Context7
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
Persistent memory for AI agents - hybrid semantic + keyword recall with autonomous consolidation
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
GEMINI_API_KEYค่าที่ติดป้ายความลับคือกุญแจของบัญชีคุณ อย่าส่งให้ใคร และอย่าวางในแชต
ต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"kirok": {
"command": "uvx",
"args": [
"kirok-mcp"
],
"env": {
"GEMINI_API_KEY": "ใส่ค่าของคุณ"
}
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add kirok --env GEMINI_API_KEY='ใส่ค่าของคุณ' -- uvx kirok-mcpเติมค่าที่เว้นว่างไว้ก่อนรัน
วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"kirok": {
"command": "uvx",
"args": [
"kirok-mcp"
],
"env": {
"GEMINI_API_KEY": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"kirok": {
"type": "stdio",
"command": "uvx",
"args": [
"kirok-mcp"
],
"env": {
"GEMINI_API_KEY": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 8 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub TadFuji ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
ต้องใส่ค่าเหล่านี้: GEMINI_API_KEY
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (1.4.2) เข้า registry 4 เดือนที่ผ่านมา
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Python (uv) ในเครื่องด้วย
ในหมวดเดียวกันมี Context7, Codebase Memory, Exa
server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว
อ่านการ์ด:↓ ดาวน์โหลดต่อสัปดาห์i★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
Codebase knowledge graph for AI agents — 162 languages, sub-ms queries, 99% fewer tokens.
Connect AI agents to Exa for web search, content fetching, and multi-step research.
ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
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).
flowchart TB
client["MCP Client (Claude Desktop / Claude Code / Cursor / …)"] subgraph server["Kirok MCP Server (FastMCP)"] direction TB tools["19 MCP tools Retain · Recall · Reflect · consolidate · CRUD"] pipeline["Hybrid search (RRF) · Smart dedup Consolidation · Auto-refresh"] end subgraph storage["Local SQLite (WAL)"] direction LR fts["FTS5 trigram (BM25 keyword)"] vec["sqlite-vec (KNN, brute-force fallback)"] tables["memories · observations mental_models · banks · system_events"] end gemini["Google Gemini API gemini-embedding-001 (3072-d) gemini-2.5-flash-lite"]
client <-->|"stdio (JSON-RPC 2.0)"| tools tools --> pipeline pipeline <--> storage pipeline <-->|embeddings · entity extraction reflection · consolidation| gemini
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:
uvx --from kirok-mcp kirok-doctor # offline sanity check
Claude Code CLI:
claude mcp add kirok -s user -- uvx kirok-mcp
Claude Desktop — edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\):
{
"mcpServers": { "kirok": { "command": "uvx", "args": ["kirok-mcp"] } } }
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.
git clone https://github.com/TadFuji/kirok-mcp.git
cd kirok-mcp uv sync # installs deps, including sqlite-vec cp .env.example .env # then put your key in it: GEMINI_API_KEY=AIza... uv run kirok-doctor # offline sanity check of the whole setup
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 run` fails 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:
`json
{
"mcpServers": {
"kirok": {
"command": "/absolute/path/to/kirok-mcp/.venv/bin/python",
"args": ["-m", "kirok_mcp.server"],
"env": { "PYTHONPATH": "/absolute/path/to/kirok-mcp/src" }
}
}
}
`
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.
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:
cp scripts/search_eval.example.json my_golden.json # add 30–50 real cases
uv run python scripts/search_eval.py my_golden.json --limit 10
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.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 to system_events so a bad LLM decision is recoverable, not silent data loss.KIROK_AUTO_SNAPSHOT_HOURS, a VACUUM INTO + `integrityตัดมาแค่ช่วงต้น อ่านต่อใน repo