This script generates a knowledge tree for Obsidian by retrieving files with specific tags from your vault and using large language models to create a comprehensive summary.
This feature should ideally be built into an Obsidian AI plugin, but currently I haven't found a suitable one. Since I'm not familiar with plugin development or frontend work, I implemented this functionality as a Python script. PRs are welcome!
-
First, install the Obsidian Local REST API plugin.
-
Note down your Obsidian API key.
-
Clone this repository (or download the ZIP file) locally, then install dependencies:
pip install -r requirements.txt
-
Configure the Obsidian API and your LLM API by creating a
.envfile with these variables:OB_API_BASE_URL="your_obsidian_api_url" OB_API_KEY="your_obsidian_api_key" LLM_API_BASE_URL="your_llm_api_url" LLM_API_KEY="your_llm_api_key"
-
Run the script:
Windows:
python obsidian_summarizer.py `
--tag '#your_tag' `
--model 'model_name' `
--output 'output.md'Linux/macOS:
python obsidian_summarizer.py \
--tag '#your_tag' \
--model 'model_name' \
--output 'output.md'You'll then receive an AI-generated summary document.
Follow me on WeixinMP/SSPAI (ID: 西郊次生林).

