Minitrace Schema Reference

Field-by-field reference for the minitrace session JSON format

Sections

Terminology & Glossary
📖 Documentation
Navigation
23 sectionsv0.1
📄 Minitrace Schema Reference — glaze help minitrace-schema
minitrace-schema

Minitrace Schema Reference

Field-by-field reference for the minitrace session JSON format

Topicminitraceschema

Every converted session is a single JSON file conforming to the minitrace schema (currently minitrace-v0.2.0). This page documents every field, its type, and what it means.

The authoritative Go types live in pkg/minitrace/schema.go. The JSON field names match the struct tags exactly.

Session (top level)

The session is the root object in each .minitrace.json file.

FieldTypeDescription
idstringUnique session identifier, usually the original session UUID
schema_versionstringAlways minitrace-v0.2.0 for current output
profilestringSession profile, typically organic for real sessions
scenario_idstring?Reserved for synthetic/benchmark scenarios
qualitystring?Quality tier: A (rich conversation + tool I/O + >10 tools + >5 turns), B (has conversation), C (no conversation)
titlestring?Auto-extracted from the first human turn (truncated to 80 chars)
summarystring?Optional session summary
classificationstringAlways internal for locally converted sessions
provenanceobjectWhere this session came from (see below)
flagsobjectData quality flags
environmentobjectModel, framework, and tools configuration
operational_contextobjectWorking directory, git state, autonomy level
timingobjectTimestamps, duration, and time-of-day information
conditionobject?Experimental condition metadata
coordinationobjectMulti-session coordination info
handoverobjectSession handover documents
turnsarrayConversation turns in order
tool_callsarrayEvery tool invocation with input and output
eventsarray?Explicit timeline events from the source (hooks, compactions, turn durations, mode changes)
attachmentsarray?Source attachments and artifact references
context_loadsarray?Instruction and guidance files injected into the model context (see below)
outcomeobject?Success/failure of the session
annotationsarrayHuman or automated annotations
metricsobjectComputed summary metrics

Provenance

Tracks where the session came from so you can trace any converted file back to its original source.

FieldTypeDescription
source_formatstringAdapter-specific format identifier, e.g. claude-code-jsonl-v2, pi-agent-jsonl-v3, pinocchio-turns-sqlite-v1
source_pathstring?Path to the original file (home directory normalized to ~)
converted_atstringRFC 3339 timestamp of when conversion ran
converter_versionstringConverter identifier, e.g. go-minitrace-claude-adapter-dev
original_session_idstring?The session ID in the original format

Flags

Data quality signals set during conversion. Most converters set needs_cleaning: true since raw sessions are not curated.

FieldTypeDescription
for_researchboolWhether this session is flagged for research use
needs_cleaningboolWhether the session needs manual review
contains_errorboolWhether conversion detected errors in the session
contains_piiboolWhether file paths contain /home/ or /Users/ patterns
categorystring[]Free-form category tags

Environment

Captures the model and framework configuration for the session.

FieldTypeDescription
modelstring?Model identifier, e.g. claude-opus-4-6, gpt-5-nano
model_versionstring?Specific model version if available
temperaturefloat?Sampling temperature if known
tools_enabledstring[]List of tool names available in this session
system_promptstring?System prompt if captured (often null for privacy)
agent_frameworkstring?Framework name: claude-code, codex, pi, pinocchio, claude-ai, chatgpt
agent_versionstring?Framework version if available
platform_typestring?Platform category: agent, chat, etc.
provider_hintstring?API provider: anthropic, openai, unknown

Operational Context

Runtime context captured at session start. Availability depends on the source format.

FieldTypeDescription
working_directorystring?Filesystem path where the agent was running
git_branchstring?Active git branch
git_refstring?Git commit reference
autonomy_levelstring?How autonomous the agent was
sandboxbool?Whether the session ran in a sandbox
framework_configany?Adapter-specific configuration blob, typically for raw session/runtime metadata that does not fit the shared schema

Timing

Temporal information about the session. The privacy_level field controls how much timing detail is exposed.

FieldTypeDescription
privacy_levelstringAlways full for locally converted sessions
duration_secondsfloat?Wall-clock duration from first to last event
active_duration_secondsfloat?Time excluding gaps longer than 5 minutes (the idle threshold)
started_atstring?RFC 3339 start timestamp
ended_atstring?RFC 3339 end timestamp
hour_of_dayint?Hour (0–23) when the session started
day_of_weekint?Day of week (0=Monday, 6=Sunday)

Turns

The conversation transcript as an ordered array. Each turn is one message from a participant.

FieldTypeDescription
indexintZero-based position in the turn sequence
timestampstring?RFC 3339 timestamp of this turn
rolestringuser, assistant, or system. Claude Code system records with subtype compact_boundary, turn_duration or stop_hook_summary are events, not turns, so they do not count toward turn_count
sourcestring?Origin detail: human, tool_result, etc.
modelstring?Model that generated this turn (assistant turns)
content_typestring?MIME type hint for the content
input_channelstring?How the input arrived
contentstringThe actual message text
framework_metadataany?Adapter-specific turn metadata preserved from the raw transcript
tool_calls_in_turnstring[]IDs of tool calls emitted by this turn
thinkingstring?Chain-of-thought / reasoning text if captured
intent_markersobject?Whether this turn was requested, inferred, or proactive
streamingobjectWhether the turn was streamed (was_streamed, stream_log)
usageobject?Per-turn token usage (see below)

Per-turn Usage

FieldTypeDescription
input_tokensint?Tokens in the prompt
output_tokensint?Tokens in the response
cache_read_tokensint?Tokens served from cache
cache_creation_tokensint?Tokens that populated the cache
reasoning_tokensint?Reasoning/thinking tokens
tool_tokensint?Tokens consumed by tool use

Tool Calls

Every tool invocation is recorded with its input, output, and contextual position within the session.

FieldTypeDescription
idstringUnique tool call identifier
emitting_turn_indexint?Index of the turn that triggered this call
timestampstring?When the tool was invoked
tool_namestringName of the tool, for example read, edit, bash, write, grep, agent. Exact naming and casing can vary by adapter, so prefer checking real data instead of assuming one canonical case.
operation_typestringNormalized operation: READ, MODIFY, NEW, EXECUTE, DELEGATE, OTHER
inputobjectTool input (see below)
outputobjectTool output (see below)
contextobjectPosition and surrounding tool context
framework_metadataany?Adapter-specific tool call metadata preserved from the raw transcript
spawned_agentobject?If this tool call delegated to a subagent

Tool Call Input

FieldTypeDescription
file_pathstring?File path argument (normalized, ~ for home)
commandstring?Shell command if applicable
justificationstring?Tool-use rationale if the source transcript provides one
argumentsany?Full arguments blob

A practical querying note: in the normalized SQL schema, input.file_path and input.command are promoted to the file_path and command columns on tool_calls, while input.arguments is preserved as arguments_json. A safe file-oriented pattern is:

COALESCE(file_path, json_extract(arguments_json, '$.path'))

Tools such as web search may expose their key values only under arguments, for example:

json_extract(arguments_json, '$.query')

Do not assume every tool uses the same nested keys. When in doubt, inspect a bounded preview of one tool call's arguments_json first.

Tool Call Output

FieldTypeDescription
successboolWhether the tool call succeeded. A Claude Code call a PreToolUse hook blocked is false (the command never ran)
reasonstring?Why, when the source says so (SQL tool_calls.outcome_reason); see below
resultstring?Output text (truncated to 10 KB if larger)
errorstring?Error message if the call failed
exit_codeint?Process exit code when the source exposes one (native for codex exec events; parsed from the "Error: Exit code N" result string for claude-code)
duration_msint?Execution time in milliseconds. Pi, claude-code, and claude.ai derive it from the emit→result timestamps; codex parses it from exec output metadata
truncatedboolWhether the result was truncated
full_bytesint?Byte length of the full pre-truncation output (only set when truncated)
full_hashstring?SHA-256 hash of the full pre-truncation output (for deduplication)
full_referencestring?External reference to the full output
redactedbool?Whether the output was redacted
content_originstring?Where the content came from

output.reason values (Claude Code; the tool-result text is matched by prefix, so output that quotes these phrases is not misread):

ValueNative signal
hook_blockedThe command did not run. A PreToolUse hook blocked it..., or a PreToolUse hook_blocking_error attachment for the call
classifier_deniedPermission for this action was denied by the Claude Code auto mode classifier...
permission_deniedPermission to use <Tool> with command ... (permission rules)
classifier_no_verdictThe server-side auto mode classifier gave no verdict...
user_rejectedThe user doesn't want to proceed with this tool use... / ...take this action right now...
interruptedtoolUseResult.interrupted
tool_use_error<tool_use_error>... (harness validation: file not read, string not found, blocked sleep)
harness_blockedThis agent is isolated in the worktree... (worktree isolation guard)

Every value except interrupted means the tool never ran, so duration_ms for those calls measures permission, classifier or hook waiting time, not execution. For calls that did run, duration_ms still includes any permission prompt before execution: Claude Code records no approval timestamp.

SELECT outcome_reason, count(*) AS calls, sum(duration_ms) / 1000 AS waited_s
FROM tool_calls WHERE outcome_reason IS NOT NULL GROUP BY 1 ORDER BY 2 DESC;

Adapters differ in how much of this they can populate — see the fidelity matrix in go-minitrace help adapter-reference. Claude Code additionally preserves the full toolUseResult payload (stderr, interruption flags, structured results) under tool_calls[].framework_metadata.tool_use_result.

Framework-specific metadata conventions

Minitrace uses a small number of shared first-class fields plus three explicit escape hatches for source-specific detail:

  • operational_context.framework_config
  • turns[].framework_metadata
  • tool_calls[].framework_metadata

Use these when a raw field is analytically useful but not yet stable enough to become shared schema. See go-minitrace help framework-metadata-mappings for the per-adapter mapping tables.

Tool Call Context

FieldTypeDescription
position_in_sessionfloat?Normalized position (0.0 = first tool call, 1.0 = last)
tools_beforestring[]Names of the 5 preceding tool calls
time_since_last_userfloat?Seconds since the last human turn

Spawned Agent

Present when a tool call delegates to a subagent (e.g., Claude Code's Agent tool).

FieldTypeDescription
agent_typestringType of subagent
task_scopestringWhat the subagent was asked to do
sub_session_idstring?ID of the subagent's minitrace session
outcome_summarystringWhat the subagent accomplished

Metrics

Computed summary statistics. These are calculated during conversion from the turns and tool calls.

FieldTypeDescription
turn_countintTotal number of turns
tool_call_countintTotal number of tool invocations
read_countintTool calls with operation_type READ
modify_countintTool calls with operation_type MODIFY
create_countintTool calls with operation_type NEW
execute_countintTool calls with operation_type EXECUTE
delegate_countintTool calls with operation_type DELEGATE
read_ratiofloat?read_count / tool_call_count — how much the agent reads before acting
time_to_first_actionfloat?Seconds from session start to first tool call
idle_ratiofloat?1 - (active_duration / total_duration) — fraction of time spent idle
total_input_tokensint?Sum of input tokens across all turns
total_output_tokensint?Sum of output tokens across all turns
total_cache_read_tokensint?Sum of cache read tokens
total_cache_creation_tokensint?Sum of cache creation tokens
total_reasoning_tokensint?Sum of reasoning tokens
total_tool_tokensint?Sum of tool tokens
session_costfloat?Estimated cost if computable
subagent_countintNumber of subagent sessions spawned
subagent_tool_callsintTool calls made by subagents
model_switchesint?Times the model changed during the session
unique_modelsint?Distinct models used
median_response_tokensint?Median output tokens per assistant turn
max_response_tokensint?Maximum output tokens in any assistant turn
compaction_countint?Context compactions the source recorded (Claude Code compact_boundary); absent when none
total_turn_duration_msint?Sum of source-reported turn durations (Claude Code turn_duration); absent when none

Annotations

Optional human or automated labels attached to a session, turn, or tool call.

At the file-format level, annotations live inside the session JSON as the annotations array. In SQL, each annotation becomes one row in the normalized annotations table, and the normal query pattern is:

SELECT session_id, scope_type, category, title
FROM annotations

The annotation object has these fields:

FieldTypeDescription
idstringAnnotation identifier
timestampstringWhen the annotation was created
annotatorstringWho created it (human name or tool ID)
scope.typestringWhat the annotation targets: session, turn, tool_call
scope.target_idstringID of the target
content.categorystringAnnotation category
content.tagsstring[]Free-form tags
content.titlestringShort annotation title
content.detailstringFull annotation text
taxonomy_mappingsobjectMappings to minitrace, MAST, and ToolEmu taxonomies
classificationstring?Annotation classification

Annotation scope semantics

The scope object is how an annotation is attached to a concrete thing in the transcript.

scope.typescope.target_id meaning
sessionUsually the session ID itself
turnThe turn index as a string, for example 0 or 14
tool_callThe tool-call ID, for example call_Y70XEopD3Ef1mGctwTXG2CEq

This distinction matters in analysis because a session-level label answers a different question than a turn-level or tool-call-level label.

Annotation categories

The current built-in categories are:

  • observation
  • ai-failure
  • user-error
  • environment-issue
  • success
  • question
  • to-discuss
  • to-improve

Taxonomy mappings

taxonomy_mappings is an object containing arrays of codes from three different labeling systems:

FieldTypeMeaning
taxonomy_mappings.minitracestring[]Minitrace taxonomy codes such as F-AUT
taxonomy_mappings.maststring[]MAST taxonomy codes
taxonomy_mappings.toolemustring[]ToolEmu taxonomy codes

Annotation SQL columns

These are the annotations table columns you will most often use in SQL (JSON paths on the left for reference):

JSON pathSQL column
$.annotatorannotator
$.scope.typescope_type
$.scope.target_idtarget_id
$.content.categorycategory
$.content.titletitle
$.content.detaildetail
$.content.tagstags_json (JSON array text)
$.taxonomy_mappings.minitraceminitrace_taxonomy_json (JSON array text)
$.taxonomy_mappings.mastmast_taxonomy_json
$.taxonomy_mappings.toolemutoolemu_taxonomy_json
$.classificationclassification

A compact SQL example:

SELECT session_id, scope_type, category, title
FROM annotations
ORDER BY session_id;

Events

events[] holds explicit timeline records from the source. The normalized events table also contains derived rows for every turn (kind = 'turn'), tool call (tool_call) and annotation (annotation). Claude Code adds:

kindSourceturn_indexframework_metadata
hookhook_success, hook_non_blocking_error, hook_blocking_error, hook_additional_context, hook_cancelled attachments; system/stop_hook_summary— (tool_call_id names the hooked call when the source does)hook_type, hook_event, hook_name, command, exit_code, duration_ms, permission_decision, permission_decision_reason; stop hooks: commands, hook_count, hook_errors, prevented_continuation, stop_reason
compactionsystem/compact_boundaryfirst turn after the boundarytrigger (auto/manual), pre_tokens, post_tokens, duration_ms
turn_durationsystem/turn_durationthe turn it closesduration_ms, message_count
attachmentother attachment records—attachment_type
mode_change, permission_mode_change, title_changemode, permission-mode, ai-title records——

Hook events keep their attachment_id, so the attachments row still carries the raw record. Severity is error for blocking hooks and stop hooks that prevented continuation, warning for non-blocking hook errors.

-- Wall time per user turn versus time spent inside tools
SELECT e.session_id, e.turn_index,
       json_extract(e.framework_metadata_json, '$.duration_ms') AS turn_ms
FROM events e WHERE e.kind = 'turn_duration' ORDER BY turn_ms DESC LIMIT 10;

-- Compactions with their token drop
SELECT session_id, turn_index, json_extract(framework_metadata_json, '$.pre_tokens') AS pre,
       json_extract(framework_metadata_json, '$.post_tokens') AS post
FROM events WHERE kind = 'compaction';

Context loads

context_loads[] (SQL table context_loads) has one entry per instruction or guidance file the framework injected into the model context. Content stays in the source attachment; the load records size and hash.

FieldTypeDescription
idstring<attachment id>:<n> (SQL load_id)
timestampstring?When the load was recorded
turn_indexint?First turn emitted after the load, i.e. the first turn whose context includes it; absent when no turn follows
tool_call_idstring?Tool call whose result triggered the load (Claude Code nested_memory, resolved through parentUuid)
attachment_idstring?The attachments row that carried it
kindstringnested_memory (path-scoped CLAUDE.md / .claude/rules/*.md), instructions (session-start and post-compaction instruction files), invoked_skill (skill bodies re-injected after compaction)
pathstring?Home-normalized path (~/...); for invoked_skill the native skill locator such as userSettings:diary
display_pathstring?Source display path (nested_memory)
namestring?Skill name for invoked_skill, else the file base name
file_typestring?Source file type: Project, User, Local, AutoMem, ...
content_charsintUnicode code points of the injected content
content_bytesintUTF-8 bytes of the injected content
content_sha256string?Hex SHA-256 of the injected content
differs_from_diskbool?Source reports the injected text differs from the file on disk (SQL 0/1)
-- Which rule files load most often, and which tools trigger them
SELECT c.path, t.tool_name, count(*) AS loads, sum(c.content_chars) AS chars
FROM context_loads c
LEFT JOIN tool_calls t ON t.session_id = c.session_id AND t.tool_call_id = c.tool_call_id
WHERE c.kind = 'nested_memory'
GROUP BY 1, 2 ORDER BY loads DESC LIMIT 20;

Coordination

Multi-session coordination metadata.

FieldTypeDescription
project_idstring?Project this session belongs to
predecessor_sessionstring?Previous session in a chain; for a Claude Code subagent, the parent session id
concurrent_sessionsint?How many sessions were running simultaneously
human_attentionstringLevel of human oversight: active, background, unknown

Quality tiers

Quality is assigned automatically during conversion based on content richness:

  • A — Has conversation turns, tool calls with output, more than 10 tool calls, and more than 5 turns
  • B — Has conversation turns but does not meet the A threshold
  • C — No conversation turns at all

See also

  • go-minitrace help what-is-minitrace — conceptual overview
  • go-minitrace help writing-queries — how to query these fields with SQL
  • go-minitrace help adapter-reference — how each source format maps to this schema