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