An operator running one session per project can type into the wrong
window, and nothing caught it: the message usually asks for work the
session can do in its own repo, so the project fence never fires.
The prompt lookup (/api/plugin/retrieve) now ranks the operator's own
words against every project's records (services/project_check.py). When
another project's records clearly win (best match >= 0.78, ahead of this
project's by 0.05, with at least 3 of the 12 nearest), a line leads the
payload, ahead of every rule, telling the session to ask the operator
whether the message was meant for it. Naming the other project halves the
margin but never flags alone; naming this project rules a flag out. A
message with no subject, or a session with no project, is not checked.
Each flag is a new `project_check` gate stop with both scores, asked once
per session per other project, read back in retrieval_telemetry's gates
block and in the web UI's gate readout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rule set to enforce or hold, the act checkpoint and the project fence
stopped work and left no record. The hook that makes each stop now reports
it to POST /api/plugin/gate-stop; the hook decides, not the server, because
the per-rule and per-session caps are kept in the plugin.
- gate_stops table (migration 0138): gate, outcome (stopped / let_through /
asked), rule, where it was reached, tool, target project, call id.
- An open of the rule stamps the stop as cleared (rule-opened). A fenced
call that then runs stamps ran: grimoire_fence_ran.sh, a PostToolUse on
the fenced tools, matches the call id the fence left pending. That is
the operator's yes.
- A hold or checkpoint the spent session budget lets through is reported
as let_through; the per-rule once is not.
- The readout: by gate and by rule, stops, cleared by a read, misfired
(rule_misfired after it), let through by the cap, ran. In
retrieval_telemetry as `gates`, at /api/retrieval/gate-stops, and on the
Moments settings page ("When a rule stopped the work").
- act_decision carries `at`, the moment the deciding rule was reached at.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>