obsidian-rag

Connect your Obsidian vault to Claude with powerful local RAG capabilities.

obsidian-rag

CI

A Claude Code plugin that connects your Obsidian vault to Claude through 18 MCP tools, 13 skills, and 2 specialized agents. Semantic search is powered by local embeddings (all-MiniLM-L6-v2) with a LanceDB vector store — everything runs locally with no external API calls.

Features

  • Full vault CRUD — read, create, append, move, and edit notes with section-level precision
  • Local RAG pipeline — semantic search across your entire vault using local embeddings
  • Incremental indexing — only re-embeds changed files, with automatic reindexing after writes
  • Daily notes — create, read, and append to daily notes with timestamped log entries
  • Link graph — traverse outgoing links, backlinks, and find broken wikilinks
  • Frontmatter management — safe YAML frontmatter updates with schema validation
  • Skills and agents — higher-level workflows for research, organization, and vault maintenance

Installation

From the marketplace

In Claude Code, run:

/plugin marketplace add thoreinstein/claude-plugins
/plugin install obsidian-rag@thoreinstein-plugins

Manual

git clone https://github.com/thoreinstein/obsidian-rag.git ~/.claude/plugins/obsidian-rag
cd ~/.claude/plugins/obsidian-rag
npm install

The built artifact (dist/index.js) is committed to the repo, so no build step is needed. Native dependencies are automatically installed on first session start when using the marketplace install.

Quick start

  1. Set your vault path — use /vault or set OBSIDIAN_VAULT_PATH in your environment
  2. Build the index — run /index to build the vector index (incremental updates happen automatically)
  3. Start using it — ask questions about your notes, create new ones, or use any of the skills below

Tools

Reading and searching

ToolDescription
obsidian_read_noteRead the full content of a note
obsidian_list_notesList markdown files in the vault or a subdirectory
obsidian_search_notesSearch notes by keyword (filename and content)
obsidian_rag_querySemantic search across the indexed vault
obsidian_get_daily_noteGet or create today's daily note

Writing and editing

ToolDescription
obsidian_create_noteCreate a new note (auto-creates parent directories)
obsidian_append_noteAppend text to an existing note
obsidian_append_daily_logAppend a timestamped entry under a daily note heading
obsidian_replace_sectionReplace the body under a heading
obsidian_insert_at_headingInsert content at the beginning or end of a section
obsidian_replace_in_noteReplace the first occurrence of a text string
obsidian_update_frontmatterUpdate YAML frontmatter (single or batch)
obsidian_move_noteMove or rename a note

Links and graph

ToolDescription
obsidian_get_linksGet all outgoing [[wikilinks]] from a note
obsidian_get_backlinksFind all notes that link to a given note
obsidian_get_broken_linksFind wikilinks pointing to non-existent notes

Index and config

ToolDescription
obsidian_rag_indexBuild or rebuild the vector index (incremental by default)
obsidian_set_vaultSet the default vault path

Skills

Skills are higher-level workflows invoked with /skill-name in Claude Code.

Core skills

SkillDescription
/obsidian-companionGuides tool selection and writing strategy for vault operations
/researchDeep vault research — chains semantic search, note reading, and link traversal to synthesize answers with citations
/journalDaily note workflows — view today's entry, add logs, weekly review
/indexBuild or rebuild the vector index
/vaultSet or change the vault path
/searchFind notes by keyword or filename
/linksExplore connections between notes (outgoing links, backlinks)

Advanced workflow skills

SkillDescription
/cross-linkerFind unlinked mentions across the vault and insert missing [[wikilinks]] with confidence scoring
/vault-lintHealth audit — frontmatter compliance, stale content, orphaned notes, MOC coverage gaps
/wiki-ingestDistill external sources (PDFs, markdown, transcripts) into vault-native notes with provenance tracking
/compoundPromote cross-project knowledge to a global folder via semantic clustering
/moc-updateSuggest which Maps of Content a new note belongs in
/link-auditAudit link health — broken wikilinks, orphaned notes, semantic link suggestions

Agents

Agents are specialized subprocesses launched automatically when a task requires deep, multi-step work.

AgentPurpose
researcherDeep vault research with semantic search chaining, full note reading, link following, and backlink discovery. Synthesizes findings with citations.
librarianVault organization and maintenance — audits folder structure, cleans up frontmatter, finds orphan notes, and suggests reorganization.

Configuration

Environment variables

VariableDefaultDescription
OBSIDIAN_VAULT_PATHDefault vault path (overrides config file)
OBSIDIAN_RAG_MIN_CHUNK_CHARS40Minimum chunk size in characters
OBSIDIAN_RAG_MAX_CHUNK_CHARS1800Maximum chunk size in characters
OBSIDIAN_RAG_TARGET_CHUNK_CHARS700Target chunk size for merging small chunks
OBSIDIAN_RAG_EMBED_BATCH_SIZE48Number of chunks to embed per batch

Data storage

When installed as a plugin, all state is stored in the plugin's persistent data directory (~/.claude/plugins/data/{id}/). For development or CLI usage, falls back to ~/.

FilePurpose
.obsidian-rag.config.jsonVault path configuration
.obsidian-rag-lancedb/LanceDB vector store
.obsidian-rag-file-hashes.jsonMD5 hashes for incremental indexing

Optional vault-level config

FilePurpose
.obsidian-rag-schema.jsonFrontmatter validation schema (enforced by PreToolUse hook)
.manifest.jsonIngest tracking and source provenance (used by /wiki-ingest)

Hooks

The plugin registers three hooks that run automatically:

HookTriggerWhat it does
Dependency installSession startInstalls native deps if package.json has changed
Session initSession startReports vault status and runs incremental reindex
Reindex noteAfter note writesRe-embeds the modified note to keep the index fresh
Validate frontmatterBefore note creationBlocks creation if required frontmatter fields are missing

Architecture

Obsidian vault (markdown files)
        |
    [chunking] ── splits notes into semantic chunks
        |
   [embedder] ── all-MiniLM-L6-v2 via @xenova/transformers (local)
        |
   [LanceDB] ── vector store with incremental updates
        |
   [MCP server] ── 18 tools exposed over stdio
        |
   Claude Code ── skills, agents, and hooks

The MCP server runs over stdio and also supports a one-shot CLI mode used by hook scripts. The embedding model runs entirely locally — no data leaves your machine.

Development

npm install          # Install dependencies
npm run build        # Bundle with esbuild
npm run type-check   # TypeScript validation
npm test             # Run tests with vitest

Key constraints

  • onnxruntime-node pinned to 1.14.0 — required by @xenova/transformers 2.17.x; do not upgrade
  • Native deps externalized@lancedb/lancedb, onnxruntime-node, and sharp are excluded from the esbuild bundle and load from node_modules at runtime
  • dist/ is committed — the built artifact is checked in so the plugin works after clone + npm install with no build step
  • Dependency placement is intentional — bundled deps are in devDependencies (esbuild bakes them in); externalized native deps are in dependencies (loaded from node_modules)

Project structure

.claude-plugin/plugin.json   # Plugin manifest (MCP server config, hooks)
src/
  index.ts                   # MCP server and tool implementations
  utils.ts                   # Wikilink extraction, section editing, frontmatter ops
  rag/
    store.ts                 # VaultIndexer (LanceDB vector store)
    embedder.ts              # Embedding pipeline (@xenova/transformers)
    chunking.ts              # Text chunking module
skills/                      # 13 skill definitions
agents/                      # 2 agent definitions (researcher, librarian)
scripts/                     # Hook shell scripts
test/                        # Vitest test suite
dist/index.js                # Built artifact (committed)

License

MIT