Harness Notes

Transcripts

Updated 2026-11-25,

On this page

Where each harness keeps the record of past sessions, how to get back into one, and how to keep, export or remove them. Every record type and field inside a transcript is on the Transcript format page. Automatic notes carried between sessions are on the Memories page.

What is saved

Questionpichecked at 1.5.2
Where sessions are saved

Each session is one file at ~/.pi/agent/sessions/--<cwd>--/<timestamp>_<session-id>.jsonl, grouped into one folder per working directory (the path with /, \ and : turned into -). Set PI_CODING_AGENT_DIR to move the whole agent directory (sessions go to <agent-dir>/sessions/), or pick a session directory with --session-dir <dir>, PI_CODING_AGENT_SESSION_DIR, or the sessionDir setting (CLI beats env beats setting). A custom session directory is flat rather than grouped per project; Pi filters it by the cwd in each file's header.

sessionDir is honoured from a project's .pi/settings.json even before project trust is granted, so Pi can find that project's sessions.

Run /session to see the current session's file path; tool shell commands also get it as PI_SESSION_FILE.

Subagent and forked sessions

Partly

Pi has no built-in subagents. /fork, /clone and --fork write a new session file in the same project folder whose header parentSession holds the source file's path, while /tree branches stay inside the original file. The example subagent extension runs each child as pi --mode json -p --no-session, so child runs aren't saved as their own sessions.

Third-party subagent extensions can save child sessions any way they like.

Prompt history

Pi doesn't keep a separate prompt-history file. Up-arrow recall (tui.editor.cursorUp at the top of the editor, or the unbound tui.editor.historyPrevious/historyNext actions) cycles through prompts you sent in this run, and it's refilled from the user messages on the active branch when a session is opened or resumed. Your prompt history therefore comes from the session transcript.

Prompts sent with --no-session are forgotten when Pi exits.

Getting back to a session

Questionpichecked at 1.5.2
Resume or continue

Run pi --continue (-c) to reopen the most recent session for the current folder, pi --resume (-r) for a picker, or pi --session <path|id> to open a file path, exact ID or partial ID. Inside Pi, /resume switches sessions and /import <path> imports and resumes a JSONL file. pi --fork <path|id> starts a new session copied from an existing one, and --session-id <id> opens that ID in this project or creates it.

If --session matches a session from another project, Pi offers to fork it into the current folder instead of opening it.

Pi 1.3.0 restores the active tool selection from the session. --tools +name/-name modifies that restored selection; explicit tool lists, --no-tools or --no-builtin-tools override it.

Find a past session

pi --resume or /resume opens a picker for the current folder that can switch to all folders. You can type to search, and use Ctrl+P to show paths, Ctrl+S to change sort order, Ctrl+N to show only named sessions, Ctrl+R to rename and Ctrl+D to delete. Name sessions with /name or --name so they're easier to spot, and run /session to see the current file, ID, message count, tokens and cost.

Session files are plain JSONL, so grep across ~/.pi/agent/sessions also works.

Export or share

/export [path] writes the session as HTML, or as JSONL if the path ends in .jsonl (the JSONL export holds only the current branch). pi --export <session.jsonl> [output.html] turns a session file into HTML without starting a session. /share uploads the session and gives you a link. If you're signed in to Radius it creates an artifact your Radius organization can see; otherwise it creates a private GitHub gist through gh and gives you a https://pi.dev/session/#<gist-id> viewer link (change the base with PI_SHARE_VIEWER_URL).

Exports and shares can contain prompts, command output, file contents and any credentials that appeared in the conversation. Review them before sharing.

Since 1.3.0, sessionShareDestination selects auto (default: Radius when authenticated, otherwise gist), gist (always GitHub), or radius (requires Radius authentication, with no gist fallback).

Read sessions from code

The SDK (@earendil-works/pi-coding-agent) exports SessionManager with create, open, continueRecent, list, listAll, forkFrom and inMemory, plus tree and context helpers. pi --mode json -p streams a session header and then session events as JSONL on stdout. pi --mode rpc offers get_messages, get_entries (every entry, including abandoned branches and pre-compaction history, with a since cursor), get_tree, get_state (session ID and file), get_session_stats, export_html, switch_session and fork.

You can also parse the JSONL files directly; session-format.md includes a parsing example.

Keeping and removing

Questionpichecked at 1.5.2
How long they are kept

Pi keeps sessions until you delete them; there's no automatic expiry or retention setting. Delete a session by removing its .jsonl file under ~/.pi/agent/sessions/, or select it in /resume and press Ctrl+D and confirm. Pi uses the trash CLI when it's installed, so the file can be recovered.

You can't delete the session that's currently open from the picker.

A session file is only created once the session has a user or assistant message, so opening and closing Pi without chatting leaves no file.

Don't save this session

Start Pi with --no-session to keep the session in memory only; nothing is written, and the session can't be resumed after Pi exits. SDK hosts get the same thing with SessionManager.inMemory().

There's no setting that turns persistence off for every run; pass the flag (or a shell alias) each time.

--no-session can't be combined with --fork.

Cloud sync and upload

Sessions stay on local disk and aren't synced to any cloud or other device. They only leave your machine when you run /share (a Radius artifact visible to your organization, or a private GitHub gist) or choose to attach the transcript to a /bug report, which uploads to radius.pi.dev unless you export the report as a zip instead. To sync across machines yourself, point --session-dir, PI_CODING_AGENT_SESSION_DIR or sessionDir at a synced folder.

PI_OFFLINE turns off automatic network activity, but /share and /bug are things you run yourself.

Since 1.3.0, sessionShareDestination selects auto (default: Radius when authenticated, otherwise gist), gist (always GitHub), or radius (requires Radius authentication, with no gist fallback).

Notes and sources

pi, 24 sources
  • 2026-11-15 source refresh: v1.5.2 at b4afdddf44e059c67ccf5097e5317d913521b470. Source inspection, not a harness runtime probe. Historical supplements keep their independent evidence and dates.
Where sessions are saved, 7
Subagent and forked sessions, 4
Prompt history, 3
Resume or continue, 6
Find a past session, 4
Export or share, 8
Read sessions from code, 5
How long they are kept, 4
Don't save this session, 5
Cloud sync and upload, 5