Skip to content

wiki-lint

Health-check the wiki synthesis layer for stale pages, broken refs, and gaps

IDE:
claude
codex
vscode
Version:
0.0.0

Wiki Lint

Validate the health of the wiki synthesis layer by checking for stale pages, broken references, orphan pages, and coverage gaps.

Primary Path: Lint Script

If the file scripts/lint-synthesis.js exists, run it and present the output:

node scripts/lint-synthesis.js

Parse the script's output and present findings using the report format described below.

Fallback Path: Manual Checks

If scripts/lint-synthesis.js does not exist or fails to run, perform the equivalent checks manually by following each step below.

Check 1: Staleness

For each Markdown file in docs/synthesis/:

  1. Parse the YAML frontmatter and extract last_synthesized and sources.
  2. For each asset ID in sources, look it up in metadata.json and read its last_reviewed date.
  3. If any source asset's last_reviewed is newer than the page's last_synthesized, compute the gap in days.
  4. If the gap exceeds the page's staleness_threshold_days frontmatter value (default: 90), the page is stale. Record the page path, the stale source asset ID, and the number of days behind.

Check 2: Broken References

For each Markdown file in docs/synthesis/:

  1. Parse the sources array from YAML frontmatter.
  2. For each source ID, verify it exists as an entry in metadata.json.
  3. If a source ID is not found in metadata.json, record it as a broken reference with the synthesis page path and the missing ID.

Check 3: Orphan Pages

Build an adjacency map of synthesis pages:

  1. For each synthesis page, parse its related_pages frontmatter field (a list of other synthesis page filenames).
  2. A page is an orphan if no other synthesis page references it in its own related_pages list. Pages with ID gap-analysis-coverage or readme are excluded from orphan detection.
  3. Record orphan page paths.

Check 4: Coverage Gaps

Identify domains that should have synthesis pages but do not:

  1. Read metadata.json and group all assets by domain (derived from all tags in the asset's tags array; assets with multiple tags appear in multiple domains).
  2. For each domain with 3 or more assets, check whether a corresponding entity page exists in docs/synthesis/.
  3. A domain without a matching entity page is a coverage gap. Record the domain name and asset count.

Report Format

Present findings in a structured report with these sections:

Stale Pages

PageStale SourceDays Behind
docs/synthesis/{page}.md{asset-id}N

If no stale pages found, display: "No stale pages detected."

Broken References

PageMissing Source ID
docs/synthesis/{page}.md{missing-id}

If no broken references found, display: "No broken references detected."

Orphan Pages

  • docs/synthesis/{page}.md

If no orphans found, display: "No orphan pages detected."

Coverage Gaps

DomainAsset CountSuggested Page
{domain}Ndocs/synthesis/entity-{domain}.md

If no coverage gaps found, display: "Full coverage across all domains."

Summary

Provide a one-line pass/fail status:

  • PASS: No stale pages and no broken references (orphans and coverage gaps are advisory warnings, not failures).
  • WARN: Advisory issues only (orphans or coverage gaps, but no stale pages or broken refs).
  • FAIL: Stale pages or broken references detected.

Include counts: {N} stale, {N} broken refs, {N} orphans, {N} coverage gaps.