@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,249 +1,281 @@
1
- ---
2
- name: fix
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
- metadata:
5
- author: runedev
6
- version: "0.5.0"
7
- layer: L2
8
- model: sonnet
9
- group: development
10
- tools: "Read, Write, Edit, Bash, Glob, Grep"
11
- ---
12
-
13
- # fix
14
-
15
- ## Purpose
16
-
17
- Apply code changes. Fix receives a plan, debug finding, or review finding and writes the actual code. It does NOT investigate root causes — that is rune:debug's job. Fix is the action hub: locate, change, verify, report.
18
-
19
- <HARD-GATE>
20
- Never change test files to make tests pass unless the tests themselves are provably wrong (wrong expected value, wrong test setup, testing a removed API). The rule: fix the CODE, not the TESTS.
21
- If unsure whether the test is wrong or the implementation is wrong → call `rune:debug` to investigate.
22
- </HARD-GATE>
23
-
24
- ## Triggers
25
-
26
- - Called by `cook` Phase 4 IMPLEMENT — write code to pass tests
27
- - Called by `debug` when root cause found and fix is ready
28
- - Called by `review` when bugs found during review
29
- - `/rune fix <issue>` — manual fix application
30
- - Auto-trigger: after successful debug diagnosis
31
-
32
- ## Calls (outbound)
33
-
34
- - `debug` (L2): when root cause unclear before fixing — need diagnosis first
35
- - `test` (L2): verify fix with tests after applying changes
36
- - `review` (L2): self-review for complex or risky fixes
37
- - `verification` (L3): validate fix doesn't break existing functionality
38
- - `docs-seeker` (L3): check correct API usage before applying changes
39
- - `hallucination-guard` (L3): verify imports after code changes
40
- - `scout` (L2): find related code before applying changes
41
- - `neural-memory` (L3): after fix verified — capture fix pattern (cause → solution)
42
-
43
- ## Called By (inbound)
44
-
45
- - `cook` (L1): Phase 4 IMPLEMENT — apply code changes
46
- - `debug` (L2): root cause found, ready to apply fix
47
- - `review` (L2): bug found during review, needs fixing
48
- - `surgeon` (L2): apply refactoring changes
49
- - `review-intake` (L2): apply fixes identified during structured review intake
50
-
51
- ## Cross-Hub Connections
52
-
53
- - `fix` ↔ `debug` — bidirectional: debug diagnoses → fix applies, fix can't determine cause → debug investigates
54
- - `fix` → `test` — after applying fix, run tests to verify
55
- - `fix` ← `review` — review finds bug → fix applies correction
56
- - `fix` → `review` — complex fix requests self-review
57
-
58
- ## Execution
59
-
60
- ### Step 1: Understand
61
-
62
- Read and fully understand the fix request before touching any file.
63
-
64
- - Read the incoming request: debug report, plan spec, or review finding
65
- - Identify what is broken or missing and what the expected behavior should be
66
- - If the request is ambiguous or root cause is unclear → call `rune:debug` before proceeding
67
- - Note the scope: single function, single file, or multi-file change
68
-
69
- ### Step 2: Locate
70
-
71
- Find the exact files and lines to change.
72
-
73
- - Use `rune:scout` to locate the relevant files, functions, and surrounding code
74
- - Use `Read` to examine the specific file:line identified in the debug report or plan
75
- - Use `Glob` to find related files: types, tests, config that may also need updating
76
- - Map all touch points before writing a single line of code
77
-
78
- ### Step 3: Change
79
-
80
- Apply the minimal set of changes needed.
81
-
82
- - Use `Edit` for targeted modifications to existing files
83
- - Use `Write` only when creating a genuinely new file is required
84
- - Follow project conventions: naming, immutability patterns, error handling style
85
- - Keep changes minimal — fix the stated problem, do not refactor unrelated code (YAGNI)
86
- - Never use `any` in TypeScript; never use bare `except:` in Python
87
- - If a new import is needed → note it for Step 5 hallucination-guard check
88
-
89
- ### Step 4: Verify
90
-
91
- Confirm the change works and nothing is broken.
92
-
93
- - Use `Bash` to run the relevant tests: the specific failing test first, then the full suite
94
- - If tests fail after the fix:
95
- - Investigate with `rune:debug` (max 3 debug loops before escalating)
96
- - Do NOT change test files to make tests pass — fix the implementation code
97
- - If project has a type-check command, run it via `Bash`
98
- - If project has a lint command, run it via `Bash`
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
-
126
- ### Step 5: Post-Fix Hardening (Defense-in-Depth)
127
-
128
- After the fix works, make the bug **structurally impossible** — not just "fixed this time."
129
-
130
- Single validation at one point can be bypassed by different code paths, refactoring, or mocks. Add validation at EVERY layer data passes through:
131
-
132
- | Layer | Purpose | Example |
133
- |-------|---------|---------|
134
- | **Entry Point** | Reject invalid input at API boundary | Validate params not empty/exists/correct type |
135
- | **Business Logic** | Ensure data makes sense for this operation | Check preconditions specific to this function |
136
- | **Environment Guard** | Prevent dangerous ops in specific contexts | In tests: refuse writes outside tmpdir |
137
- | **Debug Instrumentation** | Capture context for forensics if bug recurs | Log stack trace + key values before risky ops |
138
-
139
- Apply this when: the bug was caused by invalid data flowing through multiple layers. Skip for trivial one-liner fixes.
140
-
141
- ### Step 5b: Preserve Debug Instrumentation
142
-
143
- If `rune:debug` left `#region agent-debug` markers in the code:
144
-
145
- 1. **During fix**: DO NOT remove these markers they capture the investigation trail
146
- 2. **After fix verified** (tests pass, lint pass): scan for `#region agent-debug` markers
147
- 3. **Remove markers and their contents** in a final cleanup pass ONLY after full verification
148
- 4. If the fix is partial or tests still fail → KEEP all markers for the next debug cycle
149
-
150
- **Why:** Premature cleanup of debug instrumentation erases failure history. If the bug recurs after cleanup, the next debug session starts from zero. Keeping markers until verification means downstream skills can see what was already investigated.
151
-
152
- ### Step 6: Self-Review
153
-
154
- Verify correctness of the changes just made.
155
-
156
- - Call `rune:hallucination-guard` to verify all imports introduced or modified are real and correctly named
157
- - Call `rune:docs-seeker` if any external API, library method, or SDK call was added or changed
158
- - For complex or risky fixes (auth, data mutation, async logic): call `rune:review` for a full quality check
159
-
160
- ### Step 6b: Capture Fix Pattern
161
-
162
- Call `neural-memory` (Capture Mode) to save the fix pattern: what broke, why, and how it was fixed. Priority 7 for recurring bugs.
163
-
164
- ### Step 7: Report
165
-
166
- Produce a structured summary of all changes made.
167
-
168
- - List every file modified and a one-line description of what changed
169
- - Include verification results (tests, types, lint)
170
- - Note any follow-up work if the fix is partial or has known limitations
171
-
172
- ## Constraints
173
-
174
- 1. MUST NOT change test files to make tests pass fix the CODE, not the TESTS
175
- 2. MUST have a diagnosis (from debug or clear error) before applying fixes
176
- 3. MUST run tests after each fix attemptnever batch multiple untested changes
177
- 4. MUST NOT exceed 3 fix attemptsif 3 fixes fail, re-diagnose via rune:debug (which will classify: wrong approach → brainstorm rescue, wrong design → plan redesign)
178
- 5. MUST follow project conventions found by scoutdon't invent new patterns
179
- 6. MUST NOT add unplanned features while fixing fix only what was diagnosed
180
- 7. MUST track fix attempt numberthis feeds debug's 3-Fix Escalation classification
181
- 8. MUST preserve `#region agent-debug` markers until fix is fully verified — cleanup only after tests pass
182
-
183
- ## Scope Gate
184
-
185
- | Change Type | Action |
186
- |-------------|--------|
187
- | Bug fix (diagnosed cause) | Fix it |
188
- | Security fix (found during fix) | Fix it + flag to sentinel |
189
- | Blocking issue (can't complete fix without) | Fix it + document in report |
190
- | Unrelated improvement | **STOP — create separate task** |
191
- | Architectural change | **STOP — escalate to cook/plan** |
192
-
193
- If fix requires touching >3 files not in the diagnosis → re-diagnose. You're probably fixing a symptom.
194
-
195
- ## Mesh Gates
196
-
197
- | Gate | Requires | If Missing |
198
- |------|----------|------------|
199
- | Evidence Gate | Debug report OR clear error description before fixing | Run rune:debug first |
200
- | Test Gate | Tests run after each fix attempt | Run tests before claiming fix works |
201
-
202
- ## Output Format
203
-
204
- ```
205
- ## Fix Report
206
- - **Task**: [what was fixed/implemented]
207
- - **Status**: complete | partial | blocked
208
-
209
- ### Changes
210
- - `path/to/file.ts` — [description of change]
211
- - `path/to/other.ts` — [description of change]
212
-
213
- ### Verification
214
- - Lint: PASS | FAIL
215
- - Types: PASS | FAIL
216
- - Tests: PASS | FAIL ([n] passed, [m] failed)
217
-
218
- ### Notes
219
- - [any caveats or follow-up needed]
220
- ```
221
-
222
- ## Sharp Edges
223
-
224
- Known failure modes for this skill. Check these before declaring done.
225
-
226
- | Failure Mode | Severity | Mitigation |
227
- |---|---|---|
228
- | Modifying test files to make tests pass | CRITICAL | HARD-GATE blocks this — fix the code, never the tests (unless test setup is provably wrong) |
229
- | Applying fix without a diagnosis | HIGH | Evidence Gate: need debug report or clear error description before touching code |
230
- | Exceeding 3 fix attempts without re-diagnosing | HIGH | Constraint 4: after 3 failures, call debug again — the hypothesis was wrong |
231
- | Introducing unrelated refactoring while fixing | MEDIUM | YAGNI: fix only what was diagnosed — unrelated changes belong in a separate task |
232
- | Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changes run tests after each edit |
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 |
234
- | Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
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 |
237
-
238
- ## Done When
239
-
240
- - Root cause identified (debug report or clear error received)
241
- - Minimal changes applied targeting only the diagnosed problem
242
- - Tests pass for the fixed functionality (actual output shown)
243
- - Lint and type check pass
244
- - hallucination-guard verified any new imports
245
- - Fix Report emitted with changed files and verification results
246
-
247
- ## Cost Profile
248
-
249
- ~2000-5000 tokens input, ~1000-3000 tokens output. Sonnet for code writing quality. Most active skill during implementation.
1
+ ---
2
+ name: fix
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
+ metadata:
5
+ author: runedev
6
+ version: "0.6.0"
7
+ layer: L2
8
+ model: sonnet
9
+ group: development
10
+ tools: "Read, Write, Edit, Bash, Glob, Grep"
11
+ ---
12
+
13
+ # fix
14
+
15
+ ## Purpose
16
+
17
+ Apply code changes. Fix receives a plan, debug finding, or review finding and writes the actual code. It does NOT investigate root causes — that is rune:debug's job. Fix is the action hub: locate, change, verify, report.
18
+
19
+ <HARD-GATE>
20
+ Never change test files to make tests pass unless the tests themselves are provably wrong (wrong expected value, wrong test setup, testing a removed API). The rule: fix the CODE, not the TESTS.
21
+ If unsure whether the test is wrong or the implementation is wrong → call `rune:debug` to investigate.
22
+ </HARD-GATE>
23
+
24
+ ## Triggers
25
+
26
+ - Called by `cook` Phase 4 IMPLEMENT — write code to pass tests
27
+ - Called by `debug` when root cause found and fix is ready
28
+ - Called by `review` when bugs found during review
29
+ - `/rune fix <issue>` — manual fix application
30
+ - Auto-trigger: after successful debug diagnosis
31
+
32
+ ## Calls (outbound)
33
+
34
+ - `debug` (L2): when root cause unclear before fixing — need diagnosis first
35
+ - `test` (L2): verify fix with tests after applying changes
36
+ - `review` (L2): self-review for complex or risky fixes
37
+ - `verification` (L3): validate fix doesn't break existing functionality
38
+ - `docs-seeker` (L3): check correct API usage before applying changes
39
+ - `hallucination-guard` (L3): verify imports after code changes
40
+ - `scout` (L2): find related code before applying changes
41
+ - `neural-memory` (L3): after fix verified — capture fix pattern (cause → solution)
42
+
43
+ ## Called By (inbound)
44
+
45
+ - `cook` (L1): Phase 4 IMPLEMENT — apply code changes
46
+ - `debug` (L2): root cause found, ready to apply fix
47
+ - `review` (L2): bug found during review, needs fixing
48
+ - `surgeon` (L2): apply refactoring changes
49
+ - `review-intake` (L2): apply fixes identified during structured review intake
50
+
51
+ ## Cross-Hub Connections
52
+
53
+ - `fix` ↔ `debug` — bidirectional: debug diagnoses → fix applies, fix can't determine cause → debug investigates
54
+ - `fix` → `test` — after applying fix, run tests to verify
55
+ - `fix` ← `review` — review finds bug → fix applies correction
56
+ - `fix` → `review` — complex fix requests self-review
57
+
58
+ ## Execution
59
+
60
+ ### Step 1: Understand
61
+
62
+ Read and fully understand the fix request before touching any file.
63
+
64
+ - Read the incoming request: debug report, plan spec, or review finding
65
+ - Identify what is broken or missing and what the expected behavior should be
66
+ - If the request is ambiguous or root cause is unclear → call `rune:debug` before proceeding
67
+ - Note the scope: single function, single file, or multi-file change
68
+
69
+ ### Step 2: Locate
70
+
71
+ Find the exact files and lines to change.
72
+
73
+ - Use `rune:scout` to locate the relevant files, functions, and surrounding code
74
+ - Use `Read` to examine the specific file:line identified in the debug report or plan
75
+ - Use `Glob` to find related files: types, tests, config that may also need updating
76
+ - Map all touch points before writing a single line of code
77
+
78
+ ### Step 3: Change
79
+
80
+ Apply the minimal set of changes needed.
81
+
82
+ - Use `Edit` for targeted modifications to existing files
83
+ - Use `Write` only when creating a genuinely new file is required
84
+ - Follow project conventions: naming, immutability patterns, error handling style
85
+ - Keep changes minimal — fix the stated problem, do not refactor unrelated code (YAGNI)
86
+ - Never use `any` in TypeScript; never use bare `except:` in Python
87
+ - If a new import is needed → note it for Step 5 hallucination-guard check
88
+
89
+ ### Step 4: Verify
90
+
91
+ Confirm the change works and nothing is broken.
92
+
93
+ - Use `Bash` to run the relevant tests: the specific failing test first, then the full suite
94
+ - If tests fail after the fix:
95
+ - Investigate with `rune:debug` (max 3 debug loops before escalating)
96
+ - Do NOT change test files to make tests pass — fix the implementation code
97
+ - If project has a type-check command, run it via `Bash`
98
+ - If project has a lint command, run it via `Bash`
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
+
125
+ ### Step 5: Post-Fix Hardening (Defense-in-Depth)
126
+
127
+ After the fix works, make the bug **structurally impossible** — not just "fixed this time."
128
+
129
+ Single validation at one point can be bypassed by different code paths, refactoring, or mocks. Add validation at EVERY layer data passes through:
130
+
131
+ | Layer | Purpose | Example |
132
+ |-------|---------|---------|
133
+ | **Entry Point** | Reject invalid input at API boundary | Validate params not empty/exists/correct type |
134
+ | **Business Logic** | Ensure data makes sense for this operation | Check preconditions specific to this function |
135
+ | **Environment Guard** | Prevent dangerous ops in specific contexts | In tests: refuse writes outside tmpdir |
136
+ | **Debug Instrumentation** | Capture context for forensics if bug recurs | Log stack trace + key values before risky ops |
137
+
138
+ Apply this when: the bug was caused by invalid data flowing through multiple layers. Skip for trivial one-liner fixes.
139
+
140
+ ### Step 5b: Preserve Debug Instrumentation
141
+
142
+ If `rune:debug` left `#region agent-debug` markers in the code:
143
+
144
+ 1. **During fix**: DO NOT remove these markers — they capture the investigation trail
145
+ 2. **After fix verified** (tests pass, lint pass): scan for `#region agent-debug` markers
146
+ 3. **Remove markers and their contents** in a final cleanup pass ONLY after full verification
147
+ 4. If the fix is partial or tests still fail KEEP all markers for the next debug cycle
148
+
149
+ **Why:** Premature cleanup of debug instrumentation erases failure history. If the bug recurs after cleanup, the next debug session starts from zero. Keeping markers until verification means downstream skills can see what was already investigated.
150
+
151
+ ### Step 6: Self-Review
152
+
153
+ Verify correctness of the changes just made.
154
+
155
+ - Call `rune:hallucination-guard` to verify all imports introduced or modified are real and correctly named
156
+ - Call `rune:docs-seeker` if any external API, library method, or SDK call was added or changed
157
+ - For complex or risky fixes (auth, data mutation, async logic): call `rune:review` for a full quality check
158
+
159
+ ### Step 6b: Capture Fix Pattern
160
+
161
+ Call `neural-memory` (Capture Mode) to save the fix pattern: what broke, why, and how it was fixed. Priority 7 for recurring bugs.
162
+
163
+ ### Step 7: Report
164
+
165
+ Produce a structured summary of all changes made.
166
+
167
+ - List every file modified and a one-line description of what changed
168
+ - Include verification results (tests, types, lint)
169
+ - Note any follow-up work if the fix is partial or has known limitations
170
+
171
+ ## Constraints
172
+
173
+ 1. MUST NOT change test files to make tests pass — fix the CODE, not the TESTS
174
+ 2. MUST have a diagnosis (from debug or clear error) before applying fixes
175
+ 3. MUST run tests after each fix attempt never batch multiple untested changes
176
+ 4. MUST NOT exceed 3 fix attemptsif 3 fixes fail, re-diagnose via rune:debug (which will classify: wrong approach → brainstorm rescue, wrong design → plan redesign)
177
+ 5. MUST follow project conventions found by scout don't invent new patterns
178
+ 6. MUST NOT add unplanned features while fixingfix only what was diagnosed
179
+ 7. MUST track fix attempt number this feeds debug's 3-Fix Escalation classification
180
+ 8. MUST preserve `#region agent-debug` markers until fix is fully verified cleanup only after tests pass
181
+
182
+ ## Scope Gate
183
+
184
+ | Change Type | Action |
185
+ |-------------|--------|
186
+ | Bug fix (diagnosed cause) | Fix it |
187
+ | Security fix (found during fix) | Fix it + flag to sentinel |
188
+ | Blocking issue (can't complete fix without) | Fix it + document in report |
189
+ | Unrelated improvement | **STOP create separate task** |
190
+ | Architectural change | **STOP — escalate to cook/plan** |
191
+
192
+ If fix requires touching >3 files not in the diagnosis → re-diagnose. You're probably fixing a symptom.
193
+
194
+ ## Mesh Gates
195
+
196
+ | Gate | Requires | If Missing |
197
+ |------|----------|------------|
198
+ | Evidence Gate | Debug report OR clear error description before fixing | Run rune:debug first |
199
+ | Test Gate | Tests run after each fix attempt | Run tests before claiming fix works |
200
+
201
+ ## Output Format
202
+
203
+ ```
204
+ ## Fix Report
205
+ - **Task**: [what was fixed/implemented]
206
+ - **Status**: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
207
+
208
+ ### Changes
209
+ - `path/to/file.ts` — [description of change]
210
+ - `path/to/other.ts` — [description of change]
211
+
212
+ ### Verification
213
+ - Lint: PASS | FAIL
214
+ - Types: PASS | FAIL
215
+ - Tests: PASS | FAIL ([n] passed, [m] failed)
216
+
217
+ ### Concerns (if DONE_WITH_CONCERNS)
218
+ - [concern]: [impact assessment] — [suggested remediation]
219
+
220
+ ### Context Needed (if NEEDS_CONTEXT)
221
+ - [what is unknown]: [why it blocks] — [two most likely answers]
222
+
223
+ ### Blocker (if BLOCKED)
224
+ - [specific blocker]: [what was attempted]
225
+
226
+ ### Notes
227
+ - [any caveats or follow-up needed]
228
+ ```
229
+
230
+ ### Status Protocol (Subagent Contract)
231
+
232
+ Fix returns one of four statuses to its caller (cook, debug, review, surgeon). The caller uses this to route next actions.
233
+
234
+ | Status | When | Example |
235
+ |--------|------|---------|
236
+ | `DONE` | Fix applied, tests pass, no issues | Clean bug fix, all green |
237
+ | `DONE_WITH_CONCERNS` | Fix works but has side effects or caveats worth noting | "Tests pass but performance regressed 15% — consider optimizing in follow-up" |
238
+ | `NEEDS_CONTEXT` | Cannot apply fix without clarification — ambiguous spec or missing info | "Two valid interpretations of the expected behavior — need user input" |
239
+ | `BLOCKED` | Hard blocker — exhausted fix attempts, broken dependency, fundamental incompatibility | "3 fix attempts failed — triggering debug escalation" |
240
+
241
+ ## Returns
242
+
243
+ | Artifact | Format | Location |
244
+ |----------|--------|----------|
245
+ | Code changes | Source files | Per debug report / plan file paths |
246
+ | Fix Report | Markdown (inline) | Emitted to calling skill (cook, debug, review, surgeon) |
247
+ | Verification output | Inline (Fix Report) | Lint + types + test results |
248
+
249
+ ## Sharp Edges
250
+
251
+ Known failure modes for this skill. Check these before declaring done.
252
+
253
+ | Failure Mode | Severity | Mitigation |
254
+ |---|---|---|
255
+ | Modifying test files to make tests pass | CRITICAL | HARD-GATE blocks this — fix the code, never the tests (unless test setup is provably wrong) |
256
+ | Applying fix without a diagnosis | HIGH | Evidence Gate: need debug report or clear error description before touching code |
257
+ | Exceeding 3 fix attempts without re-diagnosing | HIGH | Constraint 4: after 3 failures, call debug again — the hypothesis was wrong |
258
+ | Introducing unrelated refactoring while fixing | MEDIUM | YAGNI: fix only what was diagnosed — unrelated changes belong in a separate task |
259
+ | Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changes — run tests after each edit |
260
+ | 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 |
261
+ | Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
262
+ | Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests pass — premature cleanup erases failure history |
263
+ | 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 |
264
+
265
+ ## Done When
266
+
267
+ - Root cause identified (debug report or clear error received)
268
+ - Minimal changes applied targeting only the diagnosed problem
269
+ - Tests pass for the fixed functionality (actual output shown)
270
+ - Lint and type check pass
271
+ - hallucination-guard verified any new imports
272
+ - Fix Report emitted with 4-state status, changed files, and verification results
273
+ - If `DONE_WITH_CONCERNS`: concerns listed with impact + remediation
274
+ - If `NEEDS_CONTEXT`: specific questions stated with two likely answers
275
+ - If `BLOCKED`: blocker + all attempted approaches documented
276
+
277
+ ## Cost Profile
278
+
279
+ ~2000-5000 tokens input, ~1000-3000 tokens output. Sonnet for code writing quality. Most active skill during implementation.
280
+
281
+ **Scope guardrail**: Do not refactor unrelated code or create new features beyond the diagnosed fix target unless explicitly delegated by the parent agent.
@@ -214,6 +214,16 @@ File: src/middleware/auth.ts:47
214
214
  | Security Gate | sentinel ran before closing incident | Run sentinel — do not skip |
215
215
  | Postmortem Gate | All sections populated (Timeline, RCA, Prevention Actions) before status = Resolved | Complete or note as DRAFT |
216
216
 
217
+ ## Returns
218
+
219
+ | Artifact | Format | Location |
220
+ |----------|--------|----------|
221
+ | Incident response report | Markdown | inline (chat output) |
222
+ | Incident timeline | Text (HH:MM format) | inline + postmortem |
223
+ | Postmortem document | Markdown | `.rune/incidents/INCIDENT-<date>-<slug>.md` |
224
+ | Prevention actions table | Markdown table | postmortem |
225
+ | Journal entry (incident ADR) | Text | `.rune/adr/` (via `rune:journal`) |
226
+
217
227
  ## Sharp Edges
218
228
 
219
229
  Known failure modes for this skill. Check these before declaring done.
@@ -303,6 +303,16 @@ Mark todo[4] `completed`.
303
303
  - Launch video: [ready | skipped]
304
304
  ```
305
305
 
306
+ ## Returns
307
+
308
+ | Artifact | Format | Location |
309
+ |----------|--------|----------|
310
+ | Deploy status + live URL | Inline (Launch Report) | Emitted at session end |
311
+ | Marketing assets (copy, social, SEO) | Markdown (inline) | Generated by `rune:marketing`, presented in Phase 5 |
312
+ | Release checklist | Markdown (inline) | Shown in Announce phase |
313
+ | Monitoring confirmation | Inline | Watchdog setup output |
314
+ | Launch Report | Markdown (inline) | Emitted at end of session |
315
+
306
316
  ## Sharp Edges
307
317
 
308
318
  Known failure modes for this skill. Check these before declaring done.
@@ -328,3 +338,5 @@ Known failure modes for this skill. Check these before declaring done.
328
338
  ## Cost Profile
329
339
 
330
340
  ~$0.08-0.15 per launch. Sonnet for coordination, delegates to haiku for scanning.
341
+
342
+ **Scope guardrail**: Do not publish marketing assets or trigger external announcements unless explicitly delegated by the parent agent.
@@ -235,6 +235,17 @@ Ensure the next session can pick up where this one left off:
235
235
  - Manifest summary saved to journal + neural memory for cross-session handoff
236
236
  - Tests pass after any logic edit
237
237
 
238
+ ## Returns
239
+
240
+ | Artifact | Format | Location |
241
+ |----------|--------|----------|
242
+ | Logic manifest | JSON | `.rune/logic-manifest.json` |
243
+ | Validation report (SYNCED / DRIFT) | Markdown | inline |
244
+ | Pre-edit gate summary | Structured text | inline |
245
+ | ADR entries for logic changes | Markdown | via `journal` L3 |
246
+
238
247
  ## Cost Profile
239
248
 
240
249
  ~1,000-2,000 tokens for manifest load + pre-edit gate. ~3,000-5,000 tokens for full project scan (Phase 3). Sonnet for code analysis; haiku for file scanning via scout.
250
+
251
+ **Scope guardrail:** logic-guardian protects existing logic — it does not implement new features or refactor code.
@@ -224,6 +224,19 @@ Known failure modes for this skill. Check these before declaring done.
224
224
  - Files saved to marketing/ directory
225
225
  - Marketing Assets report emitted with file list
226
226
 
227
+ ## Returns
228
+
229
+ | Artifact | Format | Location |
230
+ |----------|--------|----------|
231
+ | Brand voice contract | Markdown | `marketing/brand-voice.md` |
232
+ | Landing page copy | Markdown | `marketing/landing-copy.md` |
233
+ | Social media posts | Markdown | `marketing/social-posts.md` |
234
+ | SEO metadata | JSON | `marketing/seo-meta.json` |
235
+ | SEO audit report | Markdown | `marketing/seo-audit.md` |
236
+ | Video demo script | Markdown | `marketing/video-script.md` |
237
+
227
238
  ## Cost Profile
228
239
 
229
240
  ~2000-5000 tokens input, ~1000-3000 tokens output. Sonnet for copywriting quality.
241
+
242
+ **Scope guardrail:** marketing generates assets based on actual product capabilities only — no aspirational copy, no fabricated stats.
@@ -353,6 +353,19 @@ mcp-server-<name>/
353
353
  - Verification passed (types + tests)
354
354
  - Ready to install in Claude Code / Cursor / other IDEs
355
355
 
356
+ ## Returns
357
+
358
+ | Artifact | Format | Location |
359
+ |----------|--------|----------|
360
+ | MCP server source code | TypeScript or Python | `mcp-server-<name>/src/` |
361
+ | Tool definitions (one per tool) | TS/Python files | `src/tools/<name>.ts` or `.py` |
362
+ | Resource handlers | TS/Python files | `src/resources/<name>.ts` or `.py` |
363
+ | Test suite | TS/Python test files | `tests/` |
364
+ | README with tool catalog | Markdown | `mcp-server-<name>/README.md` |
365
+ | Environment config template | `.env.example` | project root |
366
+
356
367
  ## Cost Profile
357
368
 
358
369
  ~3000-6000 tokens input, ~2000-5000 tokens output. Sonnet — MCP server generation is a structured code task, not architectural reasoning.
370
+
371
+ **Scope guardrail:** mcp-builder generates the server and tests — it does not deploy, register with MCP registries, or configure the host IDE beyond providing the installation snippet.