@rune-kit/rune 2.4.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +47 -17
  2. package/compiler/__tests__/executive-dashboards.test.js +285 -0
  3. package/compiler/__tests__/inject.test.js +128 -0
  4. package/compiler/__tests__/orchestrators.test.js +151 -0
  5. package/compiler/__tests__/org-templates.test.js +447 -0
  6. package/compiler/__tests__/pack-split.test.js +141 -1
  7. package/compiler/__tests__/parser.test.js +147 -1
  8. package/compiler/__tests__/scripts-bundling.test.js +10 -11
  9. package/compiler/__tests__/skill-index.test.js +218 -0
  10. package/compiler/__tests__/status.test.js +336 -0
  11. package/compiler/__tests__/templates.test.js +245 -0
  12. package/compiler/__tests__/visualizer.test.js +325 -0
  13. package/compiler/adapters/antigravity.js +18 -4
  14. package/compiler/bin/rune.js +90 -1
  15. package/compiler/doctor.js +283 -2
  16. package/compiler/emitter.js +490 -17
  17. package/compiler/parser.js +255 -4
  18. package/compiler/status.js +342 -0
  19. package/compiler/visualizer.js +622 -0
  20. package/hooks/hooks.json +12 -0
  21. package/hooks/intent-router/index.cjs +108 -0
  22. package/hooks/pre-tool-guard/index.cjs +177 -68
  23. package/package.json +63 -63
  24. package/skills/autopsy/SKILL.md +48 -1
  25. package/skills/brainstorm/SKILL.md +2 -0
  26. package/skills/completion-gate/SKILL.md +26 -1
  27. package/skills/context-engine/SKILL.md +93 -2
  28. package/skills/cook/SKILL.md +794 -648
  29. package/skills/debug/SKILL.md +409 -392
  30. package/skills/deploy/SKILL.md +2 -0
  31. package/skills/docs/SKILL.md +28 -3
  32. package/skills/fix/SKILL.md +284 -281
  33. package/skills/mcp-builder/SKILL.md +53 -1
  34. package/skills/onboard/SKILL.md +58 -1
  35. package/skills/perf/SKILL.md +34 -1
  36. package/skills/plan/SKILL.md +372 -342
  37. package/skills/preflight/SKILL.md +396 -360
  38. package/skills/retro/SKILL.md +95 -1
  39. package/skills/review/SKILL.md +535 -489
  40. package/skills/scope-guard/SKILL.md +1 -0
  41. package/skills/scout/SKILL.md +1 -0
  42. package/skills/sentinel/SKILL.md +353 -299
  43. package/skills/sentinel/references/policy-driven-constraints.md +424 -0
  44. package/skills/session-bridge/SKILL.md +58 -2
  45. package/skills/session-bridge/references/evolutionary-memory-patterns.md +312 -0
  46. package/skills/team/SKILL.md +16 -1
  47. package/skills/test/SKILL.md +587 -585
  48. package/skills/verification/SKILL.md +1 -0
  49. package/skills/watchdog/SKILL.md +2 -0
@@ -1,342 +1,372 @@
1
- ---
2
- name: plan
3
- description: Create structured implementation plans from requirements. Produces master plan + phase files for enterprise-scale project management. Master plan = overview (<80 lines). Phase files = execution detail (<150 lines each). Each session handles 1 phase. Uses opus for deep reasoning.
4
- metadata:
5
- author: runedev
6
- version: "1.1.0"
7
- layer: L2
8
- model: opus
9
- group: creation
10
- tools: "Read, Write, Edit, Glob, Grep"
11
- ---
12
-
13
- # plan
14
-
15
- ## Purpose
16
-
17
- Strategic planning engine for the Rune ecosystem. Produces a **master plan + phase files** architecture — NOT a single monolithic plan. The master plan is a concise overview (<80 lines) that references separate phase files, each containing enough detail (<150 lines) that ANY model can execute with high accuracy.
18
-
19
- **Design principle: Plan for the weakest coder.** Phase files are designed so that even an Amateur-level model (Haiku) can execute them with minimal errors. When the plan satisfies the Amateur's needs, every model benefits Junior (Sonnet) executes near-perfectly, Senior (Opus) executes flawlessly.
20
-
21
- This is enterprise-grade project management: BA produces WHAT Plan produces HOW (structured into phases) ANY coder executes each phase with full context.
22
-
23
- <HARD-GATE>
24
- NEVER produce a single monolithic plan file for non-trivial tasks.
25
- Non-trivial = 3+ phases OR 5+ files OR estimated > 100 LOC total change.
26
- For non-trivial tasks: MUST produce master plan + separate phase files.
27
- For trivial tasks (1-2 phases, < 5 files): inline plan is acceptable.
28
- </HARD-GATE>
29
-
30
- ## Architecture: Master Plan + Phase Files
31
-
32
- ```
33
- .rune/
34
- plan-<feature>.md ← Master plan: phases overview, goals, status tracker (<80 lines)
35
- plan-<feature>-phase1.md ← Phase 1 detail: tasks, acceptance criteria, files to touch (<150 lines)
36
- plan-<feature>-phase2.md Phase 2 detail
37
- ...
38
- ```
39
-
40
- ### Why This Architecture
41
-
42
- - **Big context = even Opus misses details and makes mistakes**
43
- - **Small context = Sonnet handles correctly, Opus has zero mistakes**
44
- - Phase isolation prevents cross-contamination of concerns
45
- - Each session starts clean with only the relevant phase loaded
46
- - Coder (Sonnet/Haiku) can execute a phase file without needing the full plan
47
-
48
- ### Size Constraints
49
-
50
- | File | Max Lines | Content |
51
- |------|-----------|---------|
52
- | Master plan | 80 lines | Overview, phase table, key decisions, status |
53
- | Phase file | 200 lines | Amateur-proof template: data flow, contracts, tasks, failures, NFRs, rejections, cross-phase |
54
- | Total phases | Max 8 | If > 8 phases, split into sub-projects |
55
-
56
- ## Modes
57
-
58
- ### Implementation Mode (default)
59
- Standard implementation planning — decompose task into phased steps with code details.
60
-
61
- ### Feature Spec Mode
62
- Product-oriented planning — write a feature specification before implementation.
63
- **Triggers:** user says "spec", "feature spec", "write spec", "PRD" — or `/rune plan spec <feature>`
64
-
65
- ### Roadmap Mode
66
- High-level multi-feature planning — organize features into milestones.
67
- **Triggers:** user says "roadmap", "milestone", "release plan", "what to build next" — or `/rune plan roadmap`
68
-
69
- ## Triggers
70
-
71
- - Called by `cook` when task scope > 1 file (Implementation Mode)
72
- - Called by `team` for high-level task decomposition
73
- - `/rune plan <task>` manual planning
74
- - `/rune plan spec <feature>` feature specification
75
- - `/rune plan roadmap`roadmap planning
76
- - Auto-trigger: when user says "implement", "build", "create" with complex scope
77
-
78
- ## Calls (outbound)
79
-
80
- - `scout` (L2): scan codebase for existing patterns, conventions, and structure
81
- - `brainstorm` (L2): when multiple valid approaches exist
82
- - `research` (L3): external knowledge lookup
83
- - `sequential-thinking` (L3): complex architecture with many trade-offs
84
- - L4 extension packs: domain-specific architecture patterns
85
- - `neural-memory` | Before architecture decisions | Recall past decisions on similar problems
86
-
87
- ## Called By (inbound)
88
-
89
- - `cook` (L1): Phase 2 PLAN
90
- - `team` (L1): task decomposition into parallel workstreams
91
- - `brainstorm` (L2): when idea needs structuring
92
- - `rescue` (L1): plan refactoring strategy
93
- - `ba` (L2): hand-off after requirements complete
94
- - `scaffold` (L1): Phase 3 architecture planning
95
- - `skill-forge` (L2): plan structure for new skill
96
- - User: `/rune plan` direct invocation
97
-
98
- ## Data Flow
99
-
100
- ### Feeds Into →
101
-
102
- - `cook` (L1): master plan + phase files cook's Phase 2-4 execution roadmap
103
- - `team` (L1): task decomposition + wave grouping → team's parallel workstream dispatch
104
- - `fix` (L2): phase file tasks fix's implementation targets
105
- - `test` (L2): phase file test taskstest's RED phase targets
106
-
107
- ### Fed By
108
-
109
- - `ba` (L2): Requirements Document → plan's primary input (locked decisions, user stories)
110
- - `scout` (L2): codebase analysis → plan's convention/pattern awareness
111
- - `neural-memory` (external): past architectural decisions → plan's precedent context
112
-
113
- ### Feedback Loops
114
-
115
- - `plan` `brainstorm`: plan requests options when multiple approaches exist → brainstorm generates options → plan selects and structures the chosen approach
116
- - `plan` ↔ `cook`: cook discovers plan gaps during implementation → plan updates phase files → cook resumes with corrected tasks
117
-
118
- ## Executable Steps (Implementation Mode)
119
-
120
- ### Step 1 Gather Context
121
-
122
- Check for `.rune/features/*/requirements.md` via `Glob`. If a Requirements Document exists (from `rune:ba`), read it it contains user stories, acceptance criteria, scope, constraints. Do NOT re-gather what BA already elicited.
123
-
124
- Invoke `rune:scout` if not already done plans without context produce wrong file paths. Call `neural-memory` (Recall Mode) to surface past architecture decisions before making new ones.
125
-
126
- ### Step 2Classify Complexity
127
-
128
- Determine inline plan vs master + phase files:
129
-
130
- | Criteria | Inline Plan | Master + Phase Files |
131
- |----------|-------------|---------------------|
132
- | Phases | 1-2 | 3+ |
133
- | Files touched | < 5 | 5+ |
134
- | Estimated LOC | < 100 | 100+ |
135
- | Cross-module | No | Yes |
136
- | Session span | Single session | Multi-session |
137
-
138
- If ANY "Master + Phase Files" criterion is true → produce master plan + phase files.
139
-
140
- ### Step 3 Decompose into Phases
141
- <MUST-READ path="references/wave-planning.md" trigger="when writing wave-structured task lists inside any phase"/>
142
-
143
- Group work into phases. Each phase: completable in one session, clear "done when", produces testable output, independent enough to run without other phases loaded.
144
-
145
- <HARD-GATE>
146
- Each phase MUST be completable by ANY coder model (including Haiku) with ONLY the phase file loaded.
147
- If the coder would need to read the master plan or other phase files to execute → the phase file is missing detail.
148
- Phase files are SELF-CONTAINED execution instructions designed for the weakest model to succeed.
149
- </HARD-GATE>
150
-
151
- Phase decomposition rules:
152
- - **Foundation first**: types, schemas, core engine
153
- - **Dependencies before consumers**: create what's imported before the importer
154
- - **Test alongside**: each phase includes its own test tasks
155
- - **Max 5-7 tasks per phase**: if more, split the phase
156
- - **Vertical slices over horizontal layers**: prefer "auth end-to-end" over "all models → all APIs → all UI"
157
-
158
- Tasks within each phase MUST be organized into waves (parallel-safe groupings). See `references/wave-planning.md`.
159
-
160
- ### Step 4 Write Master Plan File
161
- <MUST-READ path="references/plan-templates.md" trigger="when writing the master plan file"/>
162
-
163
- Save to `.rune/plan-<feature>.md`. Use the Master Plan Template in `references/plan-templates.md`. Max 80 lines no implementation details.
164
-
165
- ### Step 4.5 Workflow Registry (Complex Features Only)
166
- <MUST-READ path="references/workflow-registry.md" trigger="when feature has 4+ phases OR 3+ user-facing workflows"/>
167
-
168
- For complex features (4+ phases OR 3+ user-facing workflows): build a 4-view Workflow Registry before writing phase files. Catches orphaned components, unphased workflows, and missing state transitions at plan time.
169
-
170
- **Skip** for: trivial tasks, inline plans, single-workflow features.
171
-
172
- ### Step 5 Write Phase Files
173
- <MUST-READ path="references/plan-templates.md" trigger="when writing any phase file"/>
174
-
175
- For each phase, save to `.rune/plan-<feature>-phase<N>.md`. Use the Amateur-Proof Template in `references/plan-templates.md`.
176
-
177
- <HARD-GATE>
178
- Every phase file MUST include ALL of these sections (Amateur-Proof Checklist):
179
- 1. ✅ Data Flow — ASCII diagram of how data moves
180
- 2. Code Contracts function signatures, interfaces, types
181
- 3. ✅ Taskswith file paths, logic description, edge cases
182
- 4. ✅ Failure Scenariostable of when/then/error for each error case
183
- 5. ✅ Rejection Criteria explicit "DO NOT" anti-patterns
184
- 6. ✅ Cross-Phase Contextwhat's assumed from prior phases, what's exported for future phases
185
- 7. ✅ Acceptance Criteria — testable, includes performance if applicable
186
- 8. ✅ Test tasksevery code task has corresponding tests
187
- 9. ✅ Traceability Matrixevery BA requirement mapped to tasks and tests (skip if no BA requirements exist)
188
-
189
- A phase missing ANY of sections 1-7 is INCOMPLETE the weakest coder will guess wrong.
190
- Performance Constraints section is optional (only when NFRs apply).
191
- </HARD-GATE>
192
-
193
- ### Step 5.5 — Completeness Scoring (Alternatives)
194
- <MUST-READ path="references/completeness-scoring.md" trigger="when presenting alternative approaches"/>
195
-
196
- When presenting alternatives (from brainstorm or Step 3), rate each **Completeness X/10**. Always recommend the higher-completeness option with AI, the marginal cost of completeness is near-zero.
197
-
198
- ### Step 6Present and Get Approval
199
-
200
- Present the **master plan** to user (NOT all phase files). User reviews: phase breakdown, key decisions, risks, completeness scores. Wait for explicit approval ("go", "proceed", "yes") before writing phase files.
201
-
202
- ### Step 7 Execution Handoff
203
-
204
- ```
205
- 1. Cook loads master plan → identifies current phase (first ⬚ Pending)
206
- 2. Cook loads ONLY that phase's file
207
- 3. Coder executes tasks in the phase file
208
- 4. Mark tasks done in phase file as completed
209
- 5. When phase complete update master plan status: ⬚ → ✅
210
- 6. Next session: load master plan → find next ⬚ phase → load phase file execute
211
- ```
212
-
213
- Model selection: Opus plans phases (this skill). Sonnet/Haiku executes them (cook → fix).
214
-
215
- ## Inline Plan (Trivial Tasks)
216
-
217
- For trivial tasks (1-2 phases, < 5 files, < 100 LOC) — skip master + phase files. See inline plan template in `references/plan-templates.md`.
218
-
219
- ## Re-Planning (Dynamic Adaptation)
220
-
221
- When cook encounters unexpected conditions during execution:
222
-
223
- **Trigger Conditions:** Phase hits max debug-fix loops (3) | new files outside plan scope | dependency change | user requests scope change.
224
-
225
- **Re-Plan Protocol:**
226
- 1. Read master plan + current phase file + delta context (what changed, what failed)
227
- 2. Assess impact: which remaining phases are affected?
228
- 3. Revise: mark completed phases, modify affected phase files, add new phases if scope expanded. Do NOT rewrite completed phases.
229
- 4. Present revised master plan with diff summary — get approval before resuming.
230
-
231
- ## Feature Spec Mode
232
-
233
- **Step 1** Problem Statement: what problem, who has it, current workaround?
234
- **Step 2** — User Stories: primary + 2-3 secondary + edge cases. Format: `As a [persona], I want to [action] so that [benefit]`
235
- **Step 3** — Acceptance Criteria: `GIVEN [context] WHEN [action] THEN [result]` — happy path + errors + performance
236
- **Step 4** — Scope Definition: In scope / Out of scope / Dependencies / Open questions
237
- **Step 5** — Write Spec File: save to `.rune/features/<feature-name>/spec.md`
238
-
239
- After spec approved transition to Implementation Mode.
240
-
241
- ## Roadmap Mode
242
-
243
- **Step 1** — Inventory: scan for open issues, TODO/FIXME, planned features.
244
- **Step 2** — Prioritize (ICE Scoring): Impact × Confidence × Ease (each 1-10), sort descending.
245
- **Step 3** — Group into Milestones: M1 = top 3-5 by ICE, M2 = next 3-5, Backlog = remaining.
246
- **Step 4** — Write to `.rune/roadmap.md`.
247
-
248
- ## Output Format
249
-
250
- **Master Plan** (`.rune/plan-<feature>.md`): Overview, Phases table, Key Decisions, Decision Compliance, Architecture, Dependencies/Risks. Max 80 lines. See `references/plan-templates.md`.
251
-
252
- **Phase File** (`.rune/plan-<feature>-phase<N>.md`): 7 mandatory sections (Amateur-Proof Template). Max 200 lines. Self-contained. See `references/plan-templates.md`.
253
-
254
- **Inline Plan** (trivial tasks): Changes, Tests, Risks. See `references/plan-templates.md`.
255
-
256
- ## Outcome Block (Mandatory)
257
- <MUST-READ path="references/outcome-block.md" trigger="when writing the final section of any plan output"/>
258
-
259
- Every plan output master plan, phase file, or inline plan — MUST end with an **Outcome Block** containing: What Was Planned + Immediate Next Action (single action, imperative) + How to Measure table (at least one shell command).
260
-
261
- ## Constraints
262
-
263
- 1. MUST produce master plan + phase files for non-trivial tasks (3+ phases OR 5+ files OR 100+ LOC)
264
- 2. MUST keep master plan under 80 lines — overview only, no implementation details
265
- 3. MUST keep each phase file under 200 lines self-contained, Amateur-proof
266
- 4. MUST include exact file paths for every task — no vague "set up the database"
267
- 5. MUST include test tasks for every phase that produces code
268
- 6. MUST include ALL Amateur-Proof sections: data flow, code contracts, tasks, failure scenarios, rejection criteria, cross-phase context, acceptance criteria
269
- 7. MUST order phases by dependency — don't plan phase 3 before phase 1's output exists
270
- 8. MUST get user approval before writing phase files
271
- 9. Phase files MUST be self-contained coder should NOT need master plan to execute
272
- 10. Max 8 phases per master plan — if more, split into sub-projects
273
- 11. MUST include failure scenarios table — what happens when things go wrong
274
- 12. MUST include rejection criteria — explicit "DO NOT" anti-patterns to prevent common mistakes
275
- 13. MUST include cross-phase context — what's assumed from prior phases, what's exported for future
276
-
277
- ## Returns
278
-
279
- | Artifact | Format | Location |
280
- |----------|--------|----------|
281
- | Master plan | Markdown | `.rune/plan-<feature>.md` |
282
- | Phase files | Markdown | `.rune/plan-<feature>-phase<N>.md` (one per phase) |
283
- | Feature spec | Markdown | `.rune/features/<name>/spec.md` (Feature Spec Mode only) |
284
- | Roadmap | Markdown | `.rune/roadmap.md` (Roadmap Mode only) |
285
- | Inline plan | Markdown (inline) | Emitted directly for trivial tasks |
286
-
287
- ## Sharp Edges
288
-
289
- | Failure Mode | Severity | Mitigation |
290
- |---|---|---|
291
- | Monolithic plan file that overflows context | CRITICAL | HARD-GATE: non-trivial tasks MUST use master + phase files |
292
- | Phase file too vague for Amateur to execute | CRITICAL | Amateur-Proof template: ALL 7 mandatory sections required |
293
- | Coder uses wrong approach (toFixed for money, mutation) | CRITICAL | Rejection Criteria section: explicit "DO NOT" list prevents common traps |
294
- | Coder doesn't handle errors properly | HIGH | Failure Scenarios table: when/then/error for EVERY error case |
295
- | Coder doesn't know what other phases expect | HIGH | Cross-Phase Context: explicit imports/exports between phases |
296
- | Coder over-engineers or under-engineers perf | HIGH | Performance Constraints: specific metrics with thresholds |
297
- | Master plan contains implementation detail | HIGH | Max 80 lines, overview only detail goes in phase files |
298
- | Phase file references other phase files | HIGH | Phase files are self-contained — cross-phase section handles this |
299
- | Plan without scout contextinvented file paths | CRITICAL | Step 1: scout first, always |
300
- | Phase with zero test tasks | CRITICAL | HARD-GATE rejects it |
301
- | 10+ phases overwhelming the master plan | MEDIUM | Max 8 phases split into sub-projects if more |
302
- | Task without File path or Verify command | HIGH | Every task MUST have File + Test + Verify + Commit fields no vague "implement the feature" tasks |
303
- | Horizontal layer planning (all models all APIs all UI) | HIGH | Vertical slices parallelize better. Use wave-based grouping: independent tasks in same wave, dependent tasks in later waves |
304
- | Tasks without `depends_on` in Wave 2+ | MEDIUM | Implicit dependencies break parallel dispatch. Every Wave 2+ task MUST declare `depends_on` |
305
- | Plan ignores locked Decisions from BA | CRITICAL | Decision Compliance section cross-checks requirements.md — locked decisions are non-negotiable |
306
- | Complex feature missing Workflow Registry — components planned but never wired | HIGH | Step 4.5: 4-view registry catches orphaned components, unphased workflows, and missing state transitions before phase files are written |
307
- | Recommending shortcut approach without Completeness Score | MEDIUM | Step 5.5: every alternative needs X/10 Completeness score + dual effort estimate (human vs AI). "Saves 70 LOC" is not a reason when AI makes the delta cost minutes |
308
- | Plan output missing Outcome Block | MEDIUM | Every plan output MUST end with Outcome Block (What Was Planned + Immediate Next Action + How to Measure) — executor drift when omitted |
309
- | Outcome Block "Next Action" is a list, not one action | LOW | One action only — ambiguity about where to start causes re-analysis and lost context |
310
-
311
- ## Self-Validation
312
-
313
- ```
314
- SELF-VALIDATION (run before presenting plan to user):
315
- - [ ] Every task has a clear file path — no "update relevant files" vagueness
316
- - [ ] Wave dependencies are acyclic — no task depends on a task in the same or later wave
317
- - [ ] Every code-producing phase has at least one test task
318
- - [ ] Phase files have ALL Amateur-Proof sections (data flow, code contracts, failure scenarios, rejection criteria)
319
- - [ ] Locked decisions from BA are reflected in plan none contradicted or ignored
320
- - [ ] Every BA requirement has a corresponding Req ID in at least one phase's Traceability Matrix
321
- ```
322
-
323
- ## Done When
324
-
325
- - Complexity classified (inline vs master + phase files)
326
- - Scout output read and conventions/patterns identified
327
- - BA requirements consumed (if available)
328
- - Master plan written (< 80 lines) with phase table and key decisions
329
- - Phase files written (< 200 lines each) with ALL Amateur-Proof sections:
330
- - Data flow diagram, code contracts, tasks with edge cases
331
- - Failure scenarios table, rejection criteria (DO NOTs)
332
- - Cross-phase context (assumes/exports), acceptance criteria
333
- - Every code-producing phase has test tasks
334
- - Master plan presented to user with "Awaiting Approval"
335
- - User has explicitly approved
336
- - Self-Validation: all checks passed
337
- - Outcome Block present in every plan output (master plan, phase files, inline plan)
338
- - Outcome Block contains: What Was Planned + Immediate Next Action (single action) + How to Measure table
339
-
340
- ## Cost Profile
341
-
342
- ~3000-8000 tokens input, ~2000-5000 tokens output (master + all phase files). Opus for architectural reasoning. Most expensive L2 skill but runs infrequently. Phase files are written once, executed by cheaper models (Sonnet/Haiku).
1
+ ---
2
+ name: plan
3
+ description: Create structured implementation plans from requirements. Produces master plan + phase files for enterprise-scale project management. Master plan = overview (<80 lines). Phase files = execution detail (<150 lines each). Each session handles 1 phase. Uses opus for deep reasoning.
4
+ metadata:
5
+ author: runedev
6
+ version: "1.2.0"
7
+ layer: L2
8
+ model: opus
9
+ group: creation
10
+ tools: "Read, Write, Edit, Glob, Grep"
11
+ emit: plan.ready
12
+ listen: codebase.scanned
13
+ ---
14
+
15
+ # plan
16
+
17
+ ## Purpose
18
+
19
+ Strategic planning engine for the Rune ecosystem. Produces a **master plan + phase files** architecture NOT a single monolithic plan. The master plan is a concise overview (<80 lines) that references separate phase files, each containing enough detail (<150 lines) that ANY model can execute with high accuracy.
20
+
21
+ **Design principle: Plan for the weakest coder.** Phase files are designed so that even an Amateur-level model (Haiku) can execute them with minimal errors. When the plan satisfies the Amateur's needs, every model benefits — Junior (Sonnet) executes near-perfectly, Senior (Opus) executes flawlessly.
22
+
23
+ This is enterprise-grade project management: BA produces WHAT → Plan produces HOW (structured into phases) → ANY coder executes each phase with full context.
24
+
25
+ <HARD-GATE>
26
+ NEVER produce a single monolithic plan file for non-trivial tasks.
27
+ Non-trivial = 3+ phases OR 5+ files OR estimated > 100 LOC total change.
28
+ For non-trivial tasks: MUST produce master plan + separate phase files.
29
+ For trivial tasks (1-2 phases, < 5 files): inline plan is acceptable.
30
+ </HARD-GATE>
31
+
32
+ ## Architecture: Master Plan + Phase Files
33
+
34
+ ```
35
+ .rune/
36
+ plan-<feature>.md Master plan: phases overview, goals, status tracker (<80 lines)
37
+ plan-<feature>-phase1.md ← Phase 1 detail: tasks, acceptance criteria, files to touch (<150 lines)
38
+ plan-<feature>-phase2.md ← Phase 2 detail
39
+ ...
40
+ ```
41
+
42
+ ### Why This Architecture
43
+
44
+ - **Big context = even Opus misses details and makes mistakes**
45
+ - **Small context = Sonnet handles correctly, Opus has zero mistakes**
46
+ - Phase isolation prevents cross-contamination of concerns
47
+ - Each session starts clean with only the relevant phase loaded
48
+ - Coder (Sonnet/Haiku) can execute a phase file without needing the full plan
49
+
50
+ ### Size Constraints
51
+
52
+ | File | Max Lines | Content |
53
+ |------|-----------|---------|
54
+ | Master plan | 80 lines | Overview, phase table, key decisions, status |
55
+ | Phase file | 200 lines | Amateur-proof template: data flow, contracts, tasks, failures, NFRs, rejections, cross-phase |
56
+ | Total phases | Max 8 | If > 8 phases, split into sub-projects |
57
+
58
+ ## Modes
59
+
60
+ ### Implementation Mode (default)
61
+ Standard implementation planning — decompose task into phased steps with code details.
62
+
63
+ ### Feature Spec Mode
64
+ Product-oriented planning — write a feature specification before implementation.
65
+ **Triggers:** user says "spec", "feature spec", "write spec", "PRD" — or `/rune plan spec <feature>`
66
+
67
+ ### Roadmap Mode
68
+ High-level multi-feature planning — organize features into milestones.
69
+ **Triggers:** user says "roadmap", "milestone", "release plan", "what to build next" — or `/rune plan roadmap`
70
+
71
+ ## Triggers
72
+
73
+ - Called by `cook` when task scope > 1 file (Implementation Mode)
74
+ - Called by `team` for high-level task decomposition
75
+ - `/rune plan <task>`manual planning
76
+ - `/rune plan spec <feature>` feature specification
77
+ - `/rune plan roadmap` — roadmap planning
78
+ - Auto-trigger: when user says "implement", "build", "create" with complex scope
79
+
80
+ ## Calls (outbound)
81
+
82
+ - `scout` (L2): scan codebase for existing patterns, conventions, and structure
83
+ - `brainstorm` (L2): when multiple valid approaches exist
84
+ - `research` (L3): external knowledge lookup
85
+ - `sequential-thinking` (L3): complex architecture with many trade-offs
86
+ - L4 extension packs: domain-specific architecture patterns
87
+ - `neural-memory` | Before architecture decisions | Recall past decisions on similar problems
88
+
89
+ ## Called By (inbound)
90
+
91
+ - `cook` (L1): Phase 2 PLAN
92
+ - `team` (L1): task decomposition into parallel workstreams
93
+ - `brainstorm` (L2): when idea needs structuring
94
+ - `rescue` (L1): plan refactoring strategy
95
+ - `ba` (L2): hand-off after requirements complete
96
+ - `scaffold` (L1): Phase 3 architecture planning
97
+ - `skill-forge` (L2): plan structure for new skill
98
+ - User: `/rune plan` direct invocation
99
+
100
+ ## Data Flow
101
+
102
+ ### Feeds Into
103
+
104
+ - `cook` (L1): master plan + phase filescook's Phase 2-4 execution roadmap
105
+ - `team` (L1): task decomposition + wave grouping team's parallel workstream dispatch
106
+ - `fix` (L2): phase file tasks → fix's implementation targets
107
+ - `test` (L2): phase file test tasks → test's RED phase targets
108
+
109
+ ### Fed By
110
+
111
+ - `ba` (L2): Requirements Document → plan's primary input (locked decisions, user stories)
112
+ - `scout` (L2): codebase analysis → plan's convention/pattern awareness
113
+ - `neural-memory` (external): past architectural decisions → plan's precedent context
114
+
115
+ ### Feedback Loops
116
+
117
+ - `plan` ↔ `brainstorm`: plan requests options when multiple approaches exist → brainstorm generates options → plan selects and structures the chosen approach
118
+ - `plan` `cook`: cook discovers plan gaps during implementation → plan updates phase files → cook resumes with corrected tasks
119
+
120
+ ## Executable Steps (Implementation Mode)
121
+
122
+ ### Step 1Gather Context
123
+
124
+ Check for `.rune/features/*/requirements.md` via `Glob`. If a Requirements Document exists (from `rune:ba`), read it it contains user stories, acceptance criteria, scope, constraints. Do NOT re-gather what BA already elicited.
125
+
126
+ Invoke `rune:scout` if not already done plans without context produce wrong file paths. Call `neural-memory` (Recall Mode) to surface past architecture decisions before making new ones.
127
+
128
+ ### Step 2 Classify Complexity
129
+
130
+ Determine inline plan vs master + phase files:
131
+
132
+ | Criteria | Inline Plan | Master + Phase Files |
133
+ |----------|-------------|---------------------|
134
+ | Phases | 1-2 | 3+ |
135
+ | Files touched | < 5 | 5+ |
136
+ | Estimated LOC | < 100 | 100+ |
137
+ | Cross-module | No | Yes |
138
+ | Session span | Single session | Multi-session |
139
+
140
+ If ANY "Master + Phase Files" criterion is true → produce master plan + phase files.
141
+
142
+ ### Step 3 — Decompose into Phases
143
+ <MUST-READ path="references/wave-planning.md" trigger="when writing wave-structured task lists inside any phase"/>
144
+
145
+ Group work into phases. Each phase: completable in one session, clear "done when", produces testable output, independent enough to run without other phases loaded.
146
+
147
+ <HARD-GATE>
148
+ Each phase MUST be completable by ANY coder model (including Haiku) with ONLY the phase file loaded.
149
+ If the coder would need to read the master plan or other phase files to execute → the phase file is missing detail.
150
+ Phase files are SELF-CONTAINED execution instructions — designed for the weakest model to succeed.
151
+ </HARD-GATE>
152
+
153
+ Phase decomposition rules:
154
+ - **Foundation first**: types, schemas, core engine
155
+ - **Dependencies before consumers**: create what's imported before the importer
156
+ - **Test alongside**: each phase includes its own test tasks
157
+ - **Max 5-7 tasks per phase**: if more, split the phase
158
+ - **Vertical slices over horizontal layers**: prefer "auth end-to-end" over "all models → all APIs → all UI"
159
+
160
+ Tasks within each phase MUST be organized into waves (parallel-safe groupings). See `references/wave-planning.md`.
161
+
162
+ ### Step 4 — Write Master Plan File
163
+ <MUST-READ path="references/plan-templates.md" trigger="when writing the master plan file"/>
164
+
165
+ Save to `.rune/plan-<feature>.md`. Use the Master Plan Template in `references/plan-templates.md`. Max 80 lines no implementation details.
166
+
167
+ ### Step 4.5 — Workflow Registry (Complex Features Only)
168
+ <MUST-READ path="references/workflow-registry.md" trigger="when feature has 4+ phases OR 3+ user-facing workflows"/>
169
+
170
+ For complex features (4+ phases OR 3+ user-facing workflows): build a 4-view Workflow Registry before writing phase files. Catches orphaned components, unphased workflows, and missing state transitions at plan time.
171
+
172
+ **Skip** for: trivial tasks, inline plans, single-workflow features.
173
+
174
+ ### Step 5 — Write Phase Files
175
+ <MUST-READ path="references/plan-templates.md" trigger="when writing any phase file"/>
176
+
177
+ For each phase, save to `.rune/plan-<feature>-phase<N>.md`. Use the Amateur-Proof Template in `references/plan-templates.md`.
178
+
179
+ <HARD-GATE>
180
+ Every phase file MUST include ALL of these sections (Amateur-Proof Checklist):
181
+ 1. ✅ Data Flow ASCII diagram of how data moves
182
+ 2. ✅ Code Contractsfunction signatures, interfaces, types
183
+ 3. ✅ Taskswith file paths, logic description, edge cases
184
+ 4. ✅ Failure Scenariostable of when/then/error for each error case
185
+ 5. ✅ Rejection Criteria — explicit "DO NOT" anti-patterns
186
+ 6. ✅ Cross-Phase Contextwhat's assumed from prior phases, what's exported for future phases
187
+ 7. ✅ Acceptance Criteriatestable, includes performance if applicable
188
+ 8. ✅ Test tasks — every code task has corresponding tests
189
+ 9. Traceability Matrix every BA requirement mapped to tasks and tests (skip if no BA requirements exist)
190
+
191
+ A phase missing ANY of sections 1-7 is INCOMPLETE — the weakest coder will guess wrong.
192
+ Performance Constraints section is optional (only when NFRs apply).
193
+ </HARD-GATE>
194
+
195
+ ### Step 5.5 — Completeness Scoring (Alternatives)
196
+ <MUST-READ path="references/completeness-scoring.md" trigger="when presenting alternative approaches"/>
197
+
198
+ When presenting alternatives (from brainstorm or Step 3), rate each **Completeness X/10**. Always recommend the higher-completeness option with AI, the marginal cost of completeness is near-zero.
199
+
200
+ ### Step 6 Present and Get Approval
201
+
202
+ Present the **master plan** to user (NOT all phase files). User reviews: phase breakdown, key decisions, risks, completeness scores. Wait for explicit approval ("go", "proceed", "yes") before writing phase files.
203
+
204
+ ### Step 7 — Execution Handoff
205
+
206
+ ```
207
+ 1. Cook loads master plan identifies current phase (first ⬚ Pending)
208
+ 2. Cook loads ONLY that phase's file
209
+ 3. Coder executes tasks in the phase file
210
+ 4. Mark tasks done in phase file as completed
211
+ 5. When phase complete → update master plan status: ⬚ → ✅
212
+ 6. Next session: load master plan → find next ⬚ phase → load phase file → execute
213
+ ```
214
+
215
+ Model selection: Opus plans phases (this skill). Sonnet/Haiku executes them (cook → fix).
216
+
217
+ ## Inline Plan (Trivial Tasks)
218
+
219
+ For trivial tasks (1-2 phases, < 5 files, < 100 LOC) — skip master + phase files. See inline plan template in `references/plan-templates.md`.
220
+
221
+ ## Re-Planning (Dynamic Adaptation)
222
+
223
+ When cook encounters unexpected conditions during execution:
224
+
225
+ **Trigger Conditions:** Phase hits max debug-fix loops (3) | new files outside plan scope | dependency change | user requests scope change.
226
+
227
+ **Re-Plan Protocol:**
228
+ 1. Read master plan + current phase file + delta context (what changed, what failed)
229
+ 2. Assess impact: which remaining phases are affected?
230
+ 3. Revise: mark ✅ completed phases, modify affected phase files, add new phases if scope expanded. Do NOT rewrite completed phases.
231
+ 4. Present revised master plan with diff summary — get approval before resuming.
232
+
233
+ ## Feature Spec Mode
234
+
235
+ **Step 1** — Problem Statement: what problem, who has it, current workaround?
236
+ **Step 2** — User Stories: primary + 2-3 secondary + edge cases. Format: `As a [persona], I want to [action] so that [benefit]`
237
+ **Step 3** — Acceptance Criteria: `GIVEN [context] WHEN [action] THEN [result]` — happy path + errors + performance
238
+ **Step 4** — Scope Definition: In scope / Out of scope / Dependencies / Open questions
239
+ **Step 5** Write Spec File: save to `.rune/features/<feature-name>/spec.md`
240
+
241
+ After spec approved → transition to Implementation Mode.
242
+
243
+ ## Roadmap Mode
244
+
245
+ **Step 1** — Inventory: scan for open issues, TODO/FIXME, planned features.
246
+ **Step 2** — Prioritize (ICE Scoring): Impact × Confidence × Ease (each 1-10), sort descending.
247
+ **Step 3** — Group into Milestones: M1 = top 3-5 by ICE, M2 = next 3-5, Backlog = remaining.
248
+ **Step 4** — Write to `.rune/roadmap.md`.
249
+
250
+ ## Output Format
251
+
252
+ **Master Plan** (`.rune/plan-<feature>.md`): Overview, Phases table, Key Decisions, Decision Compliance, Architecture, Dependencies/Risks. Max 80 lines. See `references/plan-templates.md`.
253
+
254
+ **Phase File** (`.rune/plan-<feature>-phase<N>.md`): 7 mandatory sections (Amateur-Proof Template). Max 200 lines. Self-contained. See `references/plan-templates.md`.
255
+
256
+ **Inline Plan** (trivial tasks): Changes, Tests, Risks. See `references/plan-templates.md`.
257
+
258
+ ## Outcome Block (Mandatory)
259
+ <MUST-READ path="references/outcome-block.md" trigger="when writing the final section of any plan output"/>
260
+
261
+ Every plan output — master plan, phase file, or inline plan — MUST end with an **Outcome Block** containing: What Was Planned + Immediate Next Action (single action, imperative) + How to Measure table (at least one shell command).
262
+
263
+ ## Change Stacking (Overlap Detection)
264
+
265
+ > From OpenSpec (Fission-AI/OpenSpec, 32.8k★): "Dependencies without metadata create phantom coupling."
266
+
267
+ When producing phase files with wave-based task grouping, every task MUST declare dependency metadata:
268
+
269
+ ```markdown
270
+ ### Task: Implement auth middleware
271
+ - **File**: `src/middleware/auth.ts`new
272
+ - **touches**: [src/middleware/auth.ts, src/types/auth.d.ts]
273
+ - **provides**: [AuthMiddleware, verifyToken()]
274
+ - **requires**: [UserModel from Wave 1]
275
+ - **depends_on**: [task-1a]
276
+ ```
277
+
278
+ **Pre-dispatch validation** (run after all tasks written, before presenting plan):
279
+
280
+ | Check | Detection | Action |
281
+ |-------|-----------|--------|
282
+ | **File overlap** | Same file in `touches[]` of 2+ tasks in same wave | BLOCK — move to sequential waves or merge tasks |
283
+ | **Missing dependency** | Task A's `requires[]` not in any prior task's `provides[]` | BLOCK — add missing task or fix dependency chain |
284
+ | **Cycle detection** | Task A `depends_on` B, B `depends_on` A | BLOCK — decompose into smaller tasks to break cycle |
285
+ | **Orphaned provides** | Task declares `provides[]` but no future task `requires[]` it | WARN may indicate dead code or missing consumer task |
286
+
287
+ **Skip if**: Inline plan (trivial task), single-phase plan, or all tasks are strictly sequential.
288
+
289
+ ## Constraints
290
+
291
+ 1. MUST produce master plan + phase files for non-trivial tasks (3+ phases OR 5+ files OR 100+ LOC)
292
+ 2. MUST keep master plan under 80 lines overview only, no implementation details
293
+ 3. MUST keep each phase file under 200 lines self-contained, Amateur-proof
294
+ 4. MUST include exact file paths for every task no vague "set up the database"
295
+ 5. MUST include test tasks for every phase that produces code
296
+ 6. MUST include ALL Amateur-Proof sections: data flow, code contracts, tasks, failure scenarios, rejection criteria, cross-phase context, acceptance criteria
297
+ 7. MUST order phases by dependency don't plan phase 3 before phase 1's output exists
298
+ 8. MUST get user approval before writing phase files
299
+ 9. Phase files MUST be self-contained coder should NOT need master plan to execute
300
+ 10. Max 8 phases per master plan if more, split into sub-projects
301
+ 11. MUST include failure scenarios tablewhat happens when things go wrong
302
+ 12. MUST include rejection criteriaexplicit "DO NOT" anti-patterns to prevent common mistakes
303
+ 13. MUST include cross-phase context what's assumed from prior phases, what's exported for future
304
+
305
+ ## Returns
306
+
307
+ | Artifact | Format | Location |
308
+ |----------|--------|----------|
309
+ | Master plan | Markdown | `.rune/plan-<feature>.md` |
310
+ | Phase files | Markdown | `.rune/plan-<feature>-phase<N>.md` (one per phase) |
311
+ | Feature spec | Markdown | `.rune/features/<name>/spec.md` (Feature Spec Mode only) |
312
+ | Roadmap | Markdown | `.rune/roadmap.md` (Roadmap Mode only) |
313
+ | Inline plan | Markdown (inline) | Emitted directly for trivial tasks |
314
+
315
+ ## Sharp Edges
316
+
317
+ | Failure Mode | Severity | Mitigation |
318
+ |---|---|---|
319
+ | Monolithic plan file that overflows context | CRITICAL | HARD-GATE: non-trivial tasks MUST use master + phase files |
320
+ | Phase file too vague for Amateur to execute | CRITICAL | Amateur-Proof template: ALL 7 mandatory sections required |
321
+ | Coder uses wrong approach (toFixed for money, mutation) | CRITICAL | Rejection Criteria section: explicit "DO NOT" list prevents common traps |
322
+ | Coder doesn't handle errors properly | HIGH | Failure Scenarios table: when/then/error for EVERY error case |
323
+ | Coder doesn't know what other phases expect | HIGH | Cross-Phase Context: explicit imports/exports between phases |
324
+ | Coder over-engineers or under-engineers perf | HIGH | Performance Constraints: specific metrics with thresholds |
325
+ | Master plan contains implementation detail | HIGH | Max 80 lines, overview only — detail goes in phase files |
326
+ | Phase file references other phase files | HIGH | Phase files are self-contained cross-phase section handles this |
327
+ | Plan without scout context — invented file paths | CRITICAL | Step 1: scout first, always |
328
+ | Phase with zero test tasks | CRITICAL | HARD-GATE rejects it |
329
+ | 10+ phases overwhelming the master plan | MEDIUM | Max 8 phases — split into sub-projects if more |
330
+ | Task without File path or Verify command | HIGH | Every task MUST have File + Test + Verify + Commit fields — no vague "implement the feature" tasks |
331
+ | Horizontal layer planning (all models → all APIs → all UI) | HIGH | Vertical slices parallelize better. Use wave-based grouping: independent tasks in same wave, dependent tasks in later waves |
332
+ | Tasks without `depends_on` in Wave 2+ | MEDIUM | Implicit dependencies break parallel dispatch. Every Wave 2+ task MUST declare `depends_on` |
333
+ | Plan ignores locked Decisions from BA | CRITICAL | Decision Compliance section cross-checks requirements.md locked decisions are non-negotiable |
334
+ | Complex feature missing Workflow Registry — components planned but never wired | HIGH | Step 4.5: 4-view registry catches orphaned components, unphased workflows, and missing state transitions before phase files are written |
335
+ | Recommending shortcut approach without Completeness Score | MEDIUM | Step 5.5: every alternative needs X/10 Completeness score + dual effort estimate (human vs AI). "Saves 70 LOC" is not a reason when AI makes the delta cost minutes |
336
+ | Plan output missing Outcome Block | MEDIUM | Every plan output MUST end with Outcome Block (What Was Planned + Immediate Next Action + How to Measure) — executor drift when omitted |
337
+ | Outcome Block "Next Action" is a list, not one action | LOW | One action only — ambiguity about where to start causes re-analysis and lost context |
338
+ | Overlapping file ownership across parallel phases/streams | HIGH | Change Stacking: every task declares `touches[]` overlap detection flags same file in 2+ tasks before execution |
339
+ | Missing dependency between tasks that share artifacts | HIGH | Every task declares `provides[]` and `requires[]` — cycle detection + missing dep check before dispatch |
340
+
341
+ ## Self-Validation
342
+
343
+ ```
344
+ SELF-VALIDATION (run before presenting plan to user):
345
+ - [ ] Every task has a clear file path — no "update relevant files" vagueness
346
+ - [ ] Wave dependencies are acyclic — no task depends on a task in the same or later wave
347
+ - [ ] Every code-producing phase has at least one test task
348
+ - [ ] Phase files have ALL Amateur-Proof sections (data flow, code contracts, failure scenarios, rejection criteria)
349
+ - [ ] Locked decisions from BA are reflected in plan — none contradicted or ignored
350
+ - [ ] Every BA requirement has a corresponding Req ID in at least one phase's Traceability Matrix
351
+ ```
352
+
353
+ ## Done When
354
+
355
+ - Complexity classified (inline vs master + phase files)
356
+ - Scout output read and conventions/patterns identified
357
+ - BA requirements consumed (if available)
358
+ - Master plan written (< 80 lines) with phase table and key decisions
359
+ - Phase files written (< 200 lines each) with ALL Amateur-Proof sections:
360
+ - Data flow diagram, code contracts, tasks with edge cases
361
+ - Failure scenarios table, rejection criteria (DO NOTs)
362
+ - Cross-phase context (assumes/exports), acceptance criteria
363
+ - Every code-producing phase has test tasks
364
+ - Master plan presented to user with "Awaiting Approval"
365
+ - User has explicitly approved
366
+ - Self-Validation: all checks passed
367
+ - Outcome Block present in every plan output (master plan, phase files, inline plan)
368
+ - Outcome Block contains: What Was Planned + Immediate Next Action (single action) + How to Measure table
369
+
370
+ ## Cost Profile
371
+
372
+ ~3000-8000 tokens input, ~2000-5000 tokens output (master + all phase files). Opus for architectural reasoning. Most expensive L2 skill but runs infrequently. Phase files are written once, executed by cheaper models (Sonnet/Haiku).