prisma-airs-audit¶
Fire-and-forget audit logging of inbound messages with scan cache population.
Overview¶
| Field | Value |
|---|---|
| Event | message_received |
| Config field | audit_mode |
| Can Block | No |
| Default mode | deterministic |
| Valid modes | deterministic, probabilistic, off |
Purpose¶
Scans every inbound user message through AIRS and logs the result. Caches the scan result (keyed by session + message hash) so downstream hooks (prisma-airs-context, prisma-airs-tools, prisma-airs-tool-redact) can reuse it without redundant API calls.
How It Works¶
- Reads
audit_modefrom config (default:deterministic). Returns void ifoff. - Validates
event.contentis a non-empty string. - Builds session key:
ctx.conversationIdor fallback{event.from}_{ctx.channelId}. - Calls
scan({ prompt: content, profileName, appName, appUser })whereappUserisevent.metadata.senderIdorevent.from. - Hashes the message content and caches the result via
cacheScanResult(sessionKey, result, msgHash). - Logs a structured JSON audit entry to stdout with: action, severity, categories, scanId, reportId, latencyMs, promptDetected.
Error Handling¶
On scan failure:
- Logs error to stderr.
- If
fail_closedistrue(default), caches a synthetic block result withaction: "block",severity: "CRITICAL",categories: ["scan-failure"],hasError: true. - If
fail_closedisfalse, does nothing (no cache entry).
Configuration¶
plugins:
entries:
prisma-airs:
config:
audit_mode: "deterministic" # "deterministic" | "probabilistic" | "off"
profile_name: "default"
app_name: "openclaw"
fail_closed: true
Behavior¶
| Condition | Result |
|---|---|
audit_mode = off |
No-op |
| Empty or non-string content | No-op |
| AIRS returns result | Cache result, log audit entry |
AIRS scan fails + fail_closed=true |
Cache synthetic block result |
AIRS scan fails + fail_closed=false |
Log error only |
Related Hooks¶
- prisma-airs-context -- Reads cached scan result; falls back to fresh scan on cache miss.
- prisma-airs-tools -- Reads cached scan result for tool gating decisions.
- prisma-airs-tool-redact -- Reads cached scan result for DLP signal detection.