From second-brain
Lints knowledge bank for broken WikiLinks, missing frontmatter, orphan documents, index drift, and stale content. Generates severity-graded report.
npx claudepluginhub sxhmilyoyo/sundayhao-plugins --plugin second-brainThis skill uses the workspace's default tool permissions.
Health-check the knowledge bank to detect quality issues that accumulate over time. Without periodic linting, orphan documents pile up, cross-references break, and stale content persists unchallenged.
Audits and interactively cleans up Claude Code knowledge base: detects stale references, duplicates, orphaned files, frontmatter issues, and merge opportunities.
Use when compiling raw sources into the wiki, querying the knowledge base, running health checks or lint on the wiki, evolving or improving wiki coverage, or when user says 'compile', 'update the wiki', 'query', 'lint', 'health check', 'evolve', 'what's missing', or 'suggest improvements'. Also triggers on questions that should be answered from the knowledge base.
Audits markdown knowledge bases for missing frontmatter, broken links, tag inconsistencies, orphaned files, draft staleness, content gaps, and coverage issues. For KB quality checks.
Share bugs, ideas, or general feedback.
Health-check the knowledge bank to detect quality issues that accumulate over time. Without periodic linting, orphan documents pile up, cross-references break, and stale content persists unchallenged.
Knowledge Bank Location: Read from ~/.claude/plugins/config/second-brain/config.json.
/second-brain:kb-lintSkill({ skill: "second-brain:kb-lint" })Run lint checks in order. Each check produces findings with a severity level.
Find WikiLinks that don't resolve to any file in the KB:
./scripts/lint_broken_links.sh "$KB_PATH"
Reuses WikiLink extraction from knowledge-bank-lookup/scripts/wikilink-utils.sh and resolution logic.
Find documents missing required frontmatter fields (title, type, created):
./scripts/lint_frontmatter.sh "$KB_PATH"
Reuses frontmatter reading from skills/common/obsidian_helpers.sh.
Find documents with zero incoming WikiLinks (not referenced by any other document):
./scripts/lint_orphans.sh "$KB_PATH"
Builds a reverse-link index across the entire KB. Excludes structural files (_meta/, _index/, _sessions/).
Find documents that exist on disk but are missing from _meta/index.md:
./scripts/lint_index_drift.sh "$KB_PATH"
Compares filesystem against the generated index. Also detects entries in the index that no longer have backing files.
Find documents not modified in 90+ days:
./scripts/lint_stale.sh "$KB_PATH"
Uses file modification timestamps. Excludes _sessions/ and daily-log/ (inherently historical).
Generate a lint report at _meta/lint-report-YYYY-MM-DD.md:
---
title: KB Lint Report YYYY-MM-DD
type: lint-report
generated: YYYY-MM-DDTHH:MM:SSZ
---
# KB Lint Report
| Severity | Count |
|----------|-------|
| Error | N |
| Warning | N |
| Info | N |
## Errors
### Broken WikiLinks
- [[Target]] referenced from [[Source]] — target not found
### Missing Frontmatter
- /path/to/doc.md — missing: title, type
## Warnings
### Orphan Documents
- [[Doc Name]] — zero incoming references
### Index Drift
- /path/to/doc.md — exists on disk but missing from index
## Info
### Stale Documents
- [[Doc Name]] — last modified YYYY-MM-DD (N days ago)
Append operation to _meta/log.md:
source skills/common/obsidian_helpers.sh
append_kb_log "$KB_PATH" "lint" "kb-lint" "N errors, N warnings, N info findings"
| Severity | Meaning | Action |
|---|---|---|
| Error | Data integrity issue | Fix immediately — broken links mislead lookups |
| Warning | Quality degradation | Fix soon — orphans and drift reduce discoverability |
| Info | Potential staleness | Review periodically — may need updating or archiving |
| Finding | Fix |
|---|---|
| Broken WikiLink | Rename target to match, or update the reference |
| Missing frontmatter | Add required YAML fields to the document |
| Orphan document | Add WikiLinks from related docs, or archive if obsolete |
| Index drift | Run generate_index.sh to rebuild _meta/index.md |
| Stale document | Review and update, or move to archive/ if obsolete |
Lint is complete when:
_meta/lint-report-YYYY-MM-DD.md_meta/log.md