Helper + validation scripts.
Files:
kb-lint.py— validates frontmatter across all*.mdfiles againstschema/kb-schema.yaml, plus reference checks: broken[[wikilinks]],supersedes:without the back-stamp on the old file, routing/config files (CLAUDE.md, AGENT-GUIDE.md,.claude/rules/, skill descriptions) pointing at missing paths, missing skills or superseded files, the always-loaded config size budget, and theas-of:line inSTATE.md(when present). Files named on the command line get errors; a whole-repo sweep reports reference problems as warnings. OptionalNAME_RULESwarn on ambiguous short entity names. Called by the pre-commit hook; also invoked via/kb-audit.rebuild-indexes.py— regenerates every auto-generatedINDEX.mdfrom entries'description:frontmatter, prefixing currency tags ([superseded],[cancelled],[archived],[dead]).--checkexits 1 if any index is stale. Run by the pre-commit hook.propagate-oneliner.py— copies the canonical product one-liner from the newestsynthesis/file into AUTOGEN blocks (e.g. GLOSSARY.md).--checkverifies.kb-convergence-scan.py— talliesconvergence:tags acrossbrainstorming/to surface ideas ready for promotion.kb-session-status.py— SessionStart hook (.claude/settings.json): prints a short staleness report (STATE.md age if the KB keeps one, synthesis lag per track, overdue pending todos, days since the last audit). Read-only; silent on error.kb-prompt-lookup.py— UserPromptSubmit hook: lists up to 12 KB files most likely to answer the prompt, ranking superseded / older-version files down. Expands shorthand throughALIASES.mdif present. Skips gitignoredprivate/folders unlessKB_LOOKUP_INCLUDE_PRIVATE=1. Also usable by hand:scripts/kb-prompt-lookup.py "<terms>".arxiv-fetch.sh,yt-fetch.sh,github-deep-fetch.sh— dedicated fetchers that write toruns/fetches/<slug>.txtfor/add-entryto cite.install-hooks.sh— setsgit config core.hooksPath scripts/hooksso the tracked hooks run directly (no copies to go stale). Run once per fresh clone.hooks/pre-commit— secret scan of staged changes (gitleaks git --staged, rules in.gitleaks.toml),kb-lint.pyon staged*.md, then rebuilds and stagesINDEX.mdfiles. Probes multiple Python install locations for one with PyYAML; robust against git's stripped-env hook execution.hooks/post-commit— pushes to the tracked upstream after every commit.
Dependencies:
- Python 3 + PyYAML (anaconda base usually has it; otherwise
python3 -m pip install pyyaml) - gitleaks (
brew install gitleaks; the pre-commit hook refuses commits without it unlessKB_SKIP_GITLEAKS=1) - jq (used by the
.claude/settings.jsonPreToolUse hooks) - git + gh
- Claude Code
Rules: ../CONVENTIONS.md.