Skip to content

Commit 02eae25

Browse files
shitianfangclaude
andcommitted
docs: the comparison is /goal + /loop + /schedule — add the goal-based loop
Anthropic's loop taxonomy (claude.com/blog/getting-started-with-loops) names three primitives; /goal is the nearest sibling and deserved the honest treatment: it has an in-session evaluator, so the loop.js difference is a separate Verify session (own model, read-only), disk-durable resume, budget guards, and the give-up verdict. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 603b863 commit 02eae25

3 files changed

Lines changed: 56 additions & 41 deletions

File tree

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,27 @@ missing piece: **an independent verdict**. The loop doesn't end because the work
5656
done; it ends because a separate judge, with its own permissions and its own model, says
5757
the bar is met — or because a declared guard fires. [Read more →](https://loop-js.mintlify.site/loop-engineering)
5858

59-
## Why loop.js, not `/loop` or `/schedule`?
60-
61-
Claude Code already loops: `/loop` re-runs a prompt (or lets the model pace itself toward a
62-
goal), and `/schedule` runs cloud agents on a cron. Both are the right tool for a developer
63-
driving their own session. They repeat **execution**; loop.js owns **convergence** — as a
64-
library you ship:
65-
66-
- **Done is a verdict.** A separate, skeptical judge settles the loop; `/loop` stops when
67-
the working model says so.
68-
- **State is on disk.** Every Round starts fresh and resumes from the Record; a `/loop`
69-
lives and dies with its session.
59+
## Why loop.js, not `/goal`, `/loop`, or `/schedule`?
60+
61+
Claude Code already loops: `/goal` iterates in your session until an evaluator passes your
62+
criteria, `/loop` re-runs a prompt on an interval on your machine, and `/schedule` runs
63+
cloud agents on a cron. All three are the right tool for a developer driving their own
64+
session. They are **commands inside Claude Code**; loop.js is the convergence machinery
65+
**as a library you ship**:
66+
67+
- **Done is a verdict.** A separate, skeptical judge — its own model, read-only — settles
68+
the loop; `/goal`'s evaluator lives inside the same session, and `/loop` stops when the
69+
working model says so.
70+
- **State is on disk.** Every Round starts fresh and resumes from the Record — on any
71+
machine, weeks later; a `/goal` or `/loop` lives and dies with its session.
7072
- **Overlap is safe.** The Lock's compare-and-set makes any trigger cadence safe — a
7173
periodic schedule doubles as the crash watchdog.
7274
- **Budget is enforced.** Dollars, Rounds, and per-Round timeouts are step-granular guards
7375
with their own exit codes.
7476
- **It's an API.** `Loop.define` / `loop.run` / typed events — embed the loop in your
7577
product, not in your terminal.
78+
- **Give-up is an answer.** A Goal that can never pass settles as an explicit `impossible`
79+
instead of burning turns to the cap.
7680

7781
Same agents underneath (the Claude Agent SDK) — loop.js is the convergence machinery
7882
around them. [Full comparison →](https://loop-js.mintlify.site/why-loop-js)

docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ so the loop is exactly as durable as your filesystem.
5252
Scaffold a project and drive your first Goal to settled.
5353
</Card>
5454
<Card title="Why loop.js" icon="scale-balanced" href="/why-loop-js">
55-
Claude Code already has `/loop` and `/schedule` — when do you need more?
55+
Claude Code already has `/goal`, `/loop`, and `/schedule` — when do you need more?
5656
</Card>
5757
</CardGroup>

docs/why-loop-js.mdx

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
11
---
22
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."
44
---
55

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)):
78

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

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,
1316
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.
3242

3343
## What the convergence machinery buys you
3444

@@ -87,12 +97,13 @@ const exit = await run.done()
8797
loop cron add "*/30 * * * *" --until settled # keeps trying, removes itself when the bar is met
8898
```
8999

90-
## When to keep `/loop` and `/schedule`
100+
## When to keep `/goal`, `/loop`, and `/schedule`
91101

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

97108
<CardGroup cols={2}>
98109
<Card title="Quickstart" icon="rocket" href="/quickstart">

0 commit comments

Comments
 (0)