Skip to navigation

Claude Code Stop Conditions: End at the Agreed Boundary

In short: Give Claude Code an explicit stopping rule tied to the requested outcome so completion does not expand into extra improvements.

Published 17 min read
On this page

A useful Claude Code stop condition names the desired end state, the evidence required to recognize it, and the follow-up work that remains excluded. Add clear decision points for when to continue, ask, or stop after a failed approach. “Do only what is needed” is too vague to serve as the whole rule. Written stopping guidance is advisory unless the integration enforces it. Official best practices documents /goal for long-running work and Stop hooks for enforcing conditions, but those mechanisms should not be described as interchangeable or universally available.

Why completion keeps expanding

A task without an end state invites extra improvements. Once the requested edit works, nearby naming, validation, formatting, or abstraction opportunities can look like part of the job. The diff grows even though the original outcome has not changed.

Expansion also makes completion harder to recognize. If success means “make the module better,” almost any additional edit can appear relevant. Reviewers lose the boundary that separates the requested result from optional polish.

A stop condition fixes the reference point before work begins. It names what is enough. Excluded work remains visible but outside the active path. A scope decision sits behind it, not merely a request for shorter output.

Use observable requirements to define the result, negative requirements to name exclusions, and acceptance criteria to clarify evidence. The task-breakdown guide helps connect steps to an inspectable state change.

False-success coverage and hard task-budget coverage are not repeated here. For those separate topics, see why passing tests are not proof and advisory limits versus hard stops. Here, the question is where the agreed work ends.

Stop-condition evidence map linking desired state, stop rule, decision point, and deferred work
Editorial evidence map based on official facts F088 and F089 plus independent fact F090. It distinguishes written scope guidance from enforced stopping.

What the evidence supports

Official, F088: Claude Code best practices documents /goal for long-running work and Stop hooks for enforcing conditions. The caveat controls this article’s wording: a written stopping rule is not deterministic enforcement. Verify the relevant surface before relying on either mechanism.

Official, F089: The official prompting best practices describes a chained pattern of drafting, reviewing against criteria, and refining in separate calls. That is API guidance. A universal Claude Code stopping mechanism is not defined by this pattern.

Independent, F090: Parallel’s acceptance-criteria overview defines acceptance criteria as conditions that determine whether a deliverable is acceptable. The supplied register records this source as search-index-only. Criteria do not automatically enforce an agent stop.

Common workflows is a fetched official companion source. The Agent SDK todo-tracking page is search-index-only in the supplied register. Neither is used here to invent an automatic boundary.

No verified benchmark in the packet measures scope expansion or stop-condition effectiveness. No community report is presented as evidence. The method below is an editorial workflow, not a measured improvement claim.

Restate the desired end state

Begin with a state that can be recognized. “The named validation block rejects empty trimmed input while preserving its existing result shape” is a state. “Improve validation” is a direction without a finish.

A useful end state names the target, the required change, and the most important protected behavior. Keep it stable while the implementation route changes. If the route changes but the desired state does not, revise the plan rather than rewriting success to match the work already done.

Desired state Required evidence Stop rule
Named guard handles whitespace Edited guard read in context Stop after the guard and protected surroundings are inspected
Duplicate helper removed Both former call sites inspected Stop when no in-scope caller uses the duplicate
Tool field renamed Definition and representative call reviewed Stop before unrelated schema cleanup
Long task reaches a decision Checkpoint names state, evidence, blocker, and next action Stop active edits while the decision is unresolved

The table contains illustrative states, not universal acceptance rules. Each project must decide what evidence is sufficient for its task.

The exact-target guide helps make a local end state precise. The refactoring-scope guide adds protected behavior when structure is changing.

Avoid defining success as the absence of possible improvements. There is always another cleanup opportunity. Success should describe the requested outcome, not an idealized repository.

Separate enough from perfect

An agreed boundary often stops before every related concern is resolved. That is not a failure of ambition. It is a decision about which uncertainty belongs to this task and which belongs to the next one.

Suppose the requested change corrects one guard, but inspection reveals an older caller with inconsistent behavior. Reaching the requested state may require recording that caller as a dependency question. Caller migration remains outside that state unless explicitly requested. The distinction prevents a local correction from becoming an interface project.

Write the remaining uncertainty beside the stop rule. A useful note says what is known, what is not, and who owns the next decision. The result keeps “enough” from being mistaken for “complete in every respect.”

F090’s acceptance-criteria definition supports predefined conditions for acceptability, but each project must choose those conditions. A boundary should be demanding enough to meet the request and narrow enough to leave unrelated work alone.

Name the required evidence

A stop condition needs a way to recognize the desired state. Naming the artifact or observation that closes the task comes first. Evidence can be an inspected block, a recorded decision, or an existing project check relevant to the requirement.

Keep the evidence requirement proportional. A one-block edit does not need a new audit system. A cross-module refactor may need evidence from each protected interface. The point is traceability, not ceremony.

Official prompting guidance supports inspecting intermediate outputs through chained API calls under F089. A written checkpoint can serve a similar editorial purpose inside a run, but the mechanisms are not the same. The checkpoint guide provides a four-field format for state, evidence, blocker, and next action.

Evidence should answer a specific question. “Read the edited guard and confirm the neighboring return remains unchanged” is useful. “Verify everything” is not.

When required evidence is unavailable, the task has not reached its stop state. Record the gap and choose the next action. Missing evidence cannot be replaced by a confident summary.

Name the excluded follow-up work

Exclusions prevent adjacent improvements from becoming implicit requirements. Name them concretely enough that a reviewer can recognize when the boundary has been crossed.

Useful exclusions include:

  • Unrelated files or modules.
  • New validation rules beyond the agreed behavior.
  • New abstractions or public interfaces.
  • Formatting or naming cleanup outside the target.
  • Feature requests discovered during the edit.
  • Broader migrations that share the same code area.

An exclusion should not forbid a necessary dependency blindly. If the requirement cannot be met without a related change, name the dependency and seek a decision. The negative-requirements guide explains how to make exclusions reviewable without treating them as automatic enforcement.

Stop-condition tradeoffs contrasting the desired state and stop rule with optional follow-up work
Editorial tradeoff diagram using F088 to F090. A clear boundary separates required evidence from optional improvements.

Capturing deferred work matters more than performing it. A short item can name the observation, why it is outside scope, and the likely future owner. That preserves the idea without expanding the current diff.

The local-pattern guide is helpful when a deviation looks tempting. Consistency may justify a small conventional choice, but it does not authorize a module-wide cleanup.

Define when to ask for a decision

Some unknowns are product decisions, not search problems. A stop condition should name the situations that require a human answer before work continues.

Examples include conflicting caller contracts, an unclear default, a missing acceptance condition, or an interface change that affects consumers outside the task. More searching may not resolve those questions.

A good decision request names:

  1. The decision that is blocked.
  2. The evidence already inspected.
  3. The competing interpretations.
  4. The consequence of choosing each path.

The clarification-before-choosing guide separates discoverable code facts from decisions a person must own. Use that distinction instead of interrupting for every unknown.

Once a decision is requested, stop active edits in the affected area unless the agreed plan explicitly allows independent work. Record the blocker in a checkpoint so the pause has a clear resume point.

Define when to stop after a failed approach

A failed approach is information. It can show that a precondition does not hold or that the planned route cannot meet the contract. Stopping prevents repeated speculative edits from hiding the original problem.

Set a boundary for retrying or changing direction. For example: “If the unique anchor no longer matches after re-reading current contents, stop and revise the target.” That rule is concrete. “Try harder” is not.

Continue Ask Stop
Evidence supports the next small action A product choice blocks the route Required evidence is unavailable
A precondition holds Callers disagree on the contract Repeated edits no longer address the objective
The desired state is still unmet An adjacent change expands scope The structural or behavioral goal is already met
A failed attempt revealed a narrower route The route changes the agreed direction Further work would implement excluded follow-up

The decision matrix is illustrative. No universal retry count or task budget is imposed. It ties action to evidence and scope.

After a failed approach, record what changed in your understanding. The plan-revision guide explains how to name evidence that invalidates a plan. A direction change belongs in a revised plan, not hidden inside continued execution.

Stop-condition workflow moving from desired state through stop rule and decision point to deferred work
Editorial workflow derived from F088 to F090. It organizes scope decisions without claiming deterministic enforcement.

Use goal conditions only where documented

F088 records /goal for long-running work and Stop hooks for enforcing conditions in official best practices. Keep their roles separate. A written goal describes the intended outcome. An enforced condition belongs to an integration mechanism that can actually stop behavior.

Universal availability of the same controls cannot be assumed. A prose stop rule is not a hook, and a hook does not guarantee product correctness. Enforcement and correctness are different questions.

Before relying on a documented mechanism, verify the surface and current documentation. This article does not provide hook configuration or server setup. It focuses on the semantic condition that the mechanism would enforce.

A practical distinction is:

  • Written rule: tells the agent what state is enough and what to defer.
  • Task status: signals progress on a defined item.
  • Enforced condition: uses a supported mechanism to stop under stated circumstances.
  • Evidence: shows whether the requested state was reached.

The Agent SDK todo-tracking fact in the packet says item status is updated as work proceeds. Status is a progress signal, not an enforced stop or independent proof of completion.

Stop-condition controls covering desired state, stop rule, decision point, and deferred work
Editorial control checklist grounded in F088 to F090. Written guidance, status signals, and supported enforcement remain distinct.

A worked stop-condition brief

Suppose the request is to rename one tool input without changing the tool’s purpose or return contract. A scoped brief could read:

Desired state: The invoice lookup tool uses invoice_id in its input definition,
and the representative call supplies that field.
Required evidence: Read the changed definition and the reviewed call together.
Excluded work: Do not rename other fields, change the tool purpose, alter the
return contract, or reorganize neighboring definitions.
Decision point: If another caller depends on the old field, stop and ask whether
interface migration is in scope.
Failed-approach boundary: If the definition no longer matches the inspected
anchor, stop and re-establish the target before editing.
Finish: Report the inspected definition, reviewed call, and any deferred item.

The brief names a finish and a boundary. Phrases such as “keep it simple” or “do only what is needed” leave the important decisions unresolved.

If inspection finds another caller using the old field, the decision point activates. The agent should not silently migrate that caller. The scope owner must decide whether the rename remains local or becomes an interface change.

Once the definition and representative call are inspected, the desired state is met. Further naming polish belongs in deferred work. The schema guide can inform a later task without expanding this one.

Inspect the final state against the boundary

Final review should compare the current state with the desired state, required evidence, and exclusions. Review the full boundary, not only the last edit. Check whether earlier changes remained inside it.

Useful final questions include:

  • Is the desired state present now?
  • Was the required evidence actually inspected?
  • Did any edit implement excluded follow-up work?
  • Does a deferred item need an owner?
  • Did a failed approach change the agreed direction?

A boundary review is what follows, not a replacement for project verification. The verification guide covers completion evidence separately. Here, the additional question is whether the work went farther than agreed.

Record the result plainly. If the desired state is present but an exclusion was crossed, say both facts. Partial success does not excuse a scope problem.

An inspectable checkpoint can hold the final state and deferred items. A concise checkpoint supports the next decision.

Record deferred work without doing it

A deferred item should be easy to distinguish from active work. Name the observation, the reason it was excluded, and the next owner or decision.

Deferred item Reason Future owner or action
Rename two neighboring fields Outside the agreed single-field change Schema owner reviews a separate task
Replace a duplicated helper Structural cleanup was not requested Refactor owner assesses the contract
Add a missing validation rule Changes behavior rather than structure Product owner decides the requirement
Update a caller using the old field May expand the interface migration Scope owner decides whether to reopen the task

The table is illustrative. Immediate tracking of every observation is not required. The purpose is to preserve useful information without performing excluded work.

Avoid turning the deferred list into a second implementation plan. A short description and owner are enough. Detailed design can wait until the work is accepted into scope.

The stop-condition decision matrix helps determine whether an observation is truly deferred or whether it blocks the current outcome. A necessary dependency is different from optional polish.

A practical stopping runbook

Use this sequence before execution and again at the finish.

Stage Question Record
Desired state What observable result is enough? Stable end-state sentence
Evidence What must be inspected to recognize it? Named artifact or observation
Exclusions What work must remain outside scope? Concrete deferred categories
Decisions Which unknowns require a person? Decision request format
Failure When should an approach end? Evidence-based stop trigger
Enforcement Is a supported mechanism being relied on? Verified surface and documented role
Final review Does current state match the boundary? Result plus any scope crossing
Deferral What useful work remains undone? Item, reason, and future owner

This runbook is an editorial control grounded in F088 to F090. Prose alone remains advisory rather than deterministic.

The boundary needs to stay visible during long work. A checkpoint can restate the desired state when new evidence makes extra work look attractive. Repetition is useful only when it protects an actual decision, not as ritual.

Match the boundary to the work

Different tasks need different evidence, but the same structure applies. A local edit can stop after contextual inspection. A structural refactor also needs its protected interfaces checked. A tool-definition change needs a representative call reviewed. The boundary grows only when the contract grows.

Work type Enough state Work to defer unless requested
Local code edit Named block changed and surroundings inspected Unrelated naming or module cleanup
Tool definition revision Definition and representative call reviewed Broader schema reorganization
Behavior-preserving refactor Structural goal met and protected relationships inspected New behavior or interface migration
Exploration task Blocking unknown resolved and recorded Implementation before a decision
Documentation task Requested sections and sources present Unrelated editorial restructuring

The table serves as an editorial decision aid. One inspection does not prove every task correct. It shows how a stop rule can name a proportionate finish.

When the requested work crosses several categories, combine their evidence requirements explicitly. The broadest category is not permission to expand. Each added requirement should trace to the agreed outcome.

Concrete win, loss, and implication

Win: A one-field tool rename stops after the definition and representative call are inspected. Two neighboring naming opportunities are recorded for later. The win is a finished, reviewable change instead of an expanding schema cleanup.

Loss: A precise written stop condition can still be ignored or misapplied because prose is advisory. The loss is the gap between an agreed boundary and enforced behavior. F088 supports Stop hooks on a documented surface, not a universal guarantee for every session.

Implication: Name the desired state, evidence, exclusions, decision points, and failed-approach boundary before work begins. Use documented enforcement only where supported. Inspect the final state against the original boundary and record deferred work without doing it.

Stop-condition verdict balancing an explicit desired state and stop rule with advisory enforcement limits
Editorial verdict using F088 to F090. A boundary can be clear without being deterministic unless a supported mechanism enforces it.

Data gap and future update

The packet contains no verified benchmark for stop-condition effectiveness, scope expansion, or enforced stopping. Universal availability of /goal or Stop hooks across interactive surfaces remains unestablished. No community issue is used as evidence.

A future update should add reproducible examples on named surfaces, distinguish prose guidance from supported enforcement, and record observed scope outcomes. Documentation is live and should be rechecked before publication.

The acceptance-criteria source is search-index-only. Criteria can clarify the desired state, but they do not automatically enforce a stop. Until stronger evidence exists, this article offers a boundary-design method rather than a performance claim.

One AI option for OpenAI-format agents

For separate OpenAI-format agents, One AI provides one key and 46 live free IDs through https://api.oneaiapikey.com/v1. Inspect the free model list or follow the OpenAI-format quickstart. This is not a Claude Code model source. The packet records the Claude IDs as unavailable on 2026-11-27, and the free IDs must not be described as working inside Claude Code.

FAQ

Is “do only what is needed” a sufficient stop condition?

No. That phrase omits the desired state, required evidence, exclusions, and decision points. Replace it with a boundary that can be recognized and reviewed.

Does a written stop condition guarantee the agent will stop?

No. Prose is advisory unless a supported mechanism enforces it. F088 distinguishes documented Stop hooks from a written rule, and surface availability still needs verification.

When should work stop after a failed approach?

Stop when required evidence is missing, a precondition fails, the agreed direction would change, or further edits would implement excluded work. Record the reason and choose a new decision path.

What belongs in a deferred item?

Name the observation, why it is outside scope, and the future owner or decision. Perform deferred work only after it enters scope.

Connect stop conditions to the batch

Define the boundary with observable requirements, goals, rules, and examples, and negative requirements. Clarify evidence through acceptance examples, clarification before choosing, and prompt specificity.

Plan through structured agent briefs, plan-mode approval, bounded exploration plans, and task exit conditions. Keep read-before-edit dependencies explicit and use new-evidence replanning when the route changes.

For tool work, compare unambiguous schemas, investigation before answering, independent parallel reads, and evidence-bearing results. Keep deferred tool definitions within the documented API boundary.

For execution quality, read inspectable checkpoints, exact block targets, local style patterns, and behavior-preserving refactor scope.

More Claude Code troubleshooting

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
  • 100requests
    per day
  • 3Mtokens
    per day
  • 47free
    models
  • $0per
    token
  • No card
  • No end date
Claim $10 credit →