# infrastructure/persistence/

## Purpose

Event store adapters for the correx event log. Provides `SqliteEventStore` (durable, production) and `InMemoryEventStore` (tests/dev). Also contains `LiveArtifactRepository`, which projects artifact state from the event log via `core:artifacts`.

## Ownership

Sole persistence adapter for `core:events` (`EventStore`). No other infrastructure module may write to the event log.

## Local Contracts

- `SqliteEventStore` implements `EventStore` from `core:events`; the SQLite file is the authoritative event log.
- `InMemoryEventStore` is for tests only — not suitable for production use.
- `LiveArtifactRepository` implements `ArtifactRepository` from `core:artifacts` by replaying events; it never persists state independently (invariant #1).
- Schema migrations are the responsibility of this module; `JDBCHelper` owns connection utilities.
- The event log is append-only: no updates or deletes to existing rows.

## Work Guidance

Standard adapter rules apply (see parent `AGENTS.md`). All JDBC calls go in `withContext(Dispatchers.IO)`.

## Verification

```
./gradlew :infrastructure:persistence:test --rerun-tasks
```

## Child DOX Index

No child AGENTS.md (leaf module).
