diff --git a/.claude/skills/new-loop/SKILL.md b/.claude/skills/new-loop/SKILL.md index 1e8534a..2f55cb5 100644 --- a/.claude/skills/new-loop/SKILL.md +++ b/.claude/skills/new-loop/SKILL.md @@ -27,7 +27,7 @@ that returns clear pass/fail (e.g. `pytest test/users`, `npm test`, | Pattern | Use when | Mechanism | |---|---|---| | **`/goal`** (default) | Iterate-to-completion on a well-scoped task with a provable success condition. | `/goal` with a separate validator model (defaults to Haiku). Requires Claude Code v2.1.139+. | -| **ralph** (`/ralph-loop` or bash) | Long autonomous build where each iteration should reset context to anchor files. | Official `ralph-wiggum` plugin, or `templates/ralph/run.sh`. | +| **ralph** (`/ralph-loop` or bash) | Long autonomous build where each iteration should reset context to anchor files. | Official `ralph-wiggum` plugin (`--max-iterations` defaults to **unlimited** — always set it), or `templates/ralph/run.sh`. | | **`/loop`** | Recurring maintenance on an interval (babysit PRs, poll a deploy). | Bundled `/loop` skill (v2.1.72+); cron-backed, session-scoped; recurring tasks expire after 7 days. | Default to `/goal` for "do this task once, correctly." Use ralph for @@ -55,8 +55,11 @@ Create `loops//` (slug derived from the task) containing: 2. **No-progress detection** — instruct the loop to bail if N consecutive iterations produce no git diff / no test-state change (default N=3), and document blockers instead of looping forever. -3. **Budget ceiling** — set `MAX_BUDGET_USD` (ralph/SDK) or remind the user of - the session budget. State the expected cost order-of-magnitude. +3. **Budget ceiling** — set `MAX_BUDGET_USD` (ralph `run.sh` / Agent SDK + `max_budget_usd`), or pass `--max-budget-usd` on the Claude Code invocation + (since v2.1.217 it also halts background subagents at the cap). A reminder + about the session budget is an alert, not a ceiling. State the expected + cost order-of-magnitude. Pull the exact defaults from `guardrails/budget.env`. Reference `guardrails/checklist.md` and confirm every box is satisfied before finishing. diff --git a/README.md b/README.md index a9cc0cb..8304c76 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,11 @@ bakes in guardrails. ## The one rule **Never run an uncapped loop.** Every loop gets all three hard stops — a max -iteration count, no-progress detection, and a token/dollar budget ceiling. The -billing layer will *not* save you (soft alerts only). See +iteration count, no-progress detection, and a token/dollar budget ceiling. +Anthropic now ships some real spend enforcement (Enterprise Spend Limits API, +gateway spend limits, Managed Agents session budgets), but the gateway layer +fails open by default and none of it reaches a plain Claude Code loop +automatically — the ceiling still has to live in your harness. See [`guardrails/`](guardrails/). ## Staying current diff --git a/templates/ralph/run.sh b/templates/ralph/run.sh index 84eb98d..1575f3c 100755 --- a/templates/ralph/run.sh +++ b/templates/ralph/run.sh @@ -12,6 +12,10 @@ set -euo pipefail # ---- CONFIG (edit me) ------------------------------------------------------ +# NOTE: models that take more turns per unit of work (e.g. Fable 5.1-class +# long-horizon models) trip iteration/stall caps tuned on older models earlier. +# An early stop on such a model is a re-tuning signal, not proof of failure +# (see knowledge/00-primer.md §4, Fable 5.1 breaking changes). PROMPT_FILE="PROMPT.md" MAX_ITERATIONS=20 # hard stop #1: iteration cap MAX_BUDGET_USD=10 # hard stop #3: dollar ceiling (enforced below) @@ -19,6 +23,8 @@ STALL_LIMIT=3 # hard stop #2: bail after N no-progress passe COMPLETION_MARKER="COMPLETE" SUCCESS_CHECK="${SUCCESS_CHECK:-false}" # e.g. "pytest -q" / "npm test" # Agent command. --dangerously-skip-permissions only for sandboxed/headless use. +# Narrower alternative (v2.1.259+): --permission-prompts none denies anything +# that would prompt instead of skipping permissions wholesale. AGENT_CMD=(claude -p --dangerously-skip-permissions) # ---------------------------------------------------------------------------