# Name a target, and let the agent finish it

**Ask once: the agent works through everything before the target, closes what you let it close, and stops at the first choice that is yours.**

An agent told to "finish the export" needs two things it cannot work out on its own: what it may do to finish a task, and which choices are its to make. Those differ for everyone — one person lets it merge, another lets it send a return — so they are written once, as a standing rule, and the agent records its run under that rule: every write it makes without a cause of its own carries the rule as its cause, so nothing it does is flagged and nothing cites the rule by hand. The loop itself is the same for everyone: read what is ready before the target, take one, finish it, read again. A choice the rule does not give the agent holds only the piece it is about, so that piece waits on the person, with the question, the options and a recommendation in its wait, which takes it out of the ready set without anyone judging anything. What the agent notices and does not need is set aside as an idea with where it was seen, linked to nothing, so the target grows only by what the work requires. When nothing before it is ready, the agent stops and says what is left; the person's answer is the cause of the move that starts the piece again.

Driven by a person and an agent. Every step below is a step in
`packages/server/tests/e2e`, run against a listening server on every pull
request; the calls under each one are what that run executed.

The same flow is playable at https://flow.ttoss.dev/docs/examples/pursue-a-target.

## 1. Ana points her agent at the repository she works in

- `POST /api/v1/projects` → `201`

## 2. She writes down, once, what an agent may do to finish a target

- `POST /api/v1/tasks/batch` → `200`

## 3. The export ships when two pieces are done, one after the other

- `POST /api/v1/tasks/batch` → `200`

## 4. Ana asks her agent to finish the export; it records its run under the rule and reads what is ready

- `POST /api/v1/agent-runs` → `200`
- `GET /api/v1/next?upstream_of=task_hma1zg1cfz` → `200`

## 5. It takes the first piece in its run and closes it with the merged PR, the rule as the cause

- `POST /api/v1/agent-runs` → `200`
- `PATCH /api/v1/tasks/task_6kn67j4xhp` → `200`
- `GET /api/v1/tasks/task_6kn67j4xhp` → `200`

## 6. The next piece is ready now, and it takes that one

- `GET /api/v1/next?upstream_of=task_hma1zg1cfz` → `200`
- `POST /api/v1/agent-runs` → `200`

## 7. The piece needs a choice the rule does not give it, so the piece waits on Ana with the question

- `PATCH /api/v1/tasks/task_wn6b9davsw` → `200`

## 8. What it noticed and does not need is set aside as an idea, not added to the target

- `POST /api/v1/tasks/batch` → `200`
- `GET /api/v1/order?upstream_of=task_hma1zg1cfz` → `200`

## 9. Nothing before the target is ready, so the agent stops and says what is left

- `GET /api/v1/next?upstream_of=task_hma1zg1cfz` → `200`
- `GET /api/v1/tasks/task_wn6b9davsw` → `200`
- `POST /api/v1/agent-runs` → `200`

## 10. Ana answers, and her answer is the cause of moving the piece back to active

- `PATCH /api/v1/tasks/task_wn6b9davsw` → `200`
- `GET /api/v1/tasks/task_wn6b9davsw` → `200`
- `GET /api/v1/next?upstream_of=task_hma1zg1cfz` → `200`

## 11. The next run under the rule finishes it, and closes the target once nothing before it is open

- `POST /api/v1/agent-runs` → `200`
- `PATCH /api/v1/tasks/task_wn6b9davsw` → `200`
- `PATCH /api/v1/tasks/task_hma1zg1cfz` → `200`
- `GET /api/v1/tasks/task_hma1zg1cfz` → `200`
