koi
Documentation / yokai

Configure Yokai

Every Yokai setting: where it lives, what it defaults to, and which value wins when the project file, the effort file and a launch flag disagree.

Where settings live

Layer File Lifetime
Built-in defaults none Always
Project settings .koi/yokai.yml Kept between efforts
Effort settings .koi/run/yokai.yml Deleted by consolidate
Launch flags the command line One launch

Each layer overrides the one above it. Mappings merge field by field, including roles, session_options, sandbox and tier bands. Lists replace as a whole, so a candidate list keeps its order. null resets a value to its default; [] deliberately empties a list such as build.guides. An explicitly empty tier list is invalid.

yokai setup writes these files for you and keeps fields you did not edit. You can also edit them by hand.

Example

# .koi/yokai.yml
model_mode: single
agent: codex
agent_timeout_secs: 1800
sensor_timeout_secs: 900
build:
  judge: true
  max_iters: 5
sandbox:
  enabled: false
# .koi/run/yokai.yml  (this effort only)
build:
  max_iters: 3

yokai --once --max-iters 2 uses 2. The next plain yokai uses 3. After consolidate deletes the effort file, the next effort uses 5. Review stays on throughout, because build.judge is inherited from the project file.

Settings reference

Field Values Default
agent, model, effort Agent name; opaque model ID; opaque effort level claude; the agent's defaults. Used to fill tier bands you leave out
model_mode single or tiers Inferred from the bands. Remembers setup's first choice
tiers.low … tiers.ultra Ordered lists of candidates Filled from agent / model
tiers.retry_after_secs Seconds 3600
roles.<role>.tier low, medium, high, ultra for plan, coder, judge, seal, triage, repair, fix Phase tier for the first four, ultra for the last three
session_options Map of ACP option name to value, for example Mode: agent Empty
permission approve-all, approve-reads, deny-all approve-all
agent_timeout_secs Seconds per agent turn 1800
sensor_timeout_secs Seconds per sensor script 900
token_savings true, false false
recovery true, false true
build.max_iters Iterations per Build; 0 means none Unlimited
build.judge true, false true
build.guides File paths or short instructions for the coder []
sandbox.enabled true, false false
sandbox.backend docker, apple docker
sandbox.image, sandbox.name Image tag; sandbox name Name defaults to yokai-<repository folder>
sandbox.memory, sandbox.cpus Apple VM size 8g, 4
gate_review Written by setup after you approve the checks none

A candidate has agent and optionally model, effort and speed. speed is an opaque session option, applied as fast for that turn. Unknown role names are errors.

Launch-only choices never go in these files: --max-cost, --max-tokens, --once, --headless, --host, --allow-gated, --theme.

Phase assessments

On a JSON board, the reviewed tier for each phase lives on its card in BOARD.json, not in YAML:

"yokai": { "model-tier": "high", "reason": "Cross-module state migration with recovery invariants." }

Older Markdown runs keep the same choice in the effort file:

# .koi/run/yokai.yml
phases:
  P2:
    tier: high
    reason: Cross-module state migration with recovery invariants.

Approve these in setup's Phases step or with /yokai assess. A complete, saved choice is used as is; Yokai does not ask again or compare hashes. Headless startup stops if a phase has no tier or no reason. A board with JSON cards plus YAML phase mappings is a conflict you must resolve.

Token savings

token_savings: true, or yokai --token-savings for one launch, keeps two agent sessions per phase instead of one per turn:

  • one session for Plan, every coder turn and Seal, chosen by the coder role;
  • one session for every judge turn, chosen by the judge role.

Recovery reuses them too: Diagnose returns to the review session, Fix and Repair to the coding session. Separate plan, seal and recovery role tiers are ignored in this mode. Review always runs, even with build.judge: false, and every role is told not to delegate to subagents.

Two is the normal count, not a hard cap. If a session cannot be resumed or runs out of context, Yokai opens a replacement with the full context. The next phase starts new sessions. The mode avoids reloading context on every turn; it does not promise a particular saving.

Without token savings, a phase with one rejected review opens six sessions: plan, code, review, correct, review again, seal. With it, those six turns share two. The Sessions view shows which turns shared a session.

Run records

Yokai creates these in .koi/run/ and consolidate removes them:

File Holds
ledger.jsonl One row per phase run, plus skip rows for candidates that could not open
sessions.jsonl One row per agent turn
session-reuse/ Session handles and usage checkpoints for token savings
live-session.json The session in flight, so an interrupted turn can reattach
FEEDBACK.md Findings during Build; deleted before Seal when Build converges
RECOVERY.md, saves/ Recovery index and episodes

Old files

  • .koi/run/config.yml and .koi/sandbox.yml come from the Koi CLI. Run yokai migrate; see Migrate from the Koi CLI.
  • .koi/run/tengu.yml is no longer read. yokai doctor warns about it. Move its keys under build: and delete it.
  • build.judge_model is deprecated. Use roles.judge.tier.
  • A leftover swarm: block or phases.*.strategy is ignored and dropped on the next save.

What can go wrong

  • A setting seems ignored. A lower layer overrides it. Check .koi/run/yokai.yml and the flags you passed.
  • tiers.medium must list at least one candidate. You wrote medium: []. Remove the key to inherit, or add a candidate.
  • Setup changed fields you did not touch. It should not; it preserves unedited fields. If it did, compare with Git and report it.
  • Gate review invalid after editing sandbox. Environment changes need a new smoke run of the existing sensors in setup.