AI chat assistant for Obsidian with vault awareness, semantic search, one-click edits, and native Python execution.
Compython is a fork of Smart Composer that adds the ability to write and run Python code directly inside Obsidian — both manually by the user and autonomously by the AI model.
Every Python code block in the chat gets a "Run Python" button. Click it and the output appears inline — no terminal, no switching apps, no copy-paste.
- Works with any AI model — local (Gemma, Qwen, LLaMA) or cloud (Claude, GPT, Gemini)
- No tool calling required — based on markdown code block detection, so every model works
- Output appears inline with stdout, stderr, and exit code
- The vault path is automatically available as the
VAULT_PATHenvironment variable inside scripts
- Contextual Chat — reference vault files with
@filenamesyntax - Apply Edit — AI suggests edits to your notes with one-click apply
- Vault Search (RAG) — semantic search across your entire vault
- MCP Support — connect to external tools via Model Context Protocol
- Local Model Support — Ollama, LM Studio, and any OpenAI-compatible provider
- Custom System Prompts and Prompt Templates
- Multiple AI providers: Anthropic, OpenAI, Gemini, Groq, DeepSeek, OpenRouter, and more
- Download the latest release:
main.js,manifest.json,styles.css - Create the folder:
YOUR_VAULT/.obsidian/plugins/compython/ - Copy the 3 files into that folder
- In Obsidian:
Settings → Community plugins → reload→ enable Compython
⚠️ If you have Smart Composer installed, disable or uninstall it first — they conflict since they register the same view type.
- Go to
Settings → Compython → Python Executor - Toggle Enable Python execution ON
- Set the Python path:
- Windows:
pythonorC:\Python311\python.exe - macOS/Linux:
python3
- Windows:
- Configure timeout and confirmation preferences
- Done — every
pythoncode block in chat will now have a Run Python button
import os
vault = os.environ.get("VAULT_PATH", ".")
print(f"My vault is at: {vault}")
# List all markdown files in the vault
import pathlib
notes = list(pathlib.Path(vault).rglob("*.md"))
print(f"Found {len(notes)} notes")git clone https://github.com/disonfranco/compython
cd compython
npm install
npm run dev # watch mode
npm run build # production buildCopy main.js, manifest.json, and styles.css to your vault's plugin folder after building.
- Auto-run Python after AI response (agentic loop for local models)
- Plot rendering — display matplotlib figures inline in chat
- Session state — persistent Python environment across executions
- Virtual environment support — point to a venv instead of system Python
- Safety sandbox — optional restricted execution mode
Compython is built on top of Smart Composer by @glowingjade and contributors. All original features and architecture are theirs — Compython adds the Python execution layer on top.
Authors of the Python execution feature:
- Dison Franco — concept, testing, and direction
- Claude (Anthropic) — implementation
MIT — same as the original Smart Composer.