Accountability spine and energy commands

Part of the NovaFabric CLI reference. Both nova and novafabric run the same binary.

Accountability Spine (experimental, ADRs 0093–0095)

Three research-grounded features for tamper-evident ex-post evidence. All additive and opt-in; none is a third top-level format (ADR-0034). The architecture note behind it is in the maintainers' private design/ tree and is not published.

LangGraph adapter

# Install the framework: pip install langgraph
from novafabric.adapters.langgraph import wrap

graph = wrap(builder.compile(), run_name="my-workflow")
result = graph.invoke({"messages": ["hi"]})
for chunk in graph.stream({"messages": ["hi"]}):   # stream_mode="updates" by default
    print(chunk)

Unlike the adapters below, wrap returns a thin wrapper around the compiled graph rather than patching it in place — keep using the returned object. invoke, ainvoke, stream and astream each write one capsule; every keyword (stream_mode, subgraphs, version, config, …) passes through to LangGraph unchanged, and so does every chunk.

What each capsule holds: the wire-level model and tool calls made while the graph ran, and (experimental, ADR-0209) state transitions — for invoke / ainvoke a start marker plus one whole-invocation transition; for stream / astream one transition per yielded chunk, digest-chained from the input. Digests always; raw state only at the forensic / air_gapped capture level. A chunk is digested exactly as stream_mode shaped it; its agent_id names the node only for a single-key dict chunk, i.e. under the default "updates" mode.

Streaming (experimental). LangGraph's stream / astream are generator functions: nothing runs until you iterate, and every node runs while you do. The capsule opens when you call stream() / astream() and stays open until the stream ends:

What happened status metadata.partial_reason
Stream read to the end success —
A node raised mid-stream (the exception still reaches you) failure —
You closed the stream early (break + close() / aclose()), dropped it unread, or a KeyboardInterrupt stopped it partial abandoned
The task consuming astream was cancelled while the graph ran, or an ainvoke was cancelled partial cancelled

A wrapped graph called while another wrapped run is producing — a wrapped subgraph invoked from inside a node, sync or async — records into the open capsule instead of opening a second one (LangGraph runs nodes in a context copied from the caller's, which is how the nested call sees it). Its own state transitions are not recorded, so the outer digest chain stays intact.

Not captured: batch / abatch, stream_events / astream_events, and every other graph method pass straight through with no capsule. Because the capsule opens on the stream() call, consume one stream before creating the next: overlapping captures share the process's wire hooks, and each capsule's metadata.wire_capture (ADR-0224) records whether its wire stream is complete. capture_node_capsules= is reserved for per-node child capsules and does nothing today.

Optional: run_name= (defaults to langgraph-run), data_dir=.

Top-level alias: from novafabric.adapters import wrap_langgraph

LlamaIndex adapter

# Install the framework: pip install llama-index
from novafabric.adapters.llamaindex import wrap_engine

engine = wrap_engine(index.as_query_engine())
response = engine.query("What changed in v2?")

Patches the entry-point method in place and returns the same object, so existing references keep working. LlamaIndex has no single entry point across its object types — a query engine exposes query, a chat engine chat, an agent chat or run — so the wrapper tries an explicit ordered list (query, chat, run) rather than guessing, and records which one it patched as metadata.entry_point. Override with method=.

When the detected entry point has an async twin (aquery for query, achat for chat), that is patched too, so async callers are captured. An agent's run (FunctionAgent, AgentWorkflow, any Workflow) returns a WorkflowHandler and does its work in a background task, so the capsule is finished when that run settles, not when run returns — it covers the whole workflow, whether you await handler or read handler.stream_events(). This works for both handler shapes: the asyncio.Future of llama-index-workflows 1.x and the plain awaitable of 2.x (the one current llama-index-core installs). A nested call (an aquery reached from inside a wrapped run) records into the capsule already open rather than opening a second one.

Streaming (experimental). A chat engine's stream_chat and astream_chat are patched alongside chat; a query engine built with streaming=True streams from query / aquery itself. The capsule stays open until the stream ends, and its status says how it ended:

What happened status metadata.partial_reason
Query-engine stream (response_gen) read to the end success —
Stream raised mid-way (the exception still reaches you) failure —
Query-engine stream closed early, or the response dropped unread partial abandoned
Consumer task cancelled mid-stream; workflow cancelled (cancel_run(), or the event loop closed before it finished) partial cancelled
Workflow raised failure —

Recorded differently from what you might expect: for chat streams, LlamaIndex's own background writer (a thread for stream_chat, a task for astream_chat) drains the model stream into chat history whether or not you read response_gen, so the capsule closes when that writer finishes and records success (or failure if the stream raised) even if you stopped reading early — the model call did run to completion. Abandoning stream_events() does not end a workflow either: the capsule follows the run, not the event stream. A call made while a stream is being produced (a sub-question engine queried from inside the token generator, say) records into the open capsule.

Optional: run_name= (defaults to the class name), data_dir=.

Top-level alias: from novafabric.adapters import wrap_llamaindex

Pydantic AI adapter

# Install the framework: pip install pydantic-ai
from novafabric.adapters.pydantic_ai import wrap_agent

agent = wrap_agent(agent, run_name="support-bot")
result = agent.run_sync("Where is my order?")

Agent.run (async, the primary API), Agent.run_sync, and the streaming entry points Agent.run_stream and Agent.iter are patched. Wrapping only run_sync would silently capture nothing for async callers; wrapping only run would double-count, because run_sync drives run internally. A re-entrancy guard is what keeps one run_sync call producing one capsule rather than two — without it the inner capsule also steals the wire hooks from the outer. The same guard makes run and run_stream (which drive iter) and run_stream_sync (which drives run_stream) one capsule each, owned by the outermost call.

Streaming (experimental). run_stream and iter are async with context managers: the model calls happen inside your block. The capsule opens when the block is entered and closes when it exits:

async with agent.run_stream("Where is my order?") as response:
    async for text in response.stream_text():
        print(text)
What happened status metadata.partial_reason
run_stream output read to the end (get_output, stream_text, stream_output, …); iter reached its End node success —
The run or your block raised (the exception still propagates) failure —
You left the block before the output was fully read, or broke out of iter before End partial abandoned
The run was cancelled (e.g. a run_stream_events consumer that stopped early) partial cancelled

A call made inside the block (another agent.run, say) records into the open capsule. Not patched directly: run_stream_sync and run_stream_events — they are captured through the run_stream and run they drive, so their capsules carry entry_point: run_stream / run.

Top-level alias: from novafabric.adapters import wrap_pydantic_ai

Haystack adapter

# Install the framework: pip install haystack-ai
from novafabric.adapters.haystack import wrap_pipeline

pipe = wrap_pipeline(pipe, run_name="rag-qa")
result = pipe.run({"retriever": {"query": "..."}})

Patches run in place and returns the same object. AsyncPipeline.run_async is patched too when present, because Haystack exposes the async variant as a separate method rather than as a coroutine returned by run. Haystack 2.x's AsyncPipeline.run drives run_async internally, so the same re-entrancy guard as the Pydantic AI adapter keeps one call producing one capsule.

Top-level alias: from novafabric.adapters import wrap_haystack

Hugging Face smolagents adapter

Status: experimental, not yet in a release.

# Install the framework: pip install smolagents
from novafabric.adapters.smolagents import wrap_agent

agent = wrap_agent(agent, run_name="support-bot")
answer = agent.run("Is SKU-1042 in stock?")

Patches run in place and returns the same object; run keeps its arguments, return value (including RunResult), exceptions and the laziness of stream=True. Each user-visible run() writes one Run Capsule with a trace.jsonl span per agent step and one tool-calls.jsonl record per tool call named in a step. Tool calls are recorded at step granularity (the framework reports one outcome per step, not a result per call), are observed and never served by replay, and a CodeAgent step is one python_interpreter call — the tools its generated code calls are not individually visible. Managed agents record as spans inside the parent's capsule. interrupt() is a cancelled partial run; a run that stops at max_steps carries the tag agent_state=max_steps_error. Model calls are recorded by the wire hooks, not by this adapter. What is and is not recorded, the inference capture, and the opt-in Hub and evaluation receipts: Hugging Face.

Top-level alias: from novafabric.adapters import wrap_smolagents

The LlamaIndex, Pydantic AI, Haystack and smolagents frameworks are optional and are not NovaFabric extras — install the framework package itself. Each module stays importable without its framework; the wrap_* call raises ImportError naming the install command.

nova energy probe

Report which energy counters this host can actually read (the ground truth the forgery guard checks against). On hardware that cannot attribute per-action energy, receipts are honestly marked unavailable rather than fabricated.

nova energy probe

nova energy attest

Write one EnergyReceipt per action into energy-receipts.jsonl for a captured capsule. The degrade-safe default emits honest unavailable receipts; Slurm sacct ConsumedEnergyRaw yields the measured per-job class. If energy-receipts.jsonl in the capsule is a symlink (or a FIFO), the command refuses with exit 2 and never writes through it.

nova energy attest ./my-capsule

nova energy verify

Re-check receipt integrity (payload-hash) and honesty/forgery consistency, then the energy conservation status. Forgery-guard exit codes: 3 integrity failure (e.g. a measured receipt with no available counter), 4 conservation diverged, 0 OK.

nova energy verify ./my-capsule

nova energy report

Tabulate the receipts in a capsule (--format table|json), showing source, confidence, and joules per action.

nova energy report ./my-capsule --format table

Reference: src/novafabric/energy/, design/adr/0093-energy-anchored-action-receipts.md (private).

nova ledger anchor

Build per-stream sidecar hash-chains over a capsule's jsonl event streams (the .jsonl files are never mutated) and write a DSSE-signed checkpoint. Requires a signing key.

nova ledger anchor ./my-capsule --key ~/.config/novafabric/keyring/ed25519.pem

nova ledger verify

Verify the chains against the signed checkpoint. Detects content edits, reordering, and truncation even after a host compromise. Exit codes (ADR-0094): 0 ok, 3 tamper, 4 reorder, 5 truncation, 6 bad signature (with --pubkey), 7 epoch rollback (with --observed-epoch), 8 Merkle inclusion failure, 9 external-anchor mismatch, 10 no checkpoint.

Without --pubkey the signature is not checked. The chains, epoch and anchor are checked against the checkpoint, but a ledger edited and then re-anchored with any key passes that, so exit 0 prints ✓ ledger structure consistent — signature NOT VERIFIED; only a verify with --pubkey prints ✓ ledger OK. Releases up to v0.107.0 printed ✓ ledger OK either way.

Exit 8 applies to a checkpoint that carries a merkle block (one appended to a NovaSeal Merkle log through the Python API, sign_checkpoint(..., merkle_log=...)): its leaf_hash must be the hash of this checkpoint's signed body, its root is verified only together with its tree_size (ADR-0313; checkpoints logged before v0.106.0 lack it and exit 8), and its inclusion proof must recompute that root. nova ledger anchor does not append to a log, so its checkpoints carry no merkle block, make no inclusion claim and are not checked for one.

What exit 0 proves about inclusion. Without --merkle-db, only that the merkle block is self-consistent. The block is written after signing and is not covered by the checkpoint signature, so a fabricated tree that no log ever held — a one-leaf tree whose root is the checkpoint's own leaf passes — or a removed block also exits 0; the output says merkle block self-consistent only. With --merkle-db PATH (experimental; the NovaSeal Merkle log the checkpoint was appended to, SQLite path or Postgres DSN, never created) the log must hold this checkpoint's leaf at log_index and reproduce the recorded (tree_size, root) from its own leaves; a checkpoint without a merkle block must be in the log. Either failure exits 8; a --merkle-db that does not exist exits 2. This proves inclusion in the log you supplied, not that others see the same log (witnessing, ADR-0097).

nova ledger verify ./my-capsule --pubkey k.pub
nova ledger verify ./my-capsule --pubkey k.pub --merkle-db ~/.novafabric/novaseal-merkle.db

nova ledger status

Show the current chain heads and checkpoint state for a capsule.

nova ledger status ./my-capsule

Reference: src/novafabric/trust/ledger/, design/adr/0094-adversary-anchored-ledger-and-replay-attestation.md (private).

nova safety-case build

Compile a Claims-Arguments-Evidence safety case from a capsule's real artifacts (evals, seals, criterion bindings, replay attestations) against a template. Naked (unsupported) claims are a schema error. Each backing state is decided from the artifact's content:

Evidence SUPPORTED when otherwise
Eval (eval-results/*.json) the whole Wilson interval is at or above the pass threshold (0.7) and κ, when reported, is ≥ 0.6 κ < 0.6 or an interval straddling the threshold → CONTESTED; an interval wholly below it, or a failing consensus verdict (fail, rejected, unsafe, …) → UNSUPPORTED; no interval → UNKNOWN
Completeness (completeness.json) it parses and reports no dropped events dropped events → CONTESTED (the counts are in the reason); not a completeness assertion → UNKNOWN
Seal the capsule's .seal/ verifies (signature, content binding, capsule id) a .seal/ that does not verify → CONTESTED; a file named seal-bundle.json or seal.json is not a seal
Replay (attestations/reperformance.json) the DSSE signature verifies under a --replay-pubkey key, the subject is this capsule's current capsule.yaml, and match is exact (deductive) or semantic-match (inductive) unsigned or no trusted key → UNKNOWN; another capsule state, or mismatch → CONTESTED

Releases up to v0.107.0 decided these from the files' existence: an eval whose interval lay wholly below the threshold, a completeness assertion reporting dropped events, any parseable seal.json, and an unsigned hand-written replay file were all SUPPORTED.

nova safety-case build ./my-capsule --template clymer-generic-v0 --output case.json
nova safety-case build ./my-capsule --replay-pubkey ed25519.pub.pem --output case.json

nova safety-case verify

Re-verify a safety case against the capsule it was built from:

Releases up to v0.107.0 checked none of the subject, accepted dangling references, and hashed any path the case named, so a case built for one capsule verified against another.

nova safety-case verify case.json --capsule ./my-capsule

nova safety-case export

Render a safety case as JSON, Markdown, or a regulatory safety-case document (--format json|markdown|annex-iv|nist-rmf). The annex-iv renderer (experimental, ADR-0095) binds to the same 15 EU AI Act Annex IV element ids as compliance/export/annex_iv_mapping.yaml; nist-rmf renders the NIST AI RMF view. Honesty is structural: a CONTESTED claim renders its reason, an UNSUPPORTED claim is never laundered to "compliant", and a not-quantified residual risk is never fabricated.

nova safety-case export case.json --format markdown
nova safety-case export case.json --format annex-iv --output annex-iv.md
nova safety-case export case.json --format nist-rmf --output nist-rmf.md

nova evidence bind-custody

Build the FRE-902(14) court-admissibility block (chain-of-custody + self-authentication) for a capsule, from the hash-chained audit log + capsule Merkle root. Invariant I3: unwitnessed fields are null + operator_declared, never fabricated. With --key, the capsule hash is signed and the signature itself is carried in the block (self_authentication.certification.signature) so a checker can re-verify it. Without --key, a --provenance oidc or novaseal-identity custodian has nothing vouching for it and is recorded as operator_declared (releases up to v0.107.0 took it on the operator's word).

nova evidence bind-custody 01HX... --custodian alice@corp --provenance oidc --key ed25519.pem -o custody.json

nova evidence check-admissibility

Re-witness the five-point FRE-902(14) gate for a custody block and exit 3 unless the result is self-authenticating. Nothing is read from the block's own verdicts:

Point Witnessed by
custodian named, not operator_declared, and vouched for by the trusted key below
signature the carried signature verifies under --pubkey (the key the block names is never trusted)
hash --capsule's Merkle root equals hash_at_acquisition
timestamp the checker's own --timestamp-ok (verify the RFC 3161 token with nova verify --tsa-ca-bundle)
custody the local hash-chained audit log holds exactly the block's custody events for that run, and its chain verifies

A point the checker was not given the material for fails, so a block alone is never self-authenticating; each failing point is printed with its reason. Releases up to v0.107.0 re-ran the gate over the block's own booleans, so a hand-written JSON with them set to true passed.

nova evidence check-admissibility custody.json --capsule 01HX... --pubkey signer.pub.pem --timestamp-ok

Reference: src/novafabric/safetycase/, design/adr/0095-evidence-grounded-safety-case-and-admissible-evidence.md (private).

nova safety control show

experimental (ADR-0167 P2, NF-352). Read-only: list the external AI-control-protocol decisions (trusted/untrusted monitoring, Ctrl-Z resample, defer-to-trusted/human, interrogate) recorded in a capsule's facets.frontier_safety block. Each row shows the protocol, the decision it produced (accept | edit | resample | defer | audit), the governed action's digest, the monitor identity digest (never its prompt), the protocol's own verdict_ref, and — for a monitor that also acted as a C4 guardrail — the guardrail_decision_ref digest. --action <sha256:…> filters to one governed action; --json emits machine-readable output.

Every output prints the in-mission-boundary line: NovaFabric records the decision; it never runs the protocol, computes a verdict, or blocks the workload. nova safety is a different command from nova safety-case (ADR-0095).

nova safety control show --capsule 01KZ...
nova safety control show --capsule ./my-capsule --action sha256:aa11... --json

Exit codes: 0 whenever the capsule was read (including "no decisions recorded"); 2 for a missing/unreadable capsule or a malformed facet.

nova safety tripwire list

experimental (ADR-0167 P2, NF-357). Read-only: list the published framework indicators (RSP/ASL, Preparedness, FSF) that fired on a run, each bound by commitment_ref to the NF-353 commitment it implicates, with the digest of the observing event/eval. --framework anthropic_rsp|openai_preparedness|deepmind_fsf|other filters (exact, case-sensitive; any other value exits 2 — before this release a misspelt framework silently filtered every trigger away and exited 0, which read as "nothing fired"); --json emits machine-readable output. There is no --fired filter: a trigger object only exists when an indicator fired (fired: false is unrepresentable by design), so the filter would be a no-op.

A fired tripwire is reported, never acted on: no safeguard is applied and the command still exits 0 (2 only on input errors). Recording is fail-open — invalid safety material is dropped with a warning, never raised into the workload.

nova safety tripwire list --capsule 01KZ...
nova safety tripwire list --capsule ./my-capsule --framework deepmind_fsf --json

nova safety signal list

experimental (ADR-0167 P3, NF-354/355/356/358). Read-only: list the external alignment-risk evidence recorded in a capsule's facets.frontier_safety block — deception / scheming / eval-awareness signals (NF-354, verdict_source: scheming_eval), sandbagging / under-elicitation records (NF-355: elicitation regime, declared-ceiling digest, the evaluator's observed_vs_declared), sandbox-escape / self-exfiltration / autonomous-replication attempts (NF-356: attempt type, reported outcome, attempt_count and report digest — never the exploit payload), and elicitation-during-deployment records (NF-358: reported effort, with no_ceiling_computed: true). --type deception|sandbagging|autonomy|elicitation filters to one kind; --json emits machine-readable output (with total_attempt_count when autonomy attempts are included — a sum of reported counts, not a risk score).

Every signal, comparison and outcome shown is an external evaluator's, held by reference. NovaFabric runs no scheming detector, no sandbox-escape test and no elicitation, and computes no capability ceiling. A reported successful escape is reported, never acted on: the command exits 0 whenever the capsule was read, and 2 only on input errors (missing/unreadable capsule, malformed facet, unknown --type). This one reader replaces the spec's separate signal show, sandbagging show and autonomy list verbs.

nova safety signal list --capsule 01KZ...
nova safety signal list --capsule ./my-capsule --type autonomy --json

The rest of the ADR-0167 nova safety … surface (threshold, commitment, gate, case, verify) is planned (P1 ships as a library facet only; P4–P5 are future design).

Reference: src/novafabric/frontier_safety/, src/novafabric/cli/frontier_safety.py, design/adr/0167-runtime-safety-alignment-evidence.md (private).

GET /api/runs/{id}/energy (dashboard API)

Return the energy receipts and conservation status for a run (experimental, ADRs 0093/0094/0095). Token-gated, read-only. Requires nova serve to be running.

GET /api/runs/{id}/energy
Authorization: Bearer <token>

Response includes the per-action receipts (source, confidence grade, joules) plus the signed energy conservation status (conserved / diverged / unmeasurable). The React EnergyTab panel that renders this is the remaining frontend follow-up (not yet built).

GET /api/runs/{id}/ledger (dashboard API)

Return the Adversary-Anchored Ledger verify status for a run (experimental, ADR-0094). Token-gated, read-only.

GET /api/runs/{id}/ledger
Authorization: Bearer <token>

Response includes the per-stream chain verify result and the tamper-taxonomy exit code (content edit / reorder / truncation / bad signature / no checkpoint).

GET /api/runs/{id}/safety-case (dashboard API)

Return the compiled Claims-Arguments-Evidence safety-case tree for a run (experimental, ADR-0095). Token-gated, read-only. The optional template query parameter selects the CAE skeleton.

GET /api/runs/{id}/safety-case?template=clymer-generic-v0
Authorization: Bearer <token>

Response is the compiled CAE tree with backing states (SUPPORTED / UNSUPPORTED / CONTESTED / UNKNOWN). The React SafetyCaseTab panel that renders this is the remaining frontend follow-up (not yet built).