agent-guardrails
Stop AI agents from secretly bypassing your rules. Mechanical enforcement with git hooks, secret detection, deployment verification, and import registries. Born from real production incidents: server crashes, token leaks, code rewrites. Works with Claude Code, Clawdbot, Cursor. Install once, enforce forever.
- License 许可
- MIT
- 最近更新
- 2026-05-17
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- bugs
- https://github.com/jzOcb/agent-guardrails/issues
- name
- agent-guardrails
- tags
- [ "ai-safety", "code-quality", "enforcement", "git-hooks", "deployment", "security", "automation", "guardrails", "claude-code", "clawdbot", "cursor", "mechanical-enforcement", "agent-reliability" ]
- author
- jzOcb
- license
- MIT
- pricing
- FREE
- version
- 1.1.0
- category
- development-tools
- homepage
- https://github.com/jzOcb/agent-guardrails#readme
- keywords
- [ "AI agent bypassing", "code enforcement", "git hooks automation", "secret detection", "deployment verification", "import enforcement", "mechanical guardrails", "agent safety", "production incidents", "Claude Code skills", "Clawdbot skills", "AI coding safety" ]
- repository
- https://github.com/jzOcb/agent-guardrails
- description
- Stop AI agents from secretly bypassing your rules. Mechanical enforcement with git hooks, secret detection, deployment verification, and import registries. Born from real production incidents: server crashes, token leaks, code rewrites. Works with Claude Code, Clawdbot, Cursor. Install once, enforce forever.
- requirements
- { "git": ">=2.0", "bash": ">=4.0" }
- compatibility
- [ "claude-code", "clawdbot", "cursor", "any-ai-agent" ]
02 资源文件 22
- 参考文档_meta.json288 B
- 脚本assets/init-registry-template.py1.2 KB
- 脚本assets/registry-template.py1.5 KB
- 参考文档CHANGELOG.md3.9 KB
- 参考文档CLAUDE_CODE_INSTALL.md2.2 KB
- 参考文档GITHUB_TOPICS_GUIDE.md1.7 KB
- 脚本PUBLISH_NOW.sh1009 B
- 参考文档PUBLISHING.md7.4 KB
- 参考文档README.md6.4 KB
- 参考文档references/agents-md-template.md1.6 KB
- 参考文档references/deployment-verification-guide.md6.9 KB
- 参考文档references/enforcement-research.md3.7 KB
- 参考文档references/SKILL_CN.md5.1 KB
- 参考文档references/skill-update-feedback.md5.0 KB
- 脚本scripts/check-secrets.sh6.8 KB
- 脚本scripts/create-deployment-check.sh5.8 KB
- 脚本scripts/install-skill-feedback-loop.sh6.1 KB
- 脚本scripts/install.sh3.4 KB
- 脚本scripts/post-create-validate.sh4.7 KB
- 脚本scripts/pre-create-check.sh3.6 KB
- 参考文档skill.json1.3 KB
- 参考文档X_THREAD.md4.7 KB
03 SKILL.md 正文
Agent Guardrails
Mechanical enforcement for AI agent project standards. Rules in markdown are suggestions. Code hooks are laws.
Quick Start
cd your-project/
bash /path/to/agent-guardrails/scripts/install.sh
This installs the git pre-commit hook, creates a registry template, and copies check scripts into your project.
Enforcement Hierarchy
- Code hooks (git pre-commit, pre/post-creation checks) — 100% reliable
- Architectural constraints (registries, import enforcement) — 95% reliable
- Self-verification loops (agent checks own work) — 80% reliable
- Prompt rules (AGENTS.md, system prompts) — 60-70% reliable
- Markdown rules — 40-50% reliable, degrades with context length
Tools Provided
Scripts
| Script | When to Run | What It Does |
|---|---|---|
install.sh |
Once per project | Installs hooks and scaffolding |
pre-create-check.sh |
Before creating new .py files |
Lists existing modules/functions to prevent reimplementation |
post-create-validate.sh |
After creating/editing .py files |
Detects duplicates, missing imports, bypass patterns |
check-secrets.sh |
Before commits / on demand | Scans for hardcoded tokens, keys, passwords |
create-deployment-check.sh |
When setting up deployment verification | Creates .deployment-check.sh, checklist, and git hook template |
install-skill-feedback-loop.sh |
When setting up skill update automation | Creates detection, auto-commit, and git hook for skill updates |
Assets
| Asset | Purpose |
|---|---|
pre-commit-hook |
Ready-to-install git hook blocking bypass patterns and secrets |
registry-template.py |
Template __init__.py for project module registries |
References
| File | Contents |
|---|---|
enforcement-research.md |
Research on why code > prompts for enforcement |
agents-md-template.md |
Template AGENTS.md with mechanical enforcement rules |
deployment-verification-guide.md |
Full guide on preventing deployment gaps |
skill-update-feedback.md |
Meta-enforcement: automatic skill update feedback loop |
SKILL_CN.md |
Chinese translation of this document |
Usage Workflow
Setting up a new project
bash scripts/install.sh /path/to/project
Before creating any new .py file
bash scripts/pre-create-check.sh /path/to/project
Review the output. If existing functions cover your needs, import them.
After creating/editing a .py file
bash scripts/post-create-validate.sh /path/to/new_file.py
Fix any warnings before proceeding.
Setting up deployment verification
bash scripts/create-deployment-check.sh /path/to/project
This creates:
.deployment-check.sh- Automated verification scriptDEPLOYMENT-CHECKLIST.md- Full deployment workflow.git-hooks/pre-commit-deployment- Git hook template
Then customize:
- Add tests to
.deployment-check.shfor your integration points - Document your flow in
DEPLOYMENT-CHECKLIST.md - Install the git hook
See references/deployment-verification-guide.md for full guide.
Adding to AGENTS.md
Copy the template from references/agents-md-template.md and adapt to your project.
中文文档 / Chinese Documentation
See references/SKILL_CN.md for the full Chinese translation of this skill.
Common Agent Failure Modes
1. Reimplementation (Bypass Pattern)
Symptom: Agent creates "quick version" instead of importing validated code.
Enforcement: pre-create-check.sh + post-create-validate.sh + git hook
2. Hardcoded Secrets
Symptom: Tokens/keys in code instead of env vars.
Enforcement: check-secrets.sh + git hook
3. Deployment Gap
Symptom: Built feature but forgot to wire it into production. Users don't receive benefit.
Example: Updated notify.py but cron still calls old version.
Enforcement: .deployment-check.sh + git hook
This is the hardest to catch because:
- Code runs fine when tested manually
- Agent marks task "done" after writing code
- Problem only surfaces when user complains
Solution: Mechanical end-to-end verification before allowing "done."
4. Skill Update Gap (META - NEW)
Symptom: Built enforcement improvement in project but forgot to update the skill itself.
Example: Created deployment verification for Project A, but other projects don't benefit because skill wasn't updated.
Enforcement: install-skill-feedback-loop.sh → automatic detection + semi-automatic commit
This is a meta-failure mode because:
- It's about enforcement improvements themselves
- Without fix: improvements stay siloed
- With fix: knowledge compounds automatically
Solution: Automatic detection of enforcement improvements with task creation and semi-automatic commits.
Key Principle
Don't add more markdown rules. Add mechanical enforcement. If an agent keeps bypassing a standard, don't write a stronger rule — write a hook that blocks it.
Corollary: If an agent keeps forgetting integration, don't remind it — make it mechanically verify before commit.
04 同仓库更多 Skills
zvukogram
Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.
zohomail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-recruit
Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows. Use this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-people
Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave. Use this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-mail
Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels. Use this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.
zoho-inventory
Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments. Use this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway). Requires network access and valid Maton API key.