> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracelane.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# External witness — keep signed heads outside Tracelane

> Keep the signed head of each audit export yourself, then check a later export against them offline to detect truncation, a rewritten history, or a rolled-back head.

# External witness

> [!WARNING]
>
> **In development, not yet available.** The `tracelane-audit witness` commands are built in the
> open-source verifier but have not been proven on production exports, and no release binary
> exists yet (see [Verifier CLI](https://docs.tracelane.dev/audit/verifier-cli.md)). Do not rely on this page for a control.

A hash chain shows that the rows in an export were not edited. It does not show that rows were
left out, because the same system writes the chain. A signed head you saved from an earlier export
fixes that gap in one direction: it commits to the first N rows as they were at that time. If a
later export drops a row, rewrites one, or ends earlier than that head, the check fails.

## What it detects

| You hold | A later export that | Result |
| - | - | - |
| a head at size 5 | has only 3 rows (truncation, or a head that moved backwards) | FAIL, exit 4 |
| a head at size 5 | has different rows at or before row 5 (a fork, or a rewrite that was re-chained) | FAIL, exit 4 |
| two heads at the same size | whose hashes differ | FAIL, exit 4 |
| a head signed later than a head or checkpoint with a larger size (including the export's own checkpoints), beyond `--skew` | is held, or the export's chain says so | FAIL, exit 4 |
| a head from another workspace | is given for this workspace | FAIL, exit 4 |
| a head that does not verify | under your pinned key | FAIL, exit 5 |
| a held head signed within the export's checkpoint window | that the export's chain does not contain (older heads are only prefix-checked) | FAIL, exit 4 |

An unverifiable head is always a failure. Exit codes follow `verify`: 2 for an I/O or usage error, 4 for a contradiction or malformed evidence, 5 for a key or signature that does not verify. The output counts held heads newer than the export and older than its checkpoint window.

## Use

```bash theme={"system"}
# After each export, keep its head (the first call starts the file).
tracelane-audit witness add --file export-2026-11.zip --pubkey workspace.pub --witness heads.ndjson --new
tracelane-audit witness add --file export-2026-12.zip --pubkey workspace.pub --witness heads.ndjson

# Later: check any export against every head you hold.
tracelane-audit witness check --file export-2027-01.zip --pubkey workspace.pub --witness heads.ndjson --max-gap 3900
```

`add` verifies the export first and refuses one that contradicts a head already in the file, so the
file cannot absorb a rolled-back history. Keep `heads.ndjson` somewhere Tracelane cannot write.
Everything runs offline against the open-source verifier; no Tracelane service is called.

## What it does not show

* A pass means the rows are unchanged since you witnessed them, not that every record was captured. It covers rows up to your newest head. The check prints how many rows come after it ("not covered").
* It does not show that no record was withheld before a head was signed.
* The heads are signed with your workspace key, which Tracelane operates. A head you hold proves
  what that key signed at the time you saved it, not that an independent party observed it. A
  co-signing witness run by someone else is not built.
* `--max-gap` reports a long interval between two heads you hold; it does not fail the check.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.