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, and this page is available as Markdown at https://docs.phax.run/guide/specs-and-plans.md.

Writing specs and plans

Specs and plans

Create them

phax artifact new spec <slug>                     # docs/specs/<YYMMDDHHMM>-<slug>.md
phax artifact new plan <slug> --spec <spec path> --last  # docs/plans/<YYMMDDHHMM>-<slug>-plan.md

phax names the file from the current UTC minute and the slug, with a Draft status, and refuses any other name (exit 12). A plan carries its spec's slug and names it as its source-spec; --spec can be left out when a plan has no spec. With --spec, say whether the plan is the spec's last: --last or --not-last (see below). Fill the file in with your agent: the phax-spec and phax-planning skills hold the formats, and point at the right sections — requirements and acceptance criteria for a spec; for each plan phase, its instructions, the files it creates and edits, its gate and its commit. examples/hello-world/plan.md is a small worked plan.

One spec, several plans. --last writes completes-spec: true, so the plan's run completes the spec; --not-last writes completes-spec: false, so the run leaves the spec live. Every plan of a spec except the last says --not-last. Splitting a spec across three plans:

phax artifact new plan greet-core --spec docs/specs/2610041200-greet.md --not-last   # plan 1 of 3
phax artifact new plan greet-cli  --spec docs/specs/2610041200-greet.md --not-last   # plan 2 of 3
phax artifact new plan greet-docs --spec docs/specs/2610041200-greet.md --last       # plan 3 of 3

Plan 1's frontmatter reads:

---
status: Draft
source-spec: docs/specs/2610041200-greet.md
completes-spec: false
---

Let phax write them

With --headless, phax runs the authoring session itself from a brief: it gives the agent the skill and the document's JSON Schema, accepts a valid document as the session's only output, renders it to Markdown, keeps the document as a .json sidecar beside it, and commits both. A plan written this way is already extracted, so phax run never extracts it again. A plan document's test strategy is a list of test lines, one per guarantee, each on four coordinates and an optional criterion id.

phax artifact new spec greet --headless --brief brief.md
phax artifact new plan greet --headless --brief brief.md --spec docs/specs/2610041200-greet.md --last
cat brief.md | phax artifact new spec greet --headless --brief -
authoring spec greet — claude-opus-5-5 / high
created docs/specs/2610041200-greet.md (Draft, headless)
sidecar docs/specs/2610041200-greet.json
commit a1b2c3d — docs(specs): draft greet
record authoring/2610041200-greet

--model and --effort choose the model, before authoring.spec|plan in phax.json and the catalog's default. The last line names the session's record. It exits 5 when the session's output is not a valid document, 8 on a provider rate or usage limit, and 12 when the slug, the brief or --spec is wrong.

A refused document, one that is not JSON or that the document's schema refuses, gets one retry: phax resumes the same session once, says what was refused, and asks for the whole document again. A warning names the refusal before the retry runs:

spec document refused — acceptanceCriteria[0].refs: is missing
  resuming the session once to ask for the whole document again

A not-JSON refusal names the parser's error and the position where parsing failed. If the retry's document is refused too, the authoring fails with exit 5, naming both refusals, and nothing is written. Rate and usage limits, provider errors and a failed commit are never retried. The record's retry field says whether a retry ran (none or retried), and the record keeps the retry's prompt and transcript beside the first answer's. phax artifact schema spec|plan prints the document's JSON Schema, and phax artifact schema verdicts prints the verdicts file's for phax artifact decide --verdicts. Headless authoring is experimental: the two document formats may still change.

If you edit the Markdown of a headless document, edit its sidecar too: phax artifact status tells you whether the body is still the sidecar's rendering, and approving a document whose body has diverged is refused.

Check a plan

phax plans lint docs/plans/2610041201-greet-plan.md
phax plans overview <plan>   # its phases, planned files by architecture part, test lines and criterion coverage
phax plans estimate <plan>   # its API-list cost, and whether it fits your subscription windows now

A read-only check, with no model: the plan's structure, its planned files against the working tree and against earlier phases, the commands it needs against phax.json, each phase's model and effort against the catalog, each phase's declaration lines (an interactive phase must not be the first or the last phase, must not directly follow another interactive phase and plans no file to create or edit; an acceptance phase runs with a configured acceptance provider and is refused without one, and a **Model reason:** line is an error: the label is **Assignment reason:**), each phase's test lines (a line off the format, an acceptance-loop line off an acceptance phase, an acceptance phase with none, and an unknown criterion id are errors; an uncovered criterion of the source spec is a warning), and the findings of your plan auditor if you have one. It exits 1 on any error; the warnings never fail it.

plans overview lays the plan out phase by phase: model, effort and mode, the acceptance pair, the planned files under the architecture's parts, the test lines, and which acceptance criteria of the source spec have a test. No model reads the plan, and nothing is written. See Reading a plan's overview.

plans estimate gives each phase's and the run's cost as P10/P50/P90, calibrated from this machine's cost ledgers, and says whether the plan fits the Claude subscription windows left right now. See Estimating a plan.

The structure check also reports a phase missing from the phase numbering, for example a plan with phase-01 and phase-03 but no ## phase-02 heading:

docs/plans/2610161201-greet-plan.md: 1 error, 0 warnings
error    structure  phase-02  no section for phase-02 in plan.md (expected a "## phase-02 — …" heading)

phax run and phax resume refuse a plan with a phase whose section they cannot find in plan.md. They look for the phase's ## phase-NN heading or its {#anchor}. phax run refuses before the run is named; both exit 11 and name the phase and phax plans lint.

Decide open questions

A spec or a plan can leave questions open, each with options, the loss each abandons, and a recommendation. phax artifact decide answers them with you, in an interactive Claude Code session:

phax artifact decide <path>                                  # framing F1–F5, then each open question
phax artifact decide <path> --question Q1                    # one question alone, open or arbitrated
phax artifact decide <path> --doctrine docs/doctrine.md      # add project rules after the skill
phax artifact decide <path> --model claude-sonnet-5-5 --effort medium

The agent raises five framing questions first, then presents the questions, and you decide. When you exit, phax asks the session for the revised document, checks it, shows the body diff and writes only what you accept: the artifact and its sidecar, committed together. --question re-arbitrates one question and keeps its previous verdict in its history; reopen an Approved artifact first. The session follows phax-decide-spec or phax-decide-plan; a copy in .claude/skills/ replaces the bundled one, and --doctrine appends a file after it. Interactive decide needs a terminal and a Draft artifact, runs on Claude Code only (default claude-opus-5-5 at high), and is refused inside a phase worktree. Every session leaves a decision record when records are on. Deciding open questions covers the flow.

When you already know your verdicts, write them in a file and pass it with --verdicts <file|->; --by operator replaces the terminal, and --json prints the report as one object:

phax artifact decide <path> --verdicts verdicts.json --by operator
phax artifact schema verdicts                                # the file's JSON Schema

A headless writer (default claude-sonnet-5-5 at medium, routed to a provider) records the verdicts and revises the body where a departing verdict implies it. A verdict that returns to the recommendation after a departure restores the body: it names the sections it restores when the departure named revised sections, and none when it named none. The writer runs read-only like every decide session, on any provider. phax checks its answer against the file, commits, and leaves the artifact Draft for you to read before approving. other is a reserved choice on every question. See Deciding from a verdicts file.

The approval lock. phax artifact approve refuses, with exit 12, while a spec or plan has an open question, and names phax artifact decide. Hand-authored artifacts are locked too, and an artifact with no question section is approved as before.

Revise a Draft

phax artifact revise <path> --amendment amendment.md changes a Draft that phax wrote headless, from a change request in prose (- reads it on stdin). One writer session returns the whole document with the amendment carried wherever it applies; phax checks that every question stays as it was, commits the artifact and its sidecar with a Revision-Id trailer, and leaves it Draft for you to read before approving. From a script, pass --by operator or --by machine:<grant>. See Revising a Draft.

Move them through their lifecycle

CommandFromTo
phax artifact approve [--by <arbiter>] <path>Draft; Stale (plan); Approved again to record a revisionApproved
phax artifact stale <path>Approved (plan)Stale
phax artifact reopen [--by <arbiter>] <path>Approved; Stale (plan)Draft
phax artifact complete <path>Approved; Stale (plan)Completed
phax artifact abandon <path>Draft, Approved; Stale (plan)Abandoned
phax artifact status <path>any— prints the status and the legal transitions

Each transition rewrites the status in the file's frontmatter and commits it on its own, and refuses when the files it writes have uncommitted changes. Completed and Abandoned move the file, and its sidecar, into the folder's archive/. Approving writes the artifact's own approval record file, docs/specs/approvals/<spec>.json or docs/plans/approvals/<plan>.json, with the commit it was made against; the record's approvedBy names the approver, --by operator (the committing git name: GIT_COMMITTER_NAME, else user.name) or --by machine:<grant>, and approve and reopen refuse with exit 12 without a terminal unless --by is given; completing or abandoning an artifact, or reopening one, deletes that file in the same commit (a reopen commit also carries a Reopened-By: trailer, and reopening a spec names its bound plans and leaves them unchanged), and no transition touches another artifact's record; approving a plan is refused while its spec's approval is missing or the spec has changed since. A run completes its own plan, and its spec only when the plan says it is the spec's last (completes-spec: true) and no other live plan still needs it, on the run's branch.

phax artifact migrate-documents lifts the headless sidecars written in an older shape and re-renders their bodies, once, after an upgrade; approve, reopen and decide refuse until it has run. A spec sidecar stamped below 0.27.0, or written before $schema, is lifted with a summary placeholder on every surface element when phax reads it, and migrate-documents restamps it; approve and complete refuse a spec still holding a placeholder. A plan sidecar stamped 0.26.0 or below has each phase's test strategy string read as test lines: migrate-documents lifts one whose every line follows the line format and refuses one holding prose, naming the phase and the line. See Troubleshooting.

Keep several plans in step

phax plans status                          # every Approved plan: fresh, or stale and why
phax plans status --apply                  # mark the stale ones Stale
phax plans overlap <plan> <plan>...        # which plans can run side by side without conflicts
phax plans overlap --landed <run> <plan>   # which plans a landed run's real diff touches
phax adjust-plan <plan> --landed <run>     # an agent session that updates a plan to what landed

plans status compares each plan with what its approval was made against: spec-changed when its spec changed, self-changed when the plan did, ground-changed when files it plans to touch changed since, missing-record when there is nothing to compare with. It reports and exits 0; --apply makes the change. plans overlap compares the files plans declare (file by file, not line by line); with --landed, it uses the files a finished run actually changed — run it before you archive that run. adjust-plan asks before it edits and commits anything.