Nous.Memory (nous v0.15.8)
View SourceTop-level module for the Nous Memory System.
Provides persistent memory for agents with hybrid text + vector search, temporal decay, importance weighting, and flexible scoping.
Quick Start
# Minimal setup (ETS store, keyword-only search)
agent = Agent.new("openai:gpt-4",
plugins: [Nous.Plugins.Memory],
deps: %{memory_config: %{store: Nous.Memory.Store.ETS}}
)Architecture
Three layers, all plain modules and structs (no GenServer):
- Data Layer —
Entry(struct),Store(behaviour + backends) - Search Layer —
Search(orchestrator),Scoring(RRF, decay) - Integration —
Plugins.Memory(plugin),Memory.Tools(agent tools)
Store Backends
| Backend | FTS | Vector | Deps |
|---|---|---|---|
Store.ETS | Jaro distance | No | None |
Store.DuckDB | FTS extension | VSS | duckdbex |
Store.SQLite | FTS5 (BM25) | sqlite-vec | exqlite |
Store.Muninn | Tantivy BM25 | No | muninn |
Store.Zvec | No | HNSW/IVF | zvec |
Store.Hybrid | Tantivy BM25 | HNSW/IVF | muninn + zvec |
Embedding Providers
| Provider | Description | Deps |
|---|---|---|
Embedding.Bumblebee | Local on-device (Qwen 0.6B) | bumblebee, exla |
Embedding.OpenAI | OpenAI text-embedding-3-small | None (uses Req) |
Embedding.Local | Ollama / vLLM / LMStudio | None (uses Req) |
No embedding configured = keyword-only search. The system never fails if no embedding provider is set.
Summary
Functions
Search memories directly (bypassing agent tools).
Store a memory entry directly (bypassing agent tools).
Validate a memory configuration map.
Functions
@spec search(module(), term(), String.t(), module() | nil, keyword()) :: {:ok, [{Nous.Memory.Entry.t(), float()}]}
Search memories directly (bypassing agent tools).
Examples
{:ok, results} = Nous.Memory.search(Nous.Memory.Store.ETS, store_state, "dark mode")
@spec store(module(), term(), Nous.Memory.Entry.t()) :: {:ok, term()} | {:error, term()}
Store a memory entry directly (bypassing agent tools).
Examples
{:ok, store_state} = Nous.Memory.Store.ETS.init([])
entry = Nous.Memory.Entry.new(%{content: "User likes dark mode"})
{:ok, store_state} = Nous.Memory.store(Nous.Memory.Store.ETS, store_state, entry)
Validate a memory configuration map.
Returns {:ok, config} with defaults applied, or {:error, reason}.