Mengram

by alibaizhanov

Not rated
GitHub

About

Human-like memory layer for AI agents with semantic, episodic, and procedural memory types, cognitive profiling, knowledge graph, and 12 MCP tools.

Details

Author
alibaizhanov
Categories
Cloud Service, AI, Knowledge Base

Setup

Install Mengram in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/alibaizhanov/mengram

Follow the installation instructions in the repository README, then restart your MCP client.

Give your AI agents memory that actually learns

Website·Get API Key·Docs·Console·Examples

pip install mengram-ai # or: npm install mengram-ai mengram try # see what memory would know about you — local only, # no account, nothing leaves your machine
from mengram import Mengram m = Mengram(api_key="om-...") # Free key → mengram.io m.add([{"role": "user", "content": "I use Python and deploy to Railway"}]) 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 that evolve from failures

Native multilingual: ask in Russian, Chinese, Spanish, Japanese — Mengram retrieves and answers across 23 languages (Cohere multilingual embeddings + rerank).

Paste this into Claude Desktop, Cursor, Codex, Claude Code, or Windsurf — the agent reads oursetup guide, installs the SDK, configures the MCP server, and verifies the round-trip end-to-end.No terminal context-switching.

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.

Works in any agent with shell + file-edit + web-fetch tools. Prefer doing it manually? See theplain-text guide— it's structured for human eyes too.

Claude Code — Memory That Survives /clear AND Auto-Compaction

Persistent memory that survives/clear,auto-compaction, machine switches, and team handoffs — the SessionStart hook fires after every compact and re-injects your context. The summary can be lossy; the memory isn't.

# 1. Get a free key at https://mengram.io and save it once mkdir -p ~/.mengram && echo '{"api_key": "om-your-key-here"}' > ~/.mengram/config.json # 2. Install the plugin (hooks + MCP server + skill) claude plugin marketplace add alibaizhanov/mengram claude plugin install mengram@mengram # 3. Skip the cold start — import your existing session history # (secrets are redacted on your machine before anything is uploaded) mengram import claude-code
Session Start → Loads your cognitive profile (fires after /clear, compaction, and restarts) Every Prompt → Searches past sessions for relevant context (auto-recall) After Response → Saves new knowledge in background (auto-save)

No manual saves. No tool calls. Claude just knows what you worked on yesterday — even after compaction ate the transcript.

Prefer CLI-managed hooks instead of the plugin?pip install mengram-ai && mengram setupdoes the same viamengram hook install.

Every AI memory tool stores facts. Mengram stores3 types of memory— and proceduresevolve when they fail.

2. Setup— one command does everything: account, Claude Code hooks, MCP configs for detected tools (Cursor, Claude Desktop, Windsurf), history import, and a round-trip check

Or get a key manually atmengram.ioandexport MENGRAM_API_KEY=om-...

from mengram import Mengram m = Mengram(api_key="om-...") # Add a conversation — auto-extracts facts, events, and workflows m.add([ {"role": "user", "content": "Deployed to Railway today. Build passed but forgot migrations — DB crashed. Fixed by adding a pre-deploy check."}, ]) # Search across all 3 memory types at once results = m.search_all("deployment issues") # → {semantic: [...], episodic: [...], procedural: [...]}
# Upload a PDF — auto-extracts memories using vision AI result = m.add_file("meeting-notes.pdf") # → {"status": "accepted", "job_id": "job-...", "page_count": 12} # Poll for completion m.job_status(result["job_id"])
// Node.js — pass a file path await m.addFile('./report.pdf'); // Browser — pass a File object from <input type="file"> await m.addFile(fileInput.files[0]);
# REST API curl -X POST https://mengram.io/v1/add_file \ -H "Authorization: Bearer om-..." \ -F "file=@meeting-notes.pdf" \ -F "user_id=default"
const { MengramClient } = require('mengram-ai'); const m = new MengramClient('om-...'); await m.add([{ role: 'user', content: 'Fixed OOM by adding Redis cache layer' }]); const results = await m.searchAll('database issues'); // → { semantic: [...], episodic: [...], procedural: [...] }
# Add memory curl -X POST https://mengram.io/v1/add \ -H "Authorization: Bearer om-..." \ -H "Content-Type: application/json" \ -d '{"messages": [{"role": "user", "content": "I prefer dark mode and vim keybindings"}]}' # Search all 3 types curl -X POST https://mengram.io/v1/search/all \ -H "Authorization: Bearer om-..." \ -d '{"query": "user preferences"}'

Semantic — facts, preferences, knowledge

m.search("tech stack") # → ["Uses Python 3.12", "Deploys to Railway", "PostgreSQL with pgvector"]
m.episodes(query="deployment") # → [{summary: "DB crashed due to missing migrations", outcome: "resolved", date: "2025-05-12"}]
Week 1: "Deploy" → build → push → deploy ↓ FAILURE: forgot migrations Week 2: "Deploy" v2 → build → run migrations → push → deploy ↓ FAILURE: OOM Week 3: "Deploy" v3 → build → run migrations → check memory → push → deploy ✅

This happensautomaticallywhen you report failures:

m.procedure_feedback(proc_id, success=False, context="OOM error on step 3", failed_at_step=3) # → Procedure evolves to v3 with new step added

Every failure-driven revision recordswhich assumption turned out false— not just which step broke — and derives a precondition that travels with the procedure at recall time:

{ "version": 3, "violated_assumption": "the build container had enough memory for a full build", "preconditions": ["check available memory before building"], "success_count": 11, "fail_count": 2 }

An agent loading v3 doesn't repeat the two mistakes that produced it — and knows what to verify before trusting the workflow.

Orfully automatic— just add conversations and Mengram detects failures and evolves procedures:

m.add([{"role": "user", "content": "Deploy failed again — OOM on the build step"}]) # → Episode created → linked to "Deploy" procedure → failure detected → v3 created

m.ask()returns a synthesized answer with citations — not a raw fact list. Mengram embeds your query, retrieves the top relevant facts, and uses Cohere Chat to write a grounded answer with native source attribution.

result = m.ask("what programming languages do I use?") print(result["answer"]) # 'You use Python and Rust. Python is your daily language [1] and # Rust is your favorite [2]. You also know Java for enterprise # systems [3].' for cit in result["citations"]: print(f' "{cit["text"]}" → {cit["sources"][0]["fact"]}') # "Python and Rust" → uses Python daily for backend development # "favorite [2]" → Rust is favorite language # "Java" → specializes in Java/Spring Boot

Multilingual: ask in any of 23 languages, get an answer in the same language with citations linking back to facts in the original language they were stored. Premium feature (Pro / Growth / Business).

One API call generates a system prompt from all memories:

profile = m.get_profile() # → "You are talking to Ali, a developer in Almaty. Uses Python, PostgreSQL, # and Railway. Recently debugged pgvector deployment. Prefers direct # communication and practical next steps."

Insert into any LLM's system prompt for instant personalization.

mengram import chatgpt ~/Downloads/chatgpt-export.zip --cloud # ChatGPT history mengram import obsidian ~/Documents/MyVault --cloud # Obsidian vault mengram import files notes/*.md --cloud # Any text/markdown

3 hooks: profile on start, recall on every prompt, save after responses. Zero manual effort.

MCP Server— Claude Desktop, Cursor, Codex, Windsurf, Cline

{ "mcpServers": { "mengram": { "command": "mengram", "args": ["server", "--cloud"], "env": { "MENGRAM_API_KEY": "om-..." } } } }

LangChainpip install langchain-mengram

from langchain_mengram import ( MengramRetriever, MengramChatMessageHistory, ) retriever = MengramRetriever(api_key="om-...") docs = retriever.invoke("deployment issues")
from integrations.crewai import create_mengram_tools tools = create_mengram_tools(api_key="om-...") # → 5 tools: search, remember, profile, # save_workflow, workflow_feedback agent = Agent(role="Support", tools=tools)
openclaw plugins install openclaw-mengram

Auto-recall before every turn, auto-capture after. 12 tools, slash commands, Graph RAG.

mengram search "deployment" --cloud mengram profile --cloud mengram import chatgpt export.zip --cloud mengram hook install

Claude Managed Agents— MCP memory for hosted agents

{ "mcp_servers": [{ "type": "url", "name": "mengram", "url": "https://mengram.io/mcp/sse" }] }
POST https://mengram.io/v1/add POST https://mengram.io/v1/search

No code needed — drag and drop memory into any n8n workflow.

One API key, many users — each sees only their own data:

m.add([...], user_id="alice") m.add([...], user_id="bob") m.search_all("preferences", user_id="alice") # Only Alice's memories m.get_profile(user_id="alice") # Alice's cognitive profile

Non-blocking Python client built on httpx:

from mengram import AsyncMengram async with AsyncMengram() as m: await m.add([{"role": "user", "content": "I use async/await"}]) results = await m.search("async") profile = await m.get_profile()

Install withpip install mengram-ai[async].

results = m.search("config", filters={"agent_id": "support-bot", "app_id": "prod"})
m.create_webhook( url="https://your-app.com/hook", event_types=["memory_add", "memory_update"], )
cd examples/devops-agent && pip install -r requirements.txt export MENGRAM_API_KEY=om-... python main.py

Mengram works as a persistent memory backend for autonomous agents. Your agent stores what it learns, and recalls it on the next run — getting smarter over time.

from mengram import Mengram m = Mengram(api_key="om-...") # Agent completes a task → store what happened m.add([ {"role": "user", "content": "Apply to Acme Corp on Greenhouse"}, {"role": "assistant", "content": "Applied successfully. Had to use React Select workaround for dropdowns."}, ]) # → Extracts: fact ("applied to Acme Corp"), episode ("Greenhouse application"), # procedure ("React Select dropdown workaround") # Next run → agent recalls what worked before context = m.search_all("Greenhouse application tips") # → Returns past procedures, failures, and successful strategies # Report outcome → procedures evolve m.procedure_feedback(proc_id, success=False, context="Dropdown fix stopped working") # → Procedure auto-evolves to a new version

Works with any agent framework — CrewAI, LangChain, AutoGPT, custom loops. The agent just callsadd()after actions andsearch()before decisions.

When running locally with Ollama, use models with8B+ parametersand8K+ context window. The extraction prompt is ~4,000 tokens — smaller models will hallucinate or mix examples with real data.

Every authenticated response includes usage headers:

m.search("test") print(m.quota) # {"add": {"used": 5, "limit": 30}, "search": {"used": 12, "limit": 100}}

- GitHub Issues— bug reports, feature requests
-
GitHub Discussions— show your use case, ask questions
-
API Docs— interactive Swagger UI
-
Examples— ready-to-run agent templates

Get your free API key· Built byAli Baizhanov·mengram.io

Adaptive MCP memory system for AI applications. Learns which retrieval strategies work for your data, scores results using cognitive science models, builds a knowledge graph automatically, and validates every parameter change against real query history before adopting it. Patent pending.

Persistent memory for AI agents. Single SQLite file, 192 MCP tools. FTS5 search, knowledge graph, session handoffs, write gate. No server, no API keys, no LLM calls.

Highly efficient context management for agentic AI: MCP code search, evidence packs, graph context, and memory for large projects.

Self-hosted Rust-based MCP server for AI agent memory — persistent, queryable memory with hybrid search, knowledge graphs, built-in embeddings, and 14 core tools (expandable to 86+ with profile-based tiering).

Authenticated MCP and agent gateway for Forge Cascade private AI memory, provenance, graph search, and capsule lineage.

MCP memory server with Hebbian learning — concept connections strengthen through co-activation and weaken through disuse.

A knowledge graph server that provides persistent, multi-context memory for AI models.

Self-improving MCP memory server for AI agents. One command, no cloud, no config. Hybrid search, feedback loop quality system, dashboard UI, auto-linking knowledge graph. Gets better the more you use it.

Provides persistent memory for AI models using a local knowledge graph.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.