---
title: "#24: Working Toward a Goal"
description: "/goal, which lets us hand Claude Code a finish line and have it keep working until it gets there. Normally Claude does a turn and hands control back to us."
url: https://littlecupsofclaude.com/24
date: 2026-11-26
author: Jake Marsh
topics: ["Workflows", "Claude Code CLI"]
---

# #24: Working Toward a Goal 🎯

> /goal, which lets us hand Claude Code a finish line and have it keep working until it gets there. Normally Claude does a turn and hands control back to us.

Published 2026-11-26 by Jake Marsh on Little Cups of Claude. Canonical: https://littlecupsofclaude.com/24
Topics: [Workflows](https://littlecupsofclaude.com/topics/workflows), [Claude Code CLI](https://littlecupsofclaude.com/topics/claude-code-cli)

Today we'll look at `/goal`, which lets us hand **Claude Code** a finish line and have it keep working until it gets there.

Normally **Claude** does a turn and hands control back to us. With a goal set, a separate model checks after every turn whether our condition holds, and if it doesn't yet, **Claude** just starts another turn. Let's dive in.

## Setting A Goal

We type `/goal` followed by the condition:

```text
/goal all tests in test/auth pass and the lint step is clean
```

That starts a turn right away, with the condition itself as the instruction, so there's no separate prompt to send. A `◎ /goal active` indicator shows how long it's been running, and only one goal can be active per session.

## What Makes A Good Condition

The evaluator doesn't run commands or read files on its own. It judges our condition against what **Claude** has surfaced in the conversation. So the best conditions are things **Claude's** own output can prove:

```text
/goal every call site of fetchUser uses the new client,
`bun test` exits 0, and no test file other than
user.test.ts is modified
```

That's one measurable end state, a stated check, and a constraint on what can't change along the way. Conditions can be up to 4,000 characters.

## Putting A Cap On It

To bound how long a goal runs, we add a turn or time clause right in the condition:

```text
/goal migrate src/legacy to the v2 API, or stop after 20 turns
```

**Claude** reports progress against that clause each turn, and the evaluator judges it from the conversation like everything else.

## Checking In

Running `/goal` with no argument shows the condition, how long it's been running, how many turns have been evaluated, the token spend so far, and the evaluator's latest reason. Pressing `Ctrl+O` while it runs shows the reason behind each verdict.

To bail out early:

```text
/goal clear
```

`stop`, `off`, `cancel`, and a few others work too. Running `/clear` also removes the goal.

## Running It Unattended

`/goal` works with `-p` as well, running the whole loop in one invocation:

```bash
claude -p "/goal CHANGELOG.md has an entry for every PR merged this week" \
  --output-format stream-json --verbose
```

With the default text output, nothing prints until the loop ends, so a long goal can look stuck. The `stream-json` flags show each message as it goes.

A goal doesn't change our permission mode. In Manual mode, **Claude** still stops to ask about tools our settings don't allow, so pairing `/goal` with auto mode is what lets it run hands-off. Auto mode removes the per-tool prompts, and `/goal` removes the per-turn ones. Neat!

## Watch Out

The goal clears on its own when the evaluator says it's met, when it judges the condition impossible, or when a turn fails on an error we have to fix, like an exhausted credit balance. If **Claude** keeps answering without using any tools for several turns, **Claude Code** stops the loop and hands control back with the goal still set.

Under the hood, `/goal` is a session-scoped prompt-based **Stop** hook running on the small fast model, so it's unavailable when hooks are turned off with `disableAllHooks`.

More info about **goals** can be found at [the Claude Code docs](https://code.claude.com/docs/en/goal).
