Overview
A vault without an auditor degrades invisibly: orphans accumulate, required fields go missing, and verification dates go stale. The auditor, a script at 99-Tools/audit.py, reads the vault spec and deterministically reports structural and schema violations. Autofix only the mechanical tier. Judgment-level defects belong to semantic-audit.
Split checks into three buckets and automate two
- Bucket 1, structural (C rules): orphans, broken links, missing frontmatter, filename, folder placement. Framework-agnostic.
- Bucket 2, schema (S rules): framework-specific, such as an ADR with no alternatives.
- Bucket 3, semantic: whether the title is a claim, the atom holds one idea, or the pre-decision section was rewritten.
Buckets 1 and 2 are code, never done by hand or by a model; bucket 3 needs judgment.
Configure from the spec, and treat a missing spec as a failed run
The auditor reads vault-spec.yaml for note types, required fields, folder mapping, thresholds, and severity_overrides. Adding a type or a required field is a spec edit, not a code change (vault-frontmatter-schema).
A missing or unparseable spec makes the auditor fall back to built-in defaults, warn loudly, emit M000, and exit non-zero. Check spec_status in the JSON summary (loaded, missing, or invalid) before trusting a zero.
Tunable thresholds and their defaults:
Key in rules: | Default | Used by |
|---|---|---|
atomicity_byte_threshold | 5000 | C009 |
stale_seedling_days | 30 | C010 |
stale_verification_days | 180 | C012 |
undigested_source_days | 30 | C006 |
decision_modified_buffer_days | 7 | C005 |
corroboration_min | 2 | C011 |
contradiction_aging_days | 90 | C013 |
Run it from the vault root and read the JSON
cd <vault-root> && python3 99-Tools/audit.py --format bothEach run writes 99-Tools/audits/AUDIT.md and audit.json, appends a line to log.md, and archives the previous reports. Reason over the JSON: each violation has a rule id, severity, file, message, and fix hint. Flags: --severity LEVEL (that level and above), --folder <dir>, and --quiet. Exit codes serve CI: 0 clean or info only, 1 warnings, 2 criticals. Setup is in bootstrap-a-research-vault.
Read the structural rules (C series)
| Rule | Finding | Severity |
|---|---|---|
| C000 | Frontmatter unparseable | critical |
| C001 | Orphan atom, no inbound or outbound links | warning |
| C002 | Broken wikilink | warning |
| C003 | Missing frontmatter | warning |
| C004 | Filename does not match the type’s pattern | warning |
| C005 | Decision modified after its decision date | critical |
| C006 | Undigested source: zero atoms past the age threshold | info |
| C007 | Decision past its expected resolution date | warning |
| C008 | Required field missing or empty | warning |
| C009 | Atom past the atomicity byte threshold | warning |
| C010 | Stale seedling | info |
| C011 | Publishable claim failing the corroboration or legal gate | critical |
| C012 | Stale verification on a decision-relevant claim | warning |
| C013 | Unresolved contradiction past its aging threshold | info |
| C014 | Note filed outside its type’s folder | warning |
| C015 | Content note with absent or unmappable type | warning |
The three criticals protect provenance: C000 hides a note from every other check, C005 is a hindsight rewrite (decision-journals), and C011 breaks the publishing gate (source-verification). C015 closes a loophole: stripping type would otherwise pass every per-type check.
Read the schema rules (S series) and the meta rule
S-rules encode a rigor framework and fire only on notes opting in by type or filename prefix (rigor-frameworks).
| Rule | Finding | Severity |
|---|---|---|
| S003 | Theme atom with fewer than three linked data points | warning |
| S004 | Result atom not linked to a hypothesis | warning |
| S006 | Objective atom missing concept, example, or assessment links | warning |
| S007 | ADR missing an alternatives section | warning |
| S008 | Decision missing key_atoms | warning |
| S009 | Naked link dump in an atom | info |
| M000 | Audit ran on built-in defaults | warning |
S001, S002, and S005 are reserved. Custom vault rules use a U prefix (U001, U002) so they never collide with a reserved id. Override severities per rule id with severity_overrides in the spec, never in the script.
Triage by root cause, not rule id
- Eight orphans on one theme: a missing map, not eight missing links.
- Five unsourced claims from one book: one source-backfill session.
- Three overdue decisions in one class: one resolution-review session.
- Many atomicity hits in one folder: one refactor session.
- One hindsight rewrite: handle it immediately, alone.
Present criticals first, individually, then warnings by cluster with a proposed batch action, and info as a list for the next review.
Autofix only the mechanical tier
--fix repairs only what can be derived with certainty.
- C003 and C015: add a missing frontmatter block or
type, takingtypefrom the folder only when it maps to one type. - C008: fills
idfrom the filename,createdandmodifiedfrom file mtime,statuswith the seedling default, and structural tags. Semantic fields (title,sources,confidence,decision_date) stay open; inventing them fabricates provenance. - C002: repairs a link only when exactly one filename matches.
Dry run is the default, --apply writes, and an un-versioned vault is refused without --force, since there is no undo. Never rename files or edit prose automatically.
Pause before bulk changes, then re-run
Bulk renames, moves, and schema backfills touching dozens of notes get a scope freeze: the exact path list, the undo plan, and explicit approval. The report proposes; the owner accepts, doubly so when an agent runs it (vault-orchestration). Making a field required across many notes is a migration (vault-evolution).
After fixes, re-run and report findings resolved and introduced by rule id (a new link can break) and the net change per severity. The log turns runs into a trend for the vault-maintenance review; in a shared vault, let the same run gate merges (vault-pull-request-review).