Knowledge Curator
本插件是一个结构驱动的内容填充工具。它扫描您现有的 Obsidian Vault 潜在链接,并允许您一键选中任何“待填充”的链接,调用 AI 为其生成符合预设模板的详细内容。
Obsidian Knowledge Curator
Knowledge Curator is an Obsidian plugin that acts as a link-driven knowledge graph extender. It scans your vault for all [[wikilinks]], identifies "unresolved links" (links that point to non-existent files), and presents them in an intelligently sorted list. With a single click, you can create the corresponding file and use AI to populate it with content, helping you organically grow your knowledge network.
✨ Key Features
- 🔍 Unresolved Link Explorer: A dedicated sidebar view that lists all your broken links, making it easy to spot gaps in your knowledge base.
- 🧠 One-Click AI Generation: Select any unresolved link, and the plugin will automatically create a new note and fill it with AI-generated content based on a prompt template of your choice.
- 📝 Prompt Template System: Define and manage custom prompt templates directly in the settings. Use the
{{title}}placeholder to dynamically insert the link name into your prompts. This offers greater flexibility and control over the AI's output. - 📊 Smart Sorting & Grouping: Sort links by frequency (most referenced first) or alphabetically. Group them by the folder they were found in to focus on specific areas of your vault.
- 🔗 Context-Aware Generation: (Optional) The plugin can gather context from all notes that reference a link, providing the AI with background information for more relevant and specific content.
- 🌐 Internationalization: Full support for English and Chinese (中文) interfaces, switchable in the settings.
- ✅ Batch Operations: Select multiple links using "Select All" or "Deselect All" buttons and generate content for them in a batch.
- 🔍 Search & Filter: Quickly find specific unresolved links using the built-in search bar.
- ⚙️ Highly Configurable: Easily configure your AI API endpoint, model, and other generation preferences.
- 🎨 Polished UI/UX: Enjoy smooth animations and a responsive interface with non-intrusive modals for a better user experience.
🚀 Getting Started
Prerequisites
- Obsidian (version 1.0.0 or higher)
- An API key for an OpenAI-compatible service (e.g., OpenAI, local LLMs).
Installation
From Community Plugins (Recommended when available)
- Go to
Settings>Community Plugins. - Turn on
Community plugins. - Click
Browseand search for "Knowledge Curator". - Click
Installand thenEnable.
For Testing (Using BRAT)
- Install the BRAT plugin.
- In Obsidian, open the command palette (
Ctrl+PorCmd+P) and runBRAT: Add a beta plugin for testing. - Enter this repository's URL:
https://github.com/Larrtroffen/Knowledge-Curator. - Enable "Knowledge Curator" in your community plugins list.
Manual Installation
- Download the latest release from the Releases page.
- Create a folder named
knowledge-curatorin your vault's.obsidian/plugins/directory. - Move the downloaded
main.js,manifest.json, andstyles.cssfiles into the new folder. - Enable "Knowledge Curator" in
Settings>Community Plugins.
Configuration
- Open the "Knowledge Curator" plugin settings.
- API Configuration:
- API Endpoint URL: Your OpenAI-compatible API endpoint (e.g.,
https://api.openai.com/v1/chat/completions). - API Key: Your secret API key.
- Model Name: The model to use for generation (e.g.,
gpt-4,gpt-3.5-turbo).
- API Endpoint URL: Your OpenAI-compatible API endpoint (e.g.,
- Prompt Templates:
- This is where you define the instructions for the AI. You can add, edit, or delete prompt templates.
- Click "Add new template". A modal will appear.
- Template Name: Give your template a unique name (e.g., "Detailed Summary").
- Prompt: Enter the actual prompt for the AI. Use
{{title}}as a placeholder for the unresolved link's name. For example:Please provide a comprehensive summary of the topic: {{title}}. Include key concepts, important figures, and historical context. - Click "Save" to add the template.
- Generation Configuration:
- Default Folder for New Notes: The folder where new notes will be created (e.g.,
Inbox). Leave empty to create in the vault root. - Enable Context-Aware Generation: If enabled, the plugin will find all notes that reference the unresolved link and append their content to the AI prompt as context.
- Default Folder for New Notes: The folder where new notes will be created (e.g.,
- Interface:
- Interface Language: Choose between
Englishand中文 (Chinese).
- Interface Language: Choose between
📖 How to Use
- Open the View: Open the Knowledge Curator view from the Obsidian ribbon or by running the
Open Knowledge Curator viewcommand. - Scan for Links: The plugin automatically scans for unresolved links on load. You can manually refresh using the refresh button in the sidebar.
- Explore Links: Browse the list of unresolved links. You can sort, group, and search to find the ones you want to address.
- Select a Prompt Template: In the Curator View's toolbar, use the dropdown to select one of your configured prompt templates.
- Select & Generate:
- Single Link: Click the checkbox next to a link, then click the "Generate Selected" button.
- Multiple Links: Use the "Select All" button to select all visible links, or manually select multiple checkboxes. Then click "Generate Selected".
- Review & Refine: The plugin will create the new note (e.g.,
My Link Title.md) and fill it with the entire AI-generated output based on your chosen prompt. The link will disappear from the unresolved list. You can then open the new note and review or edit the content.
🏗️ Workflow Diagram
graph TD
A[Open Curator View] --> B[Scan Vault for Unresolved Links];
B --> C{Display Links in Sidebar};
C -- User Selects Link(s) & Prompt Template --> D[Create New Note File];
D -- Optional: Gather Context --> E[Format Prompt with {{title}}];
E --> F[Call AI API for Content];
F --> G[Populate New Note with AI Output];
G --> H[Refresh Link List];
H --> C;
🛠️ Development
This project is built with TypeScript and uses ESBuild for bundling.
Setup
- Clone the repository:
git clone https://github.com/Larrtroffen/Knowledge-Curator.git cd Knowledge-Curator - Install dependencies:
npm install
Scripts
npm run dev: Starts the development server, watching for file changes and recompiling.npm run build: Compiles TypeScript and bundles the plugin into thedistfolder.npm run version: Bumps the plugin version usingversion-bump.mjs.
Project Structure
main.ts: Entry point of the plugin. Handles settings, commands, and view registration.CuratorView.ts: Manages the sidebar UI, user interactions, and rendering of the link list.VaultScanner.ts: Responsible for scanning the vault and identifying unresolved links.GeneratorService.ts: Handles the logic for fetching templates, gathering context, and orchestrating content generation.ApiService.ts: A simple service for making API calls to the LLM endpoint.i18n.ts: Contains all translation strings for internationalization.
🤝 Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
Distributed under the MIT License. See LICENSE for more information.
🙏 Acknowledgments
- The design and concept were inspired by the need to streamline the process of expanding a personal knowledge base.
- Thanks to the Obsidian community for providing an excellent platform and API for plugin development.
- This plugin was built with the help of the Obsidian Sample Plugin template.
How to Install
- Download the ZIP or clone the repository
- Open the folder as a vault in Obsidian (File → Open Vault)
- Obsidian will prompt you to install required plugins
Stats
Stars
1
Forks
0
License
MIT
Last updated 8mo ago
Categories
Tags