InitRunner

Audit & Observability

InitRunner automatically logs every agent run to a local SQLite database. Audit records capture what happened, how much it cost, and whether it succeeded — giving you full observability into agent behavior.

What Gets Logged

Every agent run produces an audit record with these fields:

FieldTypeDescription
run_idstrUnique run identifier (12-character hex)
agent_namestrName from metadata.name
timestampdatetimeUTC timestamp of run start
promptstrInput prompt (subject to redaction)
outputstrAgent output (subject to redaction)
tokens_inintInput tokens consumed
tokens_outintOutput tokens consumed
tool_callslistTool invocations with name, args, and result
duration_msintWall-clock duration in milliseconds
successboolWhether the run completed without error
errorstr | nullError message if the run failed
trigger_typestrHow the run was initiated: prompt, cron, file_watch, webhook, autonomous

Storage

Audit records are stored in a SQLite database:

  • Default path: ~/.initrunner/audit.db
  • Custom path: --audit-db ./custom-audit.db
  • Disable entirely: --no-audit
# Default audit database
initrunner run role.yaml -p "Hello"

# Custom audit database path
initrunner run role.yaml -p "Hello" --audit-db ./my-audit.db

# Disable audit logging
initrunner run role.yaml -p "Hello" --no-audit

The same flags work with initrunner daemon and initrunner serve.

Export

Export audit records as JSON or CSV for analysis, reporting, or ingestion into external systems.

initrunner audit export
FlagTypeDefaultDescription
--agentstr(all)Filter by agent name
--trigger-typestr(all)Filter by trigger type (prompt, cron, file_watch, webhook, autonomous)
--sincestr(none)Start date (ISO 8601, e.g. 2025-01-01)
--untilstr(none)End date (ISO 8601)
--limitint1000Maximum records to export
-f, --formatstr"json"Output format: json or csv
-o, --outputstrstdoutOutput file path

Examples

# Export all records as JSON
initrunner audit export

# Export last 7 days for a specific agent as CSV
initrunner audit export --agent monitor-agent --since 2025-01-08 -f csv -o report.csv

# Export only cron-triggered runs
initrunner audit export --trigger-type cron --limit 500

# Export to a file
initrunner audit export -o audit-export.json

Pruning

Remove old audit records to manage database size.

Manual Pruning

initrunner audit prune
initrunner audit prune --retention-days 30 --max-records 50000
FlagTypeDefaultDescription
--retention-daysint90Delete records older than this
--max-recordsint100000Keep at most this many records (oldest removed first)

Automatic Pruning

Configure auto-pruning via the security policy in your role YAML:

security:
  audit:
    retention_days: 30
    max_records: 50000
FieldTypeDefaultDescription
retention_daysint90Delete records older than this many days
max_recordsint100000Maximum audit records to retain

Auto-pruning runs at daemon startup and periodically during long-running daemons.

Redaction

Audit logs can contain sensitive information. InitRunner supports two redaction mechanisms to sanitize records before they are written.

PII Redaction

Enable built-in PII pattern detection:

security:
  content:
    pii_redaction: true

This redacts common PII patterns in both prompts and outputs before writing to the audit database:

PatternExampleRedacted As
Email addressesuser@example.com[EMAIL]
Social Security Numbers123-45-6789[SSN]
Phone numbers+1-555-123-4567[PHONE]
API keyssk-abc123...[API_KEY]

Custom Redaction Patterns

Add regex patterns to redact domain-specific sensitive data:

security:
  content:
    redact_patterns:
      - "\\b[A-Z]{2}\\d{6}\\b"        # internal account IDs
      - "\\btoken_[a-zA-Z0-9]+\\b"     # internal tokens

Custom patterns are applied in addition to PII redaction (if enabled). Matches are replaced with [REDACTED].

Viewing Audit Logs

Beyond the CLI export command, audit logs are accessible through:

  • TUI — the Audit panel provides a scrollable, filterable log viewer
  • Web Dashboard — the Audit Viewer offers search, pagination, and CSV/JSON export
  • Direct SQLite access — query ~/.initrunner/audit.db with any SQLite client
# Quick peek at recent records
sqlite3 ~/.initrunner/audit.db "SELECT agent_name, trigger_type, success, duration_ms FROM audit ORDER BY timestamp DESC LIMIT 10"

On this page