All notes
Architecture

The scaffold that puts itself back together

A vault built to run for months drifts — folders renamed, templates outdated, indexes out of sync. The fix wasn't discipline, it was a scaffold that ensures the structure on every run: idempotent, silent, untestable to break.

A vault designed to last months will break. Folders get renamed on a whim, templates drift from spec, the index falls out of sync with what actually exists on disk. The solution wasn’t better discipline — it was making the scaffold regenerate itself every time the system runs.

Structure as code, not convention

The layout of the vault is declared in one place: a manifest that lists every folder, every template, every index file the system expects to exist. On each run, before anything else happens, the scaffold phase walks that manifest and creates whatever’s missing. No folder assumed, no template taken for granted. The vault either matches the spec or it gets brought to match — silently, in under a second.

The difference between “it should look like this” and “it will look like this” sounds cosmetic. In practice it’s the difference between a system you trust and one you babysit.

Idempotent by design

Every scaffold operation is safe to run twice. Creating a folder that already exists is a no-op. Stamping a template that’s already in place checks the hash first and skips the write. The healer doesn’t diff the live vault against the spec and compute a minimal patch — it just ensures. Running it on a healthy vault changes nothing. Running it on a broken vault restores exactly what’s missing, nothing more.

This made testing trivial: delete a folder, run the scaffold, assert it’s back. No mocks, no state management — the spec is the test.

Drift is debt with interest

The real argument for auto-healing isn’t convenience. It’s that a vault missing a folder doesn’t fail loudly — it fails silently. Janus writes a pulse to the wrong path, or skips a rollup because the weekly directory doesn’t exist, and the error shows up three days later as a gap in the spine. By the time you notice, the context is gone. Auto-healing eliminates the silent failure class entirely: if the scaffold ran, the structure is there.