hms-claude-mem

Persistent semantic memory for Claude Code. A C++ MCP server backed by Redis 8 vectorsets that lets Claude store, search, and retrieve context across sessions — surgically, on demand, without bloating the context window.

MCP serverC++17Redis 8 vectorsetsSemantic searchClaude Code

What it does

Store what matters

Claude saves build commands, debug fixes, decisions, and preferences as it discovers them. The key is embedded as a 768-dim vector so it can be found later by meaning, not exact words.

Search by meaning

Ask "how do I deploy to the Pi?" and cosine similarity surfaces the right memory even if those exact words were never stored — powered by Redis VSIM over the vectorset.

Retrieve surgically

Only the relevant memories come back, in small batches with similarity scores. No MEMORY.md dumping everything upfront and burning context on what isn't relevant right now.

Five MCP tools: mem_store, mem_search, mem_get, mem_delete, and mem_list. Each memory lives in two places — a vectorset for semantic search and a hash for exact retrieval and metadata. An optional recency decay quietly de-ranks stale memories over time.

Get it running

Prerequisites & build

Redis 8+ (vectorset is built in), any OpenAI-compatible embedding provider (Ollama, OpenAI, vLLM, LiteLLM, LocalAI), and a C++17 toolchain.

sudo apt install -y libhiredis-dev \
  libcurl4-openssl-dev nlohmann-json3-dev

# local, free embeddings
ollama pull nomic-embed-text

mkdir build && cd build
cmake .. && make -j$(nproc)

Prefer no build? Grab a prebuilt binary from the latest GitHub Release (Linux / macOS arm64 / Windows) or pull the ghcr.io/hms-homelab/hms-claude-mem Docker image.

Register with Claude Code

Add it to your project's .mcp.json (project-scoped memory) or ~/.claude/settings.json (global). Different NAMESPACE values keep memory pools fully isolated.

{
  "mcpServers": {
    "claude-mem": {
      "command": "/path/to/build/hms_claude_mem",
      "env": {
        "REDIS_HOST": "127.0.0.1",
        "EMBED_PROVIDER": "ollama",
        "EMBED_HOST": "http://localhost:11434",
        "EMBED_MODEL": "nomic-embed-text",
        "NAMESPACE": "my-project"
      }
    }
  }
}

Point REDIS_HOST at a shared Redis to give every machine the same memory. Restart Claude Code after changing MCP config.

Give Claude a memory that lasts

Open source under MIT. Build from source, grab a release binary, or run the Docker image — then teach Claude to remember your homelab.