# `ADK.Memory.Store`
[🔗](https://github.com/zeroasterisk/adk-elixir/blob/main/lib/adk/memory/store.ex#L1)

Behaviour for memory services.

Provides long-term memory across sessions — agents can store and search
memories scoped by app + user. Mirrors Python ADK's `BaseMemoryService`.

## Implementing a backend

    defmodule MyVectorStore do
      @behaviour ADK.Memory.Store

      @impl true
      def search(app_name, user_id, query, opts) do
        # your vector search here
        {:ok, []}
      end

      # ... other callbacks
    end

# `scope`

```elixir
@type scope() :: {app_name :: String.t(), user_id :: String.t()}
```

# `add`

```elixir
@callback add(
  app_name :: String.t(),
  user_id :: String.t(),
  entries :: [ADK.Memory.Entry.t()]
) :: :ok | {:error, term()}
```

Add memory entries.

# `add_session`
*optional* 

```elixir
@callback add_session(
  app_name :: String.t(),
  user_id :: String.t(),
  session_id :: String.t(),
  events :: [ADK.Event.t()]
) :: :ok | {:error, term()}
```

Add all events from a session to memory.

# `clear`
*optional* 

```elixir
@callback clear(
  app_name :: String.t(),
  user_id :: String.t()
) :: :ok | {:error, term()}
```

Delete all memories for a user scope.

# `delete`

```elixir
@callback delete(
  app_name :: String.t(),
  user_id :: String.t(),
  entry_id :: String.t()
) :: :ok | {:error, term()}
```

Delete a specific memory entry by ID.

# `search`

```elixir
@callback search(
  app_name :: String.t(),
  user_id :: String.t(),
  query :: String.t(),
  opts :: keyword()
) :: {:ok, [ADK.Memory.Entry.t()]} | {:error, term()}
```

Search memories matching the query. Returns entries ranked by relevance.

---

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