Skip to content

feat(cli): let a plugin hook refuse a file write on every host - #1370

Merged
blafourcade merged 5 commits into
nextfrom
feat/hooks-refuse-a-write-on-every-host
Nov 25, 2026
Merged

blafourcade merged 5 commits into
nextfrom
feat/hooks-refuse-a-write-on-every-host

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

🎯 What & why

A plugin hook can now refuse a file write on every host through one neutral host.refuse(reason) answer. plugins/aidd-pm/hooks/spec-lock.cjs refuses on each covered host.

🛠️ How it works

host.refuse(reason) is mapped per host, from real captures:

Host Version Refusal
Claude Code 2.1.332 hookSpecificOutput.permissionDecision deny with its reason
Codex CLI 0.172.0 same shape as Claude Code
Copilot CLI 1.0.114 permissionDecision deny with permissionDecisionReason
Antigravity (agy) 1.5.17 {decision: "deny", reason}
Kiro 3.6.0 exit 2 with the reason on stderr
  • The agy wrapper answers {"decision":"allow"} for a silent PreToolUse script. Before this, {} denied every tool.
  • PreToolUse is now relayed on agy and Kiro.

🧪 How to verify

  • Gates G1 to G4 exit 0 on HEAD.
  • 10000 tests passed.
  • Bundle 888.9 KB of 897 KB.

⚠️ Heads-up

  • Cursor is not probed (usage limit).
  • Codex needs hook trust, as the trust notice says.
  • Kiro was probed only with exit 2. The Kiro IDE was not probed.
  • The OpenCode/Kilo bridge is a separate PR, so it is not covered here.

🔗 Linked issue

Refs #1342

✅ I certify

  • I DO CERTIFY I READ EACH LINE OF THE PULL REQUEST BECAUSE I AM A SOFTWARE ENGINEER, NOT A AI PUPPY.

🤖 Generated with Claude Code

blafourcade and others added 5 commits November 25, 2026 19:27
The shared hook interface gains `refuse(reason)` and a `PreToolUse`
event whose files carry their path only. Claude Code's adapter reads the
event and denies through hookSpecificOutput.permissionDecision, proven
against a real session: the write did not land and the model received
the reason. Every other adapter keeps reading no PreToolUse until its
payload is captured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each adapter reads the moment before a tool and denies it the way its
host was seen delivering it to the model, from captured runs: codex and
claude through hookSpecificOutput, copilot through permissionDecision,
antigravity through decision deny, kiro through exit code 2. Antigravity
and Kiro now relay PreToolUse, and agy's wrapper answers allow for a
silent script, since an empty object denies there. Cursor stays a stated
limit: no payload could be captured. The spec lock is proven against
each captured payload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant