Define a local-only, read-only projection model that turns validated Agent Ledger events into inspectable product-style views without any backend service.
This projection:
- reads local metadata-only event sources
- applies deterministic filtering, sorting, and deduplication
- outputs sanitized read models for local inspection and testing
- no persistence writes
- no Supabase connection
- no Cloudflare Worker dependency
- no deployment behavior
- no network calls
- no ingestion scheduling or cron
- no raw prompt/customer-data/secret capture
- T015 (event model): Projection accepts only events that validate against
schemas/agent-ledger-event.schema.jsonand preserves metadata-first boundaries. - T016 (local buffer): Projection can read events from local JSONL buffer files produced by the local buffer module.
- T017 (export/import contract): Projection can read events from local export bundles (
events.jsonl) and remains dry-run/local-only.
Exactly one source is used per projection call:
eventsarray (in-memory)bufferFilepath to local JSONL bufferbundleDirpath to local export bundle directory
buildReadOnlyEventProjection(options) returns:
generated_atsource_typesource_refsummaryrunseventsapprovalstool_callsriskserrors
summary: totals, counts, and temporal rangeruns: one row perrun_idevents: sorted metadata-only event listapprovals:approval_requested,approval_granted,approval_deniedtool_calls:tool_call_requested,tool_call_completedrisks: high/critical eventserrors:event_type = error
events: byoccurred_atascending, thenevent_idascendingruns: byrun_idascendingapprovals,tool_calls,risks,errors: follow sorted event order
Optional exact-match filters:
run_idevent_typerisk_level
Filters are applied after validation and deduplication.
Projection output is metadata-only and excludes raw payload fields by construction.
Allowed event-level output fields are limited to:
- identifiers (
task_id,run_id,event_id,parent_event_id,idempotency_key,correlation_id) - classification (
event_type,risk_level) - timing (
occurred_at) - source metadata (
source_kind,source_name,source_version,source_environment) - redaction metadata (
redaction_policy,redaction_applied, capture flags,fields_redacted_count) - payload metadata summary (
metadata_kind,metadata_summary, label/reference counts,contains_sensitive_data)
Any event containing forbidden secret-like raw content is rejected.
- Deduplication key:
idempotency_key - If duplicates exist, the first event in sorted order is kept and later duplicates are skipped.
- Projection remains deterministic for identical input.
- read-only local processing only
- no DB writes/connections
- no Worker deploy/use requirement
- no deployment behavior
- no network execution
- no secrets/customer data/raw prompts in output