Skip to content

Day 41 of 52 · about 15 min · Automation · Bonus

Keep Claude working until a goal is met

“Fix it” ends when Claude decides it is done. A goal ends when a separate check agrees: Claude keeps taking turns until the condition you wrote holds, and the goal clears itself if the check judges it impossible.

You’ll finish with

  • A goal that ran several turns and cleared when its condition held
  • The three verdicts: not yet met, met and impossible

You’ll need

  • A trusted project folder: /goal runs on the hooks system, so it waits for the trust prompt.
  • The practice project with npm test passing, or your own project with a test command

Before you start

Tell us about your setup and the steps change to fit it. Your answers stay in this browser, and you can change them at any time.

Which system are you on?

Commands differ between systems. Pick the one you’ll run Claude Code on.

The steps

One step at a time. When a step’s check matches, tick it and the next one opens.

0 of 3 steps done0%
  1. Step 1 of 3: Set a goal Claude can prove

    Name one end state, the proof you want and a turn limit.

    The check only reads the conversation. It doesn’t open files or run commands, so ask Claude to show the proof.

    In Claude Code

    You type: /goal every exported function in src/quote.js has a JSDoc comment with a @returns line, npm test exits 0, and no file in test/ changes. Show the comments and the test output as proof, or stop after 10 turns.

    What happens: A turn starts at once, with the condition as the instruction.

    One end state, a stated proof, one thing that must not change, and a turn limit.

    Check it worked

    A ◎ /goal active indicator shows how long the goal has been running.

    If it didn’t work

    Claude keeps asking before it runs `npm test`

    A goal keeps your permission mode. Approve the command, or use auto mode so turns run unattended.

  2. Step 2 of 3: Watch each turn get judged

    After every turn, a separate model checks your condition and gives a verdict.

    In order:

    1. Claude

      Claude finishes a turn

    2. Hook

      A small, fast model checks the condition

      Against what the conversation shows

    • If not yet met

      Claude takes another turn

      The reason guides the next step

    • If met

      The goal clears

      Recorded as achieved

    • If impossible

      The goal clears

      Recorded as failed, with the reason

    The model doing the work is not the one deciding it is done.

    Check it worked

    Each verdict appears in the transcript; Ctrl+O shows the reason. Once the comments and passing tests are on screen, the goal is recorded as achieved.

  3. Step 3 of 3: Check status, and see a goal fail

    Read the achieved goal’s summary, then set one that can’t be met.
    In Claude Code

    You type: /goal

    What happens: Shows the achieved condition, how long it took, the turns and the token spend.

    You type: /goal src/quote.js exports a function named rushFee, and src/quote.js is not changed

    What happens: The condition contradicts itself, so expect a failed entry with the reason.

    You type: /goal clear

    What happens: Removes a goal that is still active.

    Run the second goal in the practice project.

    Check it worked

    The impossible goal ends on its own with a failed entry and a reason. If Claude keeps working instead, /goal clear prints Goal cleared: and the condition.

Finish · 3 of 3 steps to go

Claude can now work until the job is provably done

Use a goal when the end is checkable: tests passing, a count at zero, a queue emptied. Put the proof in the condition.

What you’ll have checked

  • One goal achieved, with the proof in the transcript
  • One goal recorded as failed, with a reason

Lesson updates by email

Get lesson updates by email

Leave your email and we’ll tell you when we add or update a lesson.

We’ll email you when we add or update a lesson. We use your email only for this. Privacy policy

Claude Code for your team

Want Claude Code set up across your team?

HorizonLux sets up and repairs Claude Code for teams: CLAUDE.md rules, hooks that enforce them and reviewed MCP servers. Book a free call to talk it through.

Questions

Questions about Day 41

How is this different from the Stop hook on Day 14?

A goal lasts one session and you type it. A Stop hook lives in settings and runs in every session it covers.

What if Claude stops making progress?

After several turns with no tool use, Claude Code stops the loop, warns you and keeps the goal set. Checking resumes after your next prompt.

Sources

Checked against the official Claude Code docs on .

Independent resource, not affiliated with Anthropic. HorizonLux wrote this lesson; Claude Code is made by Anthropic.