The directory of reusable agent loops

Curated, runnable agent loops and agentic harnesses for Claude Code, Codex, Cowork, Cursor, and more. Agentic loop patterns you can copy and run.

~/ try your first loop
# the official Ralph plugin by Anthropic. paste inside Claude Code:
> /plugin install ralph-loop@claude-plugins-official
1. pick a loop in the directory 2. copy its command 3. run it where the label says
What is a loop?

Directory

Sort:
engineering

The flaky-test hunt loop

ACTION

Run [test suite] N times and collect every test whose result changes between runs. Fix the most frequent flake at its root cause (shared state, timing, ordering, or an external dependency), never with a blind sleep or retry.

CHECK

Re-run the fixed test N times, then the whole suite once, and confirm the flake is gone and nothing else regressed.

STOP

Stop when N consecutive full-suite runs pass clean, or progress stalls for two rounds.

by Loops.fyi
engineering

The dependency upgrade loop

ACTION

Upgrade [dependency] to [target version]. Read the changelog and migration guide first, then make the smallest set of changes needed, one package at a time.

CHECK

After each change run the full build, type-check, and tests, and confirm no new failures versus the baseline you recorded first.

STOP

Stop at a green build on the target version, or when a breaking change needs a product decision.

by Loops.fyi
Superpowers
Brainstorming, TDD, and subagent-driven development loops.
Plugin
Ralph Loop
Official plugin; a stop-hook re-feeds your prompt until the task is done.
Plugin
Ralph Wiggum Loop
Canonical autonomous loop; fresh context each iteration to avoid context rot.
Harness
Codex Goal Mode
OpenAI's built-in autonomous loop — /goal runs until the objective is met.
Built-in
autoresearch
Karpathy's autonomous research loop, released March 2026: give an agent one editable file, a frozen evaluator, and a scalar metric, and it runs a keep-or-revert experiment loop overnight, keeping only changes that beat the best result. The pattern has spread to prompt optimization, kernel tuning, and build-time reduction.
Harness
Claude Code /loop
Claude Code's native scheduler loop (March 2026): describe a task and cadence in plain English and Claude runs it on repeat from your terminal — deploy checks, PR review, continuous tests.
Built-in
Cowork Scheduled Tasks
Cowork's recurring-task engine is the GTM /loop: describe a workflow in plain English and it runs on a daily, weekly, or custom schedule, with file access plus CRM, email, and calendar connectors.
Built-in
Claude Code /goal
Claude Code's built-in goal loop: unlike /loop (a scheduler), /goal keeps the agent iterating until a verifiable condition holds — the native Ralph pattern with no bash required.
Built-in
evaluation

The two-model review loop

ACTION

Review [change] against [quality bar]. Have a model from one provider review it, verify and apply only necessary fixes, then hand the revised version to a model from a different provider.

CHECK

A round only counts when the findings from each reviewer are independently verified against the actual code or spec, not taken on faith.

STOP

Stop when both models approve the same unchanged version, the round limit is hit, or they oscillate on the same disagreement.

by Loops.fyi
evaluation

The claim-to-evidence loop

ACTION

List every factual claim [artifact] makes. For each, find primary-source evidence and label it proven, weak, or unsupported.

CHECK

Re-verify each weak or unsupported claim against a second independent source before changing anything.

STOP

Stop when no unsupported high-risk claim remains, or return the rest as needing a human decision.

by Loops.fyi
operations

The queue triage loop

ACTION

For [inbox or queue], process one item at a time: classify it, take the single highest-value action allowed within your permissions, and log a one-line note.

CHECK

Before closing an item confirm the action actually completed (reply sent, ticket moved, task created), not just attempted.

STOP

Stop when every item is actioned, deferred with a reason, or blocked needing the user. Ask before anything irreversible.

by Loops.fyi
operations

The weekly status loop

ACTION

On each [window], read the configured sources, update the project files, and write STATUS.md with focus, deadlines, open threads, and evidence-backed wins.

CHECK

Carry every prior thread forward: prove it finished or mark it stale, never silently drop one.

STOP

Stop when the snapshot verifies. If evidence or access is missing, return a thinner snapshot and flag what is blocked.

by Loops.fyi
content

The doc-drift loop

ACTION

Compare [documentation] against the current behavior of [project]. Find the largest place the docs and the code disagree and fix the docs to match reality.

CHECK

Verify each fix against the actual code path or a runnable example, not against older docs.

STOP

Stop when no high-impact mismatch remains, or a fix needs a product decision.

by Loops.fyi
design

The accessibility blocker loop

ACTION

Check [scope] against WCAG 2.2 AA with automated scans plus keyboard and screen-reader passes, then fix the single highest-harm blocker.

CHECK

Re-run the same checks and the affected flow, and keep the fix only if the blocker is gone and nothing regressed.

STOP

Stop when no blocker remains, progress stalls, or verification is unavailable; never silence a check to pass.

by Loops.fyi
design

The first-run UX loop

ACTION

Act as a brand-new user of [product] from a clean session with no saved login or data, complete onboarding using only visible guidance, and fix the worst obstacle with the smallest safe change.

CHECK

Discard the session and retry the whole flow from scratch to confirm the fix actually helped.

STOP

Stop after one uninterrupted success, no safe fix remains, or access is blocked.

by Loops.fyi
TDD Loop
Red-green-refactor loop the agent runs until tests pass.
Plugin
Hermes Agent
Self-improving CLI agent with memory and automated skill creation.
Harness
learn-claude-code
A ~30-line nano agent harness; bash is all you need.
Harness
cwc-long-running-agents
Primitives for long-running agents: hooks and a subagent.
Harness
ralph-claude-code
Ralph loop with intelligent exit detection.
Harness
Ralph (PRD loop)
Drives Amp or Claude Code through a PRD task list; learnings persist in AGENTS.md.
Harness
ralph-loop-agent
Continuous autonomy for the Vercel AI SDK, in TypeScript.
Harness
ralph (minimal)
Minimal file-based loop: fresh context, one story per iteration.
Harness
ralph-loop (sandboxed)
Long-running loops in parallel Docker sandboxes.
Harness
The Ralph Playbook
The principles behind Ralph: context, backpressure, oversight.
Config
Awesome Ralph
Curated index of Ralph implementations and writing.
Config
claude-review-loop
Cross-agent review loop: Claude Code writes, Codex reviews, hooks manage the lifecycle until the review passes.
Plugin
Autoloop
GitHub Next's metric-driven loop: pick a program, propose a change, evaluate, keep only if the metric improves — all state in human-readable markdown on a memory branch.
Harness
OpenHarness
Open agent harness from HKUDS with a built-in personal agent (Ohmo) — a research-grade foundation for building your own loops.
Harness
autoresearch-skill
Karpathy's autoresearch pattern packaged as an installable skill: define a goal and evaluator and let any LLM agent iterate.
Plugin
Ralph for Gemini CLI
Official Gemini CLI extension for Ralph loops: the agent iterates on a task, self-correcting over multiple turns without manual intervention.
Plugin
Cowork Sales plugin
Anthropic's official sales plugin for Cowork: /call-prep, /pipeline-review, and /forecast commands plus auto-triggering skills for account research, competitive intelligence, and outreach drafting, wired to CRM and Outreach connectors.
Plugin
Cowork Finance plugin
Anthropic's official finance plugin for Cowork: analyze financials, build models, and track key metrics from your files and connectors.
Plugin
Sales Skills Pack
Agent skills for sales, marketing, and GTM: CRM workflows, outbound, enrichment, note-takers, email marketing, influencer marketing, social listening, and directories.
Plugin
SuperSEO Skills
11 SEO skills: page audits, content briefs, article writing, E-E-A-T audits, semantic gap analysis, topic clusters, and link building, with an anti-AI-slop ruleset.
Plugin
GitHub Agentic Workflows
GitHub's continuous-AI loops in CI/CD: scheduled agentic workflows that triage and label issues, update docs, and write reports, defined in markdown with safe outputs.
Built-in
iteratr
A long-running agent loop manager that drives OpenCode with auto-approve permissions: the agent executes, edits, and iterates without manual confirmation, supervised across iterations.
Harness
OCLoop
Loop-driven development with OpenCode: executes tasks from PLAN.md iteratively, each iteration in a fresh isolated session — Ralph-style context hygiene for OpenCode.
Harness
Vibe-Trading
A trading-research agent loop from HKUDS: iteration budgets with a wrap-up nudge at 80 percent of budget and a forced final answer, applied to market analysis.
Harness
Cowork Self-Improving Loop
Karpathy's keep-or-revert autoresearch pattern rebuilt in Claude Cowork: a measurable goal, an iteration step, and keep-only-what-improves — no terminal, no code, about 7 minutes to set up.
Config