AI Rules: A Universal Taxonomy for AI Rules Governance
AI Rules defines a universal metamodel and taxonomy for describing project rules in a structured and machine-readable way. It is designed to work together with ai-rules-cli, which consumes these definitions to initialize, validate, and evolve project rule sets.
Overview
AI Rules provides a standard and consistent way to define, organize, and manage rules that govern behavior and development practices in software projects. This is especially valuable when working with AI assistants that need to understand and apply these rules consistently.
Metamodel
The system defines a complete metamodel that includes:
- CLI-guided composition: question tree that leads to rule selection
- Tag governance: prevents taxonomic jungle
- Compatibility and conflicts: management of requirements and conflicts between rules
- Audit: traceability with provenance information, last review, and owner
- Controlled evolution: SemVer along with maturity states
Taxonomy
Rules are described using fixed facets (enums) and optional labeled fields to ensure predictable composition and filtering.
Main Facets (Enums)
| Facet | Values |
|---|---|
| Category | code, foundation, framework, security, testing, architecture, … |
| Scope | global, repo, package, component, page, api, ci, cd |
| Language | typescript, javascript, html, css, python, go, … |
| Lifecycle | advisory, recommended, enforced |
| Maturity | draft, beta, stable, deprecated |
| Stability | experimental, evolving, locked |
| Audience | frontend, backend, fullstack, a11y, sec, devops, architect |
| Severity | info, low, medium, high, critical |
Relational Fields
requires[]: IDs of other required rulesconflicts[]: incompatible rulessupersedes[]: replaces old rulesbundles[]: logical groups (baseline/web)
Operational Fields
files: [“src/**/*.tsx”] - files to which the rule appliesenforcement: configuration of how it is applied (lint, ci, scaffold)order: application orderinputs: configurable rule options
Labeled Fields
topic:*→ thematic tags (topic:wcag22,topic:core-web-vitals)lint:*→ linting scope (lint:eslint-config)test:*→ testing scope (test:playwright)a11y:*,perf:*,sec:*→ accessibility, performance, security
Governance Rules
The system includes clear governance rules:
- Changes to vocabulary or enums require PR review by “Owners”
- Any new enum value → schema update + changelog entry
- Consistent rule naming using
domain.subdomain.slug
Rule ID Examples
foundation.baseline.weblanguage.typescript.strictframework.react.hooksperformance.core-web-vitalsaccessibility.wcag22.keyboardMetadata Schema (JSON Schema)
Rules conform to JSON Schema 2020-12. The schema file is mdc.schema.json, ensuring consistent validation and tools that can consume these definitions.
Rule Example (Frontmatter)
---id: typescript.conventions.guidelinestitle: "TypeScript Conventions Guidelines"category: languagelanguage: "typescript"frameworks: ["react", "astro"]tooling: ["eslint", "prettier"]maturity: stableseverity: lowenforcement: lint: warn ci: allow scaffold: nonetags: ["topic:typescript", "lint:typescript-eslint"]owner: "typescript-team@your-org.com"review: { lastReviewed: "2025-01-20", reviewCycleDays: 90 }---Integration with ai-rules-cli
The CLI uses metadata to:
- Filter rules by category, language, frameworks, and tools
- Resolve dependencies using the
requiresandconflictsfields - Generate bundles based on the
bundlesfield - Apply enforcement according to the
enforcementconfiguration - Order rules using the
orderfield for proper composition
Benefits
-
Consistency: By having a standardized system for defining rules, you can ensure that all projects follow the same conventions and best practices.
-
Scalability: The taxonomy and metadata system allows managing large rule sets without losing organization or clarity.
-
Traceability: Each rule includes information about its owner, last review, and review cycle, facilitating maintenance and auditing.
-
Controlled evolution: With SemVer and maturity states, you can manage rule evolution in a controlled and predictable way.
-
Tool integration: Being machine-readable, tools can consume these definitions to automatically apply rules in linting, CI/CD, and scaffolding.
Contributing
The project accepts contributions following these guidelines:
- PRs are welcome, but must follow the defined schema
- Each rule must include complete metadata and tags
- Review cycle is applied via
review.lastReviewed
Use Cases
-
Project initialization: When starting a new project, you can use ai-rules-cli to automatically select and apply an appropriate rule set based on the technology stack.
-
Team standardization: Teams can define shared rules that ensure consistency across all team or organization projects.
-
Migration and updates: The versioning system and maturity states facilitate rule migration between projects and gradual practice updates.