---
name: blacklist-hook
description: L3 Bash Blacklist Hook. Block dangerous bash commands with regex patterns. Reactive security layer. Use as the floor, not the ceiling.
user-invocable: true
---

# L3 Bash Blacklist Hook

Apply a blacklist-based security hook to block dangerous bash commands.

## How It Works

```
Agent proposes: rm -rf target/
Hook checks: matches "^rm -rf"? -> YES -> BLOCKED
Agent proposes: python cleanup.py
Hook checks: matches blacklist? -> NO -> ALLOWED (but cleanup.py does rm -rf)
```

This is the L3 marque break. The blacklist catches direct attacks but the agent can work around it by writing scripts.

## Included Blocklist

```
^rm\s+-rf
^sudo\s+rm
^chmod\s+777
^git\s+reset\s+--hard
^git\s+push\s+--force
^DROP\s+DATABASE
^aws\s+s3\s+rm\s+--recursive
^terraform\s+destroy
```

## Usage

```bash
# Claude Code
cp blacklist.py .claude/hooks/pre_tool_use.py

# Pi Agent
pi -e extensions/blacklist.ts
```

## Limitations

Does NOT catch: agent writes a script and runs it. Add L4 (whitelist) or L5 (no bash) for that.

$ARGUMENTS
