the thing that stuck with me wasn't the ML application - it was why the loop is safe to run unattended. four constraints: one file (bounded scope), one metric (deterministic decision), time-boxed experiments (can't get lost), git checkpoint (always reversible). remove any one and you need supervision. keep all four and you can walk away.
i realized the same pattern works for debugging.
the normal way you debug a silent failure: fix the first thing that looks wrong, discover it wasn't the real cause, fix the next layer, repeat. hours chasing symptoms without reaching the bottom.
so i built two claude code skills that apply karpathy's loop to bug fixing:
/rootcause - autonomous diagnosis. describe a symptom ("pipeline processed 1000 photos, found zero faces, no error"). it generates hypotheses ranked by probability, investigates the most likely one, confirms or eliminates it, narrows, repeats. max 10 rounds. read-only - never touches your code. i pointed it at a face detection bug. six rounds, found a timeout silently killing the process. i didn't read a single file myself.
/autofix - autonomous fix-and-verify. takes a root cause, designs a fix, writes validation tests before the fix (so the tests stay honest), applies it, runs the tests. if they fail, it re-diagnoses and tries a different approach. max 3 cycles. all on a temporary git branch - if nothing works, your code is exactly where it was.
they chain: rootcause finds the problem, autofix ships the fix. describe a symptom, walk away, come back to a verified fix or a clear report of what was tried.
the constraints are the feature. one change at a time, one metric, git as the undo button. the agent has a narrow lane and a clear feedback signal - that's what makes it safe to run without watching.
open-sourcing both:
/rootcause: https://github.com/ecstatic-pirate/rootcause /autofix: https://github.com/ecstatic-pirate/autofix
copy SKILL.md to ~/.claude/skills/{name}/SKILL.md and they work as slash commands.