Let Claude Code pick the right loop.
Hook up one MCP server and Claude Code can browse the library and choose the right loop for the job.
# 30-second install: one file, stdlib only, read-only
$ curl -fsSL ailooplibrary.com/mcp/server.py -o ~/.ai-loop-library/server.py
$ claude mcp add ai-loop-library -- python3 ~/.ai-loop-library/server.py
$ claude
> pick a loop to speed up our CI, then run it
⏺ pick_loop_for_goal("speed up CI") → CI Optimization
⏺ render_run_protocol("ci-optimization") → 8 rounds max, verify every round▊
Value prop
Why this is an MCP server and not a docs search
Retrieval is not the hard part of agent loops; packaging and judgment are. The server does the packaging; judgment stays with the calling agent, which knows the operator's repo, data, and constraints:
| Step | Tool | What you get |
|---|---|---|
| 1. Browse | browse_catalog() | The whole library as a ~2k-token digest: id, one-line use_when, verifier strength. |
| 2. Pick | pick_loop_for_goal(goal) | Lexically ranked shortlist with an honest confidence signal, never a single blind verdict. |
| 3. Run | render_run_protocol(id, goal) | Executable markdown: done contract, one change per round, the same verification every round, state-file skeleton, stop conditions, budget, approval boundary, paste-ready prompt. |
| 4. Lint / design | critique_loop, design_loop | Lint a loop design against the anti-pattern rubric, or scaffold a new spec when nothing fits. |
Every loop has a stop condition and a budget. If your task has no verifiable end state, the library says so instead of pretending.
30 seconds
Install for Claude Code
One Python file, standard library only, Python 3.9+. Read-only: no write tools, no auth, no shell execution.
mkdir -p ~/.ai-loop-library
curl -fsSL https://ailooplibrary.com/mcp/server.py -o ~/.ai-loop-library/server.py
claude mcp add ai-loop-library -- python3 ~/.ai-loop-library/server.pyVerify before trusting it: run the offline self-test.
python3 ~/.ai-loop-library/server.py --self-test # 43 checks, no networkThird-party checks: listed in awesome-mcp-servers under Knowledge & Memory, and graded on Glama for tool definition quality and server coherence.
Install for Cursor and other MCP clients
Add to ~/.cursor/mcp.json (or your client's MCP config). Point AI_LOOP_LIBRARY_CATALOG_PATH at a downloaded catalog.json to run fully offline.
{
"mcpServers": {
"ai-loop-library": {
"command": "python3",
"args": ["/Users/you/.ai-loop-library/server.py"],
"env": {
"AI_LOOP_LIBRARY_CATALOG_URL": "https://ailooplibrary.com/catalog.json"
}
}
}
}Use it without MCP
Option one: the Claude Code skill, which prefers MCP tools when connected and falls back to fetching the catalog over HTTPS.
mkdir -p .claude/skills/ai-loop-library
curl -fsSL https://ailooplibrary.com/agent-pack/claude-code/SKILL.md \
-o .claude/skills/ai-loop-library/SKILL.mdOption two: zero install. The catalog is public JSON; paste this into any tool-using agent.
Fetch https://ailooplibrary.com/catalog.json, pick the loop that fits this goal, and run it
bounded: one change per round, the same verification every round, state in
docs/loops/<id>/, stop on verifier pass / budget / blocker / approval boundary.Tool reference
| Tool | Arguments | Returns |
|---|---|---|
browse_catalog | category? | ~2k-token digest of every loop; the agent judges it directly |
search_loops | query, category?, limit?=8 | Ranked loops with id, title, category, url, one-line why-matched |
get_loop | id_or_slug | Full loop spec + canonical URL, verifier strength, loop kind |
pick_loop_for_goal | goal, constraints?, limit?=5 | Ranked shortlist + confidence signal; the calling agent makes the final call |
render_run_protocol | id_or_slug, goal?, risk_posture?, kind?=auto|session|scheduled-tick, max_rounds?, max_minutes? | Executable protocol + state-file skeleton + paste-ready prompt |
critique_loop | loop_description | 0–10 lint against the anti-pattern rubric, with per-check fixes |
design_loop | goal, constraints?, cadence?, context? | Draft loop spec: verifier suggestion, MVL check, nearest catalog loops |
list_categories | — | Category counts with library filter URLs |
catalog_stats | — | Loop count, featured loops, last_updated, catalog source |
Resources: ailooplibrary://catalog and ailooplibrary://loop/{id}. Full server docs at /mcp/README.md.
Demo
What picking looks like
Ask for an outcome, get a loop with reasons, then render it and go.
> pick_loop_for_goal("speed up CI")
{
"goal": "speed up CI",
"confidence": "high",
"confidence_note": "top match covers most goal terms and leads clearly",
"shortlist": [
{
"id": "ci-optimization",
"title": "CI Optimization",
"category": "Engineering",
"url": "https://ailooplibrary.com/loops/ci-optimization/",
"verifier_type": "deterministic-leaning",
"why_matched": "title matches ci; tags matches ci; use when matches ci"
},
{
"id": "test-flake-stabilizer",
"title": "Test Flake Stabilizer",
"verifier_type": "deterministic-leaning",
"why_matched": "tags matches ci; goal terms (ci, speed) map to the Engineering category"
}
],
"your_call": "A ranked shortlist, not a verdict. You have operator context this server lacks; pick accordingly, or pick none."
}The heuristic is documented in the server source and labels itself in every response; a 20-query golden eval holds it to a ≥85% top-3 hit rate. The calling agent always makes the final call.
What's in the library
Every loop ships with a trigger, objective, allowed actions, verification, stop condition, budget, and approval boundary: the seven parts that keep an agent from spending your tokens looking busy.
Browse the library Loop linter Loop template Loop engineering