0gm-memory
OfficialServer Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ZG_API_KEY | No | Used if nothing above is set. | |
| OPENCODE_DB | No | OpenCode's database, read by save --opencode and the plugin. | $XDG_DATA_HOME/opencode/opencode.db |
| ZGM_MEMORY_KEY | No | API key for this project's wallet. The key is read in order: ZGM_MEMORY_KEY, ZGM_MEMORY_KEY_SERVICE, a key entered in plugin settings, then ZG_API_KEY. | |
| ZGM_MEMORY_HOME | No | Local state folder. Defaults to the platform data folder: ~/Library/Application Support/0gm-memory, ~/.local/share/0gm-memory, or %LOCALAPPDATA%\0gm-memory. | |
| ZGM_MEMORY_MODEL | No | Model id. | 0gm-2.0 |
| ZGM_MEMORY_DISABLE | No | Set to 1 to turn everything off: nothing is read or sent. | |
| ZGM_MEMORY_BASE_URL | No | Router base URL. | https://router-api.0g.ai/v1 |
| ZGM_MEMORY_ASK_TIMEOUT | No | Seconds per ask_memory call. | 300 |
| ZGM_MEMORY_KEY_SERVICE | No | macOS: name of a keychain item holding the key. | |
| ZGM_MEMORY_MAX_RETRIES | No | Retries on 429 and 5xx, with backoff. | 4 |
| ZGM_MEMORY_FLUSH_TOKENS | No | Estimated tokens per save. Larger saves mean fewer, bigger saves. | 70000 |
| ZGM_MEMORY_OPENCODE_BIN | No | OpenCode command, used only if its database cannot be read. | opencode |
| ZGM_MEMORY_SAVE_TIMEOUT | No | Seconds per save call. | 600 |
| ZGM_MEMORY_TOOL_RESULT_CHARS | No | How much of each tool result is kept. | 1500 |
| ZGM_MEMORY_NO_ENTROPY_REDACTION | No | Set to 1 to keep random-looking strings that match no known secret format. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Long-term memory for this project. Call ask_memory when the user refers to past work, earlier decisions or anything you do not have in context. It returns dated verbatim quotes, not answers.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| ask_memoryA | Search this project's long-term memory (0GM-CMSA memory holding past agent sessions). Returns VERBATIM quotes of the relevant past messages, each with its session date, or NO RELEVANT MESSAGES. It does not answer: reason over the quotes yourself. Slow (seconds on a small wallet, up to about 100 s on a large one) and costs about $0.003 to $0.03 per call, so ask one specific, self-contained question rather than many small ones. Recent sessions may still be buffered locally; matches from the buffer are listed separately. |
| save_sessionA | Add a session transcript (Claude Code or Codex JSONL, or JSONL of {role, content, timestamp}) to this project's memory buffer. Secrets are redacted first. The buffer is written to wallet memory once it passes about 70K tokens; the reply says what was buffered and what was saved. Safe to call twice on one file: only new records are added. |
| memory_statusA | What is buffered locally, what has been saved to wallet memory, the quota used and the last save. Free: no network call. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 3 tools
The three tools map cleanly onto read (ask_memory), write (save_session), and inspect (memory_status) operations with no functional overlap. The descriptions explicitly differentiate them, including noting that ask_memory does not reason and that memory_status is free and local.
ask_memory and save_session follow a consistent verb_noun pattern, but memory_status breaks it with a noun_noun form. It is still readable and clearly part of the same family, so only a minor deviation.
Three tools is on the lean side but covers the core memory lifecycle (search, ingest, status) without redundancy. Each tool earns its place; nothing feels like filler.
Search, save, and status cover the main loop, but there is no way to delete or forget memories, list saved sessions/entries, or force a flush of the buffer to wallet memory. These are notable gaps that could cause dead ends for agents managing memory hygiene.