kb-integrity
Skill2 starsChanged 25 days agoApache-2.0View on GitHub
Load when a vellum check failed, or when muse routes integrity work. The kb-integrity skill teaches how to run the deterministic engine (bible validate, ledger check, wordcount, state check, knowledge --as-of), interpret their findings, apply the exemption protocol, and repair derived files. It is the operator's manual for the mechanical half of the continuity layer — the cold read and the critics find what these linters cannot.
In this repository33 other files it gives its agents.
- character-simSkill
- cold-readSkill
- creative-researchSkill
- creative-writing-craftSkill
- creative-writing-modesSkill
- creative-writing-museSkill
- demolitionSkill
- exportSkill
- gatesSkill
- grill-with-docsSkill
- information-hierarchySkill
- intent-modelingSkill
- kb-managementSkill
- knowledge-layersSkill
- llm-writingSkill
- md-validationSkill
- project-setupSkill
- qi-layerSkill
- reader-simSkill
- reflectSkill
- series-bibleSkill
- seriesSkill
- shared-daoSkill
- story-ledgersSkill
- story-memorySkill
- story-planningSkill
- story-reviewSkill
- structured-artifactSkill
- style-guardrailsSkill
- voiceSkill
- writing-principlesSkill
- writing-staffingSkill
- zoom-outSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Run from the project root.
- Distinctive: line 53
When a finding is intentional (the author confirms it is a deliberate choice, not an error):
- Very specific: line 55
Never silently accept it: Run vellum dismiss <key> --reason "<the author's words, verbatim>".
- Very specific: line 57
Expiry / re-arm: when bible validate detects the underlying fact changed (entity status, died-in, promise payoff-in, knowledge revision), …
- Distinctive: line 59
When a finding is an error: fix the source (the kb entity, the frontmatter, the prose), then re-run the check.
- Distinctive: line 68
If you need to change what a derived file says, change its sources and rebuild — never edit the derived file directly.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
KB Integrity
The kb-integrity skill is the operator's manual for the deterministic engine — the mechanical half of the continuity layer. It teaches which command to run, how to read what it says, what to do when it flags something, and how to repair things when they break. The engine is a regression fence, not a discovery tool: it catches the errors no API call should be spent on (dead-character reappearances, promise ordering, knowledge learned-in violations, schema violations, hand-edited state). The cold read and the critics find what the linters cannot — but the linters are what you run first, because they are deterministic, cheap, and reproducible.
When a book is linked to a library, the series layer adds two companion
commands: library retcon-check (the detection catalog — §10) and
library state (the series state card, injected into the existing vellum
state output). The book-local commands (bible validate, ledger check,
wordcount, knowledge --as-of, state rebuild) are unchanged in
contract — they run against the book as before, and the sidecar
.vellum/series-link.json is inert to them. Do not run series commands
against a book that is not linked; library retcon-check and library
state refuse (exit 2) if the book has no sidecar.
The engine commands
Run from the project root. All are stdlib Python, invoked as
python3 scripts/vellum <sub> — resolve the interpreter in order python3,
python, py -3 (≥ 3.8). The engine is installed at the project root's
scripts/vellum by project-setup; the hooks invoke the plugin's copy via
the same contract (VELLUM_PY is resolved internally by
vellum_py() in hooks/scripts/lib/common.sh — agents never need that
variable). Exit codes: 0 clean · 1 findings · 2 schema/usage error.
| Command | What it does | When to run |
vellum bible validate | Frontmatter schema validation for every kb entity; kebab-case ids; cross-reference integrity (broken id references = findings). | After any kb/ edit; as a precondition for export. |
vellum bible reindex | Rebuild the _index.md registries deterministically. | After validate reports broken references or missing registry entries. |
vellum bible links | Cross-reference integrity only. | When an entity was renamed or removed. |
vellum ledger check | Deterministic continuity: dead-character reappearances, promise ordering, question states, POV-not-in-cast, frontmatter completeness, prop custody, knowledge learned-in violations, clock monotonicity, outline-verbatim presence. | After every chapter acceptance; before export. |
vellum wordcount [--write] | Words per chapter; --write updates word-count frontmatter; band check vs word-target. | After drafting; before export. |
vellum knowledge <character-id> --as-of N [--audience] | Queryable knowledge backend: facts the character holds as of chapter N with certainty levels; --audience gives the reader-knowledge view for dramatic-irony checks. | When a character uses a fact; when checking dramatic irony. |
vellum state check | Transactional invariants: state exists; schema current; no half-committed chapter; pending_capture: false; derived-file hashes match. | As the outline-gate precondition; before export. |
vellum state rebuild | Regenerate state/_tracking-state.json + state/state-card.md from sources; recompute hashes. | After kb/ or frontmatter edits; to repair a state:hand-edited finding. |
vellum style stats <file> [--baseline] | Sentence-length distribution, burstiness, opener variety, dialogue ratio, em-dash density, TTR, paragraph-shape entropy; --baseline diffs against kb/styles/baseline.md. | On demand; every drift_interval chapters. |
Interpreting findings
Findings are emitted in the shared schema (gates/resources/finding-schema.md): audit (continuity|prose|structure|voice|reader), technique (short kebab tag), severity (note|suggestion|warning|blocker), location (file, line, quote), issue (one sentence), confidence (deterministic|judgment). Deterministic findings are reproducible; judgment findings are LLM opinion.
- Exit 0 — clean. No action.
- Exit 1 — findings present. Read them; resolve or dismiss.
- Exit 2 — schema/usage error. The command itself could not run (unparseable frontmatter with file+line, missing required file). Fix the input, re-run.
The exemption protocol
When a finding is intentional (the author confirms it is a deliberate choice, not an error):
- Never silently accept it. Run
vellum dismiss <key> --reason "<the author's words, verbatim>". The key is<category>:<entity_id>(category ∈continuity|canon|voice|craft|structure|pace|repeat|frontmatter|band|state) — deliberately excluding message text and chapter number so reworded messages cannot resurrect a dismissal. - Never run dismiss without the author's explicit word. The machine does not re-litigate a dismissed choice.
- Expiry / re-arm: when
bible validatedetects the underlying fact changed (entity status,died-in, promisepayoff-in, knowledge revision), the exemption flips tostaleand the finding re-arms once with a note. Muse re-asks; the author re-decides.
When a finding is an error: fix the source (the kb entity, the frontmatter, the prose), then re-run the check. Do not dismiss errors.
Repairing derived files
state/_tracking-state.json, state/state-card.md, and the ledger _index.md registries are engine-written, never hand-edited. The engine hash-verifies them (state/_derived-hashes.json); a mismatch → finding state:hand-edited. To repair:
vellum state rebuild— regenerates the tracking state and state card fromkb/+ frontmatter + ledgers; rewrites the hashes.vellum bible reindex— rebuilds the_index.mdregistries.
If you need to change what a derived file says, change its sources and rebuild — never edit the derived file directly.
Scanners are regression fences, not discovery
The deterministic engine catches the errors no API call should be spent on. It does not catch whether a chapter is flat, whether a voice has drifted in quality, whether a scene earns its payoff, or whether a reader would keep going. Those are what the cold read (cold-read/ skill) and the critics (story-review/, gates/) are for. Run the engine first (cheap, deterministic); run the readers after (expensive, judgment). The engine is the fence; the readers are the discovery.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

