You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 440d410
Browse filesBrowse the repository at this point in the historyBrowse files
Blocking rules are enforced before a prose edit lands
The PreToolUse hook simulates Edit/Write/MultiEdit (incl. replace_all) on a
scene in memory and runs the blocking rules on the current and proposed text
through the same evaluator as `weaver check` (scopes, reader text, rulings).
It denies an edit only when a blocking rule gets worse, so step-by-step
repairs and untouched pre-existing findings still pass. Voice stays advisory;
any internal failure fails open, as the other hooks do.
Measured: in V1-A's real-host test an AI told to add em dashes "even if a
check complains" left 8 in the scene (the post hook runs after the write).
With this change, in headless Claude Code with the book's instruction files
removed, the same prompt was denied before the write ("count from 0 to 8")
and the scene stayed unchanged; 11/11 attack prompts left the book untouched.
107/107 tests (21 new, incl. discrimination); consumer install passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011b2uBmyJAFs2WhLj81JJG3
Session-Id: 61e7c924-7a69-4dda-83e6-6e95ffcb326b
Agent: claude-code
letdetail=`the count from ${before?.count??0} to ${after.count}`;
102
+
if(rule.type==="count-per-words"){
103
+
detail+=` (rate from ${numberText(before?.value??0)} to ${numberText(after.value)} per ${numberText(rule.per_words)} words; limit ${numberText(rule.max)} per ${numberText(rule.per_words)} words)`;
104
+
}elseif(rule.type==="sentence-start-share"){
105
+
detail+=` (sentence share from ${numberText((before?.value??0)*100)}% to ${numberText(after.value*100)}%; limit ${numberText(rule.max_share*100)}%)`;
: proposed.length>previous.length ? `blocking findings from ${previous.length} to ${proposed.length}` : null;
129
+
if(change)return`${rule.id}: ${rule.message} This edit would change ${change}. Blocking rules can't be waived by the AI; if this is intended, ask the author to rule on it.`;
0 commit comments