opencode-mission-control
opencode-mission-control copied to clipboard
feat: Multi-plan support — remove singleton plan.json constraint
Description
MC currently supports only one active plan at a time. Starting a new plan while one exists throws an error. This blocks workflows where a user wants to run independent plan groups concurrently (e.g., a frontend plan and a backend plan).
Current Implementation
// src/tools/plan.ts:92
const existingPlan = await loadPlan();
if (existingPlan) {
throw new Error('Active plan already exists');
}
All plan state lives in a single `plan.json` file — a hard singleton.
Use Case
- Parallel workstreams: Run a "refactor auth" plan and a "add analytics" plan simultaneously.
- Quick tasks alongside plans: Launch a quick standalone plan while a long-running plan executes.
- Team workflows: Different team members could have different active plans.
Proposed Solution
Phase 1: Per-plan state files
Replace `plan.json` with `plans/{planId}.json`:
~/.local/share/opencode-mission-control/{project}/
plans/
a1b2c3d4.json
e5f6g7h8.json
Phase 2: Plan-aware tools
- `mc_plan_status` — accept optional `planId` param, list all plans if omitted.
- `mc_plan_cancel` — require `planId` or `name` when multiple plans exist.
- `mc_plan_approve` — require `planId` or `name` when multiple plans exist.
- `mc_overview` — show all active plans.
Phase 3: Resource-aware scheduling
- `maxParallel` applies globally across all plans.
- Plans compete for job slots based on priority or FIFO ordering.
Files Involved
- `src/lib/plan-state.ts` — plan persistence (currently singleton)
- `src/tools/plan.ts` — plan creation (blocks on existing plan)
- `src/tools/plan-status.ts` — plan status display
- `src/tools/plan-cancel.ts` — plan cancellation
- `src/tools/plan-approve.ts` — plan approval
- `src/lib/orchestrator.ts` — plan execution (currently one `activePlanId`)
Additional Context
From audit report Section 4 (Anti-Patterns): "Single-file state (plan.json singleton) — Blocks multi-plan support." Also listed in Section 9 Phase 3 roadmap.