moc-agent — Claude Code subagent: Obsidian maps of content
A Claude subagent that builds and maintains maps of content (MOCs) in an Obsidian vault. Useful once notes pile up in folders with no navigation.
npx claude-code-templates@latest --agent obsidian-ops-team/moc-agentWhat moc-agent does
moc-agent handles navigation inside an Obsidian vault. It spots directories that hold plenty of notes but no map of content, generates a new MOC from a template, and wires it into the rest of the network. Stale maps get repaired too: missing note links are added, dead ones dropped, and topic areas that deserve their own MOC are flagged.
The hierarchy has three tiers, following the LYT system: a home MOC acting as the index, topic maps beneath it, and sub-MOCs for narrow subjects. Every map lives in map-of-content/, is named like MOC - [Topic Name].md, and carries type: moc in its frontmatter. The template ships with a Dataview block that pulls in tagged notes; drop that block if the Dataview plugin is not installed.
Auditing runs on Glob and Grep, so no external scripts are required. When a vault happens to contain moc_generator.py, the agent can invoke it from the vault root instead. Orphaned images are a separate job: PNG, JPG, GIF and SVG files with no incoming links get grouped into gallery notes by category and attached to Visual_Assets_MOC. Nothing is moved on disk. Before writing, the agent confirms that map-of-content/ exists and adapts to whatever folder layout the vault actually uses.
What it helps with
- create a MOC for a folder full of unlinked notes
- refresh stale maps after a bulk note import
- find notes that no map links to
- group orphaned images into gallery notes
- keep the MOC network tied to a home index
Example prompts for the agent
- My vault has a pile of new AI notes and no top-level MOC for them. Sort it out.
- There are screenshots and diagrams in the attachments folder that nothing links to. Build galleries for them.
- I imported notes from Notion and my MOCs are out of date. Diff them against the current file tree and fix them.
How to install moc-agent
1claude-code-templates
npx claude-code-templates@latest --agent obsidian-ops-team/moc-agent2Manually: put the files in place
.claude/agents/moc-agent.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/moc-agent.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/moc-agent.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about moc-agent
How do I install moc-agent in Claude Code?
Run npx claude-code-templates@latest --agent obsidian-ops-team/moc-agent, then make sure the agent file sits at .claude/agents/moc-agent.md.
What does moc-agent do?
It creates new maps of content in an Obsidian vault, updates existing ones, finds notes and images nothing links to, and keeps the MOC network connected.
Does moc-agent need Python or external scripts?
No. The audit uses Glob and Grep. The moc_generator.py script is only used when a vault already provides it.