# Context management in large codebase exploration

*Claude Certified Architect - Foundations Study Guide · Context Management & Reliability · Last updated October 22, 2026 · https://www.certifyforce.com/study-guide/claude-certified-architect-foundations/context-management-and-reliability/context-management-in-large-codebase-exploration*

How to keep long codebase explorations precise: spot context degradation, persist findings in scratchpad and state files, push verbose searches into subagents, seed each phase with a summary, recover crashed runs from manifests, compact with a focus and block generated code from reads.

- Certification: Claude Certified Architect - Foundations
- Exam section: Context Management & Reliability
- Study guide: https://www.certifyforce.com/study-guide/claude-certified-architect-foundations

**Official exam objective:**

> Manage context effectively in large codebase exploration

## What the exam expects

- Recognize context degradation in a long exploration session (inconsistent answers, "typical patterns" instead of the classes found earlier) and respond by persisting findings rather than by asking for more tokens.
- Have agents keep scratchpad and per-item state files that each new context window reads first.
- Delegate narrow, verbose investigations ("find all test files", "trace refund flow dependencies") to subagents while the main agent keeps the high-level plan.
- Summarize one exploration phase and inject that summary into the prompts of the next phase's subagents.
- Design crash recovery around structured state exports and a manifest the coordinator loads on resume.
- Use `/compact` with focus instructions, know what survives compaction, and keep generated or vendored code out of reads.

Key terms: **context degradation** (precision loss as the window fills); **scratchpad file** (notes on disk the agent rereads); **state manifest** (a structured record of done and pending work in a known location); **compaction** (replacing the conversation with a summary); **`Read` deny rule** (a `permissions.deny` entry that blocks file reads).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Degradation symptom | Inconsistent answers and "typical patterns" instead of discovered classes | [Exam guide](https://everpath-course-content.s3-accelerate.amazonaws.com/instructor%2F6nizmqk8tpzpfjvt6qmmav7rh%2Fpublic%2F1783542750%2FClaude+Certified+Architect+%E2%80%93+Foundations+Exam+Guide.pdf) |
| Subagent summary size | Often 1,000-2,000 tokens after extensive exploration | [Context engineering](https://www.anthropic.com/research/effective-context-engineering-for-ai-agents) |
| What crosses into a non-fork subagent | Only the Agent tool's prompt string from the parent | [Subagents in the SDK](https://code.claude.com/docs/en/agent-sdk/subagents) |
| State file format | JSON for status; freeform notes for progress; git for checkpoints | [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) |
| Compaction across windows | Not sufficient alone; does not always pass clear state | [Effective harnesses](https://www.anthropic.com/research/effective-harnesses-for-long-running-agents) |
| Survives compaction from disk | Project-root CLAUDE.md, unscoped rules, auto memory, plan-mode plan | [Context window](https://code.claude.com/docs/en/context-window) |
| Summarized away | `paths:` rules, nested CLAUDE.md, hook-added context | [Context window](https://code.claude.com/docs/en/context-window) |
| Files re-read after compaction | Up to five; a file over 5,000 tokens returns as a path reference | [Context window](https://code.claude.com/docs/en/context-window) |
| Team-wide read block | `Read` deny rules in committed `.claude/settings.json` | [Large codebases](https://code.claude.com/docs/en/large-codebases) |

## Check yourself

- Why does a three-hour exploration session start describing "typical patterns" instead of named classes?
- When should you run `/compact` with focus instructions instead of `/clear`?
- Why is a JSON status file preferred over Markdown for per-item progress?
- What is the only parent content a non-fork subagent receives?

## Sources

- [Explore the context window](https://code.claude.com/docs/en/context-window)
- [Best practices for Claude Code](https://code.claude.com/docs/en/best-practices)
- [Set up Claude Code in a monorepo or large codebase](https://code.claude.com/docs/en/large-codebases)
- [Create custom subagents](https://code.claude.com/docs/en/sub-agents)
- [Subagents in the SDK](https://code.claude.com/docs/en/agent-sdk/subagents)
- [Effective context engineering for AI agents](https://www.anthropic.com/research/effective-context-engineering-for-ai-agents)
- [Effective harnesses for long-running agents](https://www.anthropic.com/research/effective-harnesses-for-long-running-agents)
- [How we built our multi-agent research system](https://www.anthropic.com/research/multi-agent-research-system)
- [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices)
- [Claude Certified Architect – Foundations Exam Guide v1.0](https://everpath-course-content.s3-accelerate.amazonaws.com/instructor%2F6nizmqk8tpzpfjvt6qmmav7rh%2Fpublic%2F1783542750%2FClaude+Certified+Architect+%E2%80%93+Foundations+Exam+Guide.pdf)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 8 linked practice questions, and unlimited timed mock exams are included with the Claude Certified Architect - Foundations pack (USD $19): https://www.certifyforce.com/practice-exams
