koi
Documentation / junji

refine

Split the plan into phases you can implement and verify one at a time. Junji writes them as ordered cards on the board.

When to use it

Run it after plan, once the behaviour and the checks are clear. Run it again while phases remain to split, merge or reorder unfinished work. After every phase is done, use iterate instead.

How it works

  1. Junji reads PLAN.md and CONTEXT.md and breaks the work into phases that each make sense and can be verified alone, dependencies first.
  2. Each phase becomes a card in .koi/run/BOARD.json with an id (P0, P1, ...), a title, "status": "todo" and a description holding the goal, the source files and depends_on where it is not obvious.
  3. Irreversible, destructive or human-decision phases get "gated": true.
  4. It sets nextAction to /junji next.

When reshaping, completed cards and your edits are preserved, and existing IDs are not renumbered silently, because Yokai's per-card settings refer to them.

Example

/junji refine

For the export fix you might get: P0, a failing test with 250 orders; P1, follow the pagination cursor; P2, gated, switch the production export job to the new code.

Open BOARD.json and read the first card. It should say what the phase delivers and how to check it.

What can go wrong

  • A phase is too large to verify alone. Ask Junji to split it.
  • A dangerous step is not gated. Ask for "gated": true on it. Importing or refining a plan never approves gated work.
  • Everything is already done. refine points you to iterate.