@rune-kit/rune 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -17
- package/compiler/__tests__/pack-split.test.js +141 -1
- package/compiler/__tests__/parser.test.js +147 -55
- package/compiler/__tests__/scripts-bundling.test.js +10 -11
- package/compiler/__tests__/skill-index.test.js +218 -0
- package/compiler/adapters/antigravity.js +71 -57
- package/compiler/bin/rune.js +355 -355
- package/compiler/doctor.js +11 -1
- package/compiler/emitter.js +678 -466
- package/compiler/parser.js +267 -247
- package/hooks/hooks.json +12 -0
- package/hooks/intent-router/index.cjs +108 -0
- package/hooks/pre-tool-guard/index.cjs +177 -68
- package/package.json +63 -63
- package/skills/brainstorm/SKILL.md +2 -0
- package/skills/cook/SKILL.md +661 -648
- package/skills/debug/SKILL.md +394 -392
- package/skills/deploy/SKILL.md +2 -0
- package/skills/fix/SKILL.md +283 -281
- package/skills/onboard/SKILL.md +7 -0
- package/skills/plan/SKILL.md +344 -342
- package/skills/preflight/SKILL.md +362 -360
- package/skills/review/SKILL.md +491 -489
- package/skills/scout/SKILL.md +1 -0
- package/skills/sentinel/SKILL.md +319 -299
- package/skills/session-bridge/SKILL.md +1 -0
- package/skills/team/SKILL.md +1 -0
- package/skills/test/SKILL.md +587 -585
- package/skills/verification/SKILL.md +1 -0
- package/skills/watchdog/SKILL.md +2 -0
package/skills/deploy/SKILL.md
CHANGED
package/skills/fix/SKILL.md
CHANGED
|
@@ -1,281 +1,283 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- Called by `
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- `
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- `
|
|
48
|
-
- `
|
|
49
|
-
- `review
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
- `fix`
|
|
56
|
-
- `fix` → `
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- Use `
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
|
109
|
-
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
**
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
135
|
-
| **
|
|
136
|
-
| **
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
|
187
|
-
|
|
188
|
-
|
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
|
237
|
-
|
|
238
|
-
| `
|
|
239
|
-
| `
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
|
246
|
-
|
|
247
|
-
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
|
256
|
-
|
|
257
|
-
|
|
|
258
|
-
|
|
|
259
|
-
|
|
|
260
|
-
|
|
|
261
|
-
|
|
|
262
|
-
|
|
|
263
|
-
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
-
|
|
270
|
-
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
- If `
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
+
emit: code.changed
|
|
12
|
+
listen: bug.diagnosed, review.issues, preflight.blocked, security.blocked
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# fix
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
<HARD-GATE>
|
|
22
|
+
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.
|
|
23
|
+
If unsure whether the test is wrong or the implementation is wrong → call `rune:debug` to investigate.
|
|
24
|
+
</HARD-GATE>
|
|
25
|
+
|
|
26
|
+
## Triggers
|
|
27
|
+
|
|
28
|
+
- Called by `cook` Phase 4 IMPLEMENT — write code to pass tests
|
|
29
|
+
- Called by `debug` when root cause found and fix is ready
|
|
30
|
+
- Called by `review` when bugs found during review
|
|
31
|
+
- `/rune fix <issue>` — manual fix application
|
|
32
|
+
- Auto-trigger: after successful debug diagnosis
|
|
33
|
+
|
|
34
|
+
## Calls (outbound)
|
|
35
|
+
|
|
36
|
+
- `debug` (L2): when root cause unclear before fixing — need diagnosis first
|
|
37
|
+
- `test` (L2): verify fix with tests after applying changes
|
|
38
|
+
- `review` (L2): self-review for complex or risky fixes
|
|
39
|
+
- `verification` (L3): validate fix doesn't break existing functionality
|
|
40
|
+
- `docs-seeker` (L3): check correct API usage before applying changes
|
|
41
|
+
- `hallucination-guard` (L3): verify imports after code changes
|
|
42
|
+
- `scout` (L2): find related code before applying changes
|
|
43
|
+
- `neural-memory` (L3): after fix verified — capture fix pattern (cause → solution)
|
|
44
|
+
|
|
45
|
+
## Called By (inbound)
|
|
46
|
+
|
|
47
|
+
- `cook` (L1): Phase 4 IMPLEMENT — apply code changes
|
|
48
|
+
- `debug` (L2): root cause found, ready to apply fix
|
|
49
|
+
- `review` (L2): bug found during review, needs fixing
|
|
50
|
+
- `surgeon` (L2): apply refactoring changes
|
|
51
|
+
- `review-intake` (L2): apply fixes identified during structured review intake
|
|
52
|
+
|
|
53
|
+
## Cross-Hub Connections
|
|
54
|
+
|
|
55
|
+
- `fix` ↔ `debug` — bidirectional: debug diagnoses → fix applies, fix can't determine cause → debug investigates
|
|
56
|
+
- `fix` → `test` — after applying fix, run tests to verify
|
|
57
|
+
- `fix` ← `review` — review finds bug → fix applies correction
|
|
58
|
+
- `fix` → `review` — complex fix requests self-review
|
|
59
|
+
|
|
60
|
+
## Execution
|
|
61
|
+
|
|
62
|
+
### Step 1: Understand
|
|
63
|
+
|
|
64
|
+
Read and fully understand the fix request before touching any file.
|
|
65
|
+
|
|
66
|
+
- Read the incoming request: debug report, plan spec, or review finding
|
|
67
|
+
- Identify what is broken or missing and what the expected behavior should be
|
|
68
|
+
- If the request is ambiguous or root cause is unclear → call `rune:debug` before proceeding
|
|
69
|
+
- Note the scope: single function, single file, or multi-file change
|
|
70
|
+
|
|
71
|
+
### Step 2: Locate
|
|
72
|
+
|
|
73
|
+
Find the exact files and lines to change.
|
|
74
|
+
|
|
75
|
+
- Use `rune:scout` to locate the relevant files, functions, and surrounding code
|
|
76
|
+
- Use `Read` to examine the specific file:line identified in the debug report or plan
|
|
77
|
+
- Use `Glob` to find related files: types, tests, config that may also need updating
|
|
78
|
+
- Map all touch points before writing a single line of code
|
|
79
|
+
|
|
80
|
+
### Step 3: Change
|
|
81
|
+
|
|
82
|
+
Apply the minimal set of changes needed.
|
|
83
|
+
|
|
84
|
+
- Use `Edit` for targeted modifications to existing files
|
|
85
|
+
- Use `Write` only when creating a genuinely new file is required
|
|
86
|
+
- Follow project conventions: naming, immutability patterns, error handling style
|
|
87
|
+
- Keep changes minimal — fix the stated problem, do not refactor unrelated code (YAGNI)
|
|
88
|
+
- Never use `any` in TypeScript; never use bare `except:` in Python
|
|
89
|
+
- If a new import is needed → note it for Step 5 hallucination-guard check
|
|
90
|
+
|
|
91
|
+
### Step 4: Verify
|
|
92
|
+
|
|
93
|
+
Confirm the change works and nothing is broken.
|
|
94
|
+
|
|
95
|
+
- Use `Bash` to run the relevant tests: the specific failing test first, then the full suite
|
|
96
|
+
- If tests fail after the fix:
|
|
97
|
+
- Investigate with `rune:debug` (max 3 debug loops before escalating)
|
|
98
|
+
- Do NOT change test files to make tests pass — fix the implementation code
|
|
99
|
+
- If project has a type-check command, run it via `Bash`
|
|
100
|
+
- If project has a lint command, run it via `Bash`
|
|
101
|
+
|
|
102
|
+
### Step 4.5: Quality Decay Check (Self-Regulation)
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
**Compute every 3 fix attempts** (or when called 5+ times in a single cook session):
|
|
107
|
+
|
|
108
|
+
| Signal | Score Adjustment |
|
|
109
|
+
|--------|-----------------|
|
|
110
|
+
| A fix was reverted (any test that passed now fails) | +15% |
|
|
111
|
+
| Fix touched >3 files (blast radius expanding) | +5% per extra file beyond 3 |
|
|
112
|
+
| 15+ fixes already applied in this session | +1% per fix beyond 15 |
|
|
113
|
+
| All remaining issues are LOW severity | +10% |
|
|
114
|
+
| Fix touched files outside the original diagnosis scope | +20% |
|
|
115
|
+
| Consecutive fixes without running tests between them | +10% |
|
|
116
|
+
|
|
117
|
+
**Thresholds:**
|
|
118
|
+
- **>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."
|
|
119
|
+
- **Hard cap: 30 fixes per session** — regardless of score. After 30, STOP and report.
|
|
120
|
+
|
|
121
|
+
**Reset conditions:** WTF-likelihood resets to 0% when:
|
|
122
|
+
- User explicitly says "continue fixing"
|
|
123
|
+
- A full test suite run shows zero regressions
|
|
124
|
+
- Scope is narrowed to a single file
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Step 5: Post-Fix Hardening (Defense-in-Depth)
|
|
128
|
+
|
|
129
|
+
After the fix works, make the bug **structurally impossible** — not just "fixed this time."
|
|
130
|
+
|
|
131
|
+
Single validation at one point can be bypassed by different code paths, refactoring, or mocks. Add validation at EVERY layer data passes through:
|
|
132
|
+
|
|
133
|
+
| Layer | Purpose | Example |
|
|
134
|
+
|-------|---------|---------|
|
|
135
|
+
| **Entry Point** | Reject invalid input at API boundary | Validate params not empty/exists/correct type |
|
|
136
|
+
| **Business Logic** | Ensure data makes sense for this operation | Check preconditions specific to this function |
|
|
137
|
+
| **Environment Guard** | Prevent dangerous ops in specific contexts | In tests: refuse writes outside tmpdir |
|
|
138
|
+
| **Debug Instrumentation** | Capture context for forensics if bug recurs | Log stack trace + key values before risky ops |
|
|
139
|
+
|
|
140
|
+
Apply this when: the bug was caused by invalid data flowing through multiple layers. Skip for trivial one-liner fixes.
|
|
141
|
+
|
|
142
|
+
### Step 5b: Preserve Debug Instrumentation
|
|
143
|
+
|
|
144
|
+
If `rune:debug` left `#region agent-debug` markers in the code:
|
|
145
|
+
|
|
146
|
+
1. **During fix**: DO NOT remove these markers — they capture the investigation trail
|
|
147
|
+
2. **After fix verified** (tests pass, lint pass): scan for `#region agent-debug` markers
|
|
148
|
+
3. **Remove markers and their contents** in a final cleanup pass ONLY after full verification
|
|
149
|
+
4. If the fix is partial or tests still fail → KEEP all markers for the next debug cycle
|
|
150
|
+
|
|
151
|
+
**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.
|
|
152
|
+
|
|
153
|
+
### Step 6: Self-Review
|
|
154
|
+
|
|
155
|
+
Verify correctness of the changes just made.
|
|
156
|
+
|
|
157
|
+
- Call `rune:hallucination-guard` to verify all imports introduced or modified are real and correctly named
|
|
158
|
+
- Call `rune:docs-seeker` if any external API, library method, or SDK call was added or changed
|
|
159
|
+
- For complex or risky fixes (auth, data mutation, async logic): call `rune:review` for a full quality check
|
|
160
|
+
|
|
161
|
+
### Step 6b: Capture Fix Pattern
|
|
162
|
+
|
|
163
|
+
Call `neural-memory` (Capture Mode) to save the fix pattern: what broke, why, and how it was fixed. Priority 7 for recurring bugs.
|
|
164
|
+
|
|
165
|
+
### Step 7: Report
|
|
166
|
+
|
|
167
|
+
Produce a structured summary of all changes made.
|
|
168
|
+
|
|
169
|
+
- List every file modified and a one-line description of what changed
|
|
170
|
+
- Include verification results (tests, types, lint)
|
|
171
|
+
- Note any follow-up work if the fix is partial or has known limitations
|
|
172
|
+
|
|
173
|
+
## Constraints
|
|
174
|
+
|
|
175
|
+
1. MUST NOT change test files to make tests pass — fix the CODE, not the TESTS
|
|
176
|
+
2. MUST have a diagnosis (from debug or clear error) before applying fixes
|
|
177
|
+
3. MUST run tests after each fix attempt — never batch multiple untested changes
|
|
178
|
+
4. MUST NOT exceed 3 fix attempts — if 3 fixes fail, re-diagnose via rune:debug (which will classify: wrong approach → brainstorm rescue, wrong design → plan redesign)
|
|
179
|
+
5. MUST follow project conventions found by scout — don't invent new patterns
|
|
180
|
+
6. MUST NOT add unplanned features while fixing — fix only what was diagnosed
|
|
181
|
+
7. MUST track fix attempt number — this feeds debug's 3-Fix Escalation classification
|
|
182
|
+
8. MUST preserve `#region agent-debug` markers until fix is fully verified — cleanup only after tests pass
|
|
183
|
+
|
|
184
|
+
## Scope Gate
|
|
185
|
+
|
|
186
|
+
| Change Type | Action |
|
|
187
|
+
|-------------|--------|
|
|
188
|
+
| Bug fix (diagnosed cause) | Fix it |
|
|
189
|
+
| Security fix (found during fix) | Fix it + flag to sentinel |
|
|
190
|
+
| Blocking issue (can't complete fix without) | Fix it + document in report |
|
|
191
|
+
| Unrelated improvement | **STOP — create separate task** |
|
|
192
|
+
| Architectural change | **STOP — escalate to cook/plan** |
|
|
193
|
+
|
|
194
|
+
If fix requires touching >3 files not in the diagnosis → re-diagnose. You're probably fixing a symptom.
|
|
195
|
+
|
|
196
|
+
## Mesh Gates
|
|
197
|
+
|
|
198
|
+
| Gate | Requires | If Missing |
|
|
199
|
+
|------|----------|------------|
|
|
200
|
+
| Evidence Gate | Debug report OR clear error description before fixing | Run rune:debug first |
|
|
201
|
+
| Test Gate | Tests run after each fix attempt | Run tests before claiming fix works |
|
|
202
|
+
|
|
203
|
+
## Output Format
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
## Fix Report
|
|
207
|
+
- **Task**: [what was fixed/implemented]
|
|
208
|
+
- **Status**: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
|
|
209
|
+
|
|
210
|
+
### Changes
|
|
211
|
+
- `path/to/file.ts` — [description of change]
|
|
212
|
+
- `path/to/other.ts` — [description of change]
|
|
213
|
+
|
|
214
|
+
### Verification
|
|
215
|
+
- Lint: PASS | FAIL
|
|
216
|
+
- Types: PASS | FAIL
|
|
217
|
+
- Tests: PASS | FAIL ([n] passed, [m] failed)
|
|
218
|
+
|
|
219
|
+
### Concerns (if DONE_WITH_CONCERNS)
|
|
220
|
+
- [concern]: [impact assessment] — [suggested remediation]
|
|
221
|
+
|
|
222
|
+
### Context Needed (if NEEDS_CONTEXT)
|
|
223
|
+
- [what is unknown]: [why it blocks] — [two most likely answers]
|
|
224
|
+
|
|
225
|
+
### Blocker (if BLOCKED)
|
|
226
|
+
- [specific blocker]: [what was attempted]
|
|
227
|
+
|
|
228
|
+
### Notes
|
|
229
|
+
- [any caveats or follow-up needed]
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Status Protocol (Subagent Contract)
|
|
233
|
+
|
|
234
|
+
Fix returns one of four statuses to its caller (cook, debug, review, surgeon). The caller uses this to route next actions.
|
|
235
|
+
|
|
236
|
+
| Status | When | Example |
|
|
237
|
+
|--------|------|---------|
|
|
238
|
+
| `DONE` | Fix applied, tests pass, no issues | Clean bug fix, all green |
|
|
239
|
+
| `DONE_WITH_CONCERNS` | Fix works but has side effects or caveats worth noting | "Tests pass but performance regressed 15% — consider optimizing in follow-up" |
|
|
240
|
+
| `NEEDS_CONTEXT` | Cannot apply fix without clarification — ambiguous spec or missing info | "Two valid interpretations of the expected behavior — need user input" |
|
|
241
|
+
| `BLOCKED` | Hard blocker — exhausted fix attempts, broken dependency, fundamental incompatibility | "3 fix attempts failed — triggering debug escalation" |
|
|
242
|
+
|
|
243
|
+
## Returns
|
|
244
|
+
|
|
245
|
+
| Artifact | Format | Location |
|
|
246
|
+
|----------|--------|----------|
|
|
247
|
+
| Code changes | Source files | Per debug report / plan file paths |
|
|
248
|
+
| Fix Report | Markdown (inline) | Emitted to calling skill (cook, debug, review, surgeon) |
|
|
249
|
+
| Verification output | Inline (Fix Report) | Lint + types + test results |
|
|
250
|
+
|
|
251
|
+
## Sharp Edges
|
|
252
|
+
|
|
253
|
+
Known failure modes for this skill. Check these before declaring done.
|
|
254
|
+
|
|
255
|
+
| Failure Mode | Severity | Mitigation |
|
|
256
|
+
|---|---|---|
|
|
257
|
+
| Modifying test files to make tests pass | CRITICAL | HARD-GATE blocks this — fix the code, never the tests (unless test setup is provably wrong) |
|
|
258
|
+
| Applying fix without a diagnosis | HIGH | Evidence Gate: need debug report or clear error description before touching code |
|
|
259
|
+
| Exceeding 3 fix attempts without re-diagnosing | HIGH | Constraint 4: after 3 failures, call debug again — the hypothesis was wrong |
|
|
260
|
+
| Introducing unrelated refactoring while fixing | MEDIUM | YAGNI: fix only what was diagnosed — unrelated changes belong in a separate task |
|
|
261
|
+
| Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changes — run tests after each edit |
|
|
262
|
+
| 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 |
|
|
263
|
+
| Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
|
|
264
|
+
| Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve `#region agent-debug` markers until all tests pass — premature cleanup erases failure history |
|
|
265
|
+
| 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 |
|
|
266
|
+
|
|
267
|
+
## Done When
|
|
268
|
+
|
|
269
|
+
- Root cause identified (debug report or clear error received)
|
|
270
|
+
- Minimal changes applied targeting only the diagnosed problem
|
|
271
|
+
- Tests pass for the fixed functionality (actual output shown)
|
|
272
|
+
- Lint and type check pass
|
|
273
|
+
- hallucination-guard verified any new imports
|
|
274
|
+
- Fix Report emitted with 4-state status, changed files, and verification results
|
|
275
|
+
- If `DONE_WITH_CONCERNS`: concerns listed with impact + remediation
|
|
276
|
+
- If `NEEDS_CONTEXT`: specific questions stated with two likely answers
|
|
277
|
+
- If `BLOCKED`: blocker + all attempted approaches documented
|
|
278
|
+
|
|
279
|
+
## Cost Profile
|
|
280
|
+
|
|
281
|
+
~2000-5000 tokens input, ~1000-3000 tokens output. Sonnet for code writing quality. Most active skill during implementation.
|
|
282
|
+
|
|
283
|
+
**Scope guardrail**: Do not refactor unrelated code or create new features beyond the diagnosed fix target unless explicitly delegated by the parent agent.
|