Audit the book's evidence without manufacturing completion
Inventory all 45 chapters, hash their artefacts, and read the fields that refuse to call an inventory a verification.
The final chapter makes a claim about the book’s own evidence. Every chapter has a manuscript, at least one test file and a result file. That is an inventory. It is not proof that the experiments ran, that the results are correct, or that an independent person reproduced them. The audit has to say so in fields, not in a hopeful sentence.
This example walks the repository and builds a 45-entry manifest. Each entry
records whether the manuscript, tests and result exist, the result’s declared
status, and a SHA-256 for every artefact. The audit then reports
inventory_complete: true because all 45 entries are present, and
all_complete: false, tests_executed_by_audit: false,
claims_verified_by_audit: false and independent_review: NOT_RUN because the
inventory does not do those things. That combination is the honest conclusion.
Run it
From the canonical repository at commit
f958967d70992d7b09d9c75000bd8c543f1644d4:
python examples/ch45/manifest.py --json --root .Python 3.11 or later, standard library only. No model, network, GPU or
credentials. It reads the repository and finishes immediately. Use --out to
write the same report to a file; the default prints it.
Implementation
build_manifest checks the expected paths for each chapter, parses the
manuscript front matter, validates the result’s chapter and status, and hashes
every file it includes. audit counts the entries and sets the verification
fields to false.
def build_manifest(root: Path = ROOT) -> list[ManifestEntry]:
entries = []
for ch in range(1, 46):
manuscript = root / f"content/books/inference/{ch:02d}-chapter.md"
result = root / f"research/ch{ch:02d}/results.json"
tests = sorted((root / "tests").glob(f"test_ch{ch:02d}_*.py"))
errors = []
title = f"Chapter {ch}"
if manuscript.is_file():
import tomllib
try:
metadata = tomllib.loads(manuscript.read_text(encoding="utf-8").split("+++", 2)[1])
title = metadata["title"]
if metadata.get("weight") != ch:
errors.append("front matter weight does not match filename")
except (ValueError, IndexError, KeyError) as exc:
errors.append(f"invalid front matter: {exc}")
valid = False
status = "MISSING"
if result.is_file():
try:
data = json.loads(result.read_text(encoding="utf-8"))
status = data.get("status", "UNSPECIFIED")
valid = data.get("chapter") == ch and isinstance(status, str) and status != "UNSPECIFIED"
if not valid:
errors.append("result needs matching chapter and status")
except (ValueError, AttributeError) as exc:
errors.append(f"invalid result: {exc}")
files = [p for p in [manuscript, result, *tests] if p.is_file()]
artefacts = {p.relative_to(root).as_posix(): ("SELF_REFERENCE" if ch == 45 and p == result else hashlib.sha256(p.read_bytes()).hexdigest()) for p in files}
entries.append(ManifestEntry(ch, title, bool(tests), valid, manuscript.is_file(), status, artefacts, errors))
return entries
def audit(entries: list[ManifestEntry]) -> dict:
complete = bool(entries) and len(entries) == 45 and {e.chapter for e in entries} == set(range(1, 46)) and all(e.has_manuscript and e.has_tests and e.has_results and not e.errors for e in entries)
return {"total": len(entries), "with_manuscripts": sum(e.has_manuscript for e in entries), "with_tests": sum(e.has_tests for e in entries), "with_results": sum(e.has_results for e in entries),
"inventory_complete": complete, "all_complete": False,
"status": "INVENTORY_ONLY", "tests_executed_by_audit": False, "claims_verified_by_audit": False,
"independent_review": "NOT_RUN"}Expected outcome
Observed with the command above (exit 0). The audit block was:
"audit": {
"total": 45,
"with_manuscripts": 45,
"with_tests": 45,
"with_results": 45,
"inventory_complete": true,
"all_complete": false,
"status": "INVENTORY_ONLY",
"tests_executed_by_audit": false,
"claims_verified_by_audit": false,
"independent_review": "NOT_RUN"
}The manifest itself is much larger: 45 entries with per-chapter artefact hashes.
The audit says the shape is complete and the verification is not. The
chapter 45 result file is marked SELF_REFERENCE rather than hashed, because it
would otherwise contain its own hash.
Mechanism and limitations
Documented: build_manifest checks all 45 chapter numbers, parses front
matter, validates result chapter/status, records errors and hashes every
artefact. audit checks the count, chapter set and presence flags, and returns
fixed false fields for execution and claim verification. The tests check that the
real inventory has 45 entries but does not claim verification, that an empty
repository is incomplete, that missing/malformed/NOT_RUN results stay distinct,
and that editing a test changes its hash.
Observed: the command exited 0 with the audit block above. The targeted
tests.test_ch45_manifest is part of the canonical suite; no independent test
count is claimed here.
Not shown: that the tests pass, that the results are correct, that the
numbers were produced on the recorded hardware, or that a reader reproduced
anything. The audit explicitly does not execute tests or verify claims. A hash
proves that a file is the one inventoried, not that its contents are true. The
INVENTORY_ONLY status is the correct status for this evidence, not a temporary
label to be upgraded by a successful build.
Challenge this result
Change one test file and rerun the manifest. The chapter’s artefact hash should
change while the audit counts stay the same. Explain why that is desirable: the
inventory tracks identity, not truth. Then pick one chapter’s results.json and
list the additional evidence you would need before changing its status to
VERIFIED. Finally, state which of those items this audit could ever establish
and which require an independent run.
Source and verification
Canonical source:
examples/ch45/manifest.py
at commit f958967d70992d7b09d9c75000bd8c543f1644d4. Tests:
tests/test_ch45_manifest.py
.
Chapter: What We Learned
.
The run above is a fresh local execution on Windows 11 with Python 3.13.15; it
inventories files and makes no claim that their experiments were reproduced.
Understand this example
Copy this prompt into your AI tool. No code runs here.
Apply this example
Copy this prompt into your AI tool. No code runs here.