name: mml description: > Lint the knowledge base for broken links, orphan pages, stale captures, and wikilink convention violations. Run as a periodic health check. allowed-tools: "Read Glob Grep Bash(obsidian *)"
Objective
Run fourteen health checks on the knowledge base and report all findings by severity.
This command is operational only. Do not write /mml, /memory-mason:mml, or their execution chatter back into the vault.
Path Resolution
Before any other reasoning, resolve vault config in this priority order:
- Project
./.env - Project
./memory-mason.json - Global
~/.memory-mason/.env - Global
~/.memory-mason/config.json
Resolve:
- {vault}: absolute path to the Obsidian vault
- {subfolder}: plugin-managed subfolder inside the vault
Use the source that provides the vault path.
Subfolder: .env sources use MEMORY_MASON_SUBFOLDER when present, else ai-knowledge. JSON sources use their subfolder field.
If no location provides a vault path, fail fast with an explicit error naming every location checked.
Checks run against {vault}/{subfolder}/{atlas|concepts|synthesis}/*, index.md, _meta/{state.json, manifest.json, context.md}, _raw/*.
Execution Rules
- Glob all markdown files under {vault}/{subfolder}/atlas/, {vault}/{subfolder}/concepts/, and {vault}/{subfolder}/synthesis/. Also include {vault}/{subfolder}/index.md if it exists.
- Do not lint files under
_raw/or_meta/as knowledge articles, except for the explicit checks below against_meta/manifest.jsonand_meta/context.md. - Parse wikilinks in the form
[[target]]from article content. - Treat links starting with
{subfolder}/_raw/as valid source references. Links starting with bare_raw/(missing subfolder prefix) are flagged by Check 13. - Treat bare slug links such as
[[foo]]as format violations handled by Check 13. - Report every issue found. Do not stop after the first failure.
Checks
See detailed specifications for exact rules, report formats, and edge cases for every check.
- Broken wikilinks (error) — flag every
[[link]]whose target file does not exist under{vault}/{subfolder}. - Orphan pages (warning) — report articles with zero inbound links from other content articles.
- Uncompiled raw captures (warning) — report
_raw/YYYY-MM-DD/folders absent fromstate.jsoningestedmap. - Stale articles (warning) — report raw captures whose current hash differs from the compiled hash in
state.json. - Missing backlinks (suggestion) — flag A→B links where B does not link back to A.
- Sparse articles (suggestion) — report articles with fewer than 200 words (excluding frontmatter).
- Large raw captures (warning/error) — warn >500 KB, error >2 MB total chunk size per daily folder.
- Manifest integrity (error/warning/suggestion) — validate
_meta/manifest.jsonstructure, page references, and hash agreement withstate.json. - Session context freshness (warning/suggestion) — validate
_meta/context.mdexists, has required frontmatter, and is not older thanlast_compile. - Unresolved contradictions (warning) — count
[!contradiction]callouts inconcepts/articles. - Wikilink density (suggestion) — flag concept pages with zero outbound links; flag atlas MOCs with fewer than 3 concept links.
- Knowledge gaps (suggestion) — count
[!gap]callouts inconcepts/articles. - Wikilink format convention (error) — flag bare slugs and links missing the
{subfolder}/prefix. - Cross-project references (error) — flag links starting with a subfolder prefix other than
{subfolder}/.
Output Format
- Return a markdown report grouped by severity:
### Errors (must fix),### Warnings (should fix),### Suggestions (nice to fix), and a### Summarywith counts. If no issues:✓ Knowledge base is healthy.