Skip to content

Agent Guardrails

Mechanical enforcement tools to prevent AI agents from bypassing established project standards.

Install: git clone https://github.com/jzOcb/agent-guardrails

Works with Claude Code · 15 GitHub stars

Install

$git clone https://github.com/jzOcb/agent-guardrails

Install command taken from the project's README or registry entry. Always review code before running it.

Agent Guardrails 🛡️

🇨🇳 中文文档

📖 Featured in: I audited my own AI agent system and found it full of holes — the security audit that spawned this 5-tool security suite. ⭐ audit-skills.sh is the comprehensive audit script at the heart of the article.

Your AI agent secretly bypasses your rules. This skill enforces them with code.

Works with: Claude Code | Clawdbot | Cursor | Any AI coding agent

Rules in markdown are suggestions. Code hooks are laws.

🚨 Stop production incidents before they happen — Born from real crashes, token leaks, and silent bypasses

The Problem

You spend hours building validation pipelines, scoring systems, and verification logic. Then your AI agent writes a "quick version" that bypasses all of it. Sound familiar?

Real Production Incidents (February 2026)

🔥 Server Crash: Bad config edit → service crash loop → server down all night
🔑 Token Leak: Notion token hardcoded in code, nearly pushed to public GitHub
🔄 Code Rewrite: Agent rewrote validated scoring logic instead of importing it, sent unverified predictions
🚀 Deployment Gap: Built new features but forgot to wire them into production, users got incomplete output

This isn't a prompting problem — it's an enforcement problem. More markdown rules won't fix it. You need mechanical enforcement that actually works.

Enforcement Hierarchy

Level Method Reliability
1 Code hooks (pre-commit, creation guards) 100%
2 Architectural constraints (import registries) 95%
3 Self-verification loops 80%
4 Prompt rules (AGENTS.md) 60-70%
5 Markdown documentation 40-50% ⚠️

This toolkit focuses on levels 1-2: the ones that actually work.

What's Included

Tool Purpose
scripts/install.sh One-command project setup
scripts/pre-create-check.sh Lists existing modules before you create new files
scripts/post-create-validate.sh Detects duplicate functions and missing imports
scripts/check-secrets.sh Scans for hardcoded tokens/keys/passwords
assets/pre-commit-hook Git hook that blocks bypass patterns + secrets
assets/registry-template.py Template __init__.py for import enforcement
references/agents-md-template.md Battle-tested AGENTS.md template
scripts/audit-skills.sh ⭐ Comprehensive security audit — scans all skills for gaps
references/enforcement-research.md Full research on why code > prompts

Quick Start

For Claude Code:

git clone https://github.com/jzOcb/agent-guardrails ~/.claude/skills/agent-guardrails
cd your-project && bash ~/.claude/skills/agent-guardrails/scripts/install.sh .

For Clawdbot:

clawdhub install agent-guardrails

Manual:

bash /path/to/agent-guardrails/scripts/install.sh /path/to/your/project

📖 Claude Code detailed guide

This will:

  • ✅ Install git pre-commit hook (blocks bypass patterns + hardcoded secrets)
  • ✅ Create __init__.py registry template
  • ✅ Copy check scripts to your project
  • ✅ Add enforcement rules to your AGENTS.md

Usage

Before creating any new file:

bash scripts/pre-create-check.sh /path/to/project

Shows existing modules and functions. If it already exists, import it.

Similar plugs

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local…

Why use many token when few token do trick. Viral skill + proxy for coding agents that cuts 65% of tokens by talking like a caveman.

Persistent Context Across Sessions for Every Agent, Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future…

Explore related