When your autonomous AI terminal agent refactors 15 files, executes 25 bash commands, and runs test suites—how does it persist that execution trajectory? Here is a complete architectural analysis of transcript.jsonl, event schemas, prompt cache economics, and every native CLI option to view and resume sessions.
Developers often ask: Why did Anthropic and OpenAI choose JSON Lines (JSONL) instead of a single history.json or an embedded SQLite database for terminal session logging?
The decision reflects core constraints in building streaming agentic runtimes:
[{...}]), saving turn 100 would require parsing, re-serializing, and writing several megabytes of history on every tool execution.SIGINT (Ctrl+C), or your laptop battery dies, a monolithic JSON file gets permanently corrupted by an unclosed bracket. In JSONL, every prior line is already valid JSON.readline or Web Workers) inspect events line-by-line with $O(1)$ memory consumption.Each line in a Claude Code or Codex transcript represents an atomic turn in the execution cycle. Below are the key event types you encounter:
USER_INPUT){
"step_index": 1,
"source": "USER_EXPLICIT",
"type": "USER_INPUT",
"status": "DONE",
"timestamp": "2026-10-03T14:22:10.450Z",
"content": "Add idempotent webhook retry logic to payment_service.go with exponential backoff."
}
PLANNER_RESPONSE){
"step_index": 2,
"source": "MODEL",
"type": "PLANNER_RESPONSE",
"status": "DONE",
"content": "I need to inspect payment_service.go to locate WebhookHandler and check database transactions.",
"tool_calls": [
{
"name": "run_command",
"args": {
"CommandLine": "grep -n 'func WebhookHandler' payment_service.go"
}
}
],
"usage": {
"input_tokens": 1420,
"cache_read_input_tokens": 1280,
"output_tokens": 86
}
}
Notice the cache_read_input_tokens metric: Modern agent runtimes rely heavily on prompt caching. Continuing an existing session reuses warm cache blocks, reducing API costs by up to 90% and speeding up response generation.
TOOL_RESULT){
"step_index": 3,
"source": "SYSTEM",
"type": "TOOL_RESULT",
"status": "DONE",
"content": "42:func WebhookHandler(w http.ResponseWriter, r *http.Request) {\n",
"exit_code": 0
}
Both Claude Code and OpenAI Codex provide built-in command-line options to list, inspect, and resume previous sessions:
| Command | Shorthand | Execution Mechanics |
|---|---|---|
claude --resume |
claude -r |
Launches an interactive terminal UI (TUI) listing previous sessions in the current directory. |
claude --resume <id> |
claude -r <id> |
Immediately mounts and rehydrates the specific session matching <id>. |
claude --continue |
claude -c |
Headless resume: continues the latest session in the current folder without displaying a picker. |
codex resume |
— | Scans ~/.codex/sessions/ and launches the interactive Codex session picker. |
codex list |
— | Prints a summary table of recent session IDs, token totals, and execution durations. |
~/.claude/projects/<sanitized-repo-path>/transcript.jsonl%USERPROFILE%\.claude\projects\<sanitized-repo-path>\transcript.jsonl~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl and ~/.codex/memories.sqlite~/Library/Application Support/Code/User/workspaceStorage/<hash>/chatEditingSessions/jqBecause JSONL consists of individual line-delimited records, you can audit your agent's activity with fast shell one-liners:
jq -r 'select(.type=="USER_INPUT") | "\(.timestamp) ❯ \(.content)"' transcript.jsonl
jq -r 'select(.type=="PLANNER_RESPONSE") | .tool_calls[]? | select(.name=="run_command") | .args.CommandLine' transcript.jsonl
jq -s '
map(.usage // empty) | {
total_input: map(.input_tokens // 0) | add,
cache_read: map(.cache_read_input_tokens // 0) | add,
hit_rate: ((map(.cache_read_input_tokens // 0) | add) / (map(.input_tokens // 0) | add) * 100 | round)
}
' transcript.jsonl
While claude -r is invaluable inside a single repository, software engineers frequently work across multiple microservices, repositories, and documentation trees in a single afternoon.
The native CLI tools cannot search across repositories or perform full-text searches inside past tool outputs. L2Cache for Mac indexes every transcript.jsonl and rollout-*.jsonl into an embedded, high-performance SQLite FTS5 index:
⌥ Space): Search any prompt, regex, shell command, or model output across all projects simultaneously.L2Cache provides a suite of 66 client-side developer utilities that process data entirely in your browser with zero server uploads:
transcript.jsonl files in a visual browser timeline. Filter by user prompts, bash commands, and view token usage graphs.