Sessions
A session is a file generated by Claude for each session. Sessions are
located under ~/.claude/projects/.
List Claude sessions:
Gage scans sessions by running small programs (called scanners) that look for specific issues and provide help for resolving them.
You can view any Claude session file by running:
If you omit the ID, Gage lets you pick from a list.
Gage’s session viewer shows you low level data for each session entry. This is what scanners see when they look for issues.
Stored sessions
Gage scans a copy of each session held in its store, not the file under
~/.claude. A scan adds the sessions it selects to the store. The copy is
updated when the session grows, and it stays after Claude Code deletes the
original. gage session list --stored lists stored sessions. See
gage session.
Codex sessions
Gage also reads the sessions of the Codex CLI. Codex writes each session to a
file under ~/.codex/sessions/, or under $CODEX_HOME/sessions/ when
CODEX_HOME is set. Name the codex source to read them:
A Codex session is listed, viewed, queried, and stored as a Claude Code session is, with these differences:
- A session’s project is named for the directory the session started in, in the same form a Claude Code project has, so one directory is one project across both.
- Only sessions that a person started are listed. Sessions that Codex or Gage started on their own, such as sub-agent threads, are left out.
- Tool calls are read from the records Codex writes in its newer history mode, which Codex 0.169 uses. A session written in the older mode shows its messages and no tool calls.
- A command’s files are recorded as written when the command redirects output
to them or edits them in place with
sed -i, and as cited otherwise. A file thatapply_patchchanges is recorded as written. - A session has no cost. Codex reports token counts and no cost.
gage session moveandgage session deletedo not apply to Codex sessions.- Sessions that Codex has compressed, and a forked session’s history from before the fork, are not read.
Pi sessions
Gage also reads the sessions of the Pi coding agent. Pi writes each session to a
file under ~/.pi/agent/sessions/, or under $PI_CODING_AGENT_DIR/sessions/
when PI_CODING_AGENT_DIR is set. When PI_CODING_AGENT_SESSION_DIR is set, it
names the directory of session files itself. Name the pi source to read them:
pi:<path> reads another location. The path is a Pi agent directory, whose
sessions are under <path>/sessions, or a directory of session files.
A Pi session is listed, viewed, queried, and stored as a Claude Code session is, with these differences:
- A session’s project is named for the directory the session started in, in the same form a Claude Code project has, so one directory is one project across drivers.
- A session’s id is the one its file name carries, in the form
<time>_<id>.jsonlthat Pi gives a session file. A file with another name is not listed. Pi lets a user choose an id and keeps it unique within one project only. When two files carry one id, the newest is the session and the others are not listed. - A Pi session file holds every branch of the session. Every entry of every branch is a row, in the order of the file, and the session’s token totals and cost cover all branches, as Pi’s own totals do.
- A session’s cost is the sum of the costs Pi records for each model request. Pi estimates a cost from the model’s listed prices. A session none of whose requests carries a cost has none.
- A forked session repeats the entries of the session it was forked from, so its totals include them. In a session forked into another project, a relative path in a repeated tool call is resolved against the fork’s directory.
- A session’s title is the name it was given in Pi, and its first prompt when it has no name.
- Sessions are found in the sessions directory and one level below it. A session
that Pi wrote somewhere else, through its
sessionDirsetting or--session <path>, is found only when the source names its directory. - Session files of Pi’s format versions 1 to 3 are read as they are. Pi rewrites a file of an earlier version when it opens it, and the rewritten file updates the stored session. A file of a later version is listed with a read error that names the version.
- A line that is not a JSON object fails the session with a read error. Pi itself passes over such a line.
gage session moveandgage session deletedo not apply to Pi sessions.
Gage in Pi
gage init sets Gage up in Pi, and Pi can be the
default driver. Gage works in Pi as it does in Claude Code, with these
differences:
- The Gage skills are named
gage-blame,gage-publish, andgage-resolve, and a skill is invoked as/skill:gage-blame. Pi keeps the skills of every package under one set of names. - Pi signs in to each model provider on its own.
gage statusand the check a scan makes before it starts ask about the provider of themediummodel. - The model sizes default to Anthropic models. A Pi user of another provider
sets the sizes in the config file; see
gage config. Pi names a model as<provider>/<id>. - A scan agent takes one prompt and no later message, and a limit on its turns is not applied.
- A scan agent’s session is written under Pi’s own sessions directory while the agent runs, and is removed when the agent’s session has been stored. Session listings leave it out.
Pi has no sandbox, and gage resolve cannot assign an issue in Pi. See
Known issues.