Integrate Claude Code AI assistant directly into Obsidian for intelligent note editing, analysis, and automation. This plugin brings the power of Anthropic's Claude AI with full tool support right into your note-taking workflow.
- Direct Integration: Run Claude Code commands directly from within Obsidian
- Context-Aware: Claude understands your note content and vault structure
- Streaming Responses: See Claude's thoughts in real-time as it processes your request
- File Modifications: Claude can read, edit, and create files with your permission
- Real-Time Streaming: Watch Claude's response appear as it's generated
- Task Tracking: Visual todo list shows Claude's plan and progress
- Preview Changes: Review modifications before applying them to your notes
- Session History: Browse and restore previous interactions
- Activity Monitoring: See exactly what tools Claude is using
- Permission Modes:
- Interactive Mode: Claude asks for permission before making changes
- Permissionless Mode: Claude operates autonomously for trusted operations
- Model Selection: Choose between different Claude models (Sonnet, Opus, Haiku)
- Vault Access: Optionally allow Claude to read/write files across your entire vault
- Custom System Prompts: Configure Claude's behavior with your own instructions
- Tool Usage: Claude can use Bash, file operations, web search, and more
- Session Resumption: Continue previous conversations across plugin restarts
- Selected Text Editing: Work on specific sections of your notes
- Auto-Apply Changes: Optionally apply Claude's edits automatically
- Markdown Rendering: Beautiful rendering of Claude's responses
- Open Obsidian Settings
- Navigate to Community Plugins
- Click "Browse" and search for "Claude Code Integration"
- Click "Install"
- Enable the plugin
- Download the latest release from GitHub Releases
- Create a folder:
.obsidian/plugins/claude-code-integration/in your vault - Extract
main.js,manifest.json, andstyles.cssto that folder - Reload Obsidian
- Enable the plugin in Settings → Community Plugins
Before using this plugin, you must have Claude Code CLI installed on your system:
# Install via npm (recommended)
npm install -g @anthropic-ai/claude-code
# Or download from Anthropic's website
# Visit: https://www.anthropic.com/claude-codeYou need an Anthropic API key to use Claude Code:
- Get your API key from Anthropic Console
- Set up the API key using one of these methods:
Option 1: Environment Variable (Recommended)
export ANTHROPIC_API_KEY='your-api-key-here'Option 2: Claude Code Configuration
claude config set api_key your-api-key-hereOpen Settings → Claude Code Integration to configure:
- Claude Code Path: Path to the Claude Code CLI executable (default:
claude)- Leave as
claudeif installed globally via npm - Set custom path if installed elsewhere (e.g.,
/usr/local/bin/claude)
- Leave as
- Default Model: Choose your preferred Claude model
sonnet(default) - Claude Sonnet 4 - Balanced performance and speedopus- Claude Opus 4.5 - Most capable, best for complex taskshaiku- Claude Haiku - Fastest, good for simple tasks
- Custom Model: You can also specify a custom model name (e.g.,
claude-sonnet-4-5-20250929) in the advanced settings
- Enable Permissionless Mode: Allow Claude to operate autonomously
⚠️ When enabled, Claude can read/write files without asking- Useful for trusted operations and automation
- Allow Vault Access: Let Claude access files across your entire vault
- When disabled, Claude only works with the current note
- Auto Accept Changes: Automatically apply Claude's edits without preview
- Timeout (seconds): Maximum execution time (0 = no limit)
- Custom System Prompt: Add custom instructions for Claude's behavior
- Click the Claude Code icon in the left sidebar
- Or use the command palette:
Ctrl/Cmd + P→ "Open Claude Code Assistant"
-
Open a note you want to work with
-
Write your prompt in the Claude Code panel
- Examples:
- "Add a table of contents to this note"
- "Summarize the main points"
- "Create a diagram showing the workflow"
- "Fix grammar and spelling"
- Examples:
-
Configure options (optional):
- ✅ Use selected text only: Work on highlighted text
- ✅ Auto-accept changes: Skip preview step
- 🎛️ Model selection: Choose Claude model for this request
-
Click "Run Claude Code" or press
Enter -
Watch the process:
- Result: See Claude's response in real-time
- Activity: Monitor what tools Claude is using
- Output: View detailed execution logs
-
Review and apply (if changes were made):
- View the diff in the Preview section
- Switch between Raw, Rendered, and Diff views
- Click "Accept" to apply or "Reject" to discard
Prompt: "Add a table of contents and organize this content with proper headings"
Prompt: "Create a PlantUML diagram showing the authentication flow"
Prompt: "What are the key themes in this note? Are there any gaps I should address?"
Prompt: "Improve the clarity of this explanation and add code examples"
- Each note has its own Claude Code session
- Sessions persist across plugin restarts
- View session history in the History panel
- Resume previous conversations
- Raw View: See the exact markdown Claude will apply
- Rendered View: Preview how the note will look
- Diff View: Compare original vs modified content line-by-line
- When Claude uses the TodoWrite tool, see its plan
- Track progress as Claude completes tasks
- Visual indicators for pending, in-progress, and completed items
- In interactive mode, Claude asks before making changes
- Review what Claude wants to do
- Approve or deny with one click
- Re-run with permissionless mode if you trust the operation
- All Claude Code CLI output is captured
- Tool usage is displayed with formatted details
- Errors and warnings are highlighted
- Expandable logs for debugging
Enter: Run Claude Code (when focused in prompt input)Ctrl/Cmd + Enter: Insert newline in promptEsc: Cancel running operation
- Solution: Install Claude Code CLI and configure the path in plugin settings
- Verify installation: Run
claude --versionin terminal
- Check: Is Claude Code CLI installed and accessible?
- Check: Is your API key configured correctly?
- Try: Set absolute path in plugin settings (e.g.,
/usr/local/bin/claude)
- Solution: Ensure Claude Code CLI has proper permissions
- On Linux/Mac:
chmod +x /path/to/claude
If you installed Obsidian via Flatpak or Snap, you may encounter errors like:
env: 'node': No such file or directoryClaude Code failed with code 127
This happens because Flatpak/Snap sandboxing blocks access to system binaries.
Solution: Grant Filesystem Permissions
# Allow access to the entire filesystem (recommended)
flatpak override --user md.obsidian.Obsidian --filesystem=host
# Or grant specific access to node and claude locations
flatpak override --user md.obsidian.Obsidian --filesystem=/usr/bin
flatpak override --user md.obsidian.Obsidian --filesystem=/bin
flatpak override --user md.obsidian.Obsidian --filesystem=~/.nvm
flatpak override --user md.obsidian.Obsidian --filesystem=~/.bun- Install Flatseal:
flatpak install flathub com.github.tchx84.Flatseal - Open Flatseal and find "Obsidian"
- Under "Filesystem" section, enable:
- All system files (easiest), or
- Add custom paths:
/usr/bin,/bin,~/.nvm,~/.bun
- Restart Obsidian
# Grant access to home directory
snap connect obsidian:home
# May need to install Obsidian from a different source
# as Snap has stricter sandboxingAlternative: Install Obsidian via other methods (AppImage, .deb, .rpm) to avoid sandboxing issues entirely.
- Check: Is the Result section collapsed? Click the header to expand
- Check: Console for errors (Ctrl/Cmd + Shift + I)
- Claude Code uses your Anthropic API account
- Monitor usage at Anthropic Console
- Consider using Haiku model for lower costs
- Processing: All processing happens through the Claude Code CLI on your machine and sent to Claude Servers
- Your API Key: The plugin never sees or stores your API key
- Vault Access: You control whether Claude can access your vault
- Permission Control: Interactive mode lets you review all changes
- No Telemetry: This plugin doesn't collect or send usage data
The plugin automatically detects your operating system and configures the appropriate shell environment:
| Platform | Shell | Profile Files Loaded |
|---|---|---|
| Windows | cmd.exe (via COMSPEC) |
Uses system environment directly |
| macOS | User's shell ($SHELL) |
zsh: ~/.zshenv, ~/.zprofile, ~/.zshrc |
| Linux | User's shell ($SHELL) |
bash: ~/.profile, ~/.bash_profile, ~/.bashrc |
| Fish shell | fish |
Loaded via fish -l |
The plugin loads your shell environment to ensure Claude Code has access to:
- Your
PATH(to find theclaudeCLI) - Environment variables like
ANTHROPIC_API_KEY - Any custom configurations from your shell profiles
- The plugin uses
cmd.exeby default (via theCOMSPECenvironment variable) - PATH is correctly parsed using
;as separator - Executable extensions (
.exe,.cmd,.bat) are automatically checked - Home directory uses
USERPROFILEwhenHOMEis not set
- The default shell is detected from the
$SHELLenvironment variable - Profile files are sourced to load environment variables
- If your shell is not zsh or bash, the plugin falls back to login shell mode (
-lflag)
# Clone the repository
git clone https://github.com/yourusername/obsidian-claude-code-plugin.git
cd obsidian-claude-code-plugin
# Install dependencies
npm install
# Build the plugin
npm run build
# Watch for changes during development
npm run devsrc/
├── core/ # Core logic
│ ├── claude-code-runner.ts # Main execution engine
│ ├── streaming/ # Stream processing
│ ├── session-manager.ts # Session handling
│ └── prompt-builder.ts # Prompt construction
├── ui/ # User interface
│ ├── view.ts # Main view component
│ ├── ui-builder.ts # UI construction
│ └── renderers/ # Output rendering
└── main.ts # Plugin entry point
Contributions are welcome! Please feel free to submit issues and pull requests.
- Additional UI features and improvements
- Documentation improvements
- Test coverage
- Issues: GitHub Issues
- Built with the Obsidian API
- Powered by Anthropic's Claude
- Uses Claude Code CLI
MIT License - see LICENSE file for details
Note: This plugin requires Claude Code CLI and an Anthropic API key. Costs are based on your Anthropic API usage.
