This page is for an auditor who has to check NuraMesh’s records without trusting NuraMesh’s software or database. You run one Python file, offline, and you can read its source in an afternoon. The idea behind it is on The ledger and anchors.
What you need
Section titled “What you need”| Item | Where it comes from |
|---|---|
| Python 3.12 or newer | Yours. The verifier uses the standard library only. |
nuramesh_verify.py |
One file. It is not published as a package: get it from the operator, and read it before you run it. Source on GitHub. |
| The ledger export | The operator runs nuramesh ledger export --team <team-folder> --out ledger.jsonl. It writes one JSON event per line and never overwrites a file. |
| The anchor files | A checkout of the anchor repository’s ledger-anchors branch: the files run__<id>.jsonl and org__<id>.jsonl. |
| The public key | The PEM file of the anchor signing key, obtained from the operator by a channel that is not the export. |
| A recorded head (optional) | A head hash for one stream that someone else wrote down earlier. |
Get the anchors by cloning the anchor repository yourself, not from the operator’s machine. The operator signed them, so you should fetch them.
Run it
Section titled “Run it”python3 nuramesh_verify.py ledger.jsonl --anchors ./anchors-checkout --pubkey anchor.pubOptions you can add:
--require-anchorsmakes a stream with no verified anchor a problem.--expected-head STREAM=HASHchecks that a stream ends at a head you recorded, for examplerun:r1=<64 hex digits>.--jsonprints the result as JSON.--git, with--git-ref BRANCHor--git-commit <40 hex digits>, also checks the anchor repository’s history (next section).
Exit code 0 means no problem was found. 1 means problems were found: tampering, damage or a
missing part. 2 means the check could not run (an unreadable file or key, bad options). Treat
2 as “not checked”, never as a pass.
If the operator can run NuraMesh for you, the same checks are available as
nuramesh ledger verify, with the options --anchors, --pubkey, --require-anchors and
--expected-head. That command is NuraMesh checking itself, so the standalone file is the one to
use when you must not rely on NuraMesh. See Anchor the ledger to Git.
Check the anchor repository’s history
Section titled “Check the anchor repository’s history”cd anchors-checkout && git switch ledger-anchors && cd ..python3 nuramesh_verify.py ledger.jsonl --anchors ./anchors-checkout --pubkey anchor.pub --gitThe checkout must be a full clone, on the anchor branch. This mode needs the git program. If
you ask for --git and git is missing, the clone is shallow, or there is no ledger-anchors
branch, the exit code is 2. It is never skipped quietly. --git-commit must be a commit id,
not a tag or tree id; git rev-parse <tag>^{commit} gives you one.
It reads the repository with read-only commands. It checks that every earlier version of every anchor file is still the start of the current one (no line rewritten or removed, no file deleted, side branches and merges included), and that the files you verified are exactly what the branch holds. This catches a force-pushed or rewritten anchor repository only if your clone still has the old history. A fresh clone of an already rewritten repository looks clean, so keep an older copy and compare.
The mode line
Section titled “The mode line”Every run says what it checked, so a clean result is never read as more than it checked.
mode |
What ran |
|---|---|
chain |
The hash chains only (no --anchors). |
chain+anchors |
Chains and signed anchors. |
chain+anchors+git |
Chains, signed anchors and the anchor repository’s history. |
The mode is the first line of the text output, it is repeated in the final RESULT line, and it
is the mode field of --json.
What it checks
Section titled “What it checks”- The hash chain of every stream. Events are numbered 1, 2, 3 without gaps. Each names the hash of the one before it (64 zeros for the first). Each hash is the SHA-256 of the event’s canonical JSON, and time never goes backwards. An edited, deleted, inserted, repeated or reordered event is found at the first event that no longer fits.
- The format of every event. Unknown or missing fields, wrong types, a time not written to
the microsecond, a repeated JSON key, a float,
NaN, or an integer beyond plus or minus 2^53 - 1 are reported, never repaired. The report never shows a value or a data key. - The anchors. Each anchor is a signed record of a stream, a sequence number, a head hash, a time and a key id. The verifier checks the Ed25519 signature with the key you gave, that the event at that sequence number has exactly the anchored hash, that no anchor is ahead of the export, and that anchors never go backwards. This is what catches a complete rewrite where every hash was recomputed: a chain alone cannot see one.
- Gaps against the record. A stream with anchors that is missing from the export, an export
that stops before an anchor, and (with
--expected-head) a last event that is not the head you were given. - How much is unanchored. Events newer than the last verified anchor are counted.
Read the output
Section titled “Read the output”mode: chain+anchorsorg:o1: 2 events, head 0f532d7f6031c1b2..., chain ok; 1 of 1 anchors verified, 0 events newer than the last onerun:r1: 4 events, head 580aede90cc198be..., chain ok; 2 of 2 anchors verified, 2 events newer than the last oneRESULT: no problems found (mode: chain+anchors; ...)The last line is shortened here. After the mode, the tool’s line ends with a pointer to the auditor guide “for what that does not prove”: this page is that guide, and the section “What a clean result does not prove” below is the part it means.
Each problem line reads PROBLEM <stream> <code> [at seq N]: <detail>. The stream - means a
line that could not be assigned to a stream.
| Code | Meaning |
|---|---|
bad_hash |
The event’s content does not match its hash: it was edited after it was written. |
broken_link |
An event does not point to the one before it. |
wrong_seq |
A gap, repeat, reorder or missing start: events were deleted, inserted or moved. |
time_went_backwards |
An event is dated before the one before it. |
malformed_event, malformed_line |
The export is not in the stored format. |
unsafe_number |
A number that cannot be hashed exactly. |
bad_signature, wrong_key |
An anchor is not signed by the key you gave. Do not trust that anchor. A wrong key may also mean you were given the wrong key file. |
head_mismatch |
The event at an anchored sequence number is not the one that was anchored: history was rewritten. |
stream_shorter |
An anchor is ahead of the export: events were removed from the end, or the export is cut. |
stream_missing |
Anchors, or an expected head, exist for a stream the export does not have. |
anchors_out_of_order |
Anchors go backwards in sequence number or time. |
unreadable_anchor_file |
An anchor file is not in the strict format. None of it was used. |
expected_head_mismatch |
The last event is not the head you recorded: events were removed from the end. |
history_rewritten |
Only with --git: an earlier version of an anchor file is not the start of the current one. |
anchor_file_removed |
Only with --git: an anchor file that existed in the history is gone from the branch. |
uncommitted_anchor_file |
Only with --git: the file you verified differs from what the branch holds. |
anchor_branch_diverged |
Only with --git: the local and remote-tracking ledger-anchors branches are not one history. |
unanchored |
Only with --require-anchors: no verified anchor for that stream. |
empty_export |
The export holds no events. |
After the first problem in a stream the verifier stops walking that stream, so later events of the same stream are not listed. Fix or explain the first one, then run again.
What a clean result does not prove
Section titled “What a clean result does not prove”- That the operator did not record false things. The ledger proves that what was recorded was not changed afterwards, not that the events are true. A model call that never happened but was written down verifies fine.
- Anything newer than the last anchor. The count of events newer than the last verified anchor is the part an operator who controls the database could still rewrite undetected. Ask for a fresh anchor, or a head you record yourself.
- Truncation, unless something outside the export says how long it should be. With no anchor
and no recorded head, cutting the newest events off a chain is invisible. Use anchors and
--expected-head. - That the anchor repository was not rewritten. If the operator also controls the anchor
repository and the signing key, they can sign a rewritten history. The defences are outside
this tool: the key held by someone other than the operator, a second copy of the anchors you
cloned earlier, and the hosting service’s own history. Without
--gitthe tool does not look at the repository’s history at all. Check themodeline, and compare against a copy you fetched before. - That you have the right public key. The tool checks signatures against the key you pass. Where that key came from is your job.
- Content. The ledger holds hashes of prompts and outputs, never the text. The verifier cannot say what a prompt said.
- Other signature schemes and key rotation. Only Ed25519 anchors are read; anchors signed
another way are not checked. Give every key the anchors were signed with. An anchor from a key
you did not give is
wrong_key. - The canon, honest gate results or correct budgets. It checks the chain they were written into, not the engine’s logic.
- Speed at scale. The Ed25519 check is plain Python and takes a few milliseconds per anchor. A ledger with hundreds of thousands of anchors takes minutes.
Why you can trust the checker more than the system
Section titled “Why you can trust the checker more than the system”It shares no code with NuraMesh. The hash rules, the canonical JSON writer and the Ed25519 check are written again in that one file from a written specification, and a test fails if the file imports anything outside the standard library. You can reproduce the rules from the specification and compare.
Troubleshooting
Section titled “Troubleshooting”| You see | Do this |
|---|---|
Exit code 2 |
The check could not run: an unreadable file or key, or bad options. Treat it as “not checked”, never as a pass |
Exit code 2 with --git |
git is missing, the clone is shallow, or it has no ledger-anchors branch. Make a full clone and switch to that branch |
--git-commit is refused |
It must be a commit id, not a tag. git rev-parse <tag>^{commit} gives you one |
| A stream has no anchor | With --require-anchors that is a problem by design. Ask the operator to export anchors, then fetch them yourself |
The mode line says chain |
No anchors were given, so only the hash chains were checked. Add --anchors and --pubkey |
Next steps
Section titled “Next steps”- The ledger and anchors: what the chain and the anchors are.
- Anchor the ledger to Git: the operator’s side.
- Audit a task: read one task’s story.
Was this page helpful?