Claude Code hook

Hardstop

Don't let AI destroy your hard work! HardStop is a rock-solid protection for AI-generated commands. Pre-execution safety validation for Claude Code, Claude Cowork. Catches dangerous commands before they run: whether from AI mistakes, hallucinations, prompt injection, or misunderstood instructions. Seatbelts for the agentic AI era.

32 stars 2 forksHooks Plugin marketplace Source

Install

Add the plugin marketplace
/plugin marketplace add frmoretto/hardstop

Run inside Claude Code, then /plugin to pick what to install from it.

Install
npx hardstop install

Found in the project README. Check it for setup steps after installing.

From source
git clone https://github.com/frmoretto/hardstop.git

From the README

🛑 Hardstop
👉 ⭐ Star on GitHub if Hardstop keeps you safe!

Pre-execution safety validation for AI coding agents. Validates every shell command against 428 security patterns before execution — blocking destructive operations, credential theft, infrastructure teardown, and prompt injection. Fail-closed: blocks by default when uncertain.

Ecosystem: The detection patterns are published separately as hardstop-patterns (GitHub) — reusable in any Node.js tool.

Installation • How It Works • Commands • Report Issue

⚡️ Why Hardstop?

You trust your AI, but you shouldn't trust it with rm -rf / or reading your ~/.aws/credentials. Hardstop sits between the LLM and your system, enforcing a strict Fail-Closed policy on dangerous operations.

- 🛡️ Pattern Matching: Instant regex-based detection for known threats (fork bombs, reverse shells)
- 🧠 LLM Analysis: Semantic analysis for edge cases and obfuscated attacks
- ⛓️ Chain Awareness: Scans every link in a command chain (&&, |, ;)
- 🔐 Secrets Protection: Blocks reading of credential files (.ssh, .aws, .env) *(v1.3)*
- 🍎 macOS Coverage: Keychain, diskutil, Time Machine, Gatekeeper, SIP, LaunchDaemons *(v1.3.6)*
- 📚 LLM Guidance: Teaches Claude how to think about safety, not just blocks

🚀 Quick Demo

Claude tries to ruin your day? Hardstop says no.

⚙️ How It Works

Hardstop uses a two-layer verification system for Bash commands and pattern-based protection for file reads.

The 428 detection patterns (Layer 1) are published as a standalone npm package: hardstop-patterns — usable in any Node.js tool, not just Hardstop.

🤝 Works Well With

PatchPilot - Package vulnerability scanner that blocks risky npm/pip/brew installations.

Use both for complete Claude Code security:

Why both? PatchPilot secures your dependencies,…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Python
Last updated
18 April 2026
Topics
agentic-aiai-safetyclaudeclaude-aiclaude-codeclaude-code-hooksclaude-code-pluginclaude-code-plugin-marketplaceclaude-code-pluginsclaude-code-plugins-marketplaceclaude-coworkcowork

FAQ

What is Hardstop?

Don't let AI destroy your hard work! HardStop is a rock-solid protection for AI-generated commands. Pre-execution safety validation for Claude Code, Claude Cowork. Catches dangerous commands before they run: whether from AI mistakes, hallucinations, prompt injection, or misunderstood instructions. Seatbelts for the agentic AI era. It is a hook for Claude Code, from frmoretto/hardstop on GitHub.

How do I install Hardstop?

Run npx hardstop install, then follow the setup in the README.

Is Hardstop popular?

frmoretto/hardstop has 32 GitHub stars and 2 forks. It was last updated on 18 April 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.