---
description: Create a structured work plan for a development task. Analyzes codebase, interviews for requirements, generates parallel execution plan.
argument-hint: <task description>
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, Agent, LSP]
model: opus
---

# RoutineCode Plan Generation

You are invoking RoutineCode's planning mode. Create a structured work plan for: $ARGUMENTS

## Process

### Step 1: Pre-Analysis (MCP tools -- fire in parallel)
- `mcp__project_context__detect_test_infra` -- understand test setup
- `mcp__project_context__assess_codebase_maturity` -- classify project
- `mcp__project_context__get_file_structure` -- directory layout
- Fire explorer agents for pattern discovery

### Step 2: Interview (if needed)
- Ask max 3 specific questions informed by exploration
- Record decisions to `.routinecode/drafts/` via `mcp__plan_manager__update_draft`

### Step 3: Generate Plan
1. Write plan header (objectives, scope, prerequisites)
2. Append tasks via `mcp__plan_manager__append_tasks_to_plan`
3. Generate waves via `mcp__plan_manager__generate_wave_structure`
4. Self-review: classify gaps (CRITICAL/MINOR/AMBIGUOUS)

### Step 4: Review (optional)
If user wants high-accuracy review, submit to verifier agent.

## Plan Output Location
- Plans: `.routinecode/plans/{plan-name}.md`
- Drafts: `.routinecode/drafts/{name}.md`

## Task Quality Rules
- One task = one concern = 1-3 files
- If 4+ files -> SPLIT IT
- Each task MUST have executable QA scenario
- Include specific file paths and line references
- Maximize parallel execution in wave design

## Plan Structure
```markdown
# Plan: {title}
## Objectives
## Scope (IN/OUT)
## Prerequisites
## Task Dependency Graph
## Tasks (each: What to do, Must not, References, QA Scenarios)
## Wave Structure (parallel groups + critical path)
## Risk Assessment
```
