Files
AirCoding/AirPlan/docs/architecture/adr/ADR-0004-use-eventstore-domain-tables-and-projectionstore.md
AirCoding 82f3140847 Initial commit: AirCoding V1.0.0 Alpha architecture baseline
Complete architecture document set with multi-model review remediation:
- Frozen interface contracts, runtime semantics, DB schemas
- Event/tool/error/provider registries
- Scheduler and main agent state machines
- C4 module/code views, solution architecture, baseline V1
- Multi-model review reports and joint assessment
- Phase-gate remediation complete (P0/P1/P2/UX resolved)
- Implementation plan with T-000A through T-045
- Reference folders kept as placeholders only
2026-05-28 18:45:01 +08:00

1.1 KiB

ADR-0004: Use EventStore, Domain Tables, And ProjectionStore

  • Status: Accepted
  • Date: 2026-05-27

Context

AirCoding needs live TUI/HUD updates, crash recovery, scheduling queries, tool/run evidence, and resumable session state. Raw message storage alone is insufficient for scheduling and recovery.

Decision

Use an event-driven runtime with:

EventBus        # live ephemeral/durable event publication
EventStore      # durable event validation and transactional persistence
Domain tables   # scheduling/recovery/query source of truth
ProjectionStore # derived TUI/HUD view model

Canonical messages are stored as Anthropic content JSON. Domain tables store tasks, agents, tool runs, command runs, artifacts, diagnostics, evidence, workspaces, summaries, and UI state.

Consequences

  • Scheduler and recovery query domain tables instead of parsing message history.
  • TUI/HUD consumes ProjectionStore, not DB/EventBus directly.
  • Durable event insert and corresponding domain table update happen in one SQLite transaction.
  • Event payloads and persistence policy are governed by event-registry-v1.md.