---
name: hstack-wiki-lint
description: |
  Health-check a disease wiki for structural issues and content quality. Finds
  broken wikilinks, missing _index.md files, orphan pages, shallow hierarchies,
  missing concept pages, stale content, and contradictions. Auto-fixes structural
  problems, flags content issues for the user. Use periodically to keep the wiki
  clean and internally consistent.
---

{{PREAMBLE}}

{{WIKI_SCHEMA}}

{{OBSIDIAN_MARKDOWN}}

# Lint the Wiki

**You are the quality inspector.** A wiki is only useful if it's consistent,
navigable, and trustworthy. Read the entire vault, find structural problems and
content issues, fix what you can, and flag what needs human judgment.

Karpathy calls this "health checks" — finding inconsistent data, missing
cross-references, data gaps, and incrementally improving the wiki's integrity.

## Step 1: Read the Vault

Read CLAUDE.md, index.md, log.md. Then read _index.md files at each level to
understand the structure. Read wiki pages — prioritize recently-updated pages
and pages with the most cross-references.

## Step 2: Structural Checks (Auto-Fix)

**Missing _index.md files:** Every folder in wiki/ must have one. If missing,
create it by summarizing the folder's contents.

**Broken wikilinks:** Links pointing to pages that don't exist. Fix by creating
a stub page or correcting the link.

**Orphan pages:** Pages with no inbound wikilinks. Add them to the parent
_index.md and link from relevant pages.

**Index staleness:** Pages that exist but aren't in index.md. Add them.

**Missing frontmatter:** Pages without title, tags, sources, or last_updated.
Add sensible defaults.

**Missing source provenance:** Personal data pages that don't link back to
their raw/ source file. Add the provenance link.

## Step 3: Organization Checks (Auto-Fix with Reporting)

**Shallow hierarchies:** Folders with 8+ pages and no subfolders — these
probably need to be split into subtopics. Propose (and implement if clear)
a sub-hierarchy based on content clustering.

**Missing concept pages:** Identify terms or concepts that appear in 3+ pages
but have no standalone concept page. Create them.

**Uneven coverage:** Sections with many sources and dense pages alongside
sections with a single thin page. Flag thin sections and suggest running
/hstack-wiki-refresh focused on those topics.

## Step 4: Content Checks (Report Only)

**Contradictions:** Page A says X, page B says Y. Report both with links and
suggest which is likely more current.

**Stale claims:** Information with dates suggesting it should be re-verified
(e.g., "results expected 2025" when it's 2026). Report and suggest a focused
/hstack-wiki-refresh.

**Unsourced claims:** Wiki content that doesn't trace to any raw/ source.
Flag — these may be LLM synthesis from init that should be grounded with
real sources.

**Missing evidence tiers:** Major claims without an evidence tier callout.
Flag with a suggested tier.

**Personal-research disconnects:** Personal health data that relates to
research pages but isn't cross-referenced.

## Step 5: Report

Report directly to the user (lint reports are ephemeral, not wiki pages):

```
# Lint Report — [DATE]

## Auto-Fixed ([N] issues)
- Created _index.md in [folder]
- Fixed [N] broken wikilinks
- Created concept pages: [[concepts/term1]], [[concepts/term2]]
- Split [folder] into [N] subfolders

## Needs Attention ([N] issues)

### Contradictions
[specific contradictions with page links]

### Stale Content
[specific stale claims with suggestions]

### Unsourced Claims
[content that needs raw/ sources to ground it]

### Thin Sections
[sections that need more sources — suggest /hstack-wiki-refresh]

## Wiki Health
- Total pages: [N]
- Source files in raw/: [N]
- Concept pages: [N]
- Folders with _index.md: [N]/[N]
- Issues: [N] auto-fixed, [N] flagged
```

## Step 6: Update log.md

Append a lint entry summarizing what was found and fixed.
