The /goal command in Claude Code sets a completion condition that keeps Claude working autonomously across multiple turns until that condition is met.
After you type /goal followed by your desired end state (like "all tests pass" or "build exits 0"), a small fast model checks after each turn whether the condition holds.
If not, Claude automatically starts another turn without waiting for you to prompt it, effectively creating a persistent loop—plan, act, test, review—until your goal is verifiably complete.
This transforms Claude from responding to individual prompts into an autonomous agent that can work on substantial tasks with measurable outcomes, like migrating code until tests pass or refactoring until the build succeeds.