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.
Supported agents
| Agent | Status | Live capture | Past sessions |
|---|---|---|---|
Claude Code claude-code | Verified on real sessions | settings.json hooks | projects/<slug>/<session>.jsonl transcripts |
Codex CLI codex | Verified on real sessions | hooks.json hooks (you approve them with /hooks) | sessions/**/rollout-*.jsonl |
OpenCode 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 CLI cursor | Not run live: it needs a Cursor login or CURSOR_API_KEY | hooks.json, partial in -p mode | agent-transcripts/*.jsonl (undocumented format) |
T3 Code 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 CLI (formerly Gemini CLI) antigravity | Verified on real sessions | hooks.json | brain/<id>/…/transcript.jsonl |
Gemini CLI, older installs 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 |
GitHub Copilot CLI copilot-cli | Verified on a real install (1.0.107) | hooks/coding-sh.json | session-state/<id>/events.jsonl |
Amp amp | Not run live: it needs an ampcode.com login | plugin | None |
Pi pi | Verified on a real install (1.5.0) | extension | sessions/--<cwd>--/*.jsonl |
Factory Droid droid | Verified on a real install (1.6.0) | hooks.json | sessions/-<cwd>/*.jsonl |
Goose goose | Verified on a real install (1.57.0) | plugin hooks.json | sessions.db |
Aider 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 CLI 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 |
Any other command wrapper | Wraps any command: works the same way for any command | coding.sh run -- <cmd> | None |
What the statuses mean
| Status | Means |
|---|---|
| Verified on real sessions | Checked against sessions from a live install of the agent, as well as the CI tests. |
| Verified on a real install | The 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 live | Nobody has run it on a live install yet, for the reason given. A report that it works moves it to verified. |
| Wraps any command | Works 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
| Agent | Headless 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:
"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 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. installwon't replace another tool's status line.--forcereplaces it and keeps the old one foruninstall.coding.sh statusline uninstallputssettings.jsonback as it was beforeinstall.- 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. Itsprovidernames 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
initset 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 projectwrites.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 theantigravityadapter;gemini-clistill 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 ✓ 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 |
|---|---|
| Claude Code | SubagentStart/Stop hooks; subagents/agent-*.jsonl transcripts |
| Codex CLI | SubagentStart/Stop hooks; subagent threads in rollouts |
| OpenCode | Child sessions, linked to the parent session |
| Cursor CLI | subagentStop only (subagentStart is a permission gate, not registered) |
| T3 Code | Subagent threads become child sessions |
| Antigravity CLI (formerly Gemini CLI) | invoke_subagent tool call spans the subagent; its internals are not exposed |
| Gemini CLI, older installs | Child chat files become child sessions |
| GitHub Copilot CLI | subagentStart/Stop hooks; events inside carry the subagent id |
| Amp | Task, oracle, librarian, finder tool calls span the subagent |
| Pi | None (Pi has no subagents) |
| Factory Droid | Task tool call is the start, SubagentStop the end |
| Goose | sub_agent sessions become child sessions |
| Aider | None |
| Devin CLI | 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
beforeSubmitPromptgets{"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": truewhere the format allows), or listed in~/.coding.sh/installs.json, souninstallremoves only ours. - The original file is backed up to
~/.coding.sh/backupsbefore 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.