Memory

Memory#

The memory tool saves a fact to the shared cross-runtime memory store, so a later session on any runtime (gptme, Claude Code, Codex) can recall it. Entries are Markdown files under the memory root alongside an index line in MEMORY.md. Gptme loads the index at startup when user context is enabled (the default; eval runs typically disable it).

The first line of the block is the one-line summary shown in the index; the rest is the body:

memory prefer-short-answers
User prefers short, direct answers without preamble.

Persistent memory tool backed by the shared layered memory store.

Use explicit user scope for cross-project preferences; project and CC scopes remain workspace-local. Startup loading depends on the harness configuration.

gptme.tools.memory.execute_memory(code: str | None, args: list[str] | None, kwargs: dict[str, str] | None = None) → Generator[Message, None, None]

Save a memory after confirming its exact scope, path and content.

gptme.tools.memory.prepare_pending_memory(call: ToolUse, workspace: Path | None = None) → ToolUse

Resolve a server’s initial approval without creating directories or files.

The same normalization as execution is used for native, Markdown and XML calls. Invalid calls keep their normal execution-time error reporting.

gptme.tools.memory.save_memory(name: str, content: str, workspace: Path | None = None, *, scope: str | None = None) → str

Save through the layered store, returning the selected file path.

Omitted scope follows the CLI’s default (explicit, project, else CC). Explicit scopes must be available in the resolved roots; no fallback occurs.