@rune-kit/rune 2.2.6 → 2.3.1

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 (91) hide show
  1. package/README.md +395 -389
  2. package/compiler/__tests__/tier-override.test.js +158 -0
  3. package/compiler/adapters/antigravity.js +3 -8
  4. package/compiler/adapters/codex.js +3 -8
  5. package/compiler/adapters/cursor.js +3 -8
  6. package/compiler/adapters/generic.js +3 -8
  7. package/compiler/adapters/openclaw.js +4 -9
  8. package/compiler/adapters/opencode.js +3 -8
  9. package/compiler/adapters/windsurf.js +3 -8
  10. package/compiler/bin/rune.js +34 -1
  11. package/compiler/emitter.js +94 -5
  12. package/compiler/transforms/branding.js +10 -3
  13. package/docs/ARCHITECTURE.md +3 -3
  14. package/docs/SKILL-TEMPLATE.md +15 -0
  15. package/docs/VISION.md +3 -3
  16. package/docs/guides/index.html +14 -14
  17. package/docs/index.html +82 -13
  18. package/docs/script.js +33 -6
  19. package/docs/skills/index.html +832 -832
  20. package/docs/style.css +62 -0
  21. package/extensions/ai-ml/PACK.md +7 -0
  22. package/extensions/content/PACK.md +7 -0
  23. package/extensions/mobile/PACK.md +9 -9
  24. package/extensions/zalo/PACK.md +9 -0
  25. package/package.json +8 -6
  26. package/skills/adversary/SKILL.md +12 -0
  27. package/skills/audit/SKILL.md +526 -467
  28. package/skills/autopsy/SKILL.md +12 -0
  29. package/skills/ba/SKILL.md +349 -342
  30. package/skills/brainstorm/SKILL.md +11 -0
  31. package/skills/completion-gate/SKILL.md +260 -249
  32. package/skills/context-engine/SKILL.md +77 -1
  33. package/skills/context-pack/SKILL.md +160 -0
  34. package/skills/cook/SKILL.md +648 -958
  35. package/skills/cook/references/deviation-rules.md +19 -0
  36. package/skills/cook/references/error-recovery.md +37 -0
  37. package/skills/cook/references/exit-conditions.md +31 -0
  38. package/skills/cook/references/loop-detection.md +39 -0
  39. package/skills/cook/references/mid-run-signals.md +31 -0
  40. package/skills/cook/references/output-format.md +40 -0
  41. package/skills/cook/references/pack-detection.md +82 -0
  42. package/skills/cook/references/pause-resume-template.md +38 -0
  43. package/skills/cook/references/rfc-template.md +52 -0
  44. package/skills/cook/references/sharp-edges.md +24 -0
  45. package/skills/cook/references/subagent-status.md +38 -0
  46. package/skills/db/SKILL.md +12 -0
  47. package/skills/debug/SKILL.md +392 -362
  48. package/skills/deploy/SKILL.md +10 -0
  49. package/skills/deploy/references/post-deploy-integration.md +192 -0
  50. package/skills/design/SKILL.md +9 -0
  51. package/skills/docs/SKILL.md +12 -0
  52. package/skills/docs-seeker/SKILL.md +11 -0
  53. package/skills/fix/SKILL.md +281 -249
  54. package/skills/incident/SKILL.md +10 -0
  55. package/skills/launch/SKILL.md +12 -0
  56. package/skills/logic-guardian/SKILL.md +11 -0
  57. package/skills/marketing/SKILL.md +13 -0
  58. package/skills/mcp-builder/SKILL.md +13 -0
  59. package/skills/onboard/SKILL.md +50 -2
  60. package/skills/perf/SKILL.md +11 -0
  61. package/skills/plan/SKILL.md +342 -688
  62. package/skills/plan/references/completeness-scoring.md +36 -0
  63. package/skills/plan/references/outcome-block.md +40 -0
  64. package/skills/plan/references/plan-templates.md +193 -0
  65. package/skills/plan/references/wave-planning.md +44 -0
  66. package/skills/plan/references/workflow-registry.md +52 -0
  67. package/skills/preflight/SKILL.md +360 -280
  68. package/skills/rescue/SKILL.md +11 -0
  69. package/skills/research/SKILL.md +149 -150
  70. package/skills/retro/SKILL.md +11 -0
  71. package/skills/review/SKILL.md +489 -396
  72. package/skills/review-intake/SKILL.md +11 -0
  73. package/skills/safeguard/SKILL.md +12 -0
  74. package/skills/scaffold/SKILL.md +10 -0
  75. package/skills/scope-guard/SKILL.md +11 -0
  76. package/skills/scout/SKILL.md +9 -0
  77. package/skills/sentinel/SKILL.md +296 -425
  78. package/skills/sentinel/references/config-protection.md +52 -0
  79. package/skills/sentinel/references/destructive-commands.md +39 -0
  80. package/skills/sentinel/references/domain-hooks.md +73 -0
  81. package/skills/sentinel/references/framework-patterns.md +46 -0
  82. package/skills/sentinel/references/owasp-patterns.md +69 -0
  83. package/skills/sentinel/references/secret-patterns.md +40 -0
  84. package/skills/sentinel/references/skill-content-guard.md +54 -0
  85. package/skills/session-bridge/SKILL.md +56 -2
  86. package/skills/skill-forge/SKILL.md +47 -2
  87. package/skills/skill-router/{SKILL.md → skill.md} +446 -365
  88. package/skills/surgeon/SKILL.md +12 -0
  89. package/skills/team/SKILL.md +34 -1
  90. package/skills/test/SKILL.md +585 -427
  91. package/skills/watchdog/references/webhook-health-checks.md +243 -0
@@ -1,688 +1,342 @@
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: "0.9.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
-
64
- **Triggers:**
65
- - User says "spec", "feature spec", "write spec", "PRD"
66
- - `/rune plan spec <feature>`
67
-
68
- ### Roadmap Mode
69
- High-level multi-feature planning — organize features into milestones.
70
-
71
- **Triggers:**
72
- - User says "roadmap", "milestone", "release plan", "what to build next"
73
- - `/rune plan roadmap`
74
-
75
- ## Triggers
76
-
77
- - Called by `cook` when task scope > 1 file (Implementation Mode)
78
- - Called by `team` for high-level task decomposition
79
- - `/rune plan <task>` — manual planning
80
- - `/rune plan spec <feature>` feature specification
81
- - `/rune plan roadmap` roadmap planning
82
- - Auto-trigger: when user says "implement", "build", "create" with complex scope
83
-
84
- ## Calls (outbound)
85
-
86
- - `scout` (L2): scan codebase for existing patterns, conventions, and structure
87
- - `brainstorm` (L2): when multiple valid approaches exist
88
- - `research` (L3): external knowledge lookup
89
- - `sequential-thinking` (L3): complex architecture with many trade-offs
90
- - L4 extension packs: domain-specific architecture patterns
91
- - `neural-memory` | Before architecture decisions | Recall past decisions on similar problems
92
-
93
- ## Called By (inbound)
94
-
95
- - `cook` (L1): Phase 2 PLAN
96
- - `team` (L1): task decomposition into parallel workstreams
97
- - `brainstorm` (L2): when idea needs structuring
98
- - `rescue` (L1): plan refactoring strategy
99
- - `ba` (L2): hand-off after requirements complete
100
- - `scaffold` (L1): Phase 3 architecture planning
101
- - `skill-forge` (L2): plan structure for new skill
102
- - User: `/rune plan` direct invocation
103
-
104
- ## Data Flow
105
-
106
- ### Feeds Into →
107
-
108
- - `cook` (L1): master plan + phase files → cook's Phase 2-4 execution roadmap
109
- - `team` (L1): task decomposition + wave grouping team's parallel workstream dispatch
110
- - `fix` (L2): phase file tasks fix's implementation targets
111
- - `test` (L2): phase file test tasks test's RED phase targets
112
-
113
- ### Fed By
114
-
115
- - `ba` (L2): Requirements Document → plan's primary input (locked decisions, user stories)
116
- - `scout` (L2): codebase analysis → plan's convention/pattern awareness
117
- - `neural-memory` (external): past architectural decisions → plan's precedent context
118
-
119
- ### Feedback Loops ↻
120
-
121
- - `plan` ↔ `brainstorm`: plan requests options when multiple approaches exist → brainstorm generates options → plan selects and structures the chosen approach
122
- - `plan` `cook`: cook discovers plan gaps during implementation plan updates phase files cook resumes with corrected tasks
123
-
124
- ## Executable Steps (Implementation Mode)
125
-
126
- ### Step 1Gather Context
127
-
128
- **Check for Requirements Document first**: Use `Glob` to check for `.rune/features/*/requirements.md`. If a Requirements Document exists (produced by `rune:ba`), read it and use it as the primary input — it contains user stories, acceptance criteria, scope, and constraints. Do NOT re-gather requirements that BA already elicited.
129
-
130
- Use findings from `rune:scout` if already available. If not, invoke `rune:scout` with the project root to scan directory structure, detect framework, identify key files, and extract existing patterns. Do NOT skip this step — plans without context produce wrong file paths.
131
-
132
- Call `neural-memory` (Recall Mode) to check for past architecture decisions on similar problems before making new ones.
133
-
134
- ### Step 2 Classify Complexity
135
-
136
- Determine if the task needs master plan + phase files or inline plan:
137
-
138
- | Criteria | Inline Plan | Master + Phase Files |
139
- |----------|-------------|---------------------|
140
- | Phases | 1-2 | 3+ |
141
- | Files touched | < 5 | 5+ |
142
- | Estimated LOC | < 100 | 100+ |
143
- | Cross-module | No | Yes |
144
- | Session span | Single session | Multi-session |
145
-
146
- If ANY "Master + Phase Files" criterion is true produce master plan + phase files.
147
-
148
- ### Step 3Decompose into Phases
149
-
150
- Group related work into phases. Each phase is a coherent unit that:
151
- - Can be completed in one session
152
- - Has a clear "done when" condition
153
- - Produces testable output
154
- - Is independent enough to execute without other phases loaded
155
-
156
- <HARD-GATE>
157
- Each phase MUST be completable by ANY coder model (including Haiku) with ONLY the phase file loaded.
158
- If the coder would need to read the master plan or other phase files to execute the phase file is missing detail.
159
- Phase files are SELF-CONTAINED execution instructions — designed for the weakest model to succeed.
160
- </HARD-GATE>
161
-
162
- Phase decomposition rules:
163
- - **Foundation first**: types, schemas, core engine
164
- - **Dependencies before consumers**: create what's imported before the importer
165
- - **Test alongside**: each phase includes its own test tasks
166
- - **Max 5-7 tasks per phase**: if more, split the phase
167
- - **Vertical slices over horizontal layers**: prefer "auth end-to-end" over "all models → all APIs → all UI"
168
-
169
- ### Wave-Based Task Grouping (within each phase)
170
-
171
- Tasks inside a phase MUST be organized into **waves** based on dependency analysis. Independent tasks within the same wave can execute in parallel.
172
-
173
- ```
174
- ## Tasks
175
-
176
- ### Wave 1 (parallel — no dependencies)
177
- - [ ] Task 1 — Create types/interfaces
178
- - File: `src/types.ts` (new)
179
- - ...
180
- - [ ] Task 2 Create validation schema
181
- - File: `src/validation.ts` (new)
182
- - ...
183
-
184
- ### Wave 2 (depends on Wave 1)
185
- - [ ] Task 3 Implement core logic (imports types from Task 1)
186
- - File: `src/core.ts` (new)
187
- - depends_on: [Task 1]
188
- - ...
189
-
190
- ### Wave 3 (depends on Wave 2)
191
- - [ ] Task 4 — Wire into API endpoint (imports core from Task 3)
192
- - File: `src/routes/api.ts` (modify)
193
- - depends_on: [Task 3]
194
- - ...
195
- - [ ] Task 5 — Write integration tests (tests core from Task 3)
196
- - File: `tests/core.test.ts` (new)
197
- - depends_on: [Task 3]
198
- - ...
199
- ```
200
-
201
- **Wave rules:**
202
- - Wave 1 = tasks with zero dependencies (types, schemas, configs) always first
203
- - Subsequent waves: a task goes in the earliest wave where ALL its `depends_on` tasks are in prior waves
204
- - Tasks within the same wave have NO dependencies on each other → safe for parallel dispatch
205
- - `depends_on` field is MANDATORY for Wave 2+ tasks explicit is better than implicit
206
- - `team` orchestrator can dispatch wave tasks as parallel subagents; solo `cook` executes sequentially within a wave but respects wave ordering
207
-
208
- ### Step 4 Write Master Plan File
209
-
210
- Save to `.rune/plan-<feature>.md`:
211
-
212
- ```markdown
213
- # Feature: <name>
214
-
215
- ## Overview
216
- <1-3 sentences: what and why>
217
-
218
- ## Phases
219
- | # | Name | Status | Plan File | Summary |
220
- |---|------|--------|-----------|---------|
221
- | 1 | Foundation | Pending | plan-X-phase1.md | Types, core engine, basic UI |
222
- | 2 | Interaction | ⬚ Pending | plan-X-phase2.md | Dialogue, combat, items |
223
- | 3 | Polish | Pending | plan-X-phase3.md | Effects, sounds, game over |
224
-
225
- ## Key Decisions
226
- - <decision 1 chosen approach and why>
227
- - <decision 2>
228
-
229
- ## Decision Compliance
230
- - Decisions (locked): [list from requirements.md — plan MUST honor these]
231
- - Discretion (agent): [list — agent chose X because Y]
232
- - Deferred: [list — explicitly excluded from this feature]
233
-
234
- ## Architecture
235
- <brief system diagram or component listNOT implementation detail>
236
-
237
- ## Dependencies
238
- - <external dep>: <status>
239
-
240
- ## Risks
241
- - <risk>: <mitigation>
242
- ```
243
-
244
- **Max 80 lines.** No implementation details that's what phase files are for.
245
-
246
- ### Step 4.5Workflow Registry (Complex Features Only)
247
-
248
- > From agency-agents (msitarzewski/agency-agents, 50.8k★): "Every route is an entry point. Every worker is a workflow. If it's missing from the registry, it doesn't exist."
249
-
250
- For complex features (4+ phases OR 3+ user-facing workflows), build a **4-view Workflow Registry** before writing phase files. This catches missing pieces, dead ends, and integration gaps at plan time — not implementation time.
251
-
252
- **Skip conditions**: trivial tasks, inline plans, single-workflow features.
253
-
254
- **4 cross-referenced views:**
255
-
256
- ```markdown
257
- ## Workflow Registry
258
-
259
- ### View 1: By Workflow
260
- | Workflow | Entry Point | Components Touched | Exit Point | Phase |
261
- |----------|-------------|-------------------|------------|-------|
262
- | User signup | POST /auth/register | AuthService, UserRepo, EmailService | 201 + email sent | Phase 1 |
263
- | Password reset | POST /auth/reset | AuthService, EmailService, TokenRepo | 200 + reset email | Phase 2 |
264
-
265
- ### View 2: By Component
266
- | Component | Used By Workflows | Owner Phase | Status |
267
- |-----------|-------------------|-------------|--------|
268
- | AuthService | signup, login, reset | Phase 1 | Planned |
269
- | EmailService | signup, reset, invite | Phase 2 | Planned |
270
- | TokenRepo | reset, invite | Phase 2 | Missing ← RED FLAG |
271
-
272
- ### View 3: By User Journey
273
- | Journey | Steps (workflow chain) | Happy Path | Error Path |
274
- |---------|----------------------|------------|------------|
275
- | New user first action | signup verify email login onboard | 4 steps | signup fail, email bounce |
276
-
277
- ### View 4: By State
278
- | Step | User Sees | DB State | Logs | Operator Sees |
279
- |------|-----------|----------|------|---------------|
280
- | After signup | "Check your email" | user.status=pending | user.created event | New user in admin |
281
- | After verify | Dashboard | user.status=active | user.verified event | Active user count +1 |
282
- ```
283
-
284
- **Validation rules:**
285
- - Every component in View 2 MUST appear in at least one workflow in View 1 — orphaned components = dead code
286
- - Every workflow in View 1 MUST map to a phase — unphased workflows will be forgotten
287
- - "Missing" status in View 2 = **red flag** — component needed but not planned in any phase → add to a phase or create new phase
288
- - Every user journey step in View 3 MUST have a corresponding state row in View 4
289
-
290
- **Output**: Add the registry to the master plan file (it fits within the 80-line budget when tables are compact). Phase files reference it but don't duplicate it.
291
-
292
- ### Step 5 Write Phase Files
293
-
294
- For each phase, save to `.rune/plan-<feature>-phase<N>.md`.
295
-
296
- Phase files follow the **Amateur-Proof Template** designed so that even the weakest model can execute without guessing. Every section exists because an Amateur said "I need this to code correctly."
297
-
298
- ```markdown
299
- # Phase N: <name>
300
-
301
- ## Goal
302
- <What this phase delivers1-2 sentences>
303
-
304
- ## Data Flow
305
- <5-line ASCII diagram showing how data moves through this phase's components>
306
- ```
307
- User Input validateInput() calculateProfit() formatResult() API Response
308
-
309
- TradeEntry[]
310
- ```
311
-
312
- ## Code Contracts
313
- <Function signatures, interfaces, schemas that this phase MUST implement>
314
- <This is the MOST IMPORTANT section — coder implements these contracts>
315
-
316
- ```typescript
317
- interface TradeEntry {
318
- side: 'long' | 'short';
319
- entryPrice: number;
320
- exitPrice: number;
321
- quantity: number;
322
- }
323
-
324
- interface ProfitResult {
325
- netPnL: number;
326
- totalFees: number;
327
- winRate: number;
328
- }
329
-
330
- function calculateProfit(entries: TradeEntry[]): ProfitResult;
331
- function validateInput(raw: unknown): TradeEntry[]; // throws ValidationError
332
- ```
333
-
334
- ## Tasks
335
-
336
- Each task MUST include: **File** (exact path), **Test** (test file or N/A), **Verify** (shell command), **Commit** (semantic message). Granularity: 2-5 min per task. If >10min, decompose.
337
-
338
- - [ ] Task 1 Create calculateProfit function
339
- - Req: REQ-001 (P&L calculation)
340
- - File: `src/foo/bar.ts` (new)
341
- - Test: `tests/foo/bar.test.ts` (new)
342
- - Verify: `npm test -- --grep "calculateProfit"`
343
- - Commit: `feat(trading): add calculateProfit with fee calculation`
344
- - Logic: sum entries by side, apply fees (0.1% per trade), return net P&L
345
- - Edge: empty array → return { netPnL: 0, totalFees: 0, winRate: 0 }
346
- - [ ] Task 2 — Add input validation
347
- - Req: REQ-002 (input validation)
348
- - File: `src/foo/baz.ts` (modify)
349
- - Test: `tests/foo/baz.test.ts` (new)
350
- - Verify: `npm test -- --grep "validateInput"`
351
- - Commit: `feat(trading): add input validation for trade entries`
352
- - Logic: check side is 'long'|'short', prices > 0, quantity > 0
353
- - [ ] Task 3 — Write integration tests
354
- - Req: REQ-001, REQ-002 (integration coverage)
355
- - File: `tests/foo/bar.test.ts` (modify)
356
- - Test: N/A — this IS the test task
357
- - Verify: `npm test -- --grep "trading" && npx tsc --noEmit`
358
- - Commit: `test(trading): add integration tests for edge cases`
359
- - Cases: happy path, empty input, negative values, overflow
360
-
361
- ## Failure Scenarios
362
- <What should happen when things go wrong — coder MUST implement these>
363
-
364
- | When | Then | Error Type |
365
- |------|------|-----------|
366
- | entries is empty array | return zero-value ProfitResult | No error (valid edge case) |
367
- | entry has negative price | throw ValidationError("price must be positive") | ValidationError |
368
- | entry has quantity = 0 | throw ValidationError("quantity must be > 0") | ValidationError |
369
- | calculation overflows Number.MAX_SAFE_INTEGER | use BigInt or throw OverflowError | OverflowError |
370
-
371
- ## Performance Constraints
372
- <Non-functional requirements — skip if not applicable>
373
-
374
- | Metric | Requirement | Why |
375
- |--------|-------------|-----|
376
- | Input size | Must handle 10,000 entries | Production data volume |
377
- | Response time | < 100ms for 10K entries | Real-time dashboard |
378
- | Memory | < 50MB for 10K entries | Container memory limit |
379
-
380
- ## Rejection Criteria (DO NOT)
381
- <Anti-patterns the coder MUST avoid — things that seem right but are wrong>
382
-
383
- - ❌ DO NOT use `toFixed()` for financial calculations — use Decimal.js or integer cents
384
- - ❌ DO NOT mutate the input array — create new objects (immutability rule)
385
- - ❌ DO NOT use `any` type — full TypeScript strict
386
- - ❌ DO NOT import from Phase 2+ files — this phase is self-contained
387
-
388
- ## Cross-Phase Context
389
- <What this phase assumes from previous phases / what future phases expect from this one>
390
-
391
- - **Assumes**: Phase 1 created `src/shared/types.ts` with base types
392
- - **Exports for Phase 3**: `calculateProfit()` will be imported by `src/dashboard/PnLCard.tsx`
393
- - **Interface contract**: ProfitResult shape MUST NOT change — Phase 3 depends on it
394
-
395
- ## Acceptance Criteria
396
- - [ ] All tasks marked done
397
- - [ ] Tests pass with 80%+ coverage on new code
398
- - [ ] No TypeScript errors (`tsc --noEmit` passes)
399
- - [ ] Failure scenarios all handled (table above)
400
- - [ ] Performance: calculateProfit(10K entries) < 100ms
401
- - [ ] No `any` types, no mutation, no `toFixed()` for money
402
-
403
- ## Traceability Matrix
404
- | Req ID | Requirement | Task(s) | Test(s) | Status |
405
- |--------|-------------|---------|---------|--------|
406
- | REQ-001 | P&L calculation with fees | Task 1 | `tests/foo/bar.test.ts` | ⬚ |
407
- | REQ-002 | Input validation | Task 2 | `tests/foo/baz.test.ts` | ⬚ |
408
-
409
- Every requirement from BA's Requirements Document MUST appear in this matrix. Missing requirement = incomplete phase. `completion-gate` checks this matrix during verification.
410
-
411
- ## Files Touched
412
- - `src/foo/bar.ts` — new
413
- - `src/foo/baz.ts` — modify
414
- - `tests/foo/bar.test.ts` — new
415
- ```
416
-
417
- **Max 200 lines per phase file.** Must be self-contained — coder should NOT need to read master plan or other phases to execute.
418
-
419
- <HARD-GATE>
420
- Every phase file MUST include ALL of these sections (Amateur-Proof Checklist):
421
- 1. ✅ Data Flow — ASCII diagram of how data moves
422
- 2. ✅ Code Contracts — function signatures, interfaces, types
423
- 3. ✅ Tasks — with file paths, logic description, edge cases
424
- 4. ✅ Failure Scenarios — table of when/then/error for each error case
425
- 5. ✅ Rejection Criteria — explicit "DO NOT" anti-patterns
426
- 6. ✅ Cross-Phase Context — what's assumed from prior phases, what's exported for future phases
427
- 7. ✅ Acceptance Criteria — testable, includes performance if applicable
428
- 8. ✅ Test tasks — every code task has corresponding tests
429
- 9. ✅ Traceability Matrix — every BA requirement mapped to tasks and tests (skip if no BA requirements exist)
430
-
431
- A phase missing ANY of sections 1-7 is INCOMPLETE — the weakest coder will guess wrong.
432
- Performance Constraints section is optional (only when NFRs apply).
433
- </HARD-GATE>
434
-
435
- ### Step 5.5 — Completeness Scoring (Alternatives)
436
-
437
- When presenting alternative approaches (from brainstorm or Step 3 decisions), rate each with **Completeness X/10**:
438
-
439
- | Score | Meaning |
440
- |-------|---------|
441
- | 9-10 | Complete — all edge cases, full coverage, production-ready |
442
- | 7-8 | Happy path covered, some edges skipped |
443
- | 4-6 | Shortcut — defers significant work |
444
- | 1-3 | Minimal viable, debt guaranteed |
445
-
446
- **Always recommend higher-completeness option.** With AI-assisted coding, the marginal cost of completeness is near-zero. Show dual effort estimates for each approach: `(human: ~X / AI: ~Y)`.
447
-
448
- **Anti-pattern**: "Option B saves 70 LOC" → 70 LOC delta is meaningless with AI. Choose complete. The last 10% of coverage is where production bugs hide.
449
-
450
- > Source: garrytan/gstack v0.9.0 — "Boil the Lake" principle.
451
-
452
- ### Step 6 — Present and Get Approval
453
-
454
- Present the **master plan** to user (NOT all phase files). User reviews:
455
- - Phase breakdown
456
- - Key decisions
457
- - Risks
458
- - Completeness scores for chosen approach (from Step 5.5)
459
-
460
- Wait for explicit approval ("go", "proceed", "yes") before writing phase files.
461
-
462
- If user requests changes → revise and re-present.
463
-
464
- ### Step 7 — Execution Handoff
465
-
466
- After approval, the execution flow is:
467
-
468
- ```
469
- 1. Cook loads master plan → identifies current phase (first ⬚ Pending)
470
- 2. Cook loads ONLY that phase's file
471
- 3. Coder executes tasks in the phase file
472
- 4. Mark tasks done in phase file as completed
473
- 5. When phase complete → update master plan status: ⬚ → ✅
474
- 6. Next session: load master plan → find next ⬚ phase → load phase file → execute
475
- ```
476
-
477
- **Model selection for execution:**
478
- - Opus plans phases (this skill)
479
- - Sonnet/Haiku executes them (cook → fix)
480
- - If Sonnet makes small errors → fix lightly (cheaper than using Opus for execution)
481
-
482
- ## Inline Plan (Trivial Tasks)
483
-
484
- For trivial tasks (1-2 phases, < 5 files, < 100 LOC):
485
-
486
- Skip master plan + phase files. Produce inline plan directly:
487
-
488
- ```
489
- ## Plan: [Task Name]
490
-
491
- ### Changes
492
- 1. [file]: [what to change] — [function signature]
493
- 2. [file]: [what to change]
494
-
495
- ### Tests
496
- - [test file]: [test cases]
497
-
498
- ### Risks
499
- - [risk]: [mitigation]
500
-
501
- Awaiting approval.
502
- ```
503
-
504
- ## Re-Planning (Dynamic Adaptation)
505
-
506
- When cook encounters unexpected conditions during execution:
507
-
508
- ### Trigger Conditions
509
- - Phase execution hits max debug-fix loops (3)
510
- - New files discovered outside the plan scope
511
- - Dependency change alters the approach
512
- - User requests scope change
513
-
514
- ### Re-Plan Protocol
515
-
516
- 1. **Read the master plan** + **current phase file**
517
- 2. **Read delta context**: what changed, what failed
518
- 3. **Assess impact**: which remaining phases are affected?
519
- 4. **Revise**:
520
- - Mark completed phases as ✅ in master plan
521
- - Modify affected phase files
522
- - Add new phases if scope expanded
523
- - **Do NOT rewrite completed phases**
524
- 5. **Present revised master plan** with diff summary
525
- 6. **Get approval** before resuming
526
-
527
- ## Feature Spec Mode
528
-
529
- When invoked in Feature Spec Mode, produce a structured specification.
530
-
531
- ### Steps
532
-
533
- **Step 1 — Problem Statement**
534
- - What problem? Who has it? Current workaround?
535
-
536
- **Step 2 — User Stories**
537
- - Primary story, 2-3 secondary, edge cases
538
- - Format: `As a [persona], I want to [action] so that [benefit]`
539
-
540
- **Step 3 — Acceptance Criteria**
541
- - `GIVEN [context] WHEN [action] THEN [result]`
542
- - Happy path + error cases + performance criteria
543
-
544
- **Step 4 — Scope Definition**
545
- - In scope / Out of scope / Dependencies / Open questions
546
-
547
- **Step 5 — Write Spec File**
548
- Save to `.rune/features/<feature-name>/spec.md`
549
-
550
- After spec approved → transition to Implementation Mode.
551
-
552
- ## Roadmap Mode
553
-
554
- When invoked in Roadmap Mode, produce a prioritized feature roadmap.
555
-
556
- ### Steps
557
-
558
- **Step 1 — Inventory**
559
- Scan project for: open issues, TODO/FIXME comments, planned features.
560
-
561
- **Step 2 — Prioritize (ICE Scoring)**
562
- Impact × Confidence × Ease (each 1-10). Sort descending.
563
-
564
- **Step 3 — Group into Milestones**
565
- - Milestone 1: top 3-5 features by ICE
566
- - Milestone 2: next 3-5
567
- - Backlog: remaining
568
-
569
- **Step 4 — Write Roadmap**
570
- Save to `.rune/roadmap.md`
571
-
572
- ## Output Format
573
-
574
- ### Master Plan (`.rune/plan-<feature>.md`)
575
- ```markdown
576
- # Feature: <name>
577
-
578
- ## Overview
579
- <1-3 sentences: what and why>
580
-
581
- ## Phases
582
- | # | Name | Status | Plan File | Summary |
583
- |---|------|--------|-----------|---------|
584
- | 1 | [name] | ⬚ Pending | plan-X-phase1.md | [1-line summary] |
585
-
586
- ## Key Decisions
587
- - [decision — chosen approach and why]
588
-
589
- ## Architecture
590
- <brief system diagram — NOT implementation detail>
591
-
592
- ## Dependencies / Risks
593
- - [dep/risk]: [status/mitigation]
594
- ```
595
- Max 80 lines. No implementation details.
596
-
597
- ### Phase File (`.rune/plan-<feature>-phase<N>.md`)
598
- 7 mandatory sections (Amateur-Proof Template):
599
- 1. **Goal** — 1-2 sentences
600
- 2. **Data Flow** — 5-line ASCII diagram
601
- 3. **Code Contracts** — function signatures, interfaces
602
- 4. **Tasks** — file paths, logic, edge cases, tests
603
- 5. **Failure Scenarios** — when/then/error table
604
- 6. **Rejection Criteria** — explicit DO NOTs
605
- 7. **Cross-Phase Context** — assumes from prior, exports for future
606
- 8. **Acceptance Criteria** — testable conditions
607
-
608
- Max 200 lines. Self-contained — coder needs ONLY this file.
609
-
610
- ### Inline Plan (trivial tasks)
611
- ```
612
- ## Plan: [Task Name]
613
- ### Changes
614
- 1. [file]: [what] — [signature]
615
- ### Tests
616
- - [test file]: [cases]
617
- ### Risks
618
- - [risk]: [mitigation]
619
- ```
620
-
621
- ## Constraints
622
-
623
- 1. MUST produce master plan + phase files for non-trivial tasks (3+ phases OR 5+ files OR 100+ LOC)
624
- 2. MUST keep master plan under 80 lines — overview only, no implementation details
625
- 3. MUST keep each phase file under 200 lines — self-contained, Amateur-proof
626
- 4. MUST include exact file paths for every task — no vague "set up the database"
627
- 5. MUST include test tasks for every phase that produces code
628
- 6. MUST include ALL Amateur-Proof sections: data flow, code contracts, tasks, failure scenarios, rejection criteria, cross-phase context, acceptance criteria
629
- 7. MUST order phases by dependency — don't plan phase 3 before phase 1's output exists
630
- 8. MUST get user approval before writing phase files
631
- 9. Phase files MUST be self-contained — coder should NOT need master plan to execute
632
- 10. Max 8 phases per master plan — if more, split into sub-projects
633
- 11. MUST include failure scenarios table — what happens when things go wrong
634
- 12. MUST include rejection criteria — explicit "DO NOT" anti-patterns to prevent common mistakes
635
- 13. MUST include cross-phase context — what's assumed from prior phases, what's exported for future
636
-
637
- ## Sharp Edges
638
-
639
- | Failure Mode | Severity | Mitigation |
640
- |---|---|---|
641
- | Monolithic plan file that overflows context | CRITICAL | HARD-GATE: non-trivial tasks MUST use master + phase files |
642
- | Phase file too vague for Amateur to execute | CRITICAL | Amateur-Proof template: ALL 7 mandatory sections required |
643
- | Coder uses wrong approach (toFixed for money, mutation) | CRITICAL | Rejection Criteria section: explicit "DO NOT" list prevents common traps |
644
- | Coder doesn't handle errors properly | HIGH | Failure Scenarios table: when/then/error for EVERY error case |
645
- | Coder doesn't know what other phases expect | HIGH | Cross-Phase Context: explicit imports/exports between phases |
646
- | Coder over-engineers or under-engineers perf | HIGH | Performance Constraints: specific metrics with thresholds |
647
- | Master plan contains implementation detail | HIGH | Max 80 lines, overview only — detail goes in phase files |
648
- | Phase file references other phase files | HIGH | Phase files are self-contained — cross-phase section handles this |
649
- | Plan without scout context — invented file paths | CRITICAL | Step 1: scout first, always |
650
- | Phase with zero test tasks | CRITICAL | HARD-GATE rejects it |
651
- | 10+ phases overwhelming the master plan | MEDIUM | Max 8 phases — split into sub-projects if more |
652
- | Task without File path or Verify command | HIGH | Every task MUST have File + Test + Verify + Commit fields — no vague "implement the feature" tasks |
653
- | 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 |
654
- | Tasks without `depends_on` in Wave 2+ | MEDIUM | Implicit dependencies break parallel dispatch. Every Wave 2+ task MUST declare `depends_on` |
655
- | Plan ignores locked Decisions from BA | CRITICAL | Decision Compliance section cross-checks requirements.md — locked decisions are non-negotiable |
656
- | 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 |
657
- | 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 |
658
-
659
- ## Self-Validation
660
-
661
- ```
662
- SELF-VALIDATION (run before presenting plan to user):
663
- - [ ] Every task has a clear file path — no "update relevant files" vagueness
664
- - [ ] Wave dependencies are acyclic — no task depends on a task in the same or later wave
665
- - [ ] Every code-producing phase has at least one test task
666
- - [ ] Phase files have ALL Amateur-Proof sections (data flow, code contracts, failure scenarios, rejection criteria)
667
- - [ ] Locked decisions from BA are reflected in plan — none contradicted or ignored
668
- - [ ] Every BA requirement has a corresponding Req ID in at least one phase's Traceability Matrix
669
- ```
670
-
671
- ## Done When
672
-
673
- - Complexity classified (inline vs master + phase files)
674
- - Scout output read and conventions/patterns identified
675
- - BA requirements consumed (if available)
676
- - Master plan written (< 80 lines) with phase table and key decisions
677
- - Phase files written (< 200 lines each) with ALL Amateur-Proof sections:
678
- - Data flow diagram, code contracts, tasks with edge cases
679
- - Failure scenarios table, rejection criteria (DO NOTs)
680
- - Cross-phase context (assumes/exports), acceptance criteria
681
- - Every code-producing phase has test tasks
682
- - Master plan presented to user with "Awaiting Approval"
683
- - User has explicitly approved
684
- - Self-Validation: all checks passed
685
-
686
- ## Cost Profile
687
-
688
- ~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.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 tasks → test's RED phase targets
106
+
107
+ ### Fed By ←
108
+
109
+ - `ba` (L2): Requirements Documentplan's primary input (locked decisions, user stories)
110
+ - `scout` (L2): codebase analysisplan's convention/pattern awareness
111
+ - `neural-memory` (external): past architectural decisionsplan'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 Contractsfunction signatures, interfaces, types
181
+ 3. Tasks — with file paths, logic description, edge cases
182
+ 4. ✅ Failure Scenarios — table of when/then/error for each error case
183
+ 5. ✅ Rejection Criteria — explicit "DO NOT" anti-patterns
184
+ 6. Cross-Phase Context what's assumed from prior phases, what's exported for future phases
185
+ 7. Acceptance Criteriatestable, includes performance if applicable
186
+ 8. Test tasks — every code task has corresponding tests
187
+ 9. Traceability Matrix — every 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 6 — Present 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 7Execution 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 context — invented 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).