Skip to main content

Transcript Format

A transcript is a text file with one JSON object on each line. Each object is a message, or a note about the session. Claude Code appends a line as things happen. So a crash loses little. The official docs say the format is internal and changes between versions. So a script that reads it can break. Do not edit the file. For scripts, use /export or print mode output.

Where Files Live​

Source: Explore the .claude Directory: Application Data.

  • ~/.claude/
    • history.jsonl every prompt you typed
    • projects/
      • <project>/
        • <session>.jsonl the transcript
        • <session>.orphaned-<time>-<id>.jsonl set aside, not in the picker
        • <session>.jsonl.superseded-<time> set aside, not in the picker
        • <session>/
          • subagents/ one transcript per subagent
          • tool-results/ large tool outputs and MCP images

The <project> name is the folder path. In it, - replaces every character other than a letter or a digit. CLAUDE_CONFIG_DIR moves ~/.claude. See Sessions and Storage for cleanup and resume rules.

Most lines carry uuid and parentUuid. The parentUuid field points to the line before. So the lines form a chain. A branch or a rewind makes a second child for one parent. The last-prompt line holds a leafUuid that marks the tip the picker uses.

Common Fields​

These keys appear on user, assistant, attachment, and system lines.

FieldStatusMeaning
type
Undocumented: Only the program shows this item. It can change without notice.
The line type (see the next section).
uuid
Undocumented: Only the program shows this item. It can change without notice.
ID of the line. The same in the file and in every later read.
parentUuid
Undocumented: Only the program shows this item. It can change without notice.
uuid of the line before. null for the first line.
sessionId
Undocumented: Only the program shows this item. It can change without notice.
The session ID. Also written as session_id on some lines.
timestamp
Undocumented: Only the program shows this item. It can change without notice.
When Claude Code wrote the line, in ISO form.
cwd
Undocumented: Only the program shows this item. It can change without notice.
The working folder.
gitBranch
Undocumented: Only the program shows this item. It can change without notice.
The git branch at the time, if any.
version
Undocumented: Only the program shows this item. It can change without notice.
The Claude Code version that wrote the line.
entrypoint
Undocumented: Only the program shows this item. It can change without notice.
The host that started the session, such as cli or sdk-cli. See Architecture.
userType
Undocumented: Only the program shows this item. It can change without notice.
The kind of user account.
isSidechain
Undocumented: Only the program shows this item. It can change without notice.
true on lines that belong to a subagent branch.
isMeta
Undocumented: Only the program shows this item. It can change without notice.
true on a user-side row the person did not type, such as a reminder.

Line Types​

All rows are

Undocumented: Only the program shows this item. It can change without notice.
, because no docs page lists the line types. The key lists come from transcripts that 2.1.305 wrote on a real machine and in a stub run, and the meanings from the program and its type file where they are clear.

typeMain keysMeaning
usermessage, promptId, permissionMode, permissionDecision, toolUseResult, sourceToolAssistantUUID, origin, promptSource, turnOrigin, turnPosition, sandboxedA user turn or a tool result. Since 2.1.307 a shell tool result can carry sandboxed, whether the command ran in the sandbox (the program, and probe print.transcripts.lines).
assistantmessage, requestId, requestRef, requestedModel, effort, perTurnEffort, advisorModel, apiBlockIndexA reply of the model.
systemsubtype, content, level, durationMs, messageCountA note that the model never reads.
attachmentattachment, rendered, renderedRole, renderedInHumanTurn, renderedBesideToolResultContext that Claude Code adds beside the conversation. rendered is the text the model sees and renderedRole is user or system. renderedBesideToolResult is true on a remote_session_change attachment, and renderedInHumanTurn is on a queued_command attachment whose text differs inside a human turn (the program).
queue-operationoperation, content, commandUuid, deliveryId, reasonA prompt or command that waits in the queue.
api-requestparams, shapeHash, cacheControl, requestDigest, querySource, base, keep, tail, idThe shape of one request.
api-request-shapeshape, shapeHashThe system and tools of a request, stored once.
api-request-blobhash, messageA message stored by its hash.
file-history-snapshotmessageId, snapshot, isSnapshotUpdateA file checkpoint for rewind.
file-history-deltamessageId, snapshotMessageId, backup, trackingPathA change to a checkpoint.
last-promptlastPrompt, leafUuidThe last prompt, for the picker.
ai-titleaiTitleThe title that the model made for the session.
modemodeThe mode of the session. Seen value: normal.
permission-modepermissionModeThe permission mode. Seen value: auto.
cost-statetotalCostUSD, totalAPIDuration, totalAPIDurationWithoutRetries, totalToolDuration, totalDuration, totalLinesAdded, totalLinesRemoved, modelUsage, hasUnknownModelCost, startTimeTotals for cost and time. Since 2.1.311, each modelUsage entry also has cacheCreationEphemeral5mInputTokens and cacheCreationEphemeral1hInputTokens (see Stream JSON Messages).
atis-latchatisThe atis value of the session's feature-flag client, Claude Code keeps it once per conversation, so it stays the same. Claude Code sends it as the x-cc-atis header. Empty without a flag value (it was empty in our stub run).

Lines of types file-history-snapshot, file-history-delta, last-prompt, ai-title, mode, permission-mode, cost-state, atis-latch, and queue-operation carry sessionId but not the chain fields.

Other Types in the Writer​

These names are in the program next to the writer. The meanings come from the writer and reader code (source: the program), not from example lines.

typeMain keysMeaning
custom-titlecustomTitleThe title you set, for example with /rename.
agent-name, agent-colorThe name and color of the session's agent. /rename, /color, or an agent sets them.
agent-settingThe agent definition that the session runs as, for example from --agent.
tagtagA tag on the session.
worktree-stateworktreeSessionThe worktree that the session works in. null after it ends.
pr-linkprNumber, prUrl, prRepository, timestampTies the session to a pull request.
bridge-sessionbridgeSessionId, lastSequenceNum, sessionGroupingId, owner idsThe Remote Control link.
content-replacementreplacements, agentIdRecords which large tool results a short stand-in replaced. A resume then uses the same stand-ins.
attribution-snapshotmessageIdA snapshot of file-contribution data for commits. On load the program keeps only the last one and trims a large one. In 2.1.312 the program exports its writer function and no code calls it, so only older sessions hold these lines (the program).
fork-context-refagentId, parentSessionId, parentLastUuid, contextLengthA forked agent's pointer to its parent. The fork reads the parent's lines and does not copy them.
observer-refobserverTaskId, observerAgentType, agentId, timestampAn observer agent's pointer.
progresstoolUseID, parentToolUseID, dataProgress of a running tool, hook, skill, or agent. data.type is hook_progress, tool_heartbeat, bash_progress, powershell_progress, agent_progress, agent_api_retry, skill_progress, search_results_received, query_update, workflow_log, workflow_phase, workflow_agent, or artifact_publish_retry.
isolation-latchsideRecords a one-time choice about where the session runs, kept for resume.
memory-modemode, afterUuid, reason, accountA stamp that auto memory switched mode. One per switch.
dev-modsfolderThe folder of a mod under development that the session uses.
frame-linkpath, frameUrl, title, artifactCountA link from the session to an artifact page.
ended-by-modeltimestampMarks that the model ended the session.
line-withheldbytesNot a stored type. When a transcript is uploaded, {"type":"line-withheld","bytes":N} replaces a line that could not be read or was too large.
artifact-autoreact-ledgerartifacts, accountUuid, vBookkeeping for automatic replies to artifact comments.
relocatedrelocatedCwdThe working folder was moved.
summaryleafUuid, summaryA summary line. The program reads these lines on load, and no code in 2.1.312 writes them, so only older sessions hold them.
continued-incontinuedInSessionIdPoints to the session that continued this one.
history-suppression, artifact-comment-monitorAlso in the program's table. We read no further meaning.

proactivity and language are not line types. They are kinds of attachment (attachment.type). proactivity carries status, level, and tools. language carries the reply language.

On resume the program applies a replay policy to each type. Unknown types add up.

  • Last line wins: most types in the lists above, including atis-latch.
  • Add up: content-replacement, fork-context-ref, frame-link, artifact-comment-monitor, and memory-mode.
  • Dropped at a compact boundary: progress, file-history-snapshot, file-history-delta, last-prompt, continued-in, api-request-shape, api-request-blob, and api-request.

The message Object​

On user and assistant lines, message holds an API message.

FieldWhereMeaning
rolebothuser or assistant.
contentbothA string (a typed prompt), or an array of blocks.
id, model, typeassistantThe API message ID, the model that answered, and message.
stop_reason, stop_sequence, stop_detailsassistantWhy the model stopped. Seen values: tool_use, end_turn.
usageassistantToken counts (next table).
container, context_management, diagnostics, input_transformationsassistantExtra fields of the API reply.

Content block types seen: text, thinking, tool_use (in assistant lines), and text, tool_result (in user lines).

The usage Object​

FieldMeaning
input_tokens, output_tokensTokens read and written.
cache_creation_input_tokens, cache_read_input_tokensTokens written to and read from the prompt cache.
cache_creationA break-down of cache writes by lifetime.
output_tokens_details, iterationsMore detail about output and about repeated passes.
server_tool_useCounts of server-side tool calls.
service_tier, speed, inference_geoThe tier, the speed mode, and the region of the call.
fallback_creditPresent when a fallback model answered.

user Line Fields​

FieldMeaning
promptIdGroups the lines of one prompt.
permissionModeThe permission mode when the prompt was sent.
permissionDecisionOn a tool result: an object with decision (seen: accept), source (seen: config), and reasonType (seen: classifier, mode).
toolUseResultThe structured result of a tool. Its keys depend on the tool. Seen for Bash: stdout, stderr, interrupted, isImage. Seen for edits: filePath, structuredPatch, originalFile, userModified. Seen for Agent: agentId, status, outputFile, isAsync.
sourceToolAssistantUUIDuuid of the assistant line whose tool_use this answers.
originWho caused the line. Seen kinds: human, peer (a subagent hand-back).
promptSourceHow the prompt came in. Seen: typed.
turnOrigin, turnPositionWhere the turn came from and its place in the chain.
queueSkipAttachments, queueSkipSlashCommandsSet on queued prompts that skip those steps.

assistant Line Fields​

FieldMeaning
requestIdThe request ID from the API.
requestRefA reference to the matching api-request line.
requestedModelThe model Claude Code asked for. The message.model field shows the model that answered.
effort, perTurnEffortThe effort level of the call. Since 2.1.312, effort is the level in force: if the conversation already holds an effort change that the model applied, the request uses that level, not a newly picked one. The program reads effort from output_config.effort of the request it built (chunk-r5cyd28m.js lines 135670 and 136924). In 2.1.311 it was built from the new pick (chunk-2ht8z368.js line 134537).
advisorModelThe advisor model, if the advisor tool was on.
apiBlockIndexThe index of this block in the API reply. One reply can produce several lines.
thinkingDisplay, thinkingDurationMsHow Claude Code showed the thinking text, and how long it took.
serverClassifierRequest, wireToolInputs, wireIngestContextInternal fields about classifier calls and tool input on the wire.

system Subtypes​

subtypeExtra keysMeaning
turn_durationdurationMs, messageCount, pendingBackgroundAgentCountHow long a turn took.
local_commandcontent, level, commandRunThe output of a local slash command.
informationalcontent, levelA notice for the user.
compact_boundary(see Context and Compaction)Marks where a compaction replaced the history.

attachment Types​

An attachment line holds an object in attachment with a type key. Types seen in real 2.1.305 transcripts: total_tokens_reminder, output_style, output_style_instructions, queued_command, edited_text_file, skill_listing, agent_listing_delta, deferred_tools_delta, deferred_tools_record, mcp_instructions_delta, environment, date, model, session_context, instructions, auto_mode, credential_org, prompt_snapshot, silent_turn_reminder, nested_memory, and file. goal_status and remote_session_change were not seen there. A 2.1.305 stub run showed total_tokens_reminder, output_style, output_style_instructions, nested_memory, skill_listing, agent_listing_delta, deferred_tools_delta, environment, date, model, session_context, instructions, auto_mode, prompt_snapshot, and remote_session_change:

attachment.typeMeaning
total_tokens_reminderA reminder of the token budget.
output_style, output_style_instructionsThe active output style.
queued_commandA prompt that was queued while a turn ran.
nested_memoryA nested CLAUDE.md that Claude Code loaded.
skill_listingThe list of skills.
agent_listing_delta, deferred_tools_delta, mcp_instructions_deltaChanges to agents, deferred tools, or MCP instructions.
deferred_tools_recordA record of deferred tools.
edited_text_fileA note that a file changed outside the model.
environment, date, model, session_context, instructionsEnvironment and session facts.
remote_session_changeThe commit and pull request attribution text for git, as a reminder to the model.
goal_status, auto_mode, credential_org, prompt_snapshot, silent_turn_reminderState of a goal, auto mode, the account, the prompt snapshot, and a reminder after a silent turn.

The Mod API type SessionAppendMessage lists the name of an attachment as queued_command, nested_memory, and similar, and notice names such as compact_boundary and local_command.

queue-operation Values​

The operation key was seen as enqueue, dequeue, and remove. A remove line carries reason.

File History Lines​

A file-history-snapshot line holds snapshot with messageId, timestamp, and trackedFileBackups. /rewind and --rewind-files use these to restore files. Claude Code keeps the newest 100 checkpoints.

api-request Lines​

The params object of an api-request line has these keys: model, max_tokens, thinking, output_config, context_management, safeguards, and betas. The system and tools parts are in a separate api-request-shape line with the same shapeHash. Claude Code stores large messages once in api-request-blob lines. Lines refer to them by hash. See Request and Cache.

Example​

Count the lines by type to see what a session holds:

jq -r .type ~/.claude/projects/<project>/<session>.jsonl | sort | uniq -c

List the tools the model called, in order:

jq -r 'select(.type=="assistant") | .message.content[]? | select(.type=="tool_use") | .name' \
~/.claude/projects/<project>/<session>.jsonl
warning

The file is plain text. A secret that a tool prints goes into it. Set cleanupPeriodDays low, or CLAUDE_CODE_SKIP_PROMPT_HISTORY, if that matters to you.

Exact Fields​

The exact fields are in this schema: https://clawdipedia.cc/schemas/claude-code-transcript.json, with one definition for each line type. The program builds this payload in code, not with a validator. So the schema comes from that code. A field marked x-unverified has a type that the code does not show. A field marked x-observed is a field that a probe saw. It lists every field of this release. Build on the fields it names. Look each one up there before you rely on it.