Persistent memory for AI agents - hybrid semantic + keyword recall with autonomous consolidation
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag — we're steadily working through the catalog.
💡 Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
English | 日本語
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.
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:
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).
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.
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:
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.
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.
19 MCP tools. One-line summaries below; full parameter tables in docs/tools-reference.md.
Core
| Tool | Purpose |
|---|---|
KIROK_retain | Store a memory: entity/keyword extraction + embedding + smart ADD/UPDATE/NOOP dedup |
KIROK_recall | Hybrid semantic + keyword search (RRF), observations shown first |
KIROK_reflect | Synthesise memories into a mental model (insight), optionally auto-refreshing |
KIROK_smart_retain | Score importance (1–10) first, then retain only if it clears a threshold |
KIROK_consolidate | Manually run observation consolidation for a bank |
Memory management
| Tool | Purpose |
|---|---|
KIROK_get_memory / KIROK_list_memories | Fetch one memory / browse a bank with pagination |
KIROK_update_memory | Edit content or context (re-extracts and re-embeds on content change) |
KIROK_forget | Delete a single memory (irreversible) |
Mental models
| Tool | Purpose |
|---|---|
KIROK_list_mental_models / KIROK_get_mental_model | List / inspect insights from Reflect |
KIROK_refresh_mental_model | Re-analyse against current memories |
KIROK_delete_mental_model | Delete a mental model (irreversible) |
Banks
| Tool | Purpose |
|---|---|
KIROK_list_banks / KIROK_stats | List banks with counts / detailed per-bank stats incl. background failures |
KIROK_clear_bank | Delete a bank's memories + observations (requires confirm=true; previews otherwise) |
KIROK_delete_bank | Delete a bank entirely (requires confirm=true; previews otherwise) |
Config
| Tool | Purpose |
|---|---|
KIROK_set_bank_config / KIROK_get_bank_config | Set / view a bank's retain & observation "missions" (what to focus on) |
Everything is set via environment variables (typically in .env). Only GEMINI_API_KEY is required.
| Variable | Default | Description |
|---|---|---|
GEMINI_API_KEY | — | Required. Google Gemini API key. |
KIROK_DB_PATH | ~/.kirok/memory.db | SQLite database location. |
KIROK_DEDUP_THRESHOLD | 0.85 | Cosine similarity above which retain invokes the LLM dedup (ADD/UPDATE/NOOP) decision. |
KIROK_RECALL_MIN_SIMILARITY | 0.62 | Similarity floor for semantic memory hits in recall. Keyword/FTS hits are exempt. |
KIROK_OBS_MIN_SIMILARITY | 0.62 | Similarity floor for observation hits in recall. |
KIROK_CONSOLIDATION_BATCH_SIZE | 5 | Run auto-consolidation only once this many memories are pending (1 = every retain). |
KIROK_CONSOLIDATION_TIMEOUT | 120 | Consolidation timeout, seconds. |
KIROK_REFLECT_TIMEOUT | 300 | Reflect timeout, seconds. |
KIROK_AUTO_SNAPSHOT_HOURS | 24 | Min hours between startup auto-snapshots (0 disables). |
KIROK_SNAPSHOT_KEEP | 5 | Auto-snapshot generations to keep before rotating out the oldest. |
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.
Factual signals from GitHub, npm, and our automated checks — not a rating.
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/kirok-memory)<a href="https://allmcps.com/mcp/kirok-memory"><img src="https://allmcps.com/api/badge/kirok-memory?style=directory" alt="Kirok Memory on AllMCPs" /></a>