Task Decomposition

Breaking complex tasks into smaller, manageable subtasks to overcome limitations like context window constraints in AI systems.

Key Principles

  • Atomicity: Subtasks must be small enough to complete within context window limits (e.g., <1k tokens for AI agents).
  • Sequential Dependencies: Subtasks ordered to build incrementally (output of one informs next).
  • Context Minimization: Each subtask uses only necessary context from prior steps.

AI Coding Workflow (Claude Implementation)

  • Problem: AI agents fail at “one-shot” large code generation due to context window limitations.
  • Solution: Decompose coding tasks into iterative, context-aware subtasks.
  • Workflow:
    • Break feature into atomic steps (e.g., “parse input”, “validate data”, “generate output”).
    • For each step:
      • Provide current code state and minimal relevant context.
      • Give focused instruction (e.g., “Fix the parse_input function”).
      • Use agent output to inform next step.
    • Avoid large “one-shot” prompts; iterate incrementally.

Backlink: 2026 04 14 Fixing long running Claude code sessions

Source Notes