# `PhoenixAI.Store.Adapter.FactStore`
[🔗](https://github.com/franciscpd/phoenix-ai-store/blob/v0.1.0/lib/phoenix_ai/store/adapter.ex#L38)

Sub-behaviour for adapters that support long-term memory fact storage.

Adapters implementing this behaviour can store, retrieve, and delete
per-user key-value facts. `save_fact/2` uses upsert semantics —
writing to the same `{user_id, key}` overwrites the previous value.

# `count_facts`

```elixir
@callback count_facts(
  user_id :: String.t(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, term()}
```

# `delete_fact`

```elixir
@callback delete_fact(user_id :: String.t(), key :: String.t(), keyword()) ::
  :ok | {:error, term()}
```

# `get_facts`

```elixir
@callback get_facts(
  user_id :: String.t(),
  keyword()
) :: {:ok, [PhoenixAI.Store.LongTermMemory.Fact.t()]} | {:error, term()}
```

# `save_fact`

```elixir
@callback save_fact(
  PhoenixAI.Store.LongTermMemory.Fact.t(),
  keyword()
) :: {:ok, PhoenixAI.Store.LongTermMemory.Fact.t()} | {:error, term()}
```

---

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