Skip to main content
Glama

QuoteMem

npm PyPI CI

QuoteMem is a long-term memory service for AI agents that keeps the exact words behind every memory.

  • Every memory keeps its exact quote. Each memory is a short statement tied by byte range to the words it came from.

  • Updates keep the old version. When a fact changes, a new version is written and the old one is kept and marked as replaced.

  • "Forget" is carried out and stays forgotten. The memories the request matches are taken out of reads and are not learned again later, except from the user's own later, dated statement of it in the agent Add mode.

Demo

examples/demo tells one short story to a running service, for a new user. Chat 1: "I live in Beijing. My cat is called Bob. I work as a nurse." Chat 2: "I moved from Beijing to Shanghai last month." Chat 3: "Forget my cat's name." It runs from a clone of the repository, after npm install -g quotemem and quotemem setup:

git clone https://github.com/edsml-jz2321/QuoteMem.git
cd QuoteMem
quotemem serve &
node examples/demo/demo.mjs

This is a real run with the default preset (output shortened):

$ node examples/demo/demo.mjs
2. Chat 2, the user says: "I moved from Beijing to Shanghai last month."
   stored: 1 corrected
3. The memories, each with its quote:
   [past] The user lives in Beijing.
   [current] The user moved from Beijing to Shanghai last month.
     quote: "I moved from Beijing to Shanghai last month."
   ...
   history of the city, newest first:
   update: The user moved from Beijing to Shanghai last month.
   create: The user lives in Beijing.
4. Recall:
   search "Where does the user live now?", first hit:
   The user moved from Beijing to Shanghai last month. (said on ...)
   Status: current
   - user: "I moved from Beijing to Shanghai last month."
5. Chat 3, the user says: "Forget my cat's name."
   prepare, goes: The user's cat is named Bob.
   confirm: verified
6. After the forget:
   [current] The user has a cat.
     quote: "My cat"
   ...
   search "What is the name of the user's cat?", first hit:
   The user has a cat. (said on ...)
   "Bob" in the memories or the search: no

These lines came out the same in ten runs, each with a new user. The script ends with the same list from quotemem memories.

Related MCP server: hy-mem

Quick start

You need Node 20.3 or later and uv on PATH. The default preset uses one Alibaba Cloud Model Studio (DashScope) API key, from bailian.console.aliyun.com (China region).

  1. Install the command and set it up once:

    npm install -g quotemem
    quotemem setup

    Setup asks for the preset (Enter takes default), the review (Enter takes standard) and your key, which is not shown as you type. It checks the settings with one call to each model and ends with ok: the settings work. .... For scripts, quotemem setup --yes --preset default --review standard takes the key from DASHSCOPE_API_KEY.

  2. Install one tool, for example Cursor: quotemem install cursor --write. It writes ~/.cursor/hooks.json and ~/.cursor/mcp.json, and prints the rule to copy into each project. quotemem doctor checks the setup.

  3. Say something in a chat: "I live in Beijing. My cat is called Bob." The first chat starts the memory service in the background (the first start downloads it). The chat is saved in the background every few turns, and once it has been idle for 5 minutes. Then quotemem memories lists each memory with its quote:

    [current] The user's cat is named Bob.
      remembered 2026-11-24, changed 2026-11-24; id 01M86JY92FDXTXP53TJ1MRZ58D
      - user, 2026-11-24: My cat is called Bob.
  4. Ask in a new chat: "Where do I live?" The plugin adds the matching memory to the prompt, with its quote from the first chat, in a line like - user: "I live in Beijing".

  5. Say "Forget my cat's name." The plugin forgets it and tells the agent. Then quotemem memories shows The user has a cat. with the quote My cat, and no name. A later "What is my cat called?" finds no name.

quotemem status shows the service; quotemem stop stops it.

Works with your tools, and they share one memory

Every tool's plugin talks to one local service, so what you tell one tool is recalled in the others, and what you ask one tool to forget is forgotten in all of them. They all use one memory by default: QUOTEMEM_USER_ID, which defaults to your OS user name.

Tool

Set it up

Claude Code

claude plugin marketplace add edsml-jz2321/QuoteMem --sparse .claude-plugin integrations, then claude plugin install quotemem@quotemem

Codex CLI

codex plugin marketplace add edsml-jz2321/QuoteMem --sparse .agents --sparse integrations/codex, then codex plugin add quotemem@quotemem, then trust the hooks once with /hooks

Cursor

quotemem install cursor --write, plus the rule it prints, in each project

OpenCode

quotemem install opencode prints the block to merge into opencode.jsonc

Gemini CLI

quotemem install gemini prints the gemini extensions install command

Cline (VS Code)

quotemem install cline --write, then turn on Enable Hooks

goose

quotemem install goose --write, then set GOOSE_MOIM_MESSAGE_FILE as it prints

OpenClaw

quotemem install openclaw prints the openclaw plugins install command

DSH

dsh plugin --profile quotemem add quotemem (needs pnpm on PATH), then start dsh --profile quotemem

The service runs on 127.0.0.1:8765. To use a port of your own, put QUOTEMEM_URL=http://127.0.0.1:<port> in ~/.quotemem/env and in the environment Claude Code, Codex and DSH start in. The service keeps the proxy settings of the tool or shell that starts it; if your proxy is only for downloads, add the model host to NO_PROXY (.aliyuncs.com for the default preset). More tools and details: Use with your agents.

Use it from code

The HTTP service takes a bearer token from its data folder:

TOKEN_FILE=~/.local/share/quotemem/token
curl -s http://127.0.0.1:8765/memory/add \
  -H "Authorization: Bearer $(cat "$TOKEN_FILE")" -H "Content-Type: application/json" \
  -d '{"user_id": "u1", "session_id": "s1",
       "messages": [{"role": "user", "content": "I moved to Lisbon last spring."}]}'
curl -s http://127.0.0.1:8765/memory/search \
  -H "Authorization: Bearer $(cat "$TOKEN_FILE")" -H "Content-Type: application/json" \
  -d '{"user_id": "u1", "query": "Where do I live?"}'

Any MCP client can use the memory tools (search, add, history, forget):

{
  "mcpServers": {
    "quotemem": { "command": "npx", "args": ["-y", "quotemem", "mcp"] }
  }
}

Without Node: uvx quotemem serve, or pip install "quotemem>=0.3", then quotemem serve (what it needs).

Result

In the Agent Memory Leaderboard (AMLB) Cycle 2 official results, QuoteMem scored 59.83 overall and ranked 23rd of 125 entries in Textual Memory · Closed-source Methods, where it is listed as "QuoteMem" with a link to this repository: https://agentmemoryleaderboard.ai/results/cycle-2/#industry-textual.

Documentation

The docs have the full guides: what it does, the service and its routes, configuration and review, forgetting, commands and the memory list, agents, benchmarks and development. Changes are in the changelog.

CI runs ruff, pyright, a service smoke test and a checked build on Python 3.12, 3.13 and 3.14, and the Node tests (npm test, npm run check) on Node 20 and 24 (ci.yml). To send a change, see CONTRIBUTING.md. Please open a GitHub issue for questions, bug reports and suggestions. Report a security issue privately, as SECURITY.md describes.

Licence

QuoteMem is released under the MIT License, see LICENSE. The included HeavenBase is MIT-licensed too. Third-party components and the licences of the benchmark sources are listed in NOTICE. Benchmark datasets are not redistributed here and keep their own licences.

Available Tools

8 tools
quotemem_addA

Store a conversation turn in long-term memory. The service extracts durable facts, ties each to the exact quoted words, and returns once they are stored and searchable (usually tens of seconds, sometimes minutes). Send the user's own words; never send secrets such as passwords, keys or tokens.

Inputs: messages (required), request_id, session_id.

quotemem_forget_confirmA
DestructiveIdempotent

Step 2 of forgetting: carry out a plan from quotemem_forget_prepare after the user has agreed. Repeating it with the same token is safe.

Inputs: token (required).

quotemem_forget_prepareA

Step 1 of forgetting, only when the user asks to forget something. Finds the memories that state it and returns a short-lived confirmation token plus the targeted statements. The service asks its model to pick the matching memories, so each call makes one model request. Show the targeted statements to the user and call quotemem_forget_confirm only after the user agrees. Nothing is forgotten by this step.

Inputs: statement (required).

quotemem_healthA
Read-only

Check that long-term memory is available, and how many saved conversations it is still storing.

Inputs: no named parameters.

quotemem_historyA
Read-only

Show the version history of one memory, newest first: each version's statement, validity dates, change kind and quoted source words. Forgotten versions appear redacted.

Inputs: memory_id (required), limit.

quotemem_memoriesA
Read-only

List what long-term memory holds for the user, newest first: each memory's statement, status, dates and its first quoted source line, plus how many memories have each status. Use it only when the user explicitly asks to see or list what you remember about them; to answer a question, rely on the recalled memories or quotemem_search instead. Status current: still holds (a past event that is still true counts); past: replaced, retracted or ended; possibly_outdated: a later statement conflicts and it is unresolved. Forgotten memories never appear.

Inputs: limit, cursor, status.

quotemem_provenanceA
Read-only

Show a memory's provenance: the review decision that admitted it, the existing memories it was compared with, and the reason.

Inputs: memory_id (required), revision_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct operation: write (add), retrieve (search), enumerate (memories), two-step deletion (forget_prepare/confirm), audit (history, provenance), and diagnostics (health). The descriptions explicitly disambiguate the closest pair (search vs memories) and clarify the two-step forgetting flow.

    Naming Consistency4/5

    All tools share a consistent quotemem_ prefix and snake_case formatting, which makes the set predictable. However, the stems mix verb forms (add, search, forget_prepare) with noun forms (memories, health, history, provenance), so it is not a pure verb_noun pattern throughout.

    Tool Count5/5

    Eight tools is well-scoped for a memory service, with each tool covering a meaningful capability rather than redundant variations. The two-step forget pairing is justified by its confirmation requirement.

    Completeness4/5

    The surface covers writing, searching, listing, forgetting, auditing (history/provenance), and health checks, giving solid lifecycle coverage. Minor gaps remain, such as no explicit single-memory retrieval or direct correction/update operation, though those may be handled internally by the service.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents and MCP clients to store, retrieve, and manage bi-temporal, graph-aware facts in an embedded SQLite memory engine with token-budgeted recall and contradiction tracking.
      6
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables any MCP-compatible client to persist long-term memories for AI agents, with LLM-based fact extraction, semantic vector search, update/delete/list operations, and queue status checks across sessions.
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude and other MCP hosts to persist and recall long-term agent memories—episodic turns, semantic facts with conflict-aware versioning, and procedural rules—using scored retrieval and supporting deletion.
      MIT