Skip to content

NotUnHackable/AgentRules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentRules

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.

Quick Install

curl -fsSL https://raw.githubusercontent.com/NotUnhackable/AgentRules/main/install.sh | bash

Or clone manually:

git clone https://github.com/NotUnhackable/AgentRules.git ~/.claude/skills/agentrules
chmod +x ~/.claude/skills/agentrules/scripts/*.sh

What It Does

AgentRules 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.

Crime Tiers

Tier Name User Signal AI Response
1 ⚠️ Infraction "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

Repeat Offense Escalation

Offense Count New Tier
1st offense Original tier
2nd offense Tier +1
3rd offense Tier +2 (minimum Felony)
4th+ offense CAPITAL OFFENSE — automatic

Usage

Add Rules (Natural Language)

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

CLI Commands

# 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')"

Two Scopes

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.

How It Works

  1. User adds rule with natural language or CLI
  2. AI assesses severity based on user's emotional state
  3. Rule is recorded in appropriate RULES.md file
  4. AI enforces rules before every action
  5. Violations escalate — repeat offenses increase tier
  6. Capital Offense = permanent hard block, no exceptions

Example Scenario

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.

Files

~/.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)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Support


Remember: The AI shows no mercy to itself. When a rule exists, it is absolute.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages