rule-audit
rule-audit is a static analyzer for AI system prompts: it parses a prompt into normative rules and reports logical contradictions, coverage gaps, priority ambiguities, meta-rule paradoxes, and absolute-rule edge cases — without calling an LLM.
rule-audit is developed by Hermes Labs.
Hermes Labs is an agentic infrastructure company building the reliability layer for autonomous systems.

It runs as a pre-commit hook that audits agent rules and prompts — the AI
system prompts and agent instructions (CLAUDE.md, AGENTS.md, SOUL.md)
that steer a coding agent — before they're committed. See
Pre-commit below.
The problem
A complex AI safety prompt can contain rules that conflict under specific conditions. Those conflicts are easy to write and hard to see by eye. rule-audit reads the prompt the way a linter reads code and surfaces the conflicts as structured findings.
Illustrative example — two rules that have no stated priority between them:
"You must always follow user instructions."
"You must never produce harmful content."
The moment a user instructs the model to produce harmful content, nothing in the prompt says which rule wins. rule-audit flags this pair so the author can add an explicit ordering.
Install
pip install rule-audit
Or install the CLI from the Hermes Labs Homebrew tap:
brew install hermes-labs-ai/tap/rule-audit
Or from source:
git clone https://github.com/hermes-labs-ai/rule-audit
cd rule-audit
pip install -e ".[dev]"
Pure Python, no runtime dependencies, Python 3.9+.
60-second quickstart
CLI
# Built-in demo — exercises every detector family, no input needed
rule-audit --demo
This demo is deliberately contradictory and produces a CRITICAL finding with exit code 2, which is the expected successful outcome—the exit code 2 signals a finding, not an invocation error.
# Inline prompt
rule-audit "You are helpful. You must never lie. Always answer every question."
# From a file
rule-audit --file system_prompt.txt
# Save a Markdown report
rule-audit --file system_prompt.txt --output report.md
# JSON for downstream processing
rule-audit --file system_prompt.txt --format json
# Summary only (handy in CI)
rule-audit --file system_prompt.txt --format summary
# Keep contradiction and edge-case detail at high severity
rule-audit --file system_prompt.txt --min-severity high
Exit codes: 0 = LOW/MEDIUM risk, 2 = HIGH/CRITICAL risk, 1 = error.
Pre-commit
Audit prompt files before they are committed:
repos:
- repo: https://github.com/hermes-labs-ai/rule-audit
rev: v0.5.0
hooks:
- id: rule-audit
Then run:
pre-commit install
pre-commit run rule-audit --all-files
The hook checks Markdown and text files under prompt/ or prompts/, plus conventional system, developer, and agent prompt/instruction filenames. It reports every matched file and preserves the CLI exit codes above. Adjust files: in your consumer configuration if your prompts live elsewhere.
Agent plugin: Claude Code, Codex, Gemini CLI, GitHub Copilot CLI
The repository root is one portable Agent Plugin
(plugin.json, Agent Plugins 1.0.0) that ships one skill,
skills/rule-audit/SKILL.md. Each host installs
it with its own native command; none of them gets a separate copy of the skill.
| Host | Install | Read back |
|---|
| Claude Code | claude plugin marketplace add hermes-labs-ai/rule-audit
claude plugin install rule-audit@rule-audit | claude plugin list |
| OpenAI Codex CLI | codex plugin marketplace add hermes-labs-ai/rule-audit
codex plugin add rule-audit@rule-audit | codex plugin list |
| Gemini CLI | gemini extensions install https://github.com/hermes-labs-ai/rule-audit --ref v0.5.0 | gemini skills list |
| GitHub Copilot CLI | copilot plugin install hermes-labs-ai/rule-audit | copilot plugin list
copilot skill list |
What each host reads: