Evidence-First Claude Session MiningLesson 2/8
Evidence boundary

Inventory Without Opening the Archive

Walk the whole tree, classify eligible files, and exclude symlinks without reading a single record.

U1 LIVE: PROVENSYNTHETIC EXAMPLE · /demo-claude/
Synthetic archive tree with included files and an excluded symlink/demo-claude/rootalpha.jsonlprimarysubagents/agent-01.jsonlsubagentsubagents/journal.jsonlsubagent in U1misc/orphan.jsonlotherlinked.jsonl → alpha.jsonlexcluded
Synthetic archive tree with included files and an excluded symlink.
You will be able to
  • Classify every path in the synthetic tree.
  • Explain why `lstat` is a safety decision.
  • Distinguish ignored input from a failed inventory.
1

Core model

U1 recursively visits directories, keeps only regular `.jsonl` files, and assigns one of three classes. Root files are primary; any eligible path below a `subagents/` segment is subagent; residual nested files are other. Everything else is ignored by policy, not accidentally forgotten.

Mental model: It is a museum registrar counting sealed crates by room, label, weight, and modification date—without opening a crate.

`lstat` observes a symlink as a symlink; it does not traverse the target. Directory names and final entries are sorted with an explicit text comparator. Aggregates report files, exact bytes, and filesystem mtime ranges with null bounds for empty classes.

2

Boundary table

QuestionObserved boundaryOwnerVerdict
alpha.jsonlRoot regular JSONLprimaryInclude
subagents/agent-01.jsonlNested below subagentssubagentInclude
misc/orphan.jsonlResidual nested JSONLotherInclude
linked.jsonlSymlinkNoneExclude
Primary local sourcepackages/sessions/src/claude-inventory.ts
if (metadata.kind === 'directory') walk(path);
if (metadata.kind !== 'file' || !name.endsWith('.jsonl')) continue;
entries.sort((a, b) => compareText(a.relativePath, b.relativePath));
primary: Eligible JSONL directly under the root.primary
Eligible JSONL directly under the root.
subagent: Eligible path containing a `subagents` segment.subagent
Eligible path containing a `subagents` segment.
other: Eligible nested JSONL outside subagents.other
Eligible nested JSONL outside subagents.
lstat: Observe the path object without following a symlink.lstat
Observe the path object without following a symlink.
3

Synthetic lab

Classify a synthetic path.

4

Retrieval and feedback

Predict before revealing

How is `subagents/journal.jsonl` classified in U1?

As `subagent`. The explicit journal class appears only in U2.

Retrieval cards

Retrieval cardsprimaryActivate to flip
primaryEligible JSONL directly under the root.
Retrieval cardssubagentActivate to flip
subagentEligible path containing a `subagents` segment.
Retrieval cardsotherActivate to flip
otherEligible nested JSONL outside subagents.
Retrieval cardslstatActivate to flip
lstatObserve the path object without following a symlink.

Check your model

What does a valid empty directory return?

Empty is a truthful inventory result; missing and non-directory roots fail.
5

Evidence ledger

Contract · PROVENSCOPE + source
Implementation · PROVENfocused code + tests
Compiled boundary · PROVENU1 receipt recorded
Independent probe · PROVENU1 counts/bytes match

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