Files
dotfiles/scripts
David F GliddenandClaude Opus 5 673823961c [HARDENING] governance-mcp: keyword search — the jurist can discover an item whose id it does not know (PENDING-86 d)
Steward-authorized 2026-08-05, completing the (a)+(d) pair the jurist asked for.

The failure this closes is NOT "cannot read item X" — (a) fixed that. It is
"cannot DISCOVER item X whose id it does not already know": the 2026-07-29 case
where a ruling demanded an outcome REVIEWED-74 had settled four days earlier, in
a file the jurist could read but had no reason to open. Keyed retrieval cannot
serve that; only search can.

`governance_search(query, limit)` over PENDING / PENDING-archive / REVIEWED.
Result unit is the ITEM, boundaries from wd.item_spans — no second definition of
"an item" (the 2026-07-28 bug that hid twenty). Results name ids to hand to
governance_item, so the two tools compose.

Three deliberate properties:

  - Terms are ANDed, and that is DISCLOSED on every result. A silently
    conjunctive matcher is exactly how recall dies as a question lengthens —
    found in the engine yesterday (PENDING-97, "what does levi mean by the gray
    zone" -> 0 over ten real matches). The same shape is not being rebuilt here
    unannounced.
  - A miss is a legible empty: it states the corpus, the item count scanned, the
    terms, and the match mode, and says outright that a longer query narrows
    fast. Silence discloses its own blindness (PENDING-96's discipline, applied
    to a new instrument on the day it was ruled).
  - Ranked by exact-phrase then raw term-count, labelled as a term COUNT and not
    a relevance score — it is a field this code actually computes.

Plus a query-INDEPENDENT structural pass: an item header hidden by leading
whitespace is invisible to item_spans, so it can never appear in results and its
absence reads as a genuine miss. Such headers are now reported beside the
results. An earlier draft flagged any uncovered matching line and drowned the
signal in each file's preamble — which is how a warning stops being read.

That pass earned itself immediately: REVIEWED-11, REVIEWED-12 and REVIEWED-74
were all indented and therefore unreachable by governance_item. REVIEWED-74 is
precisely the ruling the jurist could not find, so its failure was
over-determined — it did not know the id, AND the id would not have worked.
Steward unindented all three (REVIEWED.md is his file, not the executor's, per
Constitutional Constraint 1); items visible 78 -> 81, hidden headers now zero.

Selftest 35 -> 44 controls, 0 fail, including a negative control that goes red
if a header is ever hidden again. Live stdio round-trip confirms six tools and a
correct search result.

⚠ Requires a Claude.app restart to expose the new tool.

Refs PENDING-86 (d), PENDING-82, PENDING-96, PENDING-97.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AB3Kryoy6b1pm2Nz1DYdLh
2026-08-05 21:27:18 +02:00
..