New Plugin: Vault AI Chat with RAG, file deletion/creation, AI generated content, AI summarization

Vault AI Chat - Obsidian Plugin

An AI-powered chat assistant that lives inside your Obsidian vault. Ask questions, get answers based on your notes, and manage files directly from the chat interface.

Version
Obsidian

:sparkles: Features

:speech_balloon: AI Chat

  • Chat with AI right inside Obsidian
  • AI reads your notes for context (RAG - Retrieval Augmented Generation)
  • Supports multiple AI providers
  • Streaming responses for real-time feedback

:file_folder: File Operations

Manage your vault directly from the chat with slash commands:

  • Create files and folders
  • Delete files and folders
  • Append text to existing files
  • Read and list files

:robot: AI-Powered Writing

  • Generate complete notes with AI
  • Save any AI response as a note
  • Copy responses to clipboard

:rocket: Installation

Option 1: Pre-built (Easy)

  1. Download vault-ai-chat-v1.1.1.zip

  2. Extract the zip file

  3. Copy the 3 files (main.js, manifest.json, styles.css) to:

    YourVault/.obsidian/plugins/vault-ai-chat/
    
  4. Create the vault-ai-chat folder if it doesn’t exist

  5. Restart Obsidian

  6. Go to Settings β†’ Community Plugins β†’ Enable β€œVault AI Chat”

Option 2: Build from Source

See the Building from Source section below.


:gear: Configuration

  1. Open Obsidian Settings
  2. Go to β€œVault AI Chat” in the left sidebar
  3. Choose your AI provider and enter your API key
  4. Select a model
  5. Click β€œTest” to verify the connection

Supported Providers

Provider Description Get API Key
OpenRouter Access to many AI models (Claude, GPT-4, Llama, etc.) openrouter.ai/keys
Google AI Gemini models (2.0, 2.5) aistudio.google
Ollama Run AI locally on your computer (free!) ollama.ai
MiniMax MiniMax M2 models platform.minimax.i
OpenAI Compatible Any API that works like OpenAI (DeepSeek, Groq, Z.AI GLM, local LLMs) Varies

:clipboard: Commands Reference

File Operations

Command Aliases What it does Example
/create <path> /new, /touch Creates an empty file /create Projects/ideas
/generate <title> /gen, /ai AI writes content for you /generate Weekly Plan
/delete <file> /rm Deletes a file /delete old-draft
/append <file> <text> /add Adds text to end of file /append Journal.md Great day!
/read <file> /cat Shows file contents /read README
/list [folder] /ls Lists files /list Projects
/save Saves last AI response /save

Folder Operations

Command Aliases What it does Example
/mkdir <path> /folder Creates a folder /mkdir Projects/2024
/rmdir <path> /deletefolder Deletes folder + contents /rmdir Old Stuff

Chat Commands

Command What it does
/help Shows all commands
/clear Clears chat history

:light_bulb: Usage Examples

Creating Files

/create quick-note              β†’ Creates quick-note.md in vault root
/create Projects/meeting-notes  β†’ Creates Projects/meeting-notes.md
/create Archive/2024/January    β†’ Creates file with nested folders

AI-Generated Content

/generate Weekly Planning       β†’ AI writes a weekly planning template
/generate Project Proposal      β†’ AI creates a project proposal
/generate Study Notes: Biology  β†’ AI writes study notes

Natural Language

You can also just ask naturally:

  • β€œWrite a note about productivity tips” β†’ AI generates content with a save button
  • β€œCreate a meal plan for next week” β†’ AI writes it, you click save

File Management

/mkdir Projects/2024/Q1         β†’ Creates nested folder structure
/list Projects                  β†’ Shows files in Projects folder
/read README                    β†’ Displays README.md contents
/append Daily Log.md Had lunch  β†’ Adds text to Daily Log.md
/delete old-draft               β†’ Deletes old-draft.md (with confirmation)
/rmdir Archive/Old              β†’ Deletes folder and everything inside

:wrench: Settings

Chat Settings

  • Chat folder: Where saved chats go (default: β€œAI Chats”)
  • Enhanced notes folder: Where AI-generated notes go (default: β€œEnhanced Notes”)
  • Max context files: How many of your notes the AI sees (1-20)
  • Max tokens: Length of AI responses (500-8000)
  • Temperature: Creativity level (0 = focused, 1 = creative)

Security Note

:warning: API keys are stored in your plugin settings. If you use Obsidian Sync, these may sync across devices. For sensitive keys, consider using the OpenAI Compatible option with environment variables.


:hammer_and_wrench: Building from Source

Prerequisites:

  • Node.js (version 16 or newer) - Download here
  • A code editor (VS Code recommended)
  • Basic familiarity with the command line/terminal

Step-by-Step Instructions

Step 1: Get the source code

# If you have the source zip, extract it to a folder
# Or clone from git if available

Step 2: Open a terminal/command prompt

  • Windows: Press Win + R, type cmd, press Enter
  • Mac: Press Cmd + Space, type Terminal, press Enter
  • Linux: Press Ctrl + Alt + T

Step 3: Navigate to the plugin folder

cd path/to/vault-ai-chat

(Replace path/to/vault-ai-chat with the actual folder location)

Step 4: Install dependencies

npm install

This downloads all the required code libraries. It may take a minute.

Step 5: Build the plugin

npm run build

This compiles the TypeScript code into JavaScript that Obsidian can run.

Step 6: Copy to Obsidian
After building, you’ll have these files:

  • main.js
  • manifest.json
  • styles.css

Copy all three to your Obsidian vault:

YourVault/.obsidian/plugins/vault-ai-chat/

Step 7: Enable the plugin

  1. Restart Obsidian
  2. Go to Settings β†’ Community Plugins
  3. Find β€œVault AI Chat” and enable it

Development Mode (for making changes)

npm run dev

This watches for changes and rebuilds automatically.


:open_file_folder: Project Structure

vault-ai-chat/
β”œβ”€β”€ main.ts                 # Plugin entry point
β”œβ”€β”€ manifest.json           # Plugin metadata
β”œβ”€β”€ styles.css             # UI styling
β”œβ”€β”€ package.json           # Node.js dependencies
β”œβ”€β”€ tsconfig.json          # TypeScript configuration
β”œβ”€β”€ esbuild.config.mjs     # Build configuration
└── src/
    β”œβ”€β”€ core/
    β”‚   β”œβ”€β”€ provider.ts           # LLM provider interface
    β”‚   β”œβ”€β”€ providers/            # Provider implementations
    β”‚   β”‚   β”œβ”€β”€ openrouter.ts
    β”‚   β”‚   β”œβ”€β”€ google-ai.ts
    β”‚   β”‚   β”œβ”€β”€ ollama.ts
    β”‚   β”‚   β”œβ”€β”€ minimax.ts
    β”‚   β”‚   └── openai-compatible.ts
    β”‚   β”œβ”€β”€ grounding/
    β”‚   β”‚   β”œβ”€β”€ vault-search.ts   # Searches your notes
    β”‚   β”‚   └── context-builder.ts
    β”‚   └── templates/
    β”‚       └── note-templates.ts
    β”œβ”€β”€ storage/
    β”‚   β”œβ”€β”€ settings.ts           # Plugin settings
    β”‚   └── chat-persistence.ts   # Saves chat history
    β”œβ”€β”€ commands/
    β”‚   └── commands.ts           # Obsidian commands
    └── ui/
        β”œβ”€β”€ chat-view.ts          # Main chat interface
        └── settings-tab.ts       # Settings page

:red_question_mark: Troubleshooting

β€œNo AI provider configured”

β†’ Go to Settings β†’ Vault AI Chat and enter your API key

β€œAuthentication Error”

β†’ Check that your API key is correct and has credit/quota

β€œModel Not Found”

β†’ The model name may be wrong. Check the provider’s documentation.

Chat is slow

β†’ Try a faster model (e.g., gemini-2.0-flash or gpt-3.5-turbo)

Responses are cut off

β†’ Increase β€œMax tokens” in settings

Plugin doesn’t appear

β†’ Make sure all 3 files are in the plugin folder and restart Obsidian


:memo: Changelog

v1.1.1

  • Fixed folder/file deletion on OneDrive and cloud-synced vaults
  • Now uses trash instead of permanent delete (recoverable!)
  • Better error messages with helpful tips

v1.1.0

  • /create now creates empty files (use /generate for AI content)
  • Added /generate command for AI-written notes
  • Added /rmdir command to delete folders
  • Added /touch alias for /create
  • Improved /help with comprehensive command list

v1.0.x

  • Initial release
  • Chat interface with streaming
  • Multiple AI provider support
  • File operations (create, delete, append, read, list)
  • Folder creation
  • Save responses as notes

:page_facing_up: License

MIT License - feel free to use, modify, and distribute.


:folded_hands: Credits

Built for Obsidian by Mark Allen.

Uses the Obsidian Plugin API and various AI provider APIs.

1 Like

To download
mallen-lbx/Obsidian-vault-ai-chat

You can use Google AI, OpenRouter, MiniMax, and OpenAI (also accepts OpenAP compatible)

1 Like