A local mem0-compatible memory server for AI agents
pip install neatmem==0.6.3 Copy PIP instructions
Lightweight local memory for agents — every dedup, update, and rerank decision inspectable and tunable. 3 dedup detectors × 4 update resolvers × 3 rerank modes · 60+ parameters · 6 prompts replaceable
LoCoMo accuracy (5-run mean, MiniMax-M3) · reproduction
Agent memory is easy to start but hard to keep clean.
NeatMem keeps every memory decision inspectable and tunable:
messages ↓ retrieve last-k messages as extraction context ↓ LLM memory extraction (with last-k context) ↓ context completion and source tracking ↓ sequential LLM-assisted memory decisions ├─ add -> store as new memory ├─ none -> skip (duplicate) └─ update -> merge per DEDUP_RESOLVER (skip/replace/rewrite/edit) ↓ write to vector store + BM25 index + entity store Search flow query ↓ dense vector search + BM25 sparse search + entity boosting ↓ rerank (LLM listwise/pointwise or cross-encoder) ↓ threshold filtering ↓ results Compatibility NeatMem implements a mem0-compatible API subset for local agent memory workflows:
It is designed to work with OpenClaw's and Hermes' memory plugin flows and other mem0-style integrations. It does not aim to cover every mem0 SDK feature or hosted-platform behavior.
Runs on 10 LLM providers and 4 embedding providers (MiniMax, DeepSeek, Qwen, GLM, Kimi, Doubao, SiliconFlow, OpenAI, Gemini, OpenRouter) — endpoints and thinking-control parameters in supported providers.
A remote client is provided for programmatic access:
from neatmem import MemoryClient client = MemoryClient(host="http://localhost:8790") # requires `neatmem serve` added = client.add("My name is Alex", user_id="default_user") # {"results": [{"id": "...", "memory": "User's name is Alex", "event": "ADD"}]} found = client.search("What is my name?", filters={"user_id": "default_user"}) print(found["results"][0]["memory"]) # -> "User's name is Alex" Full method and parameter reference: Python Client.
The client also provides server-side write batching (add_messages, get_next_batch, mark_batch_processed, flush_messages) and raw message history access (client.messages — query, sessions, delete, reset).
pip install neatmem # Minimal .env (OpenAI-compatible LLM + SiliconFlow embedding) curl -o .env https://raw.githubusercontent.com/kanhaoning/NeatMem/main/.env.example neatmem serve # listens on http://localhost:8790 For better BM25 keyword matching (searching "memory" also matches "memories"): pip install "neatmem[nlp]" && python -m spacy download en_core_web_sm. For source install and more, see the full quick start.
NeatMem reads configuration from environment variables (a .env file in the working directory). Common settings — full table in the configuration reference:
Every core prompt (extraction, dedup, merge rewrite, group rewrite, patch edit, rerank) can be replaced with your own prompt file — see the custom prompts guide.
With the NeatMem server running at http://localhost:8790:
openclaw plugins install @neatmem/openclaw-neatmem openclaw neatmem init Then restart the gateway (openclaw gateway restart) to load the plugin.
init works with zero flags: it writes apiKey=neatmem-local, baseUrl=http://localhost:8790, and your OS username as userId, then validates against the server. Override with --api-key, --user-id, or --base-url.
{ "plugins": { "slots": { "memory": "openclaw-neatmem" }, "entries": { "openclaw-neatmem": { "enabled": true, "config": { "apiKey": "neatmem-local", "userId": "default_user", "baseUrl": "http://localhost:8790" } } } } } Then check:
openclaw neatmem status The plugin id is openclaw-neatmem. It talks to NeatMem through the local mem0-compatible HTTP API. For full CLI/tool reference and building from source, see openclaw/README.md.
NeatMem includes a Hermes Agent memory provider under hermes/. With the NeatMem server running at http://localhost:8790:
hermes plugins install kanhaoning/NeatMem/hermes --enable hermes config set memory.provider neatmem The plugin registers four memory tools (neatmem_search, neatmem_list, neatmem_update, neatmem_delete) and recalls memories automatically on each turn. Each turn is forwarded to the server, which extracts memories in fixed-size batches; anything still pending is saved automatically when the session ends. Optional configuration via ~/.hermes/neatmem.json:
{ "base_url": "http://localhost:8790", "user_id": "myname", "rerank": true } Verify: tell Hermes "remember that I prefer dark themes", then ask about it in a new session (pending messages are saved on session switch; extraction takes a few seconds). See hermes/README.md for the full configuration reference and troubleshooting.
claude plugin marketplace add kanhaoning/NeatMem claude plugin install neatmem@neatmem Open a new session after installing — plugins load at session start. Sessions are captured automatically and extracted when the session ends; the first message of every new session searches and injects relevant memories. Defaults need no configuration (localhost:8790, your OS account as the memory user).
Verify: say "remember that I prefer dark themes", /exit, then ask about it in a new session in the same directory. See claude-code/README.md for the full configuration reference, command list and troubleshooting.
NeatMem includes a DeepSeek Harness (dsh) plugin under dsh/. With the NeatMem server running at http://localhost:8790:
dsh plugin --profile web add @neatmem/dsh-neatmem Restart dsh to load the plugin — memory is on. (Using the headless CLI or another profile instead of the web UI? Swap web for that profile's name.) Verify with dsh --profile web --dump-config (a neatmem-dsh row appears). The plugin is pure TypeScript — no native dependencies and no build approvals. It works with zero configuration (baseUrl=http://localhost:8790, userId=default); override per profile in $DSH_HOME/profiles/ /cordis.patch.yml:
- id: neatmem-dsh config: userId: myname Each direct-user turn gets one bounded automatic recall (fail-open, injected as a source-labelled message), every finished turn is forwarded to the server's /v1/messages/ batching pipeline, and the agent gets five memory tools (memory_search, memory_list, memory_get, memory_update, memory_delete). Verified against dsh 0.1.5-rc.2. See dsh/README.md for the full configuration reference and development setup.
mem0-compatible endpoints for add, search, list, get, update, delete, and health check, plus a /v1/messages/ endpoint family for server-side write batching — with curl examples in the API reference.
Inspired by the mem0 project (Apache-2.0). Vendored-code notices are in the respective file headers.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




