tooling: Scheduled check for stale, orphaned or broken knowledge notes
Back to our planType
enhancement
Summary
A scheduled check that keeps the knowledge layer honest over time: it finds notes that point at files that no longer exist, modules without a note, pages missing from the index, and notes that have grown too long. This is the "lint" step of Karpathy's method.
Problem
The sync check looks at one pull request at a time. It can't see slow decay: a file a note mentions is renamed in a pull request that declared no behavior change, a new shared area appears with no note, the index misses a page. Without a periodic check these pile up until the notes are no longer trusted.
Proposed fix
- A script in
scripts/(with tests) that fails with a list of problems when:- a path or a test named in a note or in the index doesn't exist;
- a folder in
src/modules/, or a shared area ofsrc/platform/, has no note or no entry indocs/knowledge/map.json; - a note or a reference page isn't in
docs/knowledge/index.md, or the index lists one that doesn't exist; - a note is over 80 lines, or the index is over 25 lines (decision 0019, §2);
- a link between notes, decision records and reference pages is broken.
- It runs on a schedule in the existing daily workflow, and on pull requests that change a note, the index or the map.
- Judgment is out of scope here. Whether a note's sentence is still true is checked by the review on each pull request, and later by the chief of staff's regular sweep (#697).
Acceptance criteria
- Not done: The script exists with tests, and a note that names a missing file makes it fail with a message that names the note and the file.
- Not done: It runs daily and on pull requests that touch the knowledge layer.
- Not done: It passes on
mainwhen this merges.
Files likely touched
scripts/ (script and tests), package.json (one script), .github/workflows/lint.yml or .github/workflows/ci.yml.
Must not touch
src/, the notes themselves (a problem it finds is fixed in its own issue).
Open questions
None for the owner.
Area
ci, tooling
Priority
medium
Generated by Claude Code, opens in a new tab