a55b3c7147
scripts/kb add wrote onto a working-tree kb.pl that had lost 276 of its 801 clauses and reported success, because kb_consistent checks consistency, not completeness (improvise-usus). Every write now runs kb-merge.pl `complete` on the candidate before kb_consistent. It refuses unless every clause HEAD has is still present by key, or its removal was recorded by `kb rm` in a per-worktree ledger in the git dir, which prunes itself on every write. The candidate is now built beside kb.pl, so publishing it is a rename(2) rather than a possible cross-device copy that a kill could truncate. Exit codes: 0 done, 1 refused, 2 usage, 3 HEAD's kb.pl unreadable. kb-test.sh now builds its fixtures from HEAD and adds cases 18-22. Argument in context/code/kb-tool.md, evidence and rivals in context/test-evidence/tooling.md. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze