potion-fixer
Until now your loop could witness a broken spell but never mend it. Today it earns hands โ under the strictest oath in the campaign. A fixer golem may repair only what the sealed evidence witnessed break, with the smallest edit that mends it, and every edit is kept or reverted by a deterministic gate โ a score the golem cannot charm, a linter it cannot flatter. And when the evidence is partial? It walks away. In this realm, a golem that does nothing honestly outranks one that does something plausible.
The real-world skills: scoping autonomous write access to witnessed defects, keep/revert gating on machine-checkable signals (never the model grading its own homework), treating the clean no-op as success, and circuit breakers that hand stubborn work to humans instead of looping forever.
๐งญ Campaign note: Level
1101is Machine Learning & AI โ where prophecy is studied and, more importantly, where its error bars live. A fixer is applied prophecy; the gate is its error bar.
๐ The Legend Behind This Quest¶
The engine's first autonomous repair is a matter of public record. The walker witnessed two spells fail inside one quest โ Liquid incantations that rendered as dead text when copied. The fixer read the sealed evidence, made five small edits, and for each one ran the structural validator before and after: score held at 78.4%, style linter clean, edit kept. It also found a skipped command in the same scroll and declined to touch it โ the skip was the sandbox's limitation, not the quest's defect, and the oath forbids repairs without a witnessed failure. The same morning, two sibling fixers received evidence with one errored trial each โ and both walked away empty-handed, on purpose, leaving notes for a cleaner walk. One repair shipped; two no-ops recorded; zero plausible guesses. That ratio is the oath working.
๐ฏ Quest Objectives¶
By the end of this quest you will:
- Define "verified issue" โ the only defects your fixer may touch are witnessed, machine-recorded failures
- Summon a fixer golem โ write-scoped to content files only, forbidden from git and from the evidence
- Build the keep/revert gate โ a deterministic before/after check that decides an edit's fate in code
- Honor the honest no-op โ partial or unexecuted evidence โ abort with a reason, exit green
- Install a circuit breaker โ N fully-covered-but-still-failing rounds โ mark it
needs-humanand stop
๐บ๏ธ Quest Prerequisites¶
- ๐ Chapters IโV complete โ sealed evidence and the coverage ledger are this chapter's raw materials
- ๐ One deliberately broken potion whose fix is knowable (a typo'd command, a missing flag)
๐งโโ๏ธ Chapter 1: The Oath, Written as Steps¶
The fix lane is a second workflow (gated by its own FIX_ENABLED switch โ Chapter II taught you why). Its shape is oath-as-pipeline:
graph TD
A[Sealed evidence from the walk] --> B{Evidence complete?\nevery trial executed}
B -->|no| Z[๐
Honest no-op:\nrecord reason, exit green]
B -->|yes| C[Fixer golem: smallest edit\nto the witnessed failure ONLY]
C --> D{Deterministic gate:\nre-run checker + linter}
D -->|holds or rises| E[Keep the edit]
D -->|regresses| F[Revert the edit]
E --> G[Workflow commits to a branch\nand opens the fix PR]
F --> Z
The fixer's role file carries the oath's hard rules:
<!-- .claude/agents/potion-fixer.md -->
# potion-fixer
You repair potions. Your license is the sealed evidence โ nothing else.
## Hard rules (never break)
- Repair ONLY failures evidence.txt witnessed. A skipped or unrun spell
is not a defect; leave it and say so.
- Make the SMALLEST edit that mends the witnessed failure.
- Edit ONLY files under potions/. Never touch scripts/, workflows,
ledger.json, or evidence.txt.
- Never run git. Never grade your own work โ the gate decides.
- If the evidence is partial, truncated, or not executed: change NOTHING,
write fix-notes.md explaining why, and stop. A no-op is a valid outcome.
๐ Knowledge Check¶
- Why is "smallest edit that mends the witnessed failure" safer than "improve the potion while you're in there"? (The Sirens have a verse about this.)
- Why must the no-op path exit green?
๐งโโ๏ธ Chapter 2: The Gate That Cannot Be Charmed¶
The keep/revert decision belongs to code. The pattern: capture a deterministic before score, let the golem edit, recompute after, and let arithmetic rule:
{% raw %}
- name: Gate โ keep or revert (deterministic, never the golem's opinion)
run: |
set -euo pipefail
potion="${{ steps.pick.outputs.potion }}"
# AFTER: the witnessed failure must now passโฆ
if ! ./scripts/check.sh "$potion" >/dev/null 2>&1; then
echo "::warning::fix did not mend the witnessed failure โ reverting."
git checkout -- "$potion"
exit 0
fi
# โฆand style must not regress (any deterministic linter works):
if ! npx --yes markdownlint-cli2 "$potion" >/dev/null 2>&1; then
echo "::warning::fix mended the spell but broke the style gate โ reverting."
git checkout -- "$potion"
exit 0
fi
echo "edit KEPT: checker passes and linter is clean."
Then โ and only then โ the workflow commits the kept edit to a branch and opens a pull request (gh pr create in a step; the golem never sees these verbs). Two disciplines from the reference build worth stealing verbatim:
- Hold-or-rise, not "above the floor." The real gate compares each quest's structural score against its own pre-edit baseline: a fix that drags 95% down to 72% fails the gate even though 72% clears the absolute threshold. Repairs must not spend quality as currency.
- Separate the witness from the surgeon. The walk lane and the fix lane are different workflows with different switches. You can freeze all repairs (
FIX_ENABLED=false) while the walker keeps witnessing โ invaluable the week you're debugging the fixer.
โ๏ธ Skills You'll Forge¶
- Before/after gating with
git checkout --as the revert primitive - Composing gates: functional (checker) AND stylistic (linter), both deterministic
- Write-scope enforcement by path
๐ Knowledge Check¶
- The golem claims its edit is excellent, but the checker still fails. Who wins, and which line of the workflow enforces it?
- Why does the workflow own
git checkout --rather than asking the golem to revert itself?
๐งโโ๏ธ Chapter 3: The Circuit Breaker โ When the Loop Must Ask for Help¶
A loop that fixes, re-walks, and still fails will happily do so forever โ burning mana, flooding reviewers. The breaker counts full rounds and surrenders gracefully. In your ledger script:
# After computing coverage (Chapter V): breaker discipline.
MAX_ROUNDS = 3
fully_covered = covered == shelf
if fully_covered and not data["perfect"]:
data["fix_rounds"] = data.get("fix_rounds", 0) + 1
if data["fix_rounds"] >= MAX_ROUNDS:
data["needs_human"] = True # the loop STOPS choosing this work
elif data["perfect"]:
data["fix_rounds"] = 0 # convergence resets the breaker
data["needs_human"] = False
The subtlety that bit the real engine: a mid-sweep turn is progress, not a failed round. Only a fully covered shelf that still isn't perfect counts against the breaker โ otherwise a 26-item shelf on window 5 trips needs_human before its first sweep even finishes.
๐ Reproduce It¶
The first autonomous repair, and the oath it obeyed:
- PR #445 โ
bamr87/it-journey@08ca5d1cc(+33/โ28): two witnessed Liquid failures mended with a block-level guard, three evidence-backed recommendations applied, structural score held at 78.4% on every kept edit, one skipped command explicitly left alone โ read its PR body; it is the fixer's fragment, edit by edit, gate result by gate result - The oath at scale:
.claude/skills/quest-fix/SKILL.md(the abort-on-unverified rules) and the M1 no-regression gate inside.github/workflows/quest-fix.yml - The honest no-ops from the same morning: two sibling fix lanes in run
28791022929consumed partial evidence and recorded "clean no-op โ aborted at the honest-run gate" instead of guessing
๐ฎ Mastery Challenge¶
Objective: one kept repair, one forced revert, one honest no-op โ the fixer's full behavioral triangle.
Success Criteria:
- [ ] Kept: the fixer mends your knowable broken potion; the gate keeps it; the workflow opens a fix PR whose body lists the witnessed evidence
- [ ] Reverted: sabotage the gate (make the linter unsatisfiable for that file) and verify the edit is reverted with a warning while the run stays green
- [ ] No-op: hand the fixer truncated evidence (delete half of evidence.txt after sealing โ from a workflow step, not the golem) and verify it changes nothing and writes fix-notes.md
- [ ] Breaker: simulate three fully-covered failing rounds and confirm needs_human: true stops the fix lane from selecting that potion
๐ Rewards & Progression¶
- โ๏ธ The Honest Fixer โ earned on your first gate-kept repair or your first principled no-op; mastered when you have both
- โก Skills unlocked: keep/revert gates ยท verified-only scope ยท circuit breakers ยท no-op discipline
- ๐ +150 XP
๐บ๏ธ Quest Network¶
graph LR
Prev[โณ V ยท The Mana Ledger] --> Cur[โ๏ธ VI ยท The Fixer's Oath]
Cur --> Next[โพ๏ธ VII ยท Weaving the Whole]
click Prev "/quests/1010/ouroboros-loop-05-the-mana-ledger/"
click Next "/quests/1110/ouroboros-loop-07-weaving-the-whole/"
๐ฎ Next Adventures¶
- โพ๏ธ Chapter VII โ Weaving the Whole: the capstone โ the serpent closes its own circle with self-merging gates
- ๐ Campaign hub: Epic Quest: The Ouroboros Loop
๐ Resource Codex¶
- markdownlint-cli2 โ a ready-made deterministic style gate
gh pr createโ the workflow's verb, never the golem's- Martin Fowler: CircuitBreaker โ the pattern's family history
๐ธ๏ธ Knowledge Graph¶
Structured wiki-links connect this quest to the IT-Journey knowledge graph.
Campaign hub: [[Epic Quest: The Ouroboros Loop]] Previous: [[The Mana Ledger]] ยท Next: [[Weaving the Whole]] Level home: [[Level 1101 - Machine Learning & AI]]