CertSafari
    Anthropic Claude Certified Architect – Foundations (CCAR-F)· Lessons

    Domain 5 · Lesson 28/30

    Subagent Delegation, Phase Summaries and Crash Recovery for Codebase Exploration

    Manage context effectively in large codebase exploration

    11 min read
    2.5% of exam
    7 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Delegate verbose exploration to subagents while the main agent keeps the high-level picture, and recognise when delegation is overkill
    • Summarise one exploration phase and inject that summary into the prompts of the next phase's subagents
    • Design crash recovery around per-agent state files and a manifest the coordinator loads on resume

    1.Delegating exploration to subagents

    Compaction and scratchpads help a single agent manage its own context. Subagents go further: the verbose exploration never enters the main context in the first place. Each subagent runs in its own conversation. Its intermediate tool calls and results stay inside it, and only its final message goes back to the parent. A subagent might use tens of thousands of tokens exploring and return a distilled summary of perhaps 1,000–2,000 tokens. This splits the work cleanly. The main agent works from a high-level plan, and subagents do the deep searching.

    This works best when each subagent gets one specific question, such as "find all test files" or "trace refund flow dependencies". The best-practices guide gives an example prompt in the same style: *"Use subagents to investigate how our authentication system handles token refresh, and whether we have any existing OAuth utilities I should reuse."* Several such subagents can run at once, so independent questions finish in the time of the slowest one. Claude Code includes built-in subagent types for this kind of work:

    Built-in Claude Code subagents relevant to exploration
    SubagentToolsPurpose
    ExploreRead-only tools; Write and Edit are deniedFile discovery, code search, codebase exploration
    PlanRead-only tools; Write and Edit are deniedCodebase research for planning
    General-purposeEvery tool available to subagentsComplex research, multi-step operations, code modifications

    Checkpoint 1 of 7· Check yourself

    An Explore subagent reads 60 files to trace a dependency chain. What ends up in the main agent's context?

    Delegation has a cost. Anthropic's data shows that agents use about 4× more tokens than chat interactions, and multi-agent systems about 15× more. Most coding tasks also have fewer truly parallel parts than research does. The fix for the infinite-exploration anti-pattern is "scope investigations narrowly *or* use subagents", and the order of those options matters. For a narrow lookup, such as finding one function in a small module, a scoped search in the main session is cheaper than briefing and coordinating a subagent. Save delegation for exploration that would otherwise flood your context.

    Checkpoint 2 of 7· Exam question

    An architect needs to understand how a refund flow touches the payments, ledger, and notification services before proposing a redesign. The main agent should stay focused on synthesizing the redesign proposal rather than tracing every function call itself. How should the architect structure this investigation?

    Checkpoint 3 of 7· Check yourself

    You need to find the one function in a small, familiar module that formats invoice dates, and then make a single edit. What is the proportionate approach?

    Sources123

    2.Carrying findings between exploration phases

    Context isolation means subagents start clean, so they also start uninformed. Claude Code shows the difference between the two kinds of subagent:

    Forked versus non-fork subagents in Claude Code
    AspectForkNon-fork subagent
    ContextFull conversation historyFresh context with the prompt you pass
    System prompt and toolsSame as main sessionFrom the subagent's definition file
    Prompt cacheShared with main sessionSeparate cache

    A fork inherits everything, including the verbose phase-1 output you wanted to keep out of new contexts. A non-fork subagent inherits nothing. The pattern that avoids both problems is to summarise first and then inject the summary. Anthropic's research system works this way: agents summarise completed work phases and store the essential information in external memory before moving on. When context limits approach, they spawn fresh subagents and keep continuity through careful handoffs.

    Applied to codebase exploration: when phase 1 ends, the coordinator condenses its findings. That means the confirmed classes, entry points and open questions, not raw file dumps. The coordinator writes this summary to its scratchpad and places it at the start of each phase-2 subagent's prompt. Each new subagent then begins with the established facts and spends its budget on the new question. It does not rediscover phase 1 or fall back on guesses about typical structure.

    Checkpoint 4 of 7· Check yourself

    Before spawning phase-2 subagents, what should the coordinator do with phase-1 results?

    Sources43

    3.Crash recovery with exported state and a manifest

    Long multi-agent explorations run for hours, and in agent systems errors compound. Anthropic's research team decided that restarting from scratch was too expensive. Instead, they built systems that can resume from where the agent was when the error occurred. Three documented practices show how to build that.

    1. Every agent writes its state to a known place. In Anthropic's research system, subagents call tools to store their work in external systems and pass only lightweight references back to the coordinator. The aim is artifacts that persist independently. Give each subagent its own output file, never a shared one. Concurrent subagents then cannot overwrite each other's findings, and a crash in one leaves the others' results intact. Claude Code applies the same idea to its own subagents: their transcripts are stored in separate files, are unaffected when the main conversation compacts, and can be resumed after a restart by resuming the same session.

    2. Use a structured format for state. Anthropic's long-running-agent harness tracked progress with a claude-progress.txt file and git history. It also kept a feature list in JSON, because the model is less likely to inappropriately change or overwrite JSON than Markdown:

    One entry in the harness's JSON feature list: structured state that later sessions only update via the passes fieldjson
    {
        "category": "functional",
        "description": "New chat button creates a fresh conversation",
        "steps": [
          "Navigate to main interface",
          "Click the 'New Chat' button",
          "Verify a new conversation is created",
          "Check that chat area shows welcome state",
          "Verify conversation appears in sidebar"
        ],
        "passes": false
      }

    Checkpoint 5 of 7· Exam question

    A main agent is coordinating exploration of a repository with over 50,000 files and needs a complete list of every test file before planning a coverage audit. Running the search directly would flood the main conversation with thousands of matched paths it will not need again. What best keeps the main agent's context focused on high-level coordination while still producing the list?

    Checkpoint 6 of 7· Check yourself

    Four subagents explore different modules at the same time and record findings as they go. Which convention best ensures the coordinator can reliably aggregate every result?

    3. Start every resumed session by reading the state back in. In Anthropic's harness, each fresh session first gets its bearings: it runs pwd, reads the git log and progress file, then reads the feature list and picks the highest-priority unfinished item. The exam calls the coordinator-level version of this a manifest: an index of which agents ran, where each one's state file lives and what is still open. The documentation does not define a manifest format. It is a pattern assembled from the practices above. On resume, the coordinator loads the manifest, reads the referenced state files and injects the relevant findings into each restarted subagent's prompt. Non-fork subagents only know what their prompt tells them, so they cannot recover state any other way.

    Checkpoint 7 of 7· Put it in order

    Put the harness's get-your-bearings steps for a fresh session in order

    1. 1.Read the features list and choose the highest-priority feature not yet done
    2. 2.Run pwd to see the working directory
    3. 3.Read the git logs and progress files to see what was recently worked on

    Sources435

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Every search should go to a subagent, because delegation always saves context.Why is that wrong?

      Multi-agent work costs far more tokens than a single conversation. A narrow lookup is cheaper as a scoped search in the main session.

      Covered in Delegating exploration to subagents

    2. 2.A newly spawned subagent already knows what earlier phases discovered, because it shares the coordinator's session.Why is that wrong?

      A non-fork subagent starts with a fresh context that contains only the prompt you pass. Earlier findings must be summarised and injected into that prompt.

      Covered in Carrying findings between exploration phases

    3. 3.Compacting the main conversation also compacts, and loses detail from, subagent transcripts.Why is that wrong?

      Subagent transcripts are stored in separate files and are not affected by main-conversation compaction.

      Covered in Crash recovery with exported state and a manifest

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Delegate large reads: send research to a subagent so the file contents stay in its context window, not yours.”
      ↩︎ Delegating exploration to subagents
    2. 2.
      “The main agent coordinates with a high-level plan while subagents perform deep technical work or use tools to find relevant information.”
      ↩︎ Delegating exploration to subagents
      “returns only a condensed, distilled summary of its work (often 1,000-2,000 tokens)”
      ↩︎ Delegating exploration to subagents
    3. 3.
      “multi-agent systems use about 15× more tokens than chats”
      ↩︎ Delegating exploration to subagents
      “We implemented patterns where agents summarize completed work phases and store essential information in external memory before proceeding to new tasks.”
      ↩︎ Carrying findings between exploration phases
      “Instead, we built systems that can resume from where the agent was when the errors occurred.”
      ↩︎ Crash recovery with exported state and a manifest
      “Subagents call tools to store their work in external systems, then pass lightweight references back to the coordinator.”
      ↩︎ Crash recovery with exported state and a manifest
      “multi-agent systems use about 15× more tokens than chats”
      ↩︎ Exam trap 1
      “implement artifact systems where specialized agents can create outputs that persist independently.”
      ↩︎ Checkpoint
    4. 4.
      “Fresh context with the prompt you pass”
      ↩︎ Carrying findings between exploration phases
      “You can resume a subagent after restarting Claude Code by resuming the same session.”
      ↩︎ Crash recovery with exported state and a manifest
      “Fresh context with the prompt you pass”
      ↩︎ Exam trap 2
      “when the main conversation compacts, subagent transcripts are unaffected.”
      ↩︎ Exam trap 3
    5. 5.
      “the model is less likely to inappropriately change or overwrite JSON files compared to Markdown files.”
      ↩︎ Crash recovery with exported state and a manifest
      “Read the git logs and progress files to get up to speed on what was recently worked on.”
      ↩︎ Checkpoint

    Also cited

    Ready to test yourself?

    Practise the 16 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.