Skip to main content

Module memory

Module memory 

Source
Expand description

Persistent memory tools: remember, recall, forget.

Also provides a scratchpad (working memory) layer: scratchpad_set, scratchpad_get, scratchpad_delete, scratchpad_list. The scratchpad is stored in <workspace>/.recursive/scratchpad.json and its contents are injected into the system prompt as a summary.

Notes are stored in <workspace>/.recursive/memory.json (or ~/.recursive/memory.json if RECURSIVE_MEMORY_GLOBAL=1). Schema:

{ "notes": [ { "id": "N1", "tags": ["rust"], "text": "...", "ts": "..." } ] }

Structs§

Forget
MemoryStore
The on-disk store.
Note
A single memory note.
Recall
Remember
Scratchpad
The on-disk scratchpad store.
ScratchpadDelete
ScratchpadEntry
A single scratchpad entry.
ScratchpadGet
Helper: dispatch scratchpad operations based on the tool name. This is used by the multi-tool approach where one struct handles multiple tool names.
ScratchpadList
WorkingMemoryTool

Functions§

load_memory
Load the memory store from the workspace-relative path.
load_scratchpad
Load the scratchpad from the workspace-relative path.
memory_path
Determine the memory file path based on workspace and env var.
memory_summary
Build a memory summary string for injection into the system prompt. Returns the top N most recent notes as a formatted block, or empty string if no notes exist.
migrate_scratchpad
Migrate old-format scratchpad data (if any) to the new format. Currently a no-op placeholder for future migration logic.
scratchpad_path
Determine the scratchpad file path. Lives under the per-user data dir so it doesn’t pollute the project tree: ~/.recursive/workspaces/<ws-hash>/scratchpad.json.
scratchpad_summary
Build a scratchpad summary string for injection into the system prompt. Returns a formatted block of all key-value pairs, or empty string if the scratchpad is empty.