Mengram provides AI agents with a human-like memory system, whose core feature is storing three different types of memory, and procedural memory is able to learn from failures and continuously evolve.
Purpose
Mengram solves the problem of AI agents lacking persistent memory and having to relearn in every session. It can serve as a persistent memory backend, allowing agents to call add() after each action to store what they have learned, and to call search() before the next decision to recall it, thereby gradually becoming smarter. It is suitable for any agent framework, including CrewAI, LangChain, AutoGPT, and custom loops.
Main Capabilities
- Three types of memory: semantic memory (facts, preferences, knowledge), episodic memory (events, decisions, outcomes), and procedural memory (evolvable workflows).
- Failure-driven procedure evolution: when a failure is reported, the system records the failed steps and disproven assumptions, and derives preconditions, which are passed along with the procedure at recall time; when the agent loads the new version, it will not repeat the same mistakes and knows what needs to be verified before trusting the workflow. Failures can also be automatically detected and the procedure evolved.
- Ask Your Memory (built-in RAG): m.ask() returns a synthesized answer with citations, rather than a raw list of facts. It supports asking questions in 23 languages and answering in the same language, and citations can link back to facts stored in the original language. This is an advanced feature (Pro / Growth / Business).
- Cognitive profile: a single API call can generate a system prompt from all memories, which can be inserted into any LLM's system prompt for instant personalization.
- Import existing data to solve the cold-start problem.
- Multi-user isolation: one API key corresponds to multiple users, and each user can only see their own data.
- Metadata filtering and memory change notifications.
- Non-blocking Python client (based on httpx), requires pip install mengram-ai[async].
- Agent templates: clone, set the API key, and run in 5 minutes.
How to Use
- One-line prompt installation: paste the setup prompt into Claude Desktop, Cursor, Codex, Claude Code, or Windsurf, and the agent will read the installation guide, install the SDK, configure the MCP server, and verify end to end. It works with any agent that has shell, file editing, and web scraping tools.
- ManActivation method: pip install mengram-ai && mengram setup, which completes in one go the account, Claude Code hooks, MCP configuration for detected tools (Cursor, Claude Desktop, Windsurf), history import, and round-trip check.
- Manual key retrieval: get it at mengram.io, then export MENGRAM_API_KEY=om-...
- Claude Code automatic memory hooks: includes 5 hooks—load profile at startup, recall on each prompt, save after response, policy gating before workflow-shaped Bash commands, and write back results after each step runs. Memory persists after /clear, auto-compaction, switching machines, and team handoff; the SessionStart hook fires after each compaction and re-injects context.
- Codex and Cursor: trigger the same lifecycle events, so the same set of hooks runs in them, achieving one shared memory across all three ends. Cursor has no per-prompt context hook (beforeSubmitPrompt can only allow or block), so in-conversation recall must be requested on demand via MCP tools; session startup and compaction are automatic.
- MCP server: for Claude Desktop, Cursor, Codex, Windsurf, Cline, providing 30 memory management tools.
- LangChain: pip install langchain-mengram, automatic recall before each turn and automatic capture after, including 12 tools, slash commands, and Graph RAG.
- CLI: full command-line interface.
- Claude Managed Agents: provides MCP memory for managed agents, 30 memory tools.
- n8n: drag memory into any workflow via HTTP nodes, no code required.
- Self-hosting (Ollama): when running locally, models with 8B+ parameters and an 8K+ context window should be used. The extraction prompt is about 4000 tokens, and smaller models will hallucinate or confuse examples with real data.
Applicable scenarios
- Persistent agent memory, retaining context across sessions and across machines.
- Claude Code retains memory after /clear and auto-compaction, with no manual saving or tool calls needed.
- Task continuation: mengram resume writes a task card by repository and branch when the agent stops (files involved, last command, last test and its commit, task draft, completed and remaining parts). The next session on the same branch (including an agent in another worktree or another machine) gets that card first and is prompted whether the code has changed. If a branch has no card of its own, it is only told that a card exists. mengram resume --open can launch a local page to correct, confirm the card, choose another task, or copy context. Cards are located in ~/.mengram/resume/, no account required, and only the task/completed/remaining draft needs the model.
- Account-free local mode: the folder is the memory, using memfmt's Markdown tree, viewable with git diff and Obsidian, and validated with memfmt validate. It has the same procedure and result records as the cloud: versions, per-step success/failure counts, policy gating, and regression gating that isolates fixes that might break other workflows. Local search matches Unicode text words (including Russian), without using embeddings or translating queries. Multiple Mengram sessions coordinate writes via folder locks.
Limitations
- In Cursor, per-prompt automatic recall is not possible; it must be requested on demand via MCP tools.
- Policy gating only triggers queries for workflow-shaped commands, and memory can only ask, not refuse execution.
- The local folder mode as a whole is not a single-crash atomic transaction, and external editors do not participate in the lock.
- Self-hosted Ollama requires a larger model, otherwise it will hallucinate.
- Local search does not translate queries and does not support cross-language semantic retrieval.
- Some features such as Ask Your Memory and cognitive profiles are paid premium features.
- Specific pricing and more details are not yet provided.