# `Spectre.Experience.Store`
[🔗](https://github.com/elchemista/spectre/blob/0.4.0/lib/spectre/experience/store.ex#L1)

Opt-in persistence boundary for redacted Experience evidence.

Unlike the Definition Store, this Store is not canonical Agent state and is
never consulted for authorization or continuation ownership. Core verifies
every content-addressed entry before exposing it to Reflection.

# `config`

```elixir
@type config() :: module() | {module(), keyword()}
```

# `durability`

```elixir
@type durability() :: :volatile | :durable
```

# `snapshot`

```elixir
@type snapshot() :: %{
  definition_ref: Spectre.Definition.Ref.t(),
  as_of: non_neg_integer(),
  evidence: [Spectre.Experience.Evidence.t()],
  evidence_refs: [String.t()],
  digest: String.t()
}
```

# `delete`

```elixir
@callback delete(
  String.t(),
  keyword()
) :: :ok | :not_found | {:error, term()}
```

# `durability`

```elixir
@callback durability(keyword()) :: durability()
```

# `get`

```elixir
@callback get(
  String.t(),
  keyword()
) :: :not_found | {:ok, binary()} | {:error, term()}
```

# `identity`

```elixir
@callback identity(keyword()) :: term()
```

# `list`

```elixir
@callback list(keyword()) :: {:ok, [{String.t(), binary()}]} | {:error, term()}
```

# `put`

```elixir
@callback put(String.t(), binary(), keyword()) ::
  :ok | {:ok, :created | :existing} | {:error, term()}
```

# `artifact_schema_version`

```elixir
@spec artifact_schema_version() :: pos_integer()
```

Returns the Experience Store artifact schema version.

# `decode_snapshot`

```elixir
@spec decode_snapshot(binary()) :: {:ok, snapshot()} | {:error, term()}
```

Decodes and verifies canonical snapshot bytes.

# `durability`

```elixir
@spec durability(config()) :: {:ok, durability()} | {:error, term()}
```

Returns the Store's declared durability.

# `empty_snapshot`

```elixir
@spec empty_snapshot(Spectre.Definition.Ref.t() | String.t(), non_neg_integer()) ::
  {:ok, snapshot()} | {:error, term()}
```

Builds an explicitly empty snapshot when Experience is not configured.

# `encode_snapshot`

```elixir
@spec encode_snapshot(snapshot()) :: {:ok, binary()} | {:error, term()}
```

Encodes a snapshot with the production canonical codec.

# `fetch`

```elixir
@spec fetch(config(), Spectre.Experience.Evidence.Ref.t() | String.t()) ::
  :not_found | {:ok, Spectre.Experience.Evidence.t()} | {:error, term()}
```

Fetches and revalidates evidence by content Ref.

# `identity`

```elixir
@spec identity(config()) :: {:ok, term()} | {:error, term()}
```

Returns the Store identity after validating its adapter callbacks.

# `list_evidence`

```elixir
@spec list_evidence(config(), Spectre.Definition.Ref.t() | String.t(), keyword()) ::
  {:ok, [Spectre.Experience.Evidence.t()]} | {:error, term()}
```

Lists verified evidence for one Definition under an explicit time snapshot.

# `normalize`

```elixir
@spec normalize(config()) :: {:ok, {module(), keyword()}} | {:error, term()}
```

Normalizes an Experience Store configuration.

# `publish`

```elixir
@spec publish(config(), Spectre.Experience.Evidence.t()) ::
  {:ok, Spectre.Experience.Evidence.Ref.t()} | {:error, term()}
```

Publishes immutable, content-addressed evidence and reads it back.

# `purge_expired`

```elixir
@spec purge_expired(config(), non_neg_integer(), keyword()) ::
  {:ok, [String.t()]} | {:error, term()}
```

Deletes only expired, non-retained Experience evidence after explicit confirmation.

# `snapshot`

```elixir
@spec snapshot(config(), Spectre.Definition.Ref.t() | String.t(), keyword()) ::
  {:ok, snapshot()} | {:error, term()}
```

Builds the exact redacted evidence snapshot bound by Reflection and Forge.

# `snapshot_from_data`

```elixir
@spec snapshot_from_data(map()) :: {:ok, snapshot()} | {:error, term()}
```

Restores and fully verifies a snapshot from portable data.

# `snapshot_to_data`

```elixir
@spec snapshot_to_data(snapshot()) :: {:ok, map()} | {:error, term()}
```

Returns portable JSON-shaped snapshot data.

# `verify_snapshot`

```elixir
@spec verify_snapshot(snapshot()) :: :ok | {:error, term()}
```

Revalidates a snapshot and every embedded evidence item.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
