pulsemcp/ai-artifacts/decompose-agent-transcript-into-transcript-segments
Claude Code and agent skill by pulsemcp/ai-artifacts
- community
Checking that the SKILL.md file is still in the repository.
Given the tmp folder produced by get-claude-code-transcript-from-local (containing transcript.json — an OpenTranscripts Transcript document), decompose the transcript into a recursive tree of Transcript Segments (see the transcript-segment reference). Each Segment carries a Trigger (kind: New | Correction × source: user | agent | subagent), a Goal (Plan | Action), an Outcome (Success | Failure), child sub-segments, and a meta block (event range, wall-clock, tokens, model). Emits segments.json (structured) and flamegraph.html (annotated). All phase-3 analyzers read segments.json — they never walk transcript.json events directly. Use this skill immediately after acquisition and before any analyze-* skill.
Install
npx vskill@latest install pulsemcp/ai-artifacts/decompose-agent-transcript-into-transcript-segmentsSKILL.md
Decompose into transcript segments
The Transcript Segment primitive (defined in the transcript-segment reference) is the spine of every downstream analyzer. This skill is the only thing that produces it.
Inputs
tmp_dir(required): output ofget-claude-code-transcript-from-local. Must containtranscript.json(an OpenTranscriptsTranscriptdocument, possibly with nested subagents).
Outputs
Two files written into tmp_dir:
- `segments.json` — the structured tree. Schema and a worked example live in the `transcript-segment` reference under "`segments.json` schema" and "Example" — they are the contract this skill must hit. Validate against the rules listed there (exactly one Trigger/Goal/Outcome per Segment;
trigger.event_idpoints at a real event id whensource ∈ {user, subagent}; children cover the parent'sevent_rangewith no gaps or overlaps; deterministicids). - `flamegraph.html` — annotated flamegraph. X = wall-clock, Y = Segment depth. Color = Outcome (green Success, red Failure). Badge = Correction trigger at head, with the badge variant indicating
source: uservssource: agent. Hover/click reveals Goal text and meta.
Both must agree. Downstream skills read segments.json; humans look at flamegraph.html.
Sequencing checklist
- [ ] Load
transcript.jsonfromtmp_dir. Walk the recursive structure: the root Transcript'sevents[]plus everysubagents[*].events[](recursively) - [ ] Identify segment boundaries by following the
## Segmentation methodologysection of thetranscript-segmentreference. That section is the source of truth — boundary triggers (newUserMessageevent,SubagentSpawnevent, within-run topic/file shift), the leaf-stop rule, and what a Segment is not all live there - [ ] Label each segment's Goal in one sentence and classify it as Plan (figuring out) or Action (doing/changing state). When ambiguous, default to Plan
- [ ] Label each segment's Outcome as Success or Failure against its own Goal — not against a higher Goal. A successful sub-step under a failed parent is Success
- [ ] Recurse: every segment's children must collectively cover its
event_range - [ ] Compute
metaper segment: event_range (first/last event ids), wall-clock, tokens in/out (sum ofAssistantMessage.usage.input_tokens/output_tokensfor events in range), model used,source_transcript_id(the OT Transcript whoseevents[]this Segment covers) - [ ] Emit
segments.jsonand the annotatedflamegraph.html - [ ] Print both paths to stdout for the orchestrator
Heuristics for labeling
- Correction triggers from the user:
UserMessageevents whose content contains "actually", "no, I meant", "that's wrong", "you missed", or that re-issue a similar instruction to the prior turn, gettrigger.kind = Correction(withtrigger.source = user). Otherwisekind = New - Correction triggers from the agent: agent-source pivots that explicitly walk back prior work ("that didn't work, let me try X", agent reads a
ToolResultwithis_error: trueand abandons the approach, revert of prior edits) gettrigger.kind = Correction(withtrigger.source = agent). Plain sequencing into the next step of the plan stayskind = New - Failure Outcome (most reliable signal): a Correction trigger at the next segment's head retroactively marks the prior segment as Failure, even if the agent looked confident. User-source Correction is the stronger signal; agent-source Correction is softer but still real
- Failure Outcome (other signals): build/test broke and wasn't fixed; agent gave up explicitly; ran out of context mid-Goal (look for
Compactionfollowed byUserMessagewith course-correcting content); subagent returned with an unrecovered error - Plan vs Action:
ToolCallevents that mutate state (Edit, Write, Bash with side effects, gh pr create, mcp tools that write) are Action. Read-onlyToolCalls are Plan
Reading the Transcript
- Event ids are the primary key. Every
meta.event_range,trigger.event_id, andoutcome.evidence_event_idsreferences realEvent.idvalues insidetranscript.json. The orchestrator dereferences these as needed; don't denormalize event content intosegments.json. - Subagent spawns are first-class. A
SubagentSpawnevent in the parent'sevents[]always corresponds to an entry in the parent'ssubagents[]. The subagent's Segment subtree'smeta.source_transcript_idis the child Transcript'stranscript_id. - Token totals come from summing
AssistantMessage.usage.input_tokens/output_tokensover the events in range.final_metricsat the Transcript level is the global roll-up, not authoritative per Segment.
Out of scope
- Acquiring the transcript or transforming CC JSONL — that's phase 1.
- Any analysis or recommendation — every
analyze-*skill is downstream of this. - Cross-transcript work — that's
analyze-cross-agent-transcript-patterns.
Notes
- The flamegraph is a humanizing artifact — the analyzers don't read it. Prioritize correctness of
segments.jsonover flamegraph polish. - Token cost matters; this skill is the only place we walk every event, so do it once and let downstream skills consume the structured output.
- `segments.json` is a draft. Decomposition is the most interpretive step in the pipeline, so when the tree looks wrong the fix is to re-run this phase rather than to patch around it downstream. Emit your best draft, but don't treat it as final.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/agent-transcript-analysis/2-decompose/decompose-agent-transcript-into-transcript-segments/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/pulsemcp/ai-artifacts/decompose-agent-transcript-into-transcript-segments)