Skip to content

Feature #130: Multi-Stage Planning with Sub-Agents #277

Description

@warmonger0

Implement new Analyze phase (Phase 0) for ADW workflows with sub-agent delegation.

Implementation Plan: See docs/architecture/IMPLEMENTATION_PLAN_MULTISTAGE_PLANNING.md

Overview

Add a discrete Analyze phase that runs BEFORE the Plan phase to decompose work into components using Claude Code sub-agents.

5 Implementation Phases

  1. Data Types & State Extensions (1.5h)

    • Add ComponentAnalysis, DRYFinding, ContextAnalysis dataclasses
    • Extend ADWStateData with analysis fields
  2. Sub-Agent Definitions (1.5h)

    • Create .claude/subagents/component_analyzer.md
    • Create .claude/subagents/dry_checker.md
    • Create .claude/subagents/context_calculator.md
  3. Analyze Phase Script (2.0h)

    • Implement adws/adw_analyze_work_iso.py
    • Integrate Task tool for sub-agent spawning
  4. Enhanced Plan Phase (2.0h)

    • Enhance adws/adw_plan_iso.py with 3-constraint framework
    • Add fallback to time-based heuristics if no analysis
  5. Coupled Workflow & Integration (1.0h)

    • Create adws/adw_analyze_plan_iso.py
    • Update ALL_PHASES in orchestrator scripts
    • Add unit tests

Benefits

  • 19% cost reduction (220k vs 271k tokens)
  • Backward compatible (opt-in via --skip-analysis)
  • DRY checking sub-agent prevents code duplication
  • Context-aware phase boundaries (file count + token limits + logical coupling)

New 11-Phase Sequence

  1. Analyze ← NEW
  2. Plan ← Enhanced
  3. Validate
  4. Build
  5. Lint
  6. Test
  7. Review
  8. Document
  9. Ship
  10. Cleanup
  11. Verify

Estimate: 8.0 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions