Skip to content
docs

Goal mode

Normally the agent replies and hands control back to you. Goal mode changes that: you set a completion condition once, and the agent keeps working turn after turn until the condition is met.

After each turn, an evaluator model reads the conversation and answers “met” or “not met” with a short explanation. If the goal is not met, the explanation is passed to the agent as a hint, and the agent starts the next turn on its own. If it is met, the goal is cleared automatically.

/goal all tests in tests/auth pass and the linter is clean

A goal makes sense when the work has a checkable end and many similar steps:

  • migrating a module to a new API until every call site compiles and the tests are green;
  • implementing a spec until every acceptance criterion is met;
  • working through a long list of linter warnings until the list is empty;
  • splitting a large file into modules until each one fits the line limit.

When not to use it: a short edit, open-ended exploration with no clear result (“see what could be improved”), or a task where you judge success by eye. In these cases the loop circles around a vague condition and wastes tokens.

CommandWhat it does
/goalShows the active goal, the number of turns taken, and the limit
/goal <condition>Sets the goal. A new goal replaces the previous one. The condition should describe a checkable result
/goal clearClears the goal. off, stop, reset, none, and cancel also work
/goal --model <model> <condition>Sets the goal with a different evaluator model

The goal takes effect from the next turn: setting it does not start any work, so send your prompt as usual. While a goal is active, the status bar shows a goal label, and /goal and /status show the condition and progress.

The browser has no command for this: a target button next to the input field sets the goal. The same button shows the current condition and clears it, and in the session list, sessions that run toward a goal show the same target.

One goal per session. /new starts a session with no goal.

The evaluator judges by the conversation alone: it does not run commands or read files itself. So the condition must be checkable from what the agent has already shown in the chat. “All tests in tests/auth pass” works, because the agent runs the tests and their output ends up in the conversation. “The code is cleaner” does not work: there is nothing to confirm it with.

The evaluator requires evidence: command output, a file and line, or a returned value. The agent saying “done” does not count as evidence, and without evidence the answer is “not met”.

What to include in the condition:

  • One measurable state. A test result, a build exit code, an empty list, a number of files.
  • How to check it. How the agent should show it: “make test exits without errors”, “git status is clean”.
  • Boundaries. What must not change along the way: “don’t touch other tests”, “no new dependencies”.

Bad: do it properly, fix the bugs, improve performance. Good: make lint and make test pass without errors, and the public API of the auth module is unchanged.

If no goal is set, the agent may suggest a condition itself, once per session, on the first prompt longer than a couple of words. A suggestion does not always appear: it is meant for substantial multi-step work with a checkable result. For questions, explanations, and small edits, the agent suggests nothing and replies as usual.

When there is a suggestion, it appears in an approval dialog together with how it will be checked. y or Enter sets it as is, e puts /goal <condition> into the input field for editing, and n or Esc declines it. In the browser, the suggestion appears as a line above the input field: one button sets it, and the cross declines it. To turn the suggestion off entirely:

.waibee/settings.json
{ "goal": { "auto_goal": false } }
  • Turn limit. The goal.max_iterations key sets the number of turns with a goal check, including the first; the --goal-max-iterations flag sets it for one run. When the limit runs out, the goal is cleared and work stops.
  • Work does not converge. If the agent calls no tools for several turns in a row and the goal is still not met, the goal is cleared.
  • Evaluator failures. A check that fails with an error gives no verdict, so the agent does not start the next turn on its own and waits for you. If the check fails several times in a row, the goal is cleared instead of leaving the session hanging.
  • Provider content filter. A goal does not continue after the provider’s filter stops a reply. See Provider content filter.
  • Permissions stay the same. A goal does not widen permissions: if the permission mode asks before running commands, it asks on every turn. For unattended work, switch the mode to trust with Shift+Tab: in acceptEdits commands still ask. See Permissions.
  • Manual stop. /goal clear at any time. Esc interrupts the current turn, but the goal stays set.

The limit, the evaluator model, and the auto goal are set with the goal.* keys; see the Settings reference. Project settings override global ones, so you can keep the limit and the evaluator model next to the code they judge. For a single use, set the same things on the spot: /goal --model <model> in the TUI, --goal-model and --goal-max-iterations in headless mode. By default the evaluator is the helper model selected at the moment the goal was set.

Evaluator calls also use tokens, but most of the cost comes from the loop itself: the agent works as many turns as it needs, so a goal with a vague condition is expensive.

If no goal is set, the agent may pick one for the task and set it without asking. Auto selection does not guarantee a goal: for a simple task it may skip the loop.

CallWhat happens to the goal
waibee run "a large task"Tries to pick a goal automatically
waibee run --goal "..." "task"Uses yours; auto selection does not run
waibee run --once "task"No auto goal selection
waibee run "ok"A short prompt runs without auto goal selection

The same "auto_goal": false as in the TUI turns auto selection off entirely.

Terminal window
waibee run "move the auth module to the new client" \
--goal "make test passes, the old client is not used in any file"
waibee run "..." --goal-max-iterations 20 # your own limit on turns with a goal check
waibee run "..." --goal-model <model> # your own evaluator model
waibee run "..." --once # no auto goal selection

--goal-max-iterations and --goal-model also apply to an automatically selected goal, not only to one set with the --goal flag.

What you see on screen. In text format, the condition and the progress of the check go to stderr, and the reply stays in stdout, so $(waibee run ...) captures only the reply:

Terminal window
goal: tests in tests/auth pass - proved by: make test exits without errors
continuing: the tests ran, but two in auth::session fail
goal met

The evaluator’s reason comes as a paragraph, and the terminal shows only its first line. If the goal is cleared without being met, the last line is goal aborted: with the reason: max_iterations, not_converging, or consecutive_eval_failures. In the event stream (--output-format stream-json), the same information arrives as goal_* events; see Event stream.

If the active goal is not met, the run exits with code 1, even when the agent chose the goal itself. For a predictable success criterion in CI, set --goal explicitly. --once turns off auto selection, but an explicitly set goal and a restored goal stay in effect. The full table of exit codes is in the headless guide.