From 7d46ce02290474c95df6916df7847c64c5779ca5 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 23 Nov 2026 00:22:56 -0500 Subject: [PATCH 1/4] feat(7731): enforced rules refuse the act, only hold rules hold, and the shape question rides the next prompt - A rule set to enforce, reached by a mount or a trigger, refuses the tool call in its own words every time (`act_decision`, `/moment` returns `decision`, grimoire_moment.sh denies). Opening it does not lift it. - A rule set to hold denies the call once until read, under the act checkpoint's per-rule and per-session guard; file writes are never held. - The reply hold, the reply backstop and the act checkpoint hold only on rules declared hold or enforce (`rule_order.holds`). An inform rule is a line beside the work. - The prompt arm leaves rules that arrive at an act (mounted on a non-reply moment, or with a tool/path/command trigger) to that act. - The end-of-turn shape check no longer blocks: its note is kept for the next prompt, carried as `carry` into the one fitted payload, and the stop after that prompt records whether the lines were judged (noted / judged_after_note / left_after_note). - Rule editor and list copy say what hold and enforce now do. Plugin 2026.11.23.0005. Co-Authored-By: Claude Opus 5.5 --- frontend/src/api/rulebooks.ts | 5 +- .../components/rules/RuleEditorSlideOver.vue | 8 +- .../src/components/rules/RuleListPane.vue | 4 +- plugin/.claude-plugin/plugin.json | 2 +- plugin/PACKAGING.md | 6 +- plugin/README.md | 18 ++- plugin/hooks/grimoire_autoinject.sh | 16 +- plugin/hooks/grimoire_moment.sh | 31 +++- plugin/hooks/grimoire_reply_check.sh | 4 +- plugin/hooks/grimoire_session_end.sh | 11 +- plugin/hooks/grimoire_shape_check.sh | 108 ++++++++------ src/grimoire/routes/plugin.py | 37 ++++- src/grimoire/services/moment_delivery.py | 50 ++++++- src/grimoire/services/plugin_context.py | 14 ++ src/grimoire/services/retrieval_pipeline.py | 109 +++++++++++++- src/grimoire/services/rule_order.py | 23 +++ src/grimoire/services/shape_check.py | 55 ++++--- tests/conftest.py | 5 +- tests/test_moment_delivery.py | 141 +++++++++++++++++- tests/test_pre_act_checkpoint.py | 13 +- tests/test_reply_moment.py | 27 +++- tests/test_services_shape_check.py | 32 ++-- tests/test_shape_check_hook.py | 95 +++++++++--- 23 files changed, 644 insertions(+), 170 deletions(-) diff --git a/frontend/src/api/rulebooks.ts b/frontend/src/api/rulebooks.ts index 7f20f6b1..e38fff40 100644 --- a/frontend/src/api/rulebooks.ts +++ b/frontend/src/api/rulebooks.ts @@ -56,8 +56,9 @@ export type RuleKind = "rule" | "preference"; /** * What a rule does when it arrives, declared by its author. `inform` puts a - * line beside the work; `hold` makes the reply or act it governs wait for one - * read; `enforce` checks the act itself. A preference is always `inform`. + * line beside the work; `hold` makes the reply or command it governs wait for + * one read; `enforce` refuses an act its moment or trigger reaches. A + * preference is always `inform`. */ export type RuleEnforcement = "enforce" | "hold" | "inform"; /** How a rule ranks among rules of the same enforcement at a crowded moment. */ diff --git a/frontend/src/components/rules/RuleEditorSlideOver.vue b/frontend/src/components/rules/RuleEditorSlideOver.vue index ff0f1423..41d6c76b 100644 --- a/frontend/src/components/rules/RuleEditorSlideOver.vue +++ b/frontend/src/components/rules/RuleEditorSlideOver.vue @@ -344,14 +344,16 @@ watch(() => props.ruleId, load); diff --git a/frontend/src/components/rules/RuleListPane.vue b/frontend/src/components/rules/RuleListPane.vue index 92713d0e..e7b86ee2 100644 --- a/frontend/src/components/rules/RuleListPane.vue +++ b/frontend/src/components/rules/RuleListPane.vue @@ -33,8 +33,8 @@ const emit = defineEmits<{ v-if="r.enforcement === 'hold' || r.enforcement === 'enforce'" class="rule-chip" :title="r.enforcement === 'hold' - ? 'The reply or act it governs waits for one read of it' - : 'The act it governs is checked against it'" + ? 'The reply or command it governs waits until it has been read once' + : 'An act it is reached by does not run until the rule changes'" >{{ r.enforcement === "hold" ? "holds" : "enforced" }}