
Kirok Memory
io.github.TadFuji由 GitHub 帳號 TadFuji 發布v1.4.2更新於 Oct 24, 2026
Persistent memory for AI agents - hybrid semantic + keyword recall with autonomous consolidation
發布方自己的服務:Memory.fit
概覽
為 AI 助理提供持久、可檢索的記憶儲存,支援語意與關鍵字混合召回,並能自動整合成洞察。
- 可以做什麼
- Kirok 是一個本機 MCP 伺服器,把記憶存進 SQLite 資料庫,並以混合檢索取回:語意 KNN 與 FTS5 BM25 透過倒數排名融合合併,並設有校準過的相似度下限。核心工具包括 retain、recall、reflect、smart_retain 與 consolidate,另有記憶的增刪改查、心智模型管理、記憶庫管理以及各記憶庫設定。背景迴圈會定期把原始記憶綜合成更高階的觀察結果,啟動時自動快照與帶稽核軌跡的軟刪除則用來確保資料可復原。
- 適用情境
- 當助理需要跨工作階段的持久記憶、而不是每一輪重讀筆記時適用;也適合想把關鍵字比對與語意召回結合、而非只用純向量庫的情境。適合可接受本機 SQLite 檔案、但允許把嵌入與 LLM 推論送往雲端 API 的自架環境。
- 執行需求
- 以本機程序方式執行,透過 uvx 或 uv 從 PyPI 套件 kirok-mcp 啟動;需要 Python 3.12+ 與 uv。需要 Google Gemini API 金鑰,以 GEMINI_API_KEY 提供,可放在 ~/.kirok/.env 或客戶端的 env 區塊中。儲存預設是本機 SQLite 檔案 ~/.kirok/memory.db;呼叫 Gemini 嵌入與推論需要網路存取。僅支援桌面 MCP 客戶端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Kirok Memory,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Kirok
English | 日本語
[tests] [License: MIT] [Python 3.12+] [Version 1.4.2]
Persistent memory for AI agents, over MCP. Kirok (記録, "record") is a Model Context Protocol server that gives an agent a durable, searchable memory: Retain what matters, Recall it with hybrid semantic + keyword search, and Reflect to distil accumulated memories into reusable insights. A background consolidation loop turns raw memories into higher-level observations on its own.
[Kirok demo: retain a memory, then recall it later with hybrid search — consolidated observations shown first]Why Kirok
Most "agent memory" is either a flat vector store (recall is a bare cosine top-k, no keyword grounding, no forgetting) or a pile of markdown the agent has to re-read every turn. Kirok is a small, self-hostable server that does the retrieval engineering properly:
- Hybrid retrieval, not just vectors. Semantic KNN and FTS5 BM25 are fused with Reciprocal Rank Fusion, so an exact keyword match and a semantic match reinforce each other instead of competing.
- A calibrated relevance floor. Naive cosine thresholds don't work on real embedding distributions (see Search quality); Kirok's floor is measured against live data, and there's an evaluation harness to keep it honest.
- Autonomous consolidation. Memories are periodically synthesised into observations, and destructive LLM decisions are soft-deleted with an audit trail rather than executed blindly.
- Reliability first. Atomic writes, soft deletes, startup auto-snapshots, and a fail-open background pipeline that never loses a
retain.
Not local-first: storage is a local SQLite file you own, but embedding and LLM inference are sent to Google's Gemini API. If everything must stay on-device, Kirok is not for you (yet).
Architecture
Storage is a single SQLite database at ~/.kirok/memory.db. sqlite-vec provides per-bank vector KNN; if the native extension can't load, Kirok falls back to a NumPy brute-force scan with identical results. See docs/architecture.md for the full design.
🚀 Quick start
Requirements: Python 3.12+, uv (for uvx), and a Gemini API key (free tier is plenty).
Kirok ships on PyPI — nothing to clone. Put your key in ~/.kirok/.env (one line: GEMINI_API_KEY=AIza...), then verify the setup:
Connect an MCP client
Claude Code CLI:
Claude Desktop — edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):
Then restart the client. The server reads GEMINI_API_KEY from ~/.kirok/.env; an env block in the client config also works and takes precedence.
From source (development)
Point your MCP client at the checkout with uv run --directory /absolute/path/to/kirok-mcp kirok-mcp instead of uvx kirok-mcp.
[!TIP] If
uv runfails to launch the server (common on Windows or cloud-synced folders —uv runre-syncs on every launch and can hit locked.venvfiles or an in-use entry-point.exe), invoke the venv's Python directly to skip the sync entirely:On Windows use
.venv\\Scripts\\python.exeand double-backslash paths in JSON.
A bundled agent skill in skills/kirok/ teaches the agent when and how to use the memory tools on its own — point your client at skills/kirok/SKILL.md to enable it.
🛠️ Tools
19 MCP tools. One-line summaries below; full parameter tables in docs/tools-reference.md.
Core
Memory management
Mental models
Banks
Config
⚙️ Configuration
Everything is set via environment variables (typically in .env). Only GEMINI_API_KEY is required.
🔍 Search quality
Recall runs semantic KNN and FTS5 BM25 in parallel and fuses them with Reciprocal Rank Fusion (k=60). Short Japanese keyword queries get special handling: 1–2 character kanji/katakana tokens fall below the trigram tokenizer's 3-char window and can never MATCH, so they're rescued by an exact-substring LIKE supplement appended after the BM25 hits (hiragana-only short tokens stay excluded — function words would substring-match half a bank; tokens are OR-joined, matching the MATCH side).
Three details keep the hybrid honest: each source is fetched deeper than the final page (max(limit*3, 30)) so RRF can promote an item ranked just outside the cut in both lists; all FTS text is NFKC-normalized on both the index and query side, so width variants (MCP vs MCP, バグ vs バグ) actually match; and observations get the same hybrid treatment as memories — semantic hits floored, keyword hits floor-exempt — instead of being reachable only through the semantic floor.
The similarity floor is calibrated on real data. A naive cosine threshold doesn't work here: on live gemini-embedding-001 vectors the distribution is narrow — off-topic queries score 0.55–0.62 against unrelated banks while true hits score 0.66–0.73. So the usable floor sits just above the off-topic ceiling, at 0.62. Without it, an unrelated query still returns a full page of memories from any non-empty bank (context pollution); much lower and the floor filters nothing (the old hardcoded 0.4 sat below even off-topic scores). FTS keyword hits bypass the floor entirely — a literal term match is independent evidence, not a weak vector score.
Search parameters aren't tuned by vibes. scripts/search_eval.py runs a golden query set through the exact recall pipeline the server uses (extracted as hybrid_search_memories, so the harness can't drift from production) and reports hit@1/hit@5/hit@k and MRR:
🛡️ Reliability
- Atomic consolidation. Every create/update embedding is generated before any DB write; all observation changes plus the "consolidated" mark commit in a single transaction. A failure at any step leaves the database exactly as it was, with the source memories still pending for a later retry — never a half-applied batch.
- Failures surface, never fake success. A consolidation LLM failure raises and is recorded to
system_events— the batch stays pending for a later retry, instead of being silently marked consolidated with nothing produced. Runs are serialized per bank, so two retains landing together cannot double-process the same batch into duplicate observations. - Soft deletes with audit trail. An observation the consolidation LLM decides to remove is stamped
deprecated_at(excluded from search/list/stats) instead of destroyed, and a dedup UPDATE records the pre-merge content in the same transaction as the merge itself — both logged tosystem_eventsso a bad LLM decision is recoverable, not silent data loss. - Startup auto-snapshot. On launch, if the newest auto-snapshot is older than
KIROK_AUTO_SNAPSHOT_HOURS, aVACUUM INTO+integrity_checksnapshot is written under~/.kirok/backups/, keeping the newestKIROK_SNAPSHOT_KEEPgenerations. A snapshot that fails partway leaves no broken file behind, and manual backups are never rotated. - Concurrency. Connections set
PRAGMA busy_timeout=30000, so a second MCP client waits out a busy writer instead of failing withdatabase is locked. - Fail-open background work. Auto-consolidation and mental-model refresh run behind
retainand can never fail it — errors are swallowed, recorded tosystem_events, and surfaced viaKIROK_statsso silent degradation stays visible.
💾 Backup & restore
All state is one SQLite file. The offline kirok-backup CLI needs no API key:
snapshot and export write timestamped files under ~/.kirok/backups/ and refuse to overwrite. import runs in one transaction (all-or-nothing), skips existing IDs rather than overwriting, and rebuilds the FTS + vector indexes so search works immediately. Use --db to target a different database file.
🩺 Diagnostics
🧑💻 Development
The suite is fully offline — importing kirok_mcp.server is side-effect-free (the API key is checked at startup, not import) and tests swap in fake Gemini clients. CI runs the same suite on Ubuntu and Windows on every push (.github/workflows/test.yml). See CONTRIBUTING.md before opening a PR.
📚 Documentation
- docs/architecture.md — internal design, data model, consolidation engine
- docs/tools-reference.md — full parameter reference for all 19 tools
- CHANGELOG.md — version history (current: 1.4.2)
📄 License
MIT — see LICENSE.
Acknowledgements
- Model Context Protocol and the official MCP Python SDK (FastMCP)
- Google Gemini API for embeddings and LLM
- Mem0 — inspiration for smart deduplication and the knowledge layer
- Reciprocal Rank Fusion (Cormack et al., 2009)
來源:README.md,提交 4c03352
工具
0版本歷史
1- v1.4.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Memory 整合

Memory.fit
fit.memory官方發布者
託管式 Memory.fit 伺服器,讓 AI 讀取你的訓練、睡眠、恢復與飲食資料,並寫回每週計畫、每日目標和飲食計畫。
pg.ddx.io: the PostgreSQL community's memory
io.ddx.pg官方發布者
pg.ddx.io: the PostgreSQL community's memory 的託管 MCP 服務,由 pg.ddx.io 發布;無需登入;Streamable HTTP;29 個工具。
var.gg Naming Memory
gg.var官方發布者
遠端 MCP 伺服器,可依領域概念推薦並檢索韓、日、中、越、英多語言的程式識別字名稱,並提供 ERD 結構查詢。

Counterparts
ai.counterparts
為 Claude Code 與 Claude Desktop 提供的本地優先長期記憶:助理自行寫下關於你與專案的筆記,並在之後的對話中回想起來。

LAHZE - Persian AI Memory Platform
由 GitHub 帳號 pedramgholizadeh 發布
以波斯語為先的地理記憶平臺:發現地點,起草併發布僅限波斯語的記憶。AI 翻譯