
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 分