/ 目錄 / 演練場 / Memorix
● 社群 AVIDS2 ⚡ 即開即用

Memorix

作者 AVIDS2 · AVIDS2/memorix

一個記憶體儲存,多個程式碼 Agent 共用——讓 Claude Code、Cursor、Codex、Windsurf 都能共享上下文,不再每天重複說「我們用 pnpm 和 tsx」。

Memorix 是一個小型 MCP 伺服器,維護一個僅能附加的結構化記憶體儲存,並將其公開給每個支援 MCP 的程式碼 Agent。只需新增一個事實一次(例如「auth 在 /apps/api/src/auth,不是已棄用的 /legacy/auth」),任何連接的 Agent 都能讀取它。設計上不會讓你被鎖定——預設使用本地檔案後端,可選雲端同步。

為什麼要用

核心特性

即時演示

實際使用效果

memorix-mcp.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "memorix-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "memorix"
      ]
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "memorix-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "memorix"
      ]
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "memorix-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "memorix"
      ]
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "memorix-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "memorix"
      ]
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "memorix-mcp",
      "command": "npx",
      "args": [
        "-y",
        "memorix"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "memorix-mcp": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "memorix"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add memorix-mcp -- npx -y memorix

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: Memorix

跨所有程式碼 Agent 共享專案慣例,不再重複說明

👤 同時使用多個 AI 程式碼工具的開發者 ⏱ ~15 min beginner

何時使用: 你在第一天向 Cursor、Claude Code 和 Codex 分別說明了相同的 monorepo 結構,卻忘記哪個知道什麼。

前置條件
  • Memorix 正在執行npx memorix——預設使用 ~/.memorix.db
步驟
  1. 建立記憶
    Save these facts about my project: package manager pnpm, runtime node 22, db postgres 16, auth in /apps/api/src/auth (not /legacy/auth).✓ 已複製
    → 5 條記憶已附加並打上標籤
  2. 在另一個 Agent 中召回
    (in Cursor with same Memorix) — What conventions are set for this project?✓ 已複製
    → 返回相同的 5 條記憶
  3. 更新其中一條
    Update memory: now using node 24 (was 22). Keep history.✓ 已複製
    → 已更新;歷史以修訂版本保留

結果: 專案上下文跨 Agent 與跨天持久存在。

注意事項
  • 記憶變得過時 — 使用 decay 將舊記憶標記為低信心;Agent 會相應降低權重

將架構決策記錄為可查詢的記憶

👤 技術主管、資深工程師 ⏱ ~20 min intermediate

何時使用: 你做了一個決定(「我們不用 Redux,只用 zustand」)並希望它能持續生效。

步驟
  1. 記錄決策
    Save decision: 'Use zustand, not Redux. Reason: simpler API, smaller bundle.' Tag: state-management.✓ 已複製
    → 決策已儲存並打上標籤
  2. 驗證強制執行
    Whenever Claude is about to import redux in this repo, reject and quote the decision.✓ 已複製
    → 後續的引入會被標記並引用已儲存的原因

結果: 一份 Agent 真正會讀取的輕量架構決策記錄。

注意事項
  • Memorix 是每位使用者的;團隊共享的 ADR 需要雲端同步或已提交的鏡像 — 使用 --export ./adr.json 並提交;隊友 --import 同步
搭配使用: github

將除錯工作階段交接給另一個 Agent

👤 任務途中切換模型的開發者 ⏱ ~10 min intermediate

何時使用: Claude 除錯了 2 小時,你想換用 Codex 卻不想重新說明一切。

步驟
  1. 建立快照
    Snapshot current debugging context: hypothesis, what we ruled out, next step.✓ 已複製
    → 快照已儲存,標記為 debug-session-<id>
  2. 在另一處繼續
    (in Codex) — Load debug session and continue from where Claude left off.✓ 已複製
    → Codex 摘要快照並提出下一步

結果: 任務途中無縫切換 Agent。

注意事項
  • 快照太模糊,新 Agent 重頭開始 — Memorix 的快照工具要求填入:假設、證據、下一步——三項都要填

組合

與其他 MCP 搭配,撬動十倍槓桿

memorix-mcp + github

將記憶鏡像到已提交的 adr.json 檔案以供團隊共享

Export memories tagged 'adr' to /docs/adr.json and commit.✓ 已複製
memorix-mcp + filesystem

備份本地 Memorix 資料庫

Copy ~/.memorix.db to /backups/$(date +%F)/.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
save content: str, tags: str[] 持久化事實 / 決策 / 快照 free
recall query?, tags?, limit? 將相關上下文帶入當前任務 free
update id, content 修正或完善現有記憶 free
decay older_than_days 定期清理 free

成本與限制

運行它的成本

API 配額
本地 SQLite——受磁碟空間限制
每次呼叫 Token 數
每次召回 100–500 個 token
費用
免費;若使用雲端同步則依服務而定
提示
每週執行 decay,讓召回查詢返回精簡的近期上下文,而非 6 個月前的除錯筆記

安全

權限、密鑰、影響範圍

憑證儲存: 預設本地 SQLite;雲端同步需要 API 金鑰
資料出站: 預設僅限本地

故障排查

常見錯誤與修復

召回未返回相關內容

確認標籤相符——Memorix 同時使用標籤過濾與模糊文字匹配

驗證: 不加篩選執行以查看所有記憶
資料庫鎖定錯誤

多個 Agent 同時寫入——Memorix 使用 WAL 模式;確認版本 >= 0.4

匯入失敗

匯出與匯入版本的 schema 不相符——先升級兩者

替代方案

Memorix 對比其他方案

替代方案何時用它替代權衡
doobidoo/mcp-memory-service你想要知識圖譜與整合等更豐富的功能更重量;Memorix 刻意保持極簡
OpenAI Memory / Anthropic Memory你只使用單一服務商鎖定在該服務商;Memorix 跨 Agent

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills