---
title: "Registry, prompt and promotion commands"
description: "Reference for the asset registry: nova register, promote and rollback, prompt versions, deployment labels and two-person maker-checker sealing."
canonical: https://novafabric.ai/docs/cli-reference/registry/
last_updated: 2026-11-21
source: https://github.com/MSKazemi/novafabric/blob/main/docs/cli-reference.md
---

# Registry, prompt and promotion commands

Part of the [NovaFabric CLI reference](https://novafabric.ai/docs/cli-reference/). Both `nova` and `novafabric` run the same binary.

## Registry commands (v0.1)

### nova register \<spec.yaml\>

Register an asset from a YAML spec file. Exits 0 on success, 1 on validation or duplicate error.

**A new asset always enters the registry as `development` (works today).** A spec that
declares any other `status:` (`validated`, `pending_approval`, `staging`, `production`,
`archived`) is refused with exit 1 and nothing is written: registration runs no promotion
gate, so it may not place an asset in a gated status. Register, then move the asset with
`nova promote` (maker-checker, or `nova promote direct` with its ADR-0312 gate). The same
rule applies to `POST /api/assets` and `POST /api/assets/register-from-yaml` on
`nova serve` (422 / `ok: false`) and to `POST /v0/assets` on `nova server` (422
`registration_status_not_allowed`).

**A version that was ever in production can never be registered again** (exit 1, like a
duplicate), even after `nova unregister`: other systems pin that version, and new content
under the same number would silently change what the pin means. Register the new content
as a new version. Every registration writes a `register` row to the status history.

### nova suggest-register [\<capsule-ref\>] [OPTIONS]

Analyze captured run capsules and suggest assets to register. Inverts the onboarding workflow —
capture first, then let NovaFabric propose what to register from observed evidence.

**Three modes:**

- **Interactive** (default) — prompts per suggestion: `y` register, `n` skip, `e` open editor, `s` skip.
- `--draft-only` — write draft YAML files to `--output-dir` without registering.
- `--auto` — register all suggestions above `--min-confidence` (default 0.8) without prompting. Prints `N registered, D already registered, F failed` and exits `1` when any registration failed (a draft that does not validate, a registry error), so it can gate a CI step.

**Options:**

| Flag | Description |
|---|---|
| `<capsule-ref>` | Run ID or path. Omit to scan 10 most recent capsules. |
| `--output-dir / -o` | Directory for draft YAML files (default `.novafabric/drafts`). |
| `--draft-only` | Write drafts without registering. |
| `--auto` | Auto-register all suggestions above `--min-confidence`. |
| `--min-confidence` | Confidence threshold for `--auto` mode (default `0.8`). |
| `--skip-types` | Comma-separated asset types to skip (e.g. `prompt,agent`). |
| `--runs-dir` | Base directory containing capsule runs. |

**Confidence scoring:** models = 1.0 (every observed call), tools = 0.8 (min 2 calls), agents = 0.7.

**Post-capture hint:** after every successful `nova capture`, a one-line hint is printed when
unregistered assets are detected. Disable with `NOVAFABRIC_SUGGEST=0`.
The first capsule written to a directory also gets a one-line pointer to GitHub Discussions
(terminal only; disable with `NOVAFABRIC_COMMUNITY_HINT=0`).

**Examples:**

```bash
# Scan 10 most recent capsules interactively
nova suggest-register

# Analyze a specific run
nova suggest-register 01HXAY7M5JZ8R7K4P9DPBYK2WX

# Write draft YAML files for review
nova suggest-register --draft-only --output-dir ./drafts/

# Auto-register high-confidence suggestions, skipping agents
nova suggest-register --auto --min-confidence 0.8 --skip-types agent
```

**Dashboard equivalent:** Registry tab → Suggest Register panel (live suggestions table with one-click Register).

### nova list [--type TYPE] [--status STATUS] [--stale] [--stale-days N]

List registered assets. Optional filters by asset type (`model`, `agent`, `prompt`, etc.) or
lifecycle status (`development`, `staging`, `production`, `archived`).

- `--stale` — only show assets with no promotion, consumption, or eval activity in the last N days.
- `--stale-days N` — inactivity threshold (default: 30). Filters can be combined with `--status`/`--type`.

### nova inspect \<name[@version]\>

Show full metadata for an asset. If version is omitted, shows the latest registered version.

### nova promote

**v0.13.0:** `nova promote` is now a sub-group: `direct`, `propose`, and `approve`
(plus `keygen` since ADR-0312). Old scripts must add `direct` as the first positional
argument.

#### nova promote direct \<name@version\> --to \<status\> [--force] [--significance-gate]

Promote an asset in a single step (no SoD enforcement). Valid transitions:

| Current status | Valid targets |
|---|---|
| `development` | `staging`, `archived` |
| `staging` | `production`, `archived` |
| `production` | `archived` |
| `archived` | `staging` |

Agent assets require a passing eval result to promote to `staging` or `production`.
Use `--force` to override the eval gate (interactive confirmation required; audit-logged).
**`production` is a protected stage:** direct promotion into it needs an explicit
`promote_direct` policy allow and is refused by default. See *Protected stages* below.

**`--significance-gate`** (opt-in, ADR-0080) — replace the single-passing-eval
check with a *statistical* regression gate. A Wald SPRT runs over the asset's
recent pass/fail eval sequence and **only** blocks on a statistically significant
regression (`ACCEPT_H1`). Noise (`ACCEPT_H0`) and inconclusive evidence
(`CONTINUE`, too few runs) do **not** block, so a single-run dip cannot fire the
gate. Default hypotheses are `p0=0.9, p1=0.7, alpha=0.05, beta=0.05` (overridable
via the `promote_asset()` API). The flag is opt-in: omitting it preserves the
default single-passing-eval behavior. `--force` bypasses it.

**`--scores-file <path> [--metric task_pass]`** (NF-007, experimental) — source the
gate's pass/fail sequence from an evidence-grade `scores.jsonl` (the boolean `--metric`)
instead of the `eval_results` table. Omitting `--scores-file` preserves the exact
`eval_results` behavior.

**`--slsa-provenance [--slsa-out <path>] [--identity <id>]`** (NF-031, experimental,
[ADR-0096](https://novafabric.ai/docs/decisions/)) — on a **successful** promotion,
also emit a DSSE-signed SLSA v1 provenance (`slsa.dev/provenance/v1`) recording the promotion
decision (and the `significance-gate/v1` gate when `--significance-gate` is set). The subject
digest is the sha256 of the registered asset spec; the attestation is signed with the keyring
Ed25519 key for `--identity` (default: OS username; this SLSA option is the one place an
identity still defaults) and written to `<name>-<version>.slsa.json`
(or `--slsa-out`). Verify it with `nova verify-envelope`. **Opt-in:** without the flag, promotion
behavior and output are unchanged.

**`--slsa-ml-profile`** (NF-057, experimental, [ADR-0105](https://novafabric.ai/docs/decisions/)) — with
`--slsa-provenance`, emit the **SLSA-for-ML profile** instead of the generic one: the build type becomes
`https://novafabric.dev/promote-ml/v1`, a `gate-rule` byproduct records the gating rule, and an `eval-verdict`
byproduct carries the sha256 of the asset's recorded eval results (canonical JSON of its `eval_results` rows:
id, suite, pass flag, score, run time — the evidence the promote gate reads), binding the promoted model to the
eval that justified it. A promotion with no recorded eval (e.g. `--force`) gets no `eval-verdict` byproduct and a
warning; releases up to v0.107.0 digested the command's own constants instead, so every promotion of an asset
carried the same "verdict". Use for model assets. Still a valid `slsa.dev/provenance/v1` Statement, DSSE-signed
and `nova verify-envelope`-verifiable.

```bash
nova promote direct my-agent@v1.1 --to staging                       # default gate
nova promote direct my-agent@v1.1 --to staging --significance-gate   # statistical gate (eval_results)
nova promote direct my-agent@v1.1 --to staging --significance-gate \
    --scores-file cand/scores.jsonl --metric task_pass               # gate on evidence-grade scores
nova promote direct my-model@1.0.0 --to staging --slsa-provenance \
    --slsa-out my-model.slsa.json                                    # emit SLSA v1 provenance
nova promote direct my-model@1.0.0 --to staging --slsa-provenance \
    --slsa-ml-profile --slsa-out my-model.slsa.json                  # SLSA-for-ML (NF-057)
```

The dashboard Promote dialog (`Registry tab → PROMOTE →`) maps to `nova promote direct`.

#### Protected stages (ADR-0312) — works today

`nova promote direct` into a **protected stage** is refused unless the `promote_direct`
policy action returns an explicit allow. Today exactly one stage is protected:
`production`. Every other target behaves as before.

- The default policy (`policies/novafabric/defaults/promote_direct.rego`) denies
  `production`. With no OPA binary on `PATH`, NovaFabric runs the allow-all `NoopEngine`
  for the other gates, but **a NoopEngine result does not count as an explicit allow**
  here, so `--to production` is refused.
- `--force` overrides the eval gates only. It does **not** bypass this gate.
- To allow direct promotion for cases you accept, install OPA and point
  `NOVAFABRIC_POLICY_BUNDLE_PATH` at a bundle whose `novafabric.defaults.promote_direct`
  package allows them. The policy input carries `resource.to_status`,
  `resource.asset_type` and `resource.ref`. The CLI subject (`cli-user`) is not an
  authenticated identity, so do not key an allow on it.
- A refusal exits `1` and is recorded as a `policy.deny` audit event with
  `action: promote_direct`.
- The intended route into `production` is `nova promote propose` + `nova promote approve`.

#### nova promote keygen --identity NAME

Create the Ed25519 keyring key that `propose` and `approve` sign with
(`~/.config/novafabric/keyring/<identity>.pem`). Then print the **signer trust-list entry** an
operator adds to bind that key to the identity. Idempotent: an existing key is never
overwritten. This is the only command that creates a key for the maker-checker path,
including the checker of `nova annotate confirm`. A
new key is **not trusted** until it is added to the trust list.

```bash
nova promote keygen --identity alice
# Key for 'alice' created: …/keyring/alice.pem (fingerprint 1a2b3c4d5e6f7a8b)
# To bind it, an operator adds this entry under `signers:` in ~/.novafabric/promote-signers.yaml:
#   - identity: "alice"
#     public_key: <base64 raw Ed25519 public key>
#     fingerprint: 1a2b3c4d5e6f7a8b
#     roles: [proposer, approver]
```

#### Signer trust list (ADR-0312) — works today

`propose` and `approve` verify every signature against an operator-held trust list. It
is found at `NOVAFABRIC_PROMOTE_SIGNERS` if that is set, otherwise at
`$NOVAFABRIC_HOME/promote-signers.yaml`:

```yaml
signers:
  - identity: alice
    public_key: <base64 of the raw 32-byte Ed25519 public key>
    fingerprint: 1a2b3c4d5e6f7a8b   # optional; must match public_key if present
    roles: [proposer]
  - identity: bob
    public_key: <base64>
    roles: [approver]
```

- Each key is bound to **exactly one** identity. A key listed twice refuses the whole file.
- `roles` is drawn from `proposer` and `approver`. Give each person only the roles they hold.
- A missing, unreadable or malformed list refuses maker-checker promotion. It is never
  read as "trust everyone".
- The list is a trust anchor: whoever can write it decides who may approve. Keep it
  owned by an operator and read-only to signers. NovaFabric does not sign or protect
  the file itself.

#### nova promote propose \<name@version\> --to \<status\> --identity NAME

Open a maker-checker proposal (maker step). Signs a canonical payload with the keyring key
for `--identity`: proposal id, asset ref, the SHA-256 of the asset's registered spec
(`spec_sha256`), target stage, and a domain-separation tag (`nova-promote-signoff/v2`). Before
the proposal is stored, the signature is verified with the public key the trust list
binds to that identity, and the identity must hold the `proposer` role.

- `--identity NAME` — **required** (no default since ADR-0312). It must name an existing
  key from `nova promote keygen`. A missing key exits `1` and creates nothing.
- Exit `3`: the trust list is missing or malformed, the key is not listed, the key is bound
  to another identity, the role is missing, or the signature does not verify.
- An open proposal stored before ADR-0312 (unverified) is marked `superseded` by the new
  proposal instead of blocking the asset.
- The signature covers the asset's **content**, not only `name@version`: releases up to
  v0.107.0 signed the reference alone, so `unregister` + `register` of different content
  under the same version between propose and approve promoted content nobody reviewed.
  `unregister` now also supersedes the asset's open proposal.

#### nova promote approve \<name@version\> --identity NAME

Approve the open proposal for `name@version` (checker step). The approver signs a payload
bound to that exact proposal: its id, target stage and a hash of the maker's signature.
Before anything changes:

- The stored **maker** signature is re-verified against the trust list **over the asset's
  current content**. An edited proposal, a maker since removed from the list, or an asset
  whose spec changed since it was proposed is refused with exit `3` — as is a proposal signed
  with the v1 scheme (before content binding): re-propose it. A proposal
  stored before ADR-0312 reads as `unverified` and is refused with exit `3`; open a new
  one with `propose`.
- The **checker** signature must verify with the key bound to `--identity`, and that
  identity must hold the `approver` role. Otherwise the command exits `4`.
- Separation of duties compares the **bound** identities and keys, not the typed names.
  If maker and checker resolve to the same bound identity, the command exits `6`.

`--identity NAME` is **required** and must name an existing key. A missing key exits `1`
and creates nothing. On success, promotes the asset and records a `promote.approve` audit
event naming both bound identities and fingerprints. If the promote gates then refuse
(`promote` policy, an agent's eval, the lifecycle), the asset does not move, the proposal
returns to `open` so it can be approved again once the gate clears, and a
`promote.approve_reverted` event records that the approval took no effect.

Rows written before ADR-0312 still read. `nova export-model-independence` reports them
with `signature_verification: unverified`.

`maker_checker_gate.rego` (ADR-0058) is **not evaluated** by any action and has never
blocked anything. Protected-stage gating is the `promote_direct` action described above.

---

## NovaSeal linked-envelope chain maker-checker (v0.14.0, ADR-0059)

Cryptographic two-person authorization at the **capsule signing level**. Two separate DSSE envelopes (Proposal + Approval) are linked via SHA-256 of RFC 8785 JCS-canonicalized bytes. Offline-verifiable without a database.

Distinct from `nova promote propose/approve` (ADR-0058), which enforces two-actor approval for **asset registry lifecycle**. Both can be used together.

### nova policy sign

Sign and version a promotion policy document. The policy defines which certificate subjects are allowed as proposers and approvers. Stored in the NovaSeal Merkle log with a monotonically increasing version number.

```bash
nova policy sign \
  --key admin.pem \
  --cert admin_cert.pem \
  --proposer-subjects "alice,alice-ci" \
  --approver-subjects "bob,carol" \
  --bypass-valid-hours 24
# Policy signed and stored: version 1
```

Options:

- `--key PATH` — path to ECDSA P-256 PEM private key (admin key)
- `--cert PATH` — path to X.509 PEM certificate matching `--key`
- `--proposer-subjects TEXT` — comma-separated list of certificate CN values allowed to propose
- `--approver-subjects TEXT` — comma-separated list of CN values allowed to approve
- `--bypass-valid-hours N` — bypass validity window in hours (default: 24; range: 1–168)
- `--db PATH` — promotion-policy SQLite DB (default: the NovaSeal Merkle log file — `NOVAFABRIC_SEAL_DB_PATH`, then `merkle_db` in `novaseal.yaml`, then `$NOVAFABRIC_HOME/novaseal-merkle.db`; see [NovaSeal Configuration Reference](https://novafabric.ai/docs/novaseal-configuration/#31-path-resolution-order)). This is the store the dashboard SealTab reads. **Default changed:** up to v0.106.0 the code defaulted to `~/.local/share/novafabric/merkle.db` although this reference already named the resolved log; pass that path with `--db` to use a policy signed there.

Prints `Policy signed and stored: version N` on success.

---

### nova seal init

**Experimental** (ADR-0301). Turn on capsule sealing with a **local, self-asserted**
identity, offline, in one command. Sealing stays opt-in: nothing else enables it, and
`nova init` only offers this step.

```bash
nova seal init                     # create the identity + novaseal.yaml
nova seal init --force             # rotate the signing key (same local CA)
nova seal init --force --new-ca    # rotate key and CA (breaks CA-pinned continuity)
nova seal init --home /data/nova   # custom NOVAFABRIC_HOME
```

It writes, under `$NOVAFABRIC_HOME`:

| Path | Content | Mode |
|---|---|---|
| `keys/novaseal/signing.key.pem` | dedicated ECDSA P-256 signing key (not the `nova init` Ed25519 key) | 600 |
| `keys/novaseal/signing.crt.pem` | leaf certificate, issued by the local CA (`CA=FALSE`) | 644 |
| `keys/novaseal/ca.key.pem` | local seal CA key | 600 |
| `keys/novaseal/ca.crt.pem` | local seal CA certificate — pin it with `nova verify --ca-bundle` | 644 |
| `novaseal.yaml` | `profile: local`, first line `# managed-by: nova seal init`, no `tsa_url` | 644 |

Both certificates carry `O=NovaFabric local seal identity (self-asserted)` and no host or
user name. `nova verify` reports capsules sealed with it as
`identity_trust=self-asserted`, or `local-ca-pinned` with `--ca-bundle …/ca.crt.pem`.

| Situation | Result |
|---|---|
| nothing configured | creates the identity (reuses a CA or key left in `keys/novaseal/`); exit 0 |
| configured by `nova seal init` | no change, prints the identity (idempotent); exit 0 |
| configured by an operator (no marker line: KMS, operator CA…) | no change; with `--force`, **refused** (exit 1) — never replaced by a self-asserted identity |
| managed config no longer loads | exit 1, suggests `--force` |
| `--force` | archives key, leaf and config to `keys/novaseal/archive/<UTC>/`, new key + leaf from the **same** CA, `key_rotation` entry in the Merkle log |
| `--force --new-ca` | also archives and replaces the CA; prints that pinned verifiers lose continuity |
| `--force` with the CA key missing | exit 1; restore it or pass `--new-ca` |
| `--new-ca` without `--force` | exit 1 |
| `NOVAFABRIC_SEAL_CONFIG` points elsewhere | warns that capture reads that file instead |

The leaf is valid 5 years and the CA 10 years. `--ca-bundle` validates at verification
time, so rotate before the leaf expires. No network access at any point.

---

### nova seal propose \<capsule-id\>

Create a promotion proposal (maker step). Builds a `promote/proposal/v1` DSSE predicate, validates it against the JSON Schema, signs with ECDSA P-256, and stores at `{data_dir}/promote/{capsule_id}/proposal/{uuid}.json`.

The proposal's `capsule_digest` is the SHA-256 of the capsule's `capsule.yaml` — which binds every evidence file through `evidence_digests` — so the capsule must exist in the capsule store (resolved like every `<capsule-id>` argument); an unknown id exits `1` and nothing is proposed. `nova seal bypass` signs the same digest. Releases up to v0.107.0 signed a hash of the id string, so an approval bound nothing about the capsule's content.

```bash
nova seal propose capsule-abc123 \
  --justification "All eval gates green; p99 latency < 200ms. Ready for staging." \
  --key proposer.pem \
  --cert proposer_cert.pem
# Proposal created: b7820d90-039c-4d1f-a586-5023c82e9dd4
#   capsule: capsule-abc123
#   proposer: alice
#   policy version: 1
#   Run nova seal approve b7820d90-... --capsule-id capsule-abc123 as a different identity to complete.
```

Options:

- `--justification, -j TEXT` — rationale for the promotion; must be ≥ 20 characters (validated before signing; shorter values cause exit 1 without writing any bundle)
- `--key PATH` — ECDSA P-256 PEM private key (proposer key)
- `--cert PATH` — X.509 PEM certificate matching `--key`
- `--target-env TEXT` — target deployment environment (default: `staging`)
- `--db PATH` — promotion-policy SQLite DB (default: the NovaSeal Merkle log file — `NOVAFABRIC_SEAL_DB_PATH`, then `merkle_db` in `novaseal.yaml`, then `$NOVAFABRIC_HOME/novaseal-merkle.db`; see [NovaSeal Configuration Reference](https://novafabric.ai/docs/novaseal-configuration/#31-path-resolution-order)). This is the store the dashboard SealTab reads. **Default changed:** up to v0.106.0 the code defaulted to `~/.local/share/novafabric/merkle.db` although this reference already named the resolved log; pass that path with `--db` to use a policy signed there.
- `--data-dir PATH` — root directory for bundle storage (default: `~/.local/share/novafabric`; bundles live under `<data-dir>/promote/<capsule-id>/…`)

Exit codes: `0` (proposal created), `1` (validation error, signing error, or no policy found).

**Prerequisites:** a policy must exist (`nova policy sign` must have been run). The command reads the latest policy and embeds its version number in the predicate.

---

### nova seal approve \<proposal-uuid\>

Counter-sign a proposal (checker step). Fetches the Proposal bundle, displays its contents, prompts for confirmation, then builds and stores an Approval bundle.

```bash
nova seal approve b7820d90-039c-4d1f-a586-5023c82e9dd4 \
  --capsule-id capsule-abc123 \
  --key approver.pem \
  --cert approver_cert.pem
# Proposal details:
#   capsule_id:    capsule-abc123
#   justification: All eval gates green; p99 latency < 200ms. ...
#   proposer:      alice
#   timestamp:     2026-05-15T10:30:00Z
# Approve this proposal? [y/N]: y
# Approval recorded: 8b778f50-ea38-49c2-bcdc-3a69a1f8e841
```

Options:

- `--capsule-id TEXT` — capsule ID (required; must match the proposal's `capsule_id` field)
- `--key PATH` — ECDSA P-256 PEM private key (approver key)
- `--cert PATH` — X.509 PEM certificate matching `--key`
- `--db PATH` — accepted for compatibility and ignored: this command does not read the policy (`nova seal propose` and `nova seal verify` do).
- `--data-dir PATH` — bundle storage root (default: `~/.local/share/novafabric`; bundles live under `<data-dir>/promote/<capsule-id>/…`)
- `--ca-bundle PATH` — PEM CA bundle the proposer's certificate must chain to before its
  details are shown (default: `$NOVAFABRIC_PROMOTE_CA_BUNDLE`; see *Promote trust root* below)
- `--insecure-self-signed` — accept any self-signed proposer certificate (development only)

If the operator types anything other than `y` at the prompt → exits 0 with "Promotion approval cancelled." No bundle is written.

**`proposal_digest` computation:** `SHA-256(JCS(proposal_envelope_bytes))` — RFC 8785 JSON Canonicalization Scheme, not `json.dumps`. This makes the approval cryptographically bound to the exact bytes the proposer signed.

Exit codes: `0` (approval recorded or cancelled), `1` (proposal not found or signing error).

---

### nova seal verify \<capsule-id\> [--offline]

Run the five-check SoD verifier. Loads the Proposal and Approval bundles, loads the policy version recorded in the Proposal, and runs five checks in order (stops at first failure).

```bash
nova seal verify capsule-abc123 --ca-bundle /etc/novaseal/promote-ca.pem
# SoD verification passed   (exit 0)

nova seal verify capsule-abc123 --insecure-self-signed   # development only
# SoD verification passed   (exit 0; signer identity NOT checked)
```

**Promote trust root (ADR-0315, experimental).** Every proposal, approval, signed policy and
bypass carries the certificate that signed it, so the name the policy matches on is only as
trustworthy as the CA that issued that certificate. The verifier therefore requires a trust
root: `--ca-bundle` (or `$NOVAFABRIC_PROMOTE_CA_BUNDLE`), and every signer must chain to it
(offline RFC 5280 path validation, the same code NovaSeal uses for `nova verify --ca-bundle`).
With neither set, verification refuses with exit 3 and says how to configure one;
`--insecure-self-signed` (or `NOVAFABRIC_PROMOTE_INSECURE_SELF_SIGNED=1`) accepts any
self-signed signer and is meant for local development only. `nova serve`, `nova server` and
`nova export-model-independence` read the same environment variables.

**The five checks and their exit codes on failure:**

| Check | Description | Exit code |
|---|---|---|
| 1 | Proposer cert subject ∈ `policy.proposer_key_ids` | 3 |
| 2 | Approver cert subject ∈ `policy.approver_key_ids` | 4 |
| 3 | `proposal_digest` in Approval = SHA-256(JCS(Proposal envelope bytes)) | 5 |
| 4 | `approver_subject ≠ proposer_subject` (no self-approval) | 6 |
| 5 | Approval timestamp > Proposal timestamp (ordering) | 7 |

Additional exit codes:
- `3` — also: no trust root configured, a signer that does not chain to it, or a signed
  policy whose signature does not verify
- `2` — the `--ca-bundle` file cannot be read
- `8` — no approval: the Approval bundle is missing, or the approver signed `decision: rejected` (releases up to v0.107.0 ignored the signed decision, so a rejection passed)
- `9` — Proposal bundle not found for capsule
- `10` — the capsule does not exist, or is not the one that was proposed: the proposal's (or a
  bypass's) signed `capsule_digest` is not the SHA-256 of its `capsule.yaml` now — the capsule
  changed after approval, or the proposal predates content binding (it signed a hash of the id;
  the message says to re-propose). A bypass signed for other content is ignored.
- `1` — other error (missing policy, malformed envelope)

`POST /api/seal/{capsule_id}/verify` (`nova serve`) and `POST /v0/seal/{capsule_id}/verify`
(`nova server`) run the same check against the capsule the server holds and return
`content_checked: true` on a pass; a capsule id that is not one safe path segment is `400` on
`/v0`. Before this fix the `/v0` route never passed the capsule, so it answered `passed: true`
for content changed since approval and for a capsule the server does not hold. A caller of the
library `verify_sod()` without a `capsule_dir` gets `content_checked: false`: nothing bound the
approval to the content.

Options:

- `--offline` — skip any network calls (accepted; fully functional in v0.1 since no Rekor calls are made at verify time)
- `--db PATH` — promotion-policy SQLite DB (default: the NovaSeal Merkle log file — `NOVAFABRIC_SEAL_DB_PATH`, then `merkle_db` in `novaseal.yaml`, then `$NOVAFABRIC_HOME/novaseal-merkle.db`; see [NovaSeal Configuration Reference](https://novafabric.ai/docs/novaseal-configuration/#31-path-resolution-order)). This is the store the dashboard SealTab reads. **Default changed:** up to v0.106.0 the code defaulted to `~/.local/share/novafabric/merkle.db` although this reference already named the resolved log; pass that path with `--db` to use a policy signed there.
- `--data-dir PATH` — bundle storage root (default: `~/.local/share/novafabric`; bundles live under `<data-dir>/promote/<capsule-id>/…`)
- `--ca-bundle PATH` — PEM CA bundle every promote signer must chain to (default:
  `$NOVAFABRIC_PROMOTE_CA_BUNDLE`)
- `--insecure-self-signed` — accept any self-signed signer (development only)

**When a bypass counts.** An active bypass skips the five checks only if all of these hold:
its signature verifies and its signer chains to the trust root; the signer's certificate
subject is in the **latest** policy's `approver_key_ids`; the signed predicate names this
capsule; it is unexpired by its **signed** `valid_until`; and the audit log holds its
`seal.bypass.create` entry (same capsule, `bypass_uuid` and envelope SHA-256) and no
`seal.bypass.abort` for it (review r8: a bypass file planted in the store without `nova seal
bypass` has no entry and no notification). The copy of `valid_until` in the
bundle store is not signed, so it can shorten a bypass but never extend it. A bypass that
fails any condition is ignored and the five checks run as usual.
`NOVAFABRIC_PROMOTE_BYPASS_AUDIT_OPTIONAL=1` skips the audit-entry check, for a bundle store
copied without its audit log; the message then says `audit entry not checked`.

**Policy-time loading:** the verifier loads the policy version recorded in the Proposal's `policy_version` field, so a policy change after proposal creation does not *grant* anyone retroactively (ADR-0059 §Proposal-time policy). It also loads the latest policy, and a proposer or approver the latest policy no longer lists is **revoked**: SoD fails (exit `3` for the proposer, `4` for the approver) however old the policy the proposal cites. A newer policy that still lists both signers leaves an in-flight proposal valid.

---

### nova seal bypass

Create a time-limited, signed bypass of the maker-checker separation-of-duties requirement
for one capsule. Use sparingly — every bypass leaves a permanent audit trail.

```bash
nova seal bypass <capsule-id> --reason "<justification, at least 50 characters>" \
  --key signer.pem --cert signer_cert.pem [--duration 24h]
```

Options:
- `<capsule-id>` (required) — capsule to bypass SoD for
- `--reason TEXT` / `-r` (required) — human-readable justification, at least 50 characters
- `--key PATH`, `--cert PATH` (required) — ECDSA P-256 private key PEM and X.509 certificate PEM that sign the bypass
- `--duration TEXT` — validity window, e.g. `24h`, `7d` (default: `24h`, maximum `168h`)
- `--target-env TEXT` — target environment (default: `production`)
- `--notify EMAIL` — address to notify (repeatable). Signed into the bypass as `mailto:<addr>` and passed to the configured channel in the event's `recipients`; NovaFabric itself sends no email, and a warning says so when no channel is configured
- `--data-dir PATH` — promote-bundle data directory (default: `~/.local/share/novafabric`; bundles live under `<data-dir>/promote/<capsule-id>/…`)
- `--db PATH` — accepted for compatibility and ignored: this command does not read the policy (`nova seal propose` and `nova seal verify` do).

The bypass is recorded in the NovaSeal bypass log. The dashboard **SealTab** shows all active and expired bypasses with approver identity.

**Fail closed (works today).** The bypass is stored only after its `seal.bypass.create` entry is in the hash-chained audit log (actor `cli-user`, the certificate's name as `authorized_by`, the envelope's SHA-256, the configured notification channels). If that entry cannot be written, the bypass is refused, nothing is stored or announced, and the command exits 1. If the entry was written but the bypass file cannot then be stored, a `seal.bypass.abort` entry withdraws it and the command exits 1 (review r8).

**Notifications.** The signed predicate records the channels configured at signing time: `notification_status` is `pending` when `NOVA_BYPASS_NOTIFY_FILE` or `NOVA_BYPASS_NOTIFY_WEBHOOK` is set, `not_configured` otherwise, never `sent`. Delivery happens after signing and its outcome is the `seal.bypass.notify` audit entry. The webhook has a 5 s total deadline. See [NovaSeal configuration §4.1](https://novafabric.ai/docs/novaseal-configuration/#41-maker-checker-bypass-notifications).

Exit codes: `0` bypass stored; `1` invalid input, signing error, or the audit entry could not be written (nothing stored).

---

### nova seal log verify

Verify the integrity of the NovaSeal Merkle log — checks that the log has not been tampered with since the last append.  Supports both SQLite (default) and Postgres backends (Scale-S4).

```bash
nova seal log verify [--db URI] [--full] [--verbose]
```

Options:
- `--db URI` — Merkle log path (SQLite file) **or** `postgresql://` DSN for Postgres backend.  Default: `$NOVAFABRIC_SEAL_DB_PATH` or `~/.novafabric/novaseal-merkle.db`.  Postgres requires `pip install novafabric[seal-postgres]`.
- `--full` — also re-hash every stored entry against its leaf hash (Postgres; the SQLite backend always does this).  Default on Postgres: the entry re-hash is spot-checked on up to 1 000 random leaves.
- `--verbose` / `-v` — show per-leaf details on failure.
- `--consistency N` — additionally emit + verify a consistency proof from tree size `N` to the current head (experimental, ADR-0041 v0.2). Without `--old-root` the old root is the log's own stored head at `N`, which a log rewritten together with its stored heads also rewrites, so the output says `Consistency proof … internal consistency only`.
- `--old-root HEX` — with `--consistency N`: the root at size `N` as you published, witnessed or anchored it earlier. Only then is the result an **append-only proof** (`Append-only proof N → M: OK`); a rewritten log fails it (exit `2`). The proof follows the log's root version (ADR-0313; printed as `Root version:`): an RFC 9162 consistency path for a v2 log (every log created from ADR-0313 on), an aligned perfect-subtree decomposition for a v1 log (created earlier). Either is verified against both tree sizes, not only both roots.

Returns exit code 0 if the log is consistent, 1 if tampered or inconsistent, 2 if a `--consistency` proof fails (or `--old-root` is given without `--consistency`), 3 if no log exists at the location. The log is opened read-only and is never created: releases up to v0.107.0 created an empty log at a mistyped `--db` and printed `Consistency: OK`.

**What a clean result guarantees, and what it costs.** Every run — with or without `--full`, on either backend — recomputes the Merkle root from **every** stored leaf hash and compares it with the recorded tree head, so tampering with any leaf hash is detected. Nothing is trusted that is not re-derived from the stored data. The price is linear cost: the root pass is O(N). *Measured:* ~1.9 s end to end at 1 M entries (GitHub-hosted runner + Postgres 16, 2026-09); the hashing alone, in-process with no database, measured 1361 ms at 1 M (2026-09) and scales at roughly 1.2 µs per leaf (re-measured on a laptop, 2026-10). At millions of entries, schedule verification as an audit job rather than running it interactively. An earlier `p99 < 200 ms at 1M entries` target (Scale-S4) was never met and has been **withdrawn by decision** ([ADR-0268](https://novafabric.ai/docs/decisions/)): reaching it would mean checking only sampled leaves against a signed tree head, a weaker guarantee.

**Examples:**

```bash
# SQLite (default)
nova seal log verify

# Postgres — samples the entry re-hash; the root is still recomputed from every leaf
nova seal log verify --db postgresql://user:pass@db.example.com/nova

# Full audit (slower — re-hashes every entry_json)
nova seal log verify --db postgresql://... --full

# Append-only since a tree head you published at size 1000
nova seal log verify --consistency 1000 --old-root 3f9c…
```

**Env var:** `NOVAFABRIC_SEAL_DB_PATH` — sets the default `--db` value; accepts both file paths and `postgresql://` DSNs.

---

### nova seal ratchet (experimental, v0.50.0, ADR-0089)

Forward-secure per-node signing key ratchet. Opt-in — the static-key NovaSeal
signing path remains the default. State lives under
`$NOVAFABRIC_HOME/seal/ratchet` (override: `NOVAFABRIC_RATCHET_DIR`).

```bash
nova seal ratchet init --node-id node-a      # provision epoch-0 chain key
nova seal ratchet rotate --node-id node-a    # advance epoch; erase old chain key (best-effort)
nova seal ratchet status --node-id node-a    # current epoch + registry history
```

Properties:
- `K_{i+1} = HKDF-SHA256(K_i)`; per-epoch Ed25519 key derived deterministically from `K_i`.
- Compromise at epoch N cannot forge epochs < N (old chain keys erased); current/future epochs remain forgeable until detected — rotate often.
- Epoch public keys are appended to an append-only registry; verification rejects seals claiming an epoch older than the registry's latest (rollback detection).
- Secure erase is best-effort (overwrite + delete); journaling filesystems and SSD wear-levelling may retain stale blocks — see ADR-0089.

---

### nova eval agent

Run the legacy asset-based evaluation suites declared in an agent's spec (`spec.evals`,
resolved via the `novafabric.evals` entry-point group) and store the results in the
registry. Prefer `nova eval run` for new work.

```bash
nova eval agent <name@version>
```

Options:
- `<name@version>` (required) — asset reference (e.g. `my-agent@0.3.0`)

Results are stored in `eval_results` table and checked against the Rego gate for promotion eligibility.

Exit codes: `0` when every suite passes; `1` on FAIL — including a suite named in `spec.evals`
that is not installed — or when the asset is not found. Before this release a FAIL printed `FAIL`
but exited `0`, so the command could not gate a CI step; it now matches `nova eval run`.

### nova eval run

Run a standard evaluation suite against a capsule directory.

```bash
nova eval run <capsule-dir> --suite SUITE_ID [--config KEY=VALUE] [--output result.json]
```

Options:
- `<capsule-dir>` (required) — run capsule directory
- `--suite SUITE_ID` / `-s` (required) — a suite ID from `nova eval list` (e.g. `novafabric-smoke-v1`, `gaia-v1`)
- `--config KEY=VALUE` / `-c` — config pairs passed to the suite adapter
- `--output PATH` / `-o` — write the EvalResult JSON to this file (the input `nova eval compare` reads)

### nova eval cost \<document\>

Render a self-reported eval-cost / compute disclosure (ADR-0154 D2, NF-229,
**experimental**).

```bash
nova eval cost cost.json
nova eval cost cost.json --json
```

Options:
- `<document>` (required) — JSON file with `wall_seconds`, `token_in`, `token_out`,
  `usd_cost`, and optionally `energy_wh` / `hardware_ref`
- `--json` — emit the record as JSON instead of text

**Scope, honestly:** every figure is **self-reported by the harness**. NovaFabric
discloses what it was given — it does not measure, verify, or certify these values,
and it does not run the eval. Both output modes carry that honesty line, `--json`
included, as an `honesty_line` field.

This slice reads the figures from the document you pass. Reading `facets.eval_cost`
from a sealed capsule (`--capsule <run_id>`) is **planned**, not implemented.

### nova eval compare

Compare two EvalResult JSON files (as written by `nova eval run --output`) and report regressions.

```bash
nova eval compare baseline.json candidate.json [--alpha 0.05] [--min-samples 5]
```

Options:
- `<baseline>` `<candidate>` (required) — the two EvalResult JSON files
- `--alpha FLOAT` — significance level / relative-delta threshold (default: `0.05`)
- `--min-samples N` — minimum `sample_size` that enables the z-test (default: `5`)

A **regression** is a significant *decrease* of a metric: eval metrics are higher-is-better
(the schema's `threshold` is the minimum acceptable value). With both files carrying a
`statistical_context` of at least `--min-samples` samples and a confidence interval, a
one-sided z-test decides; otherwise a relative decrease above `--alpha` is a regression.
An improvement is never one.

Exit codes: `0` every baseline metric held or improved; `1` a regression; `2` the files
cannot be compared — different `suite_id`s, or a baseline metric is missing from the
candidate (a suite that crashed before writing it, or a renamed metric). So
`nova eval compare baseline.json candidate.json && echo "No regression"` works as a CI
gate: a run that lost its metric fails it. A metric only the candidate has is ignored.

### nova eval list

List all registered eval suite adapters discovered via the `novafabric.eval_suites` entry-point group.

```bash
nova eval list
```

Output columns: **Suite ID**, **Version**, **OCI Digest** (`host-env` for suites that run locally), **Entry Point** (importable module path).

Built-in suites:

| Suite ID | Version | Notes |
|---|---|---|
| `novafabric-smoke-v1` | 0.1.0 | Fast structural check, no OCI container: `capsule.yaml` parses and has a `run_id`, and the replay policy it names (`replay_policy_ref`, default `replay.yaml`) is a regular file in the capsule root |
| `gaia-v1` | 0.1.0 | GAIA Lvl-1/2/3 benchmark (OCI-pinned) |
| `mmlu-v1` | 0.1.0 | MMLU 57-subject knowledge benchmark (OCI-pinned) |
| `truthful-qa-v1` | 0.1.0 | TruthfulQA adversarial honesty benchmark (OCI-pinned) |
| `swe-bench-verified-v1` | 0.1.0 | SWE-bench Verified coding benchmark (OCI-pinned) |
| `agentbench-v1` | 0.1.0 | AgentBench multi-task agent benchmark (OCI-pinned) |

**Container suite contract.** NovaFabric publishes no eval image (ADR-0308); an image you
build for an OCI-pinned suite is run as `docker run --rm -v <capsule>:/novafabric/eval-capsule:ro
<image>@<digest> <argv>`, where the capsule is the read-only mount and `<argv>` is fixed per suite:

| Suite | Argv inside the container |
|---|---|
| `gaia-v1` | `gaia-run --capsule /novafabric/eval-capsule --output stdout` |
| `mmlu-v1` | `mmlu-run --capsule /novafabric/eval-capsule --output stdout` |
| `truthful-qa-v1` | `truthful-qa-run --capsule /novafabric/eval-capsule --output stdout` |
| `swe-bench-verified-v1` | `swe-bench-run --capsule /novafabric/eval-capsule` |
| `agentbench-v1` | `agentbench-run --capsule /novafabric/eval-capsule` |

The binary writes one EvalResult JSON document to stdout and exits `0`; a non-zero exit or
unparseable stdout fails the run.

Third-party suites register via `[project.entry-points."novafabric.eval_suites"]` in their `pyproject.toml`. Any load errors for registered adapters are shown inline without crashing the command.

### nova eval card / nova eval score (experimental)

> **Experimental — NF-002 / NF-010, [ADR-0099](https://novafabric.ai/docs/decisions/).**
> Evidence-grade evaluation: a **score is not a number — it is a signed record** binding
> `(value, evaluator-identity, subject-span-digest, verdict)`. Library + CLI are shipped
> behind the experimental label; the API may change and there is no dashboard UI yet.

An **eval card** is the reproducibility key for a score: it pins the exact evaluator
(judge model identity + endpoint reference, prompt version, rubric, dataset version,
human-agreement calibration), is content-addressed (`eval_card_digest` = sha256 over the
card's canonical JSON excluding its signature), and is Ed25519-signed with the local
keyring. A **score** is one line of an additive, optional `scores.jsonl` file; a capsule
without that file remains valid.

```bash
# create → sign → register an evaluator
nova eval card new --source code --card-id exact-match --name "Exact Match" --out card.json
nova eval card sign card.json                       # local Ed25519 keyring; prints digest
nova eval card register card.json                   # into the eval-card registry (must be signed)
nova eval card show   exact-match@0.1.0             # card JSON + digest
nova eval card verify exact-match@0.1.0             # signature_ok / calibration → exit code

# record and list evidence-grade scores
nova eval score add  --card exact-match@0.1.0 --subject sha256:<hex> \
                     --value true --value-type boolean --source code \
                     --name exact_match --capsule ./my-capsule      # or --scores-file scores.jsonl
nova eval score list --capsule ./my-capsule [--source judge] [--json]
```

`nova eval card verify` exits non-zero on a broken signature, a missing local key
(`key_id` mismatch → exit 2), or missing calibration on a `judge` card. `nova eval score
add` refuses a `--card` ref that does not resolve to a registered eval card. Judge models
are referenced by identity + a configurable endpoint (`env:NOVA_JUDGE_ENDPOINT`); no
external URL is hardcoded. **Writing a score into a `--capsule` directory seals it:** the
score log (`scores.jsonl`) is covered by the capsule Merkle root, so any Evidence Bundle
built from that capsule (`nova export-evidence`) detects score tampering — no separate
re-seal step is required.

### nova eval score config (experimental)

> **Experimental — [ADR-0117](https://novafabric.ai/docs/decisions/),
> spec `score-config-v0.md`.** The
> **score-configuration catalog**: named, reusable, **immutable, content-addressed**
> definitions of what a valid score for a given metric `name` looks like, so scores
> under one name are coherent and comparable across capsules. Fully additive: the
> `Score` record and `scores.jsonl` are unchanged, and a metric without a config is a
> *free score* — exactly the previous behavior.

A `ScoreConfig` declares a metric's `value_type` (`boolean` | `categorical` | `numeric`
— the same vocabulary as `Score.value_type`), plus the allowed `categories` (optionally
ordinal-ranked, e.g. `bad=0 < ok=1 < good=2`) or the inclusive numeric range with an
optional direction (`higher-better` | `lower-better`). Configs live in the local
registry SQLite (no server, no internet); each is pinned by a `sha256:` `content_digest`
over its canonical definition body (wire contract:
[`schemas/score-config-v0.schema.json`](https://github.com/MSKazemi/novafabric/blob/main/schemas/score-config-v0.schema.json)).

```bash
# declare metric shapes (immutable; a changed body bumps the version, never edits)
nova eval score config add --name helpfulness --value-type categorical \
    --description "How helpful the turn was." \
    --category bad:0 --category ok:1 --category good:2
nova eval score config add --name toxicity --value-type numeric \
    --description "Lower is better." --min 0 --max 1 --direction lower-better
nova eval score config add --name grounded --value-type boolean \
    --description "True iff every claim is supported."

nova eval score config list [--all] [--json]    # latest per name; --all = every version
nova eval score config get  toxicity@1          # canonical JSON (also: bare name, sha256:<hex>)
nova eval score config show toxicity            # human view + version history

# opt-in enforcement on the append path (default OFF — free scores stay legal)
nova eval score add --card tox-scan@0.1.0 --subject sha256:<hex> \
    --value 0.3 --value-type numeric --source code --name toxicity \
    --scores-file scores.jsonl --validate-scores
```

Re-registering an **identical** body is a no-op (same digest, same version).
`nova eval score add --validate-scores` resolves the latest config for `--name` and
refuses the append (`exit 1`, nothing written) when the score's `value_type` disagrees,
a categorical value is not in the allowed set, or a numeric value falls outside the
inclusive `[min, max]`. Without the flag — or when no config governs the name — the
score is appended unchanged. Because a config is immutable and content-addressed, an
aggregate ("avg `helpfulness` over 500 capsules") can pin the exact `content_digest` it
was computed against, making cross-capsule comparability reproducible evidence.
Today that pin is wired into dataset experiments: `nova experiment run --score-config`
records the digest and `nova experiment compare` reports comparability keyed by it
(experimental, ADR-0117 P4 — see the `nova experiment` section).

### nova eval contamination-check (experimental)

> **Experimental — NF-028, [ADR-0108](https://novafabric.ai/docs/decisions/).** Flags a capsule that
> was run against a *contaminated* or *superseded* benchmark version (contamination silently inflates eval
> scores). Detection/flagging only — no remediation.

```bash
# check a capsule's dataset_provenance facets (recorded status only)
nova eval contamination-check ./my-capsule

# resolve against a configurable known-bad hash registry (no default URL)
nova eval contamination-check ./my-capsule --registry known-bad.json --json
```

Reads the additive `dataset_provenance` facets stored under the capsule's
`extensions/dev.novafabric.dataset-provenance/` namespace (schema
[`schemas/dataset-provenance-v1.schema.json`](https://github.com/MSKazemi/novafabric/blob/main/schemas/dataset-provenance-v1.schema.json)) — each carrying
`name`, `version`, `dataset_hash`, `split_hash`, and `status` ∈ `current|superseded|contaminated|unknown`. The
`--registry` JSON (`{"contaminated": [...], "superseded": [...]}` of `sha256:` hashes) upgrades a facet's status
when a dataset/split hash matches; the registry never downgrades a facet's recorded severity.

The check **fails closed**: a facet file that cannot be read, is not JSON, or does not validate against the
schema (for example a missing `name` or a `status` outside the four values), and a facet namespace that is a
file rather than a directory, each produce an `invalid` row with a `reason` (a *Reason* column in the table, a
`reason` field in `--json`). No registry can clear it. (Fixed 2026-10-22: a malformed facet used to be skipped
silently, so a capsule whose only facet was unreadable reported no facets and exited `0`.)

Hashes are compared in one canonical form, `sha256:<lowercase hex>`: a facet or registry hash written in upper
case, without the `sha256:` prefix, or with surrounding whitespace still matches. A value that is not 4–64 hex
digits after that makes the facet `invalid` (in the registry it is a usage error, exit `2`). Also `invalid`: a
facet with a duplicate JSON key, a subdirectory in the namespace (the namespace is flat; a facet one level down
would never be checked), a facet that is a symlink, a FIFO or a device, a facet over 1 MiB, and a namespace or
`extensions/` directory that is a symlink. Facet files match `*.json` case-insensitively (`m.JSON` is read).

**Exit codes:** `4` when any dataset is contaminated, superseded, or `invalid` (CI-gateable), `0` when all are
current/unknown, `2` on a usage error.

### nova eval import-inspect / export-inspect (experimental)

> **Experimental — NF-024, [ADR-0108](https://novafabric.ai/docs/decisions/).** Score-level bridge
> between [Inspect AI](https://inspect.aisi.org.uk) (UK AISI) JSON eval logs and NovaFabric's
> evidence-grade `scores.jsonl`. Pure stdlib JSON parsing against the documented Inspect log structure —
> **no `inspect-ai` dependency**. The Solver-steps → span-tree import and byte-equal native round-trip
> from the NF-024 spec remain *planned*.

```bash
# import an Inspect JSON eval log's scorer results into a capsule's score log
nova eval import-inspect ./logs/hello.json --capsule ./my-capsule

# export a capsule's scores.jsonl as an Inspect-compatible JSON log
nova eval export-inspect ./my-capsule --output inspect-log.json   # or stdout
```

**Import** maps each sample scorer result (and each aggregate `results` metric) to a typed `Score`:
Inspect `"C"`/`"I"` verdict strings stay `categorical` (no lossy coercion), numbers become `numeric`,
booleans `boolean`; `model_graded_*` scorers map to `source: judge`, everything else to `source: code`.
Every imported score is provenance-stamped — `evaluator_id: inspect-ai:<scorer>` plus a synthetic
content-addressed `eval_card_digest` derived from the foreign scorer identity + mapping version (it is
*not* a signed NovaFabric eval card). The mapping is versioned and only pinned Inspect log versions are
accepted; an unsupported `version` errors naming it. **Nothing is dropped silently:** Inspect fields with
no `Score` target are preserved in `extensions/org.inspect/import.json` (`unmapped`), and content-bearing
fields (prompts, outputs, transcripts, sample `metadata`, and a scorer's `answer` / `explanation` /
`metadata` / `history`) are enumerated by name in `omitted` but never copied (ADR-0021 §4).
The log's dataset name is also recorded as an NF-028 `dataset_provenance` facet (status `unknown` — Inspect
logs carry no content hashes).

**Export** produces an Inspect-shaped JSON log from the capsule's `scores.jsonl`, reading a correction in
place of the score it supersedes (ADR-0119): one sample per span
subject, per-scorer aggregates under `results.scores` (booleans → `accuracy`, numerics → `mean`), and
NovaFabric identities carried in score `metadata` under `dev.novafabric.*` keys. A capsule imported from
Inspect restores the preserved task/model/run-id header; a capsule without scores exports a valid empty
log. **Exit codes:** `0` on success, `2` on a usage error (missing/invalid log, unsupported version,
not a capsule directory).

### nova eval offline (experimental)

> **Experimental — NF-009, [ADR-0099](https://novafabric.ai/docs/decisions/).** Trace-first
> structural checks over an already-stored capsule that run with **zero model calls** and emit a `code`
> score bound to the capsule Merkle root.

```bash
# did the run exercise every declared tool? (reads tool-calls.jsonl)
nova eval offline --capsule ./my-capsule --check coverage --declared-tools search,fetch,write [--emit-score]

# do recorded outputs satisfy a JSON-schema contract?
nova eval offline --capsule ./my-capsule --check contract --schema out.schema.json [--field output] [--emit-score]

# does a recorded input transform preserve a recorded invariant? (declarative check-spec)
nova eval offline --capsule ./my-capsule --check metamorphic --spec check-spec.yaml [--emit-score]
```

`--emit-score` appends the resulting score to `<capsule>/scores.jsonl`, so it is sealed by the capsule
Merkle root (see `nova eval score`). Because the capsule is already on disk, these checks spend **zero
tokens** — they are pure arithmetic/validation over recorded events.

The `contract` schema is validated **offline**: a `$ref` resolves only inside the `--schema` file
itself (`#/$defs/...`, anchors, embedded `$id` subschemas) or to the bundled JSON Schema
meta-schemas. A `$ref` to anything else — `http(s)://`, `file://`, a sibling file, or a URI relative
to a remote `$id` — is never fetched or read; when a record reaches one, the command exits **2**
with a `--schema` usage error and emits no score (inline the referenced definitions under `$defs`
instead).

The `metamorphic` check is driven by a declarative check-spec
([`schemas/features/metamorphic-check-v0.schema.json`](https://github.com/MSKazemi/novafabric/blob/main/schemas/features/metamorphic-check-v0.schema.json)):
records whose *input* collapses to the same value under `transform` form metamorphic pairs, and every
pair's *output* must satisfy `invariant`. Example `check-spec.yaml`:

```yaml
records_file: tool-calls.jsonl   # where the (input, output) records live (default)
input_field: input               # record field forming the pairing key (default)
output_field: output             # record field the invariant is asserted over (default)
transform: [lower, strip]        # identity | lower | strip | collapse_whitespace | remove_punctuation
invariant: equal                 # equal | equal_normalized | numeric_close | length_within
tolerance: 0                     # slack for numeric_close / length_within
```

A passing check means equivalent inputs produced consistent outputs (a zero-token consistency/robustness
signal); it emits a boolean `code` score. A malformed spec or unknown transform/invariant exits `2`.

### nova diff \<name@v1\> \<name@v2\>

Show field-level differences between two registered versions of an asset.
Both arguments must contain `@` to trigger asset diff; otherwise capsule diff is used (see above).

### nova diff --media (experimental, ADR-0148)

> **Experimental — NF-170.** Compares two runs' **media parts** by exact `sha256`, and
> optionally by a perceptual hash, classifying each pair
> `identical` | `near-duplicate` | `changed` | `added` | `removed`.

```bash
nova diff --media runs/run-01/ runs/run-02/
nova diff --media --perceptual runs/run-01/ runs/run-02/ --json
```

Options:
- `--media` — compare media parts instead of the usual capsule fields
- `--perceptual` — additionally compare `changed` pairs by pHash (**opt-in**; exact remains the default)
- `--hamming N` — near-duplicate distance for `--perceptual`, default `10` of 64 bits
- `--json` (or `--output-format json`) — emit the media diff as JSON

⚠ **`changed` needs an identity that content cannot supply.** Content hashes alone give only
`identical` / `added` / `removed` — a changed part hashes differently, so it looks like a
removal plus an addition. Parts are therefore paired **positionally**, which is an assumption
about the two runs rather than a fact about them, and the basis is reported as `pairing` rather
than left implicit.

⚠ **Perceptual comparison needs an image decoder, which is not a declared dependency.** Where
one is unavailable, `--perceptual` exits `2` rather than returning exact-only results — that
would report "no near-duplicates" about a check that never ran. A pair that could not be
compared stays `changed` and carries the reason in `perceptual_unavailable`; it is never
promoted to `near-duplicate` on missing evidence.

⚠ **An image with too little low-frequency structure is not compared perceptually.** A flat
fill or a purely high-frequency pattern hashes like every other one, so any answer would be a
coincidence — such pairs are reported unavailable, not near-duplicate.

Exit codes: `0` (rendered, whatever the classifications — it reports, it does not gate),
`2` (missing capsule, or `--perceptual` with no decoder available).

### nova diff --significance (experimental)

> **Experimental — NF-007, [ADR-0099](https://novafabric.ai/docs/decisions/); extends
> [ADR-0080](https://novafabric.ai/docs/decisions/).** Compares two run sets by
> **statistical significance, not raw delta**, so a single-run dip cannot fire a regression gate.

Reads a boolean pass/fail metric from stored `scores.jsonl` files (or capsule directories) and computes a
Wilson interval per side plus a Wald SPRT over the candidate sequence, yielding a three-valued verdict
(`accept_h0` / `accept_h1` / `continue`). It is **offline and zero-token** — pure arithmetic over
already-recorded outcomes; the workload is never re-run.

```bash
nova diff --significance \
    --baseline base/scores.jsonl --candidate cand/scores.jsonl \
    --metric task_pass [--p0 0.9 --p1 0.7 --alpha 0.05 --beta 0.05] [--json]
```

`--json` and `--output-format json` are the same switch here as everywhere in `nova diff`.

Exit codes: `0` = `accept_h0`/`continue` (no block), **`3` = `accept_h1`** (significant regression — gate
CI on this), `2` = usage error (unknown metric, non-boolean metric, or invalid SPRT parameters).
`--baseline`/`--candidate` accept either a `scores.jsonl` path or a capsule directory (reads
`<dir>/scores.jsonl`). Known limitation: the SPRT assumes i.i.d. Bernoulli outcomes; correlated
early-token cascades violate this (see ADR-0080). Related shipped surfaces: `nova eval offline`
(zero-token structural checks) and `nova promote direct --significance-gate` (which can also read its
sequence from a `scores.jsonl`).

### nova experiment run | list | show | compare (experimental, ADR-0120)

> **Experimental — [ADR-0120](https://novafabric.ai/docs/decisions/);
> spec `dataset-experiment-v0`.** Run a target command
> across **every item** of a pinned local JSONL dataset (one Run Capsule per item — the capsule
> invariant is untouched) and record an **immutable, content-addressed `Experiment`**
> (`schemas/experiment.schema.json`). Compare two experiments per item and in aggregate; the verdict
> is produced **verbatim** by the shipped ADR-0080 significance gate, so CI fails only on a
> *statistically significant* regression. Fully local, offline, zero-token (scores come from the
> built-in exact-match `code` scorer — no model call, ever).

The dataset is a JSONL file, one item per line:

```json
{"item_id": "q-001", "input": "What is 2+2?", "expected": "4"}
```

`item_id` is the A/B alignment key; `expected` (optional) drives the built-in boolean exact-match
score over the item capsule's recorded stdout. Loading pins `dataset_hash` (sha256 of the file
bytes) and `split_hash` (sha256 of the ordered `item_id` sequence) into the record **and** into
each item capsule's ADR-0108 dataset-provenance facet, so per-item contamination checks keep
working.

```bash
# run: one capsule per item; {input}/{item_id}/{expected} placeholders are substituted
nova experiment run --dataset items.jsonl --target my-agent@1.2.0 -- \
    python agent.py --question "{input}"

# read side
nova experiment list [--json]
nova experiment show <experiment_id> [--json]

# A/B diff: exit 3 on a statistically significant regression (ADR-0080, verbatim)
nova experiment compare <baseline_id> <candidate_id> --metric exact_match \
    [--p0 0.9 --p1 0.7 --alpha 0.05 --beta 0.05] [--json] [-o comparison.json]

# CI gate in one shot: run the candidate and compare against a stored baseline
nova experiment run --dataset items.jsonl --target my-agent@1.3.0 \
    --baseline <baseline_id> -- python agent.py "{input}"

# ADR-0117 D4 aggregation pin: record the score-config digest the aggregate was computed under
nova experiment run --dataset items.jsonl --target my-agent@1.3.0 \
    --score-config exact_match@1 -- python agent.py "{input}"
nova experiment compare <baseline_id> <candidate_id> --require-comparable
```

**Score-config pin (experimental, ADR-0117 P4).** `run --score-config NAME[@VERSION]|sha256:<hex>`
resolves the ref **read-only** against the local score-config catalog (`nova eval score config`)
*before any item runs*, and records the resolved `score_config_ref` (`name@version`) plus
`score_config_digest` on the experiment. The config must govern the `--metric` name and be
`boolean` (the built-in exact-match scorer); an unresolvable, mismatched, or tampered ref exits `2`
with nothing captured — a requested pin is never silently dropped. Every comparison carries a
`score_config` block keyed by digest: same digest ⇒ `comparable: true`; different digests ⇒
`comparable: false` (both digests + a message — the aggregates are **not** directly comparable);
either side unpinned ⇒ `comparable: null` ("not pinned" — never assumed). The block is reported,
not gated: exit codes stay the ADR-0080 contract unless `--require-comparable` (on `compare`, or on
`run --baseline`) is set, which exits `2` for anything but `comparable: true`.

Records live under `./.novafabric/experiments/` (override: `--experiments-dir` /
`NOVAFABRIC_EXPERIMENTS_DIR`); item capsules under `./.novafabric/runs/` (override: `--runs-dir`).
A finalized experiment is **never mutated** — a re-run mints a new `experiment_id`, and the store
refuses overwrites. Comparing experiments over **different** pinned datasets (any of
name/version/`dataset_hash`/`split_hash`) is a hard error, never a silent skew; items present on one
side only, errored items, and items without the metric are reported unmatched and excluded from the
SPRT sequences. When **no** item carries the metric on both sides (a mistyped `--metric`, a metric
only one experiment recorded) the comparison exits `2`: there is no evidence either way, and it is
not reported as "no regression". The SPRT runs on **boolean** metrics only; a numeric metric reports
mean and drift in the `numeric`/`drift` blocks and never exits `3`. Exit codes: `0` = no significant
regression, **`3` = significant regression** (`accept_h1`, boolean metrics), `2` = usage error or
nothing to compare. The comparison record
(`schemas/experiment-comparison.schema.json`) also renders a `regression_report`-shaped gate input
for the existing Rego regression gate (ADR-0003/0019) — no new gate engine.

---

## Asset lifecycle commands (v0.11.1)

### nova asset diff \<name@v1\> \<name@v2\>

Produce a unified diff of the spec JSON between two registered versions of the same (or different) asset.
Exits with code `1` if differences are found — useful as a CI gate.

```bash
nova asset diff fraud-model@1.0.0 fraud-model@2.0.0
nova asset diff my-agent@v1 my-agent@v2 --unified 5
nova asset diff fraud-model@1.0.0 fraud-model@2.0.0 --output-format json
```

Options:

- `--unified, -U INT` — lines of context in unified diff output (default: `3`)
- `--output-format text|json` — `text` (default) renders a coloured unified diff; `json` returns a structured payload with `added`, `removed`, `changed` field maps and an `identical` boolean

**JSON output shape:**

```json
{
  "ref_a": "fraud-model@1.0.0",
  "ref_b": "fraud-model@2.0.0",
  "identical": false,
  "added":   { "dotted.field": "new-value" },
  "removed": { "dotted.field": "old-value" },
  "changed": { "dotted.field": { "from": "old", "to": "new" } }
}
```

Both arguments must use the `name@version` format.  If either version is not found,
the command exits `1` with a clear error message.

**Declared asset dependencies (C-1.3).** An asset spec may declare its
dependencies in the `dependencies:` field:

```yaml
novafabric_spec_version: "1"
asset_type: model
name: my-model
version: 1.0.0
spec:
  framework: pytorch
  artifact_path: s3://models/my-model/1.0.0
dependencies:
  - base-prompt@2.0.0
  - eval-dataset@3.1.0
```

When `nova register` processes the spec, a `depends_on` lineage edge
(confidence: `declared`) is written for each dependency.  These edges are
immediately visible to `nova lineage blast-radius <dep-ref>` and
`nova lineage provenance <asset-ref>`.

**Status at consumption (C-1.1).** When your SDK code calls
`record_asset_consumption(asset_ref, status, capsule_dir)` before using an
asset, the lifecycle status of the asset *at that moment* is stored in
`assets.jsonl` and propagated into the `facets.status_at_consumption` field
of the resulting `consumed` lineage edge.  This makes blast-radius queries
answer "was this asset already in `production` when run X consumed it?"

## Prompt versioning commands (experimental, ADR-0112)

Prompts as first-class, immutable, content-addressed registry versions. Every edit registers a
new version (never a mutation); each version's `content_hash` is a sha256 over the canonical
`{template, variables, config}` body, so a capsule reference
`prompt:<id>@<version>+sha256:<hex>` resolves to exactly one verifiable version. Stored in the
existing local SQLite registry — no new store, no schema change, fully offline. NovaFabric
records prompt evidence; it never renders templates or serves prompts to inference.

### nova prompt register \<prompt_id\> [--template TEXT | --file PATH] [--var NAME]... [--config JSON] [-m MSG]

Register a new immutable prompt version. The version number auto-increments per `prompt_id`;
re-registering identical content is idempotent (the existing version is returned, no new row).
Prints the replay-verifiable frozen reference.

A version number is never reused. The next number is one past the highest the registry has
ever issued for that `prompt_id`, counting unregistered versions from the status history, so
`prompt:<id>@<n>` keeps naming the content it named when it was first registered. A number
that was in production is refused outright (`VersionReuseError`, exit 1), the same guard
`nova register` applies to assets (ADR-0312). Each registration writes a `register` row to
the status history, bound to the new row's id and spec digest, with `cli-user` as the actor.

```bash
nova prompt register triage -t "You triage {ticket_body}." --var ticket_body -m "first cut"
nova prompt register triage -f messages.json --config '{"temperature": 0.2}'
```

Options:

- `--template, -t TEXT` — inline text-form template (exactly one of `--template`/`--file`)
- `--file, -f PATH` — template file; `.json` = chat-form array of `{role, content}` messages (`role` ∈ `system|user|assistant|tool`), anything else = text-form read verbatim
- `--var NAME` — declared placeholder name (repeatable); documentation/validation only — NovaFabric never renders. Mismatches between declared and used `{tokens}` print a warning, never block
- `--config JSON` — model-agnostic hints as a JSON object (`model`, `temperature`, `max_tokens`, ...)
- `--message, -m MSG` — commit message (the version's "why")
- `--json` — print the raw record as JSON

### nova prompt get \<prompt_id\>[@\<version\>]

Fetch one version (latest when `@<version>` is omitted), frozen to version + content hash. The
printed `ref:` line is the exact `prompt:<id>@<version>+sha256:<hex>` form a Run Capsule
records. `--json` prints the raw record.

### nova prompt list [\<prompt_id\>] [--status STATUS]

Without an argument: one summary row per managed prompt (latest version, status, version
count). With a `prompt_id`: all versions of that prompt. `--status` filters by lifecycle
status.

### nova prompt history \<prompt_id\>

Chronological version log with created-at, status, content hash, and commit message.
`--json` prints the full version records.

### nova prompt diff \<prompt_id\>@\<a\> \<prompt_id\>@\<b\>

Structural diff of the canonical content triple (`template`, `variables`, `config`) between two
pinned versions. Exits `1` when the versions differ (CI-gateable), `0` when identical. Both
refs must pin a version.

```bash
nova prompt diff triage@6 triage@7
nova prompt diff triage@6 triage@7 --output-format json
```

Options:

- `--unified, -U INT` — lines of context in unified diff output (default: `3`)
- `--output-format unified|json` — `json` returns `added`/`removed`/`changed` dotted-path field maps and an `identical` boolean (same shape as `nova asset diff`)

**Promotion.** Prompt versions move through the standard lifecycle with the existing eval-gated
machinery — `nova promote direct triage@2 --to staging` works unchanged (ADR-0112 D3). A
dedicated `nova prompt promote <prompt_id>@<version> --to <status> [--force]` alias is also
available (works today, ADR-0112 P4): a thin, deliberate wrapper around `nova promote direct`
so prompts go through the exact same eval/policy gates and audit trail as any other asset —
it adds only a type check that refuses to "promote" a non-prompt asset through this surface.
Like `nova promote direct`, `--to production` is refused unless the `promote_direct` policy
action explicitly allows it (ADR-0312; `--force` does not bypass this) — use
`nova promote propose` + `nova promote approve` instead.

```bash
nova prompt promote triage@1.2.0 --to staging
nova prompt promote triage@1.2.0 --to production   # needs an explicit promote_direct allow
```

### Prompt composition (experimental, ADR-0115)

A prompt body MAY reference other registered prompt assets inline:

```
{{@prompt:<asset-name>@<selector>}}
```

where `<selector>` is an explicit integer version (`@3`) or a deployment label
(`@production`, `@latest` — ADR-0113). The reference splices in the referenced asset's
resolved body (textual inclusion only; referenced children must be text-form templates).
The composition graph is a **bounded acyclic DAG**: cycles, trees deeper than 8 levels,
and unknown references are rejected **at register time** with named errors — a malformed
composition never enters the registry. Each direct reference is snapshotted (the version +
content hash it resolved to at register time) into the version's frozen `composition` block.

### nova prompt compose \<prompt_id\>[@\<version\>|@\<label\>]

Resolve the full composition DAG for a prompt (latest version when bare) and print the
flattened, content-addressed `resolved_composition_manifest`: every transitively-included
prompt version + hash, the resolved DAG edges (what each label reference pointed at, at this
instant), the deepest resolution level, and the sha256 of the final assembled prompt.
Read-only — nothing is captured or written. Rebuilding from the manifest's pins reproduces
the assembled prompt byte-identically even after children are edited or labels move.

```bash
nova prompt compose triage-agent
nova prompt compose triage-agent@production --json
nova prompt compose triage-agent@9 --assembled
```

Options:

- `--json` — print the raw `resolved_composition_manifest` as JSON (validates against `schemas/resolved-composition-manifest.schema.json`)
- `--assembled` — print the fully spliced template instead of the manifest

### nova prompt tree \<prompt_id\>[@\<version\>|@\<label\>]

Print the composition DAG as an indented tree — each node shows the reference as written,
the version it resolved to, its content hash, and a `[label]` flag when pinned through a
deployment label. Read-only.

```bash
nova prompt tree triage-agent
```

```
triage-agent@9  aaaa0000…
├── system-preamble  @production → v4  11aa22bb…  [label]
│   └── org-header   @2 → v2  55ee66ff…
└── safety-footer    @7 → v7  33cc44dd…
```

*Capsule wiring (recording the manifest during `nova capture`) and replay verification are
planned (ADR-0115 P4) — today `compose`/`tree` and the register-time gate are shipped.*

---

## Deployment label commands (experimental, ADR-0113)

A **deployment label** is a mutable named pointer (`production`, `staging`, or any custom
lowercase name) from an asset name to exactly one immutable registry version. Labels are scoped
per asset: `production` on `prompt:triage` is unrelated to `production` on `prompt:router`.
Moving a label appends an audit row to the `asset_label_history` table (append-only —
`UPDATE`/`DELETE` are blocked by SQLite triggers); the current pointer is always the newest row.
The reserved label `latest` is auto-maintained (always the highest registered version) and is
never user-settable. Stored in the existing local SQLite registry — additive table, fully
offline, no new dependency.

**Resolution freeze.** A `<asset_type>:<asset_name>@<label>` reference (e.g.
`prompt:triage@production`) resolves at capture time to the concrete version + content hash,
recorded as a `resolved-asset-ref` record (`schemas/resolved-asset-ref.schema.json`), so a
capsule stays deterministically replayable even after the label later moves. The library API is
`novafabric.registry.labels.resolve_asset_ref()`; wiring into `nova capture` is planned
(ADR-0113 P2).

Assets are named `[<asset_type>:]<asset_name>` — the type prefix is optional but recommended
(e.g. `prompt:triage`).

### nova label set \<asset\> \<label\> \<version\> [--reason TEXT] [--json]

Point a label at an existing immutable version, appending an audit row. Fail-closed: the target
version must exist (no row is written otherwise); setting `latest` errors; mixed-case label
names are rejected, never lowercased. Re-pointing a label at its current target is a no-op.

```bash
nova label set prompt:triage production 4
nova label set prompt:triage production 3 --reason "rollback: v4 regressed on eval GAIA"
```

Options:

- `--reason, -r TEXT` — free-text note recorded on the move (shows in `history`)
- `--json` — print the full move record (`move_id`, `previous_version`, `content_hash`, …)

### nova label get \<asset\> \<label\> [--json]

Resolve a label to its current target version + content hash.

```bash
nova label get prompt:triage production      # → production → 4  (1a77…)
nova label get prompt:triage latest --json
```

### nova label list \<asset\> [--json]

All labels on an asset and their current targets — the auto-maintained `latest` first, then
explicit labels alphabetically.

```bash
nova label list prompt:triage
```

### nova label history \<asset\> [\<label\>] [--json]

The append-only label-move audit log, newest first: when each move happened, `previous →
target`, who moved it, and why. Answers "when did production point at the poisoned version,
and who moved it there?".

```bash
nova label history prompt:triage
nova label history prompt:triage production --json
```

### Protected labels — maker-checker moves (experimental, ADR-0114)

A **protected label** is a deployment label whose reassignment requires two distinct
principals: a *maker* proposes the move, a *checker* approves it. Direct `nova label set`
on a protected label is refused with guidance. Both steps are Ed25519-signed with the
per-identity keyring (ADR-0058: `~/.config/novafabric/keyring/`) and **verified against the
same signer trust list `nova promote` uses** (ADR-0312: `NOVAFABRIC_PROMOTE_SIGNERS`, default
`$NOVAFABRIC_HOME/promote-signers.yaml`): the maker's key must be bound to `--identity` with
the `proposer` role, the checker's with the `approver` role. **No key is ever created on
this path** — naming a new `--identity` cannot mint a second key; create keys explicitly with
`nova promote keygen --identity NAME` and have an operator add the printed entry to the
trust list. Self-approval is refused by **bound** identity and key fingerprint, the stored
maker signature is re-verified at approve time (an edited move, or a maker removed from the
list, is refused), and only approvals that verify against the current list count toward
`required_approvals`. A missing trust list refuses both steps (fail closed). The applied move lands in
the same append-only `asset_label_history` audit table, reusing the pending move's ULID as
its `move_id`. Free (unprotected) labels are completely unchanged. Fully offline; the
optional `--policy-ref` Rego gate (ADR-0019) fails closed if the policy file is unreadable.

**Relaxing a protection is maker-checker too** (ADR-0114 Amendment 2). Removing protection
(`--unprotect`), lowering `--required-approvals`, or replacing or dropping an existing
`--policy-ref` on a protected label does **not** apply: `nova label protect` records a signed
pending *protection change* (maker = `--identity`, `proposer` role) and the protection stays
in force until as many distinct trust-listed checkers as it currently requires approve it with
`nova label approve-move`. A change proposed against a configuration that has since changed is
`superseded` and never applies. Protecting a free label, raising `--required-approvals`, or
adding a `--policy-ref` is still a single-actor action. Before this, one person could
unprotect, move, and re-protect a label with three exit-0 commands.

### nova label protect \<asset\> \<label\> [--required-approvals N] [--policy-ref PATH] [--note TEXT] [--unprotect] [--identity NAME] [--json]

Mark a label protected, or raise its protection; this applies at once. Protecting an
already-assigned label does not move it — it only governs future moves. Config changes are
append-only events; the active setting is the newest one.

On a protected label, a **relaxation** (`--unprotect`, fewer `--required-approvals`, or a
different or removed `--policy-ref`) is proposed, not applied: the command prints (or with
`--json` returns) a pending protection change id, signed by `--identity` (an existing keyring
key bound with the `proposer` role; default: the OS user). Approve it with
`nova label approve-move <asset> <label> <change-id>`. Exit codes for a relaxation: `0`
proposed, `1` usage/state error or missing key, `3` maker-side trust-list or signature failure.

```bash
nova label protect prompt:triage production
nova label protect prompt:triage production --required-approvals 2 --note "gates live traffic"
nova label protect prompt:triage production --unprotect --identity alice   # proposes; needs approvals
```

### nova label propose-move \<asset\> \<label\> --to \<version\> [--reason TEXT] [--identity NAME] [--json]

Maker step: create an Ed25519-signed pending move. The label does **not** move. Fail-closed:
the signer trust list must exist, `--identity` must name an existing keyring key bound to it
with the `proposer` role, the target version must exist, the label must be protected (free
labels use `set`), and at most one pending move per `(asset, label)` may exist at a time.
`--identity` defaults to the OS user.

The signature covers the move id, `asset:label`, `from → to` versions, the proposal time and
the SHA-256 of the target version's registered spec (`spec_sha256`, pre-image tag
`label-move/v2`) — the **content**, not only the version string. Releases up to v0.107.0
signed the version alone, so content swapped under the proposed version before approval
(a direct registry edit, or `unregister` + `register` under the same version) was applied
with the original sign-offs.

```bash
nova label propose-move prompt:triage production --to 8 --reason "v8 passed the eval gate"
```

### nova label approve-move \<asset\> \<label\> \<move_id\> [--reject] [--note TEXT] [--identity NAME] [--json]

Checker step: approve (or `--reject`, terminal) a pending move — or a pending protection
change, when the id names one. A protection change applies (atomically, as a new protection
event whose note names the change and its approvers) once trust-verified approvals from
distinct bound identities reach the `required_approvals` of the protection that was in force
when it was proposed; the same signer, re-verification and SoD rules apply. Before anything is
recorded, the checker's key must exist and be bound to `--identity` with the `approver` role,
the maker's stored signature is re-verified (approve only), and SoD compares the **bound**
identities and key fingerprints. When trust-verified approvals from distinct bound identities
reach `required_approvals` **and** the policy gate allows, the label is reassigned atomically
with its audit row. A duplicate approver is recorded but counts once; a stored approval that
no longer verifies (for example one made before the trust-list binding) is kept but never
counted. A pending move whose maker no longer verifies cannot be approved — a trusted checker
can `--reject` it to free the label for a new proposal.

Both re-verifications run over the target version's content **as it is now**: if its spec
changed since the move was proposed, approve is refused with exit `3` (the label stays put),
and an approval signed over different content is never counted. A move proposed before
content binding (the v1 pre-image) is refused the same way — `--reject` it and propose again.
A target version that no longer exists refuses approve with exit `1`; `--reject` still works.

Exit codes (propose-move / approve-move, consistent with `nova promote`): `1` usage or state
error, missing keyring key, or self-approval; `3` maker-side trust-list or signature failure;
`4` checker-side trust-list or signature failure.

```bash
nova label approve-move prompt:triage production 01J2Q8ZK7M4YZ2K7N9DPBYK2WX --identity bob
nova label approve-move prompt:triage production 01J2Q8ZK7M4YZ2K7N9DPBYK2WX --reject --note "regressed"
```

### nova label status \<asset\> [--label L] [--json]

Protection config, current label targets, all recorded moves (pending and terminal), and all
protection changes (`protection_changes` in `--json`) for an asset.

```bash
nova label status prompt:triage
nova label status prompt:triage --label production --json
```

### nova report [--format {markdown,json,html,pdf}] [--output FILE]

Generate an asset inventory report. Defaults to Markdown on stdout.
Use `--output` to write to a file. Valid `--format` values: `markdown` (default), `json`, `html`, `pdf`. Tab-completion available via `nova --install-completion`.

**`html`** ([ADR-0201](https://novafabric.ai/docs/decisions/); **works today**) — one
self-contained page (no JS, no external requests) with an assets-by-type inline-SVG chart, the
inventory table, and the canonical JSON embedded for machine consumption.

**`pdf`** (**works today**, optional dependency) — the same page rendered through WeasyPrint.
Requires the optional extra (`pip install 'novafabric[compliance]'`) and `--output`; without the
extra the command exits with the install hint instead of failing cryptically.

```bash
nova report --format html --output inventory.html
nova report --format pdf  --output inventory.pdf   # needs novafabric[compliance]
```

### nova validate \<path\>

Smart routing:

- If `path` is a **directory containing `capsule.yaml`**: validates the run capsule
  against `run-capsule.schema.json`, `environment.schema.json`, and `secret-redaction.schema.json`,
  and checks all required files exist. A capsule whose manifest carries
  `metadata.capture_tampered` (the recorded workload replaced a capsule path with
  a link or special file during `nova capture`) fails validation (exit 1). So
  does a capsule that holds a symlink, FIFO, socket or device anywhere in its
  tree, at any depth and whenever it was planted: each is named on its own
  `✗ <path>: a <kind> inside the capsule` line (the first 20, then a count).
  Nothing is followed or opened, so a FIFO cannot hang `nova validate`.
- If `path` does not exist but is a **run id**, the capsule of that id is validated,
  resolved in `$NOVAFABRIC_CAPSULE_DIR` (default `~/.novafabric/capsules/`).
- Otherwise: validates `path` as an asset YAML spec (v0.1 behavior).

An existing path always wins, so an asset spec, a capsule directory and a replay
directory are all routed exactly as before.

```bash
nova validate .novafabric/runs/01HXAY7M5JZ8R7K4P9DPBYK2WX/
nova validate my-model.yaml
```

Tool-call schema conformance ([ADR-0128](https://novafabric.ai/docs/decisions/); **experimental**) —
capsule directories only:

| Option | Default | Effect |
|---|---|---|
| `--schemas` | off | Also validate each tool call's `arguments`/`result` against its declared `arguments_schema_ref`/`result_schema_ref` JSON Schemas and print a conformance summary. Report-only: exit 0 even on violations. Records with no schema_ref are counted as `null` ("no schema declared" — not a failure); unresolvable refs are reported, never fatal. Schema resolution is **local-only**: a relative ref resolves inside the capsule directory without following a link (no `..`, no FIFO, at most 1 MiB); an absolute ref resolves only inside NovaFabric's packaged `schemas/` directory, because this re-validates a capsule you may not have written (an absolute path anywhere is honoured at capture time only); `http(s)://` refs are never fetched. The same holds for every `$ref`/`$dynamicRef` *inside* a schema, at capture time and here: only refs within the schema document and the bundled JSON Schema meta-schemas resolve; a ref to any other URI (`http(s)://`, `file://`, or relative to a remote `$id`) is never retrieved, and that payload's verdict is `null` with a `schema-unresolved` error — never a crash, never a network request. |
| `--fail-on-schema-violation` | off | With `--schemas`: exit non-zero if any checked payload violates its schema (CI gate). Without `--schemas` it (like `--write`) is refused with exit `2` instead of being silently ignored. |
| `--write` | off | With `--schemas`: persist the computed `schema_validation` verdict blocks back into `tool-calls.jsonl` (backfill capsules captured before this feature; `checked_at` records the backfill time). Only lines that gain a verdict change; every other line — including a truncated or non-object one — is kept byte-for-byte, and nothing is written when no record was annotated. Refused with exit `1` on a sealed capsule (its seal covers `tool-calls.jsonl`). Releases up to v0.107.0 deleted every line they could not parse and rewrote sealed capsules in place. |

```bash
nova validate --schemas .novafabric/runs/<run-id>/                            # report-only
nova validate --schemas --fail-on-schema-violation .novafabric/runs/<run-id>/ # CI gate
nova validate --schemas --write .novafabric/runs/<run-id>/                    # backfill verdicts
```

At capture time the same verdict is attached automatically whenever a tool-call record declares a
schema_ref — record-only, never raised into the workload. At replay time stored tool calls are
re-validated against their current schemas, under the same resolution rule as `--schemas` (an
absolute schema_ref outside the packaged schemas is `schema-unresolved`, never read): drift is recorded as `schema_drift` in
`replay_result.yaml` in every mode, and blocks eligibility (`exact_eligible: false`) in `exact`
mode only.

---

## Asset lifecycle commands — v0.12 additions (C-1.4, C-1.5)

### nova rollback \<name\> --actor \<id\>

Atomically roll back an asset to its most recent previous production version.

```bash
nova rollback my-agent --actor on-call-eng
nova rollback my-agent --to v1.8.0 --actor on-call-eng
```

Steps performed in one DB transaction:
1. Find the current `production` version (error if none).
2. Find the most recent prior `production` version (auto, or use `--to`).
3. Archive the current production version.
4. Promote the prior version back to `production`.
5. Write an audit log entry with a `rollback_reason` and a `gate` field.

**Gate (ADR-0312 D1).** "Prior production version" is read from the registry's append-only
status history (`asset_status_history`, which records every status change). A version that
history shows was in `production` is restored without a policy decision
(`gate: previously_production`) — archived or not. Any other `--to` target is a single-actor
move into production: it is refused (exit 1) unless the `promote_direct` policy action
explicitly allows it, exactly like `nova promote direct`, and it must also pass the lifecycle,
`promote` policy and eval gates (`gate: promote_direct`). Auto-discovery considers only
versions with production history; it never falls back to "some other version". A registry
created before the history table records its current production versions when first opened
by this release; versions archived before that have no history and take the gated path.

History is evidence only for the registration it was written for. Each history row
records the asset's row id and the SHA-256 of its stored spec, and counts only if both
match the version as it is registered now. A row re-created under the same name@version
(by a restore, a migration or a direct database write), even with identical content, has
no production history of its own and takes the gated path. History rows written before
these columns existed count only if they are no older than the current registration.

Options:
- `--to <version>` — target an explicit rollback version instead of auto-discovery.
- `--actor <id>` — recorded in the audit log and as `promoted_by` (default: `cli-user`).

Errors (exit 1) when there is no current production version, no prior production version in
the history, or a `--to` target without production history lacks a `promote_direct` allow.

### nova unregister \<name@version\>

Hard-delete an asset version from the registry. Removes the asset record, its eval
results, and approvals. Blocked for `staging`, `production`, and `pending_approval`
assets unless `--force` is given. Always writes an `UNREGISTER` audit entry.

```bash
nova unregister fraud-model@1.0.0
nova unregister fraud-model@1.0.0 --yes          # skip confirmation
nova unregister broken-agent@dev --force          # override status guard
nova unregister old-model@v2 --actor ops-eng --db ./registry.db
```

Options:
- `--actor <id>` — identity recorded in the audit trail (default: OS username).
- `--force` — override the status guard; permits deletion of `staging`/`production` assets.
- `--yes, -y` — skip interactive confirmation (for CI/scripts).
- `--db <path>` — override registry DB path (`NOVAFABRIC_DB_PATH` env var also accepted).

| Status at deletion | Default | With `--force` |
|---|---|---|
| `development`, `validated`, `archived` | ✅ allowed | ✅ allowed |
| `staging`, `production`, `pending_approval` | ❌ blocked | ✅ allowed |

> **Note:** Consumed and `depends_on` lineage edges referencing the deleted asset are
> preserved — they record what actually happened in captured runs. Only the synthetic
> `reg:<name>@<version>` dependency edges (written at registration time) are removed.

### nova capture ... --asset \<ref\> --require-asset-status \<statuses\>

Gate a capture run on the named asset's lifecycle status.

```bash
nova capture --asset my-agent@v1 --require-asset-status staging,production -- python agent.py
nova capture --asset my-agent@v1 --warn-if-asset-status development -- python agent.py
nova capture --asset my-agent@v1 --require-asset-status production --require-registered -- python agent.py
```

Options:
- `--asset <ref>` — asset to check (e.g. `my-agent@v1` or `my-agent`).
- `--require-asset-status <statuses>` — comma-separated statuses; exits non-zero before spawning the subprocess if the asset's status is not in the allowed set. Nothing is written to disk.
- `--warn-if-asset-status <statuses>` — emits a structured warning but does not block.
- `--require-registered` — blocks if the named asset is absent from the registry (default: warn only).

---
