# infrastructure/artifacts-cas/ ## Purpose Content-addressable artifact store backed by append-only segment files on disk and a SQLite index. Implements `core:artifacts-store` (`ArtifactStore`). Handles content hashing, segment layout, compaction, eviction, and crash-recovery tail scanning. ## Ownership Adapter for local filesystem artifact storage. No dependency on other `infrastructure:*` modules at runtime; `infrastructure:persistence` is a test dependency only. ## Local Contracts - Implements `ArtifactStore` from `core:artifacts-store`. - Segment files are append-only; `SegmentWriter`/`SegmentReader` own the on-disk format (`SegmentLayout`). - `SqliteArtifactIndex` maintains the content-hash → segment offset index; the SQLite file lives alongside the segments in the configured root dir. - `TailScanner` recovers the index after a crash by scanning the tail of the most recent segment. - `LivenessScanner` and `Evictor` handle compaction and space reclamation. - `CasConfig` is the only configuration surface; pass via `InfrastructureModule.createArtifactStore()`. - Environment observations (file existence, segment bytes) happen at call time and must not be re-read during replay — callers must record artifact content as events if replay correctness requires it (invariant #9). ## Work Guidance Standard adapter rules apply (see parent `AGENTS.md`). No domain logic beyond storage mechanics belongs here. ## Verification ``` ./gradlew :infrastructure:artifacts-cas:test --rerun-tasks ``` ## Child DOX Index No child AGENTS.md (leaf module).