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.
Manage context effectively in large codebase exploration
~8 min read · 8 practice questions ·
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
/compactwith 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
- Detail
- Inconsistent answers and "typical patterns" instead of discovered classes
- Detail
- Often 1,000-2,000 tokens after extensive exploration
- Detail
- Only the Agent tool's prompt string from the parent
- Detail
- JSON for status; freeform notes for progress; git for checkpoints
- Detail
- Not sufficient alone; does not always pass clear state
- Detail
- Project-root CLAUDE.md, unscoped rules, auto memory, plan-mode plan
- Detail
paths:rules, nested CLAUDE.md, hook-added context
- Detail
- Up to five; a file over 5,000 tokens returns as a path reference
- Detail
Readdeny rules in committed.claude/settings.json
Sources for this section (7)
- Exam guideeverpath-course-content.s3-accelerate.amazonaws.com (opens in a new tab)
- Context engineeringwww.anthropic.com (opens in a new tab)
- Subagents in the SDKcode.claude.com (opens in a new tab)
- Prompting best practicesplatform.claude.com (opens in a new tab)
- Effective harnesseswww.anthropic.com (opens in a new tab)
- Context windowcode.claude.com (opens in a new tab)
- Large codebasescode.claude.com (opens in a new tab)
- Why does a three-hour exploration session start describing "typical patterns" instead of named classes?
- When should you run
/compactwith 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?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Claude Certified Architect - Foundations pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 30 lessons of the Claude Certified Architect - Foundations guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (8 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams
Practice for the Claude Certified Architect - Foundations exam
Certifyforce is an independent study resource and is not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic.