The five memory actions every connected agent uses, and how to connect agents such as Codex or OpenClaw.
The brain gives agents a small, fixed set of memory actions: recall, remember, entity, synthesize and forget. Together they are called MEMORY_VERBS v1. An agent uses them to save what it learns and look it up again in a later session, even from a different agent.
This guide explains what each action does, connects an agent to them, and shows how to try each one from the command line. The v1 contract is frozen: field names and meanings never change, and new fields are only ever added.
nexusbrain init first. See Setting up the brain for your AI agents.synthesize also needs a chat model key, such as ANTHROPIC_API_KEY. The other four actions work without one.A fact is one short claim, such as "prefers dark mode", with a note of where it came from. Facts can be attached to an entity: a person, company or project, named by a slug such as people/alice-example.
nexusbrain protocolYou should seeA heading with MEMORY_VERBS v1, then one line per action such as remember(fact, provenance, ttl?, entity?, kind?, visibility?). Inputs ending in ? are optional.
nexusbrain protocol --jsonYou should seeA JSON document with protocol_version, an input and response schema for each action, and the error schema.
| Action | What it does | Required inputs | Cost |
|---|---|---|---|
remember | Saves one fact. | fact, provenance | No model call |
recall | Returns saved facts. With query it also searches your pages. | None | No model call |
entity | Returns a short card about one known person, company or project. | name | No model call, usually under 100ms |
synthesize | Answers a broad question by reasoning across many pages, with sources and gaps. | question | Calls a model. Slow and costs money. |
forget | Expires a fact by id. The fact is kept for the audit trail, not deleted. | id | No model call |
Agents should use entity for one known subject, recall for facts and snippets, and synthesize only when the answer needs evidence combined from many pages.
nexusbrain serve --surface verbs starts an MCP server that offers exactly these five actions and nothing else. Without --surface verbs, nexusbrain serve offers every brain operation, and the five actions are included in that list too.
claude mcp add nexusbrain -- nexusbrain serve --surface verbsYou should seeClaude Code saves an MCP server named nexusbrain. It starts the server itself when a session begins.
Add a server that runs the command nexusbrain with the arguments serve --surface verbs. The server talks over standard input and output, the usual way to run a local MCP server. The OpenClaw plugin bundle for the brain declares a plain nexusbrain serve server, which offers the five actions alongside every other operation.
The other machine runs nexusbrain serve --http, and you create a token there with nexusbrain auth create. --agent accepts claude-code, codex, perplexity or generic. For Codex, the printed block sets NEXUS_BRAIN_REMOTE_TOKEN and runs codex mcp add with --bearer-token-env-var.
nexusbrain connect https://brain.example.com/mcp --token <token> --agent codexYou should seeA block starting # Paste into Codex: with the commands to run. Add --install to run them for you.
With no target, this starts the brain's own server and tests it. Use --target http://host:3131/mcp --token <token> for a remote server.
nexusbrain protocol conformanceYou should seeA line per check, a count of passed, failed and skipped, and CONFORMANT at the end.
On the local engine only one process can open the database. While an agent session is running nexusbrain serve, nexusbrain remember and other commands in a terminal cannot open the brain. Try the commands below with the agent closed, or ask the agent to call the tools instead.
These are the three commands nexusbrain init prints at the end. The command line uses the same code as the MCP tools, so what works here works for agents.
--provenance is required: a short note of where the fact came from, up to 500 characters. Set --entity whenever the fact is about someone or something, because a recall by entity will not find facts saved without one.
nexusbrain remember "I prefer dark mode in every editor" --provenance demo --entity people/meYou should seeremembered as fact #N and entity: people/me. Saving the same fact again prints already knew this and keeps the original id.
nexusbrain recall --entity people/meYou should seeA line with the fact id (such as id=1), [people/me], the fact text, and its kind and confidence. Facts are listed newest first.
You should seeThe agent calls recall and mentions dark mode.
| Option for `remember` | What it does |
|---|---|
--entity <name or slug> | Who or what the fact is about. |
--kind <kind> | One of event, preference, commitment, belief or fact (the default). |
--ttl <when> | When the fact expires: 30d, 12h, 45m, or a date such as 2026-07-12T00:00:00Z. Forms like P30D are rejected. |
--visibility <world|private> | world (the default) lets every connected agent read it. private keeps it to local command line reads. |
--json | Print the raw response, including status: inserted, duplicate or superseded. |
--query adds a search over your pages. --budget-tokens asks the brain to pack facts first, then page results, until the budget is used.
nexusbrain recall --query "editor setup" --budget-tokens 2000You should seeA Facts: list, a Pages: list, and a budget: line showing tokens used and how many items were dropped.
nexusbrain recall --since "8 hours ago"You should seeFacts saved in the last eight hours.
nexusbrain entity "Alice Example"You should seeThe entity title and slug, then when available a summary, open threads and links, and a backlinks: N | active facts: N line. If nothing matches you get No entity found., with a Did you mean: list when there are close matches, instead of an error.
nexusbrain synthesize "what is our payments strategy?"You should seeAn answer, then sources:, any gaps:, and a cost: line with the model and token counts.
The recall command also accepts --today, --session <id>, --grep <text>, --include-expired, --as-context and --json. synthesize accepts --since and --until to limit the time window.
nexusbrain recall --entity people/meYou should seeOne line per fact, each with id=N, the entity in brackets, the fact text, and its kind.
nexusbrain forget 42 --reason "no longer true"You should seeForgot fact id=42.
Fact ids are numbers returned by remember and recall, never page slugs. Over MCP, forgetting a fact that is already expired succeeds with expired: false.
nexusbrain protocol stats --days 7You should seeMEMORY_VERBS usage for the last 7 days, one line per action, and the path of the local log file. Before any calls it says no verb calls recorded yet.
world visibility can be read by every agent connected to this brain, including agents on other machines that reach it over HTTP.world facts. Facts saved with visibility: "private" are only returned to local command line reads such as nexusbrain recall.nexusbrain protocol stats shows calls per action, error counts, average latency, how often entity found a match, and how long it took from install to the first action call. It reads a local log file only, and that data never leaves the machine. Use --days N to change the window from the default 30 days.provenance is required and must be non-empty.Every remember needs a note of where the fact came from. Add --provenance "user said in chat" or similar.
synthesize needs an LLM and none is configured.Set a chat model key, for example ANTHROPIC_API_KEY, or run nexusbrain config set anthropic_api_key <key>, then try again. recall and entity keep working without one.
No matching facts., but the fact was savedThe fact was probably saved without --entity. Try nexusbrain recall --grep <word> to find it, then save it again with an entity.
If an agent saved it, check whether it used visibility: "private". Private facts never reach MCP clients.
nexusbrain serveAn agent session is holding the local database. Close the session, or keep it and ask the agent to call the memory tools instead.
Unknown --surface when starting the serverThe only accepted values are verbs and full.
No fact with id=42The id does not exist in this brain or source. Run nexusbrain recall to see the ids of current facts. If it says is already expired, the fact was forgotten earlier.
NOT CONFORMANTRead the lines marked as failed for the check and the reason. Add --json for a machine readable report you can share through feedback.