Skip to content

CCAR-F · Domain 5: Context Management & Reliability · 15% of the exam

Task 5.4: Manage context effectively in large codebase exploration

Long exploration sessions without context degradation: subagents for focused questions, scratchpad files and phase summaries, manifests for crash recovery, and compacting when discovery output piles up.

Study it

  • Large codebases: subagents, scratchpads, manifests and /compact

    Partly covered by: Context Windows

Sample questions

Try each one before opening the answer. Every option is explained, with the Anthropic documentation page that proves it.

Question 1 · choose 1

Three hours into exploring a large legacy codebase, your agent starts giving answers that contradict its earlier findings and refers to "typical repository patterns" instead of the specific classes it identified in the first hour. Later questions build on those findings. What practice best counters this?

  1. AHave the agent keep a scratchpad file of key findings and consult it for later questions
  2. BTurn off automatic compaction so that none of the earlier exploration output is ever summarized away
  3. CRaise the effort level so the agent reasons more carefully
  4. DPaste a reminder of the earlier findings into each new prompt by hand as the session goes on
Show the answer and why
  • AHave the agent keep a scratchpad file of key findings and consult it for later questions

    Correct

    Notes persisted outside the context window survive degradation and compaction and can be reread for each new question.

  • BTurn off automatic compaction so that none of the earlier exploration output is ever summarized away

    Incorrect

    Without compaction the context keeps filling with verbose output until the session fails.

  • CRaise the effort level so the agent reasons more carefully

    Incorrect

    More reasoning per response does not restore details that are buried or lost in a degraded context.

  • DPaste a reminder of the earlier findings into each new prompt by hand as the session goes on

    Incorrect

    Manual reminders depend on someone remembering what mattered and add more text to an already long context.

In long explorations, models drift toward generic answers as context degrades. A scratchpad of key findings that the agent maintains and rereads preserves specifics across context boundaries.

Question 2 · choose 1

Your long Claude Code explorations use an /explore-legacy skill whose SKILL.md is about 9,000 tokens. Its reporting format is defined in the last section. After a compaction, Claude keeps exploring but stops following that format. Without re-invoking the skill each time, what should you change?

  1. ATurn off automatic compaction for exploration sessions
  2. BMove the reporting format near the top of SKILL.md, or trim the file below 5,000 tokens
  3. CRaise the auto-compact window so that compaction happens later
  4. DCopy the reporting format into a path-scoped rule for the legacy folder
Show the answer and why
  • ATurn off automatic compaction for exploration sessions

    Incorrect

    Long explorations would then run out of context instead of compacting.

  • BMove the reporting format near the top of SKILL.md, or trim the file below 5,000 tokens

    Correct

    After compaction, an invoked skill's body is re-injected up to 5,000 tokens, keeping its start; the format at the end is what gets cut.

  • CRaise the auto-compact window so that compaction happens later

    Incorrect

    Compacting later delays the cut; the end of the skill is still dropped when compaction runs.

  • DCopy the reporting format into a path-scoped rule for the legacy folder

    Incorrect

    Path-scoped rules reload only when Claude touches a matching file, and compaction summarizes them away until then.

Compaction re-injects the bodies of invoked skills, capped at 5,000 tokens per skill and 25,000 in total, and truncation keeps the start of each file. Put the instructions that must survive near the top of SKILL.md.

Question 3 · choose 1

Deep in a long Claude Code exploration, you want to check a quick detail ("what does --frozen-lockfile do?"). The answer should not be added to the conversation history, and you do not want to leave the current conversation. What should you use?

  1. AAsk it in a plan-mode turn, so that nothing is recorded
  2. B/btw with the question, which keeps the answer out of history
  3. C/clear, then ask the question
  4. DA subagent with the question as its prompt
Show the answer and why
  • AAsk it in a plan-mode turn, so that nothing is recorded

    Incorrect

    Plan mode stops edits, not recording; the question and answer still join the history.

  • B/btw with the question, which keeps the answer out of history

    Correct

    A /btw side question gets its answer without adding to the conversation history.

  • C/clear, then ask the question

    Incorrect

    Clearing starts a new conversation, leaving the exploration you are in.

  • DA subagent with the question as its prompt

    Incorrect

    The subagent's result still returns to the main conversation.

Use /btw for side questions that do not need to stay in context: the answer never enters the conversation history, so you can check a detail without growing the context.

Question 4 · choose 1

A long Claude Code session feels sluggish. Before deciding whether to compact or clear, you want to see how the context window is being used, for example by tool output, MCP tools and the conversation itself. Which command shows this?

  1. A/usage, which shows the session's cost and activity
  2. B/status, which shows the model and connection
  3. C/tasks, which lists background work in the session
  4. D/context, which shows what is filling the context window
Show the answer and why
  • A/usage, which shows the session's cost and activity

    Incorrect

    /usage reports cost, plan limits and activity, not how the context window is filled.

  • B/status, which shows the model and connection

    Incorrect

    /status shows version, model, account and connectivity.

  • C/tasks, which lists background work in the session

    Incorrect

    /tasks manages background work; it does not break down context use.

  • D/context, which shows what is filling the context window

    Correct

    /context shows what is filling the window, so you can decide whether to compact or clear.

When a long session gets crowded, /context shows what is filling the context window, and /compact or /clear can then free it.

Question 5 · choose 1

The early part of a long session holds design decisions you still need, while the last hour is verbose debugging output. You want to condense only the recent messages and keep the earlier ones intact. What does Claude Code offer?

  1. A/rewind, then "Summarize from here"
  2. B/clear, then paste the design decisions back in
  3. C/compact, which condenses only the newest messages
  4. DA fork of the session from its start
Show the answer and why
  • A/rewind, then "Summarize from here"

    Correct

    Summarize from here condenses messages from that point forward and keeps earlier context in full.

  • B/clear, then paste the design decisions back in

    Incorrect

    That throws everything away and relies on manual copying.

  • C/compact, which condenses only the newest messages

    Incorrect

    /compact summarizes the conversation as a whole.

  • DA fork of the session from its start

    Incorrect

    A fork from the start loses the later work you still need.

The rewind menu can summarize from a selected message forward, or up to it, giving finer control than compacting everything.

Question 6 · choose 1

Your agent works on a codebase migration across many sessions. Each new session should see what has already been done, and the team must be able to roll back any step that goes wrong, even weeks later. What does the prompting guidance say works especially well as the record?

  1. AA progress section in CLAUDE.md that Claude rewrites after every step
  2. BResuming the same session every day so that its history serves as the record
  3. CGit commits as the progress log
  4. DClaude Code checkpoints, which record every edit
Show the answer and why
  • AA progress section in CLAUDE.md that Claude rewrites after every step

    Incorrect

    CLAUDE.md is standing instructions loaded in every session; it gives no checkpoints to return to.

  • BResuming the same session every day so that its history serves as the record

    Incorrect

    One endless session degrades, and its history cannot roll the code back.

  • CGit commits as the progress log

    Correct

    Git gives a log of what was done and checkpoints that can be restored in any later session.

  • DClaude Code checkpoints, which record every edit

    Incorrect

    Checkpoints are for quick, session-level recovery and are cleaned up after about 30 days; they are not a replacement for version control.

For work across many context windows, the prompting guidance recommends git: it provides a log of what has been done and checkpoints that can be restored. Checkpoints in Claude Code complement it for quick recovery within a session.

Practise domain 5 →Practise all domains →