Fastest way to scaffold your LLM powered personal knowledge base - Obsidian, Claude Code, qmd, Github
JavaScript aiampclaude-codecodexcursorgithubknowledge-baseknowledge-graphknowledge-managementllmobsidianobsidian-vaultqmdsecond-brain
feat: rename skills to brain-ingest/brain-search and add qmd path setup
jessepinkman99007404997304a7
diff --git a/.claude/skills/pack-test/SKILL.md b/.claude/skills/pack-test/SKILL.mdindex ac18bf7..9c3f1b1 100644--- a/.claude/skills/pack-test/SKILL.md+++ b/.claude/skills/pack-test/SKILL.md@@ -23,10 +23,10 @@ Produces `claude-second-brain-<version>.tgz` in the repo root, where `<version>`**Step 2 — Scaffold via npx**```bash-npx -y claude-second-brain-$(node -p "require('./package.json').version").tgz test-vault+echo "" | npx -y claude-second-brain-$(node -p "require('./package.json').version").tgz test-vault```-Use `npx` with the `file:` prefix — without it, npx tries to execute the tarball as a shell script and fails with "Permission denied". Pass `test-vault` as the target dir argument to skip the interactive prompt. The vault is created in the repo root and cleaned up in Step 4.+Use `npx` with the `file:` prefix — without it, npx tries to execute the tarball as a shell script and fails with "Permission denied". Pass `test-vault` as the target dir argument to skip the interactive folder name prompt. Pipe `echo ""` to accept the default qmd path (`~/.cache/qmd/index.sqlite`) without interactive input. The vault is created in the repo root and cleaned up in Step 4.**Step 3 — Verify checklist**@@ -45,11 +45,24 @@ ls test-vault/wiki/# Sources dirsls test-vault/sources/-# Claude Code skills (expect: setup, ingest, query, lint, qmd-cli)+# Claude Code skills (expect: brain-ingest, brain-search, lint, qmd-cli, setup)ls test-vault/.claude/skills/# qmd scriptsls test-vault/scripts/qmd/++# INDEX_PATH in CLAUDE.md must be an absolute path, not relative "qmd.sqlite"+grep "INDEX_PATH=" test-vault/CLAUDE.md++# setup.ts DB must be a hardcoded absolute path, not join(VAULT, "qmd.sqlite")+grep "const DB" test-vault/scripts/qmd/setup.ts++# Global skills must be installed+ls ~/.claude/skills/brain-ingest/+ls ~/.claude/skills/brain-search/++# Global skill content must have the absolute INDEX_PATH+grep "INDEX_PATH=" ~/.claude/skills/brain-ingest/SKILL.md```Report results against this checklist:@@ -60,20 +73,31 @@ Report results against this checklist:| `wiki/index.md`, `log.md`, `overview.md` | All present | || `wiki/sources/` and `wiki/qa/` | Present | || `sources/articles/`, `pdfs/`, `personal/` | Present | |-| `.claude/skills/` — 5 subdirs | setup, ingest, query, lint, qmd-cli | |+| `.claude/skills/` — 5 subdirs | brain-ingest, brain-search, lint, qmd-cli, setup | || `scripts/qmd/setup.ts`, `reindex.ts`, `package.json` | All present | || `CLAUDE.md`, `mise.toml` | Present | |+| `CLAUDE.md` INDEX_PATH | Absolute path (not `qmd.sqlite`) | |+| `scripts/qmd/setup.ts` DB const | Hardcoded absolute path (not `join(VAULT, ...)`) | |+| `~/.claude/skills/brain-ingest/SKILL.md` | Present with absolute INDEX_PATH | |+| `~/.claude/skills/brain-search/SKILL.md` | Present with absolute INDEX_PATH | |**Step 4 — Clean up**```bashrm -rf test-vaultrm claude-second-brain-$(node -p "require('./package.json').version").tgz+rm -rf ~/.claude/skills/brain-ingest+rm -rf ~/.claude/skills/brain-search```+> **Note:** If you had pre-existing `brain-ingest` / `brain-search` global skills from a real vault, they were overwritten by this test. Re-run `/setup` inside your real vault to restore them.+## What failure means- **`.gitignore.template` present instead of `.gitignore`** — npm stripped `.gitignore` from the tarball but the rename in `bin/create.js` didn't fire; check the `try/catch` rename block- **Missing skill dirs** — template copy failed or `.claude/` hidden dir wasn't included; check `npm pack --dry-run` output- **`npx` fails to run the bin** — shebang or `bin` field in `package.json` is wrong; check `#!/usr/bin/env node` on line 1 of `bin/create.js`+- **`qmd.sqlite` still in CLAUDE.md or skill files** — `patchVault()` didn't run or the replaceAll target string didn't match; check for typos in the patch targets in `bin/create.js`+- **Global skills not installed** — `installGlobalSkills()` failed; check that `~/.claude/skills/` is writable and template skill dirs are named `brain-ingest`/`brain-search`+- **`join(VAULT, ...)` still in setup.ts** — the DB line patch didn't match; verify the exact string `const DB = join(VAULT, "qmd.sqlite")` exists in the template- **Note:** `bunx` cannot run local tarballs — use `npx` for this test. After publishing, `bunx claude-second-brain` from the registry works fine.diff --git a/README.md b/README.mdindex 89f50a9..0fb0338 100644--- a/README.md+++ b/README.md@@ -19,7 +19,7 @@ One command gives you a fully wired knowledge system:- The scaffolded folder **is your Obsidian vault** — open it directly in [Obsidian](https://obsidian.md), with [obsidian-git](https://github.com/Vinzent03/obsidian-git) pre-configured for seamless sync- GitHub is the source of truth — version history, anywhere access, and a backup you control-You've been reading papers, articles, and books for years. Drop a source in, run `/ingest`, and Claude reads it — extracts what matters, cross-links it to everything you already know, and files it. Ask a question six months later and get cited answers, not a list of files to re-read.+You've been reading papers, articles, and books for years. Drop a source in, run `/brain-ingest`, and Claude reads it — extracts what matters, cross-links it to everything you already know, and files it. Ask a question six months later and get cited answers, not a list of files to re-read.> **Inspired by [Andrej Karpathy's approach to LLM-powered knowledge management](https://x.com/karpathy/status/2040470801506541998?s=20)** — share an "idea file" with an LLM agent and let it build and maintain your knowledge base.@@ -63,7 +63,7 @@ Creates your vault (the folder itself is the Obsidian vault), installs `mise` +**Step 2 — Initialize inside Claude Code**```bash-cd my-wiki && claude+cd my-brain && claude```Then run:@@ -77,21 +77,21 @@ Registers the qmd collections and generates local vector embeddings. First run d**Step 3 — Push to GitHub and open in Obsidian**```bash-git remote add origin https://github.com/you/my-wiki.git+git remote add origin https://github.com/you/my-brain.gitgit push -u origin main```-Open `my-wiki/` as a vault in Obsidian — the folder is already a valid Obsidian vault. The Git plugin is pre-configured — enable it and sync is automatic.+Open `my-brain/` as a vault in Obsidian — the folder is already a valid Obsidian vault. The Git plugin is pre-configured — enable it and sync is automatic.---## Claude Code skills included-The wiki ships with three slash commands that cover the full workflow. No manual prompting, no copy-pasting.+The wiki ships with two global slash commands that cover the full workflow. No manual prompting, no copy-pasting.-**`/ingest`** — Drop a file into `sources/articles/`, `sources/pdfs/`, or `sources/personal/`. Run `/ingest`. Claude summarizes the source, asks what matters most to you, creates a `wiki/sources/` page, updates or creates related topic pages, flags any contradictions with existing knowledge, and logs everything.+**`/brain-ingest`** — Drop a file into `sources/articles/`, `sources/pdfs/`, or `sources/personal/`. Run `/brain-ingest`. Claude summarizes the source, asks what matters most to you, creates a `wiki/sources/` page, updates or creates related topic pages, flags any contradictions with existing knowledge, and logs everything.-**`/query`** — Ask anything about what you know. Claude runs hybrid semantic search across the wiki, reads the most relevant pages, and writes an answer with inline `[[wiki/page]]` citations. If the answer synthesizes multiple pages in a novel way, it offers to file it as a permanent `wiki/qa/` entry.+**`/brain-search`** — Ask anything about what you know. Claude runs hybrid semantic search across the wiki, reads the most relevant pages, and writes an answer with inline `[[wiki/page]]` citations. If the answer synthesizes multiple pages in a novel way, it offers to file it as a permanent `wiki/qa/` entry.**`/lint`** — Health-check the wiki. Surfaces orphan pages, broken links, unresolved contradictions, and data gaps. Reports findings and applies fixes where possible.@@ -114,7 +114,7 @@ It's a plain GitHub repo. View and edit files directly in the browser at any tim```┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐-│ Drop in a source │ │ /ingest in Claude │ │ Wiki grows │+│ Drop in a source │ │ /brain-ingest │ │ Wiki grows ││ │ │ Code │ │ ││ · article │──────▶ │ │──────▶ │ · cross-linked ││ · PDF │ │ reads + extracts │ │ pages │@@ -125,7 +125,7 @@ It's a plain GitHub repo. View and edit files directly in the browser at any tim└─────────────────────┘```-Query it anytime with `/query`. Get answers with inline `[[wiki/page]]` citations, not a list of files.+Query it anytime with `/brain-search`. Get answers with inline `[[wiki/page]]` citations, not a list of files.---@@ -148,7 +148,7 @@ All pages cross-link with Obsidian `[[wikilinks]]`. Contradictions are flagged w## Directory layout```-my-wiki/+my-brain/├── CLAUDE.md ← The schema. Claude reads this every session.├── sources/ ← Your raw inputs. Claude never modifies these.│ ├── articles/@@ -165,6 +165,69 @@ my-wiki/---+## Installing and updating skills++Skills are slash commands Claude Code loads from `.claude/skills/[name]/SKILL.md`. `/brain-ingest` and `/brain-search` are installed globally to `~/.claude/skills/` during setup so they work in any Claude Code session. `/lint`, `/setup`, and `/qmd-cli` are installed into the vault itself.++Additional skills can be installed from any GitHub repo using [vercel-labs/skills](https://github.com/vercel-labs/skills) — a CLI that works across Claude Code, Cursor, Codex, and 40+ other agents.++### Discover skills++```bash+# Browse the community catalog interactively+npx skills find++# List all skills in a specific repo without installing+npx skills add vercel-labs/agent-skills --list+```++Or search the full directory at [skills.sh](https://skills.sh).++### Install skills++```bash+# Install from a GitHub repo (prompts to pick skills + agents)+npx skills add vercel-labs/agent-skills++# Install a specific skill to Claude Code, project-scoped+npx skills add vercel-labs/agent-skills --skill frontend-design -a claude-code++# Install globally (available in all projects)+npx skills add vercel-labs/agent-skills --skill frontend-design -a claude-code -g+```++Skills are available immediately in any new Claude Code session — no restart required.++### Update skills++```bash+# Update all installed skills+npx skills update++# Update a specific skill+npx skills update frontend-design+```++### Update the built-in wiki skills++The wiki's own skills (`/brain-ingest`, `/brain-search`, `/lint`, `/setup`, `/qmd-cli`) are scaffolded at creation time. To pull in improvements, use `npx skills` pointing to the template skills directory in this repo:++```bash+# Install or update all 5 wiki skills from the latest template+npx skills add https://github.com/jessepinkman9900/claude-second-brain/tree/main/template/.claude/skills -a claude-code -y++# Or update a specific skill+npx skills add https://github.com/jessepinkman9900/claude-second-brain/tree/main/template/.claude/skills --skill brain-ingest -a claude-code -y+```++Once installed via `npx skills`, future updates are a single command:++```bash+npx skills update -a claude-code+```++---+## Roadmap- [ ] GitHub Actions for scheduled re-indexingdiff --git a/bin/create.js b/bin/create.jsindex 0c24017..969331c 100644--- a/bin/create.js+++ b/bin/create.js@@ -1,9 +1,11 @@#!/usr/bin/env node-import { cp, rename, access } from "fs/promises"+import { cp, rename, access, readFile, writeFile, mkdir } from "fs/promises"+import { readdirSync } from "fs"import { join, dirname } from "path"import { fileURLToPath } from "url"import { spawnSync } from "child_process"import { createInterface } from "readline/promises"+import { homedir } from "os"const __dirname = dirname(fileURLToPath(import.meta.url))const TEMPLATE = join(__dirname, "../template")@@ -18,16 +20,67 @@ function commandExists(cmd) {return result.status === 0}+async function patchVault(targetDir, qmdPath) {+ const filesToPatch = [+ join(targetDir, "scripts/qmd/setup.ts"),+ join(targetDir, "scripts/qmd/reindex.ts"),+ join(targetDir, "CLAUDE.md"),+ ]++ // Add all skill SKILL.md files+ const skillsDir = join(targetDir, ".claude/skills")+ try {+ for (const skill of readdirSync(skillsDir)) {+ filesToPatch.push(join(skillsDir, skill, "SKILL.md"))+ }+ } catch { /* no skills dir */ }++ for (const file of filesToPatch) {+ try {+ let content = await readFile(file, "utf8")+ content = content.replaceAll('const DB = join(VAULT, "qmd.sqlite")', `const DB = "${qmdPath}"`)+ content = content.replaceAll("INDEX_PATH=qmd.sqlite", `INDEX_PATH=${qmdPath}`)+ await writeFile(file, content, "utf8")+ } catch { /* file may not exist */ }+ }+}++async function installGlobalSkills(qmdPath) {+ const globalSkillsDir = join(homedir(), ".claude", "skills")++ for (const skillName of ["brain-ingest", "brain-search"]) {+ const srcFile = join(TEMPLATE, ".claude/skills", skillName, "SKILL.md")+ const destDir = join(globalSkillsDir, skillName)++ let content = await readFile(srcFile, "utf8")+ content = content.replaceAll("INDEX_PATH=qmd.sqlite", `INDEX_PATH=${qmdPath}`)++ await mkdir(destDir, { recursive: true })+ await writeFile(join(destDir, "SKILL.md"), content, "utf8")+ console.log(` ✓ ~/.claude/skills/${skillName}/SKILL.md`)+ }+}+async function main() {- let targetName = process.argv[2]+ const rl = createInterface({ input: process.stdin, output: process.stdout })+ // 1. Folder name+ let targetName = process.argv[2]if (!targetName) {- const rl = createInterface({ input: process.stdin, output: process.stdout })- const answer = await rl.question("Where to create your wiki? (my-wiki) › ")- rl.close()- targetName = answer.trim() || "my-wiki"+ const answer = await rl.question("Where to create your brain? (my-brain) › ")+ targetName = answer.trim() || "my-brain"}+ // 2. qmd path+ const defaultQmdPath = join(+ process.env.XDG_CACHE_HOME || join(homedir(), ".cache"),+ "qmd", "index.sqlite"+ )+ const qmdAnswer = await rl.question(`Where to store the qmd index? (${defaultQmdPath}) › `)+ const qmdPath = qmdAnswer.trim() || defaultQmdPath++ rl.close()+const targetDir = join(process.cwd(), targetName)// Fail fast if target already exists@@ -39,7 +92,7 @@ async function main() {// Directory doesn't exist — good to go}- // 1. Scaffold+ // 3. Scaffoldconsole.log(`\nCreating ${targetName}...`)await cp(TEMPLATE, targetDir, { recursive: true })@@ -55,7 +108,11 @@ async function main() {console.log(`✓ Created ${targetName}/`)- // 2. Install mise if not present+ // 4. Patch vault files with chosen qmd path+ await patchVault(targetDir, qmdPath)+ console.log(`✓ Configured qmd path: ${qmdPath}`)++ // 5. Install mise if not presentif (!commandExists("mise")) {console.log("\nInstalling mise...")const ok = run(["npm", "install", "-g", "@jdxcode/mise"])@@ -66,7 +123,7 @@ async function main() {}}- // 3. Run mise install inside the new vault to install bun+ // 6. Run mise install inside the new vault to install bunconsole.log("\nInstalling bun via mise...")const miseOk = run(["mise", "install"], targetDir)if (miseOk) {@@ -75,7 +132,7 @@ async function main() {console.error(" mise install failed — run it manually inside your vault")}- // 4. Git init+ // 7. Git initconsole.log("\nInitializing git repo...")const gitOk = run(["git", "init"], targetDir)if (gitOk) {@@ -86,7 +143,11 @@ async function main() {console.error(" git init failed — run it manually inside your vault")}- console.log(`\n✓ Done! Your wiki is ready.\n`)+ // 8. Install global skills+ console.log("\nInstalling global skills...")+ await installGlobalSkills(qmdPath)++ console.log(`\n✓ Done! Your brain is ready.\n`)console.log("Next steps:")console.log(` cd ${targetName}`)console.log(" claude # open Claude Code, then run /setup")diff --git a/template/.claude/skills/ingest/SKILL.md b/template/.claude/skills/brain-ingest/SKILL.mdsimilarity index 94%rename from template/.claude/skills/ingest/SKILL.mdrename to template/.claude/skills/brain-ingest/SKILL.mdindex a2dcbcc..db7e700 100644--- a/template/.claude/skills/ingest/SKILL.md+++ b/template/.claude/skills/brain-ingest/SKILL.md@@ -1,10 +1,10 @@----name: ingest-description: "Ingest a new source into the wiki. Reads the source, summarizes it, creates a wiki/sources/ page, updates affected topic and entity pages, flags contradictions, and logs the activity. Trigger phrases: /ingest, ingest [file or URL], add this source, read and file this, process this article/paper/note."+name: brain-ingest+description: "Ingest a new source into the wiki. Reads the source, summarizes it, creates a wiki/sources/ page, updates affected topic and entity pages, flags contradictions, and logs the activity. Trigger phrases: /brain-ingest, ingest [file or URL], add this source, read and file this, process this article/paper/note."argument-hint: "File path (e.g. sources/articles/my-article.md), URL, or leave blank if source is pasted in chat"----# Ingest+# Brain IngestRuns the full 9-step ingest workflow defined in CLAUDE.md. Do not skip steps.diff --git a/template/.claude/skills/query/SKILL.md b/template/.claude/skills/brain-search/SKILL.mdsimilarity index 91%rename from template/.claude/skills/query/SKILL.mdrename to template/.claude/skills/brain-search/SKILL.mdindex 5df8e13..04f39eb 100644--- a/template/.claude/skills/query/SKILL.md+++ b/template/.claude/skills/brain-search/SKILL.md@@ -1,10 +1,10 @@----name: query-description: "Query the wiki to answer a question. Searches semantically, synthesizes an answer with inline citations, and optionally files the answer as a permanent Q&A page. Trigger phrases: /query, what do I know about, search the wiki, find everything about, what does the wiki say about."+name: brain-search+description: "Query the wiki to answer a question. Searches semantically, synthesizes an answer with inline citations, and optionally files the answer as a permanent Q&A page. Trigger phrases: /brain-search, what do I know about, search the wiki, find everything about, what does the wiki say about."argument-hint: "The question or topic to query (e.g. 'what do I know about transformer architecture?')"----# Query+# Brain SearchRuns the 4-step query workflow defined in CLAUDE.md. Answers come with inline `[[wiki/page]]` citations — not a list of files.diff --git a/template/README.md b/template/README.mdindex 361ab3f..a0b4a97 100644--- a/template/README.md+++ b/template/README.md@@ -32,9 +32,9 @@ Registers the qmd collections and generates local vector embeddings. First run d## Your Claude Code skills-**`/ingest`** — Add a file to `sources/articles/`, `sources/pdfs/`, or `sources/personal/`, then run `/ingest`. Claude summarizes the source, asks what aspects matter most, updates related wiki pages, flags contradictions, and logs everything.+**`/brain-ingest`** — Add a file to `sources/articles/`, `sources/pdfs/`, or `sources/personal/`, then run `/brain-ingest`. Claude summarizes the source, asks what aspects matter most, updates related wiki pages, flags contradictions, and logs everything.-**`/query`** — Ask anything: `what do I know about [topic]?` Claude searches the wiki semantically and returns a cited answer. If it synthesizes multiple pages in a useful way, it offers to file it as a permanent `wiki/qa/` entry.+**`/brain-search`** — Ask anything: `what do I know about [topic]?` Claude searches the wiki semantically and returns a cited answer. If it synthesizes multiple pages in a useful way, it offers to file it as a permanent `wiki/qa/` entry.**`/lint`** — Health-check the wiki. Finds orphan pages, broken links, unresolved contradictions, and data gaps. Reports findings and fixes what it can.@@ -82,6 +82,56 @@ claude-second-brain/---+## Installing and updating skills++Skills are slash commands Claude Code loads from `.claude/skills/[name]/SKILL.md` in this vault. The wiki ships with `/brain-ingest`, `/brain-search`, `/lint`, `/setup`, and `/qmd-cli` pre-installed.++Additional skills can be installed from any GitHub repo using [vercel-labs/skills](https://github.com/vercel-labs/skills) — a CLI that works across Claude Code, Cursor, Codex, and 40+ other agents.++### Discover skills++```bash+npx skills find # interactive catalog search+npx skills add vercel-labs/agent-skills --list # browse a specific repo+```++### Install a skill++```bash+# Install from a repo (prompts to pick skills + agents)+npx skills add vercel-labs/agent-skills++# Install a specific skill to Claude Code+npx skills add vercel-labs/agent-skills --skill frontend-design -a claude-code+```++### Update skills++```bash+npx skills update # update all installed skills+npx skills update my-skill # update a specific skill+```++### Update built-in wiki skills++Pull the latest `/brain-ingest`, `/brain-search`, `/lint`, `/setup`, and `/qmd-cli` from the upstream template:++```bash+# Install or update all 5 wiki skills+npx skills add https://github.com/jessepinkman9900/claude-second-brain/tree/main/template/.claude/skills -a claude-code -y++# Or update a specific skill+npx skills add https://github.com/jessepinkman9900/claude-second-brain/tree/main/template/.claude/skills --skill brain-ingest -a claude-code -y+```++Once installed via `npx skills`, future updates are a single command:++```bash+npx skills update -a claude-code+```++---+## Re-indexingAfter a bulk ingest session, re-index to keep search current: