Docs Coding agents
View as Markdown

Record Claude Code, Codex and other coding agents

Claude Code, Codex, Cursor, OpenCode, Pi, T3 Code and more: how each one is recorded with no code changes, and what you get.

coding.sh init finds the coding agents on your machine, installs capture for each one, and imports their past sessions. Your own agent is recorded with the SDK or OpenTelemetry instead.

npx coding.sh          # Windows: npx -p coding.sh codingsh
coding.sh doctor       # checks each agent's capture

coding.sh sessions then lists every agent's sessions together. Each adapter keeps your agent's config as it was, apart from the entries it adds, and coding.sh uninstall removes only those. On Windows, type npx -p coding.sh codingsh for npx coding.sh, and in PowerShell and cmd, codingsh for an installed coding.sh.

The coding.sh viewer showing a Claude Code session on the coding.sh repo: its title, agent, model, duration and cost, then each step in order with its time. The failed npm test step and its result, 41 passed and 1 failed, are highlighted.
A Claude Code session in the viewer. The failed test run is highlighted.

Supported agents

Agent Status Live capture Past sessions

claude-code
Verified on real sessions settings.json hooks projects/<slug>/<session>.jsonl transcripts

codex
Verified on real sessions hooks.json hooks (you approve them with /hooks) sessions/**/rollout-*.jsonl

opencode
Verified on a real install (1.19.5) plugin (2.x and 1.x) opencode.db (1.x and 2.x), JSON storage (older 1.x)

cursor
Not run live: it needs a Cursor login or CURSOR_API_KEY hooks.json, partial in -p mode agent-transcripts/*.jsonl (undocumented format)

t3code
Verified on a real install (0.1.7, driving Pi) its Codex and Claude Code hooks, tagged as T3 ~/.t3/userdata/statev2.sqlite (and v1 state.sqlite)

antigravity
Verified on real sessions hooks.json brain/<id>/…/transcript.jsonl

gemini-cli
Not run live: Gemini CLI moved to Antigravity CLI; this adapter reads sessions from older installs settings.json hooks tmp/<slug>/chats/*.jsonl

copilot-cli
Verified on a real install (1.0.107) hooks/coding-sh.json session-state/<id>/events.jsonl

amp
Not run live: it needs an ampcode.com login plugin None

pi
Verified on a real install (1.5.0) extension sessions/--<cwd>--/*.jsonl

droid
Verified on a real install (1.6.0) hooks.json sessions/-<cwd>/*.jsonl

goose
Verified on a real install (1.57.0) plugin hooks.json sessions.db

aider
Verified on a real install (0.86.2) coding.sh run -- aider … (each reply's tokens and cost from Aider's analytics log) None

devin
Not run live: it needs a Devin login; without one, 3000.14 recorded only a session's start, prompt and end config.json hooks, or .devin/config.local.json for one project None

wrapper
Wraps any command: works the same way for any command coding.sh run -- <cmd> None
What the statuses mean
StatusMeans
Verified on real sessionsChecked against sessions from a live install of the agent, as well as the CI tests.
Verified on a real installThe release in brackets was installed and ran a session, its hooks fired and coding.sh recorded it. It has not been checked on day-to-day sessions yet.
Not run liveNobody has run it on a live install yet, for the reason given. A report that it works moves it to verified.
Wraps any commandWorks for any command, so there is no agent release to check.

If you use an agent that is not run live, an agent support report saying whether it worked moves it to verified.

The commands eval runs use
AgentHeadless command
Claude Code claude -p --output-format stream-json
Codex CLI codex exec --json
OpenCode opencode run --format json
Cursor CLI agent -p --output-format stream-json
T3 Code None. It is a desktop app that runs codex app-server or the Claude Agent SDK.
Antigravity CLI (formerly Gemini CLI) agy -p --output-format stream-json
Gemini CLI, older installs gemini -p -o stream-json
GitHub Copilot CLI copilot -p --output-format=json
Amp amp -x --stream-json
Pi pi -p --mode json
Factory Droid droid exec -o json
Goose goose run --output-format stream-json
Aider aider --message … --yes-always --no-stream
Devin CLI devin -p --permission-mode dangerous
Any other command The command you pass to coding.sh run

Claude Code

init adds hooks to settings.json and registers the coding.sh MCP server. Past sessions come from the transcripts under projects/.

Show cost and flags in the status line

This puts the model, the session's cost, today's cost across all sessions, and the worst failure flag under the prompt:

coding.sh statusline install

It writes this block into your Claude Code settings.json, and the line appears on the next turn:

settings.json
"statusLine": { "type": "command", "command": "coding.sh statusline", "padding": 0 }

Claude Code runs the command each turn with the session id on stdin. To see the line yourself:

echo '{"session_id":"a3d1261b-fb5a-46a2-a110-4545fe7768fd","model":{"display_name":"Opus 5.5"}}' | coding.sh statusline
output
Opus 5.5  ·  $0.0011 session  ·  $0.2867 today
  • A flag shows only for a real failure, never for a tag such as skill:pdf. The flag part is left out when there is none.
  • install won't replace another tool's status line. --force replaces it and keeps the old one for uninstall.
  • coding.sh statusline uninstall puts settings.json back as it was before install.
  • The command needs coding.sh on your PATH. It exits 0 even when something is wrong. Without a session id on stdin it still prints today's cost, and when the store can't be opened it prints nothing.

Codex CLI

Codex runs new hooks only after you approve them. After init, start codex, run /hooks and approve the coding.sh hooks once. coding.sh never approves them for you; eval runs pass --dangerously-bypass-hook-trust inside their own CODEX_HOME.

T3 Code

T3 Code is a desktop app that runs other agents: Codex, Claude Code, OpenCode, Cursor, Pi, Grok and ACP agents. It needs no hooks. coding.sh reads copies of its databases (statev2.sqlite, and the older state.sqlite) before each read and never writes to them.

coding.sh sessions --where agent:t3code
coding.sh sessions --where 'agent:t3code provider:codex'
coding.sh usage --by agent-model --since 30d
  • Each thread is one session under the agent t3code. Its provider names the agent T3 Code ran.
  • A thread that ran Codex or Claude Code is the same session as that agent's own transcript, so it shows once. Let init set up those two agents for live capture.
  • For Grok and ACP agents, the content and the tokens per turn come from T3 Code's store.
  • Switching a thread to another agent, and a T3 subagent thread, each make a child session.
  • T3 Code has no headless mode, so an eval runs the agent it ran. Pass --agent:
coding.sh eval init --session <session-id> --agent codex --verifier 'npm test'

coding.sh finds T3 Code when ~/.t3/userdata exists ($T3CODE_HOME/userdata when set) or, on macOS, when it is in /Applications.

Pi

init writes one file, the extension ~/.pi/agent/extensions/coding-sh.ts, and imports the sessions in ~/.pi/agent/sessions. Pi loads extensions when a session starts, so start a new one to record live.

coding.sh init --agent pi
coding.sh sessions --where agent:pi
  • The extension only listens: it can't block or change a prompt or a tool call.
  • Each model call keeps Pi's own cost, so Pi's figures are not estimates.
  • Thinking blocks are not stored. Pi has no subagents.
  • --scope project writes .pi/extensions/coding-sh.ts, which Pi loads headless only in a trusted project or with --approve.

Evals run pi --mode json --approve in their own agent directory with a copy of your auth.json:

coding.sh eval init --sessions --agent pi --verifier 'npm test'
coding.sh eval run failures --yes

Other agents

  • Cursor CLI also runs Claude Code hooks from .claude/settings.json. The Claude Code adapter drops those, so each Cursor event is stored once.
  • Antigravity CLI (agy) replaced Gemini CLI. Use the antigravity adapter; gemini-cli still reads older installs.
  • Amp keeps threads on its servers, so there are no past sessions to import.
  • Goose hooks carry no model or tool output. Importing past sessions adds them.
  • Aider has no hooks. Run it as coding.sh run -- aider …, which reads each reply's tokens and cost from Aider's analytics log.
  • Devin CLI also runs Claude Code's hooks. coding.sh records those calls as Devin's, and skips one when its Devin hook records the same event, so each event is stored once. Past sessions are not imported.

Record any other command

coding.sh run -- <cmd> records any command as a session: start, end, exit code, duration and the files it changed, from git snapshots taken before and after. It records no prompts, tool calls or tokens.

coding.sh run -- sh -c 'echo "# Notes" > NOTES.md'
coding.sh show latest
output
✓ Captured session 9024a965-6745-4a31-a9d2-23d4d44f34f3 (the command ran 26ms, exit 0)
9024a965-6745-4a31-a9d2-23d4d44f34f3
  Session       9024a965-6745-4a31-a9d2-23d4d44f34f3
  Agent         wrapper
  Repo          /work/demo (main)
  Started       Nov 21 15:57 (1s ago)
  Duration      280ms
  Turns         0, 0 tool calls, 1 file changed
  Flags         no-verification
  Snapshot      246210b → 7444234: 1 file (+1 -0): NOTES.md

    +0ms  session.start
  +280ms  file        add NOTES.md
  +280ms  session.end exit

Cline CLI, Kiro CLI, Qwen Code, Crush have no adapter yet; record them this way. Kiro's OpenTelemetry export is daily account totals, so the receiver can't use it.

Subagents

A subagent is a subagent.start and subagent.end pair in the parent session. When the agent keeps a separate transcript for it, that becomes a child session. coding.sh sessions --subagents lists child sessions and coding.sh tree <id> shows the tree.

Agent How subagents are captured
SubagentStart/Stop hooks; subagents/agent-*.jsonl transcripts
SubagentStart/Stop hooks; subagent threads in rollouts
Child sessions, linked to the parent session
subagentStop only (subagentStart is a permission gate, not registered)
Subagent threads become child sessions
invoke_subagent tool call spans the subagent; its internals are not exposed
Child chat files become child sessions
subagentStart/Stop hooks; events inside carry the subagent id
Task, oracle, librarian, finder tool calls span the subagent
None (Pi has no subagents)
Task tool call is the start, SubagentStop the end
sub_agent sessions become child sessions
None
run_subagent tool call spans the subagent; its internals are not exposed
The hook command

Every adapter installs the same command:

/bin/sh "/Users/you/.coding.sh/bin/hook.sh" <agent-id> <EventName>   # absolute, quoted path
node "C:/Users/you/.coding.sh/bin/hook.mjs" <agent-id> <EventName>      # on Windows
  • It exits 0 every time and prints nothing, unless an agent's protocol needs a reply (Cursor's beforeSubmitPrompt gets {"continue":true}).
  • It never answers a permission question. Events where an agent reads a hook's silence or exit code as a decision are not registered.
  • Entries are marked ("_codingsh": true where the format allows), or listed in ~/.coding.sh/installs.json, so uninstall removes only ours.
  • The original file is backed up to ~/.coding.sh/backups before every edit.

Record every model call

Hooks and transcripts record what an agent did. To also keep what it sent the model, the full system prompt, tools and messages of each call, run coding.sh init --proxy. See Log every model call with the proxy.

Next steps