Skip to content

Commit 6f4b19f

Browse files
JonyanDunhclaude
andauthored
docs: purge every literal "--max-iterations 0" mention from docs and tests (#17)
Follow-up to #16. The previous PR removed the canonical "--max-iterations 0" example but left explanatory sentences like "you no longer need to pass --max-iterations 0" in the docs and a backward-compat test name in test/setup.test.js. Those still printed the literal "--max-iterations 0" to readers, defeating the point of the cleanup. This PR removes every remaining occurrence. ## Why Telling users "you don't need to write --max-iterations 0 anymore" still shows them "--max-iterations 0". A new user reading the docs has no prior knowledge of the legacy form, so explaining what NOT to write just plants the wrong syntax in their head. Cleaner: omit the deprecation note entirely. New users see only the "omit the flag for unlimited" guidance. Existing users who happen to pass 0 keep working silently. ## What changed - **`commands/help.md`**: - `--max-iterations` Options description: dropped the trailing "You no longer need to pass --max-iterations 0..." sentence - Best Practices #4: dropped the trailing "you do not need to pass --max-iterations 0" sentence - **`scripts/setup-watchdog.js` printHelp()**: dropped the "You do NOT need to pass --max-iterations 0 anymore." line from the help-output trailer - **All 7 READMEs** (`README.{md,zh,es,ja,ko,vi,pt}.md`): - --no-classifier subsection paragraph: dropped the "you no longer need to pass --max-iterations 0" trailing sentence - Best Practices #4 paragraph: dropped the same trailing sentence - **`test/setup.test.js`**: - Renamed test from "setup --no-classifier + --max-iterations 0 is allowed (infinite loop, manual stop only)" to "setup --no-classifier with no max cap is allowed (infinite loop, manual stop only)" - Test args changed from `['build', '--no-classifier', '--max-iterations', '0']` to `['build', '--no-classifier']` - Added a comment explaining that the recommended way to express "unlimited" is omission, and that the state file's max_iterations=0 default is what makes the stop hook treat the loop as uncapped ## Backward compatibility **Identical** to the previous state. The parser still accepts --max-iterations 0; the stop hook still treats max_iterations=0 as "no cap" (the > 0 guard fails). Anyone who was passing 0 explicitly keeps working. The only change is that the literal string "--max-iterations 0" no longer appears anywhere in the docs, the in-Claude-Code help, or test names that get printed in CI logs. Confirmed via `Grep "--max-iterations 0"` returning **zero matches** across the entire repo. ## Test plan - [x] 132-test suite still passes (132 active + 2 skipped, 0 failures) - [x] node --test test/*.test.js clean - [x] Grep "--max-iterations 0" returns zero matches in the repo - [ ] CI will confirm on the standard matrix Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 12090a4 commit 6f4b19f

10 files changed

Lines changed: 23 additions & 21 deletions

File tree

README.es.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Para ejecuciones estilo ralph-loop donde no quieres ningún LLM juzgando la conv
163163
/watchdog:start "Sigue iterando hasta que yo /watchdog:stop." --no-classifier
164164
```
165165

166-
El Stop hook salta la llamada a Haiku por completo. Las únicas formas de salir se vuelven `--max-iterations` y `/watchdog:stop`. **`--max-iterations` es opcional** — si lo omites (como en el ejemplo de arriba), el bucle es verdaderamente ilimitado y solo para cuando tú lo dices. **Ya no necesitas pasar `--max-iterations 0`** para significar "ilimitado"; simplemente deja la flag fuera por completo. (La forma con `0` sigue siendo aceptada por compatibilidad.)
166+
El Stop hook salta la llamada a Haiku por completo. Las únicas formas de salir se vuelven `--max-iterations` y `/watchdog:stop`. **`--max-iterations` es opcional** — si lo omites (como en el ejemplo de arriba), el bucle es verdaderamente ilimitado y solo para cuando tú lo dices.
167167

168168
El CLI `claude` ni siquiera es necesario en este modo (el subproceso de Haiku nunca se lanza). Compatible con `--prompt-file` y `--watch-prompt-file`. Mutuamente excluyente con `--exit-confirmations` — el contador del streak no tiene sentido cuando no hay un clasificador devolviendo veredictos.
169169

@@ -317,7 +317,7 @@ Implementa la feature X usando TDD:
317317

318318
El subproceso clasificador no es infalible. Un agent atascado que no para de hacer ediciones sin sentido, o uno que se confunde y deja de editar antes de tiempo, debería caer en un tope duro. `--max-iterations 20` es un valor por defecto razonable para la mayoría del trabajo.
319319

320-
**Pero la flag es opcional**. Si genuinamente quieres un bucle ilimitado (por ejemplo, un bucle de mantenimiento de larga duración que pretendes detener manualmente con `/watchdog:stop`, o una ejecución `--no-classifier` donde la convergencia la juzgas tú, no Haiku), **simplemente omite la flag por completo**. **No** necesitas pasar `--max-iterations 0` — esa forma sigue siendo aceptada por compatibilidad, pero la manera natural de expresar "ilimitado" ahora es dejar la flag fuera.
320+
**Pero la flag es opcional**. Si genuinamente quieres un bucle ilimitado (por ejemplo, un bucle de mantenimiento de larga duración que pretendes detener manualmente con `/watchdog:stop`, o una ejecución `--no-classifier` donde la convergencia la juzgas tú, no Haiku), **simplemente omite la flag por completo**.
321321

322322
---
323323

README.ja.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ralph-loop スタイルの実行で「LLM に収束を判定させたくない
164164
/watchdog:start "私が /watchdog:stop するまで反復し続けて。" --no-classifier
165165
```
166166

167-
Stop hook は Haiku 呼び出しを**完全にスキップ**します。終了する手段は `--max-iterations``/watchdog:stop` の 2 つだけになります。**`--max-iterations` はオプション**です——上の例のように省略すれば、ループは本当に無制限になり、あなたが止めるまで動き続けます。「無制限」を意味するために `--max-iterations 0` を渡す必要は**もうありません**——フラグごと省略してください。(`0` の形式は後方互換のために引き続き受け付けます。)
167+
Stop hook は Haiku 呼び出しを**完全にスキップ**します。終了する手段は `--max-iterations``/watchdog:stop` の 2 つだけになります。**`--max-iterations` はオプション**です——上の例のように省略すれば、ループは本当に無制限になり、あなたが止めるまで動き続けます。
168168

169169
このモードでは `claude` CLI すら必要ありません(Haiku サブプロセスが起動されないため)。`--prompt-file` および `--watch-prompt-file` と自由に組み合わせられます。**`--exit-confirmations` とは併用できません**——分類器が判定を返さない以上、streak カウンターは無意味です。
170170

@@ -318,7 +318,7 @@ Implement feature X using TDD:
318318

319319
分類器サブプロセスは万能ではありません。意味のない編集を繰り返して詰まった agent や、混乱して早すぎるタイミングで編集を止めてしまった agent は、最終的にハード停止に吸収されるべきです。`--max-iterations 20` はほとんどの作業に妥当なデフォルトです。
320320

321-
**ただし、このフラグはオプションです**。本当に無制限ループが欲しい場合(例えば `/watchdog:stop` で手動停止する予定の長期メンテナンスループや、収束を Haiku ではなくあなた自身が判定する `--no-classifier` 実行など)は、**フラグごと省略してください**`--max-iterations 0` を渡す必要は**ありません**——その形式は後方互換のために引き続き受け付けますが、「無制限」を表現する自然な方法は、今後はフラグごと省略することです。
321+
**ただし、このフラグはオプションです**。本当に無制限ループが欲しい場合(例えば `/watchdog:stop` で手動停止する予定の長期メンテナンスループや、収束を Haiku ではなくあなた自身が判定する `--no-classifier` 実行など)は、**フラグごと省略してください**
322322

323323
---
324324

README.ko.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ralph-loop 스타일로 어떤 LLM도 수렴을 판정하지 않도록 — 수
164164
/watchdog:start "내가 /watchdog:stop할 때까지 계속 반복해." --no-classifier
165165
```
166166

167-
Stop hook이 Haiku 호출을 **완전히 건너뜁니다**. 종료 수단은 `--max-iterations``/watchdog:stop` 두 가지로 줄어듭니다. **`--max-iterations`는 선택입니다** — 위 예시처럼 생략하면 루프는 진짜로 무제한이 되고, 당신이 멈추라고 할 때까지만 돕니다. "무제한"을 의미하기 위해 `--max-iterations 0`을 전달할 **필요가 더 이상 없습니다** — 그냥 플래그를 빼세요. (`0` 형식은 하위 호환을 위해 여전히 허용됩니다.)
167+
Stop hook이 Haiku 호출을 **완전히 건너뜁니다**. 종료 수단은 `--max-iterations``/watchdog:stop` 두 가지로 줄어듭니다. **`--max-iterations`는 선택입니다** — 위 예시처럼 생략하면 루프는 진짜로 무제한이 되고, 당신이 멈추라고 할 때까지만 돕니다.
168168

169169
이 모드에서는 `claude` CLI조차 필요 없습니다(Haiku 서브프로세스가 절대 생성되지 않습니다). `--prompt-file`, `--watch-prompt-file`과 자유롭게 조합할 수 있습니다. **`--exit-confirmations`와는 함께 쓸 수 없습니다** — 분류기가 판정을 반환하지 않는 이상 streak 카운터는 의미가 없습니다.
170170

@@ -318,7 +318,7 @@ TDD로 기능 X를 구현해주세요:
318318

319319
분류기 서브프로세스는 완벽하지 않습니다. 의미 없는 편집을 반복하며 멈추지 못하는 agent나, 헷갈려서 너무 일찍 편집을 중단해 버리는 agent는 결국 하드 스톱으로 떨어져야 합니다. 대부분의 작업에는 `--max-iterations 20`이 합리적인 기본값입니다.
320320

321-
**그래도 이 플래그는 선택사항입니다**. 정말로 무제한 루프를 원한다면(예: `/watchdog:stop`으로 수동 중지할 작정인 장기 유지보수 루프, 또는 Haiku가 아닌 본인이 수렴을 판정하는 `--no-classifier` 실행), **그냥 플래그를 빼세요**. `--max-iterations 0`을 전달할 **필요가 없습니다** — 그 형식은 하위 호환을 위해 여전히 허용되지만, "무제한"을 표현하는 자연스러운 방법은 이제 플래그를 빼는 것입니다.
321+
**그래도 이 플래그는 선택사항입니다**. 정말로 무제한 루프를 원한다면(예: `/watchdog:stop`으로 수동 중지할 작정인 장기 유지보수 루프, 또는 Haiku가 아닌 본인이 수렴을 판정하는 `--no-classifier` 실행), **그냥 플래그를 빼세요**.
322322

323323
---
324324

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ For ralph-loop-style runs where you don't want any LLM judging convergence — y
163163
/watchdog:start "Keep iterating until I /watchdog:stop." --no-classifier
164164
```
165165

166-
The Stop hook skips the Haiku call entirely. The only ways to exit become `--max-iterations` and `/watchdog:stop`. **`--max-iterations` is optional** — if you omit it (as in the example above), the loop is truly unbounded and only stops when you say so. You no longer need to pass `--max-iterations 0` to mean "unlimited"; just leave the flag off entirely. (The `0` form is still accepted for backward compatibility.)
166+
The Stop hook skips the Haiku call entirely. The only ways to exit become `--max-iterations` and `/watchdog:stop`. **`--max-iterations` is optional** — if you omit it (as in the example above), the loop is truly unbounded and only stops when you say so.
167167

168168
The `claude` CLI is not even required in this mode (the Haiku subprocess is never spawned). Compatible with `--prompt-file` and `--watch-prompt-file`. Mutually exclusive with `--exit-confirmations` — the streak counter is meaningless when there is no classifier returning verdicts.
169169

@@ -317,7 +317,7 @@ Implement feature X using TDD:
317317

318318
The classifier subprocess is not infallible. A stuck agent that keeps making meaningless edits, or one that gets confused and stops editing prematurely, should fall through to a hard stop. `--max-iterations 20` is a reasonable default for most work.
319319

320-
**The flag is optional, though.** If you genuinely want an unlimited loop (e.g., a long-running maintenance loop you intend to stop manually with `/watchdog:stop`, or a `--no-classifier` run where convergence is judged by you, not Haiku), **just omit the flag entirely**. You do **not** need to pass `--max-iterations 0` — that form is still accepted for backward compatibility, but the natural way to express "unlimited" is now to leave the flag off.
320+
**The flag is optional, though.** If you genuinely want an unlimited loop (e.g., a long-running maintenance loop you intend to stop manually with `/watchdog:stop`, or a `--no-classifier` run where convergence is judged by you, not Haiku), **just omit the flag entirely**.
321321

322322
---
323323

README.pt.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Para execuções estilo ralph-loop onde você não quer nenhum LLM julgando conv
163163
/watchdog:start "Continue iterando até eu /watchdog:stop." --no-classifier
164164
```
165165

166-
O Stop hook pula a chamada ao Haiku completamente. As únicas formas de sair se tornam `--max-iterations` e `/watchdog:stop`. **`--max-iterations` é opcional** — se você omiti-lo (como no exemplo acima), o loop é verdadeiramente ilimitado e só para quando você manda. **Você não precisa mais passar `--max-iterations 0`** para significar "ilimitado"; basta deixar a flag de fora por completo. (A forma com `0` continua sendo aceita por compatibilidade.)
166+
O Stop hook pula a chamada ao Haiku completamente. As únicas formas de sair se tornam `--max-iterations` e `/watchdog:stop`. **`--max-iterations` é opcional** — se você omiti-lo (como no exemplo acima), o loop é verdadeiramente ilimitado e só para quando você manda.
167167

168168
O CLI `claude` nem mesmo é necessário neste modo (o subprocesso Haiku nunca é spawned). Compatível com `--prompt-file` e `--watch-prompt-file`. **Mutuamente exclusivo com `--exit-confirmations`** — o contador de streak é sem sentido quando não há classificador retornando vereditos.
169169

@@ -317,7 +317,7 @@ Implement feature X using TDD:
317317

318318
O subprocesso classificador não é infalível. Um agente travado que fica fazendo edições sem sentido, ou um que se perde e para de editar cedo demais, precisa cair num limite rígido. `--max-iterations 20` é um default razoável para a maior parte do trabalho.
319319

320-
**Mas a flag é opcional**. Se você genuinamente quer um loop ilimitado (por exemplo, um loop de manutenção de longa duração que você pretende parar manualmente com `/watchdog:stop`, ou uma execução `--no-classifier` onde a convergência é julgada por você, não pelo Haiku), **simplesmente omita a flag por completo**. Você **não** precisa passar `--max-iterations 0` — essa forma continua sendo aceita por compatibilidade, mas a maneira natural de expressar "ilimitado" agora é deixar a flag de fora.
320+
**Mas a flag é opcional**. Se você genuinamente quer um loop ilimitado (por exemplo, um loop de manutenção de longa duração que você pretende parar manualmente com `/watchdog:stop`, ou uma execução `--no-classifier` onde a convergência é julgada por você, não pelo Haiku), **simplesmente omita a flag por completo**.
321321

322322
---
323323

README.vi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Cho các lần chạy kiểu ralph-loop mà bạn không muốn bất kỳ LLM n
163163
/watchdog:start "Cứ lặp cho đến khi tôi /watchdog:stop." --no-classifier
164164
```
165165

166-
Stop hook bỏ qua hoàn toàn lời gọi Haiku. Cách thoát duy nhất trở thành `--max-iterations``/watchdog:stop`. **`--max-iterations` là tùy chọn** — nếu bạn bỏ qua nó (như trong ví dụ trên), vòng lặp thực sự không giới hạn và chỉ dừng khi bạn ra lệnh. **Bạn không còn cần truyền `--max-iterations 0`** để có nghĩa là "không giới hạn"; chỉ cần bỏ flag đó hoàn toàn. (Dạng `0` vẫn được chấp nhận vì lý do tương thích ngược.)
166+
Stop hook bỏ qua hoàn toàn lời gọi Haiku. Cách thoát duy nhất trở thành `--max-iterations``/watchdog:stop`. **`--max-iterations` là tùy chọn** — nếu bạn bỏ qua nó (như trong ví dụ trên), vòng lặp thực sự không giới hạn và chỉ dừng khi bạn ra lệnh.
167167

168168
CLI `claude` thậm chí không cần thiết trong chế độ này (subprocess Haiku không bao giờ được spawn). Tương thích với `--prompt-file``--watch-prompt-file`. **Không tương thích với `--exit-confirmations`** — bộ đếm streak vô nghĩa khi không có bộ phân loại trả về kết luận.
169169

@@ -317,7 +317,7 @@ Implement feature X using TDD:
317317

318318
Classifier subprocess không phải là thánh. Một agent bị kẹt mà cứ loay hoay sửa linh tinh vô nghĩa, hoặc một agent bị rối rồi ngừng sửa quá sớm, đều cần rơi vào một cú dừng cứng. `--max-iterations 20` là một mặc định hợp lý cho hầu hết công việc.
319319

320-
**Tuy nhiên flag này là tùy chọn**. Nếu bạn thực sự muốn vòng lặp không giới hạn (ví dụ: một vòng lặp bảo trì chạy lâu mà bạn định dừng thủ công bằng `/watchdog:stop`, hoặc một lần chạy `--no-classifier` mà việc hội tụ do bạn — không phải Haiku — đánh giá), **chỉ cần bỏ flag hoàn toàn**. Bạn **không** cần truyền `--max-iterations 0` — dạng đó vẫn được chấp nhận vì lý do tương thích ngược, nhưng cách tự nhiên để biểu đạt "không giới hạn" giờ đây là không truyền flag.
320+
**Tuy nhiên flag này là tùy chọn**. Nếu bạn thực sự muốn vòng lặp không giới hạn (ví dụ: một vòng lặp bảo trì chạy lâu mà bạn định dừng thủ công bằng `/watchdog:stop`, hoặc một lần chạy `--no-classifier` mà việc hội tụ do bạn — không phải Haiku — đánh giá), **chỉ cần bỏ flag hoàn toàn**.
321321

322322
---
323323

README.zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Stop hook 会在每一轮开始时重新读这个 prompt 文件。如果内容
163163
/watchdog:start "一直跑直到我 /watchdog:stop。" --no-classifier
164164
```
165165

166-
Stop hook 会**完全跳过** Haiku 调用。退出循环只剩两个途径:`--max-iterations``/watchdog:stop`**`--max-iterations` 是可选的** —— 如果你完全不传(就像上面的示例),循环就是真正的无限循环,只能你手动停。**不需要再写 `--max-iterations 0`** —— 直接不传这个参数就行(`0` 那种写法还能用,只是为了向后兼容)。
166+
Stop hook 会**完全跳过** Haiku 调用。退出循环只剩两个途径:`--max-iterations``/watchdog:stop`**`--max-iterations` 是可选的** —— 如果你完全不传(就像上面的示例),循环就是真正的无限循环,只能你手动停。
167167

168168
这个模式下 `claude` CLI 都不需要装(Haiku 子进程根本不会被启动)。可以和 `--prompt-file``--watch-prompt-file` 自由组合。**不能和 `--exit-confirmations` 同时用**——既然没人判定收敛,streak 计数器就毫无意义。
169169

@@ -317,7 +317,7 @@ Loop 的退出条件是"没有文件被修改"。如果你的任务没有可验
317317

318318
分类器子进程不是 100% 可靠。一个卡住的 agent 可能反复做无意义修改;一个被绕晕的 agent 可能过早停止编辑。这些情况都应该落到一个硬性上限上。`--max-iterations 20` 是大多数任务的合理默认值。
319319

320-
**但这个 flag 是可选的**。如果你确实想要无限循环(比如长期跑的维护任务,准备靠 `/watchdog:stop` 手动停;或者用 `--no-classifier` 让收敛完全由你判断而不是 Haiku),**直接不写这个 flag 就行****不需要写 `--max-iterations 0`** —— `0` 那种写法还能用(向后兼容保留),但表达"无限"的自然方式现在是直接省略这个 flag。
320+
**但这个 flag 是可选的**。如果你确实想要无限循环(比如长期跑的维护任务,准备靠 `/watchdog:stop` 手动停;或者用 `--no-classifier` 让收敛完全由你判断而不是 Haiku),**直接不写这个 flag 就行**
321321

322322
---
323323

commands/help.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Start a Watchdog in the current session.
4646

4747
**Options:**
4848

49-
- `--max-iterations <n>`**optional safety cap**. If passed, the loop exits after N iterations no matter what. **If you don't pass it, the loop is unlimited** — it will only exit via convergence (Haiku verdict + `--exit-confirmations`) or `/watchdog:stop` (or, under `--no-classifier`, only via `/watchdog:stop`). Recommended for most tasks: `--max-iterations 20`. You no longer need to pass `--max-iterations 0` to mean "unlimited"just omit the flag entirely (the `0` form is still accepted for backward compatibility).
49+
- `--max-iterations <n>`**optional safety cap**. If passed, the loop exits after N iterations no matter what. **If you don't pass it, the loop is unlimited** — it will only exit via convergence (Haiku verdict + `--exit-confirmations`) or `/watchdog:stop` (or, under `--no-classifier`, only via `/watchdog:stop`). Recommended for most tasks: `--max-iterations 20`. To express "unlimited", just leave the flag off entirely.
5050
- `--exit-confirmations <n>` — require **N consecutive** `NO_FILE_CHANGES` verdicts from the Haiku classifier before allowing the loop to exit. Default `1` (exit on the first clean verdict, identical to pre-1.3.0 behavior). Use a higher value when you want belt-and-suspenders confirmation that the work is really done — for example `--exit-confirmations 3` means the agent must finish three turns in a row without modifying any project file.
5151

5252
**Strict reset semantics:** the streak counter is reset to `0` whenever the Haiku classifier returns anything other than a clean `NO_FILE_CHANGES` verdict — that includes `FILE_CHANGES`, `AMBIGUOUS`, `CLI_MISSING`, `CLI_FAILED`, or a pure-text turn (no tool invocations). Convergence has to be **unbroken** to count.
@@ -111,7 +111,7 @@ The state file is keyed by the **parent Claude Code process ID**, which Watchdog
111111
- **Clear completion criteria** — "no more edits needed" must be a verifiable answer, not subjective. Tie it to passing tests, a clean typecheck, zero lint errors, etc.
112112
- **Incremental verifiable goals** — if there's no verifiable end state, the loop will just spin.
113113
- **Self-correcting structure** — tell Claude how to notice failure and adapt.
114-
- **Set `--max-iterations` for most tasks** — even if the Haiku classifier is reliable, a stuck agent should fall through to a hard stop. `--max-iterations 20` is a reasonable default. **Omit the flag entirely** if you genuinely want unlimited iterations (e.g., a long-running maintenance loop you intend to stop manually with `/watchdog:stop`); you do **not** need to pass `--max-iterations 0`.
114+
- **Set `--max-iterations` for most tasks** — even if the Haiku classifier is reliable, a stuck agent should fall through to a hard stop. `--max-iterations 20` is a reasonable default. **Omit the flag entirely** if you genuinely want unlimited iterations (e.g., a long-running maintenance loop you intend to stop manually with `/watchdog:stop`).
115115

116116
## Learn more
117117

0 commit comments

Comments
 (0)