# core/artifacts — AGENTS.md

## Purpose

Structured output model for workflow artifacts: defines artifact kinds, tracks lineage and relationships between artifacts, and provides the projector/reducer/repository stack for artifact state.

## Ownership

CORREX kernel team.

## Local Contracts

- `Artifact` — core domain type, carries `ArtifactKind`, payload, and metadata.
- `ArtifactKind` / `ArtifactKindRegistry` — extensible registry; built-in kinds: `ConfigArtifactKind`, `FileWrittenKind`, `ProcessResultKind`.
- `ArtifactLineage` / `ArtifactRelationship` / `ArtifactRelationshipType` — DAG of artifact provenance.
- `ArtifactState` rebuilt from events via `DefaultArtifactReducer` (in `core:events` `ArtifactEvents.kt`) + `ArtifactProjector`.
- `TypedArtifactSlot<T>` — typed accessor for well-known artifact slots.
- `ArtifactSerializationModule` — registers artifact polymorphic types; must be included in serialization setup.
- Hard Invariant #1: artifact state is always rebuilt from events. `ArtifactRepository` wraps `EventReplayer<ArtifactState>`.

## Work Guidance

- Follow the standard Events→State→Reducer→Projector→Repository pattern (see `core/AGENTS.md`).
- New artifact kinds must be registered in `ArtifactKindRegistry` and their payloads in `ArtifactSerializationModule`.
- `JsonSchema` is a local utility for schema representation; do not reach into external schema libraries.

## Verification

```bash
./gradlew :core:artifacts:test --rerun-tasks
```

Reducer tests in `testing/projections/ArtifactReducerTest.kt`.

## Child DOX Index

No child AGENTS.md (leaf module).
