Files
AirCoding/AirPlan/docs/architecture/adr/ADR-0004-use-eventstore-domain-tables-and-projectionstore.md
AirCoding 33a76a1ebc Move project from external drive to local NVMe
迁移路径: /run/media/airlongdian/EasyU/AirCoding -> /home/airlongdian/DataDevices/AirWorkSpace/AirCoding

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 09:51:49 +08:00

1.1 KiB
Executable File

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.