hamarshehmhmd

Agentfence — AI skill for Claude Code

AI community

Policy firewall for the shell commands AI coding agents run: Claude Code & Cursor hooks that block rm -rf ~, force-push to main, curl bash, DROP TABLE and secret exfiltration.

How to install Agentfence

This entry records only its repository, not the path inside it, so there is no exact command to give. Open hamarshehmhmd/agentfence and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Agentfence does

Policy firewall for the shell commands AI coding agents run: Claude Code & Cursor hooks that block rm -rf ~, force-push to main, curl bash, DROP TABLE and secret exfiltration.

Alternatives in AI

  • Main — Open-source SaaS framework (React + Firebase + Stripe) with built-in Claude Code AI skills 550 ★
  • Table Skills — 自用 AI Skills 合集:项目交接与网页替身,让长任务接续更清楚,让独立重任务交给网页 ChatGPT 512 ★
  • Hol Guard — Open-source antivirus for AI agents: block risky tools, secret access, prompt injection, malicious packages, M 485 ★

README

agentfence

[![CI](https://github.com/hamarshehmhmd/agentfence/actions/workflows/ci.yml/badge.svg)](https://github.com/hamarshehmhmd/agentfence/actions/workflows/ci.yml) [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](LICENSE) ![Python 3.11 | 3.12 | 3.13](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg) ![Dependencies: none](https://img.shields.io/badge/dependencies-none-brightgreen.svg)

curl -fsSL https://raw.githubusercontent.com/hamarshehmhmd/agentfence/main/install.sh | sh

Installs the CLI and registers the hook for Claude Code and Cursor (user-level, merged into your existing settings, safe to re-run). Prefer not to pipe to sh? `pipx install git+https://github.com/hamarshehmhmd/agentfence` (or `uv tool install git+https://github.com/hamarshehmhmd/agentfence`), then `agentfence install claude --user` / `agentfence install cursor --user`. [Read install.sh](install.sh) first if you like.

![agentfence allowing safe commands and blocking rm -rf ~](docs/demo.gif)

**A policy firewall for the shell commands AI coding agents run.** It plugs into Claude Code and Cursor as a hook and checks every command *before* it executes. `rm -rf ~`, `git push --force origin main`, `curl … | bash`, `DROP TABLE` and `cat .env | curl …` get blocked. Commands that are risky but sometimes legitimate (`terraform destroy`, `git reset --hard`, reading `.env`) wait for a human. Everything else runs as normal.

Zero dependencies (Python ≥ 3.11 standard library only), licensed under AGPL-3.0 (commercial licenses available on request).

$ agentfence check -- "npm test && git push --force origin main"
DENY   npm test && git push --force origin main
       -> force-push to protected branch main [git.force-push: deny]

The problem

Coding agents now run shell commands on developers' laptops, often in auto-approve or "YOLO" mode. The built-in permission systems match command *prefixes*, not what a command