1.6 Task Decomposition Strategies
What You Need to Know
Section titled “What You Need to Know”Task decomposition splits complex work into pieces an agentic system can handle. A fixed sequential pipeline, also called prompt chaining, runs predetermined steps in order. Dynamic adaptive decomposition generates subtasks from what each step discovers. The wrong pattern makes the results worse in predictable ways. Attention dilution is a failure mode that occurs when the work is split into too few passes.
This lesson uses one made-up example throughout: a jeweller. The jeweller’s agent has two jobs. It checks 40 new product listings before they appear on the website. Its other job is to discover why the website’s stock count keeps differing from the shop’s count.
Fixed Sequential Pipelines (Prompt Chaining)
Section titled “Fixed Sequential Pipelines (Prompt Chaining)”In a fixed pipeline, each step takes the previous step’s output as input. The sequence does not change based on intermediate results.
Prompt chaining can split a code review into three sequential steps.
- A local analysis pass on each file individually (style, bugs, complexity).
- After all local passes, a cross-file integration pass (data flow, API consistency, import chains).
- A step that compiles the results into one review report.
The jeweller’s listing check has the same structure: check each listing, check the listings against each other, write one report.
Fixed pipelines suit predictable, structured tasks with known steps: code reviews, document processing, data extraction pipelines and compliance checks. The same input always follows the same path. That gives three advantages.
- Consistent, reliable results.
- Easy debugging, because you know which step produced which output.
- Easy monitoring, because you can log the output of each step.
A fixed pipeline cannot adapt to unexpected findings. If the jeweller’s Step 2 finds half the batch using the wrong size chart, Step 3 cannot change.
Dynamic Adaptive Decomposition
Section titled “Dynamic Adaptive Decomposition”With dynamic decomposition, the plan changes as the agent learns. The agent starts with a high-level goal. It investigates, and it plans from what it finds. New information may change the remaining steps, and the agent adapts the plan.
The stock mismatch needs this pattern. Nobody knows the cause at the start, so nobody can write the steps in advance. If the agent finds repairs logged as sales, its next steps investigate that finding.
Adding tests to a legacy codebase follows the same pattern.
- Map the codebase structure (directories, modules, dependencies).
- Identify high-impact areas (most-used modules, modules with the most bugs, untested critical paths).
- Write a prioritised test plan from the map.
- Start writing tests, and discover that Module A depends on Module B, which has no tests.
- Reprioritise: test Module B first so Module A’s tests can rely on it.
- Keep adapting as new dependencies and issues emerge.
This pattern suits open-ended investigation where the full scope is unknown at the start: exploring legacy systems, security audits, research projects and debugging unfamiliar codebases. It responds to unexpected complexity. It gives more thorough results on open-ended tasks, because it does not force the task into a predetermined plan. It is less predictable. Execution time varies with discoveries, so completion time and resource usage are harder to estimate. Debugging is also harder.
Choosing a Pattern
Section titled “Choosing a Pattern”Match the pattern to the task’s characteristics. The jeweller’s listing check has known steps and needs a fixed pipeline. The stock mismatch has unknown scope and needs dynamic decomposition.
| Task Characteristics | Pattern | Reasoning |
|---|---|---|
| Steps known in advance, structured input | Fixed pipeline | Consistency and reliability outweigh adaptability |
| Open-ended, unknown scope | Dynamic decomposition | Adaptability is essential when the problem is not fully defined |
| Multi-file code review | Fixed pipeline | Per-file analysis + cross-file integration is predictable |
| Legacy codebase exploration | Dynamic decomposition | Dependencies and issues emerge during investigation |
| Document extraction | Fixed pipeline | Fields and format are predetermined |
| Debugging an unfamiliar system | Dynamic decomposition | Root cause is unknown; investigation must adapt |
The Attention Dilution Problem
Section titled “The Attention Dilution Problem”Attention dilution occurs when an agent processes too many items in a single pass. The depth of analysis becomes inconsistent: some items get thorough analysis, and the agent misses obvious issues in other items. The model allocates attention across all the items in its context, so each item gets less attention as the count grows. Early items get a disproportionate share, and the model skims later items. Three symptoms appear.
- Detailed feedback on the first few items, and increasingly shallow analysis on later ones.
- A pattern flagged as a problem in one item while identical content is approved in another.
- Obvious bugs or errors missed in some items while minor style issues are caught in others.
Suppose you send the jeweller’s 40 listings in one pass. The agent flags listing 3 for a missing hallmark. Listing 31 has the same missing hallmark, but it passes. The agent does not notice a wrong price in listing 35.
The Fix: Multi-Pass Architecture
Section titled “The Fix: Multi-Pass Architecture”The fix is structural. A better model, a larger context window or a more detailed prompt still leaves every item in one pass. Multi-pass architecture splits the work into two layers. In the per-item layer, each file, document or module gets its own local analysis pass. That pass gives that item all of the model’s attention. After all local passes, a cross-item integration pass looks for cross-cutting concerns: data flow issues, inconsistent pattern usage and cross-file dependencies.
The per-item passes catch local issues consistently, because each item gets dedicated attention. The integration pass catches cross-item issues, because it focuses on the relationships between items instead of doing everything at once.
With 40 single-listing passes and one integration pass, the pass for listing 35 catches its wrong price. The integration pass finds that the same missing hallmark was judged in two different ways.
In the exam
Section titled “In the exam”A version of the exam’s sample question: a code review agent processes 14 files in a single pass.
- Files 1-5: detailed feedback with specific line references, bug identification and improvement suggestions.
- Files 6-9: moderate feedback with some issues identified but less thorough analysis.
- Files 10-14: superficial feedback that misses obvious null pointer bugs and SQL injection vulnerabilities.
- A
forEachloop flagged as inefficient in File 3, while identical code in File 11 receives no comment.
Large code reviews are split into per-file local analysis passes plus a separate cross-file integration pass to avoid attention dilution. Here the right fix is 14 per-file passes and one integration pass. The integration pass checks data flow and pattern consistency across all files. The per-file passes catch the null pointer bugs in Files 10-14, because each file gets its own pass. The integration pass identifies the inconsistent forEach evaluation, because it checks cross-file pattern consistency.
Exam Traps
Section titled “Exam Traps”Sources
Section titled “Sources”- Claude Agent SDK Overview — Anthropic
- Claude Code in Action (Skilljar) — Anthropic
- Anthropic Prompt Engineering Guide — Anthropic
- CCAR-F Exam Guide v1.0: Task Statement 1.6 — Anthropic
Exam Simulator
Section titled “Exam Simulator”Five exam-style multiple-choice questions on Task Decomposition Strategies. Pick an answer, then open the explanation.
Question 1
Section titled “Question 1”A code review agent processes 14 files and produces detailed feedback for the first 5 files but misses obvious bugs in files 10-14. It also flags a forEach loop as inefficient in one file while approving identical code in another. What is the root cause and the most appropriate solution?
- A. The model’s context window is too small to hold all 14 files — upgrade to a model with a larger context window
- B. Split the review into per-file local analysis passes plus a separate cross-file integration pass to avoid attention dilution
- C. Add a stronger system prompt emphasising the importance of reviewing all files with equal thoroughness
- D. Reduce the number of files per review to 5 and process in sequential batches of 5 files each
Answer & explanation
Correct: B
- B is correct because multi-pass architecture solves attention dilution. Per-file passes ensure each file receives dedicated, consistent analysis. The cross-file integration pass catches data flow issues and pattern inconsistencies. This addresses both symptoms: missed bugs in later files and contradictory pattern evaluation.
- A is wrong because context window size is not the issue. Attention dilution occurs because processing too many items in a single pass produces inconsistent depth, regardless of how much context the model can hold.
- C is wrong because prompt improvements do not solve attention dilution. The fundamental issue is processing too many items in a single pass, which is an architectural problem requiring a structural solution.
- D is wrong because batching solves within-batch attention dilution but misses cross-batch issues. Without a separate cross-file integration pass, data flow issues between batches and pattern consistency across all 14 files are not addressed.
Question 2
Section titled “Question 2”A team needs to add tests to a legacy codebase with undocumented dependencies. Which task decomposition pattern is most appropriate?
- A. Dynamic adaptive decomposition: map the structure, discover dependencies, reprioritise as new complexity emerges
- B. Fixed sequential pipeline: analyse each module, write tests, run tests, report results
- C. Fixed sequential pipeline with a larger context window to handle the complexity
- D. Process each module independently without any decomposition strategy
Answer & explanation
Correct: A
- A is correct because adding tests to a legacy codebase with undocumented dependencies is an open-ended investigation task. The full scope is not known at the start — dependencies emerge during investigation. Dynamic decomposition adapts the plan as new information is discovered.
- B is wrong because a fixed pipeline assumes the steps are known in advance. With undocumented dependencies, the agent cannot predetermine which modules to test first. It may discover Module A depends on Module B, requiring a plan change.
- C is wrong because context window size does not address the need for adaptability. The issue is that the plan must evolve based on discoveries, not that the model cannot hold enough data.
- D is wrong because independent module processing ignores dependencies. Tests for Module A may fail if Module B (a dependency) has no tests. Some coordination strategy is required.
Question 3
Section titled “Question 3”Which of the following tasks is best suited for a fixed sequential pipeline (prompt chaining)?
- A. Investigating the root cause of an intermittent production bug
- B. Exploring a competitor’s product features for a market analysis
- C. Conducting a security audit of an unfamiliar system
- D. Extracting structured data from invoices with a known format
Answer & explanation
Correct: D
- D is correct because invoice data extraction has a known structure: the fields and format are predetermined. The steps are predictable: read invoice, extract fields, validate format, output structured data. Fixed pipelines are ideal for structured, predictable tasks.
- A is wrong because root cause investigation is open-ended. The cause is unknown, and the investigation must adapt as clues emerge. Dynamic decomposition is more appropriate.
- B is wrong because market analysis involves discovering unknown information. The scope of competitor features is not fully known in advance, making dynamic decomposition more suitable.
- C is wrong because security audits of unfamiliar systems require exploration and adaptation. Vulnerabilities may reveal additional attack surfaces that change the investigation plan.
Question 4
Section titled “Question 4”What distinguishes attention dilution from a model capability limitation?
- A. Attention dilution occurs only with small models; large models do not experience it
- B. Attention dilution is caused by insufficient context window size
- C. Dilution varies depth, while capability limits are uniformly bad
- D. Attention dilution only affects code review tasks, not other types of analysis
Answer & explanation
Correct: C
- C is correct because attention dilution is characterised by inconsistency: thorough analysis for some items, superficial for others, and contradictory evaluation of identical patterns. A capability limitation would produce consistently poor results across all items. The inconsistency is the telltale sign.
- A is wrong because attention dilution affects models regardless of size. It is a structural issue of processing too many items in a single pass, not a model power issue.
- B is wrong because attention dilution is about attention allocation, not context window size. A larger context window does not fix uneven attention distribution.
- D is wrong because attention dilution can occur in any task where too many items are processed in a single pass: code reviews, document analysis, data validation, and more.
Question 5
Section titled “Question 5”A developer batches 14 files into groups of 5 for review but does not include a cross-file integration pass. Which issues will this approach miss?
- A. Cross-file data flow issues and pattern inconsistencies between files in different batches
- B. Bugs within individual files — batching does not help with local analysis
- C. Performance bottlenecks introduced by processing the files in batches rather than in a single pass
- D. Formatting inconsistencies inside individual files that the batch boundaries happen to split apart
Answer & explanation
Correct: A
- A is correct because batching solves attention dilution within each batch but does not address cross-batch issues. Without a dedicated cross-file integration pass, data flow issues between modules in different batches and contradictory pattern evaluation across batches go undetected.
- B is wrong because batching actually improves local analysis by giving each batch a more focused attention budget. Per-file or per-batch analysis catches local issues better than a single pass.
- C is wrong because the question asks about review quality, not performance. Batching may actually improve throughput by reducing per-pass load.
- D is wrong because formatting inconsistencies within files are local issues that batching handles adequately. The missed issues are specifically cross-file concerns.