Skip to content

Audit Records

Lexicon maintains an immutable audit trail of significant actions. Every verification run, contract change, AI modification, and policy event is recorded.

Audit records are stored as JSON files in .lexicon/audit/. Each file is named <timestamp>-<uuid>.json, where the timestamp format is YYYYMMDDTHHMMSS.

{
"schema_version": "1.0",
"id": "550e8400-e29b-41d4-a716-446655440000",
"action": "verify_run",
"actor": "system",
"before_hash": null,
"after_hash": "abc123...",
"delta_summary": "Verify: 4 gates, 4 passed",
"score_before": null,
"score_after": 0.925,
"gates_passed": true,
"timestamp": "2025-01-15T12:00:00Z"
}
FieldTypeDescription
schema_versionstringSchema version for forward compatibility
idUUIDUnique identifier for this record
actionenumType of action (see below)
actorenumWho performed the action
before_hashstring?Content hash before the change
after_hashstring?Content hash after the change
delta_summarystringHuman-readable summary of what changed
score_beforef64?Score before the change
score_afterf64?Score after the change
gates_passedboolWhether all gates passed after the change
timestampdatetimeWhen the action occurred
ActionDescription
repo_initRepository initialized with lexicon
contract_createNew contract created
contract_updateExisting contract modified
contract_status_changeContract status changed (e.g., draft to active)
conformance_createNew conformance suite created
conformance_updateConformance suite updated
behavior_createNew behavior scenario created
behavior_updateBehavior scenario updated
score_model_changeScoring model modified
gate_model_changeGates configuration modified
gate_weakening_attemptAttempt to weaken a gate definition
ai_improveAI-guided improvement applied
ai_improve_rejectedAI-guided improvement rejected
verify_runVerification pipeline executed
claude_sync_runCLAUDE.md synced with repo state
test_deletionTest file or test function deleted
threshold_changeScoring threshold changed
ActorDescription
userHuman user initiated the action
aiAI assistant initiated the action
systemAutomated system action (e.g., verification)

Records that involve changes (contract updates, AI improvements) capture score_before and score_after to track the impact. This enables detection of score regressions.

Audit records are plain JSON files. You can query them with standard tools:

Terminal window
# Find all failed verification runs
grep -l '"gates_passed": false' .lexicon/audit/*.json
# Find all AI actions
grep -l '"actor": "ai"' .lexicon/audit/*.json