Claude Code shipped /goal a few weeks ago. Codex and Hermes have their version too. It replaces the old Ralph loop plugin people were running on their own.
The idea is simple. You set a goal, Claude runs until the goal is met.
What's actually happening under the hood:
A worker model (Sonnet or Opus) does the real work. Writes code, runs bash, reads files. An evaluator model (Haiku) reads the conversation every turn and checks if your condition is met. When the evaluator says done, the goal auto-clears and you get control back.
The catch most people miss: the evaluator only sees the transcript. It cannot run commands or check files itself. So your end condition has to be something the worker's own output can prove. Otherwise it loops forever and burns tokens.
The prompt framework that works for me:
1. End state. One measurable thing. A test result, a file count, a markdown doc.
2. State check. How Claude proves it. A command, a script.
3. Constraints. Guardrails so it does not take shortcuts on other files.
4. Safety cap. Stop after 28 turns or 45 minutes. Non-negotiable.
Real example: migrating 50 skills from one repo to another. Without /goal, Claude pings you for approval every few files. With /goal in auto mode, it ran straight through. Zero misses, zero babysitting.
One gotcha. You need auto mode or bypass permissions on. Otherwise it stalls waiting for input and the loop dies.
Also worth knowing: only one goal per session, condition can be up to 4,000 characters, and the goal survives if you close the session. You can resume it.