Task Decomposition & Routing Strategies

Core

Design task decomposition strategies for complex workflows · Difficulty 3/5

0%
decompositionroutingprompt-chainingoptimization

Task decomposition determines how complex work is broken into manageable units. The right strategy depends on whether the workflow is predictable or open-ended.

Fixed Sequential Pipelines (Prompt Chaining)

Best for predictable, multi-aspect workflows:

  • Analyze each file individually, then run a cross-file integration pass
  • Break reviews into sequential steps with defined inputs/outputs
  • Each step's output feeds the next step's input
  • Example: Split large code reviews into per-file local analysis passes plus a separate cross-file integration pass to avoid attention dilution.

    Dynamic Adaptive Decomposition

    Best for open-ended investigation tasks:

  • Generate subtasks based on what is discovered at each step
  • First map structure, identify high-impact areas, then create a prioritized plan
  • Plan adapts as dependencies are discovered
  • Example: "Add comprehensive tests to a legacy codebase" -- first map the codebase structure, identify high-impact untested areas, then create a test plan that adapts as you discover dependencies.

    Routing by Complexity

    Route tasks to the cheapest model that meets quality requirements:

  • Use Haiku as a classifier to determine routing for more expensive models
  • Simple tasks go to faster/cheaper models; complex ones escalate
  • Monitor quality metrics per tier to validate routing decisions
  • Key Takeaways

    • Use prompt chaining for predictable workflows, dynamic decomposition for open-ended tasks
    • Split large reviews into per-file passes plus a cross-file integration pass
    • Route tasks to the cheapest model that meets quality requirements