Stop-Hook Ralph (Deterministic Loop Without Bash)

A Ralph variant that lives inside a single Claude Code session: a stop hook re-injects the task prompt whenever the agent tries to end its turn, trading the bash while-loop's fresh context for a persistent session.

prompt
→ Claude
Use a Claude Code stop hook that re-injects the task prompt whenever the agent tries to end its turn, until a completion condition or hard iteration cap is met — Ralph semantics inside one session instead of a bash `while` wrapper.
claude-code

Implementation note

When to use: you want Ralph-style relentless iteration but inside a single Claude Code session — no bash wrapper, no process management — and you accept persistent context instead of fresh context as the trade. How it works: a Claude Code stop hook intercepts the agent whenever it tries to end its turn and re-injects the task prompt, forcing another iteration until a completion condition or a hard iteration cap is met. That yields Ralph semantics — keep going until done — deterministically within one session, trading the bash while-loop's fresh-context-per-iteration for session continuity and its context accumulation. Safety: the source's warning is the rule: always include a hard iteration cap in the hook logic, because a stop hook with no cap is an infinite loop by construction — the agent literally cannot end its turn. Make the completion condition machine-checkable, and remember that accumulated context drifts; for very long runs, fresh-context Ralph resists drift better.

Source: paddo.dev

More automation loops

Run workflows with dynamic sub-agents

/goalnew

Split a task into packets, run sub-agents in parallel, synthesize results, and verify completion.

prompt
→ Claude
/goal loop and verify until complete
automationlow risk

Run agent turns until goal met

/goalnew

Agent executes repeated turns toward a condition, with a lightweight evaluator checking progress after each turn until the goal is reached.

prompt
→ Claude
/goal <condition turns a prompt into a durable objective. Thanos immediately starts a turn toward the condition, and after each turn a fresh, tool-less side-channel evaluator (a one-shot completeSimple call, not a subagent — so no extra agent turn and no re-entrancy) reads the last turn's evidence and returns MET / NOT MET . NOT MET auto-continues another turn with the reason as guidance; MET clears the goal and records the achievement. Unparseable evaluator output is treated as NOT MET (fail-safe: it never declares a false "done
automationmedium risk

Run agent until goal met

/goalnew

Queue agent turns with goal context until your objective is achieved, treating the goal as untrusted data.

prompt
→ Claude
/goal <objective , after /goal resume , and after every agent turn that leaves the goal active , the extension queues Codex's goal continuation prompt as hidden model-visible context. The objective is XML-escaped and wrapped as untrusted user data so it does not become higher-priority instructions
automationlow risk