%% x-task-manager: Task Manager (Orchestrator v6.1.0)
%% Universal task operations (create/replan) with automatic decomposition
%% Decompose-First Pattern: Build IDEAL plan → Check existing → Delegate to workers
graph TD
Start([Start: x-task-manager
ORCHESTRATOR]) --> Phase1[Phase 1: Discovery
Auto-discover Team ID
Parse Story ID from request]
Phase1 --> Phase2[Phase 2: Analyze & Decompose ALWAYS
Load Story from Linear
Build IDEAL task plan 1-6
Extract guide links
Foundation-First ordering]
Phase2 --> Phase3{Phase 3: Check
Existing Tasks?
Query Linear}
Phase3 -->|Count = 0| CreateMode[CREATE MODE
No existing tasks]
Phase3 -->|Count ≥ 1| ReplanMode[REPLAN MODE
Has existing tasks]
CreateMode --> Phase4a[Phase 4a: Delegate to ln-311-task-creator
Skill tool with:
taskType: "implementation"
+ IDEAL plan + guide links]
Phase4a --> WorkerCreate[ln-311-task-creator WORKER:
• Generate 7-section docs
• Validate NO tests
• Show preview
• User confirms
• Create in Linear
• Update kanban_board.md]
WorkerCreate --> Phase5[Phase 5: Post-Execution
Receive Summary from worker
Return to user]
ReplanMode --> Phase4b[Phase 4b: Delegate to ln-312-task-replanner
Skill tool with:
taskType: "implementation"
+ IDEAL plan + existing IDs]
Phase4b --> WorkerReplan[ln-312-task-replanner WORKER:
• Load existing tasks
• Compare IDEAL vs existing
• Show operations + diffs
• User confirms
• Execute operations
• Update kanban_board.md]
WorkerReplan --> Phase5
Phase5 --> End([End: Return to user
Summary + Linear URLs
Next Step ONLY:
→ ln-320-story-validator])
%% Styling
classDef orchestrator fill:#e1f5fe,stroke:#0277bd,stroke-width:3px
classDef discovery fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef processing fill:#fff9c4,stroke:#f57c00,stroke-width:2px
classDef decision fill:#ffe0b2,stroke:#e64a19,stroke-width:2px
classDef delegation fill:#e1bee7,stroke:#7b1fa2,stroke-width:2px
classDef worker fill:#c8e6c9,stroke:#388e3c,stroke-width:2px
classDef success fill:#a5d6a7,stroke:#2e7d32,stroke-width:2px
class Start orchestrator
class Phase1 discovery
class Phase2,CreateMode,ReplanMode processing
class Phase3 decision
class Phase4a,Phase4b delegation
class WorkerCreate,WorkerReplan worker
class Phase5Create,Phase5Replan,End success