# consolidate

Close the run. Junji turns the phase records into one document in your repository's spec folder and removes .koi/run/ in the same commit.

## When to use it

Use it when every phase is done and you accept the result. If a review asked for fixes, run them first. If you still want changes, use `iterate` while the run is open. Consolidation deletes the working folder, so Junji asks you to confirm.

## How it works

1. It refuses unless every card is `done`.
2. It reads every phase file (especially the Outcomes), `NOTES.md`, the plan and `CONTEXT.md`, including the deliverable format.
3. It writes one document in the outline recorded in `CONTEXT.md › Deliverable spec model`: what the system is, the decisions, a short story of the phases, and the gotchas. It is documentation, not a changelog.
4. It saves it where the spec model says (your `docs/adr/`, `rfcs/` or `specs/`), named after what was delivered.
5. In a single commit it adds the document and runs `git rm -r .koi/run/`.

Everything else under `.koi/` stays: Yokai settings, sensors, the sandbox recipe. Git history keeps the phase records.

## Example

```text
/junji consolidate
```

Junji shows the proposed document. Read it, confirm, and check the commit: one new file, and `.koi/run/` gone.

## What can go wrong

- A card is not done. Junji refuses and names it.
- An unattended run should never consolidate. `METHOD.md` forbids it; if it happens, restore `.koi/run/` from Git.
- You want the cost ledger. Copy `.koi/run/ledger.jsonl` before confirming.

## Cards to read next

- [![](/art/verbs/iterate-card.webp) iterate · Extend an open run](/en/docs/junji/iterate)
- [![](/art/verbs/begin-card.webp) begin · Survey a repository](/en/docs/junji/begin)
