Claude-Mem alternatives in Go, Rust, and C

Mascote do LinuxPro encaixando um cartucho de memória no SQLite, com o gopher do Go, o Ferris e o cubo do C

The terminal agent is great until the session ends. In the next one, it rediscovers the same bug, rereads the same README, and asks again if the API uses JWT. claude-mem solves this — it captures what the agent did, compresses it, and returns the right chunk at SessionStart. Only it's TypeScript, Node, Bun, and a separate worker. If your machine already runs on a single binary in Go, Rust or C, you can have the same idea without the JS stack.

This post maps the native alternatives that actually exist today: session memory (decisions, bugs, conventions) and code memory (who calls who). They're not clones. Some speak MCP over stdio, others use HTTP, install hooks, or become SQLite extensions. The map of terminal agents continues at AI assistants on the Linux terminal; the fit of claude-mem into the vibe coding flow is at Vibe coding on Linux.

What Claude-Mem does — and what the alternatives try to copy

The repository is still thedotmack/claude-mem, Apache-2.0 license. In 2026 the product is also called Grok Mem; the npm package remains claude-mem. The piece that matters for comparison:

  • lifecycle hooks (SessionStart, PostToolUse, PreCompact, Stop);
  • SQLite + search (FTS5 and vector);
  • MCP for the agent to query memory on demand;
  • context injection at the start of the session, without you asking “remember what we agreed on”.

Whoever switches the stack essentially wants these four things in a local binary, with the database in a file you control. Embeddings, when they exist, point to Ollama or to an embedded model — nothing needs to leave the machine.

Quick table

Project Language Database MCP Profile
mnemo Go SQLite (pgvector optional) stdio / SSE The closest equivalent to Claude-Mem in Go
Engram Go SQLite + FTS5 yes Multi-agent memory, CLI, TUI, HTTP
Goldie Go SQLite + vector yes Shared pool between agents
ai-memory Rust Wiki Markdown + SQLite yes (HTTP) Local server, hooks and handoff between agents
Leteo Rust SQLite 22 tools Single binary + hooks, derived from Engram
Subcog Rust SQLite + FTS5 + HNSW yes Hybrid search + knowledge graph
mcp-memory Rust SQLite yes Graph + vector + code indexing
mcp-memory-rs Rust JSON + SQLite FTS5 yes Local-first, versioned, no embedding
memory-server Rust PostgreSQL + pgvector yes Centralized service + Ollama
sqlite-memory C SQLite via sqlmem / sqlite-mcp Extension, Markdown + hybrid search
codebase-memory-mcp C SQLite yes Code graph, not conversation graph

Go: three binaries, three ways to remember

mnemo — the most direct clone

mnemo (MIT, Go 1.23+) is a memory MCP server with a single binary. Default database in ~/.mnemo/memory.db. Detects Claude Code, OpenCode and Codex on first run and self-registers. Has dashboard at http://localhost:8765.

go install github.com/kyungw00k/mnemo/cmd/mnemo@latest

# hooks do Claude Code (ou deixe o auto-install)
mnemo hook install --dry-run
mnemo hook install

mnemo dashboard

The hooks cover the cycle that Claude-Mem popularized: SessionStart injects recent decisions, PreCompact saves a snapshot, PostToolUse annotates result of Bash, Stop closes the session. Embeddings talk to any OpenAI-compatible endpoint — Ollama by default (nomic-embed-text, 768 dimensions). PostgreSQL + pgvector come in if you swap the DB_URL.

It's the option closest to the original in Go. The project is still new; treat it as a useful tool, not a mature product of years.

Engram — one brain for multiple agents

Engram (MIT) was born inspired by claude-mem, but is agent-agnostic: a Go binary, a SQLite with FTS5 in ~/.engram/engram.db, MCP, HTTP, CLI, and TUI. No Node, no Python, no Docker to run.

# Claude Code
claude plugin marketplace add Gentleman-Programming/engram
claude plugin install engram

# Codex, OpenCode, Antigravity, Cursor…
engram setup codex
engram setup opencode
engram setup antigravity-cli

engram tui

The contract with the agent is explicit: orient yourself with mem_context / mem_search before repeating work; record only what lasts (mem_save); close the session with mem_session_summary. It's not a transcript dump. The production README asks for the binary from the GitHub Releases; Homebrew covers the stable line.

If Claude Code, Codex, and Google's CLI need to remember the same decision, start here. The step-by-step covering installation, MCP, project name, and systemd is in Engram: persistent memory for agents on Linux.

Goldie — one pool, multiple agents

Goldie (MIT) replaces MEMORY.md with a shared SQLite file. Tools with the right vocabulary: remember, recall, update_memory, forget. Typed memories (user, feedback, project, reference…), a concept graph, local embeddings via MiniLM (ONNX Runtime) or Ollama.

# Linux amd64 — pegue o binário da release
curl -LO https://github.com/srfrog/goldie-mcp/releases/latest/download/goldie-mcp-linux-amd64
chmod +x goldie-mcp-linux-amd64
mv goldie-mcp-linux-amd64 ~/.local/bin/goldie-mcp

# MiniLM precisa do ONNX Runtime
sudo apt install libonnxruntime-dev   # Debian/Ubuntu

# ou pule o ONNX e use Ollama
ollama pull nomic-embed-text
claude mcp add -s user -e GOLDIE_DB_PATH=~/.local/share/goldie/index.db goldie goldie-mcp -- -b ollama

The “scope” is the file. Two agents using the same GOLDIE_DB_PATH share memory. Do not write from two machines at the same time if the .db is on Syncthing — the README is honest about this.

Rust: from single binary to memory server

ai-memory — versioned wiki and handoff

ai-memory (MIT, Rust) is the most structured option in this part of the list. Instead of each agent writing directly to the database, a server is the sole writer: it receives observations sanitized by hooks, maintains a Git-versioned Markdown wiki as the source of truth, and uses SQLite as a derived index (FTS5, entities, and optional vectors).

The workflow is capture → consolidate → retrieve → hand off. At the end of a session, observations can become readable wiki pages; in the next one, the agent receives a bounded handoff and can search the history. Capture, search, and handoff work without a key or LLM call; configuring a provider only adds consolidation and semantic search. This is an important difference from Engram and Leteo: ai-memory is a local HTTP/MCP service, not just a process that opens SQLite.

The documented path for Linux is Docker or Podman. Anyone already using mise can download the release binary with a checksum, without installing Rust:

mise use -g github:akitaonrails/ai-memory

# uma vez: cria o estado local; depois sobe MCP + API + hooks HTTP
ai-memory init
ai-memory serve --transport http --bind 127.0.0.1:49374

# em outro terminal, registre MCP e hooks para o cliente escolhido
ai-memory install-mcp --client claude-code --apply
ai-memory install-hooks --agent claude-code --apply

# para o Codex, troque claude-code por codex nos dois comandos

Claude Code, Codex, OpenCode, Gemini CLI, Grok Build, and several other clients have first-party integration. On a single machine, the server listens on loopback; for a team or homelab, it can run on a shared host with authentication and HTTPS. Choose ai-memory when the priority is explicit transitions between Claude, Codex, and other agents — or when you want to inspect and version memory as Markdown. For direct SQLite access and a smaller setup, Engram and Leteo remain simpler.

Leteo — the Engram in Rust

Leteo (MIT) is an independent Rust product derived from Engram's workflow and MIT implementation. One binary, SQLite in ~/.leteo/leteo.db, no API key, no server. Imports the Engram database with leteo import --from-engram.

curl -fsSL https://raw.githubusercontent.com/asanabrial/leteo/main/scripts/install.sh | sh
leteo tui
leteo setup claude-code --hooks
leteo setup codex

The Linux release files require glibc 2.34 — Debian 12, Ubuntu 22.04, RHEL 9 or newer. Claude Code plugin: /plugin marketplace add asanabrial/leteo and /plugin install leteo@leteo. Do not register the plugin and leteo setup --hooks at the same time: each event fires twice.

Subcog — true hybrid search

Subcog (MIT, Rust 1.88+) stacks three layers: SQLite as the source of truth, FTS5 (BM25), and HNSW vectors via usearch. Embeddings with all-MiniLM-L6-v2 through fastembed, 384 dimensions, without calling an API. RRF fusion. Knowledge graph with entities and relationships.

cargo install subcog
# ou: brew install zircote/tap/subcog

subcog capture --namespace decisions "Use PostgreSQL por causa do ACID"
subcog recall "decisão de banco"
subcog serve

Claude Code hooks: SessionStart, UserPromptSubmit, PostToolUse, PreCompact, Stop. This is the option if “remembering” needs to mean semantic search, not just grep in SQLite.

mcp-memory — graph + code in the same binary

mcp-memory (Apache-2.0) combines a knowledge graph, FTS5, vectors (usearch HNSW), and tree-sitter indexing for Rust, Python, JS/TS, Go, Java, C, C++, Ruby, and PHP. Tools are enabled by category: nothing is exposed until you pass --enable-graph-read / --enable-code / --enable-all.

cargo install mcp-memory
mcp-memory --transport stdio --enable-all

Useful when you want a process remembering project entities and the symbol map. It does not replace codebase-memory-mcp at kernel scale, but fits on a laptop without an extra daemon.

mcp-memory-rs — local notebook, no ML

mcp-memory-rs (Apache-2.0) stores agent state in JSON by category, with a SQLite FTS5 index. Every write is versioned. No model download, no embeddings. Synchronization between machines is an explicit step (Merkle manifest + HTTP), never a hidden dependency.

The offline default is the point: Claude Code and Codex point to the same binary, and state survives model changes. For corpora (chunked documents), the author points to the companion mcp-vl-msa-rs — this one is the notebook, not the library.

memory-server — when memory is a service

memory-server separates the pieces: the agent speaks MCP to memory-mcp, which calls memoryd over HTTP, which writes to PostgreSQL + pgvector and requests embeddings from Ollama (bge-m3 by default).

agent  --stdio-->  memory-mcp  --HTTP-->  memoryd
                                           |-- PostgreSQL + pgvector
                                           +-- Ollama

Fixed categories: context, decision, error_fix, plan, rule. It makes sense when a laptop and server need the same store — and you accept running Postgres 17 with pgvector. For a single laptop user, it is overkill.

C: SQLite extension and repository graph

sqlite-memory — memory as SQL

sqlite-memory (MIT) is a C extension: Markdown as the source of truth, heading-aware chunking, hybrid search (vectors + FTS5), local embeddings with llama.cpp. It is part of the SQLite AI family (sqlite-vector, sqlite-sync, sqlite-mcp…).

.load ./vector
.load ./memory
SELECT memory_set_model('local', '/path/to/nomic-embed-text-v1.5.Q8_0.gguf');
SELECT memory_add_directory('/path/to/docs', 'project-docs');
SELECT path, snippet, ranking FROM memory_search
 WHERE query = 'como o agente persiste contexto';

The Go CLI, sqlmem, wraps this in a project (sqlmem init, add, search) and exposes the tools via MCP. This is the path if you want to build your own layer, not install a ready-made product. Synchronization between agents uses CRDT from sqlite-sync — each works offline and merges later.

codebase-memory-mcp — the other memory

codebase-memory-mcp (MIT, pure C) is not an alternative to Claude-Mem. It indexes the repository into a knowledge graph: functions, classes, HTTP routes, who calls whom. Tree-sitter, 15 MCP tools, native binary. The preprint is on arXiv 2603.27277.

curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
# reinicie o agente e peça: index this project

Questions it answers that grep cannot: “who calls this function?”, “what is the blast radius of this diff?”, “where is this interface implemented?”. Usage details in the post on AI skills in the CLI. The happy path is both in the same agent: one remembers the conversation, the other remembers the code.

C++: the clone isn't ready yet

Among the projects on this list, there is no mature Claude-Mem equivalent whose primary implementation is C++. What exists in C++ serves as a component — llama.cpp for embeddings, SQLite, vector indexes — not as a session-memory product. codebase-memory-mcp analyzes C/C++ very well; its binary, however, is C.

Where to test on Linux

A practical order for Claude Code + Codex + whatever else is in your PATH:

  1. ai-memory (Rust) — when the main point is automatic handoff between Claude, Codex, and other agents, with a versioned Markdown wiki and a local server.
  2. Engram (Go) — one database, multiple agents, a TUI to inspect what was saved.
  3. mnemo (Go) — if what you want is Claude-Mem's hook cycle, without changing philosophy.
  4. Leteo (Rust) — the same workflow as Engram, a Rust binary, imports its .db database.
  5. Subcog (Rust) — when search really needs vectors + BM25.
  6. mcp-memory (Rust) — if you want a graph + code index in the same process.
  7. Goldie (Go) — shared pool, vocabulary remember/recall.
  8. sqlite-memory (C) — if the idea is to build your own layer on top of SQLite.

And, alongside it, not instead: codebase-memory-mcp.

          Claude Code / Codex / OpenCode
                       |
              +--------+--------+
              |                 |
              v                 v
     memória de sessão    memória do código
     Engram / mnemo /     codebase-memory-mcp
     Leteo / Subcog              |
              |                  v
              v            knowledge graph
         SQLite + FTS5         (tree-sitter)
              |
              +--------+--------+
                       v
              contexto persistente

This way, the next morning's agent already knows that authentication is JWT with refresh, and can point to the handler.go without rereading the repo.

What not to outsource

Persistent memory is not a backup of the truth. Git remains the record; the history is in The history of Git. What goes into SQLite is decisions, conventions, costly bugs — not passwords, not tokens, not a dump of journalctl. Serious projects have a <private> tag or secret filter; if the one you chose does not, do not store anything that cannot be leaked.

And do not install three memory servers in the same agent “just in case.” They compete for context. One for sessions + the code graph is already the useful ceiling.

Closing

Claude-Mem demonstrated the format: lifecycle hooks, local state, and MCP for queries. Go and Rust already deliver this in a single binary; Rust also offers ai-memory's server + versioned wiki approach. C delivers the extension and the code graph. C++ is still a component, not a product. Choose based on the question that hurts today — “the agent forgot the decision,” “I need to hand the work to another agent,” or “the agent cannot find the function” — and add only the tool that answers that question.

Repositories: claude-mem · mnemo · Engram · ai-memory · Goldie · Leteo · Subcog · mcp-memory · mcp-memory-rs · memory-server · sqlite-memory · codebase-memory-mcp. Docs: docs.claude-mem.ai · engram.gentlemanprogramming.com.

Go Gopher designed by Renée French (CC BY 3.0). Ferris, Rust's unofficial mascot, by Karen Rustad Tölva.