From rune
Applies code changes, implements features from plans, fixes bugs from debug or review findings, and verifies with tests. Core development action hub.
npx claudepluginhub rune-kit/rune --plugin @rune/analyticsThis skill uses the workspace's default tool permissions.
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.
Fixes bugs via root cause diagnosis with debugger/gap-analyzer, requirements.md generation, /execute delegation, 3-retry circuit breaker, and QA.
Orchestrates bug-fixing workflow: clarify symptoms, reproduce with failing tests, diagnose root cause, implement targeted fixes, verify, review, and document. Use for thorough bug investigations.
Automates bug fixes and small code changes autonomously from invocation to merged PR. No questions gate, spec generation, or planning—for quick, well-defined updates in 1-3 files.
Share bugs, ideas, or general feedback.
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.
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. If unsure whether the test is wrong or the implementation is wrong → call `rune:debug` to investigate.cook Phase 4 IMPLEMENT — write code to pass testsdebug when root cause found and fix is readyreview when bugs found during review/rune fix <issue> — manual fix applicationdebug (L2): when root cause unclear before fixing — need diagnosis firsttest (L2): verify fix with tests after applying changesreview (L2): self-review for complex or risky fixesverification (L3): validate fix doesn't break existing functionalitydocs-seeker (L3): check correct API usage before applying changeshallucination-guard (L3): verify imports after code changesscout (L2): find related code before applying changesneural-memory (L3): after fix verified — capture fix pattern (cause → solution)adversary (L2): on agent.stuck after 2+ failed attempts — oracle-mode dispatches stateless second-model pass to break confirmation-bias loopcook (L1): Phase 4 IMPLEMENT — apply code changesdebug (L2): root cause found, ready to apply fixreview (L2): bug found during review, needs fixingsurgeon (L2): apply refactoring changesreview-intake (L2): apply fixes identified during structured review intakegraft (L2): apply integration fixes for grafted codescaffold (L1): apply fixes during project scaffoldingfix ↔ debug — bidirectional: debug diagnoses → fix applies, fix can't determine cause → debug investigatesfix → test — after applying fix, run tests to verifyfix ← review — review finds bug → fix applies correctionfix → review — complex fix requests self-reviewRead and fully understand the fix request before touching any file.
rune:debug before proceedingBefore locating code, classify the incoming error/task into a recovery category to determine the right fix strategy. This prevents wasting effort on the wrong approach.
| Error Type | Recovery Action | Strategy |
|---|---|---|
INPUT_REQUIRED — missing user input, ambiguous spec | PROMPT_USER | Return NEEDS_CONTEXT with specific questions. Do NOT guess. |
INPUT_INVALID — wrong format, type mismatch, encoding | AUTO_FIX | Fix at validation layer. Add schema validation (Zod/Pydantic) if missing. |
TIMEOUT — operation exceeded time limit | RETRY with adjustment | Increase timeout, add retry with exponential backoff, or chunk the operation. |
POLICY_BLOCKED — security gate, lint rule, contract violation | ABORT | Do NOT work around the policy. Report to caller with the specific rule that blocked. |
PERMISSION_DENIED — auth failure, file access, API scope | PROMPT_USER | Cannot fix permissions programmatically. Report exact permission needed. |
DEPENDENCY_ERROR — missing package, version conflict, broken dep | AUTO_FIX | Install missing dep, resolve version conflict, or suggest alternative package. |
LOGIC_ERROR — wrong output, incorrect calculation, bad algorithm | INVESTIGATE | Do NOT auto-fix. Call rune:debug — logic errors need root cause analysis. |
ENVIRONMENT_ERROR — wrong Node/Python version, missing system dep | PROMPT_USER | Report exact version/tool needed. Agent cannot change system environment. |
Decision flow:
Why: Without a recovery matrix, fix attempts the same strategy (read → change → test) for every error type. A POLICY_BLOCKED error doesn't need code reading — it needs the policy reported. An INPUT_REQUIRED error doesn't need debugging — it needs a question asked. Matching strategy to error type eliminates wasted cycles.
Find the exact files and lines to change.
rune:scout to locate the relevant files, functions, and surrounding codeRead to examine the specific file:line identified in the debug report or planGlob to find related files: types, tests, config that may also need updatingApply the minimal set of changes needed.
Edit for targeted modifications to existing filesWrite only when creating a genuinely new file is requiredany in TypeScript; never use bare except: in PythonConfirm the change works and nothing is broken.
Bash to run the relevant tests: the specific failing test first, then the full suiterune:debug (max 3 debug loops before escalating)BashBashWhen 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.
Compute every 3 fix attempts (or when called 5+ times in a single cook session):
| Signal | Score Adjustment |
|---|---|
| A fix was reverted (any test that passed now fails) | +15% |
| Fix touched >3 files (blast radius expanding) | +5% per extra file beyond 3 |
| 15+ fixes already applied in this session | +1% per fix beyond 15 |
| All remaining issues are LOW severity | +10% |
| Fix touched files outside the original diagnosis scope | +20% |
| Consecutive fixes without running tests between them | +10% |
Thresholds:
agent.stuck signal. scout zoom-out mode (structural pivot) and adversary oracle-mode (semantic pivot via stateless second-model dispatch) both listen and fire in parallel. If oracle.response arrives with confidence=high, apply its recommended edit (still routes through normal validation gates).Reset conditions: WTF-likelihood resets to 0% when:
After the fix works, make the bug structurally impossible — not just "fixed this time."
Single validation at one point can be bypassed by different code paths, refactoring, or mocks. Add validation at EVERY layer data passes through:
| Layer | Purpose | Example |
|---|---|---|
| Entry Point | Reject invalid input at API boundary | Validate params not empty/exists/correct type |
| Business Logic | Ensure data makes sense for this operation | Check preconditions specific to this function |
| Environment Guard | Prevent dangerous ops in specific contexts | In tests: refuse writes outside tmpdir |
| Debug Instrumentation | Capture context for forensics if bug recurs | Log stack trace + key values before risky ops |
Apply this when: the bug was caused by invalid data flowing through multiple layers. Skip for trivial one-liner fixes.
If rune:debug left #region agent-debug markers in the code:
#region agent-debug markersWhy: 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.
Verify correctness of the changes just made.
rune:hallucination-guard to verify all imports introduced or modified are real and correctly namedrune:docs-seeker if any external API, library method, or SDK call was added or changedrune:review for a full quality checkCall neural-memory (Capture Mode) to save the fix pattern: what broke, why, and how it was fixed. Priority 7 for recurring bugs.
Produce a structured summary of all changes made.
#region agent-debug markers until fix is fully verified — cleanup only after tests pass| Change Type | Action |
|---|---|
| Bug fix (diagnosed cause) | Fix it |
| Security fix (found during fix) | Fix it + flag to sentinel |
| Blocking issue (can't complete fix without) | Fix it + document in report |
| Unrelated improvement | STOP — create separate task |
| Architectural change | STOP — escalate to cook/plan |
If fix requires touching >3 files not in the diagnosis → re-diagnose. You're probably fixing a symptom.
| Gate | Requires | If Missing |
|---|---|---|
| Evidence Gate | Debug report OR clear error description before fixing | Run rune:debug first |
| Test Gate | Tests run after each fix attempt | Run tests before claiming fix works |
## Fix Report
- **Task**: [what was fixed/implemented]
- **Status**: DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED
### Changes
- `path/to/file.ts` — [description of change]
- `path/to/other.ts` — [description of change]
### Verification
- Lint: PASS | FAIL
- Types: PASS | FAIL
- Tests: PASS | FAIL ([n] passed, [m] failed)
### Concerns (if DONE_WITH_CONCERNS)
- [concern]: [impact assessment] — [suggested remediation]
### Context Needed (if NEEDS_CONTEXT)
- [what is unknown]: [why it blocks] — [two most likely answers]
### Blocker (if BLOCKED)
- [specific blocker]: [what was attempted]
### Notes
- [any caveats or follow-up needed]
Fix returns one of four statuses to its caller (cook, debug, review, surgeon). The caller uses this to route next actions.
| Status | When | Example |
|---|---|---|
DONE | Fix applied, tests pass, no issues | Clean bug fix, all green |
DONE_WITH_CONCERNS | Fix works but has side effects or caveats worth noting | "Tests pass but performance regressed 15% — consider optimizing in follow-up" |
NEEDS_CONTEXT | Cannot apply fix without clarification — ambiguous spec or missing info | "Two valid interpretations of the expected behavior — need user input" |
BLOCKED | Hard blocker — exhausted fix attempts, broken dependency, fundamental incompatibility | "3 fix attempts failed — triggering debug escalation" |
| Artifact | Format | Location |
|---|---|---|
| Code changes | Source files | Per debug report / plan file paths |
| Fix Report | Markdown (inline) | Emitted to calling skill (cook, debug, review, surgeon) |
| Verification output | Inline (Fix Report) | Lint + types + test results |
Append to Fix Report when invoked standalone. Suppress when called as sub-skill inside an L1 orchestrator (cook, team, etc.) — the orchestrator emits a consolidated block. See docs/references/chain-metadata.md.
chain_metadata:
skill: "rune:fix"
version: "1.0.0"
status: "[DONE | DONE_WITH_CONCERNS | NEEDS_CONTEXT | BLOCKED]"
domain: "[area fixed]"
files_changed:
- "[list of modified files]"
exports:
fix_applied: { files: ["[paths]"], description: "[what was fixed]" }
verification: { lint: "[PASS/FAIL]", types: "[PASS/FAIL]", tests: "[PASS/FAIL]" }
commit_hash: "[hash if committed]"
suggested_next:
- skill: "rune:test"
reason: "[grounded in changes — e.g., 'Modified 3 files in auth module, edge cases need coverage']"
consumes: ["fix_applied", "verification"]
Known failure modes for this skill. Check these before declaring done.
| Failure Mode | Severity | Mitigation |
|---|---|---|
| Modifying test files to make tests pass | CRITICAL | HARD-GATE blocks this — fix the code, never the tests (unless test setup is provably wrong) |
| Applying fix without a diagnosis | HIGH | Evidence Gate: need debug report or clear error description before touching code |
| Exceeding 3 fix attempts without re-diagnosing | HIGH | Constraint 4: after 3 failures, call debug again — the hypothesis was wrong |
| Introducing unrelated refactoring while fixing | MEDIUM | YAGNI: fix only what was diagnosed — unrelated changes belong in a separate task |
| Not running tests after each individual change | MEDIUM | Constraint 3: never batch untested changes — run tests after each edit |
| 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 |
| Single-point validation (fix one spot, hope it holds) | MEDIUM | Step 5: add entry + business logic + environment + debug layers for data-flow bugs |
| Removing debug instrumentation before fix is verified | MEDIUM | Step 5b: preserve #region agent-debug markers until all tests pass — premature cleanup erases failure history |
| 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 |
| Each fix creates a new bug elsewhere — whack-a-mole | CRITICAL | Tight coupling signal. STOP fixing → escalate to debug with note "each fix creates new failure — suspect structural issue". Debug will route to plan for redesign |
| Applying same fix strategy to every error type | MEDIUM | Step 1b Recovery Policy Matrix: classify error type FIRST — POLICY_BLOCKED needs reporting not fixing, INPUT_REQUIRED needs questions not code |
DONE_WITH_CONCERNS: concerns listed with impact + remediationNEEDS_CONTEXT: specific questions stated with two likely answersBLOCKED: blocker + all attempted approaches documented~2000-5000 tokens input, ~1000-3000 tokens output. Sonnet for code writing quality. Most active skill during implementation.
Scope guardrail: Do not refactor unrelated code or create new features beyond the diagnosed fix target unless explicitly delegated by the parent agent.