Send with Goal
Instead of nudging the agent turn by turn, you declare a success criterion. An independent goal-agent supervises every turn and decides for itself: keep pushing the agent, or declare the goal achieved.
How it works
The Send with Goal button sits next to Send in the chat composer. Clicking it opens a modal where you declare three things: the success criterion, the goal-agent that supervises, and the maximum number of iterations.
You send with a goal
Your composer text is forwarded to the target session, and an ACP goal-agent is spawned concurrently.
The target agent works
The agent runs its turn as usual — editing code, running commands, responding.
The goal-agent evaluates each turn
When the target turn ends, the backend hands the goal-agent a rendered prompt with context, then reads its decision.
Continue or complete
The response is parsed for an action directive. continue → forwarded as the next prompt to the target agent. complete → the goal transitions to achieved.
The goal-agent prompt template
On each evaluation, the backend renders a template with context placeholders and sends it to the goal-agent. The goal-agent replies with a structured action directive.
Template placeholders
| Placeholder | Description |
|---|---|
| {{goal}} | The success criterion you declared |
| {{conversation}} | Recent conversation context |
| {{iteration}} | Current iteration number |
| {{maxIterations}} | Maximum iteration cap |
Action directives
| type | Description | Outcome |
|---|---|---|
| continue | Agent should keep going — text inside the action tag | Forwarded as the next prompt to the target agent |
| complete | Goal is satisfied | State moves to achieved |
The goal-agent runs as its own ACP connection, separate from the working agent. It only observes and decides continue/complete — it does not edit your code directly.
The four termination paths
A Goal loop always ends in exactly one of four ways — there is no infinite loop:
| Stop reason | Description |
|---|---|
| Goal achieved | The goal-agent returns complete. State moves to achieved. |
| Iteration cap reached | Turns reach maxIterations without completing — the loop stops safely. |
| User presses Stop | You can always stop manually at any time. |
| Parse-failure ×2 / agent exits | Action directive fails to parse twice in a row, or the goal-agent exits. |
Tracking & recovery
Goal state shows through a chip on the target session, with a detail panel. Each goal record is persisted per target session in settings.json. On backend restart, active goals resume, capped at the 50 most recent records.
The more verifiable your criterion, the more accurately the goal-agent decides. “All unit tests in the auth module pass” is far better than “make the login feel better”.