second-brain-template

Claude Code knowledge-base / second-brain template: Obsidian-style vault + management skills + guided onboarding

Knowledge Base Template

A second brain for agents and humans — built on Karpathy's LLM Wiki idea, portable via the OKF standard.

RAG searches raw documents on every query. An LLM Wiki flips it: a Claude Code agent incrementally builds and maintains a living markdown vault — cross-linked, indexed, synthesized. Knowledge compounds instead of piling up. Because it's plain markdown with type frontmatter (the OKF minimum), the base stays portable — git clone and it's yours — and readable by agent and human alike.

The trick that makes it scale without embeddings or a vector DB: index-first reads. The agent starts from a navigation map and opens only the relevant notes, keeping context up to ~28× smaller per query — good for ~500 sources on plain markdown alone.

Live instance: brain.lipowczan.pl.

This template is about managing knowledge, not publishing it — the Quartz / GitHub Pages pipeline is intentionally not included (see Adding publishing later). What you get is an Obsidian-style vault plus the skills that ingest sources, compile articles, answer questions, lint for quality, and keep navigation indexes current.

What you get

  • content/ — your vault. Topic folders hold notes; _raw/ is the ingest drop zone; _indexes/ holds auto-maintained navigation files; _outputs/ holds generated answers and reports; templates/ holds note templates.
  • .claude/skills/ + .claude/commands/ — the management skills below.

Quickstart

  1. Open this folder in Claude Code.
  2. Install script prerequisites: pip install -r requirements.txt.
  3. Run /b:onboard — it interviews you (KB name, owner, topics, language, voice) and then personalizes the brain (CLAUDE.md, AGENTS.md, content/WRITING_STYLE.md), creates your topic folders, and builds the navigation indexes.
  4. Start using the vault:
    • Drop a file in content/_raw/inbox/ and run /b:ingest.
    • Ask /b:qa what does this vault say about ….
    • Run /b:lint for a health check.

Prefer to set things up by hand? You can skip /b:onboard, rename the *.template.md files yourself, and edit the {{PLACEHOLDERS}} directly.

Works beyond Claude Code

The template is plain markdown files plus instructions for an agent. Drive it in any tool where an AI assistant can reach your files: Claude Code, Claude Desktop (the Code tab), GitHub Copilot (VS Code), Codex, Cursor, or Antigravity.

  • Commands go in the agent's chat. In Claude Code / Claude Desktop (Code) they run directly as /b:onboard, /b:ingest. In other tools, ask in a sentence: "follow the instructions in .claude/commands/b/ingest.md."
  • No terminal needed. Git without commands: tell the agent "save my changes," use the panel buttons (VS Code–based tools), or use a cloud mode where the agent opens the pull request itself.
  • Don't want git at all? Download a ZIP: the Code button → Download ZIP → unzip, and open the folder in your tool.

See ENVIRONMENTS.md for the full tool-by-tool matrix.

Skills

CommandWhat it does
/b:onboardInterview + scaffold a fresh knowledge base from the template (personalizes the brain, creates topics, builds indexes).
/b:ingestTurn raw sources (files in _raw/inbox/, or YouTube URLs) into wiki notes; updates indexes.
/b:compileSynthesize a new article from existing notes on a topic.
/b:enhanceImprove a single note: fill gaps, add wikilinks, mark reviewed.
/b:qaAnswer a question from the vault, citing notes.
/b:lintAudit vault health: frontmatter, broken links, orphans, stubs, stale notes.
/b:outputGenerate a report/summary (reading list, topic map, timeline).
/b:reindexRebuild vault-map.md, catalog.md, graph.md from all notes.
/b:refactorRename/move/merge/split notes with automatic wikilink repair.
/b:gapsCoverage analysis: weakly-connected notes, missing topics, thin areas.
/b:curateStaleness hygiene: score notes (age, isolation, dead links, duplication), propose archive/merge/refresh, retire confirmed notes to _graveyard/ (reversible).
(skill) excalidraw-diagramGenerate Excalidraw diagram JSON to embed in notes.
(skill) research, research-deep, …Structured multi-item web research into the vault (best-effort; depends on your Claude Code web tools).

Prerequisites

  • Python 3 with PyYAML — required for the reindex and lint scripts (pip install -r requirements.txt).
  • Node — optional, only for npm run format (Prettier).
  • yt-dlp (+ ffmpeg) on PATH — optional, only for ingesting YouTube URLs.

Adding publishing later

This template omits the Quartz static-site pipeline and the optional brain-mcp server on purpose. Either can be layered on top of content/ later without changing how the skills work.

License

MIT — use it, fork it, make it yours. The example notes under content/ are scaffolding meant to be replaced; they carry the same license.

How to Install

  1. Download the ZIP or clone the repository
  2. Open the folder as a vault in Obsidian (File → Open Vault)
  3. Obsidian will prompt you to install required plugins

Stats

Stars

2

Forks

1

License

MIT

Last updated 21d ago