> 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.

# phax 0.40.0 \{#phax-0400}

Changes since 0.39.0: [v0.39.0...v0.40.0](https://github.com/lbdremy/phax/compare/v0.39.0...v0.40.0).

## Highlights \{#highlights}

- **Code repository: a plan's process in one repository, its code in another** — A plan's ground is the code it reads, in whichever repository that code lives.
- **Finding ids and fates** — No finding is dropped: phax names it, the operator or a machine settles it through a phax command, and Git remembers how.

## Upgrading \{#upgrading}

- **The pull request description's code review findings list is replaced by a Review findings section** of every finding by fate: open and deferred named, fixed and dismissed counted.
- **With `publish.auto` on, `phax finding fix`, `dismiss` and `defer` now push and comment on the run's existing pull request**, `fix` only while GitHub reports it open, and their `--json` answers gain `pullRequest`. Exit 1 now also covers a pull request not updated.
- **`phax finding post` is new.** It posts the comments of settled findings without recording a fate again.
- **`code-review` and `compliance-review` move to 0.40.0 shapes whose findings carry an `id`.** An `@lbdremy/phax-schemas` before 0.40.0 refuses them, so upgrade the package. The package reads the 0.32.0 shapes with each id `Unknown`.
- **The review sessions answer new formats**, `code-review-answer` and `compliance-review-answer`. phax gives each finding its id and keeps the answer as `code-review.json` or `compliance-review.json`.
- **`phax finding list --json` prints the new `finding-list` document.** See [Review findings](https://github.com/lbdremy/phax/blob/v0.40.0/docs/findings.md).
- **`phax finding fix`, `dismiss` and `defer` record fates** as `finding-fate-record-manifest` records on `phax/records/v1`, keyed `<runId>/finding/<id>/<NN>`, which `phax records list` does not show. An `@lbdremy/phax-schemas` before 0.40.0 cannot read them, and `parseRecordManifest` refuses them: read them with `parseFindingFateRecordManifest`.
- **`finding-list`'s `history` now holds fate records.**
- **Fixing commits carry `Finding:` trailers** beside `Short-Name`.
- **`plan-approval-record` moves to a new shape with a required `code` key**: `null` without a code link, `{ root, baseline }` with one. An `@lbdremy/phax-schemas` before 0.40.0 cannot read new plan approval records, so upgrade the package.
- **Records written earlier are read as `code: null` and never rewritten.**
- **Declaring a code link makes plans approved before it `missing-record`**, so re-approve them. See [Process and code in two repositories](https://github.com/lbdremy/phax/blob/v0.40.0/docs/code-repository.md).
- No step is needed in a repository that declares no code link.

## What's new \{#whats-new}

### Code repository: a plan's process in one repository, its code in another \{#code-repository-a-plans-process-in-one-repository-its-code-in-another}

> A plan's ground is the code it reads, in whichever repository that code lives.

- A process repository names the directory where its code repository is checked out, and phax judges its plans against that code. `phax.json code (process repository, project layer only)`

  Now:

  ```text
  {
    "gateProfiles": { "default": [ … ] },
    "code": { "root": "code" }
  }

  # .gitignore of the process repository
  /code/
  ```

  :::details Before

  ```text
  {
    "gateProfiles": { "default": [ … ] }
  }
  ```

  :::

- Running phax validate in a process repository says when its code root is missing, is not a git repository or is not ignored. `phax validate (link refusals)`

  Now:

  ```text
  $ phax validate
  ✗ phax.json code.root "code": not the top level of a git repository
  $ phax validate
  ✗ phax.json code.root "code": not ignored by this repository — add /code/ to .gitignore
  $ phax validate
  ✗ phax.local.json code: the code link is declared in phax.json only
  ```

- Every plan approval record states which code commit its plan was approved against, or null when the project has no code link. `docs/plans/approvals/<plan>.json`

  Now:

  ```text
  # linked project
  {
    "$schema": "https://docs.phax.run/schemas/plan-approval-record/0.40.0.json",
    "artifact": "docs/plans/2611201030-billing-export-plan.md",
    "planFingerprint": "73307e42…",
    "approvedAt": "2026-11-20T10:42:07.112Z",
    "baseline": "bae802b24aed73802ec8d9292ed61df045b9c747",
    "code": { "root": "code", "baseline": "9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0d" },
    "sourceSpec": { "path": "docs/specs/2611181420-billing-export.md", "fingerprint": "ddef903b…" },
    "approvedBy": { "kind": "operator", "name": "Ada" }
  }

  # project with no code link
  {
    "$schema": "https://docs.phax.run/schemas/plan-approval-record/0.40.0.json",
    …
    "baseline": "bae802b24aed73802ec8d9292ed61df045b9c747",
    "code": null,
    …
  }
  ```

  :::details Before

  ```text
  {
    "$schema": "https://docs.phax.run/schemas/plan-approval-record/0.25.0.json",
    "artifact": "docs/plans/2611201030-billing-export-plan.md",
    "planFingerprint": "73307e42…",
    "approvedAt": "2026-11-20T10:42:07.112Z",
    "baseline": "bae802b24aed73802ec8d9292ed61df045b9c747",
    "sourceSpec": { "path": "docs/specs/2611181420-billing-export.md", "fingerprint": "ddef903b…" },
    "approvedBy": { "kind": "operator", "name": "Ada" }
  }
  ```

  :::

- An approved plan in a linked project shows the short code commit it was approved against beside its baseline. `plan frontmatter approved stamp`

  Now:

  ```text
  approved:
    date: 2026-11-20
    baseline: bae802b
    code: 9c8d7e6
  ```

  :::details Before

  ```text
  approved:
    date: 2026-11-20
    baseline: bae802b
  ```

  :::

- Running phax plans status in a process repository reports a plan stale when the code files it reads have changed since its approval. `phax plans status`

  Now:

  ```text
  === Plan Staleness Report ===

  docs/plans/2611201030-billing-export-plan.md: STALE
    ground-changed: src/export/csv.ts changed in code/ since baseline 9c8d7e6f5a4b…
  docs/plans/2611190915-ledger-plan.md: STALE
    missing-record: the recorded code baseline 1a2b3c4 no longer exists in code/ — re-approve with "phax artifact approve docs/plans/2611190915-ledger-plan.md"
  ```

  :::details Before

  ```text
  === Plan Staleness Report ===

  docs/plans/2611201030-billing-export-plan.md: fresh
  ```

  :::

- A run from the code repository refuses a plan that is unapproved or stale against the code, and at review it tells the operator to complete the plan in the process repository. `phax run --plan ../docs/plans/<plan>.md (from the code repository)`

  Now:

  ```text
  $ cd code && phax run --plan ../docs/plans/2611201030-billing-export-plan.md
  phax run refused: docs/plans/2611201030-billing-export-plan.md is stale
    ground-changed: src/export/csv.ts changed in code/ since baseline 9c8d7e6f5a4b…

  $ cd code && phax run --plan ../docs/plans/2611201030-billing-export-plan.md
  … phases run, gates pass …
  ✓ review open
  The plan lives in the process repository: once merged, run there
    phax artifact complete docs/plans/2611201030-billing-export-plan.md
  ```

  :::details Before

  ```text
  $ cd code && phax run --plan ../docs/plans/2611201030-billing-export-plan.md
  … phases run, gates pass …
  ✓ review open
  ```

  :::

- A pull request opened from a linked run names neither the plan nor the spec it came from. `pull request body footer (code repository)`

  Now:

  ```text
  ---

  🛤️ Generated with [phax](https://docs.phax.run) 0.40.0 — the golden path, just facts\
  **Agents** claude `claude-opus-5-5` at high: 3 phases\
  **Run** `billing-export`
  ```

  :::details Before

  ```text
  ---

  🛤️ Generated with [phax](https://docs.phax.run) 0.40.0 — the golden path, just facts\
  **Plan** `../docs/plans/2611201030-billing-export-plan.md`\
  **Agents** claude `claude-opus-5-5` at high: 3 phases\
  **Run** `billing-export`
  ```

  :::

- Running phax plans lint in a process repository checks the plan's files against the checked-out code instead of the process repository. `phax plans lint (process repository)`

  Now:

  ```text
  $ phax plans lint docs/plans/2611201030-billing-export-plan.md
  ✓ files  every planned path checked against code/
  ```

  :::details Before

  ```text
  $ phax plans lint docs/plans/2611201030-billing-export-plan.md
  ✗ files  p1: modifies src/export/csv.ts, which does not exist
  ```

  :::

### Finding ids and fates \{#finding-ids-and-fates}

> No finding is dropped: phax names it, the operator or a machine settles it through a phax command, and Git remembers how.

- Each code-review finding now carries a stable `id` such as `F3` that commits, records and people can point at. `code-review.json`

  Now:

  ```text
  {
    "$schema": "https://docs.phax.run/schemas/code-review/0.33.0.json",
    "findings": [
      { "id": "F1", "severity": "bug", "file": "src/app/gate.ts", "line": 42,
        "message": "retry loses the gate's exit code",
        "lens": "core", "escape": "omission", "criterion": "AC-retry",
        "suggestion": "carry the exit code through the retry" }
    ]
  }
  ```

  :::details Before

  ```text
  {
    "$schema": "https://docs.phax.run/schemas/code-review/0.32.0.json",
    "findings": [
      { "severity": "bug", "file": "src/app/gate.ts", "line": 42,
        "message": "retry loses the gate's exit code",
        "lens": "core", "escape": "omission", "criterion": "AC-retry",
        "suggestion": "carry the exit code through the retry" }
    ]
  }
  ```

  :::

- Each compliance finding now carries a stable `id` such as `C2`, numbered across phases in document order. `compliance-review.json`

  Now:

  ```text
  "perPhase": [
    { "phaseId": "phase-02", "verdict": "conformant-with-deviations",
      "findings": [
        { "id": "C1", "dimension": "files", "severity": "deviation",
          "message": "edited src/cli/ls.ts, not in the plan" } ] }
  ]
  ```

  :::details Before

  ```text
  "perPhase": [
    { "phaseId": "phase-02", "verdict": "conformant-with-deviations",
      "findings": [
        { "dimension": "files", "severity": "deviation",
          "message": "edited src/cli/ls.ts, not in the plan" } ] }
  ]
  ```

  :::

- Running `phax finding list <run>` shows every finding of a run with its id and fate, so you can pick the ids to fix, dismiss or defer. `phax finding list`

  Now:

  ```text
  $ phax finding list gate-retry
  gate-retry (review_open) — 6 findings: 3 open, 1 fixed, 1 dismissed, 1 deferred

  F1  bug        fixed      src/app/gate.ts:42         retry loses the gate's exit code
                            a1b2c3d (code, tests)
  F2  concern    open       tests/gate.test.ts:88      asserts the message, not the exit code
  F3  concern    dismissed  src/cli/run.ts:17          duplicate flag check
                            Rémy Loubradou: the second check guards --resume
  F4  info       open       src/app/gate.ts:12         name reads oddly
  F5  concern    deferred   docs/gates.md:30           retry budget undocumented
                            → docs/briefs/gate-retry-docs.md
  C1  deviation  open       phase-02 files             edited src/cli/ls.ts, not in the plan
  ```

- The knowledge index and scripts read a run's findings and their full fate history as one versioned JSON document. `phax finding list --json`

  Now:

  ```text
  {
    "$schema": "https://docs.phax.run/schemas/finding-list/0.33.0.json",
    "run": { "shortName": "gate-retry", "runId": "2611041402-gate-retry", "state": "review_open" },
    "findings": [
      { "id": "F1", "source": "code-review", "severity": "bug",
        "file": "src/app/gate.ts", "line": 42, "message": "retry loses the gate's exit code",
        "lens": "core", "escape": "omission", "criterion": "AC-retry",
        "fate": "fixed",
        "history": [
          { "fate": "fixed", "commit": "a1b2c3d4…", "pathClasses": ["code", "tests"],
            "by": { "kind": "operator", "name": "Rémy Loubradou" }, "at": "2026-11-04T15:02:11Z" } ] },
      { "id": "C1", "source": "compliance-review", "severity": "deviation",
        "phaseId": "phase-02", "dimension": "files", "message": "edited src/cli/ls.ts, not in the plan",
        "fate": "open", "history": [] }
    ]
  }
  ```

- After changing files for a finding, `phax finding fix <run> F2 -- <paths>` commits exactly those paths with the finding trailers and records the finding as fixed, with no trailer typed by hand. `phax finding fix`

  Now:

  ```text
  $ phax finding fix gate-retry F2 -- tests/gate.test.ts
  ✓ committed 9f8e7d6 fix(review): F2 of gate-retry
    paths: tests/gate.test.ts (tests)
  ✓ recorded F2 fixed on phax/records/v1

  $ git log -1 --format=%B
  fix(review): F2 of gate-retry

  Short-Name: gate-retry
  Finding: F2

  $ phax finding fix gate-retry F7 -- src/app/gate.ts
  ✗ fix refused: gate-retry has no finding F7
  $ phax finding fix gate-retry F2 -- docs/gates.md
  ✗ fix refused: docs/gates.md has no change
  ```

  :::details Before

  ```text
  $ git add tests/gate.test.ts src/app/gate.ts
  $ git commit -m "fix review findings

  - assert the exit code
  - …

  Short-Name: gate-retry"
  ```

  :::

- An operator can mark one or more findings dismissed with a required reason, stamped with their name and the time. `phax finding dismiss`

  Now:

  ```text
  $ phax finding dismiss gate-retry F3 --why "the second check guards --resume"
  ✓ recorded F3 dismissed on phax/records/v1 (by Rémy Loubradou)

  $ phax finding dismiss gate-retry F3 --by machine:review-bot --why "…"
  ✗ dismiss refused: only an operator dismisses a finding
  ```

- An operator can hand a finding to later work by naming the brief, spec or NEXT_STEPS.md that takes it over. `phax finding defer`

  Now:

  ```text
  $ phax finding defer gate-retry F5 --to docs/briefs/gate-retry-docs.md --why "docs pass after the gate rework"
  ✓ recorded F5 deferred → docs/briefs/gate-retry-docs.md on phax/records/v1

  $ phax finding defer gate-retry F5 --to docs/briefs/nope.md --why "…"
  ✗ defer refused: docs/briefs/nope.md is not a tracked file
  ```

- Each fate of a finding is a record on the records branch, so the history of every finding can be rebuilt from Git alone. `phax/records/v1 <runId>/finding/<id>/<NN>/record.json`

  Now:

  ```text
  // <runId>/finding/F3/01/record.json
  {
    "$schema": "https://docs.phax.run/schemas/finding-fate-record-manifest/0.33.0.json",
    "kind": "finding-fate",
    "runId": "2611041402-gate-retry",
    "finding": "F3",
    "fate": "dismissed",
    "verdict": { "kind": "decided", "chosen": "dismiss", "abandoned": ["fix", "defer"],
      "why": "the second check guards --resume",
      "advocate": "drop the duplicate flag check", "principles": [], "reversibility": "cheap",
      "by": { "kind": "operator", "name": "Rémy Loubradou" }, "at": "2026-11-04T15:10:40Z",
      "revised": [] }
  }

  // <runId>/finding/F2/01/record.json (a fix)
  { "$schema": "…", "kind": "finding-fate", "runId": "2611041402-gate-retry", "finding": "F2",
    "fate": "fixed", "commit": "9f8e7d6…", "pathClasses": ["tests"],
    "by": { "kind": "operator", "name": "Rémy Loubradou" }, "at": "2026-11-04T15:02:11Z" }
  ```

## Fixes \{#fixes}

- fix(findings): finding fix posts nothing on a merged or closed pull request ([29f745f](https://github.com/lbdremy/phax/commit/29f745f53a52d432209d01ec436f80ddd3e5717c))

## Other \{#other}

- feat(github): ask a pull request's state through the GitHub port ([a6a85a2](https://github.com/lbdremy/phax/commit/a6a85a2994982641b3a122bb3eb9c00d942ae3af))
