Skip to content

Repository files navigation

Obsidian RAG Integration

Chat with your Obsidian vault using configurable LLM providers, embeddings, local vector search, and optional pgvector storage.

Features

  • Chat view inside Obsidian with streaming responses.
  • Vault-aware RAG mode that retrieves indexed note chunks before answering.
  • Configurable chat, embedding, and rerank models.
  • Markdown-aware chunking strategies:
    • delimiter splitting
    • Markdown heading splitting
    • Markdown Q&A splitting
    • fixed length splitting
  • Local vector storage in the vault.
  • Optional PostgreSQL + pgvector storage for larger indexes.
  • Per-file chunking overrides and chunk preview in the index manager.
  • Optional LightRAG backend for graph-based RAG answers, Markdown vault sync, processing status, and source references.

Requirements

  • Obsidian desktop.
  • Node.js 18+ for development.
  • An OpenAI-compatible chat and embedding endpoint, or one of the configured providers.
  • Optional: PostgreSQL with the pgvector extension if you choose pgvector storage.

This plugin is currently desktop-only because pgvector support uses the Node.js pg package. Mobile support would require removing or lazily isolating that desktop dependency.

Installation

Manual install

  1. Run a production build:

    npm install
    npm run build
  2. Copy these files into your vault:

    <Vault>/.obsidian/plugins/simple-rag-plugin/
      main.js
      manifest.json
      styles.css
    

    styles.css is only needed if present.

  3. Reload Obsidian.

  4. Enable the plugin from Settings → Community plugins.

Development

npm install
npm run dev

For easiest local development, keep this repository inside:

<Vault>/.obsidian/plugins/simple-rag-plugin/

Basic setup

  1. Open Settings → Obsidian RAG Integration.
  2. Add at least one chat model and one embedding model.
  3. Select the embedding model in the Embedding tab.
  4. Choose a vector database:
    • Local file stores vectors inside the vault.
    • pgvector stores vectors in PostgreSQL.
  5. Select a chunking strategy.
  6. Run Index all vault notes or index individual files from the index manager.
  7. Open Copilot Chat and ask questions about your vault.

LightRAG setup

  1. Open Settings → Obsidian RAG Integration → LightRAG.
  2. Enable LightRAG and set the server URL, for example http://192.168.50.209:9621.
  3. Select Test connection to verify /health.
  4. Keep Auto sync Markdown enabled or select Start sync to sync immediately. Edits are debounced (continuous typing is coalesced into a single re-sync after you pause, with a hard cap so a long editing session still syncs periodically), and the periodic scan defers to files you are actively editing to avoid re-processing intermediate states. Renames and deletions remove the corresponding LightRAG document, and a full Start sync also reconciles the server by removing orphaned documents whose vault files no longer exist (only documents previously created by this plugin are touched).
  5. In Vault chat mode, the default answer mode calls LightRAG /query/data for retrieval, then uses the plugin's selected chat model to generate the final answer. You can switch to direct LightRAG /query/stream generation in the LightRAG query settings.

LightRAG sync only sends Markdown files. New or changed files are submitted in batches of up to 3 texts per /documents/texts request. When a synced file changes, the plugin deletes the previously tracked LightRAG document and inserts the updated text because the current LightRAG API does not expose an in-place document update endpoint. The plugin listens for vault file events, scans once on startup, and can periodically rescan the vault by mtime to catch missed events. The LightRAG exclude list supports exact paths, folder prefixes such as private/, and simple glob rules such as archive/**/*.md; excluded files are not synced and previously synced excluded files are removed from LightRAG on the next scan. LightRAG chat defaults to /query/data retrieval plus plugin-model generation, strips generated inline References sections, and shows a limited de-duplicated source list based on retrieved chunks. The LightRAG settings tab refreshes pipeline and tracked document status automatically while it is open.

Commands

  • Open Copilot chat
  • Index all vault notes
  • Reindex current file

Privacy and network access

This plugin does not include hidden telemetry.

Depending on your settings, it may send the following data to external services:

  • Chat messages and retrieved note context to your selected chat model provider.
  • Note chunks and user queries to your selected embedding provider.
  • Candidate retrieval results to your selected rerank provider, if reranking is enabled.
  • If LightRAG is enabled, Markdown file contents and vault-chat retrieval queries are sent to your configured LightRAG server. In the default answer mode, retrieved chunks are then sent to your selected chat provider so the plugin's model can generate the final answer. If you switch to direct LightRAG generation, LightRAG uses its own configured LLM for the final answer.

API keys are stored in Obsidian plugin settings data. Only configure providers you trust. If you use local vector storage, vectors are stored inside your vault. If you use pgvector, vectors and chunk text are stored in your configured PostgreSQL database.

Release checklist

For a GitHub release, make sure:

  • manifest.json has the correct version.
  • versions.json maps that version to the correct minAppVersion.
  • npm run build succeeds.
  • Push a tag that exactly matches manifest.json version, for example 0.1.0.
  • The release workflow will build the plugin and upload main.js, manifest.json, styles.css if present, and a zip archive.
git tag -a 0.1.0 -m "0.1.0"
git push origin 0.1.0

License

See LICENSE.

Releases

Packages

Contributors

Languages