Rightshold™ Sign up

Answers · AI evidence

How do I make an AI agent's audit log append-only so even an admin can't silently delete entries?

Last updated

TL;DR: Database permissions alone can't do it. You can revoke UPDATE and DELETE from the agent's role, but PostgreSQL's own docs say a superuser bypasses all permission checks, and whoever runs the database can drop a trigger, restore an old backup or simply stop writing. So aim for two things: deletion that is blocked where the storage allows it, and deletion that is visible everywhere else. Number every entry and chain it to the hash of the one before, so a removed or edited entry leaves a gap or a broken link. Then copy each closed batch to write-once storage the admin can't shorten: S3 Object Lock in compliance mode, which AWS says no user, including the root user, can delete before the retention date, or a locked Cloud Storage retention policy. Finally, commit the chain head on a schedule to a record outside the admin's control, so cutting off the newest entries is caught too. On Rightshold, recorder_checkpoint commits your agent's signed log head to a public, hash-chained ledger whose blocks are timestamped in Bitcoin, checkpoints only move forward, and verify_recorder lets anyone check a disclosed stretch for gaps for free.

What should I check, step by step?

1. Write down who you are protecting the log from: the agent, the app's own service account, a database admin, a cloud admin. Each of these can remove a different layer, so each needs a layer it can't touch.

  1. Give every entry a sequence number, a timestamp and the hash of the previous entry (seq 1 points at 64 zeros). Sign each entry with a key the log's admin doesn't hold, such as the agent's own key kept in a separate secret store.
  2. In the database, give the writer role INSERT only. Revoke UPDATE, DELETE and TRUNCATE from it and from the app. Treat this as protection against the agent and the app, not against the database's superuser or owner.
  3. Every hour or every N entries, write the closed batch and its last hash to a separate bucket with write-once retention: S3 Object Lock in compliance mode (not governance mode, which a user with s3:BypassGovernanceRetention can override), or a locked Cloud Storage retention policy. Put that bucket in a different account, owned by someone other than the log's admin.
  4. Commit the chain head outside your systems on the same schedule: recorder_checkpoint on Rightshold, an RFC 3161 timestamp, an OpenTimestamps proof, or a copy to your auditor. Without this, an admin can delete the newest entries and the remaining chain still looks whole.
  5. Check the chain on a schedule from a system the admin doesn't control: no missing sequence numbers, every prev hash matches, every signature verifies, and the newest entry is at or after the last committed head.
  6. Alert when entries stop arriving or the checkpoint job fails. Silence is how a quiet deletion or a disabled logger looks from outside.
  7. Write corrections as new entries that point at the entry they correct. Never edit an old entry, even to fix a typo.

Why can't database permissions stop an admin from deleting an AI agent's audit log entries?

PostgreSQL's documentation on role attributes says a database superuser bypasses all permission checks except the right to log in. REVOKE and triggers stop the application and the agent. They don't stop the person who runs the database, and they don't stop a restore from an older backup.

How do I detect deleted or cut-off entries in an AI agent's audit log?

A hash chain makes edits and deletions in the middle visible: remove entry 41 and entry 42's prev hash no longer matches anything, or the sequence jumps from 40 to 42. It can't catch the newest entries being cut off, because what is left still chains.

How often should I commit an AI agent's audit log head outside my systems?

On Rightshold, the flight recorder keeps your log on your side. Each entry is {seq, at, kind, summary, prev}, hashed as sha256('rec:' + canonical(entry)) and signed with the agent's key. recorder_checkpoint publishes only the head hash and the entry count, signed by the agent, as a ledger entry.

How do I ask Rightshold about this (free, no key)?

Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “My agent's audit log is hash-chained and signed. Commit the current head (entry 5120) so an admin can't later delete entries or cut off the end without it showing.”

One-click setup

{
  "tool": "recorder_checkpoint",
  "arguments": {
    "checkpoint": {
      "agent": "<RS number>",
      "seq": 5120,
      "head": "<sha256('rec:' + canonical(entry 5120))>",
      "at": "2026-11-07T21:00:00Z"
    },
    "signature": "<agent key's Ed25519 signature over canonical(checkpoint)>"
  }
}

Rightshold never holds your log. It records the head hash and entry count you commit and checks excerpts you choose to disclose. It can't stop anyone from deleting their own copy, and it can't show that an entry was true when it was written, only that it existed in that form by the time its head was committed. Write-once storage, database permissions and monitoring are steps you run on your own systems. Not legal or compliance advice.

What are the sources?

Related

Not legal advice. JSON · Markdown · All answers

Get a free API key in one call

No card and no email needed. 100 free credits; the license and policy checks stay free without a key.

curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_...   # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
  -H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'