Task Decomposition and Session Management in Claude Code

How you split work determines whether Claude stays focused or drowns in context. The exam asks you to choose the right decomposition pattern and the right way to continue work across sessions.

Advertisement
📖 What You’ll Learn: You will be able to choose the right decomposition pattern for a task and the right way to continue work across Claude sessions.

✍️ Prompt chaining vs dynamic decomposition

Prompt chaining (fixed pipeline)Dynamic decomposition
Steps are known in advanceNext steps depend on what you discover
e.g. review each file against a checklist, then an integration passe.g. “add tests to this legacy codebase”, “find why billing is slow”
Predictable, cheap, testableAdaptive; plan → investigate → re-plan

🔍 Large code reviews: per-file plus integration

Reviewing many files in one pass dilutes attention: some files get deep feedback, others shallow, and identical code can get contradictory verdicts. Split the review into per-file passes for local issues plus a separate integration pass for cross-file data flow. A bigger context window doesn’t fix this — attention quality is the problem, not space.

📘 Open-ended tasks

For “add comprehensive tests to a legacy service”: map the structure, identify high-impact or high-risk areas, create a prioritised plan, then adapt it as dependencies are discovered.

💾 Resume, fork or start fresh?

SituationUse
Continue yesterday’s named investigation; context still mostly valid--resume <session-name> — and tell the agent which files changed
Compare two approaches from the same analysisfork_session
Earlier tool results are largely staleStart fresh and inject a structured summary
⚠️ Watch out: Resuming without mentioning changed files lets the agent reason from stale results; re-exploring everything is wasteful. Name the changed files for targeted re-analysis.
Advertisement

🧪 Exam-Style Practice Questions

Try these before opening the answers. They use the same scenario style as the real exam.

Question 1. "Review this PR": each of 9 files should get the same checklist, followed by a cross-file data-flow check. Which decomposition fits?

  • A. Three random full-PR passes with voting
  • B. Dynamic adaptive decomposition
  • C. A single pass with a larger context
  • D. Prompt chaining: per-file passes, then an integration pass
Show answer

Answer: D. Predictable, multi-aspect work suits a fixed chain. B suits open-ended investigation. C: attention gets diluted. A: voting suppresses real but intermittent findings.

Question 2. Yesterday you analysed a module in a named session. Overnight, teammates changed 3 of its 40 files. What's the best way to continue?

  • A. Use the Batches API
  • B. Start over and re-read all 40 files
  • C. `–resume <name>` and tell the agent which 3 files changed so it re-analyses them
  • D. Resume without mentioning the changes
Show answer

Answer: C. Most of the prior context is still valid, so resume and point at what changed. B is wasteful. D risks stale conclusions. A is irrelevant.

Question 3. You want to compare two refactoring strategies starting from the same codebase analysis. Which feature fits?

  • A. `fork_session`
  • B. `/memory`
  • C. `/compact`
  • D. `–print`
Show answer

Answer: A. Forking creates independent branches from a shared baseline. C shrinks context. D is non-interactive mode. B inspects memory files.

Advertisement

📝 Assignment

Do these tasks in order. Each one has a Done when check, so you know when it is complete. The stretch task is optional but close to what the exam expects from an architect. Keep your answers in one notes file or Git repository, and revisit them in your final week of revision together with the cheat sheet in the last lesson of this course.

  1. Task 1: Classify five tasks from your own work as prompt chaining or dynamic decomposition.
    ✅ Done when: Each of your five tasks is labelled, with a one-line reason that mentions whether its steps are known in advance.
  2. Task 2: Plan a review of a 12-file pull request as per-file passes plus an integration pass.
    ✅ Done when: Your plan lists every file pass plus a separate integration pass, and says what the integration pass checks.
  3. Stretch: in Claude Code, resume a named session after changing two files and tell it exactly which files changed.
    ✅ Done when: Claude re-analyses only the two changed files and does not re-read the whole codebase.
Advertisement

❓ Frequently Asked Questions

🤔 What is prompt chaining?

A fixed sequence of focused steps, such as reviewing each file and then running an integration pass. It suits predictable work.

🤔 When should I use dynamic decomposition?

For open-ended tasks where the next steps depend on what you discover, such as adding tests to a legacy codebase.

🤔 Does a bigger context window fix inconsistent reviews?

No. The problem is attention dilution, so split the review into focused passes.

🤔 When should I fork a session?

When you want to compare two approaches starting from the same analysis.

🏁 Summary

  • Predictable multi-aspect work → prompt chaining; open-ended work → dynamic decomposition.
  • Big reviews → per-file passes plus an integration pass.
  • Resume when context is valid, fork to compare approaches, start fresh with a summary when it is stale.
📝 Test yourself: Mock Test 1 · Mock Test 2 (30 scenario-based questions in 60 minutes, with explanations).

Next, continue with Claude Tool Design: Descriptions, Tool Distribution and tool_choice.

🎬 Prefer video? Watch QA, automation and AI testing tutorials on the SQA Tools YouTube channel.

Independent study material by SQA Tools. Not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic. Mock questions are original practice items, not real exam content. Exam facts checked against Anthropic's official exam guides and certification FAQ on 11 November 2026.