
Mengram
io.github.alibaizhanov由 GitHub 账号 alibaizhanov 发布v2.25.4更新于 Oct 26, 2026
Long-term memory for AI agents: semantic facts, episodic events, and procedural workflows
概览
Mengram 是面向 AI 智能体的托管长期记忆服务,让助手跨会话存储、检索和回忆事实、事件与工作流程。
- 可以做什么
- 添加与检索记忆:存入对话或文本,取回语义事实、情景事件和流程工作流,并支持三类统一搜索。
- 向记忆提问:获得带引用来源的综合答案,并生成可用作系统提示词的认知画像。
- 管理流程:上报步骤结果使工作流演进为新版本,并查看版本历史与前置条件。
- 导入与整理:导入 Claude Code 历史、ChatGPT 导出、Obsidian 库或文件,并按 agent、app 等元数据过滤结果。
- 账户与自动化:查看配额用量、为记忆变更注册 webhook,并运行 curator、connector、digest 等记忆代理。
- 适用场景
- 适合需要助手在不同会话、机器或智能体之间记住用户偏好、过往决策和工作流程的场景,也适合多个智能体共享同一份记忆。对压缩后丢失上下文的编码智能体,以及希望跨 Claude Code、Codex、Cursor 保持回忆的团队尤其有用。
- 运行要求
- 通过 streamable HTTP 连接 mengram.io 远程端点,使用 OAuth 与 Authorization bearer API 密钥,提供商提供免费密钥。部分功能(如综合问答)需要付费套餐。可选的 CLI 与 SDK 需另行安装,远程服务器本身不需要。
安装
在 SourceWeft 中
- 打开 控制台中的 Mengram,将其添加到工作区。
- 连接 所需的 凭据。它们会被私密存储,绝不会在公开页面上展示。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
交给智能体安装
把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。
阅读 https://sourceweft.com/mcp/io.github.alibaizhanov%2Fmengram/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。 客户端会在首次连接时完成 OAuth 登录。
{
"mcpServers": {
"mengram": {
"type": "http",
"url": "https://mengram.io/mcp"
}
}
}README
Give your AI agents memory that actually learns
[GitHub stars] [PyPI] [npm] [License: Apache 2.0] [PyPI Downloads] [Last commit]
Website · Get API Key · Docs · Console · Examples
Native multilingual: ask in Russian, Chinese, Spanish, Japanese — Mengram retrieves and answers across 23 languages (Cohere multilingual embeddings + rerank).
Install in one prompt (any AI tool)
Paste this into Claude Desktop, Cursor, Codex, Claude Code, or Windsurf — the agent reads our setup guide, installs the SDK, configures the MCP server, and verifies the round-trip end-to-end. No terminal context-switching.
Works in any agent with shell + file-edit + web-fetch tools. Prefer doing it manually? See the plain-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.
What happens:
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 setup does the same via mengram hook install.
Same memory in Codex and Cursor
Codex and Cursor fire the same lifecycle events, so the same hooks run there — one memory across all three. mengram setup finds them on your machine and installs their hooks; or add them one by one:
Cursor has no per-prompt context hook (beforeSubmitPrompt can only allow or block), so mid-conversation recall there is on request via the MCP tools; session start and compaction are automatic.
Every fact remembers which tool wrote it and when, and recall shows it: deploys to Fly.io from main (codex, 2026-09-15). Each hook also tells the server which OS and tool it runs under, so a workspace path recorded on your Mac never reaches a Claude Code session on a Linux box, and a Cursor settings fact never reaches Codex — those are left out and counted (facts_left_out_for_host).
Pick a task up where it was left — mengram resume
When an agent stops, the hooks write a task card for the repository and branch: files touched, last commands, the last test run and the commit it ran on, plus the agent's draft of the task, what is done and what remains. The next session on that branch — tomorrow, another agent in another worktree of it, another machine — gets it first, and is told when the code has moved since the last check. A session on a branch with no card of its own (a fresh Orca worktree, say) is only told that cards exist, since another branch's card is usually another agent's task; mengram resume shows it on request:
mengram resume --open serves a local page to correct the card, confirm it (confirmed text is never redrafted), pick another task or copy the context for a new session. The card lives in ~/.mengram/resume/ and needs no account; only the draft of task/done/remaining uses a model.
No account? Keep the memory in a folder
The folder is the memory: a memfmt tree of Markdown you own — git diffs it, Obsidian draws it, memfmt validate checks it. Same procedures-with-outcomes as the cloud: versions, success/fail counts per step, the policy gate, and the regression gate that quarantines a fix that would break another workflow. Only extraction and a failure revision need a model, and that one you bring. Nothing expires and nothing asks for a key. Docs.
Local search matches words in Unicode text, including Russian; it does not use embeddings or translate queries. Multiple Mengram sessions coordinate writes with a folder lock and merge independent additions. Conflicting edits require a reload instead of overwriting another session. Each changed file is replaced atomically, but the whole folder is not a single crash-atomic transaction, and external editors do not participate in the lock.
Why Mengram?
Every AI memory tool stores facts. Mengram stores 3 types of memory — and procedures evolve when they fail.
Get Started in 30 Seconds
1. Install
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 at mengram.io and export MENGRAM_API_KEY=om-...
3. Use
File Upload (PDF, DOCX, TXT, MD)
JavaScript / TypeScript
REST API (curl)
3 Memory Types
Semantic — facts, preferences, knowledge
Episodic — events, decisions, outcomes
Procedural — workflows that evolve
This happens automatically when you report failures:
Every failure-driven revision records which assumption turned out false — not just which step broke — and derives a precondition that travels with the procedure at recall time:
An agent loading v3 doesn't repeat the two mistakes that produced it — and knows what to verify before trusting the workflow.
Or fully automatic — just add conversations and Mengram detects failures and evolves procedures:
Ask Your Memory (RAG built-in)
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.
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).
Cognitive Profile
One API call generates a system prompt from all memories:
Insert into any LLM's system prompt for instant personalization.
Import Existing Data
Kill the cold-start problem:
Integrations
Multi-User Isolation
One API key, many users — each sees only their own data:
Async Client
Non-blocking Python client built on httpx:
Install with pip install mengram-ai[async].
Metadata Filters
Filter search results by metadata:
Webhooks
Get notified when memories change:
Agent Templates
Clone, set API key, run in 5 minutes:
Use with AI Agents
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.
Works with any agent framework — CrewAI, LangChain, AutoGPT, custom loops. The agent just calls add() after actions and search() before decisions.
Self-Hosted (Ollama)
When running locally with Ollama, use models with 8B+ parameters and 8K+ context window. The extraction prompt is ~4,000 tokens — smaller models will hallucinate or mix examples with real data.
API Reference
Full interactive docs: mengram.io/docs
Quota Headers
Every authenticated response includes usage headers:
SDKs expose this via .quota:
Community
- 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
Star History
[Star History Chart]License
Apache 2.0 — free for commercial use.
Get your free API key · Built by Ali Baizhanov · mengram.io
来源:README.md,提交 88a50ab
工具
0版本历史
1- v2.25.4最新Sep 16, 2026
评分
已满足适用检查项的 85%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通必需25 分
- 已声明认证方式必需10 分
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分