Subchapter 66.1
references/details.mdMarkdown8 KBView on GitHub
Deep material for the grounded-vault skill. SKILL.md carries the convention; this file
carries the scripts, templates, and edge cases.
scripts/check_vault.py walks every page under wiki/, verifies each linked claim against
its raw source, and compares each fingerprint with the current tree. It uses only the standard
library and git.
#!/usr/bin/env python3
"""Grounding and drift checks for a grounded vault. Run from the vault root."""
import re
import subprocess
import sys
from pathlib import Path
RAW = (Path.cwd() / "raw").resolve()
WIKI = Path("wiki")
HEADER = re.compile(r"^> (Raw|Fingerprint|Monitored|
What it checks, and what it deliberately does not:
raw/adr/0007-jwt.md
never reads as a claim of 0007.15 does
not match 150 or 2015. A quotation must appear verbatim. Quoted phrases shorter than
eight characters are not treated as claims; a two-word quote is not evidence of anything.
Reformatted figures (1,000 versus 1000) fail on purpose; copy the source’s form.raw/. A path that escapes it, or points at a file that is
missing, is a miss, so a page cannot ground a claim on something outside the vault.--strict, a number or quotation with no raw/ link in its sentence is an error.
Without --strict it is skipped, which is the mode for a first pass over an old vault.Fingerprint:. An empty Monitored: is allowed: a page
compiled only from raw/ has no code to drift against.git diff --stat between the fingerprint and HEAD restricted to
the monitored paths. When git cannot compare, for example after a history rewrite removed
the fingerprint, that counts as drift too; recompile and stamp a fresh fingerprint.For a vault with many pages, collect fingerprints first and run one git diff per distinct
fingerprint rather than one per page:
grep -rh '^> Fingerprint: git:' wiki | sort -u | sed 's/^> Fingerprint: git://' \
| while read -r sha; do
echo "== $sha"; git diff --stat "$sha..HEAD" -- $(grep -rl "git:$sha" wiki \
| xargs grep -h '^> Monitored:' | sed 's/^> Monitored: //' | tr ',' '\n' | sort -u)
doneindex.md:
# Vault index
| Page | Status | Fingerprint | Sources |
|---|---|---|---|
| [Authentication architecture](wiki/auth-architecture.md) | Current | git:5b237fa | raw/notes/auth-v1.md, raw/adr/0007-jwt.md |log.md, one line per change, newest last:
2026-09-01 compile wiki/auth-architecture.md from raw/adr/0007-jwt.md at git:5b237fa
2026-09-14 archive wiki/session-store.md: Outdated, src/auth/session.ts changed after git:5b237faPre-commit hook (.git/hooks/pre-commit):
#!/bin/sh
python3 scripts/check_vault.py --strict || {
echo "vault check failed; fix the claim or the fingerprint before committing" >&2
exit 1
}The same command runs as a CI step on pull requests so the gate holds for every contributor.
git diff reports the deletion as a change, which
is correct: the page describes something that moved. Recompile with the new paths in
Monitored:.raw/ and add a sibling text
extraction (report.pdf and report.pdf.txt) produced once by a deterministic tool. Link
claims to the text file so the grounding check can read it.raw/ and link the
snapshot; keep the URL in the snapshot’s first line for attribution.git:<repo-name>@<sha> and keep one vault per
repository, or one vault whose Monitored: paths are prefixed by repository. The check
script above assumes a single repository.llm-wiki-loop (MIT, https://github.com/PALAN-K/llm-wiki-loop (opens in a new tab)) scaffolds this layout with
npx llm-wiki-loop init, ships a stricter check_evidence.py, and adds an event-driven
garbage collector and a step that promotes repeated fixes in log.md into agent skills. Read
it for the full loop; nothing in this skill requires it. The pattern was proposed for this
catalog by its author in wshobson/agents issue #673.