Context7
ส่งคู่มือการใช้ไลบรารีและเฟรมเวิร์กรุ่นล่าสุดให้ AI อ่านก่อนตอบ ช่วยให้โค้ดที่ AI เขียนไม่ใช้คำสั่งเก่าที่เลิกใช้แล้ว
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
Recall over your markdown notes: vector search plus your [[wikilinks]] as a graph, in SQLite.
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
BRAIN_INDEX_DIR, TURNSTATE_DBต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"sqlite-graph-memory": {
"command": "uvx",
"args": [
"sqlite-graph-memory"
],
"env": {
"BRAIN_INDEX_DIR": "ใส่ค่าของคุณ",
"TURNSTATE_DB": "ใส่ค่าของคุณ"
}
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add sqlite-graph-memory --env BRAIN_INDEX_DIR='ใส่ค่าของคุณ' --env TURNSTATE_DB='ใส่ค่าของคุณ' -- uvx sqlite-graph-memoryเติมค่าที่เว้นว่างไว้ก่อนรัน
วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"sqlite-graph-memory": {
"command": "uvx",
"args": [
"sqlite-graph-memory"
],
"env": {
"BRAIN_INDEX_DIR": "ใส่ค่าของคุณ",
"TURNSTATE_DB": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"sqlite-graph-memory": {
"type": "stdio",
"command": "uvx",
"args": [
"sqlite-graph-memory"
],
"env": {
"BRAIN_INDEX_DIR": "ใส่ค่าของคุณ",
"TURNSTATE_DB": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
TURNSTATE_DB envค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 6 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub tonydzi ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
ต้องใส่ค่าเหล่านี้: BRAIN_INDEX_DIR
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.3.7) เข้า registry วันนี้
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Python (uv) ในเครื่องด้วย
ในหมวดเดียวกันมี Context7, Codebase Memory, Exa
server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว
อ่านการ์ด:★ ดาว 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 รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
Your coding agent remembers what you already wrote down, and reaches the note a plain search misses by following the links between your notes. It is an MCP server and a CLI over any folder of markdown, Obsidian vaults included: pip install, point it at the folder, and Claude Code, Cursor, Codex or any other MCP client can recall from it.
Your agent forgets everything between sessions, and plain vector search gives it back flat, unrelated chunks. This gives it associative recall over your own markdown notes: vector search finds the entry points, the `[[wikilinks]]` you already wrote are the graph. One SQLite file, no graph database, no ETL pass, no server.
Already using your own agent rules and projects? The Russian existing-setup guide combines this memory backend with the optional starter-kit method, preserves existing settings, and checks recall in a fresh chat. Install one memory connection per client; the starter-kit memory plugin and manual registration are alternatives.
Build the index once (any folder of markdown; uv gives you uvx):
BRAIN_INDEX_DIR=$HOME/.sgm-index uvx --python 3.12 --from 'sqlite-graph-memory[lite]' sgm-index ~/notes
--python 3.12 is deliberate. onnxruntime has no wheels for Python 3.14 on an Intel Mac, or on Apple Silicon below macOS 14. On such a machine an unpinned uvx falls back to release 0.3.5, which has no [lite], and sgm-index then stops and asks for [embeddings].
Then point your client at the server. Use the absolute path of that index folder.
Cold-start timeout (0.3.5 and later). The MCP server starts recall in a separate process with a default deadline of 180 seconds; a first call on a clean Windows install took 89 s, which the old fixed 60 s always cut off. Override with BRAIN_RECALL_TIMEOUT (integer seconds, 1 to 600; invalid values return an error). Your MCP client's own tool timeout must also allow the longer call. On 0.3.3 and earlier the deadline is a fixed 60 s: upgrade, or use sgm-ask --ask directly, and do not report MCP recall as verified merely because the CLI works.
Claude Code
claude mcp add sqlite-graph-memory -e BRAIN_INDEX_DIR=$HOME/.sgm-index -- uvx --python 3.12 --with 'sqlite-graph-memory[lite]' sqlite-graph-memory
Cursor (~/.cursor/mcp.json; Claude Desktop, Zed and Windsurf take the same mcpServers block)
{
"mcpServers": { "sqlite-graph-memory": { "command": "uvx", "args": ["--python", "3.12", "--with", "sqlite-graph-memory[lite]", "sqlite-graph-memory"], "env": { "BRAIN_INDEX_DIR": "/absolute/path/to/.sgm-index" } } } }
VS Code (.vscode/mcp.json in the workspace)
{
"servers": { "sqlite-graph-memory": { "type": "stdio", "command": "uvx", "args": ["--python", "3.12", "--with", "sqlite-graph-memory[lite]", "sqlite-graph-memory"], "env": { "BRAIN_INDEX_DIR": "/absolute/path/to/.sgm-index" } } } }
Codex (~/.codex/config.toml)
[mcp_servers.sqlite-graph-memory]
command = "uvx" args = ["--python", "3.12", "--with", "sqlite-graph-memory[lite]", "sqlite-graph-memory"] env = { BRAIN_INDEX_DIR = "/absolute/path/to/.sgm-index" }
Size, du -sh of a fresh Python 3.12 venv on an x86_64 Mac (1 Nov 2026): the base install is 26 MB and has no torch (numpy only, enough for the graph half and the SQLite ledger); with [embeddings] (torch) it is 879 MB, 540 MB of that torch 2.2.2 CPU. With [lite], the same two models on ONNX Runtime and no torch, it is 155 MB (Windows, Python 3.12, 3 Nov 2026), installs in 12 s, and one MCP recall on the 202-note bench vault took 7.0 s against 33.8 s through torch on the same machine, with the same top hits and scores. [lite] is picked automatically when installed; SGM_BACKEND=torch forces torch (for a GPU). An index built by either backend is searched correctly by the other. Already installed with pip? Replace uvx --python 3.12 --with ... sqlite-graph-memory by sgm-mcp (examples/mcp-config.json). Agents that read files first: llms.txt.
pip install 'sqlite-graph-memory[lite]'
sgm-index ./notes sgm-ask --ab "In which programming language is the tool behind Project Ouzel written?"
On an Intel Mac, use Python 3.12 with pip install. On a newer Python it can quietly install 0.3.5, which has no [lite].
./notes is any folder of markdown notes. Re-running sgm-index only re-embeds notes that are new or changed since the last run (tracked by a manifest next to the index); pass --full to force a complete rebuild.
To get exactly the output below, use the 202-note synthetic vault from this repo (it is not inside the pip package):
git clone --depth 1 https://github.com/tonydzi/sqlite-graph-memory && cp -R sqlite-graph-memory/bench/vault ./notes
Real output, top 5 of 12:
--- DIRECT memory (vector) ---
--- ASSOCIATIVE memory (vector+graph) ---
The answer lives in tool-lanternfish ("Lanternfish is written in Elixir"). The question never names Lanternfish, so the vector pass does not find it in the top 12 at all. project-ouzel links to it, so one graph hop puts it second.
If that hop found something your vector search missed, a star is how other people with a notes folder find this repo. sgm-ask --ab asks the same once per machine, in a terminal only; SGM_NO_STAR_PROMPT=1 turns it off.
That is the idea in one query, and it is not a blanket win. On this same vault vector-only ranks ahead of graph mode overall; the numbers are in bench/. --ab exists so you can measure which one wins on your own notes.
Graph RAG on SQLite for AI agents — a working pilot, not a framework. It is the extracted memory layer of a personal "second brain" agent setup: vector search finds the entry points, the [[wikilinks]] you already wrote by hand are the graph, and dense similarity orders what the hop dragged in (a cross-encoder rerank is opt-in with --rerank; see below for why it is no longer the default). SQLite is the only database (schema.sql).
Status: pilot, and the word is load-bearing: it runs daily in one real setup (an index of ~28k curated notes, ~93k chunks, rebuilt nightly from a ~270k-file Obsidian vault driven by Claude Code), but it is deliberately minimal and makes no attempt to be general — see What's intentionally missing, which is where the uneven test coverage is described. Published as the companion code for an upcoming write-up on lightweight Graph RAG for agents; the one design note that is already written is docs/bitemporal.md.
Most Graph RAG stacks assume a graph database, an ETL pipeline, and an entity-extraction pass — HippoRAG (arXiv:2405.14831) derives its KG that way, and Graphiti/Zep maintain a temporal one. For a single-user agent over a markdown knowledge base, all three are overkill:
[[wikilinks]], and brain_ask.py just parses them. No extraction pass, and edge quality beats anything a model would mine.schema.sql. One file, stdlib driver, zero ops.--rerank / SGM_RERANK=1.So the pilot's bet: *vector retrieval for entry points, hand-curated wikilinks for association, SQLite for everything that must persist.* All steps live in one file, brain_ask.py, in that order.
Three layers, three failure-isolated components:
markdown notes (with [[wikilinks]])
│ ├── index_notes.py chunk + embed (e5-base) → .npy/.pkl index │ ├── brain_ask.py recall pipeline: │ 1. dense retrieve top-60 chunks, dedup by file │ 2. --graph +1-hop wikilink neighbours of top-15 hits (max 40) │ 3. order dense similarity → top-12 │ (--rerank: cross-encoder instead, opt-in) │ 4. --ab run vector-only AND vector+graph, diff, │ log the delta to SQLite (ab_recall) │ └── turnstate_hook.py agent Stop-hook: after every assistant turn, parse the transcript tail and append one row (ask, summary, files, tools, commands, decisions) to SQLite (turns). 0 LLM tokens, pure stdlib. turnstate_show.py = read-only viewer.
schema.sql documents both tables. The graph is not materialized in SQL: brain_ask.py parses edges from the notes at query time, bounded to 1 hop / 40 neighbours. That keeps the graph permanently in sync with the notes at zero maintenance cost; materialize an edge table only when hop depth or corpus size demands it.
brain_ask.py). Neighbours go into the same ranking pool as vector hits, so an irrelevant linked note gets buried. That is what makes 1-hop expansion safe to leave on.looks_like_entity in brain_ask.py). A/B telemetry showed graph expansion helps *theme* queries ("approaches to agent memory") but hurts *name/tool* lookups ("NotebookLM"): a name's card links to everything, so the hop pulls in noise. The heuristic in brain_ask.py is deliberately conservative, and switches the graph off only for name-shaped queries.brain_ask.py) and the Stop-hook (turnstate_hook.py) are both wrapped, so any failure degrades to the previous behavior: vector-only recall, no ledger row. A memory layer must never make the agent worse than having no memory layer.ตัดมาแค่ช่วงต้น อ่านต่อใน repo