What you will be able to do
- Decide whether a workflow needs a fixed prompt chain, fixed parallel sectioning, or adaptive decomposition, based on whether its subtasks can be listed before the run
- Split a large code review into per-file local passes plus a cross-file integration pass, and explain why a bigger context window does not fix attention dilution
- Design an adaptive investigation where each finding decides the next subtask, with a stopping condition
- Break an open-ended task such as adding tests to a legacy codebase into three phases: map the structure, prioritize, then follow a plan that changes as dependencies turn up
Key concept
Predictable vs discovered subtasks — The main decomposition choice turns on one question: can you write the subtask list before the run starts? If you can, code sequences the steps in a fixed chain. If the subtasks only show up as the work goes on, an orchestrator has to generate them from what each step finds.
1.Fixed prompt chains for predictable work
Every complex workflow has to be broken into smaller tasks, and the first design decision is who does the breaking. One option is to do it yourself, in code, before the run starts. The other is to let a model do it at runtime, based on what it finds. Getting this wrong costs you in one of two ways. A fixed pipeline can't follow a lead it didn't plan for, and a dynamic planner spends tokens and adds variation to work that never changes.
Prompt chaining is the fixed option. It splits a task into a sequence of steps, and each LLM call processes the output of the previous one. Between steps you can add programmatic checks, called gates, to ensure that the process is still on track. Chaining works best when the task divides cleanly into fixed subtasks. It deliberately accepts extra latency in exchange for accuracy, because each individual call has an easier job. One canonical example is generating marketing copy and then translating it into a different language.
Consider a support pipeline that turns a raw transcript into a structured summary and then translates the summary into three fixed languages, with the same steps in the same order on every run. A fixed chain fits this exactly: summarize, run a code-based check on the summary, then translate. The alternatives each fail for a specific reason:
- An orchestrator that plans the summary and translation subtasks for each transcript works out the same plan on every run and pays for that planning call each time.
- An adaptive agent that first inspects the transcript and then generates subtasks has the same flaw. The transcript's content never changes what the steps are.
- A single pass that folds summarization into translation removes the intermediate summary. That leaves nothing for a gate to check, and one call now does two jobs.
This is the legitimate use of a predefined path over Model-driven tool selection vs pre-configured sequences. Normally the model picks its next tool. For predictable work with several distinct aspects, though, a path fixed in advance beats letting the model choose, because there is nothing for it to decide.
A chain is only fixed if code enforces it. Deterministic hooks vs probabilistic prompt instructions covers why instructions alone aren't guarantees. For decomposition, this means a system prompt that says "first summarize, then check, then translate" is a request the model can blend or skip. Separate API calls, sequenced by your orchestration code, are a structure. Explicit chaining earns its place when you need to inspect intermediate outputs or enforce a fixed pipeline. Each step is its own call, so you can log, evaluate, or branch at any point.
Checkpoint 1 of 9· Check yourself
Every night a job takes each new product spec and runs the same steps in the same order. It writes a product description, code checks the length and banned terms, and then the description is translated into German and French. The content of a spec never changes which steps run. Which decomposition fits best?
You can write the subtask list before the run, and it never changes. So a fixed chain with a gate between steps fits. An orchestrator or an adaptive agent would work out the same plan on every run and pay for it each time. A single combined call leaves no intermediate output for the gate to check.
“This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”Source: www.anthropic.com
Checkpoint 2 of 9· Check yourself
An agent's system prompt says: "First extract the fields, then validate them, then format the report." The team needs to log the validated fields and stop the run before formatting if validation fails. What change gives them that?
Listing steps in a prompt is a request that the model can blend or skip. A pipeline is only fixed when each step is a separate call that your code sequences. Only then can you inspect the output, gate the run or branch between steps.
“Each step is a separate API call so you can log, evaluate, or branch at any point.”Source: platform.claude.com
Checkpoint 3 of 9· Exam question
A team is building an automated pipeline that takes a raw customer support transcript, produces a structured summary, then translates that summary into three fixed target languages. The steps and their order never change between runs. Which decomposition strategy best fits this workflow?
Correct answer: A — A fixed prompt chain that summarizes the transcript, runs a code-based check on the summary, then translates it
- A. Correct. The steps and their order are known in advance (summarize, then translate), which is the case prompt chaining is designed for. A programmatic check between the two steps catches a bad summary before it is translated into the three languages.
- B. Planning and delegating subtasks separately for each transcript is built for work whose steps cannot be predicted. Here the steps and their order never change, so a planning layer adds cost and variability and brings no benefit over a fixed sequence.
- C. Producing the translations in one pass removes the separate summary output, so there is nothing to verify before translation and no way to retry only the step that failed. The workflow calls for a structured summary that is then translated, which needs distinct, inspectable steps.
- D. Generating subtasks from what the transcript contains suits open-ended investigation, where the next step depends on what was found. This workflow has the same two steps on every run, so content-driven planning only introduces unpredictability.
2.Per-file passes plus a cross-file integration pass
Large reviews fail because of attention dilution. A model's context is a finite resource with diminishing returns, and its ability to recall information from that context drops as the token count rises. The degradation is a gradient, not a cliff: the model stays capable but loses precision on retrieval and long-range reasoning. Put 40 files in one pass and each file gets a thinner share of attention. That is why comments drift toward generic advice and the subtle interaction between two distant files goes unnoticed.
The standard prompt-chaining fix splits the review in two stages. First, each file gets its own pass that looks only for local issues. Second, a separate integration pass reads those findings and checks how the files interact. Per-file passes plus a cross-file integration pass covers how to run those passes. For decomposition, the point is that this review is predictable: the file list is known, and so is the order of the stages. A fixed chain therefore beats adaptive decomposition here. Models generally do better when each consideration gets its own call and focused attention, and Claude Code's workflow examples include this exact shape: review every changed file, then merge the per-file findings into one ranked summary.
Two other restructurings look plausible but leave the problem in place:
- Ranking the files by risk inside one pass keeps all 40 files in the same diluted context. It also directs effort away from low-ranked files, which may hold the other half of a cross-file bug.
- Rerunning one pass with the file order shuffled and keeping the comments that recur is voting. Voting raises confidence across several attempts, but every attempt is still a single diluted pass, and an issue that every run misses can't recur.
const found = await agent('List every .ts file under src/routes/.', {
schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
})
const audits = await pipeline(found.files, file =>
agent(`Audit ${file} for missing authentication checks.`, { label: file }),
)
return audits.filter(Boolean)Checkpoint 4 of 9· Fill the gap
This workflow script should give each changed file its own focused audit pass. Which token belongs in the blank inside the audit prompt?
const found = await agent('List every .ts file under src/routes/.', {
schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
})
const audits = await pipeline(found.files, file =>
agent(`Audit ${ ? } for missing authentication checks.`, { label: file }),
)
return audits.filter(Boolean)pipeline() calls agent() once for each entry in found.files, and each call should name only its own file. That gives every file a focused pass of its own. Passing found.files would put every file into every call, which brings back the diluted single pass that the per-file stage exists to avoid.
Checkpoint 5 of 9· Exam question
A reviewer is designing an agentic code review for a pull request that touches 40 files across a monorepo. Reviewers have noticed that when a single pass tries to hold all 40 files in context at once, subtle cross-file issues are missed and comments become generic. What restructuring addresses this attention dilution problem?
Correct answer: A — Review each file in its own pass for local issues, then run a second pass over those findings to check how the files interact
- A. Correct. Focused per-file passes keep each review small enough to stay specific, and a second pass over the findings catches interactions between files that a per-file review cannot see. This matches the recommended pattern for large pull requests.
- B. The reviewer already puts the whole diff into a single pass, and the problem is that attention is spread thinly across 40 files. A larger context window only lets more content fit. It does not make the model attend to each file more carefully, so generic comments and missed cross-file issues remain.
- C. Ranking files by risk inside one pass still keeps all 40 files in context, so attention stays diluted. It also directs less effort to the lower-ranked files, where subtle cross-file issues can still be hiding, so the missed issues are not recovered.
- D. Each shuffled run still holds the entire diff in a single pass, so attention is diluted in every run. Reordering only changes which files happen to get more attention each time. Keeping the comments that recur favours the obvious issues and drops the subtle cross-file ones that surface inconsistently.
3.Adaptive decomposition for open-ended investigation
Some tasks have no subtask list until the work starts. In the orchestrator-workers pattern, a central LLM breaks the task down, delegates the pieces to workers, and synthesizes their results. The orchestrator decides at runtime which subtasks to create. That is the difference from a pre-defined parallel workflow, even though the two look alike on a diagram. Coding changes that touch an unknown number of files fit this pattern, and so do searches that gather information from many sources.
Anthropic's Research system shows the loop in practice. A lead agent plans an approach, spawns subagents with specific research tasks, and synthesizes what they return. It then decides whether more research is needed, and if so it can create additional subagents or refine its strategy. This kind of work depends on the path taken: the model has to keep choosing which directions to pursue based on intermediate findings. A linear, one-shot pipeline cannot handle it.
Take an incident where the only input is a vague alert and nobody knows which service is at fault. An adaptive plan starts with whatever the alert points to, such as the services that logged errors around that time. Each result then shapes the next task. If the errors trace back to a recent deploy, the next subtask inspects that change. If they trace to a downstream timeout, the plan follows that dependency instead. The other designs all fix the subtasks before any evidence arrives:
- A fixed set of parallel subagents for the database, cache, and load balancer only looks where someone guessed. If the fault is in a fourth service, no subagent checks it.
- A prompt chain with predefined stages for collecting logs, correlating errors, and inspecting code runs the same stages whatever the logs say.
- A single prompt loaded with logs from the "main services" guesses what to load and gets no chance to follow up.
Being adaptive depends on who decides the subtasks and when, not on how many agents run. Those subagents were chosen before any evidence came in, which makes the design fixed parallel sectioning. In adaptive decomposition, the orchestrator creates each new subtask from what the previous one found.
An adaptive loop needs an explicit stopping rule, because nothing about the task tells it when it's done. Agent designs commonly add conditions such as a maximum number of iterations. Claude Code's workflow examples use a rule based on progress: stop once two rounds in a row find nothing new. Adaptive decomposition also costs more. Multi-agent systems are only economical when the task is valuable enough to pay for the improved performance.
Checkpoint 6 of 9· Check yourself
Customers report that some paid orders vanish without a trace, and nobody knows which part of the system drops them. Which design is adaptive decomposition for this investigation?
Adaptive decomposition means the orchestrator decides each next subtask from intermediate findings, with an explicit stopping rule. The parallel fan-out and the prompt chain both fix their subtasks before any evidence arrives, even though one uses several agents. The single call guesses what to load and can't follow up on what it finds.
“The model must operate autonomously for many turns, making decisions about which directions to pursue based on intermediate findings.”Source: www.anthropic.com
Checkpoint 7 of 9· Exam question
An architect is asked to design an agent that investigates why a production incident occurred, given only a vague alert message and no prior knowledge of which service is at fault. The number of logs, services, and code paths to inspect cannot be known ahead of time. Which decomposition approach is most appropriate?
Correct answer: A — An orchestrator agent that plans each next task from what the previous task found and revises the plan as evidence arrives
- A. Correct. The faulty service is unknown and the amount of work depends on what each step turns up. An orchestrator that picks the next task from earlier findings can widen or narrow the search as evidence accumulates.
- B. Parallel subagents are a real pattern, but this set is fixed to three components before any evidence exists. The faulty service is unknown and may be elsewhere, so the design cannot follow leads outside those components.
- C. Preloading logs from a few services into one prompt cannot cover the unknown number of logs, services and code paths. It also gives the model no way to follow up on findings, so the diagnosis rests on a partial snapshot.
- D. A chain with predefined stages decides the shape of the work up front. It cannot add, skip or repeat steps when findings point to a different service or deeper code paths, which this open-ended investigation requires.
4.Map, prioritize, then adapt: tests for a legacy codebase
"Add comprehensive tests to a legacy codebase" is open-ended, but it isn't an investigation with one answer. Starting to write tests on the first file returned spends effort wherever the listing happens to begin. A fixed chain can't help either, because nobody knows the modules, their coupling, or their risk in advance. The workable decomposition has three phases, and each phase produces the input for the next.
Map the structure first. Ask for an overview of the codebase, its main architecture patterns, its key data models, and how its components interact. Start with broad questions and narrow down to specific areas. The map is the work list. Claude's orchestration guidance treats this as the default hybrid: scout inline to discover the work list, then fan out over it.
Identify the high-impact areas and order the plan. Rank the areas the map turned up and put the highest-impact ones first. Size each subtask to a distinct concern or component rather than a slice of a file, so each worker owns something it can test end to end. Multiphase sequencing keeps the phases separate: understand, design, implement, and review are run as separate calls, with the results read between phases.
Let the plan change as dependencies turn up. Writing tests for the first priority module might show that it opens its own database connection. That means a test fixture or seam has to come first, so the plan moves it ahead. Another module might turn out to be a thin wrapper, so it moves down the list. Keep the plan somewhere outside the model's context so revisions don't get lost. Anthropic's Research lead agent saves its plan to memory for this reason, because a long run can push the plan out of a truncated context.
Checkpoint 8 of 9· Put it in order
A team is asked to add comprehensive tests to a large legacy codebase that nobody on the team knows. Put their decomposition steps in the order they should happen.
- 1.Start writing tests for the top-priority component
- 2.Get an overview of the architecture, key data models and how the components interact, starting broad and then narrowing
- 3.Rank the areas the overview turned up by impact, and build a plan with one subtask per component, highest impact first
- 4.Revise the stored plan when a dependency appears, for example by moving a database test fixture ahead of the module that needs it
The map is the work list, so it has to come first. The ranked plan is built from the map. The plan only changes after testing starts, because that is when hidden dependencies show up. Writing tests before mapping spends effort wherever the file listing happens to begin, and a plan fixed up front can't react to what testing finds.
“is hybrid: scout inline first to discover the work-list, then fan out over it.”Source: platform.claude.com
5.Choosing the pattern for the workflow
| Pattern | Who decides the subtasks | Use it when | Example |
|---|---|---|---|
| Prompt chaining (fixed sequence) | Your code, before the run | Each step needs the previous step's output and the order never changes | Write marketing copy, then translate it; per-file review, then a cross-file pass |
| Parallelization: sectioning (fixed fan-out) | Your code, before the run | Subtasks are independent and none depends on another's result | One call screens a query for inappropriate content while another answers it |
| Orchestrator-workers (adaptive) | An orchestrator LLM, at runtime | The needed subtasks depend on the input or on what earlier steps found | Coding changes across an unknown number of files; multi-source research |
Two questions settle most cases. First, can you list the subtasks before the run? If so, decomposition belongs in code. Second, does any step need another step's output? If it does, chain the steps. If not, section them and run them in parallel. Only when the first answer is no does an orchestrator earn its planning call.
A dynamic orchestrator added to fixed work is the most common mistake here. Suppose a content pipeline always runs the same tone check and the same profanity filter, and someone proposes an orchestrator that decides their order from the content. That adds a planning call, latency, and run-to-run variation, and buys nothing, because the steps and their outcomes don't depend on the order. The orchestrator pattern specifically lists predictable, pre-definable subtasks as a reason not to use it. Applying the same eleven-rule checklist to every Terraform file every quarter is the same situation: a fixed fan-out over known rules and files.
Use only as much decomposition as the work needs. The simplest solution is the recommended starting point, and Claude already handles most multistep reasoning internally. Chain explicitly when you need to inspect intermediate outputs or guarantee a fixed pipeline structure. Decompose adaptively when the work is open-ended enough that a fixed path would miss what it can't predict.
Checkpoint 9 of 9· Match them up
Match each workflow to the decomposition pattern that fits it. Ask two questions: can the subtasks be listed before the run, and does any step need another step's output?
Tap a term, then the definition that fits it.
The release-note subtasks can be listed in advance, and each step needs the previous step's output, so they form a chain. The two scoring checks can also be listed in advance but are independent, so they are sectioned to run in parallel. The API migration's subtasks can't be listed until the call sites are found, so only an orchestrator that decides at runtime can create them.
“the key difference from parallelization is its flexibility—subtasks aren't pre-defined, but determined by the orchestrator based on the specific input.”Source: www.anthropic.com
Sources
(8)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practicesOfficial docs
“is still useful when you need to inspect intermediate outputs or enforce a specific pipeline structure”
↩︎ Fixed prompt chains for predictable work“Each step is a separate API call so you can log, evaluate, or branch at any point.”
↩︎ Fixed prompt chains for predictable work“With adaptive thinking and subagent orchestration, Claude handles most multistep reasoning internally.”
↩︎ Choosing the pattern for the workflow“Each step is a separate API call so you can log, evaluate, or branch at any point.”
↩︎ Exam trap 2 - 2.https://www.anthropic.com/engineering/building-effective-agentsSecondary source
“The main goal is to trade off latency for higher accuracy, by making each LLM call an easier task.”
↩︎ Fixed prompt chains for predictable work“to ensure that the process is still on track”
↩︎ Fixed prompt chains for predictable work“Generating Marketing copy, then translating it into a different language.”
↩︎ Fixed prompt chains for predictable work“LLMs generally perform better when each consideration is handled by a separate LLM call, allowing focused attention on each specific aspect.”
↩︎ Per-file passes plus a cross-file integration pass“when multiple perspectives or attempts are needed for higher confidence results”
↩︎ Per-file passes plus a cross-file integration pass“This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”
↩︎ Choosing the pattern for the workflow“Workflows are systems where LLMs and tools are orchestrated through predefined code paths.”
↩︎ Key concept“This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks.”
↩︎ Checkpoint“the key difference from parallelization is its flexibility—subtasks aren't pre-defined, but determined by the orchestrator based on the specific input.”
↩︎ Checkpoint - 3.https://code.claude.com/docs/en/workflowsOfficial docs
“use a workflow to review every file changed in this PR for correctness issues, then merge the per-file findings into one ranked summary”
↩︎ Per-file passes plus a cross-file integration pass“stop once two rounds in a row find nothing new”
↩︎ Adaptive decomposition for open-ended investigation - 4.
“Context, therefore, must be treated as a finite resource with diminishing marginal returns.”
↩︎ Per-file passes plus a cross-file integration pass“Context, therefore, must be treated as a finite resource with diminishing marginal returns.”
↩︎ Exam trap 3“this characteristic emerges across all models”
↩︎ Prediction - 5.
“The orchestrator decides at runtime what subtasks to create, making this more adaptive than pre-defined parallel workflows.”
↩︎ Adaptive decomposition for open-ended investigation“Subtasks are predictable and can be pre-defined (use simpler parallelization)”
↩︎ Choosing the pattern for the workflow“Subtasks are predictable and can be pre-defined (use simpler parallelization)”
↩︎ Exam trap 1 - 6.
“it can create additional subagents or refine its strategy”
↩︎ Adaptive decomposition for open-ended investigation“making decisions about which directions to pursue based on intermediate findings”
↩︎ Adaptive decomposition for open-ended investigation“For economic viability, multi-agent systems require tasks where the value of the task is high enough to pay for the increased performance.”
↩︎ Adaptive decomposition for open-ended investigation“saving its plan to Memory to persist the context”
↩︎ Map, prioritize, then adapt: tests for a legacy codebase“A linear, one-shot pipeline cannot handle these tasks.”
↩︎ Exam trap 4“The model must operate autonomously for many turns, making decisions about which directions to pursue based on intermediate findings.”
↩︎ Checkpoint - 7.https://code.claude.com/docs/en/common-workflowsOfficial docs
“Start with broad questions, then narrow down to specific areas”
↩︎ Map, prioritize, then adapt: tests for a legacy codebase - 8.
“scout inline first to discover the work-list, then fan out over it.”
↩︎ Map, prioritize, then adapt: tests for a legacy codebase“scope each subtask to a distinct concern, component, or question”
↩︎ Map, prioritize, then adapt: tests for a legacy codebase“review as separate workflow calls, reading results between phases”
↩︎ Map, prioritize, then adapt: tests for a legacy codebase“is hybrid: scout inline first to discover the work-list, then fan out over it.”
↩︎ Checkpoint