You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
complete-visibility audit chain: every SDK action is HMAC-chained
Until now, createIntegrityAudit() was a separate opt-in wrapper that only
covered explicit integrity.log() calls. That meant "tamper-evident audit"
quietly excluded register(), enforce(), audit.log(), kill-switch — the
actual surface of the SDK. Fix that.
New: `createGovernance({ integrityAudit: { signingKey, onFailure } })`
- One config flag turns on HMAC-SHA256 hash chaining for EVERY audit
write the SDK makes:
agent_registered, policy_evaluation, policy_evaluation_preprocess/
postprocess, audit.log() (any eventType), kill-switch events, and
the new action_outcome type.
- onFailure: "allow" (default) logs via onAuditError and continues;
"block" rejects enforce() when the chain write fails so no gaps.
- Sequence is race-free — chainLock serialises concurrent writes.
- Chain state is only committed after storage confirms the write, so a
rejected storage call doesn't advance the chain.
New: `gov.recordOutcome(outcome)` + `runWithOutcome(gov, opts, action)`
- recordOutcome writes an action_outcome event that captures what
happened AFTER enforce() approved the action: success/failure,
duration, tokens, output summary (or error message).
- runWithOutcome wraps an async function and records success/failure
automatically, with optional summarize() for output redaction before
the outcome hits the audit log.
- Both participate in the integrity chain when integrityAudit is on.
New: `gov.integrityChain` (populated only when integrityAudit is set)
- .export(filters?) returns IntegrityAuditEvent[] joined against the
in-memory integrity index, ready for verifyAuditIntegrity.
- .stats() returns latestSequence / latestHash / algorithm.
Tests: 10 new tests (+6 end-to-end chain coverage, +4 action-recorder).
- E2E: chains register + enforce + recordOutcome + audit.log + kill into
one chain, exports it, and verifies with the standalone verifier.
- Tamper detection: mutating an outcome event's detail breaks verify at
the right position.
- Fail-open and fail-closed behaviours both covered.
Total: 1348 → 1358, zero regressions, lint + build clean.
README updated with an honest "what gets chained / what does NOT" table
so readers don't assume 'every agent action' is covered when what we
mean is 'every action routed through the SDK.'
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments