feat(7733): adherence is measured per rule and per moment, and shown
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 16s
CI & Build / TypeScript typecheck (push) Successful in 36s
CI & Build / Python tests (push) Failing after 1m48s
CI & Build / integration (push) Successful in 2m26s
CI & Build / Build & push image (push) Skipped
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 16s
CI & Build / TypeScript typecheck (push) Successful in 36s
CI & Build / Python tests (push) Failing after 1m48s
CI & Build / integration (push) Successful in 2m26s
CI & Build / Build & push image (push) Skipped
A rule is in force at a moment of a session when it was delivered there. Each (session, rule, place) now carries at most one verdict (rule_adherence, migration 0134): followed, departed, broken or not applicable, with where it came from: - an enforce rule refusing the act: followed, recorded by the moment arm, and never replaced; - the session's own rule_outcome (applied, departed) and rule_misfired calls, which the plugin's outcome hook now also posts with the session id (/api/plugin/rule-verdict) onto the delivery being answered; - a transcript review: adherence_to_judge lists what has no verdict yet, by session, and judge_adherence records verdicts with their evidence. rule_adherence (MCP) and /api/retrieval/adherence give the readout: sessions in force, opened and each verdict per rule and per place. Settings > Moments shows it in a "Were they followed" panel, beside each moment's delivered and opened counts, and per rule inside each moment. Verdicts are pruned with their deliveries and left out of backups like them. Plugin 2026.11.23.2227. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "grimoire",
|
||||
"description": "Grimoire for Claude Code: connects the grimoire MCP server, adds the hooks that deliver live project state and relevant records at the right moment, ships the shared client-neutral Grimoire skills (using-grimoire, writing-plans, reporting-back, systematic-debugging, verification, brainstorming, reusing-code, shape-accounting, family-canon), and syncs your saved Grimoire Processes as skills (/grimoire:sync).",
|
||||
"version": "2026.11.23.2051",
|
||||
"version": "2026.11.23.2227",
|
||||
"author": {
|
||||
"name": "Bryan Van Deusen"
|
||||
},
|
||||
|
||||
@@ -24,6 +24,16 @@
|
||||
# honest. It records that an outcome was declared. The value of that is not the
|
||||
# claim itself — it is that the absence of one becomes visible.
|
||||
#
|
||||
# `rule_misfired` closes the same gap from the other side: the rule arrived
|
||||
# at a moment and did not bear on the work there. It is an answer too, so it
|
||||
# goes in the same ledger.
|
||||
#
|
||||
# BOTH ALSO GO TO THE SERVER, with the session id the MCP call cannot carry,
|
||||
# as an adherence verdict on this session's delivery of the rule: applied is
|
||||
# followed, departed is departed, a misfire is not applicable at the moment it
|
||||
# names (`/api/plugin/rule-verdict`). That is what lets the adherence readout
|
||||
# put "followed" beside "delivered" and "opened" per rule and per moment.
|
||||
#
|
||||
# EXIT 0, ALWAYS. This decorates a ledger; a bookkeeping failure must never
|
||||
# turn a successful tool call into a hook error.
|
||||
set -uo pipefail
|
||||
@@ -38,7 +48,7 @@ event_flat=$(printf '%s' "$event" | grimoire_json_flat)
|
||||
session_id=$(grimoire_json_pick "$event_flat" '.session_id')
|
||||
[ -n "$session_id" ] || exit 0
|
||||
|
||||
# The matcher in hooks.json narrows to the rule_outcome tools, but the server
|
||||
# The matcher in hooks.json narrows to the rule_outcome and rule_misfired tools, but the server
|
||||
# segment of an MCP tool name varies with how the plugin was installed, so the
|
||||
# id is read from the field rather than from an assumed tool name — the same
|
||||
# reasoning grimoire_record_opened.sh gives.
|
||||
@@ -52,4 +62,28 @@ safe_sid=$(printf '%s' "$session_id" | tr -c 'A-Za-z0-9._-' '_')
|
||||
|
||||
# Stamped and append-only like its two siblings, so one reader ages them all.
|
||||
printf '%s\n' "$rule_id" | grimoire_rules_append "$state_dir/${safe_sid}.acted.ids"
|
||||
|
||||
# ── The verdict, to the server ───────────────────────────────────────────
|
||||
command -v curl >/dev/null 2>&1 || exit 0
|
||||
grimoire_config || exit 0
|
||||
tool_name=$(grimoire_json_pick "$event_flat" '.tool_name')
|
||||
why=$(grimoire_json_pick "$event_flat" '.tool_input.why')
|
||||
outcome=""
|
||||
moment=""
|
||||
case "$tool_name" in
|
||||
*rule_misfired) moment=$(grimoire_json_pick "$event_flat" '.tool_input.moment') ;;
|
||||
*) outcome=$(grimoire_json_pick "$event_flat" '.tool_input.outcome') ;;
|
||||
esac
|
||||
sid_esc=$(printf '%s' "$session_id" | grimoire_json_escape) || exit 0
|
||||
outcome_esc=$(printf '%s' "$outcome" | grimoire_json_escape) || exit 0
|
||||
moment_esc=$(printf '%s' "$moment" | grimoire_json_escape) || exit 0
|
||||
why_esc=$(printf '%s' "$why" | grimoire_json_escape) || exit 0
|
||||
printf '{"rule_id":%s,"session_id":"%s","outcome":"%s","moment":"%s","why":"%s"}' \
|
||||
"$rule_id" "$sid_esc" "$outcome_esc" "$moment_esc" "$why_esc" \
|
||||
| curl -fsS --max-time 3 \
|
||||
-H "Authorization: Bearer ${token}" \
|
||||
-H "X-Grimoire-Plugin: ${plugin_version:-}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data-binary @- \
|
||||
"${url%/}/api/plugin/rule-verdict" >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "mcp__.*__rule_outcome",
|
||||
"matcher": "mcp__.*__(rule_outcome|rule_misfired)",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
|
||||
@@ -96,3 +96,12 @@ triggers reach it exactly (`rules_to_weigh`, `propose_rule_weights`,
|
||||
`rule_weight_proposals`, `judge_rule_weights`). It reads each rule beside its
|
||||
delivery history and proposes; the operator confirms each change, in the
|
||||
session or under Settings › Moments.
|
||||
|
||||
Whether a rule was followed where it arrived is measured per rule and per
|
||||
moment (`rule_adherence`, and under Settings › Moments). Your own
|
||||
`rule_outcome` and `rule_misfired` calls are the session's half of that
|
||||
record: each lands as a verdict on the delivery you were answering. A
|
||||
transcript review fills in the rest when the operator asks for one:
|
||||
`adherence_to_judge` lists the rules in force at a moment of a session with
|
||||
no verdict yet, and `judge_adherence` records followed, broken, departed or
|
||||
not applicable, with what the transcript shows.
|
||||
|
||||
Reference in New Issue
Block a user