schemabrain audit
The CLI surface for the tamper-evident audit chain. Two subcommands:
audit list— read recent rows, with optional filters.audit verify— re-walk the chain and report mismatches.
list
List recentmcp_audit rows with optional filters. Two output modes: rich-formatted table (default) or JSON Lines.
| Flag | Default | Purpose |
|---|---|---|
--store-path PATH | ./schemabrain.db | Path to the local SQLite store. |
--since DURATION_OR_TIMESTAMP | (all) | Show rows newer than this point. Accepts compact duration (30s, 5m, 2h, 1d) or ISO 8601 timestamp with timezone. |
--status {success,empty,partial,degraded,error,refused} | (no filter) | Filter by Charter envelope status. |
--tool NAME | (no filter) | Filter by tool_name (exact match, e.g. describe_table). |
--limit N | 100 | Maximum rows to return. Must be non-negative. |
--json | (off) | Emit JSON Lines instead of the rich table. Pipe-friendly for jq / awk. |
Examples
verify
Re-walks the chain hash for every row and reports mismatches. The fast yes/no integrity check operators run before trusting the audit log.| Flag | Default | Purpose |
|---|---|---|
--store-path PATH | ./schemabrain.db | Path to the local SQLite store. |
--full | (off — stops at first mismatch) | Walk every row and report all mismatches. Use for forensic walks. |
--since CURSOR | (walk from genesis) | Anchor the walk to a known-good cursor row. Accepts: a leading hex prefix (≥8 chars) of a previously-archived chain_hash, a compact duration (7d, 2h), or an ISO 8601 timestamp with timezone. The cursor row’s own integrity is NOT re-verified — only rows after it are. |
How verification works
For every row,verify recomputes chain_hash from the previous stored chain_hash plus the canonical bytes of the current row, and compares against the stored value:
ChainMismatch is reported for every row where recomputed ≠ stored. With --full, all mismatches are collected; without it, the walk stops at the first.
--since is the operator’s tool when a known-good chain head has been archived externally (a CI artifact, a nightly backup, a cron-emailed head hash). Walk only rows after that anchor — fast on stores with millions of rows.
Examples
Manual tamper demo
For a hands-on walk-through of how a forged row breaksverify, see audit-chain — Verify it yourself.
Related
Tamper-evident audit chain
The mechanism this CLI surface reflects.
Audit Viewer dashboard
Visual rendering of the same chain.
schemabrain tail
Live event stream from a running
serve process.Observability
Where audit rows fit in the event-bus substrate.