Files
Christian Klotz 25cc5c7bf4 docs(coding-agent): refresh documentation (#9898)
* docs(coding-agent): improve getting started documentation

* docs(coding-agent): correct getting started details

* docs(coding-agent): clarify SDK entry point

* docs(coding-agent): restructure guides and references

* docs(coding-agent): improve getting started guides

* docs(coding-agent): refresh integration guides

* docs(coding-agent): improve terminal and CLI guides

* docs(coding-agent): refresh customisation guides

* docs(coding-agent): clarify project trust terminology

* docs(coding-agent): simplify customisation guidance

* docs(coding-agent): improve runtime and reference guidance

* Fix settings reference

* feat(coding-agent): add Crowdin documentation sync

* docs(coding-agent): separate CLI and slash command references

* docs(coding-agent): correct compaction reference

* docs(coding-agent): streamline package documentation

* docs(coding-agent): split RPC reference documentation

* Update configuration docs

* Shorten config docs

* docs(coding-agent): refine configuration references

* docs(coding-agent): streamline settings reference

* docs(coding-agent): clarify configuration reference

* docs(coding-agent): clarify project trust exception

* docs(coding-agent): simplify keybindings reference

* docs(coding-agent): remove Crowdin integration

* docs(coding-agent): turn themes reference into guide

* docs(coding-agent): consolidate model and authentication docs

* docs(tui): require Component.invalidate() (fixes #9358)

* docs(coding-agent): document offline catalog behavior (fixes #8684)

* docs(coding-agent): preserve established documentation routes

* docs(coding-agent): reorganize documentation navigation

* docs(coding-agent): correct audited behavior

Clarify provider, session, local-model, Termux, TUI, SDK, debug, and extension behavior. Simplify the documentation audit to report only clear user-visible contradictions.

* docs(coding-agent): fix broken documentation links
2026-09-22 16:48:19 +02:00

4.6 KiB

Sessions and Context

Pi saves a conversation as a session. The active branch of that session supplies conversation history for the next model request. Use session commands to continue work, explore another branch, or reduce the amount of history sent to the model.

Continue or switch sessions

Pi saves sessions automatically unless you start it with --no-session.

pi --continue
pi --resume

--continue opens the most recent session for the current working directory. --resume opens the session picker. In interactive mode, /resume opens the same picker and /new starts a new session.

Use /name or --name to assign a recognizable session name. Run /session to verify the current session file, ID, message count, token usage, and cost.

The session picker lets you search, rename, and delete sessions. It can also show paths, change sorting, and limit results to named sessions. See Keybindings for its shortcuts.

Choose how to branch

Pi stores entries as a tree, so returning to an earlier point does not erase the branch you leave.

Action Result Use it when
/tree Moves within the current session file Related alternatives should stay together
/fork Creates a new session from an earlier user message The alternative should become separate work
/clone Copies the active branch into a new session You want a separate copy of the current state

In /tree, select a user message to put its text back in the editor. Edit and submit it to create another branch. Selecting an assistant response or another entry continues after that entry with an empty editor.

When you leave a branch, Pi can summarize it and attach that summary to the branch you enter. This preserves relevant work from the abandoned path without including every message from it.

For the persisted tree and entry types, see Session Format.

Manage conversation context

The model receives the active branch, not every branch in the session file. Pi combines that history with the system prompt, discovered context files, available tools, and loaded skill descriptions. How Pi Works describes how those inputs are assembled.

The footer shows current context usage. When the active context approaches the model's limit, Pi normally compacts older history automatically. Compaction adds a summary and keeps recent messages. It does not delete the original session entries.

Run /compact to compact manually. You can add instructions when the summary should preserve a particular topic or decision. Configure automatic compaction and retained history through Settings.

Compaction can fail if the provider is unavailable or cannot accept the summarization request. Correct the provider problem and run /compact again. Disabling automatic compaction does not disable the manual command.

See Compaction Reference for thresholds, retained boundaries, branch-summary behavior, and extension hooks.

Control session storage

By default, Pi stores sessions under ~/.pi/agent/sessions/, grouped by working directory. Use --session-dir, PI_CODING_AGENT_SESSION_DIR, or the sessionDir setting to choose another location. The CLI option has highest precedence.

Use --no-session for an ephemeral run. An ephemeral session cannot be resumed after Pi exits.

Use --session when you already know the session path or ID. Use --fork to create a new session from an existing session before interactive mode starts.

Export or share a session

Use /export to write the current session as HTML or JSONL. Use /share to upload it and get a viewer link. Pi uses a Radius artifact when Radius authentication is configured; otherwise, it uses a private GitHub gist.

Review exported or shared sessions first. They can contain prompts, model responses, tool arguments, command output, file contents, and extension messages.

Report a bug

Run /bug [description] to prepare a private report for the Pi developers. You can include the session transcript, omit it, or ask the current model to summarize the problem. Review any transcript or generated summary because it can contain sensitive conversation data.

The report includes environment and provider configuration without credential values, plus recorded error diagnostics. Upload it through radius.pi.dev or export the same report as a zip to inspect and share yourself. Uploads do not require a login; Radius authentication attributes the report to your account so the developers can follow up. If an upload fails, Pi offers to export the zip.