Evidence-First Claude Session MiningLesson 7/8
Bounded planning

Overlap, Hashes, Journals, and Mutation

A plan is trustworthy only if every byte is attributable to one stable source snapshot.

U2 LIVE: PROVENSYNTHETIC EXAMPLE · /demo-claude/
File bytes pass through hash, handle identity, path identity, and final inventory gatesstream bytesCHECKSHA-256CHECKhandle identityCHECKpath identityCHECKfinal inventorystable snapshot
File bytes pass through hash, handle identity, path identity, and final inventory gates.
You will be able to
  • Separate byte integrity, file identity, and archive membership.
  • Explain journal precedence and skipped windows.
  • Reject mixed snapshots without partial output.
1

Core model

Hashes prove which bytes were measured; identity checks prove those bytes came from the same file; final enumeration proves archive membership did not change. Journals receive hashes and structural counts, but no transcript window plan. These are distinct integrity decisions, not one generic safety flag.

Mental model: A tamper-evident evidence bag needs a seal number, custody signatures, and an item list. A checksum alone cannot prove someone did not swap the entire bag.

U2 compares path `lstat`, handle `fstat` identity before/after streaming, and the path identity again after close, then repeats the inventory. Device, inode, size, mtimeNs, and ctimeNs detect replacement or mutation. SHA-256 covers files and each full window. Basename `journal.jsonl` takes classification precedence and yields `status: skipped, reason: journal`.

2

Boundary table

QuestionObserved boundaryOwnerVerdict
SHA-256Exact bytesDigest mismatchCross-check content identity
Handle identityOpened file objectdev/inode/time/size changeReject source mutation
Final inventoryArchive membershipEntry added/removed/changedReject changed archive
journal.jsonlJournal basenameNo transcript windowsHash and count only
Primary local sourcepackages/sessions/src/claude-manifest.ts
beforePath === openedHandle
openedHandle === afterHandle
afterHandle === afterPath
finalInventory === initialInventory
// Otherwise: fail closed, no mixed manifest.
File digest: SHA-256 over every original byte.File digest
SHA-256 over every original byte.
Window digest: SHA-256 over the full window, including overlap.Window digest
SHA-256 over the full window, including overlap.
Identity: Device, inode, size, and nanosecond metadata from the opened object.Identity
Device, inode, size, and nanosecond metadata from the opened object.
journal: A distinct structural artifact, not a transcript-window source.journal
A distinct structural artifact, not a transcript-window source.
3

Synthetic lab

Choose a change during scanning. What is the honest outcome?

4

Retrieval and feedback

Predict before revealing

The file is atomically replaced by another file of the same size. Is size alone enough?

No. Handle/path identity and a final path check are needed to detect replacement.

Retrieval cards

Retrieval cardsFile digestActivate to flip
File digestSHA-256 over every original byte.
Retrieval cardsWindow digestActivate to flip
Window digestSHA-256 over the full window, including overlap.
Retrieval cardsIdentityActivate to flip
IdentityDevice, inode, size, and nanosecond metadata from the opened object.
Retrieval cardsjournalActivate to flip
journalA distinct structural artifact, not a transcript-window source.

Check your model

What happens to `subagents/journal.jsonl` in U2?

Journal basename precedence makes the special structural policy explicit.
5

Evidence ledger

Contract · PROVENSCOPE + source
Implementation · PROVENfocused code + tests
Compiled boundary · PROVENU2 receipt recorded
Independent probe · PROVENU2 files/hashes/bytes match

Authority: docs/fable-session-mining/LOOP-LOG.md. Tests never upgrade a missing live receipt.