DocsGuides

Goals

Tell the agent what to do and what counts as done; it works in passes until the measurement says the goal is reached.

A goal is an instruction plus a result that counts as done. The agent works on it in passes. Each pass is a fresh single-agent run in the same chat. After each pass, Rusty measures the code and decides whether to go on. The agent never ends a goal by saying it is finished: the measurement decides.

A goal can be any kind of work:

  • a task goal, any instruction ("add CSV export to the report page", "migrate the settings to the new store", "document every public module"): the first pass plans it, later passes carry the plan on, and it ends when the plan is finished, the checks pass and the result is judged done;
  • a quality goal, with a code health target (health=, mean= or severity=): it ends when the measurement says so, for work like "rewrite this module until it is healthy".

Starting a goal

Type /goal in the Agent tab, followed by options and what to do. There is no other format to learn: the options are optional key=value pairs at the start, and everything after them is the instruction, in your own words. Say what you want and what counts as done; the first pass works out the plan from it.

/goal Add CSV export to the report page; the export button downloads every visible column
/goal checks=typecheck,test scope="the task queue and whatever schedules it" Make retries back off exponentially
/goal mean=8.5 health=6 Raise rusty-core's code health; split the worst files by responsibility
/goal scope=src/harness/core/run/** health=8.5 checks=typecheck,test Split CoreRun into smaller modules

Quote a value that has spaces. Unquoted words that are not paths (scope=The health is ...) are read as the start of the instruction.

Option Meaning
scope="in words" The scope as a description (quoted, with spaces). The passes work out the files from it and keep their plan within it. A code health goal is measured on the repository it or the instruction names.
scope=a,b Paths: files, folders or globs the targets are measured on (scope=rusty-core, scope=src/**/*.rs); scope=changed means the files the passes change. Attached files are added. A scope that names no file, folder or glob is refused. Without a scope, a goal on code health is measured on the repository the instruction names, else the active one; a goal with only checks measures the files the passes change.
health=8.5 Every file in scope has a code health score of at least this (1-10). Only structure counts; change history is not something a pass can fix.
mean=8.5 The mean score of the files in scope is at least this. Like health=, it counts structure only, so it can be higher than the Code Health page's score, which includes change history.
severity=medium No code health finding in scope is more severe than low, medium, high or critical.
checks=typecheck,test Checks that must pass. Each pass runs them with run_check; only a whole check run after the pass's last edit counts.
loops=8 Passes before the goal pauses (passes= is the same, 1 to 100). Without it there is no limit: passes go on until the goal is done, blocked, or three passes in a row make no progress.
guidelines=off Do not require "no guideline errors" (on by default).
keep=all Keep a pass even when it makes things worse (by default it is undone).
done="..." A result in words. The reviewer judges it, and its answer counts only once every measured target is met.

With no code health target, the goal is a task goal. A goal needs a skill selected, because its passes run on the single agent.

Task goals

/goal checks=typecheck,test Add CSV export to the report page
  1. The first pass plans the whole goal: it reads what it needs, then writes every step to the result as its to-do list, each naming the files or area, the change and how it is verified.
  2. The plan is kept in the goal file. Each later pass is shown the plan as it stands ([x] done, [ ] open), re-posts it, adds steps it has found, and takes the next open steps. A step is marked done only once it is verified.
  3. Done needs all of: every step closed (completed, or cancelled because it turned out unnecessary), every check the pass ran passing (plus the checks= you asked for), no guideline errors in the changed files, and the reviewer judging the goal done. The agent saying it is done is not enough. A pass that cancels more steps than it completes has them reopened.
  4. Progress is more steps done, fewer failing checks, or code changed while the plan is worked (a large step can take more than one pass). New code may score lower than old code, so a task pass is undone only when it breaks a check that passed or adds guideline errors.

To add a quality bar to a task, measure only what it changes: /goal health=8 scope=changed Add CSV export.

Each pass of a quality goal

  1. Rusty measures the scope (code health, guideline errors) and records the workspace under a hidden Git ref (refs/rusty/checkpoints/goal/...). This never moves a branch or touches the index.
  2. The agent gets the goal, where it stands and a work list: the files still missing a target, worst first, with the findings worth the most. It plans the pass first (one to-do per file, with the findings it will fix) and takes on at least its share of the list: what is left divided by the passes left (by five without a limit), and at least three files. It ends with Next: <what the next pass should take on>, which the next pass is given along with what earlier passes did.
  3. When the pass ends, Rusty measures again and decides:
    • done: every target is met (a scope in which nothing could be measured never is);
    • undone: a check that passed now fails, there are more guideline errors, or the scores dropped. The pass's changes are put back and the next pass is told to try another approach;
    • paused: three passes in a row made no progress (or the reviewer gave the same reason three times), or the loops= limit is reached;
    • blocked: the reviewer found the goal needs something only you can provide;
    • otherwise the next pass starts.

Each pass adds a line to the chat with its verdict and the measurement before and after.

The reviewer

After every pass, before Rusty decides, a reviewer reads what the pass left: its diff since the checkpoint, the checks, the plan and the agent's final message. It is one call to the chat's model with no tools, and it answers done, continue (with what is missing and the next concrete step) or blocked. The agent's own claims are not evidence to it: a pass cannot end its goal by saying it is done, or that the work is too large or risky to start.

  • Blocked is only for what you alone can provide: a decision, a credential, a value that is in neither the code nor its history, or a manual step. Large, risky or coordinated work is never a blocker.
  • The reviewer's next step is the first thing the next pass is told to take on.
  • If the reviewer gives no usable answer, the pass's own Status: and Done when: lines are used instead.

Controlling a goal

Command What it does
/goal or /goal status Shows the chat's goal: status, passes used, where it stands.
/goal pause Stops after the running pass.
/goal resume Measures again and starts the loops= count afresh.
/goal clear Deletes the goal.

Sending any other message pauses a running goal: you have taken over. A pass that fails or is stopped also pauses it.

Where goals are kept

Each goal is a file in the workspace, .rusty/goals/<id>.json, which holds its targets, the measurement it started from, the last accepted measurement and a journal of the passes. Next to it, <id>.checkpoint.json names the snapshot the running pass started from.

Esc

Type to search the docs.