---
name: next-plan
description: Create the next numbered MASTER_PLAN from a plan idea
arguments: '"plan idea"'
---

# /next-plan Command

Create a new `MASTER_PLAN[N].md` file in canonical format by researching the codebase and drafting a phased implementation plan.

## Arguments

- `"plan idea"` (required) — A description of what the plan should accomplish

## Behavior

### Step 1: Determine Next Number

Run the number detection script to find the next available MASTER_PLAN number:

```bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/next-plan-number.sh"
```

Capture the output as `NEXT_NUM`.

### Step 2: Read the Canonical Template

Read the template for reference:

```
${CLAUDE_PLUGIN_ROOT}/templates/MASTER_PLAN.md
```

### Step 3: Research and Draft Plan

Use the **Task tool** with `subagent_type: "Plan"` to explore the codebase and draft the plan. Provide this prompt to the sub-agent:

> Research the codebase and create an implementation plan for: {{args}}
>
> Write the plan in this exact canonical format:
>
> ```markdown
> # Master Plan: [Descriptive Title]
>
> ## Objective
>
> [1-2 sentence description of what this phase accomplishes]
>
> ## Files
>
> | File | Change |
> |------|--------|
> | `path/to/file` | Description of change |
>
> ## Steps
>
> - [ ] **1. [First step title]**
>   - Detail or substep
>   - Key files: `path/to/file`
>
> - [ ] **2. [Second step title]**
>   - Detail or substep
>
> ## Verification
>
> - [ ] Verification check
> ```
>
> Be specific about file paths, function names, and implementation details. Each numbered step should be atomic and independently completable.

### Step 4: Write the Plan

Write the sub-agent's output to `MASTER_PLAN{NEXT_NUM}.md` in the project root.

### Step 5: Report and Offer Promotion

Tell the user:
- The plan was written to `MASTER_PLAN{NEXT_NUM}.md`
- Summarize the key sections (objective, number of steps, verification count)
- Suggest they review, then use `/promote` to activate the plan

## Example

```
/next-plan "add webhook support for requirement change notifications"
```

Output:
```
Created MASTER_PLAN9.md: Webhook Support for Requirement Changes

Objective: Add webhook notifications when requirements change status
Files: 4 files to create/modify
Steps: 5 numbered steps
Verification: 3 checks

Review the plan and use /promote to activate it.
```
