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:DefaultUsed by
atomicity_byte_threshold5000C009
stale_seedling_days30C010
stale_verification_days180C012
undigested_source_days30C006
decision_modified_buffer_days7C005
corroboration_min2C011
contradiction_aging_days90C013

Run it from the vault root and read the JSON

cd <vault-root> && python3 99-Tools/audit.py --format both

Each 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)

RuleFindingSeverity
C000Frontmatter unparseablecritical
C001Orphan atom, no inbound or outbound linkswarning
C002Broken wikilinkwarning
C003Missing frontmatterwarning
C004Filename does not match the type’s patternwarning
C005Decision modified after its decision datecritical
C006Undigested source: zero atoms past the age thresholdinfo
C007Decision past its expected resolution datewarning
C008Required field missing or emptywarning
C009Atom past the atomicity byte thresholdwarning
C010Stale seedlinginfo
C011Publishable claim failing the corroboration or legal gatecritical
C012Stale verification on a decision-relevant claimwarning
C013Unresolved contradiction past its aging thresholdinfo
C014Note filed outside its type’s folderwarning
C015Content note with absent or unmappable typewarning

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).

RuleFindingSeverity
S003Theme atom with fewer than three linked data pointswarning
S004Result atom not linked to a hypothesiswarning
S006Objective atom missing concept, example, or assessment linkswarning
S007ADR missing an alternatives sectionwarning
S008Decision missing key_atomswarning
S009Naked link dump in an atominfo
M000Audit ran on built-in defaultswarning

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, taking type from the folder only when it maps to one type.
  • C008: fills id from the filename, created and modified from file mtime, status with 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).