claude-code - 💡(How to fix) Fix Docs: publish JSONL session schema for ~/.claude/projects/ [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49400Fetched 2026-04-17 08:42:12
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

The session transcripts at ~/.claude/projects/**/*.jsonl are a rich telemetry source, but there is no published schema. Anyone building performance tooling, analytics, or introspection scripts has to reverse-engineer the structure from live session files.

Root Cause

The session transcripts at ~/.claude/projects/**/*.jsonl are a rich telemetry source, but there is no published schema. Anyone building performance tooling, analytics, or introspection scripts has to reverse-engineer the structure from live session files.

Fix Action

Fix / Workaround

Current workaround

RAW_BUFFERClick to expand / collapse

Summary

The session transcripts at ~/.claude/projects/**/*.jsonl are a rich telemetry source, but there is no published schema. Anyone building performance tooling, analytics, or introspection scripts has to reverse-engineer the structure from live session files.

What would be useful

A documented schema covering:

  • Top-level record types: user, assistant, tool_result, tool_error, queue-operation, and the attachment types (deferred_tools_delta, mcp_instructions_delta)
  • For assistant records: message.model, message.content[] blocks (text, thinking, tool_use), message.usage with cache token fields, requestId, sessionId, cwd, gitBranch
  • For tool_use blocks: name, input (shape varies per tool), id, caller
  • Subagent layout: <SESSION_ID>/subagents/agent-<ID>.jsonl and .meta.json structure (agentType, description)
  • Stability guarantees: which fields are stable across versions, which may change

Use cases this unlocks

  • Performance digests (one-shot edit rate, agent-turn efficiency, model mix, activity distribution)
  • Cost/usage dashboards built from the usage field
  • Session replay and debugging tools
  • Integration with observability platforms

Current workaround

Guessing from session samples, which breaks whenever the schema evolves. A CHANGELOG entry when it does would help too.

extent analysis

TL;DR

Documenting the schema for session transcripts at ~/.claude/projects/**/*.jsonl would provide a reliable foundation for building performance tooling, analytics, and introspection scripts.

Guidance

  • Identify and document the top-level record types and their structures, including user, assistant, tool_result, tool_error, and queue-operation, to establish a clear understanding of the data.
  • Focus on documenting the assistant records, including message.model, message.content[] blocks, and message.usage with cache token fields, as these seem to be crucial for performance and usage analysis.
  • Consider creating a CHANGELOG entry whenever the schema evolves to notify users of changes and help them adapt their tools and scripts accordingly.
  • Develop a process for maintaining and updating the schema documentation to ensure it remains accurate and reliable over time.

Example

No specific code snippet can be provided without more context, but an example of how the schema documentation could be structured might look like a JSON schema definition or a table outlining the fields and their descriptions for each record type.

Notes

The lack of a published schema currently forces developers to reverse-engineer the structure from live session files, which is error-prone and breaks when the schema changes. Documenting the schema would significantly improve the reliability and maintainability of tools and scripts built on top of these session transcripts.

Recommendation

Apply a workaround by starting to document the schema based on current understanding and known record types, and request that a CHANGELOG entry be made for any future schema changes to ensure that all users can adapt their tools and scripts accordingly. This approach allows for immediate progress while acknowledging the need for ongoing maintenance and updates to the schema documentation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Docs: publish JSONL session schema for ~/.claude/projects/ [1 participants]