How to use agentic memory in XERJ
How do I use agentic memory in XERJ? The agent calls xerj_memory_store when a fact is worth keeping, and xerj_memory_recall when it needs it back. Nothing is saved unless the agent asks. The same local node can also search logs, docs and code. The concept is on the science page.
TL;DR Agentic memory is memory an AI agent manages for itself. The agent decides what to keep, saves it with a tool call, and searches it again in a later task. Recall is a search problem, so XERJ serves agent memory as two endpoints on one local search engine.
Act as a coding agent. Read https://xerj.org/llms.txt, install XERJ, start one local node, store one durable fact with POST /_memory/agentmem, recall it with POST /_memory/agentmem/_recall, and report the exact hit you got back.
curl -fsSL https://xerj.org/get | sh
Install the single XERJ binary.
curl -s -XPOST 'http://127.0.0.1:9200/_memory/agentmem' -H 'content-type: application/json' -d '{"text":"The user wants answers in metric units."}'
The agent saves one fact. Port 9200 is the default Elasticsearch-compatible listener.
curl -s -XPOST 'http://127.0.0.1:9200/_memory/agentmem/_recall' -H 'content-type: application/json' -d '{"query":"which units does the user want","k":3}'
A later task reads it back. Plain query recall is BM25 over the stored text.
This page is the how-to. The concept is What is agentic memory?.
How agentic memory is written and read
1. The agent decides
In the hot path, the agent itself chooses to keep a fact before it answers. Example (illustrative): "The user wants answers in metric units." A background job can also write memory, but that is not the agent deciding in the moment.
2. A tool writes it out of the chat
The fact is stored outside the model. In XERJ that call is POST /_memory/{namespace}, or xerj_memory_store over MCP. The context window can later forget the chat; the store still has the document.
3. A later task needs it
A new session does not load every saved fact up front. The agent asks a question, for example "which units does the user want", and only then searches.
4. Recall is a search
POST /_memory/{namespace}/_recall, or xerj_memory_recall, returns the best matches. On XERJ, a plain query is BM25 over the stored text. Nothing is forgotten unless you DELETE that id. There is no decay and no TTL.
Facts
Example: the user wants metric units.
Past events
Example: the deploy failed last Tuesday on step 3.
How to do a task
Example: run the linter before every commit.
The short definition
An agent with memory can say "remember this" and find it again next week. The memory lives outside the model, in a store the agent reads and writes through tools. That is the difference from a chat history or a context window: those hold what the model sees right now, and they are gone when the session ends.
LangChain calls the agent-driven version updating memory "in the hot path": the agent itself decides to remember a fact, usually via a tool call, before it answers. The other route is a background process that writes memory for the agent. Both end up in a store. Only the hot path makes the agent the one choosing what is worth keeping.
If you want the same idea exposed as MCP tools, see what an MCP memory server is. For how this differs from retrieving a folder of documents, see agentic memory vs RAG.
A common split of types
LangChain, after the CoALA paper, splits long-term agent memory into semantic memory (facts), episodic memory (past events) and procedural memory (how to do a task). A memory application can represent these as text, structured documents or links, depending on how it will retrieve them later.
The cards in the figure use short illustrative examples, not recorded runs. In practice one store can hold all three kinds, as long as the agent can ask a later question and get the right note back. The hard part is that later question, which may use different words from the note you saved.
Memory is search
Saving a note is simple. Getting the right note back when the agent asks a vague question months later is a retrieval job. That is why XERJ treats memory as a search feature and not as a separate database, and why it does not require a vector database to start.
The AI agent memory benchmark tests how often open-source tools find the right memory. For individual designs, see the comparisons with agentmemory, memvid and ReMe.
How XERJ does it
XERJ is the search engine for AI agents: a new way for AI to search for data, in one local binary. Memory is part of the same API.
POST /_memory/{namespace} saves a fact. The configured embedder runs at write time; the default is lexical feature hashing. POST /_memory/{namespace}/_recall finds it again. A plain query is BM25. DELETE /_memory/{namespace}/{id} forgets one entry. Each namespace is its own index. Use separately scoped API keys to restrict agents to their own namespaces; names alone are not an access boundary. Over MCP, xerj mcp exposes the same calls as xerj_memory_store and xerj_memory_recall.
The default embedder is lexical feature hashing, so semantic: true recall matches shared words, not meaning. Start the node with --embed-mode neural for a real neural embedder. The commands at the top of this page show a store and a recall against the default listener on port 9200.
Limits to know
XERJ is single-node: no replication and no failover. There is no decay and no TTL. A memory is permanent until explicitly forgotten. The only time signal is stored_at, which the optional recency_weight re-rank uses.
Try it
Copy the prompt on this page into your coding agent, or follow the agent memory recipe. For Claude Code's own files and when to add a server, see Claude Code memory.
Read next
Agentic memory, the science, the AI agent memory benchmark and XERJ vs Memvid.
More comparisons: OpenViking alternatives 2026.
FAQ
How do I use agentic memory in XERJ?
Call xerj_memory_store when a fact is worth keeping, and xerj_memory_recall when you need it back. The concept is on the science page.
How is agentic memory different from a context window?
The context window is what the model sees right now and it is lost when the session ends. Agentic memory lives in a store outside the model and is searched back in when needed.
What types of agentic memory are there?
A common split, from the CoALA paper as summarized by LangChain, is semantic memory for facts, episodic memory for past events and procedural memory for how to do a task.
Does agentic memory need a vector database?
No. Recall is a search problem. XERJ stores memories as documents in one local binary and recalls them with BM25 by default, with no second database.
Can an agent use XERJ memory over MCP?
Yes. The xerj mcp server exposes xerj_memory_store and xerj_memory_recall, which call the same /_memory endpoints.
Does XERJ forget memories on its own?
No. There is no decay and no TTL. A memory is permanent until explicitly forgotten with DELETE /_memory/{namespace}/{id}.
Evidence
- LangChain describes agents updating memory in the hot path, where the agent explicitly decides to remember facts, usually via tool calling, or in the background by a separate process. Source: https://www.langchain.com/blog/memory-for-agents
- LangChain, after the CoALA paper, splits agent long-term memory into procedural, semantic and episodic memory. Source: https://www.langchain.com/blog/memory-for-agents
- XERJ memory: POST /_memory/{namespace} stores, POST /_memory/{namespace}/_recall recalls, DELETE /_memory/{namespace}/{id} forgets one entry, each namespace is its own .xerj-memory-{namespace} index. Source:
engine/crates/xerj-api/src/memory_api.rs - xerj mcp exposes xerj_memory_store and xerj_memory_recall as MCP tools. Source:
landing/docs/agents/schemas/mcp-tools.json
Related
- What is agentic memory?
- Agent memory vs RAG: the difference, and when you need both
- What is an MCP memory server?
- Mem0 vs Zep vs Letta vs Cognee: which agent memory framework fits in 2026?
- What's a simple way to give an agent long-term memory on my laptop without Qdrant?
- How do I stop an agent memory store from filling with near-duplicate notes?
- Agent memory
- Agentic RAG vs RAG: which one fits your question?
- XERJ vs Mem0: which memory fits your AI agent?
- MemPalace vs claude-mem (and XERJ): which memory should Claude Code use?
- Claude Code memory: CLAUDE.md, auto memory, or an MCP memory server?
- AI agent memory benchmark 2026: real tests on 7 open-source projects
- XERJ vs agentmemory: which memory for your coding agent?
- XERJ vs memvid: one memory file or one local server?
- XERJ vs ReMe (Alibaba Tongyi Lab): a tested comparison
- What is a knowledge graph memory server? · same intent: agent memory
- How do people store user preferences so an agent can recall them next week? · same intent: agent memory
- How can agent-memory links retain evidence? · same intent: agent memory