@rune-kit/rune 2.2.3 → 2.2.6

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.
@@ -3,7 +3,7 @@ name: debug
3
3
  description: Root cause analysis for bugs and unexpected behavior. Traces errors through code, uses structured reasoning, and hands off to fix when cause is found. Core of the debug↔fix mesh.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.5.0"
6
+ version: "0.7.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -67,6 +67,24 @@ Understand and confirm the error described in the request.
67
67
  - Confirm the error is consistent and reproducible before proceeding
68
68
  - If no reproduction steps provided, ask for them or attempt the most likely path
69
69
 
70
+ ### Step 1.5: Scope Lock (Edit Boundary)
71
+
72
+ After reproducing the error, **lock edits to the narrowest affected directory** to prevent debug-driven scope creep — the #1 source of "while I'm here, let me also fix..." violations.
73
+
74
+ 1. Identify the narrowest directory containing the affected files (from stack trace or error location)
75
+ 2. Announce to user: "Debug scope locked to `<dir>/`. Changes will be restricted to this area."
76
+ 3. Any fix recommendation in the Debug Report MUST reference only files within this boundary
77
+ 4. If root cause traces outside the boundary → expand scope with user confirmation first
78
+
79
+ **Skip conditions** (do NOT lock):
80
+ - Bug spans the entire repo (3+ unrelated directories in stack trace)
81
+ - Cannot determine affected area from initial evidence
82
+ - User explicitly says "investigate everything"
83
+
84
+ **Why:** Debugging naturally expands scope as you trace root causes. Without a boundary, rune:fix receives recommendations touching 10+ files across unrelated modules. The scope lock forces discipline: fix at the source, not at every symptom site.
85
+
86
+ > Source: garrytan/gstack v0.9.0 (investigate skill) — auto-freeze to affected module during debug sessions.
87
+
70
88
  ### Step 2: Gather Evidence
71
89
 
72
90
  Use tools to collect facts — do NOT guess yet.
@@ -231,6 +249,30 @@ After Step 4 (Test Hypotheses): if NO hypothesis is confirmed after 3 cycles of
231
249
  Within any single step: 5+ consecutive Read/Grep calls without forming or testing a hypothesis = stuck. Stop reading, form a hypothesis from what you have, and test it. Incomplete hypotheses that get tested are better than perfect hypotheses that never form.
232
250
  </HARD-GATE>
233
251
 
252
+ ### Hash-Based Evidence Loop Detection
253
+
254
+ Beyond counting reads, detect when debug is **re-gathering the same evidence without progress** — the most common debug-specific stuck pattern.
255
+
256
+ **Detection signals** (track mentally across hypothesis cycles):
257
+
258
+ | Signal | Count | Meaning | Action |
259
+ |--------|-------|---------|--------|
260
+ | Reading the same file:line range in different cycles | 2x | Re-examining without new lens | Form hypothesis from existing evidence NOW |
261
+ | Running the same test command with same failure output | 3x | No code changed between runs | STOP — hand off to fix with current diagnosis, even if incomplete |
262
+ | Grepping the same error string after already finding all occurrences | 2x | Hoping for different results | Evidence is complete — move to Step 3 (hypothesize) |
263
+ | Same hypothesis tested with same evidence across cycles | 2x | Circular reasoning | Mark hypothesis INCONCLUSIVE, try a DIFFERENT hypothesis category |
264
+
265
+ **Hypothesis category diversity rule**: If H1 (cycle 1) was "wrong input data" and it was RULED OUT, H1 (cycle 2) MUST be from a DIFFERENT category:
266
+
267
+ | Category | Examples |
268
+ |----------|---------|
269
+ | Data | Wrong value, missing field, type mismatch, encoding |
270
+ | Control Flow | Wrong branch, missing guard, race condition, async ordering |
271
+ | Environment | Wrong config, missing env var, version mismatch, path issue |
272
+ | State | Stale cache, mutation side-effect, leaked reference, dangling connection |
273
+
274
+ > Source: goclaw (832★) — content-aware loop detection adapted for debug hypothesis cycles.
275
+
234
276
  ## Red Flags — STOP and Return to Step 2
235
277
 
236
278
  If you catch yourself thinking any of these, you are GUESSING, not debugging:
@@ -301,6 +343,11 @@ ALL of these mean: STOP. Return to Step 2 (Gather Evidence).
301
343
  | Escalating to plan when the APPROACH is wrong (not the module) | HIGH | If all 3 fixes hit the same category of blocker (API limit, platform gap), the approach needs pivoting via brainstorm(rescue), not re-planning |
302
344
  | Not tracking fix attempt number for recurring bugs | HIGH | Debug Report MUST include Fix Attempt counter — enables escalation gate |
303
345
  | Adding instrumentation without region markers | MEDIUM | All debug logging MUST use `#region agent-debug` — unmarked code gets cleaned up prematurely by fix |
346
+ | Re-reading same file:line in different hypothesis cycles | HIGH | Hash-based evidence loop: if same evidence gathered 2x, form hypothesis from existing data — don't re-gather |
347
+ | Same hypothesis category across cycles after RULED OUT | HIGH | Hypothesis category diversity: if "data" ruled out in cycle 1, cycle 2 must try "control flow", "environment", or "state" |
348
+ | Running same test 3x with same failure without code change | MEDIUM | True stuck loop — no progress possible. Hand off to fix with current incomplete diagnosis |
349
+ | Scope creep via debug — "while investigating, also fix X" | HIGH | Step 1.5 Scope Lock: lock edits to narrowest affected directory. Fix recommendations MUST stay within boundary. Expand only with user confirmation |
350
+ | Debug report recommends touching 5+ unrelated files | HIGH | Symptom of fixing at crash sites instead of source. Backward trace (Step 2) to find origin. If truly 5+ files → likely architectural issue → escalate via 3-Fix Rule |
304
351
 
305
352
  ## Done When
306
353
 
@@ -4,7 +4,7 @@ description: "Deploy application to target platform. Use when user explicitly sa
4
4
  disable-model-invocation: true
5
5
  metadata:
6
6
  author: runedev
7
- version: "0.3.0"
7
+ version: "0.4.0"
8
8
  layer: L2
9
9
  model: sonnet
10
10
  group: delivery
@@ -64,6 +64,49 @@ If sentinel returns CRITICAL issues → STOP. Do NOT proceed. Report issues.
64
64
 
65
65
  Both gates MUST pass. No exceptions.
66
66
 
67
+ ### Step 1.5 — Release Checklist (Production Deploys Only)
68
+
69
+ **Skip for**: staging, preview, development deploys.
70
+
71
+ Before production deploy, verify ALL items:
72
+
73
+ | # | Check | How | Gate |
74
+ |---|-------|-----|------|
75
+ | 1 | Version bumped | `package.json`/`pyproject.toml` version matches release | BLOCK if unchanged |
76
+ | 2 | Changelog updated | `CHANGELOG.md` has entry for this version | WARN if missing |
77
+ | 3 | Breaking changes documented | RFC artifact exists for each breaking change | BLOCK if RFC missing |
78
+ | 4 | Migration scripts ready | DB migrations tested on staging first | BLOCK if untested migration |
79
+ | 5 | Rollback plan documented | `.rune/deploy/rollback-<version>.md` exists | WARN if missing |
80
+ | 6 | Release notes drafted | Customer-facing notes for release-comms | WARN if missing |
81
+ | 7 | Dependencies locked | Lock file committed, no floating versions | BLOCK if unlocked |
82
+
83
+ **Rollback Plan Template** (`.rune/deploy/rollback-<version>.md`):
84
+
85
+ ```markdown
86
+ # Rollback Plan: v<version>
87
+
88
+ ## Trigger Conditions
89
+ - [When to rollback — e.g., error rate >5%, P0 incident, data corruption]
90
+
91
+ ## Steps
92
+ 1. [Revert command — e.g., `vercel rollback`, `fly releases rollback`]
93
+ 2. [DB rollback — e.g., `npm run migrate:rollback` or "N/A — no migration"]
94
+ 3. [Cache invalidation if needed]
95
+ 4. [Notify stakeholders]
96
+
97
+ ## Verification
98
+ - [ ] Previous version serving traffic
99
+ - [ ] Health check passing
100
+ - [ ] No data loss confirmed
101
+
102
+ ## Post-Rollback
103
+ - [ ] Incident created for root cause analysis
104
+ - [ ] Fix branch created from rolled-back commit
105
+ ```
106
+
107
+ If any BLOCK item fails → STOP deploy. Fix before retrying.
108
+ If WARN items missing → proceed but flag in deploy report.
109
+
67
110
  ### Step 2 — Detect platform
68
111
 
69
112
  Use `Bash` to inspect the project root for platform config files:
@@ -147,6 +190,8 @@ Deploy Report with platform, status (success/failed/rollback), deployed URL, bui
147
190
  3. MUST verify deploy is live and responding before declaring success
148
191
  4. MUST NOT deploy with known CRITICAL security findings
149
192
  5. MUST log deploy metadata (version, timestamp, commit hash)
193
+ 6. MUST complete release checklist for production deploys — version bump, changelog, rollback plan
194
+ 7. MUST create rollback plan artifact before first production deploy of a version
150
195
 
151
196
  ## Sharp Edges
152
197
 
@@ -3,7 +3,7 @@ name: fix
3
3
  description: Apply code changes and fixes. Writes implementation code, applies bug fixes, and verifies changes with tests. Core action hub in the development mesh.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.4.0"
6
+ version: "0.5.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -97,6 +97,32 @@ Confirm the change works and nothing is broken.
97
97
  - If project has a type-check command, run it via `Bash`
98
98
  - If project has a lint command, run it via `Bash`
99
99
 
100
+ ### Step 4.5: Quality Decay Check (Self-Regulation)
101
+
102
+ When fix is called repeatedly (e.g., by cook Phase 4, or iterative fix loops), track a **WTF-likelihood score** — the probability that continued fixing is making things worse.
103
+
104
+ **Compute every 3 fix attempts** (or when called 5+ times in a single cook session):
105
+
106
+ | Signal | Score Adjustment |
107
+ |--------|-----------------|
108
+ | A fix was reverted (any test that passed now fails) | +15% |
109
+ | Fix touched >3 files (blast radius expanding) | +5% per extra file beyond 3 |
110
+ | 15+ fixes already applied in this session | +1% per fix beyond 15 |
111
+ | All remaining issues are LOW severity | +10% |
112
+ | Fix touched files outside the original diagnosis scope | +20% |
113
+ | Consecutive fixes without running tests between them | +10% |
114
+
115
+ **Thresholds:**
116
+ - **>20% WTF-likelihood**: STOP fixing. Report current state to cook/user with: "Quality decay detected — continued fixes risk introducing more bugs than they resolve. {N} fixes applied, {score}% risk. Recommend: commit current progress, re-assess remaining issues."
117
+ - **Hard cap: 30 fixes per session** — regardless of score. After 30, STOP and report.
118
+
119
+ **Reset conditions:** WTF-likelihood resets to 0% when:
120
+ - User explicitly says "continue fixing"
121
+ - A full test suite run shows zero regressions
122
+ - Scope is narrowed to a single file
123
+
124
+ > Source: garrytan/gstack v0.9.0 (qa skill) — prevents runaway fix loops where each fix introduces new risk.
125
+
100
126
  ### Step 5: Post-Fix Hardening (Defense-in-Depth)
101
127
 
102
128
  After the fix works, make the bug **structurally impossible** — not just "fixed this time."
@@ -207,6 +233,7 @@ Known failure modes for this skill. Check these before declaring done.
207
233
  | Fixing at crash site without tracing data origin | HIGH | Defense-in-depth: trace where bad data ORIGINATES, add validation at every layer it passes through |
208
234
  | Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
209
235
  | Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests pass — premature cleanup erases failure history |
236
+ | Runaway fix loop — 20+ fixes without checking quality decay | HIGH | Step 4.5: WTF-likelihood self-regulation. >20% risk = STOP. Hard cap 30 fixes/session. Each fix adds risk — diminishing returns after ~15 |
210
237
 
211
238
  ## Done When
212
239
 
@@ -3,7 +3,7 @@ name: git
3
3
  description: Specialized git operations — semantic commits, PR descriptions, branch management, conflict resolution guidance. Replaces ad-hoc git commands with a dedicated, convention-aware utility.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: utility
@@ -27,6 +27,7 @@ Specialized git operations utility. Handles semantic commits, PR descriptions, b
27
27
  - `/rune git pr` — manual PR generation
28
28
  - `/rune git branch <description>` — generate branch name
29
29
  - `/rune git changelog` — generate changelog from commits
30
+ - `/rune git release <version>` — create tagged release with changelog
30
31
 
31
32
  ## Calls (outbound)
32
33
 
@@ -187,6 +188,49 @@ Group commits by conventional commit type. Format as [Keep a Changelog](https://
187
188
 
188
189
  Link to PRs/issues when references found in commit messages.
189
190
 
191
+ ### Release Mode
192
+
193
+ Create a version tag with release artifacts.
194
+
195
+ **Triggers:**
196
+ - `/rune git release <version>` — create release for specified version
197
+ - Called by `launch` (L1) during release pipeline
198
+ - Called by `deploy` (L2) after successful production deploy
199
+
200
+ #### Step 1 — Validate Version
201
+
202
+ Parse version string. Must follow semver (`major.minor.patch`):
203
+ - Breaking changes → major bump
204
+ - New features → minor bump
205
+ - Bug fixes → patch bump
206
+
207
+ Check `git tag -l` to ensure version doesn't already exist.
208
+
209
+ #### Step 2 — Generate Release Artifacts
210
+
211
+ 1. **Changelog**: Run Changelog Mode to generate entries since last tag
212
+ 2. **Version bump**: Update version in `package.json`, `pyproject.toml`, `Cargo.toml`, or equivalent
213
+ 3. **Release notes**: Summarize changes for GitHub Release body
214
+
215
+ #### Step 3 — Tag and Push
216
+
217
+ ```bash
218
+ git add <version-files>
219
+ git commit -m "chore: bump version to v<version>"
220
+ git tag -a v<version> -m "Release v<version>"
221
+ git push origin master --tags
222
+ ```
223
+
224
+ #### Step 4 — Create GitHub Release
225
+
226
+ ```bash
227
+ gh release create v<version> --title "v<version>" --notes "<release-notes>"
228
+ ```
229
+
230
+ #### Step 5 — Notify
231
+
232
+ If deploy reports customer email list available (via rune-pay `/admin/emails`), flag for notification.
233
+
190
234
  ## Output Format
191
235
 
192
236
  ### Commit Mode
@@ -235,6 +279,16 @@ Examples: `feat/jwt-refresh`, `fix/123-login-crash`, `refactor/auth-module`
235
279
  - Change description (#PR)
236
280
  ```
237
281
 
282
+ ### Release Mode
283
+ ```
284
+ ## Release: v<version>
285
+ - **Tag**: v<version>
286
+ - **Commits**: [count] since last release
287
+ - **Changelog**: [path to CHANGELOG.md]
288
+ - **GitHub Release**: [URL]
289
+ - **Artifacts**: version bump, changelog, tag, release
290
+ ```
291
+
238
292
  ## Constraints
239
293
 
240
294
  1. MUST use conventional commit format — no freeform messages
@@ -3,7 +3,7 @@ name: hallucination-guard
3
3
  description: Verify AI-generated imports, API calls, and packages actually exist. Catches phantom functions, non-existent packages, and slopsquatting attacks.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: validation
@@ -74,15 +74,30 @@ File: resolved file path
74
74
 
75
75
  If export not found → mark as **WARN** (symbol may not be exported).
76
76
 
77
- ### Step 3 — Verify external packages
77
+ ### Step 3 — Verify external packages (Dependency Check Before Import)
78
+
79
+ > From taste-skill (Leonxlnx/taste-skill, 3.4k★): "Before importing ANY 3rd party lib, check package.json."
78
80
 
79
81
  Use `Read` on the project's dependency manifest to confirm each external package is listed:
80
82
 
81
83
  - JavaScript/TypeScript: `package.json` → check `dependencies` and `devDependencies`
82
- - Python: `requirements.txt` or `pyproject.toml`
83
- - Rust: `Cargo.toml` → `[dependencies]`
84
-
85
- If package is **not listed** in the manifest mark as **BLOCK** (phantom dependency).
84
+ - Python: `requirements.txt` or `pyproject.toml` → `[project.dependencies]` and `[project.optional-dependencies]`
85
+ - Rust: `Cargo.toml` → `[dependencies]` and `[dev-dependencies]`
86
+
87
+ **Pre-import gate** (BEFORE writing import statements, not just after):
88
+ 1. If the agent is ABOUT to import a package → check manifest FIRST
89
+ 2. If package is NOT in manifest → output install command before writing the import:
90
+ ```
91
+ ⚠ Package '<name>' not in dependencies. Install first:
92
+ npm install <name> # JS/TS
93
+ pip install <name> # Python
94
+ cargo add <name> # Rust
95
+ ```
96
+ 3. If package IS in manifest → proceed with import
97
+
98
+ **Post-import verification** (after code is written):
99
+ - If package is **not listed** in the manifest → mark as **BLOCK** (phantom dependency)
100
+ - If package is listed but not installed (no lockfile entry) → mark as **WARN** (not yet installed)
86
101
 
87
102
  Also check for typosquatting: if package name has edit distance ≤ 2 from a known popular package (axios/axois, lodash/lodahs, react/recat), mark as **SUSPICIOUS**.
88
103
 
@@ -3,7 +3,7 @@ name: journal
3
3
  description: Persistent state tracking and Architecture Decision Records across sessions. Manages progress state, module health, dependency graphs, and ADRs for any workflow.
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.3.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: state
@@ -43,6 +43,7 @@ None — pure L3 state management utility.
43
43
  .rune/module-status.json — Machine-readable module states
44
44
  .rune/dependency-graph.mmd — Mermaid diagram, color-coded by health
45
45
  .rune/adr/ — Architecture Decision Records (one per decision)
46
+ .rune/risks/ — Risk Register entries (one per identified risk)
46
47
  ```
47
48
 
48
49
  ## Execution
@@ -111,6 +112,50 @@ For each architectural decision or trade-off made during this session (applies t
111
112
  - **[Alternative B]**: Rejected because [specific reason]. May reconsider if [condition changes].
112
113
  ```
113
114
 
115
+ ### Step 3.5 — Record risks
116
+
117
+ For each risk identified during the session (technical, schedule, dependency, security):
118
+
119
+ 1. Generate a risk filename: `.rune/risks/RISK-[NNN]-[slug].md` where NNN is next sequential number
120
+ 2. Use `Write` to create the risk file:
121
+
122
+ ```markdown
123
+ # RISK-[NNN]: [Risk Title]
124
+
125
+ **Date Identified**: [YYYY-MM-DD]
126
+ **Identified By**: [workflow — cook | plan | deploy | audit | adversary]
127
+ **Severity**: Critical | High | Medium | Low
128
+ **Likelihood**: High | Medium | Low
129
+ **Status**: Open | Mitigated | Accepted | Closed
130
+
131
+ ## Description
132
+ [What could go wrong — specific scenario, not vague "things might break"]
133
+
134
+ ## Impact
135
+ [What happens if this risk materializes — quantify if possible]
136
+
137
+ ## Mitigation
138
+ [Actions to reduce likelihood or impact]
139
+ - [ ] [Action 1 — owner, deadline]
140
+ - [ ] [Action 2]
141
+
142
+ ## Trigger Conditions
143
+ [How to detect this risk is materializing — monitoring, alerts, symptoms]
144
+
145
+ ## Contingency
146
+ [What to do if risk materializes despite mitigation — the Plan B]
147
+ ```
148
+
149
+ 3. **Risk classification matrix**:
150
+
151
+ | Likelihood \ Severity | Critical | High | Medium | Low |
152
+ |----------------------|----------|------|--------|-----|
153
+ | **High** | 🔴 Immediate action | 🔴 This sprint | 🟡 This quarter | ⚪ Backlog |
154
+ | **Medium** | 🔴 This sprint | 🟡 This quarter | ⚪ Backlog | ⚪ Accept |
155
+ | **Low** | 🟡 This quarter | ⚪ Backlog | ⚪ Accept | ⚪ Accept |
156
+
157
+ 4. Risks marked 🔴 MUST have mitigation actions with deadlines. ⚪ Accept = documented acknowledgment, no action required.
158
+
114
159
  ### Step 4 — Update dependency graph
115
160
 
116
161
  If any module dependencies changed during this session (new imports, removed dependencies, refactored interfaces):
@@ -145,6 +190,7 @@ Emit the journal update summary to the calling skill.
145
190
  - **Module**: [current module]
146
191
  - **Health**: [before] → [after]
147
192
  - **ADRs Written**: [count]
193
+ - **Risks Logged**: [count] ([severity breakdown])
148
194
  - **Files Updated**: [list of .rune/ files modified]
149
195
  - **Next Module**: [next in queue, or "rescue complete"]
150
196
  ```
@@ -154,8 +200,9 @@ Emit the journal update summary to the calling skill.
154
200
  ```
155
201
  1. Read .rune/RESCUE-STATE.md → full rescue history
156
202
  2. Read .rune/module-status.json → module states and health scores
157
- 3. Read git log latest changes since last session
158
- 4. Read CLAUDE.md project conventions
203
+ 3. Read .rune/risks/ open risks and their status
204
+ 4. Read git log latest changes since last session
205
+ 5. Read CLAUDE.md → project conventions
159
206
  → Result: Zero context loss across rescue sessions
160
207
  ```
161
208
 
@@ -180,6 +227,7 @@ Known failure modes for this skill. Check these before declaring done.
180
227
  ## Done When
181
228
 
182
229
  - All decisions from the session recorded as ADR files with rationale
230
+ - All identified risks recorded as RISK files with severity, mitigation, and trigger conditions
183
231
  - Progress state updated (module status, phase, or deploy event as appropriate)
184
232
  - Dependency graph updated if module relationships changed
185
233
  - Journal Update summary emitted to calling skill
@@ -3,7 +3,7 @@ name: plan
3
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
4
  metadata:
5
5
  author: runedev
6
- version: "0.4.0"
6
+ version: "0.9.0"
7
7
  layer: L2
8
8
  model: opus
9
9
  group: creation
@@ -101,10 +101,25 @@ High-level multi-feature planning — organize features into milestones.
101
101
  - `skill-forge` (L2): plan structure for new skill
102
102
  - User: `/rune plan` direct invocation
103
103
 
104
- ## Cross-Hub Connections
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
105
118
 
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
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
108
123
 
109
124
  ## Executable Steps (Implementation Mode)
110
125
 
@@ -149,6 +164,46 @@ Phase decomposition rules:
149
164
  - **Dependencies before consumers**: create what's imported before the importer
150
165
  - **Test alongside**: each phase includes its own test tasks
151
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
152
207
 
153
208
  ### Step 4 — Write Master Plan File
154
209
 
@@ -188,6 +243,52 @@ Save to `.rune/plan-<feature>.md`:
188
243
 
189
244
  **Max 80 lines.** No implementation details — that's what phase files are for.
190
245
 
246
+ ### Step 4.5 — Workflow 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
+
191
292
  ### Step 5 — Write Phase Files
192
293
 
193
294
  For each phase, save to `.rune/plan-<feature>-phase<N>.md`.
@@ -235,6 +336,7 @@ function validateInput(raw: unknown): TradeEntry[]; // throws ValidationError
235
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.
236
337
 
237
338
  - [ ] Task 1 — Create calculateProfit function
339
+ - Req: REQ-001 (P&L calculation)
238
340
  - File: `src/foo/bar.ts` (new)
239
341
  - Test: `tests/foo/bar.test.ts` (new)
240
342
  - Verify: `npm test -- --grep "calculateProfit"`
@@ -242,12 +344,14 @@ Each task MUST include: **File** (exact path), **Test** (test file or N/A), **Ve
242
344
  - Logic: sum entries by side, apply fees (0.1% per trade), return net P&L
243
345
  - Edge: empty array → return { netPnL: 0, totalFees: 0, winRate: 0 }
244
346
  - [ ] Task 2 — Add input validation
347
+ - Req: REQ-002 (input validation)
245
348
  - File: `src/foo/baz.ts` (modify)
246
349
  - Test: `tests/foo/baz.test.ts` (new)
247
350
  - Verify: `npm test -- --grep "validateInput"`
248
351
  - Commit: `feat(trading): add input validation for trade entries`
249
352
  - Logic: check side is 'long'|'short', prices > 0, quantity > 0
250
353
  - [ ] Task 3 — Write integration tests
354
+ - Req: REQ-001, REQ-002 (integration coverage)
251
355
  - File: `tests/foo/bar.test.ts` (modify)
252
356
  - Test: N/A — this IS the test task
253
357
  - Verify: `npm test -- --grep "trading" && npx tsc --noEmit`
@@ -296,6 +400,14 @@ Each task MUST include: **File** (exact path), **Test** (test file or N/A), **Ve
296
400
  - [ ] Performance: calculateProfit(10K entries) < 100ms
297
401
  - [ ] No `any` types, no mutation, no `toFixed()` for money
298
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
+
299
411
  ## Files Touched
300
412
  - `src/foo/bar.ts` — new
301
413
  - `src/foo/baz.ts` — modify
@@ -314,17 +426,36 @@ Every phase file MUST include ALL of these sections (Amateur-Proof Checklist):
314
426
  6. ✅ Cross-Phase Context — what's assumed from prior phases, what's exported for future phases
315
427
  7. ✅ Acceptance Criteria — testable, includes performance if applicable
316
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)
317
430
 
318
431
  A phase missing ANY of sections 1-7 is INCOMPLETE — the weakest coder will guess wrong.
319
432
  Performance Constraints section is optional (only when NFRs apply).
320
433
  </HARD-GATE>
321
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
+
322
452
  ### Step 6 — Present and Get Approval
323
453
 
324
454
  Present the **master plan** to user (NOT all phase files). User reviews:
325
455
  - Phase breakdown
326
456
  - Key decisions
327
457
  - Risks
458
+ - Completeness scores for chosen approach (from Step 5.5)
328
459
 
329
460
  Wait for explicit approval ("go", "proceed", "yes") before writing phase files.
330
461
 
@@ -519,7 +650,23 @@ Max 200 lines. Self-contained — coder needs ONLY this file.
519
650
  | Phase with zero test tasks | CRITICAL | HARD-GATE rejects it |
520
651
  | 10+ phases overwhelming the master plan | MEDIUM | Max 8 phases — split into sub-projects if more |
521
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` |
522
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
+ ```
523
670
 
524
671
  ## Done When
525
672
 
@@ -534,6 +681,7 @@ Max 200 lines. Self-contained — coder needs ONLY this file.
534
681
  - Every code-producing phase has test tasks
535
682
  - Master plan presented to user with "Awaiting Approval"
536
683
  - User has explicitly approved
684
+ - Self-Validation: all checks passed
537
685
 
538
686
  ## Cost Profile
539
687