warden

Reviewed at commit 867b81f

KOZMOS Warden: a guard for destructive shell commands. Before Claude or a subagent runs rm -rf on a broad path, git push --force, reset --hard, clean -fd…

Made by
KOZMOS
What we checked

Checks every Bash and PowerShell command Claude or a subagent is about to run against a built-in list of destructive patterns (rm -rf on broad paths, force push, reset --hard, DROP TABLE, curl | sh and similar) and asks you to allow or deny; it denies when no one can answer. It reads no files, makes no network calls, runs no programs and only stores whether its band is hidden.

Review details

Static review of the source at the pinned commit; not run. Registers session.start (registers the /warden command and loads the hidden flag from $.store), command.run for /warden (rules, session log, hide|show|toggle), a tool.call hook limited to Bash and PowerShell, and ui.render for AbovePrompt (an 8 second band or SVG after a block). The tool.call hook classifies the command with a pure local parser (rules.ts: shell splitter, path breadth checks, git, SQL, rm and Remove-Item, mkfs, dd, shutdown, chmod -R 777, download-to-shell pipes, fork bomb, optional user regexes from the extraPatterns option) and, on a hit, asks via $.ui.ask (Allow once / Deny) in mode ask, denies in mode deny, or only toasts in mode warn. A dismissed question, a non-interactive run or any error in the hook fails closed and returns a deny; a re-entry error is judged by the classifier alone. Commands that match nothing pass through unchanged via next(e). The session log (max 40 entries, commands clipped to 200 chars) is held in memory only; $.store keeps only the isHidden boolean. No fetch, no $.process, no $.fs, no env access, no eval. Read fully: register.tsx, rules.ts, types, hooks.json and plugin.json. kz.ts is a shared drawing and formatting helper, read in full and pure. hooks/lib/probe.ts (not in the bundle) is not imported by register.tsx or the other included files and is never loaded; it only defines git and platform argv lists and parsers. The unresolved import ../types is a type-only import. npm dependencies: none. Extra user-supplied regexes are compiled with new RegExp, which could be slow on a pathological pattern the user wrote themselves.

What it uses
  • Reads your prompts: no
  • Sees tool calls: yes
  • Blocks or changes tool calls: yes
  • Reads or writes files: no
  • Runs programs on your machine: no
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events

KOZMOS Warden: a guard for destructive shell commands. Before Claude or a subagent runs rm -rf on a broad path, git push --force, reset --hard, clean -fd, DROP TABLE, mkfs, format, curl | sh and their kin, warden asks you (Allow once / Deny) and refuses when no one can answer. A band flashes for 8 s after a block; /warden lists the rules and this session's log.

Made this mod? Add a badge to your README

modsforClaude badge for warden

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/warden.svg)](https://modsforclaude.com/mods/warden/)

← All mods