Health-check the wiki for missing articles, stale content, broken backlinks, and cross-reference gaps. Run this after any session where new session logs were created, or when starting a new session and the wiki may be out of date. Also run before any `/wiki-compile all` pass. --- ## Step 1 — Missing Articles (Primary Check) Scan for clients and projects that have session logs but no wiki article. ```bash # List all client slugs that have session-logs but no wiki article cd D:/claudetools for dir in clients/*/session-logs; do slug=$(echo "$dir" | sed 's|clients/||;s|/session-logs||') wiki="wiki/clients/$slug.md" if [ ! -f "$wiki" ]; then count=$(ls "$dir"/*.md 2>/dev/null | wc -l) echo "MISSING: $wiki ($count session logs)" fi done ``` ```bash # List all project slugs that have session-logs but no wiki article for dir in projects/*/session-logs; do slug=$(echo "$dir" | sed 's|projects/||;s|/session-logs||') wiki="wiki/projects/$slug.md" if [ ! -f "$wiki" ]; then count=$(ls "$dir"/*.md 2>/dev/null | wc -l) echo "MISSING: $wiki ($count session logs)" fi done ``` Report each missing article as: ``` [MISSING] wiki/clients/.md — session logs, oldest: ``` Suggest: `Run /wiki-compile client: to seed.` --- ## Step 2 — Stale Articles Check `last_compiled` date in all wiki article frontmatter. Flag any article where: - `last_compiled` is more than 90 days ago AND there are session logs newer than `last_compiled` - Report as `[STALE]` with days since compile and count of new logs Use `grep -r "last_compiled:" wiki/` to collect dates, then compare against session log mtimes. --- ## Step 3 — Broken Backlinks Scan all `[[link]]` references in wiki articles. For each `[[slug]]`, check: - Does `wiki/clients/.md` exist? Or `wiki/projects/.md`? Or `wiki/systems/.md`? - If none match → flag as `[BROKEN_LINK]` ```bash grep -rh '\[\[' wiki/ | grep -o '\[\[[^]]*\]\]' | sed 's/\[\[//;s/\]\]//' | sort -u ``` For each slug found, normalize before checking: 1. Strip leading `wiki/` prefix if present → flag as `[BAD_FORMAT]` (seeding agents sometimes write wrong format) 2. Strip trailing `.md` extension if present → also flag as `[BAD_FORMAT]` 3. Check existence: `wiki/.md`, `wiki/clients/.md`, `wiki/projects/.md`, `wiki/systems/.md`, `wiki/patterns/.md` 4. If no file found after normalization → flag as `[BROKEN_LINK]` Note: `[[systems/neptune]]` will always show as broken until neptune is seeded — that's expected. --- ## Step 4 — Index Gaps Read `wiki/index.md`. For every `.md` file in `wiki/clients/`, `wiki/projects/`, `wiki/systems/`: - Is it listed in `wiki/index.md`? If not → flag as `[NOT_INDEXED]` Conversely, for every row in `wiki/index.md`: - Does the linked file actually exist? If not → flag as `[DEAD_INDEX_ENTRY]` --- ## Step 5 — Compilation Queue Cleanup Read the `## Compilation Queue` section in `wiki/index.md`. For each entry: - Does the corresponding `wiki//.md` file now exist? If yes → flag the queue entry as stale, suggest removing it. --- ## Output Format Emit a clean lint report: ``` ## Wiki Lint Report — YYYY-MM-DD ### Missing Articles (N) [MISSING] wiki/clients/evs.md — 1 session log (2026-04-17) ... ### Stale Articles (N) [STALE] wiki/clients/cascades-tucson.md — compiled 2026-05-24, 3 new logs since ... ### Broken Backlinks (N) [BROKEN_LINK] wiki/clients/kittle.md → [[gururmm]] (no file found) ... ### Index Gaps (N) [NOT_INDEXED] wiki/clients/new-client.md — not listed in index.md ... ### Compilation Queue — Stale Entries (N) [QUEUE_STALE] client:birthbiologic — wiki/clients/birth-biologic.md exists; remove from queue ... ### Summary - N missing articles → run /wiki-compile for each - N stale articles → run /wiki-compile to refresh - N broken links → fix manually or after recompile - N index gaps → update wiki/index.md ``` After the report, ask: "Run /wiki-compile for any of the missing articles now?"