refactor-tag-tree
Skill8 starsChanged 11 months agoMITView on GitHub
Analyze the tag tree, surface case chaos and stragglers, and consolidate via supervised renames.
In this repository6 other files it gives its agents.
- build-MOCSkill
- connect-ideasSkill
- daily-summarySkill
- find-orphansSkill
- prep-for-writingSkill
- review-and-linkSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Call list_tags(min_count=1, include_hierarchy=True).
- Very specific: line 26
After all renames in the issue class, call list_tags again.
- Distinctive: line 42
Don't do silent bulk renames.
- Very specific: line 43
Don't propose hierarchy changes (#ai → #research/ai) without asking.
- Very specific: line 44
Don't touch tags that appear only in Dataview tags:: foo, bar inline fields.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to use
The user's tag tree has accumulated drift: case variants (#AI, #ai, #Ai), spelling variants, near-synonyms, and singletons that should be folded into a hierarchy. This skill walks the user through consolidation one decision at a time.
Procedure
- Call
list_tags(min_count=1, include_hierarchy=True). Sort bywith_descendants_countdescending. - Detect issue classes from the returned list:
- Case chaos: tags whose
tag.lower()collides with another tag'stag.lower(). - Singletons: tags with
exact_count == 1that aren't part of a hierarchy. - Near-duplicates: pairs where Levenshtein distance ≤ 2 (e.g.
agentsvsagent). - Orphan top-levels: top-level tags with no descendants where a hierarchy parent would be obvious (e.g.
ragalone whenresearch/exists).
- Case chaos: tags whose
- Surface ONE issue class at a time. Order: case chaos → near-duplicates → orphan top-levels → singletons. Don't dump the whole list.
- For each issue class, propose specific renames. For case chaos, default to the lowercase form. For near-duplicates, the higher-count tag wins (with the user able to override).
- Show usage counts and 2–3 sample paths per tag involved. The user MUST have enough context to make a judgment.
- For each user-approved rename, call
rename_tag(old=..., new=..., confirm=true)(ormerge_tagsif the target already exists andmerge=Trueis needed). - After all renames in the issue class, call
list_tagsagain. Re-check whether the issue is resolved before moving to the next class.
Output format (per issue class)
Found case chaos:
#AI (12 uses, in [[notes...]]) ←
#ai (37 uses, in [[notes...]])
#Ai (2 uses, in [[notes...]])
Recommendation: merge into #ai (highest count, conventional lowercase).
Confirm? (yes / change target / skip)Anti-patterns
- Don't do silent bulk renames. Every rename is a separate confirm.
- Don't propose hierarchy changes (
#ai→#research/ai) without asking. That's the user's taxonomy. - Don't touch tags that appear only in Dataview
tags:: foo, barinline fields. Those aren't real tags. - Don't run on a vault where Obsidian is currently open — tag-tree refactor across hundreds of files while Obsidian holds buffers is asking for conflict. The user should close Obsidian (or open it read-only) before invoking this skill. (Automatic detection + refusal is on the v0.2 roadmap.)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

