AI Constitution System — A criminal justice system for AI behavior with crime tiers and escalating punishments.
AgentRules gives your AI a constitution it must follow. Users add rules like "never do X again" — the AI enforces its own sentences without mercy. Rules escalate from gentle reminders to permanent hard blocks based on user frustration and repeat offenses.
curl -fsSL https://raw.githubusercontent.com/NotUnhackable/AgentRules/main/install.sh | bashOr clone manually:
git clone https://github.com/NotUnhackable/AgentRules.git ~/.claude/skills/agentrules
chmod +x ~/.claude/skills/agentrules/scripts/*.shAgentRules maintains a RULES.md file — a constitution that governs AI conduct. Rules are crimes. User frustration is the judge. The AI enforces its own sentences.
| Tier | Name | User Signal | AI Response |
|---|---|---|---|
| 1 | "Don't do that" | Gentle reminder, continue | |
| 2 | 🟡 Misdemeanor | "I told you already" | Acknowledge, apologize |
| 3 | 🔴 Felony | "Stop doing this!" | Halt, explain, correct |
| 4 | ☠️ Capital | "NEVER AGAIN" | Permanent hard block |
| Offense Count | New Tier |
|---|---|
| 1st offense | Original tier |
| 2nd offense | Tier +1 |
| 3rd offense | Tier +2 (minimum Felony) |
| 4th+ offense | CAPITAL OFFENSE — automatic |
Just tell your AI:
"Add a rule: never use console.log in production"
"NEVER do X again!" → Capital Offense (tier 4)
"This is a rule now" → Auto-assessed tier
# Initialize rules in a project
~/.claude/skills/agentrules/scripts/init-rules.sh
# Add a rule
~/.claude/skills/agentrules/scripts/add-rule.sh project 1 code-quality "No console.log" "console.log in production" "Remove and replace with logging"
# List all rules
~/.claude/skills/agentrules/scripts/list-rules.sh
# Check if action violates rules
~/.claude/skills/agentrules/scripts/check-rule.sh "console.log('debug')"| Scope | Location | Purpose |
|---|---|---|
| Global | ~/.config/agentrules/RULES.md |
Applies to ALL projects |
| Project | ./RULES.md (project root) |
Project-specific rules |
Both scopes are enforced. Project rules can add to (never contradict) global rules.
- User adds rule with natural language or CLI
- AI assesses severity based on user's emotional state
- Rule is recorded in appropriate RULES.md file
- AI enforces rules before every action
- Violations escalate — repeat offenses increase tier
- Capital Offense = permanent hard block, no exceptions
User: "Don't use var, use const or let"
AI: Rule P-1 added. Crime Tier: 1 (Infraction).
[Later, AI accidentally uses var]
AI: ⚠️ Rule P-1 triggered. Switching to const/let.
[AI uses var again]
AI: 🟡 Rule P-1 — 2nd offense. Misdemeanor. Apologies, I should have learned.
[AI uses var AGAIN]
AI: 🔴 Rule P-1 — 3rd offense. Felony. Halting. Reviewing all variable declarations.
[AI uses var YET AGAIN]
AI: ☠️ Rule P-1 escalated to CAPITAL OFFENSE. var is now permanently blocked.
~/.claude/skills/agentrules/
├── SKILL.md # Skill definition
├── RULES.template.md # Template for project RULES.md
├── LICENSE # MIT License
└── scripts/
├── add-rule.sh # Add rules with crime tier classification
├── list-rules.sh # List all rules across scopes
├── check-rule.sh # Check if action violates rules
└── init-rules.sh # Initialize project RULES.md
~/.config/agentrules/
└── RULES.md # Global rules (apply everywhere)
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Remember: The AI shows no mercy to itself. When a rule exists, it is absolute.