feat(8141): every gate that stops a tool call is recorded, with what followed
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>
This commit is contained in:
@@ -537,6 +537,27 @@ async def retrieval_telemetry(
|
||||
pushed or by being asked for, which `usage` cannot: a pull there does not
|
||||
say which door led to it. Counts only sessions whose plugin reports opens.
|
||||
|
||||
`gates` — every time a Grimoire gate stood in front of a tool call, from
|
||||
`gate_stops`, as the plugin hook that made the stop reported it. In
|
||||
`by_gate`, for each of `enforce` and `hold` (a moment rule's
|
||||
enforcement), `checkpoint` (the act checkpoint on a command) and
|
||||
`fence` (the project fence asking the operator), it gives:
|
||||
- `stops`: calls denied or put to the operator;
|
||||
- `cleared`: stops the session cleared by opening the rule, which is how
|
||||
a hold is meant to clear;
|
||||
- `misfired`: stops whose rule the session then reported with
|
||||
`rule_misfired`, a stop at the wrong moment;
|
||||
- `let_through`: calls a hold would have stopped, let through because
|
||||
the session's stop budget was spent;
|
||||
- `ran`: stopped calls that ran after all. For the fence that is the
|
||||
operator's yes; an ask without it was declined, or the call failed.
|
||||
`by_rule` gives the same per rule and place, most stops first. `fence`
|
||||
gives the asks per tool and target project. Read `misfired` and
|
||||
`let_through` before changing a rule's enforcement. A rule that stops
|
||||
work and is then called a misfire has the wrong moment or trigger; a
|
||||
budget that keeps letting calls through is spent on rules that stop
|
||||
too often. `gates_failed: true` means the read broke.
|
||||
|
||||
`judged` — whether the lines RELATED, from `retrieval_judgments`:
|
||||
per source, a reviewer's verdicts (`on_point` / `adjacent` / `unrelated`)
|
||||
on a sample of logged menus, `within_budget` against `beyond_budget` and
|
||||
|
||||
Reference in New Issue
Block a user