Skip to content

Support new transcript structure (2026-01) #79

@cboos

Description

@cboos

Starting with Claude Code 2.1.2, sub-agent transcripts are stored like this:

/home/cboos/.claude/projects/-home-cboos-...-experiments-claude-p/
├── 256ba646-2c15-437a-98e9-4171aafd030e.jsonl
├── 29ccd257-68b1-427f-ae5f-6524b7cb6f20
│   └── subagents
│       └── agent-a2271d1.jsonl
├── 29ccd257-68b1-427f-ae5f-6524b7cb6f20.jsonl
├── 2b4ed4c0-b905-41de-9238-273db3ec737a.jsonl
├── 94604a7b-062f-4369-bdf0-da948381c3e5.jsonl
└── sessions-index.json

No more agent-*.jsonl files as sibling to the session's .jsonl. This is indeed cleaner and would be trivial to support.

This is now fixed in #80.

However, more interesting is the sessions-index.json:

{
  "version": 1,
  "entries": [
    {
      "sessionId": "2b4ed4c0-b905-41de-9238-273db3ec737a",
      "fullPath": "/...experiments-claude-p/2b4ed4c0-b905-41de-9238-273db3ec737a.jsonl",
      "fileMtime": 1769188459986,
      "firstPrompt": "Search if claude -p can make use of WebSearch and Task tool. Especially the Task with Haiku model. Summarize the findings.",
      "messageCount": 4,
      "created": "2026-01-23T17:13:37.849Z",
      "modified": "2026-01-23T17:14:19.984Z",
      "gitBranch": "",
      "projectPath": "/...experiments/claude_p",
      "isSidechain": false
    },
    {
      "sessionId": "256ba646-2c15-437a-98e9-4171aafd030e",
      "fullPath": "/...experiments-claude-p/256ba646-2c15-437a-98e9-4171aafd030e.jsonl",
      "fileMtime": 1769188864895,
      "firstPrompt": "Search if claude -p can make use of WebSearch and Task tool. Especially the Task with Haiku model. Summarize the findings.",
      "messageCount": 3,
      "created": "2026-01-23T17:19:55.498Z",
      "modified": "2026-01-23T17:21:04.893Z",
      "gitBranch": "",
      "projectPath": "/...experiments/claude_p",
      "isSidechain": false
    },
    {
      "sessionId": "94604a7b-062f-4369-bdf0-da948381c3e5",
      "fullPath": "/...experiments-claude-p/94604a7b-062f-4369-bdf0-da948381c3e5.jsonl",
      "fileMtime": 1769189427779,
      "firstPrompt": "What are the tools that are available to you (allowed or not)?",
      "messageCount": 2,
      "created": "2026-01-23T17:30:15.058Z",
      "modified": "2026-01-23T17:30:27.778Z",
      "gitBranch": "",
      "projectPath": "/...experiments/claude_p",
      "isSidechain": false
    }
  ],
  "originalPath": "/...experiments/claude_p"
}

If we'd read that, it could simplify a lot the current logic for chasing the SummaryTranscriptEntry around... Well, the summary is still a AI generated summary, so this is still better than the first prompt (but only when it's there!).

Actually, I made Claude evaluate the trade-offs, and it was clearly not looking that good for using this one:

Explored using Claude Code's native sessions-index.json as alternative
method for building combined transcripts.

Findings:
- sessions-index.json may be INCOMPLETE: found 3 entries but directory
  has 4 JSONL files (missing session with subagent)
- Provides gitBranch and isSidechain (new), but missing token counts
  and summary that our cache has
- Code simplification is marginal - still need to validate index matches
  reality and load JSONL files for content/tokens anyway

Conclusion: Not worth pursuing. If we need gitBranch, we can extract it
directly from the session JSONL files. Keep directory scanning as primary
discovery method.

Not to mention this would be at odds with our session management (well, let's also hope that when we remove one session referenced in sessions-index.json, this won't raise errors on the claude side).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions