published fresh until

How do I make Claude Code keep going until the tests pass?

Summary As of November 2026, Claude Code's /goal sets a completion condition such as all tests in test/auth pass and lint is clean. After every turn a separate model checks it and Claude keeps working until met, judged impossible, or an error you must fix clears the goal.

Not for writing CLAUDE.md wording about when to stop, see agent-keep-going-or-stop-and-ask-rule; a stop hook for monorepo builds, see monorepo-stop-hook-build-changed-projects

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

Claude Code finishes a turn, reports progress, and waits. For a migration or a bug with a clear pass or fail check you end up typing "continue" every few minutes, or it declares victory with failing tests.

What /goal does (Anthropic docs, read 17 November 2026)

/goal <condition> starts a turn right away and, after each turn, sends the condition plus the conversation to your small fast model. Verdicts: not yet met (Claude continues, using the reason as guidance), met (goal cleared), or impossible (cleared with a reason). One goal per session; /goal shows status (turns evaluated, token spend, last reason) and /goal clear removes it. It also works with claude -p "/goal ...", in the desktop app and through Remote Control, and active goals are restored on resume.

Writing a condition that works

The evaluator judges only what Claude has shown in the conversation; it does not run commands itself. The docs recommend one measurable end state, a stated check, and constraints. Example: /goal all tests in test/auth pass and the lint step is clean, and no other test file is modified, or stop after 20 turns. Put a turn or time clause in to bound it (up to 4,000 characters).

Things to know

  • A goal does not change permissions. For unattended runs the docs pair it with auto mode; in Manual mode Claude still asks before commands your settings do not allow.
  • It stops by itself if Claude makes no tool calls for several turns, leaving the goal set, or clears the goal on errors you must fix (authentication or a disk too full to renew login when Claude Code manages its own credentials, no credits, context overflow auto-compaction cannot clear, unavailable model). Host-managed authentication failures leave the goal active. Usage limits and overloads pause or retry instead.
  • Long goals spend plan usage; while background work is running it checks in at most three idle times per goal between your prompts (CLAUDE_CODE_GOAL_CHECKIN_MINUTES=0 turns off check-ins and automatic retries).
  • A Stop hook is the alternative when you want a deterministic script check instead of a model judging.

Caveats

  • Vendor documentation; WhatWorks has not run goals. The evaluator can be wrong in either direction, so keep a real check (tests, build) in the condition.

Sources

Primary source: the Claude Code /goal docs, read in full on 17 November 2026.

  • Confirms: the three verdicts from a small fast model, one goal per session, /goal status and /goal clear, non-interactive, desktop and Remote Control use, restoring an active goal on resume, conditions of up to 4,000 characters, the evaluator judging only what Claude surfaced in the conversation, pairing with auto mode for unattended runs, the stop after several turns without tool use, the five error kinds that clear the goal, with authentication and login-renewal disk errors scoped to Claude Code-managed credentials, and the Stop hook alternative.
  • Corrected above: the docs say Claude Code starts at most three idle check-ins per goal between your own prompts, and CLAUDE_CODE_GOAL_CHECKIN_MINUTES=0 turns off both check-ins and automatic retries. The evaluator model is the small fast model, so setting ANTHROPIC_DEFAULT_HAIKU_MODEL changes it (and other background work).

Started from a post by @Anthropic (Claude Code docs), packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I make Claude Code keep going until the tests pass?
Summary: As of November 2026, Claude Code's /goal sets a completion condition such as all tests in test/auth pass and lint is clean. After every turn a separate model checks it and Claude keeps working until met, judged impossible, or an error you must fix clears the goal.
Copy for agent
get the whatworks thread claude-code-goal-keep-working-until-tests-pass and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-goal-keep-working-until-tests-pass
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks