Expand description
Distill-pending queue — append-only JSONL log under
<cwd>/.spool/distill-pending.queue that Stop / PreCompact hooks
drain into candidate / accepted memory records.
§Why a separate file (vs. piggybacking on the ledger)?
- The ledger is the lifecycle truth source. Half-cooked signals (raw tool outputs, partial prompts) MUST NOT pollute it.
- The queue is intentionally lossy under pressure (LRU 100 by default) — old signals dropped silently. The ledger never drops.
- The queue file is project-local; deleting
.spool/on a fresh clone safely wipes accumulated signals without touching the shared vault ledger.
§Concurrency model
Multiple Claude Code instances may run hooks against the same
.spool/ (e.g. user opens two terminals in the same repo). We use
fs2::FileExt::lock_exclusive (POSIX flock) to serialize all
mutating operations. flock is advisory + per-fd, sufficient for
single-host concurrency. We do NOT support cross-host network FS
concurrency (out of scope per ADR-0001 single-user assumption).
§File format
One JSON object per line. Each entry has the shape produced by
[hook_runtime::post_tool_use::DistillSignalEnvelope]:
{"recorded_at": <unix>, "tool_name": <opt>, "cwd": <abs>, "payload": <opt>}§Operations
Structs§
- Distill
Signal - One signal envelope written by the post-tool-use hook.
Constants§
Functions§
- append
- Append a single signal envelope to the queue, then enforce the LRU cap. Atomic w.r.t. concurrent appenders thanks to flock.
- drain_
all - Read all lines and atomically truncate the queue to empty. The caller (typically Stop hook) processes the returned signals into the lifecycle ledger.
- peek_
all - Read all lines without modifying the queue. Useful for doctor / debugging.
- queue_
path - Resolve the queue file path under
<runtime_dir>/distill-pending.queue.