| name | mao-plan |
| description | Decomposes complex tasks into a DAG of atomic subtasks with model routing and dependency mapping. Use when the user wants to plan a multi-file feature, refactor, or system build without executing it yet. Triggers on "plan", "break down", "decompose", "task graph", or when the user wants to understand the work before committing to execution.
|
| argument-hint | [--quality] [task or feature to decompose] |
| allowed-tools | Read, Glob, Grep, Bash(git log*), Bash(git diff*), Bash(wc*) |
MAO Plan โ Task Decomposition
Analyze a user request and produce a dependency-aware task graph without executing anything.
Process
1. Understand the Codebase
Before decomposing, scan:
- Project structure (languages, frameworks, entry points)
- Existing patterns (naming, architecture, testing conventions)
- Related code to the requested change
2. Identify Concerns
Separate the request into distinct concerns:
- Data layer changes
- Business logic
- API/interface changes
- Tests
- Configuration/infrastructure
3. Break Into Atomic Tasks
Each task must be:
- Atomic: one clear deliverable
- Independent: minimal shared state with other tasks
- Verifiable: has a concrete verification criterion
- Right-sized: 15-60 minutes of focused work
Anti-patterns to avoid:
- Tasks that touch the same file for different reasons (split them)
- "Update tests" as a separate task (tests belong with their implementation)
- Tasks without clear verification criteria
- Tasks that require another task's output to even start writing code
4. Score Complexity
Rate each task using weighted factors:
| Factor | Weight |
|---|
| files_touched | ร1 |
| new_logic | ร3 |
| security_risk | ร5 |
| concurrency | ร5 |
Model routing by score:
Standard level (default):
- 0-3 โ Haiku (boilerplate, CRUD, config, formatting)
- 4-7 โ Sonnet (features, refactoring, integration, review)
- 8+ โ Opus (architecture, security-critical, novel algorithms)
- Targets: 40-50% haiku, 40-45% sonnet, 5-15% opus
- Override: if >30% routes to Opus, re-examine โ likely over-scored
Quality level (--quality):
- 0-3 โ Sonnet (boilerplate, CRUD, config, formatting)
- 4+ โ Opus (features, refactoring, security, algorithms)
- Targets: 0% haiku, 40-50% sonnet, 50-60% opus
If --quality flag is present, set quality_level: "quality" in config and adjust budgets:
max_opus_invocations: 15, max_opus_concurrent: 2, escalation_budget: 5.
5. Map Dependencies
Build a DAG (directed acyclic graph):
- Each task lists
depends_on: [task_ids]
- Group into waves โ tasks in the same wave can run in parallel
- Verify no circular dependencies
6. Output Task Graph
Write to .orchestrator/state/task-graph.json:
{
"intent": "Brief description of what the user wants",
"config": {
"max_parallel": 4,
"created_at": "ISO-8601"
},
"tasks": {
"T1": {
"title": "Short task title",
"description": "What to do",
"depends_on": [],
"model": "haiku|sonnet|opus",
"complexity": 3,
"verify": "How to verify this task is done correctly",
"status": "pending"
}
},
"dag_waves": [["T1", "T2"], ["T3"]],
"worktrees": {}
}
7. Present to User
Show:
- Visual DAG (ASCII or table showing waves and dependencies)
- Model distribution breakdown (% haiku / sonnet / opus)
- Estimated parallelism (how many agents run concurrently)
- Ask for approval before any execution
Common Patterns
API Feature: schema migration โ model โ service โ controller โ tests
Refactoring: identify boundaries โ extract interfaces โ move implementations โ update imports โ verify
Data Pipeline: source connector โ transform โ sink โ monitoring โ integration test
Frontend Feature: types/models โ API client โ state management โ components โ E2E test