> 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.43.0 \{#phax-0430}

Changes since 0.42.0: [v0.42.0...v0.43.0](https://github.com/lbdremy/phax/compare/v0.42.0...v0.43.0).

## Highlights \{#highlights}

- **Gate step times in the gate attribution** — A gate time is a recorded fact read from the record, never a guess, a re-run, or a reason to change a verdict.
- **Launcher and release-pipeline fixes: verified first run, forwarded signals, tag-only redeploy, locked Deno build** — Only verified, pinned code reaches a user's machine or the release, and the launcher is a transparent doorway to the binary it verified.
- **Security High fixes: skeleton records, worktree git, .phax-context, review skill** — Nothing the agent under review can write decides what phax executes, where phax writes, what phax publishes, or how the agent's work is reviewed.
- **The plan names its gate profile** — The profile that gates a run is the one the operator approved in its plan, never the one phax.json happens to list first.

## Upgrading \{#upgrading}

- **`gate-attribution.json` and `checks-attempt-NN.attribution.json` move to a new shape**, stamped 0.43.0, with a required `time` on the attempt, on every step and on a non-null `protectedPaths`: `measured` with `startedAt` and `durationMs`, or `not-run` for a skipped acceptance step.
- **`phax records explain` shows these times** under its `gates` line, and `--json` adds `gateAttempts`.
- **Older attributions still read, with their times `unknown`, and are never rewritten.**
- **An `@lbdremy/phax-schemas` before 0.43.0 cannot read the new attributions**, so upgrade the package. Its `toLatestGateAttribution` gives 0.26.0 to 0.33.0 attributions `unknown` times. Older ones (pre-schema, 0.17.0 to 0.21.0) come back under their own types with no `time` key, since their steps can be `pending`; phax itself reads them with `unknown` times.
- **Phase records carry the required `gateProfile`**, the id of the gate profile that gated the run, and `phase-record-manifest` is stamped 0.43.0. `phax records explain` prints it on a `profile` line just before the `gates` line, and `--json` adds `gateProfile`.
- **Earlier records read as `null`**, shown as `(not recorded)` by `phax records explain`, and are never rewritten. `toLatestPhaseRecordManifest` lifts them the same way.
- **An `@lbdremy/phax-schemas` before 0.43.0 cannot read the new records**, so upgrade the package.
- **A plan's JSON sidecar carries the required `run.gateProfile`**, the id of the one gate profile in phax.json that verifies the plan's whole run, and `plan-document` is stamped 0.43.0. The rendered plan.md declares it in a `## Gate profile` section, just before `## Required commands`. A document without it is refused, naming `run.gateProfile`.
- **An `@lbdremy/phax-schemas` before 0.43.0 cannot read the new plan documents**, so upgrade the package. Its `toLatestPlanDocument` lifts a plan document stamped 0.38.0 or earlier under a type of its own, `LiftedPlanDocument`, whose run declares no gate profile: it never invents one.
- **A plan sidecar stamped 0.38.0 or earlier declares no gate profile.** It still reads, but `phax artifact approve` and `phax artifact reopen` refuse it until it is migrated.
- **Every plan.md declares exactly one gate profile under `## Gate profile`**, its id written as a code span or a bare word. phax reads it itself and never asks the extraction model. `phax plans lint` reports a plan with no declaration, or more than one, as a `structure` error, and extraction refuses it before any model call, naming `phax plans lint`. `phax plans overview`, `phax plans estimate` and `phax plans overlap` only show a plan: they do not read its gate profile, so a plan written before the declaration, archived ones included, still shows.
- **`phax-plan.json` carries the required `run.gateProfile`**, and `phax-plan` is stamped 0.43.0. A run started by 0.42.0 or earlier recorded none: it is still listed and shown, but `phax resume` refuses it. Finish it with the release that started it, or archive it with `phax archive <run> --force` and run its plan again. An `@lbdremy/phax-schemas` before 0.43.0 cannot read the new file; its `toLatestPhaxPlan` lifts one stamped 0.38.0 or earlier under a type of its own, `LiftedPhaxPlan`, whose run names no gate profile.
- **A plan whose extraction fell back to the model is extracted once more**, since an extraction cached by an earlier release is a miss.
- **`phax run`, `phax run --dry-run` and `phax plans lint` use the gate profile the plan declares**, wherever phax.json lists it, never the first one. Revise each live plan to declare one and approve it again. `phax run` refuses a declared profile phax.json does not define with exit 2, before any worktree, run branch or run folder exists. See [Gate profiles](https://github.com/lbdremy/phax/blob/v0.43.0/docs/gate-profiles.md).
- **`phax plans lint` has a new `gate-profile` check**, an error naming the declared profile and every defined one when phax.json does not define it. The `commands` check then compares required commands with the declared profile's steps alone. Every lint report's check column is one space wider.
- **`plan-lint` is stamped 0.43.0**, and an `@lbdremy/phax-schemas` before 0.43.0 refuses new lint documents, so upgrade the package. It reads a 0.34.0 lint document as its own shape and `toLatestPlanLint` lifts it unchanged.

Run `phax artifact migrate-documents --gate-profile <id>` once per live plan sidecar stamped 0.38.0 or earlier, naming one of phax.json's gate profiles. It writes the id into the sidecar and renders `## Gate profile` into the body, so approve each Approved plan again afterwards. Without the flag such a plan is refused, naming the flag, and an id phax.json does not define is refused with exit 2.

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

### Gate step times in the gate attribution \{#gate-step-times-in-the-gate-attribution}

> A gate time is a recorded fact read from the record, never a guess, a re-run, or a reason to change a verdict.

- Each gate attempt's attribution now shows when each step started and how long it ran, how long the protected-paths check took, and how long the attempt took. `gate-attribution.json and checks-attempt-NN.attribution.json`

  Now:

  ```text
  {
    "$schema": "https://docs.phax.run/schemas/gate-attribution/0.43.0.json",
    "phase": "phase-02",
    "time": { "kind": "measured", "startedAt": "2026-11-23T10:04:11.020Z", "durationMs": 192113 },
    "steps": [
      { "command": "pnpm typecheck", "surface": "local", "result": "pass",
        "time": { "kind": "measured", "startedAt": "2026-11-23T10:04:11.031Z", "durationMs": 712 } },
      { "command": "pnpm test", "surface": "local", "result": "pass",
        "time": { "kind": "measured", "startedAt": "2026-11-23T10:04:11.760Z", "durationMs": 191344 } },
      { "command": "phax-acceptance", "surface": "acceptance", "result": "skipped",
        "time": { "kind": "not-run" } }
    ],
    "protectedPaths": { "result": "pass", "changes": [],
      "time": { "kind": "measured", "startedAt": "2026-11-23T10:07:23.140Z", "durationMs": 84 } }
  }
  ```

  :::details Before

  ```text
  {
    "$schema": "https://docs.phax.run/schemas/gate-attribution/0.33.0.json",
    "phase": "phase-02",
    "steps": [
      { "command": "pnpm typecheck", "surface": "local", "result": "pass" },
      { "command": "pnpm test", "surface": "local", "result": "pass" },
      { "command": "phax-acceptance", "surface": "acceptance", "result": "skipped" }
    ],
    "protectedPaths": { "result": "pass", "changes": [] }
  }
  ```

  :::

- Running `phax records explain` on a phase commit shows each gate attempt's steps with how long each took, so you can see where the gate time went. `phax records explain`

  Now:

  ```text
  $ phax records explain 3f2a9c1
  phase-02 · claude-code (claude-opus-5-5, high)
  run      2026-11-23-gate-step-times
  record   …
  gates    passed after 2 attempt(s)   surfaces  local, structural
    attempt 01   192.6 s
      pnpm typecheck     local        pass      0.7 s
      pnpm test          local        fail    191.3 s
      protected paths                 pass      0.1 s
    attempt 02   195.0 s
      pnpm typecheck     local        pass      0.7 s
      pnpm test          local        pass    190.4 s
      pnpm lint          structural   pass      2.4 s
      protected paths                 pass      0.1 s
  source   3f2a9c1… (reachable)

  # a record written before times were recorded:
    attempt 01   time unknown
      pnpm test          local        pass    time unknown
  ```

  :::details Before

  ```text
  $ phax records explain 3f2a9c1
  phase-02 · claude-code (claude-opus-5-5, high)
  run      2026-11-23-gate-step-times
  record   …
  gates    passed after 2 attempt(s)   surfaces  local, structural
  source   3f2a9c1… (reachable)
  ```

  :::

- Scripts reading `phax records explain --json` get each gate attempt's steps with their times. `phax records explain --json`

  Now:

  ```text
  { "kind": "phase", …, "checksAttemptCount": 2, "acceptanceStep": null,
    "gateAttempts": [
      { "attempt": 1,
        "time": { "kind": "measured", "startedAt": "2026-11-23T10:04:11.020Z", "durationMs": 192613 },
        "steps": [
          { "command": "pnpm test", "surface": "local", "result": "fail",
            "time": { "kind": "measured", "startedAt": "2026-11-23T10:04:11.760Z", "durationMs": 191344 } }
        ],
        "protectedPaths": { "result": "pass", "time": { "kind": "measured", "startedAt": "2026-11-23T10:07:23.633Z", "durationMs": 84 } } }
    ], … }
  ```

  :::details Before

  ```text
  { "kind": "phase", …, "checksAttemptCount": 2, "acceptanceStep": null, … }
  ```

  :::

### Launcher and release-pipeline fixes: verified first run, forwarded signals, tag-only redeploy, locked Deno build \{#launcher-and-release-pipeline-fixes-verified-first-run-forwarded-signals-tag-only-redeploy-locked-deno-build}

> Only verified, pinned code reaches a user's machine or the release, and the launcher is a transparent doorway to the binary it verified.

- A first run that is interrupted, raced or fails leaves no binary behind, so the next run downloads and verifies again instead of running an unchecked file. `phax (npm launcher), first run`

  Now:

  ```text
  $ phax --version                 # first run of 0.44.0, killed during the download
  phax: downloading binary from https://github.com/lbdremy/phax/releases/download/v0.44.0/phax-darwin-arm64
  ^C
  $ ls -A ~/.phax/bin/0.44.0/
                                   # empty: the private download directory is gone
  $ phax --version                 # downloads and verifies again
  phax: downloading binary from https://github.com/lbdremy/phax/releases/download/v0.44.0/phax-darwin-arm64
  0.44.0
  ```

  :::details Before

  ```text
  $ phax --version                 # first run of 0.43.0, killed after the download
  ^C
  $ ls ~/.phax/bin/0.43.0/
  phax-darwin-arm64                # renamed in place, never verified
  $ phax --version                 # runs it, unchecked
  0.43.0
  ```

  :::

- A first run that is redirected too far or off GitHub, or stalls, stops with a message naming the URL, host or timeout instead of looping, crashing or hanging. `phax (npm launcher), download errors`

  Now:

  ```text
  $ phax --version
  phax: download failed: more than 5 redirects from https://github.com/lbdremy/phax/releases/download/v0.44.0/phax-darwin-arm64
  $ echo $?
  1

  phax: download failed: refused redirect to http://release-assets.githubusercontent.com/…: not https
  phax: download failed: refused redirect to https://downloads.example.net/phax: host is not github.com or *.githubusercontent.com
  phax: download failed: no connection to github.com within 10 s
  phax: download failed: no data from release-assets.githubusercontent.com for 30 s
  ```

  :::details Before

  ```text
  $ phax --version     # a redirect loop: never returns
  $ phax --version     # relative Location
  TypeError [ERR_INVALID_URL]: Invalid URL
  $ phax --version     # stalled connection: never returns
  ```

  :::

- Signalling the launcher stops the phax run it started, and the launcher's exit status is the binary's own code or signal. `phax (npm launcher), signals and exit status`

  Now:

  ```text
  $ phax run my-plan &
  $ kill -INT %1
  Run "my-plan" interrupted — state saved. Resume with: phax resume my-plan --yes
  $ wait %1; echo $?
  130                              # the binary's own exit code

  $ kill -TERM <binary pid>        # the binary dies of SIGTERM
  $ echo $?                        # the launcher died of SIGTERM too
  143
  ```

  :::details Before

  ```text
  $ phax run my-plan &             # through a manager that signals the launcher's pid only
  $ kill -INT %1
  $ echo $?
  130                              # the launcher died; phax-darwin-arm64 goes on with the phase

  $ kill -TERM <binary pid>
  $ echo $?                        # launcher's status
  1
  ```

  :::

- When the cached binary cannot be started, the launcher says why and how to get a fresh download instead of exiting 1 in silence. `phax (npm launcher), binary cannot start`

  Now:

  ```text
  $ phax --version
  phax: could not start /Users/me/.phax/bin/0.44.0/phax-darwin-arm64: EACCES (permission denied)
    remove /Users/me/.phax/bin/0.44.0 and run phax again to download it afresh
  $ echo $?
  1
  ```

  :::details Before

  ```text
  $ phax --version
  $ echo $?
  1
  ```

  :::

- During a first run the download sits in a directory of its own, and only a verified, executable binary ever appears at the cache path. `~/.phax/bin/<version>/`

  Now:

  ```text
  ~/.phax/bin/0.44.0/
    .download-a1B2c3/              # one per first run, removed on success, failure or signal
      phax-darwin-arm64
    phax-darwin-arm64              # appears only verified and executable, by one rename
  ```

  :::details Before

  ```text
  ~/.phax/bin/0.43.0/
    phax-darwin-arm64.tmp          # shared by every concurrent first run
    phax-darwin-arm64              # renamed in before verification
  ```

  :::

- A redeploy refuses a malformed tag before checking anything out, and always builds the tag itself, never a branch of the same name. `.github/workflows/docs-deploy.yml`

  Now:

  ```text
  steps:
    - name: Verify the tag's shape
      run: |
        if ! [[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
          echo "Not a release tag: ${RELEASE_TAG}"
          exit 1
        fi
    - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
      with:
        ref: refs/tags/${{ inputs.tag }}
        lfs: true
    - uses: pnpm/action-setup@…
    - uses: actions/setup-node@…
    - name: Verify the tag is this release
      run: |                       # package.json and ledger, unchanged
    - name: Install dependencies
      run: pnpm install
  ```

  :::details Before

  ```text
  steps:
    - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
      with:
        ref: ${{ inputs.tag }}
        lfs: true
    - uses: pnpm/action-setup@…
    - uses: actions/setup-node@…
    - name: Install dependencies
      run: pnpm install
    - name: Verify the tag is this release
      run: |                       # shape, package.json, ledger
  ```

  :::

- Deno builds and checks fail on a dependency the lockfile does not pin, leave pnpm's node_modules alone, and grant install scripts to no unused version. `deno.json`

  Now:

  ```text
  {
    "nodeModulesDir": "manual",
    "lock": { "frozen": true },
    …
    "allowScripts": {
      "allow": ["npm:esbuild@0.28.2", "npm:fsevents@2.3.3"]
    }
  }
  ```

  :::details Before

  ```text
  {
    "nodeModulesDir": "auto",
    …
    "allowScripts": {
      "allow": [
        "npm:@parcel/watcher@2.5.6",
        "npm:msgpackr-extract@3.0.4",
        "npm:esbuild@0.21.5",
        "npm:esbuild@0.28.1",
        "npm:fsevents@2.3.3"
      ]
    }
  }
  ```

  :::

- Building the binaries stops with Deno's lockfile error when deno.lock does not match, instead of embedding a version no lockfile pins. `pnpm deno:build-binaries`

  Now:

  ```text
  $ pnpm deno:build-binaries       # deno.lock out of date
  error: The lockfile is out of date. Run `deno install --frozen=false`, or rerun with `--frozen=false` to update it.
  $ echo $?
  1
  ```

  :::details Before

  ```text
  $ pnpm deno:build-binaries       # deno.lock out of date: resolves, relinks, builds
  Bundling with esbuild...
  Building phax-darwin-arm64 (aarch64-apple-darwin)...
  ```

  :::

### Security High fixes: skeleton records, worktree git, .phax-context, review skill \{#security-high-fixes-skeleton-records-worktree-git-phax-context-review-skill}

> Nothing the agent under review can write decides what phax executes, where phax writes, what phax publishes, or how the agent's work is reviewed.

- A record written with `records.transcript: false` no longer carries fix-attempt streams, handoff streams, gate and setup logs, or agent error logs. `phase record on phax/records/v1, skeleton shape`

  Now:

  ```text
  Files of phase-02's skeleton record (records.transcript: false):
  agent-binding.json
  checks-attempt-01.request.json
  claude-session-id.txt
  diff.patch
  file-reconciliation.json
  gate-attribution.json
  model-resolution.json
  phase-handoff.md
  prompt.md
  security.json
  status.json
  ```

  :::details Before

  ```text
  Files of phase-02's skeleton record (records.transcript: false):
  agent-binding.json
  agent-error.log
  checks-attempt-01.log
  checks-attempt-01.request.json
  claude-session-id.txt
  diff.patch
  file-reconciliation.json
  fix-attempt-01.jsonl
  gate-attribution.json
  handoff-generation.jsonl
  model-resolution.json
  phase-handoff.md
  prompt.md
  security.json
  setup.log
  status.json
  ```

  :::

- phax keeps `.phax-context` out of git without touching the worktree's `.gitignore`, so a phase's diff never shows phax's ignore line. `.git/info/exclude of the repository`

  Now:

  ```text
  # <repository>/.git/info/exclude, shared by every worktree
  /.phax-context

  # <worktree>/.gitignore, untouched by phax
  node_modules/
  ```

  :::details Before

  ```text
  # <worktree>/.gitignore, as phax leaves it today
  node_modules/
  .phax-context/
  ```

  :::

- When an agent rewrites its worktree's `.git` file, phax stops the phase before running any git command there and shows what changed. `phax run / phax resume, gitdir pointer refusal`

  Now:

  ```text
  $ phax resume billing
  …
  ✗ phase-02 failed: the worktree's .git no longer points at the git directory phax created
    .git holds:  gitdir: ./x
    expected:    gitdir: /Users/me/billing/.git/worktrees/phase-02
    phax ran no git command in this worktree after the change.
  ```

- When `.phax-context` (or `.phax-context/briefs`) is a symbolic link or not a directory, phax refuses to use it and names what it found. `phax run / phax resume, .phax-context refusal`

  Now:

  ```text
  $ phax run docs/plans/2611240900-billing-plan.md
  …
  ✗ phase-03 refused: .phax-context is a symbolic link (→ /Users/me/.ssh), not a directory
    phax writes and reads .phax-context only as a real directory; remove the link from the branch, then resume.

  [phax] Warning: phase "phase-03" — .phax-context/briefs/brief-01.json is a symbolic link; not recorded.
  ```

- The code review says which review skill it follows, and warns when the run changed the project's review skill, whose base copy it follows instead. `phax review-code <run>`

  Now:

  ```text
  $ phax review-code billing --headless
  review skill: project, as of base 1a2b3c4 (.claude/skills/phax-review/SKILL.md)
  ! this run changed .claude/skills/phax-review/SKILL.md; the review follows the base copy
  ```

### The plan names its gate profile \{#the-plan-names-its-gate-profile}

> The profile that gates a run is the one the operator approved in its plan, never the one phax.json happens to list first.

- A plan states which of the project's gate profiles verifies its run in one section that phax reads, and phase Verification no longer names the profile. `plan.md — the gate-profile declaration`

  Now:

  ```text
  ## Gate profile

  `light`

  ## Required commands

  - `pnpm test:unit`
  - `git log`

  ...

  ### Verification

  The real-git test proves the hook left no marker file.
  ```

  :::details Before

  ```text
  ## Required commands

  - `pnpm test:unit`
  - `git log`

  ...

  ### Verification

  The `standard` gate profile in `phax.json`.
  ```

  :::

- The plan's JSON sidecar and its extracted plan carry the declared gate profile as a required run field. `plan sidecar and phax-plan.json — run.gateProfile`

  Now:

  ```text
  "run": {
    "shortName": "docs-lane",
    "title": "Docs lane",
    "requiredCommands": ["pnpm test:unit"],
    "gateProfile": "light"
  }
  ```

  :::details Before

  ```text
  "run": {
    "shortName": "docs-lane",
    "title": "Docs lane",
    "requiredCommands": ["pnpm test:unit"]
  }
  ```

  :::

- Running `phax plans lint` reports an error when a plan declares no gate profile, or one that phax.json does not define, and checks required commands against the declared profile. `phax plans lint`

  Now:

  ```text
  $ phax plans lint docs/plans/2611251200-docs-lane-plan.md
  docs/plans/2611251200-docs-lane-plan.md: 1 error, 0 warnings
  error    gate-profile  -  gate profile "light" is not defined in phax.json (defined: standard)
  $? = 1

  $ phax plans lint docs/plans/2611251300-untagged-plan.md
  docs/plans/2611251300-untagged-plan.md: 1 error, 0 warnings
  error    structure     -  the plan declares no gate profile (## Gate profile)
  $? = 1
  ```

  :::details Before

  ```text
  $ phax plans lint docs/plans/2611251200-docs-lane-plan.md
  docs/plans/2611251200-docs-lane-plan.md: no findings
  ```

  :::

- Running `phax run` gates the run with the profile its plan declares, and refuses before any worktree exists when phax.json does not define that profile. `phax run`

  Now:

  ```text
  $ phax run --plan docs/plans/2611251200-docs-lane-plan.md --dry-run
    Gate profile: light

  $ phax run --plan docs/plans/2611251200-docs-lane-plan.md
  ✗ gate profile "light" is not defined in phax.json (defined: standard)
    the plan declares it under ## Gate profile; no worktree was created
  $? = 2
  ```

  :::details Before

  ```text
  $ phax run --plan docs/plans/2611251200-docs-lane-plan.md
  (every phase gated by "standard", the first profile phax.json lists)

  $ phax run --plan docs/plans/2611251200-docs-lane-plan.md --dry-run
    Gate profile: standard
  ```

  :::

## Fixes \{#fixes}

- fix(spikes): build no regular expression from a variable in measure.mjs ([6806e20](https://github.com/lbdremy/phax/commit/6806e20b4026f525b5760e5f5f192697b1f82de6))
- fix(records): show the true explain output and short gate times ([ebfd916](https://github.com/lbdremy/phax/commit/ebfd916a85e4d8d006fe3129fef78f75ceb5e3cc))
