Skill v1.0.0
currentAutomated scan100/100version: "1.0.0" name: coding-trace-raw description: "Read and explain raw Claude Code and Codex CLI session logs in this coding-trace repo. Use when inspecting example_sessions, raw .claude/.codex JSONL records, provider record families, duplicate-looking runtime layers, raw tool-call pairing, exposed or omitted fields, token accounting records before normalization, or representative raw windows from find_representative_session_segments.py."
Coding Trace Raw
Overview
Use this skill to reason about raw coding-agent trace files before they are converted into normalized round rows. Keep the distinction clear: raw traces preserve provider-specific runtime records, while normalized traces collapse those records into one JSONL row per LLM invocation.
First Steps
- Work from the coding-trace repo root, identified by
pyproject.toml,README.md, andscripts/collect_llm_traces.py. - Identify the provider before interpreting records: Claude Code raw logs and Codex CLI raw logs have different schemas.
- Prefer the public examples for orientation:
example_sessions/claude/explanation.mdexample_sessions/codex/explanation.mdexample_sessions/claude/trace.jsonexample_sessions/codex/trace.json
- Treat public
trace.jsonexamples and generated*.expanded.jsonfiles as human-readable record dumps with separators. Individual JSON blocks are valid, but the whole expanded file is not one JSON document. - Avoid reading large private trace files wholesale. Use targeted
sed,rg,head,python -c, orscripts/find_representative_session_segments.py.
Claude Raw Logs
Claude Code raw records commonly include:
user: visible user messages and tool result messages. Tool results are stored as user records withmessage.content[]blocks of typetool_result.assistant: model output records. One assistant message can be split across several records that share the samemessage.id.attachment: auxiliary runtime context such as skill listings or task reminders.system,last-prompt,ai-title,mode,permission-mode,file-history-snapshot: UI/runtime bookkeeping, not separate LLM calls.
When interpreting Claude:
- Do not count each split
assistantrecord as a separate LLM invocation. Deduplicate by assistantmessage.idwhen reading usage. - Pair tool calls by matching assistant
tool_use.idto later usertool_result.tool_use_id. - Read token accounting from
message.usage:input_tokens,cache_creation_input_tokens,cache_read_input_tokens, andoutput_tokens. - Treat
cache_read_input_tokensas prompt-cache hit prefix tokens. - Treat
cache_creation_input_tokens + input_tokensas new prompt-side work for that API call. - Do not infer readable private thinking from
thinkingblocks. Public examples preserve that a thinking block existed, not its contents.
Codex Raw Logs
Codex CLI raw records commonly include:
session_meta: session metadata, base instructions, source, model provider, cwd, and git metadata.turn_context: per-turn runtime context such as cwd, sandbox, model, date, and collaboration mode.response_item: structured API-stream items such as messages, reasoning placeholders, function calls, and function-call outputs.event_msg: runtime/UI events such astask_started,user_message,agent_message,token_count, andtask_complete.
When interpreting Codex:
- Expect duplicate-looking layers. A user-visible message can appear as both
response_itemandevent_msg.user_message; an assistant reply can appear as bothresponse_itemandevent_msg.agent_message. - From Codex CLI 0.147 on, the main thread writes the prompt as
event_msg.item_completedwith an item of typeUserMessageinstead ofevent_msg.user_message; automatic-review rollouts wroteevent_msg.user_messageup to CLI 0.156, and from 0.158 mostly carry the request only as arole = userresponse_item, which the extractor does not read (injected context has the same shape). In the rollouts we checked, no rollout writes both prompt records. - Pair tool calls by
response_item.payload.type == "function_call"and laterfunction_call_outputrecords with the same call id. - Treat
event_msg.token_countas accounting for the preceding model round.last_token_usage.input_tokensalready includes cached tokens. - A
token_countis often written after the tool its round requested has already run. That tool output is input to the next model round, not to the round being accounted (the extractor applies this to rollouts that record turn ids). - Treat
cached_input_tokensas prompt-cache hit prefix tokens andinput_tokens - cached_input_tokensas uncached prompt-side work. - Treat
reasoning_output_tokensas a subset ofoutput_tokens, not an additional count.
Finding Examples
Use the finder when the user needs compact raw examples from local histories:
uv run python scripts/find_representative_session_segments.py --provider claude codex --export-dir artifacts/raw_windows
Useful options:
--provider claudeor--provider codexto focus one format.--min-tool-calls,--min-tool-results,--min-usage, and--min-token-countto require richer windows.--max-file-size-mb 0only when a full scan is acceptable.--export-dirto write raw JSONL, expanded text, per-record JSON, and a manifest.
Reporting Guidance
When answering raw-trace questions:
- State whether the evidence is raw-provider behavior or normalized interpretation.
- Explain duplicate-looking records as runtime layers unless the data proves an extraction bug.
- Avoid exposing private raw contents in summaries. Prefer counts, schema fields, and short paraphrases unless the user explicitly asks to inspect a public example.
- If the user wants cross-provider metrics, switch to
$coding-trace-normalizeor$coding-trace-analyzeafter identifying the raw source.