Audit
PartialThe audit log answers “who changed this, and to what?”: every mutation is recorded once, at the source. To read it, see the admin Audit page.
The model
Section titled “The model”audit_log is ground truth, not derived: one row per mutation, carrying actor, verb, resource,
resource_id and the old and new images.
- Written in the same transaction. Every API write emits its row in the transaction that makes the change, in the storage layer, so it cannot be forgotten or bypassed.
resource_idis the primary key, never the name. A named entity is addressable by uuid or by a renameable handle, so recording whichever the caller used would give one entity two audit keys. The name at the time is in the images, a point-in-time snapshot rather than a key. A guard fails on awriteAuditResargument that is not primary-key shaped.- A row outlives its subject.
resource_idis text and never a foreign key. An update carries the moved fields in both images and enough of the subject to name it; a delete carries the whole subject inold. Images are read under the row’s lock, so they are the state the write replaced. Where there is no row to lock, an advisory lock stands in: an append-only series (property values) has no single row, and a create-or-update path (settings) may not have its row yet. A secret’s image is its metadata and a digest of the sealed value, never the plaintext, and the password verbs carry no field images (ADR-1442). - The actor is a person, machine user or outpost, resolved by the Storage Gateway, the one layer every database read and write passes through, to its identifier and
snapshotted on the row (
actor_username), so the trail stays attributable after the actor is purged (ADR-0016, ADR-0110). An impersonated action records both actors. - How it arrived rides beside the actor. A row carries
channelandclient: an MCP call readschannel = 'mcp'with the client the caller declared, and an omnibot run readsomnibot, stamped from the credential and never claimed by the caller (ADR-1162). - An agent token names its agent. A row written with an
agent token carries
agentbeside the person, on every channel (ADR-1179). - A token is audited. Minting and revoking write rows carrying the prefix, purpose and expiry, never the token or its hash.
The second write lane
Section titled “The second write lane”Login and logout run on read paths with no transaction, so they emit through a standalone seam under
resource = 'auth', with the verbs login, logout, login_failed, login_denied, login_locked
and revoke_session, and agent_refused when the install’s agent policy refuses an agent’s call.
Every read of secret material writes a row, with distinct reveal and copy verbs, and that subset
cannot be filtered away. Other reads are not audited.
GET /audit-log is gated by audit:read:admin, out of a wildcard’s reach, so only admin and owner
see it. Rows return newest first, filterable by resource, verb, agent, channel and client,
paged backward with before and limit (default 100, at most 500). Redaction is the write side’s:
the read passes images through verbatim.
Retention and integrity
Section titled “Retention and integrity”Audit is append-only by construction and meant to have the longest retention of any log.