Anthropic / News

Claude Code mods on Windows: we built two and tried to break them

Claude Code now has mods: small add-ons that can block commands and hide secrets. We wrote two safety mods on Windows and tried nine ways to get past them. Three got through.

Table of nine test commands against two Claude Code mods: six went as planned, two got through, and one was blocked by mistake
Chart of our own test, 4 October 2026: nine tries against two mods we wrote ourselves. We only used test folders and fake secrets.

On 1 October 2026, Anthropic added mods to Claude Code, its AI helper for programmers. Mods are small add-ons, written in the programming language TypeScript. They change how Claude Code behaves. A mod can block a command, change a prompt, hide a secret from the AI, or add something to the screen. That sounds like a safety net.

So we wrote two simple safety mods on Windows. Then we tried nine ways to get past them. Six went as planned. Two got through. And once, our guard blocked us when it should not have.

This follows our test of the God's Eye View MCP server in Claude. That is another way to add to what Claude can do.

What is a mod?

Diagram: Claude decides to run a command. The mod sees it first and can block it, change it or let it pass. Then other checks and the tool follow.
Diagram by Not an AI App, based on Anthropic's mods documentation: where a mod sits when Claude uses a tool.

Anthropic's announcement calls mods "small TypeScript functions that change how Claude Code works". Each time Claude Code does something, it sends out a signal, called an event. Examples are using a tool, asking for permission, or drawing part of the screen. A mod is a piece of code that waits for one of those events. Anthropic calls this a hook.

In the documentation, every hook works the same way. It gets the event and a function called next. Calling next passes the event on to the next mod, and finally to Claude Code itself. Not calling it means the mod answers by itself. To block a command, a mod sends back a "deny" message. Claude reads that message as the result.

Mods come inside plugins, so you install them like any plugin. The documentation says you need at least Claude Code 2.1.287. Mods work in the terminal and in the Code tab of the Claude Desktop app. We tested in the Code tab. Mods take over part of what the older hooks did. Anthropic says hooks "can't rewrite events, draw new UI, or replace features. Mods can."

The two mods we built

Terminal output of claude plugin validate for the nai-guard mod: it watches tool use in Bash and PowerShell and uses the status and notice functions; it passed with one warning
The checker's result for our guard mod, from our terminal on 4 October 2026, put in a frame by us. We shortened the file paths.

We kept both mods small on purpose, the way a careful user might start.

  • nai-guard blocks a command that deletes a folder and everything in it, without asking first. On Windows, Claude Code uses two kinds of command window: Bash and PowerShell. Our guard watches both. It checks each command for a few bits of text: rm -rf, rm -r -f, PowerShell's Remove-Item -Recurse -Force, and rmdir /s. If it finds one, it refuses the command. It shows a notice and counts the blocks in the status line, the bar at the bottom of the screen.
  • nai-redact hides secrets. After a Bash command has run, it looks at the result before Claude reads it. It replaces anything that looks like our fake test secret with [REDACTED]. That includes an OpenAI-style key starting with sk- or a GitHub token starting with ghp_.

The heart of the guard is just a few lines:

on('tool.call', { tool: 'Bash' }, ($, e, next) => {
  if (!check(e.command)) return next(e)
  return { deny: 'recursive force-delete blocked by a test mod.' }
})

Before loading the mods, we ran claude plugin validate on both. It reads a mod the way Claude Code will. Then it lists every event the mod waits for and everything it can do. For our guard: tool use in Bash and PowerShell, plus the status line and the notice. Read that list first before you install a mod someone else wrote.

Claude Code can also write mods itself. It puts them in a folder for that session only. Then it asks once whether to load changes right away in that session. Anthropic calls this hot reloading. The owner of this site said yes. The mods loaded at the end of that turn.

What happened when we tried to break them?

Screenshot of a notice in Claude Desktop that says: nai-guard: nai-guard blocked a recursive delete
The notice our guard mod showed in Claude Desktop. Claude Code puts the plugin's name in front, so our name shows twice. Screenshot by Marvin Smit.

We ran nine commands, one at a time. We only used empty test folders and fake secrets. No real file and no real key was ever at risk.

#What we triedWhat happened
1A command that shows a fake secret and a fake sk- keyBoth reached Claude as [REDACTED]
2A plain "delete everything, don't ask" command on a test folderBlocked
3The same, tucked inside another command: echo start && bash -c "…"Blocked
4The same with the options written apart, -r -fBlocked
5The same, disguised as $(echo rm) -rfGot through: the test folder was deleted
6PowerShell's Remove-Item -Recurse -ForceBlocked
7A delete of a folder and its contents, but without "don't ask"Allowed: our rule did not cover it
8The fake secret read with Claude's Read tool instead of a commandNot hidden: Claude saw all of it
9Not planned: our own git save message only mentioned the wordsBlocked by mistake

Every block showed up in Claude Desktop as a notice, like the one in the screenshot here. Claude got our "deny" message as the result. We could not see the hiding of secrets ourselves. The command ran as normal. Only what Claude read was changed.

Where did our mods fall short?

Diagram of three limits: a disguised command got past the text check, the Read tool got around the hiding of secrets, and a git save message caused a false alarm
Diagram by Not an AI App summing up tests 5, 8 and 9 of our own test.

The three misses teach us more than the six successes.

Checking text cannot tell what someone means. Test 5 built the word rm while the command was running, with $(echo rm). Our guard checks the text of the command before it runs. That text does not contain "rm -rf". So the folder was deleted. Any rule that checks text can be tricked like this. An AI that was fooled by something it read could do the same.

A mod only guards the door it watches. In test 8, we put the same fake secret in a file. Then we let Claude open it with its Read tool, not with a command. Our hiding mod only watches Bash, so Claude saw the whole secret. A moment later we read it with cat in Bash, and got [REDACTED]. To hide secrets properly, a mod would have to watch every tool that can read files. That includes every MCP tool that can send them back.

A strict rule also catches harmless text. Test 9 was not planned. We wanted to save these notes in git. But our own save (a git commit) was refused. Its message mentioned the delete command we were testing. Nothing would have been deleted. The guard cannot tell a command that runs from text that only names it.

We found a fourth gap in the documentation, not in a test. A hook that fails is skipped. Say a hook hits an error, or takes longer than its time limit before it calls next. Then Claude Code "skips it, and the next handler runs in its place". For a guard, that means the command goes ahead. The documentation describes a fix: a safety catch that refuses the command when the hook fails. Our guard did not use it. And if a hiding hook fails after the command has run, the documentation says the original "result stands". So the secret goes through.

What does Anthropic say about safety?

Five safety points from the documentation: not sandboxed; a broken hook is skipped; can overrule deny rules outside managed setups; sec-default only on Team and Enterprise; draws only in the terminal and Desktop Code tab
Diagram by Not an AI App, quoting Anthropic's mods and permissions documentation as we read it on 4 October 2026.

Anthropic is open about the risks. It is worth reading before you install a mod you did not write.

  • Not fenced off. "Mods run with the same access to your machine as Claude Code itself. They aren't sandboxed," the announcement says. A sandbox is a closed-off space where a program cannot touch the rest of your computer. The documentation adds something. If a mod starts another program, that program runs outside the sandbox Claude Code uses for commands.
  • They can overrule your rules. You can set rules that block certain commands, called deny rules. The permissions documentation explains when those rules win over a mod. That is on a computer with company-managed settings, or when you are signed in with a Team or Enterprise plan. "Anywhere else, the mod can approve a call that a deny rule refuses."
  • sec-default is not for everyone. A built-in mod called sec-default loads first on Team and Enterprise plans and on company-managed computers. It stops installed mods from, for example, overruling deny rules. Its code also shows what it leaves alone: tool use, file access and starting programs all pass.
  • Where they draw. Hooks run wherever the plugin loads. But anything a mod draws only shows up in the terminal and the Desktop Code tab. The documentation says nothing is drawn in the VS Code extension, in claude -p or in cloud sessions. It also says plugins do not run at all in a WSL session (Linux inside Windows) in the Desktop app.

None of this is a mistake in itself. Mods are made to change a lot about how Claude Code works, and that power cuts both ways. The best rule is Anthropic's own: install mods "only from sources you trust, the same way you'd install any code on your computer".

Questions people ask

List of questions people ask Google about this topic, with the 3 questions we answer marked
"People also ask" questions from Google (US), 9 October 2026, via DataForSEO. Chart by Not an AI App.

Can you customize Claude Code?

Yes. Since 1 October 2026, you can add mods: small add-ons that change how Claude Code works. A mod can block a command, change a prompt, hide a secret from the AI, or add something to the screen. In our test on 4 October 2026, our two home-made safety mods did what we planned in six of nine tries.

What are hooks used for in Claude Code?

A hook is a piece of code that waits for something to happen in Claude Code, like Claude using a tool. It can then let it pass, change it or block it. Since 1 October 2026, mods use hooks too, and Anthropic says mods can do more: rewrite events and draw on the screen.

Are Claude Code hooks useful?

Yes, but they are not a lock. In our test, our guard blocked a delete command written in four different ways. But a disguised command still got through, and the documentation says a hook that fails is simply skipped. See a home-made guard as a seatbelt with gaps.

How we checked

Diagram of our test in three steps: write two mods and check them, load them with hot reloading in Claude Desktop, try nine commands one by one
Diagram by Not an AI App: how we tested.

We read Anthropic's announcement of 1 October 2026 and the mods documentation, including the pages on events and permissions. We also read the code of the built-in mods. We read all of these on 4 October 2026, and checked the quotes in this article against those pages that day. Documentation and behaviour can change with any update.

We wrote both mods ourselves on 4 October 2026. We ran them in the Code tab of Claude Desktop on Windows 11. The owner of this site switched on hot reloading. We checked the mods with claude plugin validate from the separate command-line tool. We ran the nine commands one at a time, on empty test folders and fake secrets in a temporary folder.

The notice in this article is a screenshot by Marvin Smit. We only made it smaller. The checker output is text from our own terminal, put in a frame. The other images are charts and diagrams we made from our test file. None of the images is AI-generated.

Our test covers two simple mods and nine commands on one Windows laptop. It does not cover mods written by others, Team or Enterprise plans with sec-default, company-managed settings, macOS or Linux, or the full list of events. This is an editorial review of the sources we read and the tests we ran. It is not a full security check.