koi
Documentation / architecture

What lives in .koi/

.koi/ holds settings you reuse from one change to the next. .koi/run/ holds one change in progress and is deleted when you consolidate. This page lists every file, who writes it and when it goes away.

Two folders, two lifetimes

Koi uses one fixed folder at the repository root. It has two parts with different lifetimes.

  • .koi/ is the project home. It keeps what does not change between efforts: Yokai's settings, the reviewed sensor scripts and the sandbox image recipe. It survives consolidate.
  • .koi/run/ is the working folder for one effort. It holds the plan, the board and every record of the run. /junji consolidate deletes all of it, with git rm -r .koi/run/, in the same commit that adds the final document.

Both folders are committed to Git on purpose. Every phase starts by reading them, so a run can continue in any session, with any agent, on any machine.

What stays and what goes
The project home contains the working folder The .koi/ project home is kept between efforts. It holds yokai.yml, the sensors folder and Dockerfile.sandbox. Inside it, the run/ working folder is removed by consolidate. The working folder holds CONTEXT.md and the plan, BOARD.json with NOTES.md and the phases folder, and Yokai's ledger and session records. .koi/ · project home, kept yokai.yml sensors/*.sh Dockerfile.sandbox run/ · removed by consolidate CONTEXT.md · PLAN.md BOARD.json · NOTES.md · phases/ ledger.jsonl · sessions.jsonl

The full layout

.koi/
  yokai.yml               Yokai settings, sandbox settings, gate review fingerprints
  sensors/*.sh            reviewed check scripts (optional for Junji)
  Dockerfile.sandbox      image recipe for sandbox mode (optional)
  sandbox-setup.sh        runs once in each new sandbox (optional)
  run/
    CONTEXT.md            binding facts, skills, verification bar, standing overrides
    PLAN.md or PLAN.html  the plan: problem, approach, decisions and why
    DESIGN.md             visual contract, if you used /junji design
    METHOD.md             per-phase protocol, copied from the Junji templates
    BOARD.json            nextAction and the ordered phase cards
    NOTES.md              carry-forward decisions
    phases/               one plan per phase, with an Outcome section once done
    researches/           notes from /junji research
    designs/              notes from /junji design
    reviews/              notes from /junji review
    yokai.yml             Yokai settings for this effort only
    ledger.jsonl          one row per phase run: cost, gate result, commits
    sessions.jsonl        one row per agent turn
    FEEDBACK.md           sensor and judge findings during Build
    RECOVERY.md, saves/   recovery index and episodes
    live-session.json     handle to the agent session in flight
    session-reuse/        session handles for token savings

Files marked optional appear only when you use the feature. A run made with Junji alone has no yokai.yml, no ledger and no sensors.

Who writes each file

File Written by When
CONTEXT.md Junji begin (observed facts), plan and grill (decisions) Start of the effort, and when a decision changes
PLAN.md / PLAN.html Junji plan, grill, iterate Planning
METHOD.md Junji begin copies it Once
BOARD.json Junji refine, next, review, iterate; Yokai during each act Every phase
NOTES.md, phases/ Junji next, or the agent in Yokai's Plan and Seal turns Every phase
.koi/yokai.yml, sensors/ Yokai setup, or the optional /yokai helper skill, after you approve Setup
.koi/run/yokai.yml You, Yokai setup When one effort needs different settings
ledger.jsonl, sessions.jsonl, FEEDBACK.md, saves/ Yokai only During a run

Yokai is the only writer of FEEDBACK.md. The agent reads it but never edits it.

Where the model tier lives

On a JSON board, a reviewed model tier sits on the card under the optional yokai key:

{
  "id": "P2",
  "title": "Persist tasks in localStorage",
  "status": "todo",
  "description": "...",
  "yokai": { "model-tier": "high", "reason": "Recovery touches shared state and reload behavior." }
}

Junji never reads this object but preserves it on every edit. Older Markdown runs keep the same choice under phases.P2.tier and phases.P2.reason in .koi/run/yokai.yml. See Model tiers.

What consolidate keeps

After /junji consolidate, the repository has one new document (for example specs/daylist.md, in the location CONTEXT.md recorded) and no .koi/run/. The ledger, the session records, the phase assessments and the effort settings are gone from the tree. Git history still has them. Copy ledger.jsonl first if you want cost records outside Git.

The next effort starts with /junji begin. It inherits .koi/yokai.yml, the sensors and the sandbox recipe, needs fresh phase assessments, and starts new cost accounting.

What can go wrong

  • phases/, PLAN.md or CONTEXT.md appear at the repository root or directly in .koi/. Paths are always .koi/run/.... Move them and tell the agent.
  • .koi/ is in .gitignore. Remove the entry. A run that is not committed cannot continue in another session or on another machine.
  • Both BOARD.json and BACKLOG.md exist. Keep the one the run actually uses and delete the other.
  • consolidate ran by accident during an unattended run. Restore .koi/run/ from Git. METHOD.md forbids consolidating without a human.