docs(6209): task document, query scrubbing, note pipeline, lesson door, live body, ledger clear, rule usage

Seven more test files: docstrings and comments state the property and its
reason, the SQL-twin note states why `\m` and not `\b` without the install
it broke, and fixture provenance says "real near-miss queries" rather than
naming the spike that collected them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 21:29:49 -04:00
co-authored by Claude Opus 5.5
parent 17e1931c0b
commit 0e658bf275
7 changed files with 81 additions and 92 deletions
+12 -16
View File
@@ -1,22 +1,18 @@
"""A compaction clears every session ledger, by convention not by list (#4101).
"""A compaction clears every session ledger, by convention not by list.
WHY THIS EXISTS
Milestone 386 established the claim: a ledger describes what a session HOLDS,
so the events that destroy context must destroy it too, or the records it names
become permanently unreachable mid-session. `scribe_session_context.sh`
implemented that — for the rules ledger, by name.
Five ledgers live in that directory and two were on the list. The note arms'
three (`.ids`, `.sync.ids`, `.derive.ids`) were left, under a comment asserting
this was "a decision rather than an oversight". It was not a decision, and the
arms left out are the ones where it costs most:
A ledger describes what a session HOLDS, so the events that destroy context
must destroy it too, or the records it names become permanently unreachable
mid-session. A clear that names ledgers one by one misses the next one, and the
note arms' three (`.ids`, `.sync.ids`, `.derive.ids`) are where a miss costs
most:
- their exclusions are HARD — `exclude_ids` is passed into
`semantic_search_notes` itself, so a surfaced note leaves the result set
entirely, with no weaker rendering to fall back to the way #3750 gave a
repeated rule one;
- and they never AGE — #3751's TTL was added to the rules ledger only.
entirely, with no weaker rendering to fall back to the way a repeated
rule has one;
- and they never AGE — the TTL is on the rules ledger only.
Hard, permanent and never cleared: a note surfaced in a session's first minute
is unreachable for the rest of it, through any number of compactions.
@@ -38,7 +34,7 @@ test. Both sides are asserted:
And the negative: `<sid>.unreached` is not a ledger of held context but a
record that the instance could not be reached, and a glob that swept it away
would make a hook forget an outage it is meant to report (#2932).
would make a hook forget an outage it is meant to report.
"""
import json
import os
@@ -137,7 +133,7 @@ def test_a_source_that_kept_the_context_keeps_the_ledgers(source, tmp_path):
def test_the_outage_marker_is_not_swept_with_them(tmp_path):
"""`.unreached` records that the instance was down, not what was surfaced.
Different lifetime, different question. #2932's whole point is that "we
Different lifetime, different question. The marker's whole point is that "we
checked and found nothing" and "we never managed to check" must stay
distinguishable, and a clear that took this file out would quietly answer
the second with the first.
@@ -235,7 +231,7 @@ def test_the_clear_is_derived_and_not_a_list_of_names():
def test_the_evidence_twin_is_not_swept_with_them(tmp_path):
"""The second thing that survives, and for the `.unreached` reason (#4217).
"""The second thing that survives, and for the `.unreached` reason.
`scribe_rules_append` writes each ledger twice: `<sid>.<kind>.ids`, which
says what this context HOLDS and must be forgotten here, and