ai-setup 5 min read

Mengram – Open-Source Memory Layer for AI Agents

Persistent memory across Claude Code, Cursor, and ChatGPT. Mengram stores facts, episodes, and procedures that survive every /clear.

By
Share: X in
Mengram AI memory layer for AI agents product thumbnail

TL;DR

TL;DR: Mengram is an open-source memory layer for AI agents. It stores facts, event episodes, and procedural workflows that survive every /clear — one memory shared across Claude Code, Cursor, Codex, and ChatGPT.

Source and Accuracy Notes

What Is Mengram?

AI agents forget everything after each conversation. Clear your Claude Code session and every learned preference, tech stack detail, and workflow is gone. Mengram fixes that by maintaining a persistent memory store your agents query at runtime.

Mengram stores three types of memory:

  • Facts — static knowledge (“I use Python and deploy to Railway”)
  • Episodes — events and interactions (“deployment failed on 2026-07-28 due to missing env var”)
  • Procedures — workflows that evolve from failures (“to deploy, always check env vars first”)

Agents search this memory on every query. The result is continuity that survives /clear, context resets, and new sessions.

Setup Workflow

Step 1: Install

pip install mengram-ai
```bash

npm is also available:

```bash
npm install mengram-ai
```bash

### Step 2: Get an API key

Sign up at [mengram.io/#signup](https://mengram.io/#signup) for a free key.

### Step 3: Add your first memory

```python
from mengram import Mengram
m = Mengram(api_key="om-...")

m.add([{"role": "user", "content": "I use Python and deploy to Railway"}])
```bash

### Step 4: Search and ask

```python
m.search("tech stack")           # → facts
m.ask("what's my tech stack?")   # → synthesized answer + citations
m.episodes(query="deployment")  # → events
m.procedures(query="deploy")    # → workflows learned from failures
```bash

### Step 5: Agent install in one prompt

Paste this into any agent (Claude Desktop, Cursor, Codex, Claude Code, Windsurf):

```bash
Install Mengram for me. Fetch the canonical install guide at
https://mengram.io/agent-install.txt and follow it precisely.
My email is YOUR_EMAIL_HERE.

The agent fetches the install guide, installs the SDK, configures the MCP server, and verifies round-trip — no manual terminal work required.

Key Features

FeatureDetails
Multi-agentOne memory store shared across Claude Code, Cursor, Codex, ChatGPT
Memory typesFacts, episodes (events), procedures (evolved workflows)
Multilingual23 languages — ask in Russian, Chinese, Spanish, Japanese
EmbeddingsCohere multilingual embeddings + rerank
Agent installOne-prompt setup inside any compatible AI tool
MCP serverConfigurable via agent install guide
LicenseApache 2.0 (open-source)
Local try modemengram try — works offline, nothing leaves your machine

Practical Evaluation Checklist

  • pip install mengram-ai succeeds
  • mengram try runs locally without an API key
  • Free API key obtained from mengram.io
  • m.add() stores a fact and m.search() retrieves it
  • m.ask() returns a synthesized answer with citations
  • Agent install prompt works in Claude Code or Cursor
  • Memory persists across a /clear in Claude Code

Security Notes

  • The local mengram try mode requires no API key and makes no network calls
  • API key is required only when using cloud sync and retrieval features
  • Mengram stores memory facts on their servers — review their privacy policy before storing sensitive project details
  • MCP server configuration requires outbound HTTPS access to mengram.io

FAQ

Q: How is this different from Kinic or MemoryGate? A: Mengram organizes memory into three distinct types (facts, episodes, procedures) and emphasizes cross-agent sharing — the same memory is available in Claude Code, Cursor, Codex, and ChatGPT simultaneously. It also supports a fully offline “try” mode.

Q: Is there a free tier? A: Yes. A free API key is available at mengram.io/#signup. The mengram try local mode requires no key at all.

Q: Does it work with self-hosted models? A: Mengram uses Cohere embeddings for retrieval. The agent-side SDK works with any LLM that calls the Mengram API. Self-hosted model compatibility depends on how the agent is configured.

Q: What languages are supported? A: 23 languages via Cohere multilingual embeddings — including English, Russian, Chinese, Spanish, Japanese, and more.

Q: Can I self-host Mengram? A: The core SDK is open-source (Apache 2.0). The hosted memory store is a SaaS product. Self-hosting the full stack is not documented in the current README.

Conclusion

Mengram solves the memory problem that every AI agent user hits eventually: you spend 20 minutes teaching Claude Code your project’s quirks, then /clear wipes it all. The fact/episodes/procedures taxonomy is more structured than a simple vector store, and the cross-agent sharing means your memory works everywhere, not just in one tool.

The one-prompt agent install is the killer feature for power users — paste it into any session and the agent handles the setup itself.