@rune-kit/rune 2.3.0 → 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 (46) 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/VISION.md +3 -3
  15. package/docs/guides/index.html +14 -14
  16. package/docs/index.html +7 -7
  17. package/docs/skills/index.html +832 -832
  18. package/extensions/ai-ml/PACK.md +7 -0
  19. package/extensions/content/PACK.md +7 -0
  20. package/extensions/mobile/PACK.md +9 -9
  21. package/extensions/zalo/PACK.md +9 -0
  22. package/package.json +2 -2
  23. package/skills/audit/SKILL.md +526 -529
  24. package/skills/ba/SKILL.md +349 -351
  25. package/skills/completion-gate/SKILL.md +260 -263
  26. package/skills/context-engine/SKILL.md +0 -6
  27. package/skills/cook/SKILL.md +2 -11
  28. package/skills/debug/SKILL.md +392 -394
  29. package/skills/deploy/references/post-deploy-integration.md +192 -0
  30. package/skills/fix/SKILL.md +281 -282
  31. package/skills/onboard/SKILL.md +0 -4
  32. package/skills/plan/references/completeness-scoring.md +0 -1
  33. package/skills/plan/references/outcome-block.md +0 -1
  34. package/skills/plan/references/workflow-registry.md +0 -1
  35. package/skills/preflight/SKILL.md +360 -365
  36. package/skills/rescue/SKILL.md +1 -0
  37. package/skills/research/SKILL.md +149 -150
  38. package/skills/review/SKILL.md +489 -495
  39. package/skills/sentinel/SKILL.md +0 -11
  40. package/skills/sentinel/references/destructive-commands.md +0 -1
  41. package/skills/sentinel/references/skill-content-guard.md +0 -1
  42. package/skills/session-bridge/SKILL.md +0 -4
  43. package/skills/skill-router/{SKILL.md → skill.md} +446 -397
  44. package/skills/team/SKILL.md +1 -2
  45. package/skills/test/SKILL.md +585 -593
  46. package/skills/watchdog/references/webhook-health-checks.md +243 -0
@@ -1,282 +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.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
- > 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**: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | 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
- ### Concerns (if DONE_WITH_CONCERNS)
219
- - [concern]: [impact assessment] — [suggested remediation]
220
-
221
- ### Context Needed (if NEEDS_CONTEXT)
222
- - [what is unknown]: [why it blocks] — [two most likely answers]
223
-
224
- ### Blocker (if BLOCKED)
225
- - [specific blocker]: [what was attempted]
226
-
227
- ### Notes
228
- - [any caveats or follow-up needed]
229
- ```
230
-
231
- ### Status Protocol (Subagent Contract)
232
-
233
- Fix returns one of four statuses to its caller (cook, debug, review, surgeon). The caller uses this to route next actions.
234
-
235
- | Status | When | Example |
236
- |--------|------|---------|
237
- | `DONE` | Fix applied, tests pass, no issues | Clean bug fix, all green |
238
- | `DONE_WITH_CONCERNS` | Fix works but has side effects or caveats worth noting | "Tests pass but performance regressed 15%consider optimizing in follow-up" |
239
- | `NEEDS_CONTEXT` | Cannot apply fix without clarification ambiguous spec or missing info | "Two valid interpretations of the expected behavior need user input" |
240
- | `BLOCKED` | Hard blocker — exhausted fix attempts, broken dependency, fundamental incompatibility | "3 fix attempts failed — triggering debug escalation" |
241
-
242
- ## Returns
243
-
244
- | Artifact | Format | Location |
245
- |----------|--------|----------|
246
- | Code changes | Source files | Per debug report / plan file paths |
247
- | Fix Report | Markdown (inline) | Emitted to calling skill (cook, debug, review, surgeon) |
248
- | Verification output | Inline (Fix Report) | Lint + types + test results |
249
-
250
- ## Sharp Edges
251
-
252
- Known failure modes for this skill. Check these before declaring done.
253
-
254
- | Failure Mode | Severity | Mitigation |
255
- |---|---|---|
256
- | Modifying test files to make tests pass | CRITICAL | HARD-GATE blocks this fix the code, never the tests (unless test setup is provably wrong) |
257
- | Applying fix without a diagnosis | HIGH | Evidence Gate: need debug report or clear error description before touching code |
258
- | Exceeding 3 fix attempts without re-diagnosing | HIGH | Constraint 4: after 3 failures, call debug again the hypothesis was wrong |
259
- | Introducing unrelated refactoring while fixing | MEDIUM | YAGNI: fix only what was diagnosed unrelated changes belong in a separate task |
260
- | Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changes run tests after each edit |
261
- | 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 |
262
- | Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
263
- | Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests passpremature cleanup erases failure history |
264
- | 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 |
265
-
266
- ## Done When
267
-
268
- - Root cause identified (debug report or clear error received)
269
- - Minimal changes applied targeting only the diagnosed problem
270
- - Tests pass for the fixed functionality (actual output shown)
271
- - Lint and type check pass
272
- - hallucination-guard verified any new imports
273
- - Fix Report emitted with 4-state status, changed files, and verification results
274
- - If `DONE_WITH_CONCERNS`: concerns listed with impact + remediation
275
- - If `NEEDS_CONTEXT`: specific questions stated with two likely answers
276
- - If `BLOCKED`: blocker + all attempted approaches documented
277
-
278
- ## Cost Profile
279
-
280
- ~2000-5000 tokens input, ~1000-3000 tokens output. Sonnet for code writing quality. Most active skill during implementation.
281
-
282
- **Scope guardrail**: Do not refactor unrelated code or create new features beyond the diagnosed fix target unless explicitly delegated by the parent agent.
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 failedtriggering 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 diagnosedunrelated changes belong in a separate task |
259
+ | Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changesrun 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.
@@ -118,8 +118,6 @@ Instincts with confidence <0.6 are still learning — mention count but don't li
118
118
 
119
119
  **Why**: Onboard is the first skill that runs in a new session. Surfacing instincts here ensures the agent starts with project-specific learned behaviors, not just static conventions.
120
120
 
121
- > Source: affaan-m/everything-claude-code (91.9k★) — instinct-based learning with project isolation.
122
-
123
121
  ### Step 6b — Generate DEVELOPER-GUIDE.md
124
122
 
125
123
  Use the data from Steps 2–3 to generate `.rune/DEVELOPER-GUIDE.md` — a human-readable onboarding guide for new team members joining the project. This is NOT AI context. This is plain English for humans.
@@ -222,8 +220,6 @@ Audit the project's baseline context cost from MCP servers and agent configurati
222
220
 
223
221
  **Skip if**: Total MCP tools ≤80 AND CLAUDE.md ≤150 lines (healthy baseline).
224
222
 
225
- > Source: affaan-m/everything-claude-code (91.9k★) — MCP token cost awareness.
226
-
227
223
  ### Step 7 — Commit
228
224
  Use `Bash` to stage and commit the generated files:
229
225
  ```bash
@@ -20,7 +20,6 @@ When presenting alternatives, rate each with **Completeness X/10**:
20
20
  - Show **dual effort estimates** for each approach: `(human: ~X / AI: ~Y)`
21
21
  - **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.
22
22
 
23
- > Source: garrytan/gstack v0.9.0 — "Boil the Lake" principle.
24
23
 
25
24
  ## Example Format
26
25
 
@@ -38,4 +38,3 @@ Example: "Load phase 1 file and execute Wave 1 tasks (create types, validation s
38
38
 
39
39
  Plans without a clear "what to do NOW" cause executor drift — agents re-read the plan, re-analyze, and pick arbitrary starting points. The Immediate Next Action eliminates ambiguity: there is exactly ONE right first move.
40
40
 
41
- > Source: Affitor/affiliate-skills — every output ends with: outcome achieved + immediate next action + measurement metric ("What happened → What to do now → How to measure").
@@ -9,7 +9,6 @@ Build this registry BEFORE writing phase files for complex features. It catches
9
9
 
10
10
  **Skip conditions**: trivial tasks, inline plans, single-workflow features.
11
11
 
12
- > Source: 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."
13
12
 
14
13
  ## 4-View Format
15
14