Show HN: Understanding your Claude Code with trajectory segmentation A new Claude Code plugin called trajectory segmentation adds a side pane that breaks long autonomous agent sessions into short, non-overlapping phases, listing each decision the agent made and the reason behind it. The plugin runs a small model every N steps (default 6) to label each chunk as NEW, AMEND, or SKIP, and offers a backfill button to reconstruct phases over up to the whole conversation plus a scoped 'btw' side-question feature that the agent never sees. The tool's stated purpose is to make delegation observable, since an agent can now run for tens of minutes and hundreds of tool calls on a single prompt. Trajectory segmentation for long Claude Code sessions: a pane on the right that keeps a running, honest account of what the agent is doing, why, and every decision it makes, broken into short phases you can skim. You can delegate intelligence. You cannot delegate understanding. An agent now runs for tens of minutes and hundreds of tool calls on a single prompt. It reads files, edits them, runs commands, changes direction, recovers from a failed test, and by the time it stops you have a result but no picture of how it got there. The transcript holds every step, yet nobody scrolls back through four hundred lines to reconstruct the plot. So the understanding is simply lost, and you are left trusting an outcome you did not watch being made. That gap matters more as the models get better, not less. The more capable the agent, the more you hand it, and the more of the actual work happens while you are not looking. Capability you can buy. Legibility you have to build. This plugin spends a little intelligence to buy back the understanding: a small model watches the trajectory and keeps a running outline of the phases the agent moved through, and for each one the decisions it made and the reason behind them, so at any moment you can read the story instead of the log. It is deliberately cheap to run and worth more than it costs. Paying for a few extra tokens so that a long autonomous run stays explainable is a good trade, and it will look like an obviously good trade as runs get longer. The point of the panel is not to summarise text. It is to make delegation observable, and decisions are the part of a trajectory most worth seeing. - Short, non-overlapping phases. Each card is one thing the agent did: a step range, a one-line title, and a one-sentence summary. The model is biased to open a new phase whenever the action, target or goal shifts, so the outline stays fine-grained instead of collapsing into one long block. - Decisions, separated from the narration. Under each phase, every real choice the agent made is listed as the choice and, beneath it, the why. A decision is a choice with alternatives: an approach taken, an option rejected, a fix chosen after a failure, a tool or command picked for a reason. - Backfill. Turned the plugin on late, or want a cleaner pass with a stronger model? The backfill button asks how far back to go up to the whole conversation and which model and interval to use, then reconstructs the phases over that history. - btw: a side question about one phase. Like Claude Code's own /btw , but scoped: press btw on a card and ask anything about that phase. A model of your choice answers from the phase's steps and decisions, with the outline of every other phase for context, and the agent never sees the exchange. The thread stays on the card. A step is one action of the trajectory: a prompt you typed, an assistant message, or a single tool call with the start of what it returned. Every N steps default 6 the plugin runs a look. A look walks the new steps in N-sized chunks, and for each chunk the model reads the phases it has already written with their decisions and the recent steps, then answers one of three ways: - NEW — the action, target or goal shifted. A new phase card is pushed. This is the usual answer, which is what keeps the phases short. - AMEND — the newest steps are the direct continuation and result of the same action already in the current phase. Its summary is rewritten and any new decision is added to it. - SKIP — the steps did nothing worth recording. Nothing changes. Walking the backlog in chunks is deliberate: it stops one look from swallowing a whole multi-step turn into a single coarse block, so each chunk is roughly one action and becomes its own phase. Each card is a one-line title. Click it to expand the one-sentence summary, the decisions, and three buttons: transcript scrolls the conversation to where the phase starts, steps opens the exact steps it covers in a second pane, and btw asks a side question about it. ✕ dismisses a card. Built on Claude Code function hooks "Claude Mods" , in early access: it needs the environment variable the quick start sets, and the API can change between releases. - Claude Code 2.1.269 or later, with CLAUDE CODE ENABLE FUNCTION HOOKS=1 set. - An interactive terminal session. For the pane to dock on the right: the fullscreen layout the default outside tmux and at least 110 columns. Narrower, the pane sits inline above the prompt. - The model that writes the segments runs through your session's own credentials. Each chunk is one short completion, haiku by default. 1. Turn function hooks on in ~/.claude/settings.json merge the env key into what is there : { "env": { "CLAUDE CODE ENABLE FUNCTION HOOKS": "1" } } 2. Load it for one session, from a clone: git clone https://github.com/lucastononro/cc-traj-seg cd cc-traj-seg claude --plugin-dir . or install it as its own marketplace: claude plugin marketplace add lucastononro/cc-traj-seg then claude plugin install cc-traj-seg@cc-traj-seg . 3. It is off by default : installing it costs nothing until you ask. Run /traj in a session to turn the looks on and open the pane. /traj off turns them off again and closes the pane; the phases are kept. The switch persists across sessions, so once on it stays on until you say off. If the plugin was not running from the start of a session, or you want to re-segment the history with a different model, press backfill in the pane or run /traj backfill . A dialog asks three things and then rebuilds the phases: 1. How far — the whole conversation, or the last N steps. 2. Which model — the current one, haiku , sonnet or opus a full id goes through /traj model NAME . 3. Every how many steps — the chunk size for the reconstruction. The answers also become the ongoing settings, and live segmentation continues from the present once the backfill finishes. Claude Code's /btw lets you ask a side question about the conversation without it entering the agent's context. This is the same idea aimed at one phase. Press btw on an expanded card, or run /traj btw 3 why did it retry? . A dialog offers three stock questions why did it do this, what did it try that did not work, what was left undone ; any other question goes through /traj btw N