Disclosure: I built Mengram. MIT-licensed ( github.com/alibaizhanov/mengram ). There’s a free hosted tier (40 adds, 200 searches/mo) and paid tiers from $5/mo. Self-host is fully supported — no degraded free version, same code, your own Postgres. Posting this as a tutorial because Claude Code session amnesia is the specific problem this solves. The problem Every new Claude Code session starts blank. CLAUDE.md helps for project rules but is static — it doesn’t capture “user prefers Postgres Session Mode pooler because Transaction Mode breaks psycopg2” or “we already tried the LRU cache, it caused a deadlock under concurrent writes.” Setup (3 commands) Bash pip install mengram mengram signup --email you@example.com mengram doctor # round-trip test The signup command prints your MCP config block. For Claude Code, append it to your MCP settings (location varies by platform — claude mcp add or edit your config file directly): JSON { “mcpServers”: { “mengram”: { “type”: “http”, “url”: “https://mengram.io/mcp”, “headers”: { “Authorization”: “Bearer <your-key>” } } } } Restart Claude Code. You’ll see 30 tools available: add , recall , search , profile , reflect , dedup , procedures , plus graph/agent tools. What changes Inside Claude Code, after a debugging session: You: “Remember that the supersession bug fix removed ‘DUPLICATED or redundant’ from the prompt, and now check_and_increment must run BEFORE the LLM call to avoid double-charging quota on retry.” Mengram extracts the entities ( supersession bug , check_and_increment ), the fact, and the procedural pattern. Next session, when you ask “what did we decide about the supersession fix,” Claude Code calls search and gets it back. Retrieval — why it’s not just vector search Pure vector similarity ranks “I bought milk in 2019” the same as “I bought milk yesterday.” Mengram layers: Hybrid retrieval : vector (pgvector) + BM25 + Reciprocal Rank Fusion Ebbinghaus decay on facts : $decay = e^{-0.03 \cdot days_since_last_access}$, ~23-day half-life. Source: Murre & Dros 2015 (PLOS ONE). Importance weighting on episodes : bounded [0.8, 1.2] boost from Stanford Generative Agents paper (Park et al. 2023). Bounded so importance can’t override semantic match. Honest limitations Cloud is the default. Self-host works but needs Postgres + OpenAI key setup. If you’re privacy-first and don’t want any external service, this isn’t the lowest-friction option (look at Letta Code). Free tier is real but capped at 40 adds/mo. If you use Claude Code heavily, you’ll hit it. No local-only embeddings yet. Uses OpenAI text-embedding-3-large . Question for the community How are you handling memory across Claude Code sessions today? CLAUDE.md
- manual notes? Cursor-style rules? Another MCP server? Curious if there’s something I should benchmark against — I’ve compared retrieval against pure vector but not against Letta or Cognee on Claude Code-specific workflows yet. Repo: github.com/alibaizhanov/mengram submitted by /u/No_Advertising2536
Originally posted by u/No_Advertising2536 on r/ClaudeCode
