# Configure the project

Decide where each rule lives: in CONTEXT.md for this change, in your repository's agent instructions for every change, or in .koi/yokai.yml for how Yokai runs.

Koi reads its configuration from files in the repository. There is no global config. Junji takes project rules and test commands from `.koi/run/CONTEXT.md`. Yokai adds its own settings in `.koi/yokai.yml`.

## Tell every agent how to work

`/junji begin` reads your repository's instructions (`AGENTS.md`, `CLAUDE.md`, `.cursor/rules` and similar) and fills `.koi/run/CONTEXT.md` with what it finds. During `/junji plan`, say which rules apply to every phase:

```text
/junji plan Use the test commands that already exist in this repository.
Commit locally and leave the push to me.
Show me how you will verify each phase before starting.
```

Then check these sections of `CONTEXT.md`:

| Section | What to look for |
| --- | --- |
| Verification bar | The commands that must pass and the directory each runs from. `Toolchain` lists what `begin` found; the bar is what you chose. |
| Standing overrides | Rules any agent must follow, such as the branch and the push policy. |
| Skills | `SKILL.md` files in your repository and the roles that must follow them (`next`, `coder`, `judge`, `seal`, `design`, `plan`). |
| Deliverable spec model | Where `consolidate` writes the final document, in what format and outline. |
| Design contract | Points at `.koi/run/DESIGN.md` when the change has an interface. |

`CONTEXT.md` lasts for one effort. To keep a rule for future efforts, write it in your repository's standing instructions, such as `AGENTS.md`, where the next `begin` finds it.

## Where each setting belongs

| What you want | Where it goes |
| --- | --- |
| Requirements, checks and handoff format for this change | `.koi/run/CONTEXT.md` |
| Rules for every future change | `AGENTS.md` or your agent's instruction file |
| Yokai's default agent, models, timeouts, environment | `.koi/yokai.yml` |
| A Yokai setting for this effort only | `.koi/run/yokai.yml` |
| Checks Yokai runs | Scripts in `.koi/sensors/`, reviewed in setup |
| Tools inside the sandbox | `.koi/Dockerfile.sandbox`, with the image tag in `.koi/yokai.yml` |
| Order and scope of phases | `/junji refine` (writes `BOARD.json`) |

`consolidate` removes `.koi/run/`. Everything directly under `.koi/` survives.

## Example: one rule, three places

Your team never pushes from an agent. Put "commit locally, never push" in `AGENTS.md` so every effort inherits it. During `plan`, ask Junji to record it under `CONTEXT.md › Standing overrides` for the current run. Yokai's Seal prompt tells the agent to honor standing overrides, so unattended phases follow it too.

## Settings on the machine that runs Yokai

Yokai's settings are in [Configure Yokai](/en/docs/yokai/configuration). Three environment variables matter for sandbox mode:

- `KOI_DATA_DIR` changes where the sandbox launcher caches the Linux `yokai` it downloads. The default is `~/.local/share/koi`.
- `YOKAI_LINUX_BINARY` points the launcher at a Linux `yokai` you built yourself. It wins over the cached and downloaded copies.
- `KOI_LINUX_BUILD_BACKEND` picks the backend `scripts/build-linux-artifacts.sh` uses in a koi clone: `docker`, `sbx` or `container`. It does not choose the project's sandbox backend; that is `sandbox.backend` in `.koi/yokai.yml`.

## What can go wrong

- A rule you gave in chat is not followed once the phases run on their own. It only lived in the chat. Ask the agent to record it under Standing overrides.
- The bar lists a command that does not exist yet. Make the first phase a bootstrap phase that creates it. No phase can pass until it exists.
- Yokai asks you to review the checks again after you edited `CONTEXT.md`. You changed the Verification bar section. Edits to other sections do not trigger a review.
