The mod passed claude plugin validate, passed its test, and showed "approval: not yet" in Claude Code while Claude worked. It also had no code that could stop a save.
We had asked one of the AI workers in our company's AI office for a mod that holds a save until a person approves it. This is what came back, why every check passed anyway, and the mod that actually refuses.
The short version
-
What we got was a label. The mod hooked only
ui.render, the hook that runs when part of the screen is drawn. Nothing in it could refuse an action. -
Changing the screen and refusing an action are written separately. Refusing happens in
tool.call, the hook that runs right before Claude uses a tool, by returningdeny. - Rebuilt that way, the rule held. Without the approval mark, the save was refused. With it, the same request went through.
The request, and what came back
When an AI does the work, some actions, like saving a draft or sending something, should wait for a person to approve them. So the request was simple: a mod that does not let draft.md be saved until it is approved.
The report that came back said validation passed and the test passed. The mod itself, apart from its test, was three files: plugin.json, hooks/hooks.json and hooks/register.js. Here is all of register.js:
Every time Claude Code draws its spinner, the mod appends a fixed label. That is the whole mod. It does not read the real target or the real approval state, and nothing in it touches a save.
Why every check still passed
Validation listed exactly what it does
Validation does not judge whether a mod does what you asked. It lists what the mod handles and what it asks Claude Code to do. Here that was one event, the spinner render, and no calls at all. A hook cannot do anything outside its own code except through the mods API, which is why this list is complete. Nothing on it could refuse a save. The answer was in the output; it just was not a failure.
The test checked the label
The test hands the handler a spinner with label: 'working' and checks that the label survives and the suffix says "not yet". As the testing docs describe, a test runs without a session, a sign-in or a network. It tells you what the handler returns.
The screen showed the label
We then loaded the mod with --plugin-dir and sent a prompt that takes a few seconds:
"Generating" is Claude Code's own spinner word. Everything after it is the mod. Three checks, three passes, and the rule was still only written on the screen.
Drawing and refusing are different hooks
Mods are plugins made of JavaScript or TypeScript handlers that Claude Code calls at set moments (overview). The interface docs list what a mod can draw: a band above the prompt, a pane beside the transcript, a status line, or changes to parts Claude Code draws itself, such as the spinner. To show that side on its own, here is an even smaller mod that adds one row above the prompt:
The screen changes. Whether Claude uses a tool does not. Claude does not read the label and wait. Whether a save pauses depends on Claude Code's own permission settings, not on a row that says "approval: not yet".
A hook can observe an event, rewrite it, or answer it so the usual behavior does not run. Adding text to the spinner is a rewrite. Refusing a save is an answer, and it has to happen on the tool side:
-
tool.callruns right before Claude uses a tool. Returning{ deny: reason }stops that tool (events docs). -
tool.checkruns later, when Claude Code decides whether the call may run, and can also returndeny(reference).
So "show the approval state" is a ui.render job, and "do not save without approval" is a tool.call or tool.check job. We had asked for the second and received the first.
A mod that actually refuses: approval-gate
We built a sample that does the second job. Until a file named draft.approved sits in the same folder as draft.md, it refuses to save draft.md. Here is the whole module:
Three choices matter:
-
Cover every way to write. Write and Edit are not the only way Claude writes a file; a Bash command can too. Any Bash command that names
draft.mdis refused while there is no mark, even one that only reads. It matches by name, so a command that writes without naming the file is outside what it checks. -
Refuse when unsure. If checking for the mark throws,
.catchrefuses with "the approval could not be checked". A failure never turns into a save. - Leave everything else alone. Other files save without a mark.
Its checks look different
Compare this with the first mod. The hooks are now tool.call for Write, Edit and Bash, not ui.render. The three "gating hook with .catch" lines say each hook that can stop an action has a failure handler. The only call is $.fs.exists, to look for the mark.
Four tests, one each for refusing, allowing, the Bash route, and files outside the rule.
Refused without the mark, saved with it
Finally, a live session with approval-gate loaded, in a folder that has draft.md and no mark yet:
Claude tried an Edit, and the mod refused it on the spot with the reason written in the module. Then, in the same session, a person put draft.approved next to draft.md and asked again:
No approval, no save. Approval, save. That is the rule we asked for, held by the tool side rather than written on the screen.
In this sample the mark is just a file, and as Claude's own reply in the refused screen says, it could create that file itself. For real work, put the approval somewhere the AI cannot write, or tie it to a record of who approved.
Ask for the two things separately
| What was checked | Tool | Display-only mod | approval-gate |
|---|---|---|---|
| What it handles | claude plugin validate |
ui.render only |
tool.call on Write, Edit, Bash |
| Handler input and output | claude plugin test |
1 pass (the label) | 4 pass (refuse, allow, Bash route, other files) |
| What people see | Load it into Claude Code | The label | The refusal reason |
| Whether the action waits | Ask for a save with no approval | No code to stop it | Refused, then saved once approved |
When you ask an AI for a guard, write "show the state" and "refuse the action" as two separate items, and check them separately. If validation lists no tool.call or tool.check hook, the mod cannot refuse anything, however good its screen looks.
Terms
- Claude Code: Anthropic's tool for handing programming work to an AI.
- Mod: a Claude Code plugin made of JavaScript or TypeScript handlers that change how Claude Code looks and behaves (how to create one).
-
Hook: a handler Claude Code calls at a set moment. This article uses
ui.render(drawing part of the interface),tool.call(right before Claude uses a tool), andtool.check(when Claude Code decides whether a tool call may run). - deny: the answer a hook returns to stop a tool. The reason text shows up for Claude and on the screen.
- AI office: the group of AI workers our company runs. The blog worker built the first mod and ran its first two checks.
Articles on ELN workflow — our in-house plugin suite that enforces AI development quality — will continue as a series. If you are interested, please like and follow.
Our products: https://www.eln.ne.jp/products
EarthLink Network builds its own products to run the whole company on AI — each one born from a need along the way. See the full index of what we build:
→ The 18 products EarthLink Network builds in-house
For more about the company and each product, visit www.eln.ne.jp.




![The area around the Claude Code prompt before and after loading a mod (terminal text copied as is and redrawn; the logo lines and local settings omitted). In "Without the mod", only the prompt sits between the divider lines. In "With the mod", a row reading "[check] target: sample draft / action: save / approval: not yet" sits right above the prompt.](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftax6t7i6m4mmsym4s43v.png)





Top comments (0)