# HOOL Forensic Companion Kit (`companion/forensic-kit/`) Zero-dependency Python 3 stdlib receipt-chain and artifact integrity verifier for multi-agent fleets, implementing the structural invariants from **Chapter 1** (*quorum & receipt anchors*) and **Chapter 11** (*corruption cascades & the substrate lie*): 1. **Hash-chained receipts:** Each ledger entry commits to its predecessor via `prev_entry_sha256` (`GENESIS` for index `0`) and a canonical SHA-256 `entry_sha256`. 2. **Disk-byte verification (anti-substrate-lie):** Every entry's `artifact_sha256` is verified against the actual file bytes on disk relative to `base_dir` (no trusting status labels without file hashes; absolute paths, `..` traversal, and symlink escapes outside `base_dir` are rejected). 3. **Bounded verdict & independent receiver (`producer != receiver`):** `verdict` must be `"ACCEPT"` or `"REJECT"`, and self-authored acceptance fails closed. **Scope honesty (read before trusting):** Hash chaining verifies *internal tamper-evidence and disk-byte consistency relative to a trusted root digest*. Without an external signature/anchor held outside the repo, an attacker who controls the entire ledger and artifacts could recompute a fresh chain; anchor `entry[0]` externally to make tampering detectable. ## Quickstart directly from book.hool.dev (no git clone required) Download the zero-dependency verifier and fixture bundle into an empty directory and execute both clean and corrupted checks: ```bash mkdir -p hool-forensic-kit/fixtures && cd hool-forensic-kit curl -fsSL https://book.hool.dev/forensic-kit/verify_receipts.py -o verify_receipts.py curl -fsSL https://book.hool.dev/forensic-kit/fixtures/artifact-sample.txt -o fixtures/artifact-sample.txt curl -fsSL https://book.hool.dev/forensic-kit/fixtures/valid_ledger.json -o fixtures/valid_ledger.json curl -fsSL https://book.hool.dev/forensic-kit/fixtures/corrupted_cascade.json -o fixtures/corrupted_cascade.json python3 verify_receipts.py fixtures/valid_ledger.json python3 verify_receipts.py fixtures/corrupted_cascade.json ``` ## 30-Second Repo Quickstart (No `pip install` Required) Verify the clean sample receipt chain (expected exit code `0`): ```bash python3 companion/forensic-kit/verify_receipts.py companion/forensic-kit/fixtures/valid_ledger.json ``` Inspect a simulated Chapter 11 corruption cascade + self-authored acceptance failure (expected exit code `2`): ```bash python3 companion/forensic-kit/verify_receipts.py companion/forensic-kit/fixtures/corrupted_cascade.json ``` Run the unit & CLI regression suite: ```bash python3 -m unittest discover -s companion/forensic-kit -v ```