> For AI agents: the complete documentation index is available at https://docs.phax.run/llms.txt, the full documentation bundle is available at https://docs.phax.run/llms-full.txt.

# Reviewing and landing

## Review and land \{#review-and-land}

A run at `review_open` has done its work on the last phase's branch; nothing has landed. You find there a `review-handoff.md` and the reconciliation of the whole run, against its plan.

```bash
phax review-code <run>          # an agent session in the final worktree, primed to review the change
phax review-code <run> --headless  # the same review without a person: findings in code-review.json
phax finding list <run>          # every finding of the run's reviews with its id and fate (see docs/findings.md)
phax finding fix <run> <id>… -- <path>…  # commit the named paths and record the findings fixed (see docs/findings.md)
phax finding dismiss <run> <id>… --why …  # record the findings dismissed (see docs/findings.md)
phax finding defer <run> <id>… --to <path> --why …  # record the findings deferred (see docs/findings.md)
phax finding post <run> <id>…  # post the comments of settled findings on the run's pull request (see docs/findings.md)
phax enter <run>                # back into the last phase's agent session
phax shell <run>                # a shell in the final worktree
phax open <run>                 # the final worktree, in the system's default opener
phax path <run>                 # the final worktree's path
phax review-handoff <run>       # write review-handoff.md and the reconciliation again
```

`review-code` starts from the reconciliation and the compliance findings rather than a blank prompt, and follows the `phax-review` skill: it uses the change before reading its code, works from the user inward, and looks for what the run's tests cannot catch, each finding naming why they missed it. A copy at `.claude/skills/phax-review/SKILL.md` on the run's branch replaces the bundled skill. Running it again resumes the session, and `--new-session` starts over. Its model is `review.code` in `phax.json`, `claude-opus-5-5` at `high` effort by default, or `--model` and `--effort`.

`phax review-code <run> --headless` runs that review without a person. It follows the same skill in a read-only session (its reading tools and read-only `git`), answers with its final message, and phax writes the findings to `code-review.json`: each with a severity, a file and line, a lens, an escape, a criterion and a suggestion. It records its session, so `phax review-code <run>` resumes it on the provider that ran it, to ask for the fixes; `--new-session` starts a new session that becomes the recorded one and detaches it from `code-review.json`, which is left as it is. A refused answer, a failed session or a session that changed the worktree (its changes are put back) leaves `code-review.json` and the recorded session as they were, and exits 1 with the retry command; the session's cost entry and transcript are still kept. To get it with every run, set `"review": { "code": { "enabled": true } }`, read the `## Review findings` section in the pull request, then fix each finding with `phax finding fix <run> <id> -- <path>…`, or settle it with `dismiss` or `defer`. A fate is written on `phax/records/v1`, so it needs records on. From a script, every fate names its arbiter with `--by`, and only the operator dismisses or defers; `fix --commit <sha>` records a commit you already made.

Three steps run on their own when a run reaches review, if `phax.json` turns them on, and can be run by hand. None can fail the run.

```bash
phax review-compliance <run>    # an agent checks the work against the plan, phase by phase, and phax writes its verdict
phax review-code <run> --headless  # the code review (review.code.enabled): findings in code-review.json
phax publish-pr <run>           # push the final branch and open a pull request, or reuse the open one
```

The compliance review changes nothing. `phax publish-pr <run>` writes a short description: a run summary with the compliance verdict, one line per phase, what needs your review (unexplained deviations, compliance attention points), a Review findings section (every finding by fate: open and deferred named, fixed and dismissed counted), the review notes, and where to read the full review handoff, `~/.phax/runs/<namespace>.<name>/review-handoff.md`, on the machine that ran it. When the description is too long, it cuts unexplained deviations first, then attention points, deferred findings, open findings and last the review notes. With `publish.auto` on, `phax finding fix`, `dismiss` and `defer` then comment on the pull request (see docs/findings.md). A review run by hand never updates an open pull request. The compliance review's model is `review.compliance`, `claude-sonnet-5-5` at `medium` by default. `publish-pr` needs a GitHub remote and an authenticated `gh`; the remote, base branch and title are set under `publish`.

The description ends with a phax footer, for example:

```markdown
---

🛤️ Generated with [phax](https://docs.phax.run) 0.27.0 — the golden path, just facts\
**Plan** [`docs/plans/archive/2610101200-greet-cli-plan.md`](https://github.com/acme/greet/blob/3f2a…/docs/plans/archive/2610101200-greet-cli-plan.md) · **Spec** [`docs/specs/archive/2610091100-greet-cli.md`](https://github.com/acme/greet/blob/3f2a…/docs/specs/archive/2610091100-greet-cli.md)\
**Agents** claude-code `claude-sonnet-5-5` at medium: 2 phases; codex-cli `gpt-5.5` at high: 1 phase\
**Run** `acme.greet-cli`
```

The plan and the spec (the `source-spec` of the run's plan) are permalinks at the head commit of the published branch, each named where it lives in that commit's tree: its recorded path, else its `archive/` counterpart. The summary's `**Plan**` names the plan the same way. A loose plan (outside `docs/plans/`), a branch `publish-pr` did not push (`publish.pushBranch: false`, so the host may not hold that commit), a web URL `gh repo view` cannot give, or a head commit phax cannot read gives a code span instead of a link; with no readable head, the plan is named at its `archive/` counterpart and the spec is left out. A run that recorded no plan path names its plan as plain `loose plan` text. A plan with no spec has no `**Spec**` part. The agents are the provider, model and effort each committed phase ran with, read from its `agent-binding.json` and counted per assignment; an interactive phase has no binding and a skipped phase did not commit, so neither is counted. When the description is shortened to fit GitHub's limit, the footer is never cut. A pull request that already exists keeps its description: `publish-pr` reuses it as it is. There is no setting to turn the footer off.

### After the merge \{#after-the-merge}

```bash
phax ls                         # your runs; --active, --failed, --review-open, --archived, --json
phax archive <run>              # put a finished run away, keeping everything
phax prune --all --dry-run      # see what deleting your archived runs would free
phax prune <run>                # delete an archived run for good
phax cost backfill              # give every kept run without a cost ledger one, from its streams
```

Every run keeps `cost-ledger.json`: each Claude invocation's own API-list cost, tokens, duration and subscription-window samples. `archive` moves it with the run, and `prune` keeps a copy in `~/.phax/cost-ledgers/`.

`archive` moves the run's folder and its worktrees under `~/.phax/archive/<namespace>.<name>/` and keeps the name taken. It accepts a finished run (`review_open`, `completed`) whose final worktree is clean; an unfinished run or a dirty worktree needs `--force`, and a running or locked run is refused.

`prune` deletes archived runs for real: the archive folder, the worktrees' records in Git, the run's local branches, and its entry, which frees its name and its disk space. It shows what it will do first, asks in a terminal (`--yes` otherwise, `--dry-run` to only look), works on this repository's runs only, and never touches the records branch, remote branches or pull requests. Before it deletes the archive folder, it copies the run's cost ledger to `~/.phax/cost-ledgers/<namespace>.<name>.<run-id>.json`; if the copy fails, the run is kept. A run whose branches hold commits found nowhere else is kept, unless you pass `--force`; a branch checked out somewhere keeps its run even then.
