Recipes for agent memory. Each one is a call you can paste.
The five things people do first: resume at the start of a session, remember with the source, ask, forget, and bring a PostgreSQL database in. Each recipe says what to tell your agent, the MCP tool it calls, and the same call over plain HTTP on a node you run.
Every recipe needs a node (install it in one line) or a Semurg Cloud key. On a node, put the token in your shell first, without printing it:
export SEMURG_API_TOKEN=$(sudo grep '^SEMURG_API_TOKEN=' /etc/semurg/semurg.env | cut -d= -f2-)
1. Resume at the start of a session
Tell your agent: "Before we start, resume the memory for this project."
The agent calls memory_resume once. It returns the working state the agent saved in this memory space and what changed in the space since, each change cited. In a space where nothing was saved, it says so instead of inventing a history.
Over HTTP
curl -sS http://127.0.0.1:4000/v1/memory/resume -H "Authorization: Bearer $SEMURG_API_TOKEN" -H "Content-Type: application/json" -d '{"scope":"demo"}'
Run on Semurg Cloud on 2 December 2026: in a new space it answered nothing_stored and named what to save.
2. Remember a fact, with its source
Tell your agent: "Remember that we chose PostgreSQL for the billing service, because the team already runs it. Source: today's team meeting."
The agent calls memory_remember with the text, the things it is about, and the source label. The label is what every later answer cites.
Over HTTP
curl -sS http://127.0.0.1:4000/v1/memory/remember -H "Authorization: Bearer $SEMURG_API_TOKEN" -H "Content-Type: application/json" -d '{"scope":"demo","source":"team meeting, 2 Dec","passages":[{"text":"We chose PostgreSQL for the billing service, because the team already runs it.","mentions":["billing service","PostgreSQL"]}]}'
Run on the release of 30 November 2026.
3. Ask, and get the source back
Ask your agent: "Which database did we choose for the billing service?"
The agent calls memory_ask. The answer comes back with its source, or says nothing is stored: read state first, answered or nothing_stored, so the agent never takes "nothing found" for a fact.
Over HTTP
curl -sS http://127.0.0.1:4000/v1/memory/ask -H "Authorization: Bearer $SEMURG_API_TOKEN" -H "Content-Type: application/json" -d '{"scope":"demo","question":"Which database did we choose for the billing service?"}'
Run on the release of 30 November 2026: the answer came back with "team meeting, 2 Dec" as its source. A question about something never stored answered nothing_stored, on that release and on Semurg Cloud on 2 December 2026.
4. Forget
Tell your agent: "Forget what was filed under 'team meeting, 2 Dec'."
The agent calls memory_forget with the narrowest form that does the job: one fact, one entity (subject), one stored document, everything filed under one source label, or a whole memory space. Before forgetting a whole space, it should say what will go and wait for your yes.
Over HTTP
curl -sS http://127.0.0.1:4000/v1/memory/forget -H "Authorization: Bearer $SEMURG_API_TOKEN" -H "Content-Type: application/json" -d '{"scope":"demo","source":"team meeting, 2 Dec"}'
Forget takes the item out of every answer at once. On this release its stored bytes stay in the node's files; to remove everything a node holds, uninstall it and delete its data directory.
Run on Semurg Cloud on 2 December 2026: a label nothing was stored under was refused by name, source_not_found, and nothing was forgotten.
5. Bring a PostgreSQL database in
On the source database, make a login for this copy that can only read: grant it SELECT and REFERENCES on the tables, and remove it afterwards. Store the login on the node once; the password stays on the node, and the copy names the login:
curl -s -H "Authorization: Bearer $SEMURG_API_TOKEN" -H 'content-type: application/json' http://localhost:4000/v1/query -d '{"op":"credential_put","name":"shop-a-reader","family":"pgwire","fields":{"user":"copy_reader","password":"..."}}'
Then copy it in. The answer is a job id:
curl -s -H "Authorization: Bearer $SEMURG_API_TOKEN" -H 'content-type: application/json' http://localhost:4000/v1/query -d '{"op":"connector_ingest","family":"pgwire","options":{"host":"pg-a","port":5432,"credential":"shop-a-reader","database":"shop","schema":"public","db":"shop_copy"}}'
Ask for the job by its id; its state reads done when the copy has finished, and a refused step names its reason, for example a table without a primary key:
curl -s -H "Authorization: Bearer $SEMURG_API_TOKEN" -H 'content-type: application/json' http://localhost:4000/v1/query -d '{"op":"job","id":"<the job id>"}'
Run as written on release r11.197 on 2 December 2026, with a login granted only SELECT and REFERENCES. The whole round trip writes it back out to an empty PostgreSQL and checks both ends with your own tools.
More
- Agent memory over MCP in five minutes: entities, relationships and the answer that says it is empty.
- Persistent memory for Claude Code.
- Connect your agent: every agent and framework, with its exact line.
- llms.txt: every memory tool and its fields, for an agent to read.