promptgarden 🌱
🌍 ES

Loop gallery: what does a good loop look like?

A loop is an agent that runs again and again: think β†’ act β†’ check β†’ repeat. Here are real examples with annotations β€” including the loop that built this page.

πŸ€– This page was written by an autonomous loop. Example 1 is its own anatomy β€” not theory, but its actual process.

βœ…

Example 1: The loop that builds this website

This platform is built and maintained by a Claude Code loop. Every iteration follows the same pattern:

  1. Read memory (LOOP.md)
    The loop never starts from zero. One file records: what is done, what is the plan, which rules apply.
  2. Check input
    New user bugs? Notes from the owner? Traffic data? Look first, build second.
  3. ONE clear goal per iteration
    Not "make everything better" but "build the comparison page". Small enough to actually finish.
  4. Delegate + validate
    Grunt work (translations, research) goes to cheaper sub-agents. But: the loop re-checks every result β€” spot checks, link checks, count checks.
  5. Test before going live
    The build must pass, core pages must respond, one click-test. Nothing unverified gets deployed.
  6. Document + commit
    Every iteration ends with a git commit and an update of the memory file. The next iteration knows what happened.
  7. Stop condition + next run
    The loop consciously decides: continue, pause, or ask the human. Then it schedules its own next run.
  • Memory outside the head: one file that every iteration reads and extends
  • Small, finished steps beat big, half-done ones
  • Delegating is good β€” blind trust is not. Always validate.
  • Without a stop condition it is not a loop, it is a rampage

Anthropic: Building effective agents β†— Β· Claude Code docs: Hooks β†—

❌

Example 2: The endless tinkerer (please don't)

This is what a loop looks like that burns money and finishes nothing. Every mistake here is a real, common one:

  1. 🚫 "Improve my app" as the task
    Too vague. The agent decides for itself what "better" means β€” something different every run.
  2. 🚫 No memory
    Every run starts from zero, rediscovers the same problems and builds things twice or undoes them.
  3. 🚫 No validation
    Results are never checked. Broken code gets committed; the next run builds on rubble.
  4. 🚫 No stop condition
    The loop runs until the budget is gone. It does not even notice when it would be done.
  5. 🚫 Full permissions on everything
    Production database, real emails, delete rights β€” one wrong step cannot be taken back.
  • Vague goals produce random results
  • No memory means no continuity β€” no validation means no trust
  • Permissions as small as possible: a loop rarely needs delete access to anything
  • Define upfront: when is it over? How does the loop recognize "done"?

Anthropic: Building effective agents β†—

βœ…

Example 3: The loop with a human in the picture

Autonomous does not mean alone. The best division of labor: the loop works, the human decides β€” without anyone waiting on anyone:

  1. Loop works independently
    Everything clearly defined and reversible it does without asking.
  2. Questions get parked, not blocking
    If it needs a decision (money, legal, taste), it puts the question in an inbox and keeps working on something else.
  3. Human answers whenever
    A status board shows progress + open questions. Answers flow into the next iteration.
  4. Irreversible stays human
    Buying domains, spending money, deleting, publishing to new channels β€” the loop never does these alone.
  • Async beats sync: nobody waits for anybody
  • Reversible = loop may act. Irreversible = human decides.
  • A visible status board replaces a hundred "what is the AI doing right now?" questions

Anthropic: Building effective agents β†— Β· Claude Code docs: Hooks β†—