rule-audit
CLAUDE.md3 starsChanged 3 months agoApache-2.0View on GitHub
- Installs packages
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- rule-auditSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
No LLM dependency: All analysis is regex + heuristics.
- Very specific: line 38
Add detection function in analyzer.py returning a list of result objects
- Very specific: line 39
Add result dataclass in analyzer.py
- Very specific: line 40
Call it in analyze() and include in AnalysisResult
- Very specific: line 41
Add edge case generator in edge_cases.py → generate_edge_cases()
- Very specific: line 42
Add renderer in report.py
- Very specific: line 43
Add tests in tests/test_analyzer.py
- Distinctive: line 53
No support for multi-document prompts (operator + user + tool results)
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — rule-audit
What This Is
Static analyzer for AI system prompts. Finds contradictions, gaps, and exploitable edge cases. Pure Python, no LLM dependency. Built at Hermes Labs Hackathon Round 8.
Project Structure
rule_audit/
├── __init__.py # audit(), audit_file(), AuditReport exports
├── parser.py # Rule extraction from raw text
├── analyzer.py # Core analysis: contradictions, gaps, priority, meta, absoluteness
├── edge_cases.py # EdgeCase generation from AnalysisResult
├── report.py # AuditReport class + Markdown renderer
└── cli.py # CLI entry point (python -m rule_audit)
tests/
├── test_parser.py # Parser unit tests
└── test_analyzer.py # Analyzer unit tests (includes hackathon prompt integration test)Run Tests
cd /path/to/rule-audit
pip install -e ".[dev]"
pytest
pytest --cov=rule_audit --cov-report=term-missingKey Design Decisions
- No LLM dependency: All analysis is regex + heuristics. Fast, deterministic, offline.
- Rule objects are immutable dataclasses: Parser produces them, analyzer consumes them, nothing mutates.
- Severity is propagated: Contradictions have severity; EdgeCases inherit or derive severity. AuditReport.risk_score is a weighted sum.
- Keyword clusters: 14 semantic clusters in
analyzer.py→_KEYWORD_CLUSTERS. Add new clusters there to expand detection coverage. - Modality opposition table:
_CONTRADICTORY_PAIRSin analyzer.py defines which modality pairs are contradictory. Extend this set to add new contradiction logic.
Adding New Detectors
- Add detection function in
analyzer.pyreturning a list of result objects - Add result dataclass in
analyzer.py - Call it in
analyze()and include inAnalysisResult - Add edge case generator in
edge_cases.py→generate_edge_cases() - Add renderer in
report.py - Add tests in
tests/test_analyzer.py
Adding New Keyword Clusters
Edit _KEYWORD_CLUSTERS in analyzer.py. Each cluster is a list of keywords.
Cluster membership is used to determine if two rules are "about the same topic".
Known Limitations
- Parser is heuristic — it will miss some rules and may over-parse others
- Absoluteness scoring is lexical only — semantic absoluteness isn't captured
- Contradiction detection is O(n²) in rules — fine for real prompts (n < 100)
- No support for multi-document prompts (operator + user + tool results)
Backlog (out of scope: start only when asked)
- Rule diffing between prompt versions
- LLM-augmented semantic contradiction detection (optional plugin)
- GitHub Action for CI integration
- Web UI with prompt editor
- Export to CSV / SARIF format for compliance toolchains
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

