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.

browsepickrunstop with evidence

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:

StepToolWhat you get
1. Browsebrowse_catalog()The whole library as a ~2k-token digest: id, one-line use_when, verifier strength.
2. Pickpick_loop_for_goal(goal)Lexically ranked shortlist with an honest confidence signal, never a single blind verdict.
3. Runrender_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 / designcritique_loop, design_loopLint 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.py

Verify before trusting it: run the offline self-test.

python3 ~/.ai-loop-library/server.py --self-test   # 43 checks, no network

Third-party checks: listed in awesome-mcp-servers under Knowledge & Memory, and graded on Glama for tool definition quality and server coherence. Live Glama quality score for the AI Loop Library MCP server

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.md

Option 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.

Full install guide CLAUDE.md drop-in MCP server on GitHub

Tool reference

ToolArgumentsReturns
browse_catalogcategory?~2k-token digest of every loop; the agent judges it directly
search_loopsquery, category?, limit?=8Ranked loops with id, title, category, url, one-line why-matched
get_loopid_or_slugFull loop spec + canonical URL, verifier strength, loop kind
pick_loop_for_goalgoal, constraints?, limit?=5Ranked shortlist + confidence signal; the calling agent makes the final call
render_run_protocolid_or_slug, goal?, risk_posture?, kind?=auto|session|scheduled-tick, max_rounds?, max_minutes?Executable protocol + state-file skeleton + paste-ready prompt
critique_looploop_description0–10 lint against the anti-pattern rubric, with per-check fixes
design_loopgoal, constraints?, cadence?, context?Draft loop spec: verifier suggestion, MVL check, nearest catalog loops
list_categoriesCategory counts with library filter URLs
catalog_statsLoop 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

68bounded loop patterns
10categories
21engineering loops
7Paul originals

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