agentleFS
vivary-devvivary-dev/vivary-cli/.agents/skills/loops/SKILL.md

loops

Skill4 starsChanged 4 months agoMITView on GitHub

How to recognize when an agent loop fits, when it doesn't, and how to set one up safely. Use when the user asks "should I loop this", "set up a loop", "automate / run this repeatedly", "babysit my PRs", "run it on a schedule / unattended", mentions /loop, /goal, ralph, or a long-running batch over many items — or when you're about to do the same kind of task many times by hand and a loop might be better. Recommend loops; do not reach for one by default.

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use code-review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No trustworthy self-verification — an open loop with no feedback is a machine for confident mistakes.

    line 40

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Loops

A loop is cron plus a decision-maker in the body: a small program that prompts the agent, reads what it produced, decides whether it's done, and if not prompts it again. You author the loop and its stopping behavior; the model becomes a subroutine. The work moves up an altitude — from doing the task to writing the thing that does the task.

This skill is for deciding whether to recommend a loop and how to set one up safely. Default behavior is a single focused pass — loops are a recommendation, not a reflex.

When to recommend a loop

Recommend one only when all three hold:

  1. Repeatable, long-running, or unattended — babysitting PRs, polling a queue, a batch over many items, an overnight run.
  2. A reliable self-check exists — the loop can verify its own work each tick (tests pass, build green, sources found, a validator confirms done). No feedback signal → no loop.
  3. State is durable — the work can survive a restart (git-backed), so the loop doesn't assume the terminal stays open.

When NOT to loop

  • One-off or exploratory work, or anything ambiguous enough that the next step is a judgment call you'd want to make yourself.
  • No trustworthy self-verification — an open loop with no feedback is a machine for confident mistakes.
  • High blast-radius autonomous actions (anything near the hard gates).

The spectrum (pick the right kind)

ReAct (reason→act→observe while-loop, human watching) → AutoGPT (self-prompting toward a goal; famously ran forever) → ralph (pipe one fixed prompt repeatedly, resetting context to anchor files each time) → /goal (ralph gated by a validator that confirms done) → orchestration (loops supervising other loops, scheduled, durable). Single-agent ralph is simple and cheap; multi-agent supervision is the heavy end — only go there when the task genuinely needs it.

Guardrails (mandatory if you set one up)

The interesting engineering is everything that keeps the loop from running off a cliff. Every serious loop has:

  • Self-verification each tick — write → run → read result → correct.
  • Hard stops — a max iteration count, no-progress detection, and a token/$ budget ceiling. Most of the job is making the loop halt. (Real teams have burned annual AI budgets in months to runaway loops.)
  • Skills, not re-derived prompts — a loop that calls sharp, named skills compounds; one that re-derives everything just burns money. If a sub-task recurs, extract a skill and have the loop call it.
  • Durable state — git-backed, crash-recoverable.

The hard line: loops stop at the gates

A loop runs autonomously inside the work but must stop for human approval at the hard gates (merge, publish, destructive ops, the read-only source repos — see AGENTS.md). Autonomy in the body; alignment at the edges. A loop never merges or publishes on its own.

How to set one up

Any runtime: state the intent and the stopping behavior (not the steps); define the per-tick self-check; set an iteration cap and a budget ceiling; point it at a fixed set of anchor files; make state durable.

Claude Code mechanisms:

  • /loop — run a prompt or skill on an interval or self-paced (e.g. "babysit my PRs, auto-fix build issues, address review comments in a worktree").
  • /goal — keep going until a validator confirms done.
  • dynamic workflows — orchestrate many agents for one task.
  • cloud + auto-mode permissions — unattended runs with the laptop closed.

Codex mechanisms: Codex has no built-in loop command. Drive iterations from outside: re-invoke codex exec from a shell loop, cron / Task Scheduler, or CI with an explicit iteration cap, and keep loop state in a file each run reads and updates. Cloud tasks can be re-run for unattended iterations.

Always (any runtime): a way to self-verify end to end, plus the caps above.

Recommend, then confirm

Loops are a recommendation. Propose the loop — what it does, its stopping behavior, its budget — and get the human's go-ahead before kicking off an autonomous or scheduled run. Starting one is a durable/outward action: it gets a gate like any other.


Concept from the 2026 Steinberger/Cherny "what is a loop" discourse: the loop, not the model, is now the expensive part — so the discipline is feedback and halting.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.