docs: clarify --max-iterations is optional and defaults to unlimited#16
Merged
Merged
Conversation
…ited
Make the existing "default = unlimited" behavior explicit in every user-
facing surface, and stop showing `--max-iterations 0` as the way to
express "no cap". The natural way is now to just omit the flag.
## Why
The current behavior (verified in `scripts/setup-watchdog.js:22` and
`hooks/stop-hook.js:154`) is already that not passing `--max-iterations`
means an unlimited loop — `maxIterations` defaults to `0` in the parser,
and the hook's hard-stop check is `if (state.max_iterations > 0 && ...)`,
so a value of `0` never triggers the cap.
But the docs were misleading users into thinking `--max-iterations 0` was
something they had to write to opt into "unlimited", when actually
omitting the flag is exactly equivalent. Worse, the `--no-classifier`
section's example showed `--no-classifier --max-iterations 0` as the
canonical "unbounded ralph-loop-style run" syntax, which made the `0`
look mandatory for that use case.
## What changed
No production code or behavior changes. Pure documentation cleanup:
- **`commands/help.md`** (the in-Claude-Code reference users see via
`/watchdog:help`):
- The `--no-classifier` example dropped from `--no-classifier
--max-iterations 0` to plain `--no-classifier`
- The `--max-iterations` option description now leads with "**optional
safety cap**" and explicitly states "If you don't pass it, the loop
is unlimited"
- The `--no-classifier` option description's "Pair with
`--max-iterations 0`" advice changed to "**Just omit
`--max-iterations`**"
- The "Best Practices" item renamed from "Always set `--max-iterations`"
to "Set `--max-iterations` for most tasks", with an explicit note that
omitting the flag is the correct way to express "unlimited"
- **`scripts/setup-watchdog.js` (`printHelp()`)**: the no-classifier
quick-usage example dropped its `--max-iterations 20` and gained an
inline comment `# no --max-iterations = unlimited`. A new three-line
trailer at the bottom of the help output explicitly explains that
`--max-iterations` is optional and `--max-iterations 0` is no longer
needed.
- **All 7 READMEs** (`README.{md,zh,es,ja,ko,vi,pt}.md`):
- The `--no-classifier` subsection's example dropped `--max-iterations 0`
- The surrounding paragraph reworded to lead with "**`--max-iterations`
is optional**" and explicitly tell the user they no longer need to
pass `--max-iterations 0`
- The "Best Practices" section #4 renamed from "Always set
`--max-iterations`" to "Set `--max-iterations` for most tasks", with
a new paragraph explicitly endorsing flag omission for unlimited
loops
## Backward compatibility
The CLI still accepts `--max-iterations 0` exactly as before — it is
parsed, stored as `max_iterations: 0` in the state file, and the hook
treats it as "no cap" because the `> 0` check fails. Existing watchdogs
that pass `0` keep working unchanged. This PR only changes the
*recommended* and *documented* way to express "unlimited"; the
*supported* ways now include both "omit the flag" and "pass 0", with
the former being the new natural form.
No state file schema changes. No new fields. No new flags. No version
bump (docs-only, following the convention of PRs #7 and #15).
## Test plan
- [x] 132-test suite still passes locally (132 active + 2 skipped, 0
failures) — no behavior change so no test additions needed
- [x] `node --test test/*.test.js` clean
- [x] Confirmed no remaining stale references via
`Grep --max-iterations 0` — every remaining match is in the new
explanatory text or the existing backward-compat test
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JonyanDunh
added a commit
that referenced
this pull request
Apr 12, 2026
…tests 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>
4 tasks
JonyanDunh
added a commit
that referenced
this pull request
Apr 12, 2026
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make the existing "default = unlimited" behavior explicit in every user-facing surface, and stop showing
--max-iterations 0as the way to express "no cap". The natural way is now to just omit the flag.No production code or behavior changes. Pure documentation cleanup. No version bump (following the convention of #7 and #15).
Why
The current behavior (verified in
scripts/setup-watchdog.js:22andhooks/stop-hook.js:154) is already that not passing--max-iterationsmeans an unlimited loop —maxIterationsdefaults to0in the parser, and the hook's hard-stop check isif (state.max_iterations > 0 && ...), so a value of0never triggers the cap.But the docs were misleading users into thinking
--max-iterations 0was something they had to write to opt into "unlimited", when actually omitting the flag is exactly equivalent. Worse, the--no-classifiersection's example showed--no-classifier --max-iterations 0as the canonical "unbounded ralph-loop-style run" syntax, which made the0look mandatory for that use case.What changed
commands/help.md(the in-Claude-Code reference users see via/watchdog:help)--no-classifierexample dropped from--no-classifier --max-iterations 0to plain--no-classifier--max-iterationsoption description now leads with "optional safety cap" and explicitly states "If you don't pass it, the loop is unlimited"--no-classifieroption description's "Pair with--max-iterations 0" advice changed to "Just omit--max-iterations"--max-iterations" to "Set--max-iterationsfor most tasks", with an explicit note that omitting the flag is the correct way to express "unlimited"scripts/setup-watchdog.js(printHelp())--max-iterations 20and gained an inline comment# no --max-iterations = unlimited--max-iterationsis optional and--max-iterations 0is no longer neededAll 7 READMEs (
README.{md,zh,es,ja,ko,vi,pt}.md)--no-classifiersubsection's example dropped--max-iterations 0--max-iterationsis optional" and explicitly tell the user they no longer need to pass--max-iterations 0--max-iterations" to "Set--max-iterationsfor most tasks", with a new paragraph explicitly endorsing flag omission for unlimited loopsBackward compatibility
The CLI still accepts
--max-iterations 0exactly as before — it is parsed, stored asmax_iterations: 0in the state file, and the hook treats it as "no cap" because the> 0check fails. Existing watchdogs that pass0keep working unchanged. This PR only changes the recommended and documented way to express "unlimited"; the supported ways now include both "omit the flag" and "pass 0", with the former being the new natural form.No state file schema changes. No new fields. No new flags. No version bump.
Scope
commands/help.md— 4 spotsscripts/setup-watchdog.js—printHelp()block onlyREADME.md+ 6 translations — 2 spots each (no-classifier subsection + Best Practices fix(commands): /watchdog:stop was pointing at a non-existent script #4)Zero changes to
lib/,hooks/,test/, or.claude-plugin/. No state file schema changes. No new tests required (no behavior change).Test plan
node --test test/*.test.jsclean — no test additions or modifications--max-iterations 0user-facing examples remain (the only matches are in the new explanatory text and the existing backward-compat test)Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com