Skip to content

Fastest way to scaffold your LLM powered personal knowledge base - Obsidian, Claude Code, qmd, Github

refactor: unify all qmd path references under __QMD_PATH__ placeholder

jessepinkman9900618a3aaab795
diff --git a/bin/create.js b/bin/create.js
index 43dab33..befff11 100644
--- a/bin/create.js
+++ b/bin/create.js
@@ -46,8 +46,7 @@ async function patchVault(targetDir, qmdPath, brainName) {
await Promise.all(filesToPatch.map(async file => {
try {
let content = await readFile(file, "utf8")
- content = content.replaceAll('"__QMD_PATH__"', `"${qmdPath}"`)
- content = content.replaceAll("INDEX_PATH=qmd.sqlite", `INDEX_PATH=${qmdPath}`)
+ content = content.replaceAll("__QMD_PATH__", qmdPath)
await writeFile(file, content, "utf8")
} catch { /* file may not exist */ }
}))
@@ -68,7 +67,7 @@ async function installGlobalSkills(qmdPath) {
const destDir = join(globalSkillsDir, skillName)
let content = await readFile(srcFile, "utf8")
- content = content.replaceAll("INDEX_PATH=qmd.sqlite", `INDEX_PATH=${qmdPath}`)
+ content = content.replaceAll("__QMD_PATH__", qmdPath)
await mkdir(destDir, { recursive: true })
await writeFile(join(destDir, "SKILL.md"), content, "utf8")
diff --git a/template/.claude/skills/brain-ingest/SKILL.md b/template/.claude/skills/brain-ingest/SKILL.md
index db7e700..89d3ee5 100644
--- a/template/.claude/skills/brain-ingest/SKILL.md
+++ b/template/.claude/skills/brain-ingest/SKILL.md
@@ -35,7 +35,7 @@ Runs the full 9-step ingest workflow defined in CLAUDE.md. Do not skip steps.
- Add the new source to the Sources Ingested section: one-line description + `[[wiki/sources/slug]]` link
**Step 5 — Identify affected wiki pages**
-- Run: `INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query -c wiki "<source topic and key claims>"`
+- Run: `INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query -c wiki "<source topic and key claims>"`
- Also Glob `wiki/*.md` and `wiki/sources/*.md` to catch anything qmd missed
- List all pages to create or update before proceeding
diff --git a/template/.claude/skills/brain-search/SKILL.md b/template/.claude/skills/brain-search/SKILL.md
index 04f39eb..17f14b8 100644
--- a/template/.claude/skills/brain-search/SKILL.md
+++ b/template/.claude/skills/brain-search/SKILL.md
@@ -11,7 +11,7 @@ Runs the 4-step query workflow defined in CLAUDE.md. Answers come with inline `[
## Workflow
**Step 1 — Search the wiki**
-- Run hybrid search: `INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query -c wiki "<question>"`
+- Run hybrid search: `INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query -c wiki "<question>"`
- Read `wiki/index.md` to confirm coverage and catch any pages qmd didn't surface
- Read the 2–5 most relevant pages in full before synthesizing
diff --git a/template/.claude/skills/qmd-cli/SKILL.md b/template/.claude/skills/qmd-cli/SKILL.md
index b809720..084d052 100644
--- a/template/.claude/skills/qmd-cli/SKILL.md
+++ b/template/.claude/skills/qmd-cli/SKILL.md
@@ -10,10 +10,10 @@ Local semantic document index with hybrid search (BM25 + vector), collection man
## Vault DB
-This vault keeps its index at `qmd.sqlite` in the vault root (gitignored). All CLI commands **must** prefix with `INDEX_PATH=qmd.sqlite` (relative path works when running from the vault root, which is always the case here):
+This vault keeps its index at `__QMD_PATH__`. All CLI commands **must** prefix with `INDEX_PATH=__QMD_PATH__`:
```bash
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query -c wiki "..."
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query -c wiki "..."
```
The scripts `bun scripts/qmd/setup.ts` and `bun scripts/qmd/reindex.ts` write to this same file. The CLI must match.
@@ -24,40 +24,40 @@ The scripts `bun scripts/qmd/setup.ts` and `bun scripts/qmd/reindex.ts` write to
```bash
# Create/index a collection
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd collection add <path> --name <name> --mask <glob-pattern>
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd collection add <path> --name <name> --mask <glob-pattern>
# e.g.:
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd collection add wiki --name wiki --mask "**/*.md"
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd collection add wiki --name wiki --mask "**/*.md"
# List all collections with details
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd collection list
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd collection list
# Remove a collection
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd collection remove <name>
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd collection remove <name>
# Rename a collection
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd collection rename <old-name> <new-name>
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd collection rename <old-name> <new-name>
```
## Listing Files
```bash
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd ls
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd ls [collection[/path]]
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd ls
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd ls [collection[/path]]
```
## Context
```bash
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd context add [path] "description text"
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd context list
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd context rm <path>
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd context add [path] "description text"
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd context list
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd context rm <path>
```
## Retrieving Documents
```bash
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd get <file>[:line] [-l N] [--from N]
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd multi-get <pattern> [-l N] [--max-bytes N]
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd get <file>[:line] [-l N] [--from N]
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd multi-get <pattern> [-l N] [--max-bytes N]
```
**Multi-get format flags:** `--json`, `--csv`, `--md`, `--xml`, `--files`
@@ -66,16 +66,16 @@ INDEX_PATH=qmd.sqlite bunx @tobilu/qmd multi-get <pattern> [-l N] [--max-bytes N
```bash
# Show index status and collections
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd status
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd status
# Re-index all collections
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd update [--pull]
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd update [--pull]
# Create vector embeddings (900 tokens/chunk, 15% overlap)
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd embed [-f]
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd embed [-f]
# Remove cache and orphaned data, vacuum DB
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd cleanup
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd cleanup
```
> After bulk ingest sessions, run `update` then `embed` to keep the index fresh.
@@ -108,28 +108,28 @@ INDEX_PATH=qmd.sqlite bunx @tobilu/qmd cleanup
```bash
# Hybrid search across all collections
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query "distributed systems consensus"
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query "distributed systems consensus"
# Search only the wiki collection, JSON output
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query -c wiki "transformer architecture" --json
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query -c wiki "transformer architecture" --json
# Keyword-only search, top 10, markdown output
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd search -c wiki "kafka" -n 10 --md
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd search -c wiki "kafka" -n 10 --md
# Vector search with full documents
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd vsearch "attention mechanism" --full
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd vsearch "attention mechanism" --full
# Filter by score threshold
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query "machine learning" --all --min-score 0.7
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query "machine learning" --all --min-score 0.7
```
## MCP Server
```bash
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd mcp
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd mcp --http [--port N]
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd mcp --http --daemon
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd mcp stop
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd mcp
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd mcp --http [--port N]
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd mcp --http --daemon
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd mcp stop
```
## Global Options
@@ -151,18 +151,18 @@ bun scripts/qmd/reindex.ts
### After a bulk ingest session
```bash
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd update
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd embed
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd update
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd embed
```
### Research workflow
```bash
# Discover relevant pages
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query -c wiki "<topic>"
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query -c wiki "<topic>"
# Get a specific file
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd get wiki/distributed-systems.md
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd get wiki/distributed-systems.md
# Get multiple related files
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd multi-get "wiki/kafka.md,wiki/distributed-systems.md" --md
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd multi-get "wiki/kafka.md,wiki/distributed-systems.md" --md
```
diff --git a/template/.claude/skills/setup/SKILL.md b/template/.claude/skills/setup/SKILL.md
index 9d8deb2..c97de48 100644
--- a/template/.claude/skills/setup/SKILL.md
+++ b/template/.claude/skills/setup/SKILL.md
@@ -50,13 +50,13 @@ Run these three commands to confirm everything is working:
```bash
# List registered collections (expect: wiki, raw-sources, human, daily-notes)
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd collection list
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd collection list
# List registered contexts
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd context list
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd context list
# Show index status and embedding counts
-INDEX_PATH=qmd.sqlite bunx @tobilu/qmd status
+INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd status
```
All four collections should appear in `collection list`. `status` should show non-zero document and embedding counts — if embeddings are 0, re-run step 2.
diff --git a/template/CLAUDE.md b/template/CLAUDE.md
index 6642412..11ace6b 100644
--- a/template/CLAUDE.md
+++ b/template/CLAUDE.md
@@ -209,15 +209,15 @@ N issues found, N fixed. [Brief summary of notable findings.]
## Search Tool
This vault uses **qmd** (`bunx @tobilu/qmd`) for local semantic and full-text search.
-Collections and contexts are registered via `bun scripts/qmd/setup.ts` and stored in `qmd.sqlite` at the vault root (gitignored).
+Collections and contexts are registered via `bun scripts/qmd/setup.ts` and stored at `__QMD_PATH__` (gitignored).
Key commands:
| Command | Use |
|---------|-----|
-| `INDEX_PATH=qmd.sqlite bunx @tobilu/qmd query -c wiki "<question>"` | Hybrid search — best for topic discovery |
-| `INDEX_PATH=qmd.sqlite bunx @tobilu/qmd search -c wiki "<terms>"` | Fast keyword search (BM25, no LLM) |
-| `INDEX_PATH=qmd.sqlite bunx @tobilu/qmd vsearch -c wiki "<question>"` | Pure vector/semantic search |
+| `INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd query -c wiki "<question>"` | Hybrid search — best for topic discovery |
+| `INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd search -c wiki "<terms>"` | Fast keyword search (BM25, no LLM) |
+| `INDEX_PATH=__QMD_PATH__ bunx @tobilu/qmd vsearch -c wiki "<question>"` | Pure vector/semantic search |
Add `--json` for structured output. Omit `-c wiki` to search all collections (wiki, raw-sources, human, daily-notes).