An architect is designing a 20-step agentic workflow: early steps gather information, middle steps analyze, and late steps produce outputs depending on all prior steps. The team wants to optimize for cost without losing the analytical chain. What context management strategy is most effective?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — a rolling context strategy with phase summaries is optimal: after each phase, Claude generates a concise structured summary of key findings (capturing the analytical chain without verbatim verbosity), which is carried forward as the working context. Prompt caching applied to stable elements (system prompt, completed-phase summaries) reduces input costs on subsequent steps.
Full explanation below image
Full Explanation
A rolling context strategy with phase summaries is optimal: after each phase, Claude generates a concise structured summary of key findings (capturing the analytical chain without verbatim verbosity), which is carried forward as the working context. Prompt caching applied to stable elements (system prompt, completed-phase summaries) reduces input costs on subsequent steps. This preserves analytical continuity while keeping context size manageable. Option A (single API call) conflates input and output tokens — the 20 steps require iterative feedback loops between steps, not just long generation; single-call processing doesn't enable the iterative reasoning required. Option C (three independent calls with raw data) breaks the analytical chain — analytical insights from the gather phase are lost when only raw data is passed to the analyze phase. Option B (Opus for all) addresses model quality but not the context management problem, and increases cost.