Inventory Without Opening the Archive
Walk the whole tree, classify eligible files, and exclude symlinks without reading a single record.
- Classify every path in the synthetic tree.
- Explain why `lstat` is a safety decision.
- Distinguish ignored input from a failed inventory.
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.
Boundary table
| Question | Observed boundary | Owner | Verdict |
|---|---|---|---|
| alpha.jsonl | Root regular JSONL | primary | Include |
| subagents/agent-01.jsonl | Nested below subagents | subagent | Include |
| misc/orphan.jsonl | Residual nested JSONL | other | Include |
| linked.jsonl | Symlink | None | Exclude |
Primary local source
packages/sessions/src/claude-inventory.tsif (metadata.kind === 'directory') walk(path);
if (metadata.kind !== 'file' || !name.endsWith('.jsonl')) continue;
entries.sort((a, b) => compareText(a.relativePath, b.relativePath));Synthetic lab
Classify a synthetic path.
Retrieval and feedback
How is `subagents/journal.jsonl` classified in U1?
Retrieval cards
Check your model
What does a valid empty directory return?
Evidence ledger
Authority: docs/fable-session-mining/LOOP-LOG.md. Tests never upgrade a missing live receipt.