Events and Audit Trail

Events and Audit Trail

Events and Audit Trail

Reeboot maintains a structured audit trail in SQLite. Every significant operational event — channel connections, agent turns, rate limits, permission violations — is recorded in the events table.


Events Table

The events table uses an OTEL-ready schema:

ColumnTypeDescription
idintegerAuto-increment primary key
typetextEvent type (e.g. channel_connected, turn_started, rate_limit_warning)
payloadtextJSON payload with event-specific data
severityintegerOTEL severity number: 9=INFO, 13=WARN, 17=ERROR, 21=FATAL
trace_idtext32-char hex (16 bytes) — maps to OTEL LogRecord.traceId
span_idtext16-char hex (8 bytes) — maps to OTEL LogRecord.spanId
created_nsintegerUnix epoch in nanoseconds — maps to OTEL LogRecord.timeUnixNano
created_attextUTC datetime string (human-readable)

These fields map directly to OTEL LogRecord fields. When an OTEL exporter is added in a future release, no schema migration will be required.


Event Types

EventWhen it fires
channel_connectedA channel adapter successfully connects
channel_disconnectedA channel adapter disconnects or errors
turn_startedAn agent turn begins
turn_closedAn agent turn completes successfully
turn_crashedAn agent turn crashes or times out
rate_limit_warningToken budget warning threshold reached
rate_limit_hitToken budget limit reached
permission_violationA tool call was denied or injection detected
memory_consolidatedBackground memory consolidation completed

Turn Journal

The turn_journal table records every agent turn as a persistent audit record:

ColumnDescription
idTurn ID
context_idWhich context this turn ran in
status"open" (in progress) or "closed" (completed)
opened_atWhen the turn started
closed_atWhen the turn completed (null if still open)

Turns are never deletedcloseTurn() sets status = 'closed' and closed_at. Open rows after a restart indicate crashed turns and trigger crash recovery.

Records are pruned after logging.retention_days days (default: 30).


Operational Logs Table

The operational_logs table stores warn-level and above log records from pino, providing a queryable complement to the log files:

ColumnDescription
idAuto-increment
levelPino level number (40=warn, 50=error, 60=fatal)
msgLog message
componentSource component (e.g. "whatsapp", "orchestrator")
payloadFull JSON log record
created_atUTC datetime

Retention and Pruning

All three tables (events, turn_journal, operational_logs) are pruned on startup based on logging.retention_days:

{
  "logging": { "retention_days": 30 }
}

→ See Logging for log level configuration and the CLI log commands.