← Go back

Guide · CompanionGuard · Published 14 November 2026 · Reviewed 14 November 2026 · By the Ingenious AI team

Hash-Chained Evidence: Tamper-Evident Records for Chatbot Safety Decisions

The short answer

A hash-chained evidence record is a log where every entry's hash is computed over the previous entry's hash plus the entry's own fields — so changing any historical entry invalidates every hash after it. CompanionGuard's runtime seals each decision (signal class, action, timestamp, one-way message hash, session reference) this way. Verification is recompute-and-compare, doable by any reviewer from the export alone. Raw message text is never an entry field.

What is a hash-chained evidence record?

A hash-chained evidence record is an append-only log in which each entry contains a cryptographic hash (SHA-256 in CompanionGuard) computed over the previous entry's hash and the entry's data. The construction makes history tamper-evident: you can add new entries freely, but editing, deleting or reordering an old one breaks the chain from that point forward, visibly.

Create the free safety kit Next guide All guides

CompanionGuard is built by Ingenious AI. A compliance toolkit — not legal advice and not a clinical service. If you are in crisis right now: US — call or text 988; UK & Ireland — Samaritans 116 123.

The construction, in one paragraph

CompanionGuard's entry hash is computed over a pipe-joined payload: the previous entry's hash, the bot slug, the session reference, the event kind, the signal class, the action, the message hash and the creation timestamp — hashed with SHA-256. The session reference is itself a one-way SHA-256 hash of the operator's session ID, and the message hash is a one-way SHA-256 of the message. So the chain links three levels of one-way references, and at no level does a reversible identifier or a word of conversation text appear.

The first entry's 'previous hash' is empty, anchoring the chain to the bot's record. From there the invariant is simple and total: entry n's stored hash must equal the recomputation from entry n−1's hash and entry n's fields. Any database edit — a backdated action, a deleted crisis event, a softened signal class — desynchronises the chain at exactly the edited point.

Why tamper-evidence is the property that matters

Safety records have an unusual threat model: the person most tempted to edit them is their owner, after an incident, under legal or reputational pressure. A plain database table offers no resistance to its own administrator; a policy that says 'we never edit logs' is a promise about future behaviour under stress. A hash chain converts that promise into a verifiable property: the operator cannot rewrite history without the rewrite being detectable by anyone holding the export.

That asymmetry is what makes the record evidence rather than bookkeeping. When a builder hands a reviewer a chain that verifies end-to-end, the claim being made is narrow and strong: 'these entries, in this order, with these fields, are the entries that were written — or the chain would not recompute.' It says nothing about whether the decisions were wise; it proves they are the decisions that were recorded at the time. The exports guide covers handing this to a reviewer in practice.

What an entry proves — and pointedly does not

An entry proves: at this timestamp, for this bot and session reference, this event kind occurred, this signal class was primary, and this action was returned — over a message whose hash is recorded. It does not prove what the message said (the hash is one-way), who sent it (no user identifier exists), or where they were (no IP is stored). Two entries with the same message hash prove the same text was sent twice, without revealing it once.

This is the design's answer to the evidence-versus-privacy dilemma that runs through companion-bot safety: the records a regulator or reviewer needs (decisions, counts, timing, integrity) are fully present, and the data a user fears (their words, their identity) is structurally absent. The privacy guide develops that trade-off and where its edges are.

Verifying an export yourself

Verification needs no CompanionGuard account and no trust in the operator: take the export, start from the first entry with an empty previous hash, recompute each entry's hash from its fields and the running previous hash, and compare against the stored hash at every step. A single mismatch localises the tampering to that entry; a clean run verifies the whole sequence. Because entries carry their fields in the clear (signal class, action, timestamp), the recomputation is fully determined by the export itself.

Do this on a schedule, not only under audit: monthly verification while the chain is young turns 'we believe our records are intact' into a dated series of verified checkpoints. The runtime export feeds the annual-report CSV as well, so the California reporting duty inherits the same integrity story — counts that trace back to a chain a reviewer can recompute.

Five actions to keep evidence evidence-grade

  1. Export the evidence chain monthly and store exports outside the app's own database, so the record survives the system it describes.
  2. Run chain verification on every export and log the result with a date — verification you cannot date did not happen.
  3. Never hand-edit an evidence table 'to fix a mistake': append a corrective note through your own ops records instead, and let the chain show the original.
  4. Keep the field discipline: if a proposed new log field contains user content or identifiers, it does not belong in the evidence chain.
  5. Give reviewers the export plus this verification method, not a screenshot — evidence is what a sceptic can recompute.

Worked example: a reviewer finds the chain, not a promise

A fictional app-store reviewer asks a companion builder, 'Your policy says crisis decisions are logged and never altered. Prove the never.' The builder sends the quarter's evidence export: 96,400 entries across 31,000 sessions. The reviewer's script recomputes the chain in under a minute: 96,400 of 96,400 hashes match, in order, from the empty anchor to the final entry.

The reviewer then tries the adversarial reading: could the builder have deleted an embarrassing crisis event before exporting? Deleting entry 40,112 would leave entry 40,113's stored 'previous hash' pointing at a hash that no longer precedes it — the recomputation fails at exactly that seam. The export the reviewer holds is therefore either the complete, unedited sequence or visibly broken; there is no third state. That property — not the builder's good character — is what closes the question. The numbers are illustrative; the construction is the product's own, field for field.

Frequently asked questions

How does the hash chain detect edits?

Each entry's hash is computed over the previous entry's hash plus its own fields (bot, session reference, event kind, signal class, action, message hash, timestamp). Editing, deleting or reordering any entry changes the recomputation for that entry and every entry after it, so verification fails at the edited point.

Can the chain be verified without a CompanionGuard account?

Yes. Verification is recompute-and-compare from the export alone: start with an empty previous hash and recompute each entry in order. No secret is involved — the integrity comes from the chaining, not from encryption.

Does an evidence entry contain the user's message?

No. Entries contain a one-way SHA-256 hash of the message, never the text. Sessions are likewise referenced by a one-way hash of the operator's session ID, and no IPs, user agents or user IDs are stored.

What can an entry be used to prove?

That at a recorded time, for a recorded bot and session reference, a decision of a recorded kind was taken — a named signal class produced a named action. It cannot prove what the user wrote or who they were; those are absent by design.

Which plans include hash-chained evidence?

The Crisis Evidence Runtime is a Pro ($29/month) and Team ($59/month) feature. Exports are available via the runtime export endpoint and inside the annual-report CSV.

Keep going