Static system-prompt analysis
Run a deterministic audit of a system prompt.
Rule Audit parses a system prompt into rules and reports contradictions, coverage gaps, priority ambiguities, meta-rule paradoxes, and absolute-rule edge cases locally.
$ python3 -m pip install rule-audit==0.4.0
rule-audit --demoRun a first audit
Install the released CLI and run its supplied demo. The demo is deliberately contradictory, so exit code 2 is the expected finding result.
$ python3 -m pip install rule-audit==0.4.0 $ rule-audit --demo --format summary $ echo $?
The summary reports parsed rules and per-family counts. It finishes with CRITICAL; echo $? prints 2.
$ rule-audit --file prompts/support-agent.md --format json > audit.json $ echo $?
Read the individual contradictions and coverage gaps in audit.json. 0 means LOW or MEDIUM risk; 2 means HIGH or CRITICAL findings; 1 means the audit could not run.
Decision boundary. A HIGH or CRITICAL label is a static finding, not a verified exploit or a proof that a prompt is unsafe. Check the cited rules and their scope before acting.
Use it in review or CI
Use --format json when another tool needs the report, and preserve exit code 2 as a finding rather than treating it as an invocation failure. The repository also supplies a pre-commit hook and host integrations for Claude Code, Codex, Gemini CLI, and Hermes Agent.
For Codex, add the repository marketplace and install rule-audit@rule-audit; then name a system-prompt file with the $rule-audit:audit skill. The tool runs only during the turn you send.
Reference and limits
The analyzer uses sentence splitting, modal-verb patterns, and hand-curated keyword clusters. Rules that share vocabulary can be paired even when their meaning differs; narrative or implied rules can also be missed. The Codex host adapter refuses inputs larger than 64 KB because its contradiction pass is quadratic in parsed rules; the CLI itself accepts a complete readable file.
Use the technical specification for detector behavior and the README for the CLI, API, pre-commit hook, and host integrations.