Sessions, context windows, and handoffs
An AI coding agent reasons well only while its context window is small enough to hold the thread. Pocock’s skills are laid out with that limit in mind. Some steps must share one window because each needs the reasoning of the last. Others must start fresh because the previous window would only be noise. A boundary in the wrong place does not fail when it happens; the cost appears later as drift.
The unbroken stretch
Section titled “The unbroken stretch”The main flow, from sharpening an idea to writing its tickets, runs in one context window. The grilling, the spec that to-spec synthesizes from it, and the tickets that to-tickets cuts from the spec build on the same thinking. Each later step needs the earlier reasoning verbatim, not a summary. The ask-matt router says not to compact or clear until after to-tickets.
The limit on that stretch is what Pocock calls the smart zone: the window, around 150k tokens on current models, within which the model still reasons sharply. If a session approaches it before the tickets are cut, compact at the nearest phase boundary and continue, rather than push on with degraded reasoning.
The forced fresh starts
Section titled “The forced fresh starts”Two places in the flow require a new session by design.
The prototype detour. When a question in the grilling needs a runnable answer, write a handoff, open a fresh session against that file, build the prototype, then write a handoff back and cite what was learned from the original thread. A prototype lives in its own directory and answers one question, which is what makes it portable.
Implementation per ticket. On a multi-session build, each ticket is implemented in its own fresh context, cleared between tickets. This works because to-tickets sizes every slice to fit one window and writes it to be self-contained. The ticket says what to build from the user’s perspective and its acceptance criteria, and avoids file paths and code that would go stale. Implement then drives tdd and closes with code-review inside that one window. Implement-spec keeps the same rule while removing the manual clearing: it gives each ticket to an implementer sub-agent with a window of its own, in its own worktree. It talks to them through pointers to the spec, the tickets, and shared exploration notes rather than restated content.
The table
Section titled “The table”| Invocation | Session | Carry in | Carry out |
|---|---|---|---|
/grill-with-docs, /grill-me |
Start of the unbroken stretch | Nothing; the interview builds the design tree from scratch. | GLOSSARY.md entries and ADRs, written as decisions settle. |
/to-spec |
Same session as the grilling | The full reasoning, verbatim. A spec written from a summary flattens the decisions. | The spec, published on the tracker. |
/to-tickets |
Same session as the spec | The spec and its reasoning. | Self-contained tickets with blocking edges. The session can end here. |
/prototype |
Fresh session, in the prototype’s own directory | A handoff file that states the question the prototype has to answer. | The answer, applied to the real code; the throwaway prototype left on a prototype/<name> branch; a pointer to it on the implementation issue; a handoff back to the idea thread. |
/implement |
Fresh session per ticket | The ticket, which is written to be sufficient, plus GLOSSARY.md and the ADRs for the area, which every skill reads first. |
A reviewed commit on the current branch. |
/implement-spec |
One orchestrating session; a fresh sub-agent window per ticket | The spec and its tickets, read as a task graph; optional exploration notes saved outside the repository for every implementer to read. | Every ticket merged onto one integration branch, reviewed once by code-review, and the tickets resolved the way the tracker closes work. |
/retro |
The session it looks back on, before that session is cleared | The session’s own record. Once the session is cleared, point retro at that session’s log instead. | A ranked list of proposed changes to checks, standards, steering files, and tooling; nothing changes until you accept one. |
/research |
A background agent in its own window | The question. | A cited Markdown file in the repository, read into the next grilling. |
/wayfinder |
One ticket per session, except research tickets | The map body at low resolution and the one claimed ticket. | A resolution comment, the ticket closed, and a one-line pointer added to the map’s decisions. |
/triage, /diagnosing-bugs, /improve-codebase-architecture |
Standalone on-ramps; each produces work that enters the main flow | Whatever the on-ramp starts from: an issue, a bug report, a codebase. | Agent-ready issues; a regression test and post-mortem; or an idea to grill. |
/handoff |
Only at a phase boundary, and only when something has to move to another session | The conversation to compact. | A Markdown file in the temp directory that starts a session anywhere. |
The skill files fix the stretch, the two forced fresh starts, and retro’s place before clearing. They say nothing about a session boundary for research, triage, or diagnosis; those rows are a reading of how the skills are described.
Five moves at a boundary
Section titled “Five moves at a boundary”Pocock’s phase-boundaries note gives the decision as an ordered list. It is taken at the boundary between two phases, never mid-phase, because compacting in the middle of a phase loses the thread. Take the first option that applies.
- Continue if the next phase needs this one’s reasoning verbatim, or there is enough smart zone left. Grilling into implementation is the standard case. Continuing costs nothing and loses nothing, so it is considered first.
- Clear if everything in the session is disposable. It is the cheapest move, and the old session stays resumable, but clearing a relevant context loses the reasons behind what was built, and the diff cannot restore them.
- Handoff only when something must move: to a new harness (Claude to Codex), a new directory or repository, a colleague, or a side task forked mid-phase. If nothing is moving, no handoff is needed.
- Subagent when the task is scoped tightly enough to run without steering. Automated review is the standard case.
- Compact otherwise: the context is relevant, the harness and directory are the same, and you stay in the loop. It comes last because every option above it is cheaper or more precise, and a session started from a flattened summary can be confidently wrong about a decision.
Every move except continuing replaces the session’s own record of its reasoning with a summary. The summary has less noise and leaves more room, and it loses detail.
What goes wrong when the boundary is ignored
Section titled “What goes wrong when the boundary is ignored”- Context drift. A session past the smart zone keeps answering, but its answers stop tracking the earlier decisions. A spec or ticket contradicts something settled an hour before.
- A lost design tree. Compacting mid-grilling replaces the tree of settled and open decisions with a summary. The next round asks questions already answered, or assumes answers never given.
- A stale spec. A spec is a snapshot that can go stale. Implementing from one several sessions old, without the ADRs written since, builds to decisions that have changed.
- A ticket that is not self-contained. If a ticket depends on the session that wrote it, the fresh implementer has to guess. The fix is upstream: cut tickets that state their own what-to-build and acceptance criteria.
- A handoff that is a transcript. A handoff that pastes the conversation gives the next agent noise instead of a starting point.
Writing a handoff a fresh agent can act on
Section titled “Writing a handoff a fresh agent can act on”The handoff skill’s rules:
- Save the document to the operating system’s temporary directory, not the workspace.
- Do not duplicate what other artifacts already hold: specs, plans, ADRs, issues, commits, diffs. Reference them by path or URL.
- Include a suggested-skills section naming which skills the next agent should call.
- Redact secrets and personal data.
- An argument, if passed, describes what the next session will focus on, and the document is tailored to it. Say what the next session is for.
The in-progress claude-handoff variant skips the file and launches a background agent with the same summary as its prompt, named so it appears in the job list. It follows the same rules about pointers, suggested skills, and redaction. It is in Pocock’s beta bucket and not part of the plugin.
A handoff that works reads like a briefing: where the work is, what was decided and where that is written down, what is open, and which skill to run first.
Sources
Section titled “Sources”- Matt Pocock, skills repository, version 1.3.1 of the Claude Code plugin.
- ask-matt, including its phase-boundaries note.
- handoff and the in-progress claude-handoff.
- to-tickets, to-spec, implement, implement-spec, retro, prototype, wayfinder.