# next

One call runs one phase end to end: plan it, implement it, run every check, record the outcome and commit. It never starts the following phase.

## When to use it

Use it after `refine`, once there are cards on the board and a verification bar in `CONTEXT.md`. Run it once per phase, in a fresh chat each time if you like. Typing "do the next task" also runs it. To let the remaining phases run on their own, use [`goal`](/en/docs/junji/goal) or [Yokai](/en/docs/koi/autonomous).

## How it works

1. Load state. Junji reads `CONTEXT.md`, `BOARD.json`, `NOTES.md`, `METHOD.md` and `DESIGN.md` if present, and picks the phase in progress or the first `todo` card. A gated card stops here and asks you.
2. Phase research. It reads the source files the phase names.
3. Phase plan. It writes `.koi/run/phases/phase-NN-<slug>.md` with an "Explicitly out" list and numbered steps, and sets the card to `planning`. An existing phase file is reused.
4. Implement. It sets the card to `building` and changes only what the phase needs. Ideas outside the phase go into the plan as follow-ups.
5. Verify. It runs every command in the verification bar from its working directory. Every one must exit 0. A failure leaves the card at `building`; the bar is never weakened.
6. Record. It sets `sealing`, then `done` with a short outcome, moves facts later phases need into `NOTES.md`, adds an Outcome to the phase file and updates `nextAction`.
7. Commit. One conventional commit, honoring standing overrides such as "never push".

`--subagent` asks your agent for one isolated child to run the phase. The child rereads `.koi/run/`; your window only posts its report.

## Example

```text
/junji next
```

The report starts with the position: `Phase 2 of 4 — Persist tasks`, `Next action: /junji next`, then the result, such as "all four checks pass".

## What can go wrong

- A check fails. The phase stays open and nothing is committed. Fix the cause and run `next` again.
- The phase is gated. Approve it in the chat if you mean to. Configuring Yokai does not count.
- Two cards are in flight. `next` asks you to leave only one.
- The agent wants to fix something nearby. It should record it as a follow-up, not do it. Point at the "Explicitly out" list.

## 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)
