Evidence-First Claude Session MiningLesson 5/8
Structural manifest

Stream Records, Never Emit Them

Frame physical records from byte chunks while preserving exact provenance and output silence.

U2 LIVE: PROVENSYNTHETIC EXAMPLE · /demo-claude/
Arbitrary byte chunks become complete physical records and sanitized metadatachunksC0C1C2C3LF framerR0 [0,30)R1 [30,55)R2 invalid_jsonranges + codesno raw record
Arbitrary byte chunks become complete physical records and sanitized metadata.
You will be able to
  • Frame LF-delimited records across arbitrary chunks.
  • Keep byte accounting even when parsing fails.
  • Describe output silence as an invariant, not a redaction step.
1

Core model

A stream may split anywhere—even in the middle of a UTF-8 sequence or line. U2 therefore treats bytes as the source of truth, finds LF record boundaries, counts a final unterminated record, and keeps exact offsets. Parsing can fail without losing byte coverage.

Mental model: A conveyor belt delivers puzzle pieces in arbitrary boxes. The framer rebuilds complete rows at the local station, records their positions, and discards the picture after measuring it.

The file digest consumes every raw byte. Physical records use half-open `[start,end)` spans. Valid top-level timestamp strings contribute observations; invalid UTF-8, empty records, invalid JSON, and non-object JSON become stable faults. The manifest stores none of the raw buffers.

2

Boundary table

QuestionObserved boundaryOwnerVerdict
Chunk boundaryArbitraryNever a record boundary by itselfSTREAM
LFPhysical delimiterEnds one byte spanFRAME
Final bytes without LFUnterminatedStill one physical recordFRAME
Invalid JSONParse faultKeep coverage; emit code onlyFAULT
Primary local sourcepackages/sessions/src/claude-manifest.ts
interface ClaudeManifestByteSource {
  identityBefore: FileIdentity;
  bytes: AsyncIterable<Uint8Array>;
  identityAfter(): Promise<FileIdentity>;
  close(): Promise<void>;
}
Byte chunk: Transport unit chosen by the stream, not the file format.Byte chunk
Transport unit chosen by the stream, not the file format.
Physical record: One LF-delimited span or a non-empty final span.Physical record
One LF-delimited span or a non-empty final span.
Half-open: `start` belongs to the range; `end` does not.Half-open
`start` belongs to the range; `end` does not.
Output silence: Raw buffers never enter the manifest or error text.Output silence
Raw buffers never enter the manifest or error text.
3

Synthetic lab

Feed a synthetic stream shape to the framer.

4

Retrieval and feedback

Predict before revealing

The final record has no LF. Is it ignored?

No. A non-empty final byte span is one physical record and remains covered by hashes and windows.

Retrieval cards

Retrieval cardsByte chunkActivate to flip
Byte chunkTransport unit chosen by the stream, not the file format.
Retrieval cardsPhysical recordActivate to flip
Physical recordOne LF-delimited span or a non-empty final span.
Retrieval cardsHalf-openActivate to flip
Half-open`start` belongs to the range; `end` does not.
Retrieval cardsOutput silenceActivate to flip
Output silenceRaw buffers never enter the manifest or error text.

Check your model

What is the source of truth for offsets and hashes?

Parsing may fail or normalize text; byte provenance must not.
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.