masterplan
A Claude Code & Codex CLI plugin for durable multi-hour engineering work — brainstorm → plan → execute → finish on top of obra/superpowers skills.
Current release: v10.2.8 · License: MIT · Works with: Claude Code, Codex CLI · See CHANGELOG.md
What is masterplan
masterplan provides the /masterplan slash command. It orchestrates a brainstorm → plan → execute → finish development lifecycle on top of the obra/superpowers skills suite.
The core design principle: state lives on disk, not in the chat session. A run bundle at docs/masterplan/<slug>/ is the single source of truth. The orchestrator sequences decisions; all real work is delegated to short-lived subagents that return digests, never raw logs. If the session crashes, compacts, or is cleared, /masterplan re-reads the bundle and picks up exactly where it left off.
The Four-Phase Lifecycle
brainstorm → plan → execute → finish
| Phase | What happens |
|---|
| brainstorm | Codebase discovery; spec.md authored and reviewed |
| plan | spec.md → task decomposition → plan.index.json + plan.md |
| execute | Wave-by-wave task dispatch; each wave is one mp dispatch-wave launch |
| finish | Verification → retro.md → branch-finish gate → archive |
The state.yml phase field holds the enum brainstorm|plan|execute. finish is a terminal finalization flow that fires automatically when the last execute wave completes — it is not a phase value.
Architecture
masterplan v8 is a five-layer system. Each layer delegates downward and never writes state on behalf of the layer above it.
┌─────────────────────────────────────────────────────────────┐
│ L0 — Run bundle (disk) │
│ docs/masterplan/<slug>/state.yml spec.md plan.md │
│ plan.index.json events.jsonl retro.md handoff.md │
└───────────────────────┬─────────────────────────────────────┘
│ read / atomic write (CD-7)
┌───────────────────────▼─────────────────────────────────────┐
│ L1 — Thin shell │
│ commands/masterplan.md (~870-line verb sequencer) │
│ bin/masterplan.mjs (mp — filesystem-only subcommands) │
│ lib/resume.mjs (pure decideNextAction) │
│ ← SOLE durable state writer; git commit/checkout live here │
└───────────────────────┬─────────────────────────────────────┘
│ launch + receive digests
┌───────────────────────▼─────────────────────────────────────┐
│ L2 — Fabric dispatch path (`mp dispatch-wave` → │
│ `dispatchWaveViaFabric` in `lib/dispatch-wave.mjs`; the │
│ deleted Workflow engine's replacement — native spawn plans │
│ (descriptors for the harness subagent API)) │
│ lib/plan-merge.mjs lib/dispatch/ lib/wave.mjs │
│ ← returns digests/fragments only; never writes disk/git │
└───────────────────────┬─────────────────────────────────────┘
│ bounded briefs / structured digests
┌───────────────────────▼─────────────────────────────────────┐
│ L3 — Agents │
│ agents/mp-intent-assessor.md agents/mp-adversarial-reviewer.md │
│ agents/mp-planner.md agents/mp-plan-reviewer.md │
│ agents/mp-intent-critic.md agents/mp-subsystem-planner.md │
│ agents/mp-spec-decomposer.md agents/mp-alignment-auditor.md │
│ ← no session history; return structured output only │
└───────────────────────┬─────────────────────────────────────┘
│ node bin/doctor.mjs
┌───────────────────────▼─────────────────────────────────────┐
│ L4 — Doctor │
│ bin/doctor.mjs dispatcher │
│ lib/doctor/*.mjs (23 check modules, auto-discovered) │
│ ← Finding {id, severity, summary, fix}; non-zero on ERROR │
└─────────────────────────────────────────────────────────────┘
Key invariants:
- L1 (
commands/masterplan.md + mp) is the only durable state writer (CD-7). All state mutations go through mp subcommands; L2 and below never commit to git or write state.yml.
bin/masterplan.mjs is filesystem-only apart from deliberate local-git exceptions: mp record-result runs local git for its split commit, and the mp finish-step paths commit bundle state through commitBundle (branch-finish, archive, push-gate and push-recovery milestones). All are -C-qualified to loci the CLI derives itself and pathspec-scoped to the bundle directory. Network git (push, gh) stays the shell's job.
- L2 fabric dispatch communicates via descriptors on launch and return digests in the completion notification.
Installation
Claude Code
Run inside the Claude Code CLI: