# goal

Let the phases run on their own in your agent's chat. Your agent runs each phase in a fresh child and stops at the phase you name or at the first problem.

## When to use it

Use it after `refine`, when several phases are ready and you trust the plan. You can leave it running and do something else; it stops and reports why when it needs you. Your agent must support long-running goals and isolated subagents; if it does not, `goal` says so and changes nothing. It never moves `nextAction` itself.

## How it works

1. Junji hands your agent one objective: run runnable phases one at a time.
2. For each phase the agent starts a fresh child with `/junji next --subagent`, waits for its report, then rereads the board.
3. It stops at the phase named by `--until` (inclusive), at a red check, at a gated phase, or when no runnable phase is left. It never retries, never runs `consolidate` or `iterate`.

Options:

- `--until P4` stops after P4. `4` and `p4` also work; `--until=p4` does not.
- `--allow-gated` authorizes every gated phase in this goal, subject to standing overrides.
- `--review` alternates: drain the phases, run `/junji review`, drain the fix phases it adds, review again. It stops on approval, a halt, or after three review rounds.

Unlike Yokai, `goal` has no separate judge, no recovery and no cost ceiling, and your agent has to stay open while it runs. Each child runs the normal `next`. For a run in a terminal, on a server or in CI, see [Run on its own](/en/docs/koi/autonomous).

## Example

```text
/junji goal --until P4
```

When it stops, read the reason in its report. At the end of the board, ask for a `brief` and try the change.

## What can go wrong

- Your agent has no goal or subagent tool. Use `next` repeatedly, or Yokai.
- It stops at a gated phase. That is the default. Rerun with `--allow-gated` if you approve.
- `--until` names a phase that is not on the board. The goal is not created.

## Cards to read next

- [![](/art/verbs/brief-card.webp) brief · Try what shipped](/en/docs/junji/brief)
- [![](/art/verbs/review-card.webp) review · Review the branch](/en/docs/junji/review)
