From 05831149b8c3d88ba4be3ffd3c02f77eb59c411b Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 22 Nov 2026 19:12:06 -0500 Subject: [PATCH] fix(7729): a rule with no statement keeps its full line, and the delivery test flushes like a door MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A first mention whose rule had an empty statement fell through to the reference form and lost its "may apply " — for a trigger-fired rule, the very clause that says which trigger fired. The full form now renders with or without a statement. The integration helper flushes the request buffer, as a door does once its payload is fitted. using-grimoire trimmed back to its 350-line budget. Co-Authored-By: Claude Opus 5.5 --- plugin/skills/using-grimoire/SKILL.md | 10 ++++------ src/grimoire/services/retrieval_pipeline.py | 11 +++++++---- tests/test_integration_rule_deliveries.py | 3 +++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/plugin/skills/using-grimoire/SKILL.md b/plugin/skills/using-grimoire/SKILL.md index 4d6839f7..d066656b 100644 --- a/plugin/skills/using-grimoire/SKILL.md +++ b/plugin/skills/using-grimoire/SKILL.md @@ -100,12 +100,10 @@ Two constraints on *how* that's achieved: **lesson** is what is worth knowing — a better way to think about a problem, a solution that transfers — and ignoring it costs time. All three are worth reading and all three arrive beside your work; only the first is - a mistake to miss. An injected line names which in its opening words — - *"Rule 11 …; it binds:"* against *"Preference 173 …; how this has been done - before:"* — and on a first mention it carries the record's own statement, - so `get_rule(id)` is for the full text (why, how to apply), not for - finding out what it says. A lesson arrives in the records menu marked `lesson`, under a header that - says outright that it binds nothing, and every payload carries `kind`. + a mistake to miss. A line names which up front (*"Rule 11 …; it binds:"*, + *"Preference 173 …; how this has been done before:"*) and on first mention + quotes the statement; `get_rule(id)` gives the why and how. A lesson is + marked `lesson` under a header saying it binds nothing; payloads carry `kind`. **One question sorts them, and it is worth asking out loud: what happens if someone doesn't do this?** *Something breaks, or a boundary is crossed* — a diff --git a/src/grimoire/services/retrieval_pipeline.py b/src/grimoire/services/retrieval_pipeline.py index a29b530a..2bcd97b7 100644 --- a/src/grimoire/services/retrieval_pipeline.py +++ b/src/grimoire/services/retrieval_pipeline.py @@ -237,12 +237,15 @@ def _rule_hint_line( else: state = "First mention this session" tail = f"{state}; full text: get_rule({rule.id})." - statement = "" if (compact or seen or held) else _statement_excerpt(rule) - if not statement: + if compact or seen or held: return f"Also relevant: {noun} {rule.id} \u201c{rule.title}\u201d ({force}). {tail}" + statement = _statement_excerpt(rule) + if statement and statement[-1] not in ".!?…": + statement += "." return ( - f"{noun} {rule.id} \u201c{rule.title}\u201d may apply {where}; {force}: " - f"{statement} {tail}" + f"{noun} {rule.id} \u201c{rule.title}\u201d may apply {where}; " + + (f"{force}: {statement}" if statement else f"{force}.") + + f" {tail}" ) diff --git a/tests/test_integration_rule_deliveries.py b/tests/test_integration_rule_deliveries.py index 90f2b286..41c9375d 100644 --- a/tests/test_integration_rule_deliveries.py +++ b/tests/test_integration_rule_deliveries.py @@ -35,7 +35,10 @@ async def _rows(uid: int) -> list[RuleDelivery]: async def _record(uid, sid, source, lines): + # A bound request's rows wait for the door's payload; flushing all of + # them is what a door does when every line it rendered was kept. rule_deliveries.record(uid, sid, source, lines) + rule_deliveries.flush() await background.drain()