Cookbook
Runnable, copy-pasteable loop templates that show what LoopKing is good for
beyond "fix this code." Each entry lives in
cookbook/ as a
self-contained directory: a .loop.md you can launch and a README.md that
explains the idea, the flow, and the knobs to turn.
The format in 30 seconds
# Title
goal: One sentence describing the outcome.
max_iterations: 5
## Flow
- build: command `make build` -> pass: test, fail: failed
- test: command `pytest -q` -> pass: success, fail: fix
- fix: prompt `prompts/fix.md` -> pass: build, fail: failed
commandsteps route by process exit code (0= pass).promptsteps hand a prompt file to your coding agent; the outcome routes the same way. Prompt paths resolve relative to the.loop.mdand cannot escape its directory.- Routes point at another step, or the stop tokens
success/failed. - Every back-edge counts as one iteration against
max_iterations. - Don't want to wire a graph by hand? Set
mode: loose | in-depth | deterministicplus acheck:command and LoopKing generates the planner/coder/reviewer/verifier steps for you.
Run any entry
uv run loop launch cookbook/<entry>/<entry>.loop.md # dry-run, runs nothing
uv run loop launch cookbook/<entry>/<entry>.loop.md --execute # real execution
uv run loop compile cookbook/<entry>/<entry>.loop.md # emit a committable YAML spec
Entries
dependency-upgrade
Upgrade one dependency and prove build + types + tests + audit still pass, or fail so the bump can be reverted. A pure deterministic command pipeline — no agent — and the clearest demonstration that a loop is just auditable, exit-code-routed commands.
flaky-test-hunter
Find and fix the test that fails intermittently, then prove stability by running
the suite 25× with randomized ordering. Uses the in-depth preset so the agent
fixes and a repeat-run verifier gates — because "passed once" is not "not flaky".
data-contract
Keep an ETL output faithful to its schema contract; when it drifts, the agent repairs the transform (never the contract) and the loop re-validates. A hybrid of deterministic command gates and an agent repair step with result-based routing.
prompt-eval-optimizer
Raise an LLM prompt's offline eval score above a release gate without overfitting. The agent edits the prompt, a deterministic eval harness scores it against a held-out suite, and the loop stops only when the number clears threshold.
Why loops (and not a one-shot prompt)
Every entry shares one shape: act → verify with a real command → route on the
result → stop only when the gate passes or the budget runs out. That makes the
work auditable (each iteration writes a report), reproducible (the verifier is a
deterministic command, not a vibe), and safe to run unattended (dry-run by
default, hard max_iterations ceiling).