Skip to content

Audit Schema Reference ​

Structure of audit log records.

Record fields ​

Every audit record contains these base fields:

FieldTypeDescription
idstringUUID v4 unique identifier
timestampstringISO 8601 timestamp
sessionIdstringPi session identifier
eventstringEvent type (see below)
userIdstringResolved user identity
rolestringUser's active role
orgUnitstringUser's org unit

Optional fields ​

These fields are present on tool-related events:

FieldTypeDescription
toolstringTool name (bash, read, write, edit, etc.)
inputobjectSummarized parameters (commands truncated to 100 chars)
decisionstringallowed or denied
reasonstringWhy the decision was made (denial events)
durationnumberApproval duration in milliseconds (HITL events)
metadataobjectExtra data (varies by event type)

Event types ​

session_start ​

Logged when a governed session begins.

Metadata fieldTypeDescription
sourcestringConfig file path or built-in
executionModestringRole's execution mode

session_end ​

Logged when a session ends. Contains aggregated session statistics.

Metadata fieldTypeDescription
stats.allowednumberTotal allowed tool calls
stats.deniednumberTotal denied tool calls
stats.approvalsnumberTotal HITL approval prompts
stats.dryRunnumberTotal dry-run blocks
stats.budgetExceedednumberTotal budget exceeded blocks
budget.usednumberTool invocations consumed
budget.remainingnumberRemaining invocations (or Infinity)
summaryobjectEvent type counts for the session

tool_allowed ​

Logged when a tool call passes all governance checks.

tool_denied ​

Logged when a tool call is blocked by policy (not in allowed_tools or in blocked_tools).

tool_dry_run ​

Logged when a tool call is blocked by dry-run mode.

bash_denied ​

Logged when a bash command is classified as dangerous and blocked.

path_denied ​

Logged when a file tool targets a path outside allowed boundaries or inside blocked paths.

approval_requested ​

Logged when an HITL approval prompt is shown to the user or sent to a webhook.

approval_granted ​

Logged when a human approves a tool call. Includes duration (time to approve in ms).

approval_denied ​

Logged when a human denies a tool call or the approval times out. Includes reason and duration.

budget_exceeded ​

Logged when a tool call is blocked because the session's tool invocation budget is exhausted.

config_reloaded ​

Logged when the governance config file is successfully hot-reloaded during a session.

Metadata fieldTypeDescription
sourcestringConfig file path

dlp_blocked ​

Logged when a tool call is blocked because sensitive data was detected in the input.

Metadata fieldTypeDescription
patternsstring[]Names of matched DLP patterns
severitiesstring[]Severity levels of matches
directionstringinput
countnumberTotal number of matches

dlp_detected ​

Logged when sensitive data is found but allowed through (audit-only mode).

Metadata fieldTypeDescription
patternsstring[]Names of matched DLP patterns
severitiesstring[]Severity levels of matches
directionstringinput or output
countnumberTotal number of matches

dlp_masked ​

Logged when sensitive data is redacted in tool input or output.

Metadata fieldTypeDescription
patternsstring[]Names of matched DLP patterns
severitiesstring[]Severity levels of matches
directionstringinput or output
countnumberTotal number of matches
strategystringMasking strategy used (partial/full/hash)

Example records ​

tool_allowed ​

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "timestamp": "2026-03-01T14:30:00.000Z",
  "event": "tool_allowed",
  "sessionId": "sess_abc123",
  "userId": "alice",
  "role": "project_lead",
  "orgUnit": "backend",
  "tool": "bash",
  "input": { "command": "git status" },
  "decision": "allowed"
}

budget_exceeded ​

json
{
  "id": "550e8400-e29b-41d4-a716-446655440001",
  "timestamp": "2026-03-01T15:45:00.000Z",
  "event": "budget_exceeded",
  "sessionId": "sess_abc123",
  "userId": "carol",
  "role": "analyst",
  "orgUnit": "data-science",
  "tool": "read",
  "input": { "path": "/project/src/index.ts" },
  "decision": "denied",
  "reason": "Budget exhausted (100000 invocations used)"
}

session_end ​

json
{
  "id": "550e8400-e29b-41d4-a716-446655440002",
  "timestamp": "2026-03-01T16:00:00.000Z",
  "event": "session_end",
  "sessionId": "sess_abc123",
  "userId": "alice",
  "role": "project_lead",
  "orgUnit": "backend",
  "metadata": {
    "stats": { "allowed": 42, "denied": 3, "approvals": 5, "dryRun": 0, "budgetExceeded": 0 },
    "budget": { "used": 50, "remaining": 499950 },
    "summary": {
      "tool_allowed": 42,
      "tool_denied": 2,
      "bash_denied": 1,
      "approval_requested": 5,
      "approval_granted": 5
    }
  }
}

Released under the Apache-2.0 License.