ai-rules  by fjb040911

AI code governance rules engine

Created 1 month ago
1,064 stars

Top 35.3% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

ai-rules is a governance framework designed to combat "Architectural Decay" in AI-driven development. It ensures AI coding agents (such as Cursor, Windsurf, and Copilot) adhere to project-specific boundaries, design patterns, and UI standards. This leads to more consistent AI-generated code from the outset, faster code reviews, and more stable audit and repair workflows.

How It Works

This CLI tool transforms project rules defined in Markdown into structured metadata. It packages engineering standards into local configuration files (.ai-rules.md, rules-config.json, config.json) to generate rule-aware audit and fix prompts for AI agents. This provides AI agents with a project-local operating contract before code reaches review gates, guiding AI development rather than solely protecting the merge boundary.

Quick Start & Requirements

Requires Node.js >= 18. Installation is performed globally via npm install -g ai-law. Key commands include ai-law init to initialize rules within a project, ai-law doctor to validate the setup, ai-law audit to generate prompts for AI analysis, and ai-law fix for generating repair prompts based on AI reports.

Highlighted Details

  • Comprehensive Rule Templates: Includes built-in coverage for Frontend (React, Vue), Python (FastAPI), and Java (Spring), addressing common anti-patterns like direct network calls from UI, XSS, eval(), weak hashing, and sensitive logging.
  • Project Layout Adaptability: Utilizes config.json with pathAliases to accommodate non-standard repository structures without modifying individual rules.
  • Hybrid Detection Strategy: Supports local evidence collection for regex, import/include, and minimal count rules, while AST and semantic rules remain AI-guided.
  • Configurable Governance: config.json allows defining thresholds for numeric limits (e.g., maxFunctionLines) and exceptions to suppress known-safe files per rule pattern during local evidence collection.

Maintenance & Community

Information regarding maintainers, community channels (e.g., Discord/Slack), or project health signals was not found in the provided README content.

Licensing & Compatibility

The license type and any compatibility notes for commercial use or closed-source linking were not specified in the provided README content.

Limitations & Caveats

ai-rules is not a full static analysis engine; AST and semantic rules are currently AI-guided. The CLI structures context and outputs, but the AI ultimately makes the final audit decision for these higher-level rules. Partial locale support exists for several languages, falling back to English for untranslated elements.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
1
Star History
1,334 stars in the last 30 days

Explore Similar Projects

Starred by Peter Norvig Peter Norvig(Author of "Artificial Intelligence: A Modern Approach"; Research Director at Google).

codev by cluesmith

0.8%
255
AI-powered OS for human-agent software co-development
Created 6 months ago
Updated 3 days ago
Feedback? Help us improve.