Event-Sourced Governance — Data Flow

Audit trail is the single source of truth. Analytics and Compliance derive all metrics by replaying events.

EVENT PRODUCERS
EVENT CONSUMERS (replay from audit)
TaskService
Emits task.transition
on every state change
ContainerService
Emits container.assignment
with integrityMaintained flag
WorkDistribution
Emits work.recommendation
and work.handoff
Validator
Emits validation events
with step results
EventBus
on('*')
AuditService
Subscribes to ALL events
Ring buffer (500, in-memory)
JSONL store (persistent, append-only)
Fire-and-forget persistence
AnalyticsService
Queries AuditService on demand
Builds per-task timelines
Computes cycle/lead/blocking time
Cache: 30s TTL, invalidated on events
ComplianceService
Queries AuditService on demand
5 categories, weighted 0-100 score
Uses AnalyticsService for flow efficiency
Cache: 30s TTL, invalidated on events
.jsonl
Append-only
Zero separate storage: AnalyticsService and ComplianceService have NO database. They replay the audit trail on every query (cached 30s). Correctness is guaranteed by construction — if events are emitted correctly, all derived data is correct. New governance intelligence = new replay query, not new storage.
queries queries uses
Event Producers (domain services)
EventBus + AuditService
Derived Services (replay audit)
Key Insight