Work across sessions
Every Koi session starts with an empty context window. It finds the plan, the last result and the next step in .koi/run/, does one unit of work, and writes back what the next session needs. That is what lets a run go on unattended.
The folder is the memory
Junji's rule is short: the filesystem is the durable memory, and the context window is a disposable cache. A session can be thrown away at any point. The next one rebuilds its picture of the project by reading .koi/run/.
This is what lets a run go on without you. Nobody keeps one long chat alive and compacts it. /junji goal starts a fresh child for each phase, and Yokai opens a new agent session for each turn. Nothing important lives only in a transcript, so a run can span as many sessions as it needs.
What a new session reads
A fresh session reads these files, in this order, before it touches code:
.koi/run/BOARD.json. ThenextActionfield holds the command to run next, such as/junji next. Thetasksarray lists the phases in order, each with astatus..koi/run/NOTES.md. Carry-forward decisions: facts a later phase depends on, like "the date column is stored as text, parse it in the mapper"..koi/run/CONTEXT.md. The binding facts: what the project is, locked decisions, standing overrides such as "commit locally, never push", and the verification bar, which lists the exact commands that must pass..koi/run/phases/phase-NN-<slug>.mdfor the phase in progress. Its Outcome section records what the last session verified..koi/run/METHOD.md. The per-phase protocol, copied byte for byte from the Junji templates bybegin.
A session running a phase does not need PLAN.md. The plan explains why. CONTEXT.md says what is binding, and it wins when the two disagree.
A card's life on the board
Each phase is one card in BOARD.json:
{
"id": "P2",
"title": "Persist tasks in localStorage",
"status": "todo",
"description": "Save tasks on change, load on start, recover from invalid stored data. depends_on: P1.",
"gated": false
}
The status field moves through five values. Junji's next and Yokai write the same values, so either tool can pick up a phase the other started. Junji's next and Yokai's Seal turn move the card with koi board move, the same board code Yokai uses; when koi is missing, Junji asks you to install it, and an unattended Yokai turn (for example in the sandbox) edits the same fields directly.
A phase that must not run without a human decision has "gated": true. Junji's next stops and asks you. Yokai halts at it unless you launch with --allow-gated. Configuring Yokai or importing a plan never counts as that approval.
When a phase finishes, Seal replaces the card's description with a one or two line verified outcome and moves the long detail into the phase file's Outcome section. The board stays short enough to read at a glance. One consequence: if a card is reopened later, its description holds the outcome, not the original scope. The scope is still in the phase file.
Older runs keep progress in .koi/run/BACKLOG.md with headings like ### [todo] P2 - Persist tasks. Junji and Yokai still read that format. A run uses one or the other; if both files exist, both tools stop and ask you to choose.
The next action pointer
nextAction moves along a fixed path: begin, plan, refine, then next once per phase, then consolidate. Some verbs never move it: research, design, grill, brief and goal. iterate moves it from consolidate back to next after adding phases. review sets it to /junji next only when it schedules fixes.
If you type /junji with no verb, Junji reads nextAction and runs or offers that command.
Example: an unattended run
You start yokai --headless --max-cost 25 after planning four phases. P1 runs in one set of sessions, commits, and is verified on disk. P2 starts in brand new sessions. It knows what P1 did only from the board, the Outcome section in P1's phase file, and a carry-forward note such as "dates are stored as text". It never reads P1's transcript.
P3 is gated, so the run halts there with the reason. You read the phase, approve it, and launch again with --allow-gated. The new process reads the same card statuses and starts at P3.
Because the state is in the repository, the agent and the machine do not matter. The same branch can continue in Codex instead of Claude Code, or on a CI runner instead of your laptop.
What can go wrong
- The board says P1 is done but the code does not match. Ask the agent to run the verification commands from
CONTEXT.mdand inspect the last commit before continuing. Do not trust the board over a failing test. - Two cards are in flight (two non-
todo, non-donestatuses).nextstops and asks you to leave only one. - The board is gone. Check that you are on the right branch and in the repository root. If the run was consolidated, the result is in your spec folder and the phase history is in Git.
- You kept one chat open for several phases. It works, but every later session will only know what was written to disk. Make sure carry-forward notes and Outcome sections are complete.
Read next
- What lives in .koi/
- Run on its own:
/junji goalandyokai --headlessside by side. - When a run stops: the short how-to.