CarolineDocs

Prove it / The decision ledger

The decision ledger

Every decision, every refusal at the door and every change to rules, keys, agents and records, in one append-only chain kept for a year. Each record carries the hash of the one before it, so an edit, a gap or a reorder shows.

What goes in

SourceRecords
opaevery decision the engine makes, with the rule that made it, the input, and OPA's decision_id
pdpevery evaluation refused at the door: no key, a wrong or revoked key, a wrong agent key
backendevery change made in Caroline: rule saves and AI drafts applied, pack switches, keys issued and revoked, gateway bindings, directory and vocabulary edits, agent settings and approvals, ledger exports
ledgerthe ledger's own housekeeping: retention and repair

Each admin record names the installation, the request id and the author who signed in. A rule save's git commit carries the same operation id, so the history in git and the ledger meet.

Written first

The chain

{"seq": 3213, "received": "2026-11-29T10:41:07.118Z", "source": "opa",
 "event": { ... }, "prev": "3ea6cd54...", "hash": "cda65019..."}

hash is SHA-256 over prev and the canonical JSON of the other four fields. The first record's prev is 64 zeros. One file per UTC day, one writer at a time: the backend holds an exclusive lock for its whole life, so a second copy cannot fork the chain.

Verify it

caroline ledger verify

Recomputes the whole retained chain and names any problem by file and line: a line that does not parse or is not exactly as written, a gap in the sequence, a broken link, a record whose content no longer matches its hash, or a last record that is not the head Caroline holds. It runs beside ingest; decisions keep landing while it checks.

What it proves, and what it does not

Tamper-evident, not tamper-proof

An edit, deletion, insertion or reorder inside the retained files breaks verify at that line. It does not stop someone with write access to the ledger's disk from rewriting the chain from their edit onwards: recomputing SHA-256 is arithmetic, not a secret. Nor does it prove every decision arrived: during a ledger outage the engine keeps unsent decisions in a bounded in-memory buffer (128 slots, lost if it restarts), and the PDP forwards refusals on a best-effort queue whose drops are counted.

Export every day to a system the installation's operator cannot write. A later rewrite then disagrees with your copy. Anchoring the head outside the installation is not built yet.

Export

HowGives
caroline ledger export 2026-11-29
GET /api/audit/export/2026-11-29
one UTC day, verbatim, as NDJSON: what a SIEM ingests
caroline ledger export --all
GET /api/audit/export
Decisions › Export › The whole record, with its proof
the whole retained ledger as one zip: the day files, a manifest with each file's SHA-256, and verify.py, which checks it all again offline with nothing but Python

An export is itself recorded (ledger_exported: by whom, how many records, the head, the zip's SHA-256), so the next export shows who took this one.

Read it

GET/api/audit/ledger?limit=20&source=pdp&before_seq=3200author

Newest first, a page at a time. caroline decisions reads the decisions the same way, from the last hour, a window, one by id, or as they arrive.

Retention

365 days. On the first record of each UTC day, whole days older than that are removed, in an order that keeps the chain checkable: the last removed record's sequence and hash are written down first, a retention record goes on the chain, and only then are the files deleted. A wall clock set far ahead cannot delete the retained year: the newest day is never removed, and what is held back is counted.

Personal data

A record holds what the engine and the PDP saw, subject and resource ids included. Nothing is masked. Reading the ledger needs an author's sign-in; a viewer is refused. Keep exports where only authors can read them.

Watch it

MetricAlert when
backend_ledger_write_failures_totalit rises: changes are being refused
backend_ledger_events_dropped_totalit rises: an event could not be stored
pdp_ledger_forwards_total{outcome="dropped"}it rises: refusals did not reach the ledger
backend_ledger_ingest_refused_totalit rises: something without the ingest token is posting
backend_ledger_retention_held_back_totalit jumps: the clock is ahead; fix it within the day
Caroline DocsAuthZEN 1.0 · OPA