# Auto MOC and AI Tagger Version 1.0.3 requires **Obsidian 1.13.0 or later**. See [CHANGELOG.md](CHANGELOG.md) for migration notes and validation scope. ## Development ```sh npm ci npm run lint npm test npm run build ``` The repository includes official Obsidian lint checks, regression tests, and GitHub Actions build artifacts. Release assets must include `main.js`, `manifest.json`, and `styles.css`; keep `manifest.json` at the root of the default branch. ## Data and network use Tagging sends the active note body to the configured provider. Recommendations can send up to 2,000 characters from each candidate note across the vault to the configured embedding provider. Local Ollama endpoints keep these requests local; hosted endpoints receive the input. Requests begin when you start processing in the AI panel. Model lists are fetched when the relevant settings render. API keys are stored in local plugin `data.json` and masked in the settings UI. Embedding vectors and note paths are stored in `embeddings-cache.json`. Neither file belongs in Git. This plugin has no telemetry. Missing Ollama models must be installed manually with `ollama pull `. Request timeout/cancellation stops waiting and prevents late note writes, but Obsidian's underlying HTTP request may continue at the provider. Existing legacy recommendation sections are preserved on migration; remove any duplicate old section manually. For more pleasant quick-start, please read: ๐Ÿ“– [docs](https://zhangpl666ya.github.io/auto-moc-ai-tagger/) Automatically maintain folder-level Maps of Content (MOCs) and use a local or cloud LLM to tag notes and recommend similar notes based on vector embeddings. ## Features - **Auto MOCs** โ€” Generate and update a `MOC.md` for every folder in your whitelist, listing child folders and notes with their tags, last-modified date, and clickable wikilinks. - **AI Tagging** โ€” Send notes to Ollama, OpenAI, or Anthropic and write generated tags back to YAML frontmatter. - **Similar Notes** โ€” Embed note contents with a local or hosted embedding model and show the top-N most similar notes in a side panel. - **Live Updates** โ€” Create, delete, rename, and modify events update MOCs within a configurable debounce window. - **Bilingual UI** โ€” Switch between ไธญๆ–‡ and English from the settings tab. The plugin UI, generated MOCs, and the LLM tag-extraction prompt all follow the chosen language. - **Privacy First** โ€” Bring-your-own endpoint. Local Ollama keeps everything on your machine; cloud providers are opt-in. ## Installation ### From Obsidian Community Plugins (after approval) 1. Open **Settings โ†’ Community plugins**. 2. Make sure Community plugins are enabled. 3. Click **Browse** and search for `Auto MOC and AI Tagger`. 4. Click **Install**, then **Enable**. ### Manual / BRAT 1. Download `main.js`, `manifest.json`, and `styles.css` from the latest release. 2. Create the folder `/.obsidian/plugins/auto-moc-ai-tagger/`. 3. Drop the three files inside. 4. Enable the plugin in **Settings โ†’ Community plugins**. ## Quick Start 1. Open **Settings โ†’ Auto MOC and AI Tagger**. 2. Add the folders you want MOCs for to the **Whitelist** (e.g. `ๅญฆไน `, `ๅทฅๅ…ท`). 3. (Optional) Pick a tagging provider. Ollama is the easiest zero-cost option: - Install [Ollama](https://ollama.com) and pull a small model: `ollama pull qwen2.5:0.5b`. - Set `taggingProvider` to `ollama` (default). 4. (Optional) Pick an embedding provider for similar-notes. Recommended: `nomic-embed-text` via Ollama. 5. Run the command **Update all MOCs** from the command palette (or click the brain-circuit ribbon icon). ## Commands | Command | What it does | |---|---| | `ๆ›ดๆ–ฐๆ‰€ๆœ‰็™ฝๅๅ•็š„ MOC` | Regenerates every MOC in your whitelisted folders. | | `AI ็ฌ”่ฎฐๅค„็†ไธŽๆถฆ่‰ฒ้ขๆฟ` | Opens a modal for the active note: tag it, find similar notes, apply tags. | ## Settings The plugin stores settings in `.obsidian/plugins/auto-moc-ai-tagger/data.json`. Adjustable from the settings tab: - **Whitelist** โ€” folders to maintain MOCs for. - **Recursive** โ€” include sub-folders when generating MOCs. - **Unclassified Header** โ€” section heading for notes without tags. - **Clean Broken Links** โ€” strip wikilinks that no longer resolve. - **Preserve User Content** โ€” keep your handwritten content outside the auto-generated block. - **MOC Show Stats** โ€” render the top summary callout (folder / note / tag counts). - **MOC Show Dates** โ€” append a ๐Ÿ“… `YYYY-MM-DD` modification date to each entry. - **MOC Show Icons** โ€” toggle the emoji chrome (๐Ÿ“š / ๐Ÿ“ / ๐Ÿ“„ / ๐Ÿ•’ / ๐Ÿค–). - **MOC Tag Style** โ€” render tags as `` `tag` `` (code) or `#tag` (hash). - **MOC Sort By** โ€” order notes inside each section by `mtime` (default) or `name`. - **Tagging Provider** โ€” `ollama` / `openai` / `anthropic`. - **Tag Count / Max Length** โ€” limits on generated tags. - **Embedding Provider** โ€” `ollama` / `openai` (for similar notes). - **Max Recommendations** โ€” top-N similar notes to show. ## MOC Layout (v1.1) Generated MOCs now ship with a stats callout, folder callouts, code-style tags, per-note dates, and a generation footer: ```markdown --- tags: - "็ฌ”่ฎฐ/MOC" moc: true ๅˆ›ๅปบ: 2026-06-15 ๆ›ดๆ–ฐ: 2026-06-15 14:30 --- # ๐Ÿ“š ๅญฆไน  ยท ็Ÿฅ่ฏ†ๅœฐๅ›พ > [!info] **๐Ÿ“Š ็Ÿฅ่ฏ†ๅœฐๅ›พๆฆ‚่งˆ** > ๐Ÿ“‚ **5** ไธชๅญๆ–‡ไปถๅคน ยท ๐Ÿ“„ **42** ็ฏ‡็ฌ”่ฎฐ ยท ๐Ÿท๏ธ ๅนณๅ‡ **3.0** ไธชๆ ‡็ญพ/็ฏ‡ > ๐Ÿ•’ ๆœ€ๅŽๆ›ดๆ–ฐ๏ผš2026-06-15 14:30 --- ## ๐Ÿ“ ๅญๆ–‡ไปถๅคน1 ยท 15 ็ฏ‡ > [!note] ๐Ÿ—‚๏ธ ๆ‹ฅๆœ‰็‹ฌ็ซ‹ MOC ยท [[ๅญๆ–‡ไปถๅคน1/MOC|ๆŸฅ็œ‹ๅญ็›ฎๅฝ•]] - ๐Ÿ“„ [[Note1|Note1]] `tag1` `tag2` `tag3` ยท ๐Ÿ“… 2026-06-15 - ๐Ÿ“„ [[Note2|Note2]] `tag1` ยท ๐Ÿ“… 2026-06-14 ## โ“ ๆœชๅˆ†็ฑป ยท 5 ็ฏ‡ - ๐Ÿ“„ [[Note4|Note4]] ยท ๐Ÿ“… 2026-06-12 --- ๐Ÿค– Auto-generated by Auto MOC & AI Tagger ยท 2026-06-15 14:30 ``` Existing MOCs are regenerated automatically on the next file event in the folder (or run **ๆ›ดๆ–ฐๆ‰€ๆœ‰็™ฝๅๅ•็š„ MOC** from the command palette to force-refresh the whole tree). ## Privacy Your notes and embeddings never leave your machine unless you explicitly configure a cloud provider (OpenAI, Anthropic). Embeddings are cached locally in `embeddings-cache.json` inside the plugin folder. ## License MIT โ€” see [LICENSE](LICENSE). ## Author zhangpl666ya โ€” https://github.com/zhangpl666ya