|
1 | 1 | --- |
2 | 2 | title: "Why loop.js" |
3 | | -description: "Claude Code already loops — /loop and /schedule. Use them for yourself; use loop.js when the loop is a system you ship." |
| 3 | +description: "Claude Code already loops — /goal, /loop, and /schedule. Use them for yourself; use loop.js when the loop is a system you ship." |
4 | 4 | --- |
5 | 5 |
|
6 | | -Claude Code ships two ways to make an agent repeat, right in the terminal: |
| 6 | +Claude Code ships three ways to make an agent repeat, right in the terminal |
| 7 | +([Anthropic's loop taxonomy](https://claude.com/blog/getting-started-with-loops)): |
7 | 8 |
|
8 | | -- **`/loop`** — re-run a prompt on an interval, or omit the interval and let the model pace |
9 | | - itself toward a goal. |
10 | | -- **`/schedule`** — cloud agents (routines) that run on a cron schedule. |
| 9 | +- **`/goal`** — a goal-based loop in your live session: an evaluator checks your success |
| 10 | + criteria each iteration, until the goal is achieved or a maximum number of turns is hit. |
| 11 | +- **`/loop`** — a time-based loop on your machine: re-run a prompt on an interval, or let |
| 12 | + the model pace itself. |
| 13 | +- **`/schedule`** — the same idea in the cloud: agents (routines) that run on a cron. |
11 | 14 |
|
12 | | -For a developer driving their own session, both are the right tool: one line, zero setup, |
| 15 | +For a developer driving their own session, these are the right tool: one line, zero setup, |
13 | 16 | and you're watching the work happen. loop.js exists for the day the loop stops being |
14 | | -something you *run* and becomes something you *ship* — a system with a bar to meet, a budget |
15 | | -to respect, state to keep, and no human watching. |
16 | | - |
17 | | -The distinction in one sentence: **`/loop` and `/schedule` repeat execution; loop.js owns |
18 | | -convergence.** Everything a loop needs to reach *done* — an independent verdict, durable |
19 | | -state, declared guards, real scheduling — built into one npm package, driving the same |
20 | | -Claude agents underneath. |
21 | | - |
22 | | -## Who says "done"? |
23 | | - |
24 | | -| | `/loop` | `/schedule` | loop.js | |
25 | | -| --- | --- | --- | --- | |
26 | | -| Who judges "done" | the working model itself | each run ends when its agent stops | a separate, skeptical **Verify** agent — only its Verdict settles the Loop | |
27 | | -| Where memory lives | the session's context window | carried by your prompt, run to run | on disk — Record, journal, handoff notes; every Round starts with fresh context | |
28 | | -| Crash, restart, overlap | tied to the live session | fire-and-forget | the **Lock** (CAS + heartbeat): a live owner refuses overlap, a dead one is taken over | |
29 | | -| Budget | — | — | total `usd` ledger with a step-granular cutoff, plus Rounds and per-Round timeout | |
30 | | -| A finished goal, re-triggered | runs again | runs again | re-judged through the **Verify gate** — near-free while still ok, re-opens when stale | |
31 | | -| Surface | a command inside Claude Code | a command inside Claude Code | a typed library — `Loop.define` / `loop.run`, an event stream, CLI exit codes | |
| 17 | +something you *run* and becomes something you *ship* — a system with a bar to meet, a |
| 18 | +budget to respect, state to keep, and no human watching. |
| 19 | + |
| 20 | +The distinction in one sentence: **`/goal`, `/loop`, and `/schedule` are commands inside |
| 21 | +Claude Code; loop.js is the convergence machinery as a library.** Everything a loop needs |
| 22 | +to reach *done* — an independent verdict, durable state, declared guards, real scheduling — |
| 23 | +built into one npm package, driving the same Claude agents underneath. |
| 24 | + |
| 25 | +## What each owns |
| 26 | + |
| 27 | +| | `/goal` | `/loop` | `/schedule` | loop.js | |
| 28 | +| --- | --- | --- | --- | --- | |
| 29 | +| Who judges "done" | an evaluator in the same session | the working model itself | each run ends when its agent stops | a separate, skeptical **Verify** agent — own model, read-only — and only its Verdict settles the Loop | |
| 30 | +| Where memory lives | the session's context window | the session — stops when your machine does | carried by your prompt, run to run | on disk — Record, journal, handoff notes; every Round starts with fresh context | |
| 31 | +| Crash, restart, overlap | tied to the live session | tied to the live session | fire-and-forget | the **Lock** (CAS + heartbeat): a live owner refuses overlap, a dead one is taken over | |
| 32 | +| What stops a runaway | a maximum number of turns | you cancel it | you cancel it | total `usd` ledger (step-granular), Rounds cap, per-Round timeout — each a typed Exit | |
| 33 | +| A finished goal, re-triggered | — | runs again | runs again | re-judged through the **Verify gate** — near-free while still ok, re-opens when stale | |
| 34 | +| Surface | a command inside Claude Code | a command inside Claude Code | a command inside Claude Code | a typed library — `Loop.define` / `loop.run`, an event stream, CLI exit codes | |
| 35 | + |
| 36 | +The nearest sibling is `/goal` — it, too, refuses to let the worker declare victory early. |
| 37 | +The difference is what the judgement is made of and where the loop lives: `/goal`'s |
| 38 | +evaluator runs inside your session and ends with it; loop.js's Verify agent is a separate |
| 39 | +session with its own model and read-only permissions, its mandatory `reason` feeds the next |
| 40 | +Round, a Goal it can never meet settles as an explicit give-up, and the whole thing |
| 41 | +resumes from disk on any machine, any trigger, weeks later. |
32 | 42 |
|
33 | 43 | ## What the convergence machinery buys you |
34 | 44 |
|
@@ -87,12 +97,13 @@ const exit = await run.done() |
87 | 97 | loop cron add "*/30 * * * *" --until settled # keeps trying, removes itself when the bar is met |
88 | 98 | ``` |
89 | 99 |
|
90 | | -## When to keep `/loop` and `/schedule` |
| 100 | +## When to keep `/goal`, `/loop`, and `/schedule` |
91 | 101 |
|
92 | | -Honestly: often. Watching a refactor converge in your own session, re-checking a deploy |
93 | | -every five minutes, a personal daily routine — an interactive command beats a framework. |
94 | | -Reach for loop.js at the first of: the loop outlives your session, someone else (or cron) |
95 | | -triggers it, money is on the line, or "done" must be *proven* rather than felt. |
| 102 | +Honestly: often. Watching a refactor converge in your own session (`/goal`), re-checking a |
| 103 | +deploy every five minutes (`/loop`), a personal daily routine (`/schedule`) — an |
| 104 | +interactive command beats a framework. Reach for loop.js at the first of: the loop outlives |
| 105 | +your session, someone else (or cron) triggers it, money is on the line, or "done" must be |
| 106 | +judged by an agent the worker can't influence. |
96 | 107 |
|
97 | 108 | <CardGroup cols={2}> |
98 | 109 | <Card title="Quickstart" icon="rocket" href="/quickstart"> |
|
0 commit comments