Large codebase exploration
A long Claude Code session in a big codebase starts to blur what it found in the morning. The tempting answers keep everything in the session: read more files, remind Claude, get a bigger window, or restart and hope. The exam wants the findings to live somewhere the context can't blur: written down, with the noisy searching done elsewhere.
D5 Context Management & ReliabilityExam guide 5.4About 12 minutes
/compact when the context fills.Start here: the detective's board
A detective works a long case with hundreds of files.
Claude Code works the same way. Everything Claude reads sits in its context window, the working memory for one session. In a long session that memory gets crowded, and the exam guide names the signs of context degradation: inconsistent answers, and talk of “typical patterns” instead of the specific files found earlier. Four habits fix it:
- A scratchpad file is the board: Claude writes each key finding, with file and line, to a file on disk, and reads it back when needed.
- A subagent is the junior: it runs the broad search in its own context and returns a short summary, so the verbose output never enters the main session.
/compactclears the desk: it condenses the conversation so far, freeing room.- A manifest is a structured state file (findings, modules done, modules left, next step) so a crashed session can pick up exactly where it stopped.
- Answers drift to “typical patterns” or contradict earlier ones: write confirmed findings to a scratchpad file.
- Searches dump thousands of lines: send them to a subagent that returns only what matters.
- The context is nearly full, answers still accurate:
/compactnow, before they blur. - The work must survive a crash or carry on tomorrow: a manifest of findings and progress, read on every restart.
- Read more, remind Claude, bigger window, restart: each keeps the findings in the context, or throws them away.
Words in the question that tell you which side you're on
Scratchpad or manifest
- “inconsistent answers”
- “typical patterns” instead of the file it named
- “forgot an earlier finding”
- “session crashed”, “pick up tomorrow”
Subagents or /compact
- “verbose output”, “thousands of lines”
- “searching hundreds of files”
- “context nearly full”
- “long exploration”
Try it: a day in a big codebase
Pick the day, then a strategy. The meter fills turn by turn. At 95% Claude Code compacts on its own; with /compact you do it at 70%. Three times during the day the engineer asks the same question. At the end you see which findings are still exact, and where they live.
Token sizes and blur rates are illustrative, chosen to show the shape. They are not measurements. Each finding gets the same dice under every strategy, so the strategies differ only in how they work. The exam guide's point is that a long exploration degrades into inconsistent answers and “typical patterns”, and that findings kept on disk survive context limits and crashes.
Things to try: long day + just keep going, and read the three answers. Then + subagents: the meter stays lower, but the morning still blurs. Then + scratchpad + subagents + /compact. Last, the crash with /compact, with the scratchpad, and with the manifest.
The four traps
| Trap | What the wrong option looks like | Why it loses |
|---|---|---|
| Fills context | “Read every file in the module up front so nothing is missed” | Fine on a small module. On a large codebase it floods the context, and the earlier findings degrade. |
| Loses findings | “Restart the session whenever answers get inconsistent” | It clears the clutter, but without a saved record the new session starts from nothing. |
| Delays the problem | “Switch to a model with a bigger context window” | It works for a while, then the same degradation returns later in the run. |
| Only usually works | “Ask Claude to keep earlier findings in mind” | An instruction isn't storage. The findings still live only in the context, and still fade as it grows. |
Practice: three exam-style questions
Answer first, then open “Think it through”.
Rule to remember
Exam guide 5.4: “Context degradation: inconsistent answers, referencing "typical patterns" vs specific earlier findings.” “Scratchpad files persist key findings across boundaries; subagent delegation isolates verbose output.” “Structured state persistence (manifests) for crash recovery; /compact to reduce context usage.”