Claude Code is powerful, but it forgets everything when you start a new session. Your tech stack, your project structure, yesterday's debugging session — all gone. Let's fix that.
The problem
Every Claude Code session starts from zero. Claude doesn't know:
- Who you are or what you're working on
- What you discussed yesterday
- What bugs you fixed last week
- Your preferred tools, frameworks, and patterns
Some tools like claude-mem save conversations to files, but they never recall that information. Saving without retrieval is like a brain that records but never remembers.
The solution: Full memory loop
Mengram installs 3 Claude Code hooks that create a complete memory loop:
pip install mengram-ai
mengram setup
That's it — signup, key saving, and hook install all happen in the terminal. Here's what happens automatically:
Session Start → Loads your cognitive profile
(who you are, preferences, tech stack)
Every Prompt → Searches past sessions for relevant context
(auto-recall via UserPromptSubmit hook)
After Response → Saves new knowledge in background
(auto-save via Stop hook, async)
How it works under the hood
1. Session Context (SessionStart hook)
When you start Claude Code, the mengram auto-context hook fires. It calls the Mengram API to load your Cognitive Profile — a system prompt generated from everything Mengram knows about you. Claude sees this as context before your first message.
2. Auto-Recall (UserPromptSubmit hook)
On every prompt you type, mengram auto-recall searches your memory for relevant context. If you ask about "deployment issues," it finds facts about your deployment setup, past incidents, and relevant procedures. This context is injected via Claude Code's additionalContext mechanism — Claude sees it and uses it naturally.
3. Auto-Save (Stop hook)
After Claude responds, mengram auto-save runs in the background (async). It sends the conversation to Mengram's API, which extracts entities, facts, events, and workflows. By default it saves every 3rd response to avoid noise — configurable with mengram hook install --every 5.
Managing hooks
mengram hook status # Check what's installed
mengram hook uninstall # Remove all hooks
mengram hook install --every 5 # Save every 5th response
Why not just use claude-mem?
claude-mem saves conversations to local Markdown files. That's useful for logging, but:
- No recall — it never searches past sessions or injects context
- No profile — Claude doesn't know who you are on session start
- No semantic search — you can't find relevant memories by meaning
- No structure — raw conversation dumps vs. extracted entities, facts, and workflows
- Local only — no sync across devices or tools
See the full comparison.
Works beyond Claude Code
The same memory is accessible via:
- MCP Server (29 tools) — Claude Desktop, Cursor, Windsurf
- LangChain & CrewAI integrations
- Python & JavaScript SDKs
- REST API (90+ endpoints)
Your memory follows you across every tool.
Get started
pip install mengram-ai
mengram setup
Restart Claude Code. That's it — Claude remembers now.