Automatically assign tags to Obsidian notes
Automatically assigns relevant tags to Obsidian notes based on predefined criteria. Use this to batch-tag your vault for better organization, or run with `--dry-run` to preview changes before applying them.
/plugin marketplace add tsuyoshimishina/obsidian-claude-tools/plugin install tsuyoshimishina-obsidian-auto-tagger@tsuyoshimishina/obsidian-claude-tools[folder-path] [--dry-run] [--criteria <file>]Analyzes Obsidian notes and automatically assigns appropriate tags based on predefined criteria.
$ARGUMENTS
folder-path (optional): Target folder path. Processes entire vault if omitted--dry-run (optional): Simulate tagging without modifying files--criteria <file> (optional): Path to tag criteria file. Defaults to tags/_all.mdIdentify target notes (recursive)
/), recursively call list_vault_filesFilter to .md files only
attachments/, .obsidian/, .trash/Display note list and confirm before processing
Parse --criteria argument from $ARGUMENTS
Locate the skill folder. Try these paths in order:
./skills/tag-criteria/ (development)./.claude/skills/tag-criteria/ (project scope)~/.claude/skills/tag-criteria/ (user scope, use Bash to get home directory)Load tag definitions:
--criteria specified: Read the specified file
tags/ directory--criteria not specified: Read tags/_all.md from skill folderLoad SKILL.md from skill folder (contains Judgment Rules)
Combine into full_criteria:
{SKILL.md content}
## Tag Definitions
{tag definitions content}
Launch obsidian-tagger agents in parallel
Agent invocation with criteria:
Task tool with subagent_type="obsidian-tagger":
"Analyze the note at [vault-path]/[file-path] and apply appropriate tags.
---BEGIN CRITERIA---
{full_criteria}
---END CRITERIA---
"
Repeat until all files are processed
Output result report after processing:
## Tagging Report
### Results
| File | Tags Added | Status |
|------|------------|--------|
| notes/example.md | #programming, #tips | Success |
| notes/meeting.md | #meeting | Success |
| notes/broken.md | - | Skipped |
### Summary
- Total processed: X files
- Success: Y files
- Skipped (no matching tags): Z files
- Total tags added: N
### Tag Distribution
| Tag | Count |
|-----|-------|
| #papers | 5 |
| #arxiv | 3 |
| ... | ... |
When --dry-run is specified:
/tag-notes # Process entire vault with all tags
/tag-notes inbox # Process inbox folder
/tag-notes notes/projects # Process specific subfolder
/tag-notes . --dry-run # Simulate on entire vault
/tag-notes --criteria sam-3d.md # Use custom criteria file
/tag-notes inbox --criteria papers.md # Process inbox with papers criteria only
--- separatortags/_all.md