ANSWERS · AGENT MEMORY: CONCEPTS

How to use agentic memory in XERJ

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-10-28 · UPDATED · 2026-11-14
SHORT ANSWER · UPDATED 2026-11-14

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.

PASTE THIS TO YOUR AI AGENT. IT DOES THE REST 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.
RUN THIS XERJ COMMAND curl -fsSL https://xerj.org/get | sh Install the single XERJ binary.
RUN THIS XERJ COMMAND 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.
RUN THIS XERJ COMMAND 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?.

Try it: follow one fact

How agentic memory is written and read

  1. 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. 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. 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. 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.

Semantic

Facts

Example: the user wants metric units.

Episodic

Past events

Example: the deploy failed last Tuesday on step 3.

Procedural

How to do a task

Example: run the linter before every commit.

The hot-path vs background split, and the semantic / episodic / procedural types, follow LangChain's summary of the CoALA paper. The XERJ endpoints follow engine/crates/xerj-api/src/memory_api.rs. The examples in the cards are illustrative, not recorded runs.

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

Related