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 for gptme.

Saves memories to the shared Claude Code memory path so they are readable by future sessions on any runtime (CC, gptme, Codex).

Memory files are written to:

~/.claude/projects/<workspace-hash>/memory/<name>.md

And an entry is added to MEMORY.md (the index file), which is auto-loaded by gptme (via prompt_workspace) and by Claude Code in every session.

Usage:

memory save <name> <description line> <body content>

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

Execute the memory tool — save a memory entry with user confirmation.

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

Save a memory to the shared CC memory directory.

Parameters:
  • name – Memory name (slugified to a safe filename).

  • content – Memory content. First line is the description; rest is the body.

  • workspace – Workspace root (defaults to get_workspace()).

Returns:

Path to the saved memory file as a string.