The loop's first step mirrors the PRD phase: explore the solution before structuring anything. But the input is now a single ticket the developer picked up, self-assigned through the JIRA MCP if you like. One artifact in, one implementation out. That is the shape of every cycle from here.
CHAPTER 5 OF 7 · 10 min · 2 COPYABLE ASSETS
How to prime Claude Code with codebase context (PIV loop step one)
Start every implementation fresh: /prime loads the ticket, codebase patterns, and git history, then subagents research without flooding your context window.
TL;DW
Every ticket starts a brand-new Claude Code session. The developer picking up work has no memory of the planning conversation, and that is by design. The /prime command rebuilds exactly the context needed: it pulls the JIRA ticket through the MCP server, studies the codebase and recent git commits, and reports a summary. From there you explore solutions freely, spinning up subagents for research so that a hundred thousand tokens of codebase reading collapses into a few thousand tokens of summary for your main agent.
Planning has two layers, and confusing them is what sinks most AI-coding attempts. Layer one, the PRD, stayed at features-and-requirements altitude. Layer two, this ticket, is where you analyze the codebase, the documentation, and exactly which files must change. The two-step order matters: you arrive here already carrying validated business context.
Cole starts a brand-new conversation and role-plays the reality: the developer picking up this ticket was not in the planning session and has none of that context. That is not a problem to fix. It is the design. Context gets rebuilt deliberately, not inherited accidentally.
The prime command walks the agent through understanding the codebase through the lens of the ticket. It loads external context (the JIRA issue, Confluence pages), studies features and app routes, and reads recent git commits. Cole: 'I love using git as long-term memory for my coding agents.' What you shipped recently predicts the patterns you should follow next.
The argument is a comma-separated list of ticket IDs, so one prime call can load a small cluster of related work. What it reads is fully yours to tune: which directories count as core, how many recent commits matter, whether Confluence pages join the sweep. Cole's version is a starting point, and he expects you to specialize it per codebase.
A good smell test after priming: the agent should be able to summarize your app's structure and name the files the ticket will likely touch. If it cannot, the command is loading the wrong things. If it rambles for pages, it is loading too much.
/prime AT-23 Under Ctrl+O you see the sequence: list accessible Atlassian resources, fetch the specific issue, then a burst of parallel file reads and git-log checks. Everything the agent needs, gathered in one orchestrated sweep. And every step of that sweep is text in the prime command you can edit.
You do not want half the agent's context spent on research before work begins. Load the core files and recent history, no more. The tuning knob is the command itself. If priming pulls too much, change what it reads. Your process, your codebase, your lever.
Primed on ticket AT-23, the projection page, the agent checks JIRA state and reports blockers: AT-22, the QR-code ticket, has to land first. That dependency mapping was built into /create-stories. Cole pivots the session to AT-22 on the spot. Unstructured gear-shifts are exactly what this phase is for.
Exploration here is deliberately free-form. Cole does not even use a command. He speech-to-texts a quick instruction spinning up subagents: sub-processes that each research part of the codebase and report back only a summary to the main agent.
When to reach for subagents versus letting the main agent read directly: direct reads win for one or two known files, because a subagent round trip adds overhead. Subagents win the moment the question is open-ended (where does voting state live, what patterns do our components follow, which library handles QR rendering), because the research would otherwise flood your working context.
Three parallel subagents is Cole's typical shape for a feature exploration. Each one burns its own context freely and returns a few hundred words. Your main session stays clean for the decisions that follow.
Let's build AT-22. Spin up a few subagents to research the codebase and help me ideate on how to build this feature into our app. One research pass loaded 32,000 tokens. The whole exploration burned over 100,000, yet only a few thousand tokens of summary returned to the main agent. That is the strategy. Yes, million-token windows exist now. 'Just because you can fit a million tokens into a large language model does not mean that you should.' Models get overwhelmed just like people. Manage context; do not hoard it.
Key terms
- Context window
- The bounded working memory an agent reasons over; overfilling it degrades output quality.
- Subagent
- A helper agent with its own context that researches a slice of the problem and returns only a summary.
- Priming
- Rebuilding a fresh session's context from artifacts: the ticket, the codebase, recent git history.
- Blocker
- A ticket that must be completed before another can start.
Key takeaways
- Two planning layers: project-level (the PRD) stays high-level, while ticket-level digs into files, architecture, and docs.
- Git history is long-term memory. Recent commits teach the agent the patterns your codebase actually follows.
- /prime is a starting point. Tune how much context it loads for your codebase; the command is the lever.
- Subagents burn 100k tokens on research and hand back a few thousand. That is the point.
Watch out
- When the agent flags a blocker dependency (here, the QR ticket had to precede the projection page), believe it. That dependency mapping came from /create-stories and it is usually right.
- A 1M-token context window is not a license to fill it. Models get overwhelmed exactly like people; summaries beat raw dumps.
Check your understanding
Why start implementation planning in a brand-new session with no memory of the PRD work?
Because context should be rebuilt deliberately (via /prime and the ticket artifact), not inherited accidentally. The developer picking up a ticket never has the planning conversation anyway, and fresh context keeps the agent focused.
What did the subagent research cost in tokens, and what came back?
Over 100,000 tokens consumed across the subagents, with only a few thousand tokens of summarized findings returned to the main agent. Research is delegated precisely so the main context stays clean.
Unlocks when you finish the chapter.