Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(memory): describe the memory tool's current read contract

sanil-23feabc02617df
diff --git a/docs/specs/memory-v2.md b/docs/specs/memory-v2.md
index 1f4d4328af..076dbc5a6a 100644
--- a/docs/specs/memory-v2.md
+++ b/docs/specs/memory-v2.md
@@ -222,8 +222,20 @@ CortexDB refuses for it is written again without it (tinymemory's fallback). Off
## Agent tool: `memory`
One tool, `action` = `recall` | `fetch` | `learn` | `forget`:
-- `recall { question, filter? }` → `{answer, citations[]}`.
-- `fetch { query, mode?, filter?, limit? }` → `{hits[]}`; `mode` limited to the engine's `fetch_modes`.
+- `recall { question, filter?, refers_to? }` → `{evidence, items}`: the engine's
+ evidence (`RecallMode::Evidence`, no engine-written answer) as dated lines,
+ capped at about 2,500 tokens and cut only at line ends, and how many items it
+ rests on (their ids are recorded as the turn's citations); `{evidence: "",
+ note}` when nothing was recalled.
+- `fetch { query, mode?, filter?, refers_to?, cursor? }` → `{items, matches,
+ next_cursor?}`: five matches at a time, best first, as dated lines with their
+ ids; `next_cursor` continues the same search. `mode` is limited to the
+ engine's `fetch_modes`. The page size is the host's: the tool takes no `limit`.
+- `recall` and `fetch` leave out the calling thread's turns still verbatim in
+ the prompt (`ThreadWindow`), so the message being answered never comes back
+ as a memory while turns compacted out of a long thread stay readable. A run
+ that does not know its window (a sub-agent, a direct dispatch) leaves the
+ whole thread out. RPC `memory_recall` / `memory_fetch` keep their shapes.
- `learn { text, kind?, confidence? }` → `{id, status: "queued; not yet saved to memory"}`. The host fills `meta`: the
layout's learnings node, `workspace`, `thread_id`, `agent_id` (the memory
agent id), `tool_call`, `source.kind = "agent"`.