A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
feat: register QMD as MCP and teach Claude to consult brain topics via QMD (#48)
Brenno Ferrari3b6976bb0c97
diff --git a/.mcp.json b/.mcp.jsonnew file mode 100644index 0000000..cdaca1c--- /dev/null+++ b/.mcp.json@@ -0,0 +1,8 @@+{+ "mcpServers": {+ "qmd": {+ "command": "qmd",+ "args": ["mcp"]+ }+ }+}diff --git a/CLAUDE.md b/CLAUDE.mdindex c057727..1c8e3ec 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -11,7 +11,7 @@ This vault has [obsidian-skills](https://github.com/kepano/obsidian-skills) inst- **json-canvas**: Create `.canvas` files with nodes, edges, and visual layouts. See `references/EXAMPLES.md`.- **obsidian-bases**: Create `.base` files with views, filters, and formulas. Bases core plugin is enabled. See `references/FUNCTIONS_REFERENCE.md`.- **defuddle**: Extract clean markdown from web pages via `defuddle parse <url> --md`.-- **qmd**: Semantic search across the vault via [QMD](https://github.com/tobi/qmd). Use PROACTIVELY before reading files -- `qmd query "..."` for hybrid search, `qmd search "..."` for keyword, `qmd vsearch "..."` for semantic. Falls back to grep/glob if QMD not installed.+- **qmd**: Semantic search across the vault via [QMD](https://github.com/tobi/qmd). Use PROACTIVELY before reading files -- `qmd query "..."` for hybrid search, `qmd search "..."` for keyword, `qmd vsearch "..."` for semantic. Also registered as an MCP server via `.mcp.json` (project root), so the `qmd` tools are available directly in the Claude Code tool menu when QMD is installed. Falls back to grep/glob if QMD not installed.### Custom Slash Commands@@ -270,6 +270,15 @@ When asked to "remember" something:3. Update `brain/Memories.md` index if a new topic note was created4. Do NOT create additional files in `~/.claude/projects/.../memory/` beyond MEMORY.md -- they are not version-controlled+### When to Consult Brain Topics++The SessionStart hook injects a **Brain Topics (read on demand)** index listing each `brain/` topic note with its description and an `(empty)` marker for stub notes. Treat that index as a menu:++- When the user's message touches a topic from the index (debugging → Gotchas, "how do we usually…" → Patterns, "why did we decide" → Key Decisions, "which command / slash" → Skills), query QMD **first** before answering — `qmd query "<topic keywords>"` searches the whole vault, so after the query filter or prioritize the results whose `file` path is under `brain/`. Do not assume the topic name alone scopes the search.+- If QMD is unavailable, read the specific `brain/` note directly with the Read tool. Don't load all of `brain/` — only the one(s) matching the topic.+- Skip notes marked `(empty)` in the index — they're stubs with no substantive content.+- After answering, if the conversation produced durable knowledge, update the relevant brain note (see the "remember" workflow above).+## Agent Guidelines### Graph-First Thinkingdiff --git a/README.ja.md b/README.ja.mdindex 7297611..f1f9fdc 100644--- a/README.ja.md+++ b/README.ja.md@@ -103,7 +103,7 @@ Decision: defer Redis migration. Win: Sarah praised the auth architecture.5. **`brain/North Star.md`**に目標を記入 — これがすべてのセッションの基盤になります6. 仕事について話し始める-### 🔍 オプション:QMDセマンティック検索+### 🔍 推奨:QMDセマンティック検索ボールト全体のセマンティック検索(ノートのタイトルが「Redis Migration ADR」でも「キャッシュについて何を決めた?」で見つかる):diff --git a/README.ko.md b/README.ko.mdindex d7a9a4e..7c6fc8a 100644--- a/README.ko.md+++ b/README.ko.md@@ -103,7 +103,7 @@ You: "wrap up"5. **`brain/North Star.md`**에 목표를 작성합니다 — 이것이 모든 세션의 기준이 됩니다6. 업무에 대해 이야기를 시작하세요-### 🔍 선택 사항: QMD 시맨틱 검색+### 🔍 권장: QMD 시맨틱 검색볼트 전체의 시맨틱 검색을 위해 (노트 제목이 "Redis Migration ADR"이어도 "캐싱에 대해 뭘 결정했지?"를 찾을 수 있습니다):diff --git a/README.md b/README.mdindex 333ec8b..d35a4db 100644--- a/README.md+++ b/README.md@@ -102,9 +102,14 @@ You: "wrap up"5. Fill in **`brain/North Star.md`** with your goals — this grounds every session6. Start talking about work-### 🔍 Optional: QMD Semantic Search+### 🔍 Recommended: QMD Semantic Search-For semantic search across the vault (find "what did we decide about caching" even if the note is titled "Redis Migration ADR"):+QMD is where most of the agent's retrieval intelligence comes from. Optional in the strict sense — the vault falls back to grep + the Obsidian CLI — but the experience is meaningfully better with it:++- **Semantic recall.** Find "what did we decide about caching" even when the note is titled "Redis Migration ADR."+- **Brain topics available on demand.** Claude is instructed (via `CLAUDE.md`) to consult `brain/` guidance through QMD when the conversation touches a listed topic.+- **Subagents get sharper context.** `context-loader`, `review-prep`, `brag-spotter`, and friends consult QMD first, then fall back to grep.+- **First-class MCP tools.** Registered via `.mcp.json` at the project root — when QMD is installed, its search tools appear directly in the Claude Code tool menu.```bashnpm install -g @tobilu/qmd@@ -114,7 +119,10 @@ qmd update && qmd embed```> [!NOTE]-> If QMD isn't installed, everything still works — the agent falls back to the Obsidian CLI and grep.+> First-time `qmd embed` downloads a ~328MB embedding model. `qmd query` (with LLM reranking) also downloads a ~1.28GB model on first use — skip it with `qmd search` (BM25) or `qmd vsearch` (semantic only) if you want to avoid the larger download.++> [!NOTE]+> If QMD isn't installed, everything still works — the agent falls back to grep and the Obsidian CLI, and the MCP server entry is skipped with a harmless warning.---diff --git a/README.zh-CN.md b/README.zh-CN.mdindex a40d91c..1c60e6c 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -103,7 +103,7 @@ Decision: defer Redis migration. Win: Sarah praised the auth architecture.5. 在 **`brain/North Star.md`** 中填写你的目标——这将为每次会话定下基调6. 开始谈论工作-### 🔍 可选:QMD 语义搜索+### 🔍 推荐:QMD 语义搜索用于在仓库中进行语义搜索(即使笔记标题是 "Redis Migration ADR",也能找到 "我们关于缓存做了什么决策"):