Skip to content

docs: clarify --max-iterations is optional and defaults to unlimited#16

Merged
JonyanDunh merged 1 commit into
mainfrom
docs/max-iterations-default-unlimited
Apr 12, 2026
Merged

docs: clarify --max-iterations is optional and defaults to unlimited#16
JonyanDunh merged 1 commit into
mainfrom
docs/max-iterations-default-unlimited

Conversation

@JonyanDunh
Copy link
Copy Markdown
Owner

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.

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

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 fix(commands): /watchdog:stop was pointing at a non-existent script #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.

Scope

Zero changes to lib/, hooks/, test/, or .claude-plugin/. No state file schema changes. No new tests required (no behavior change).

Test plan

  • 132-test suite still passes locally (132 active + 2 skipped, 0 failures)
  • node --test test/*.test.js clean — no test additions or modifications
  • Confirmed no stale --max-iterations 0 user-facing examples remain (the only matches are in the new explanatory text and the existing backward-compat test)
  • CI will confirm on the standard matrix (jsonlint + markdownlint will catch any markdown issues in the new README content)

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

…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 JonyanDunh merged commit 12090a4 into main Apr 12, 2026
11 checks passed
@JonyanDunh JonyanDunh deleted the docs/max-iterations-default-unlimited branch April 12, 2026 16:09
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>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant