AI Initiative logoAI Initiative
Reading room / Manthan

T-009 — Demo Flat-File Audit Log

T-009 — Demo Flat-File Audit Log. Covers Run; File format; Public API; What this is NOT.

Project explanation / technical method
This is the retained source text, not a new validation of its claims. Numerical results and comparative claims require the accompanying source review before public reuse.

Read the connected case study or article →

Not explicitly stated in source · Date not established

Provenance, authorship and editorial notes

T-009 — Demo Flat-File Audit Log

Id

manthan-herald-protocol-demo-audit-log-readme

Project

Manthan

Source path

manthan/herald-protocol/demo/audit-log/README.md

Source sha256

cd4b113ff405a9887ec207407c09e6afd9d88eb1480cd310b7e25c748cfa6fed

Local copy sha256

cd4b113ff405a9887ec207407c09e6afd9d88eb1480cd310b7e25c748cfa6fed

Repo head

3a94084024a3434cef331fecac91c2c3b43f0313

Date
Not recorded
Date basis

Original publication date not established; Git revision date retained separately.

Author

Not explicitly stated in source

Author basis

Unknown; Git committer not substituted for document author.

Last source commit

8b75d1b0157c20a0a463f0e31008ef9f73099beb

Last source commit date

2026-06-08T07:40:14Z

Document status

Project explanation / technical method

Summary

T-009 — Demo Flat-File Audit Log. Covers Run; File format; Public API; What this is NOT.

Topics
  • Exploration architecture and selection
  • Run
  • File format
  • Public API
Theme

Exploration architecture and selection

Priority

deep

Related ids
  • manthan-readme
  • manthan-docs-architecture
  • manthan-docs-business-overview
  • manthan-docs-demo-walkthrough
  • manthan-docs-principles
  • manthan-docs-qd-measurement-direction-plan
  • manthan-docs-swarm-evolution-integration
Evidence concerns
  • Recovered source text is preserved verbatim. Assertions, comparisons, commands and results belong to its original context; they were not re-executed or externally re-verified during this corpus review.
Word count

567

Bytes

3901

Source relative

herald-protocol/demo/audit-log/README.md

Remote mirror

manthan/herald-protocol/demo/audit-log/README.md

Full text preserved

True

T-009 — Demo Flat-File Audit Log

This is the demo audit-log primitive used by the two-agent demo (T-011) and the herald verify <trace> CLI (T-010). It is intentionally minimal: append-only, hash-linked, no Signed Tree Heads, no inclusion proofs, no consistency proofs, no gossip. The full HERALD CT log lives in T-101 / T-102 / [EXT §2].

Run

cd learning/herald-protocol/manthan/state/findings/T-009/demo/audit-log

npm test     # 10 tests
npm run demo # appends 3 entries, prints raw JSONL, replays

No npm install required on Node 24+ (uses --experimental-strip-types).

File format

The log is a single JSONL file. One JSON object per line. Each line is a LogEntry:

{
  "seq": 0,
  "prev_hash": "<64 hex>",
  "id": "<envelope id>",
  "parent_hash": "<64 hex>",
  "trace_hash": "<64 hex>",
  "ts_bucket": 1746432000,
  "entry_hash": "<64 hex>"
}

This is the minimal-metadata profile from [SPEC §5.3 line 310]: the log records id, hash of parent, hash of trace, and a coarse timestamp bucket — nothing more. No from, no to, no payload, no signatures. Wider profiles require an explicit log_metadata_consent attestation per [EXT §2.2 line 137]; that profile is out of scope for the demo.

Public API

import { AuditLog, ZERO_HASH, type EnvelopeSummary } from "./src/index.ts";

const log = new AuditLog("/tmp/herald-demo.jsonl");

log.init();                        // create file if missing
const entry = log.append({         // append one envelope summary
  id: "envid-...",
  parent: null,                    // or another envelope id
  trace: "envid-...",
  ts: 1746432000,
});
log.read();                        // -> LogEntry[]
log.tailEntry();                   // -> LogEntry | null
log.replay();                      // -> {status: "ok", count} | failure

replay() walks the file in order, re-derives each entry_hash, and verifies the prev_hash chain. It does NOT verify envelope signatures — that is the verifier's job (T-010). It returns one of:

StatusMeaning
okWhole file is internally consistent.
tampered-entryA line's stored entry_hash does not match its body.
broken-chainA line's prev_hash does not match the previous line's entry_hash.
duplicate-seqseq is non-monotonic.
malformedA line is not valid JSON or missing required fields.

What this is NOT

Files

Continue exploring