Skip to main content

AI Govern

"AI Govern verifies that your AI system is engineered correctly — not that your application code is written correctly."

PyPI version Python 3.12+ License: MIT

AI Govern is a CLI-first AI Governance platform that audits AI-enabled repositories for AI engineering best practices. Think of it as ESLint + Lighthouse + SonarQube — but exclusively for AI systems.


What It Does

AI Govern scans only the AI layer of your repository:

✅ Analyzes — CLAUDE.md, AGENTS.md, GEMINI.md, Cursor rules, Copilot instructions, prompt templates, skill definitions, agent workflows, MCP servers, tool definitions, LLM configurations, RAG configs, memory strategies

❌ Ignores — CRUD endpoints, React components, CSS, database schemas, authentication, general business logic


Installation

pip install ai-govern

Quick Start

# Scan current directory and open dashboard
ai-govern run

# Scan a specific repository
ai-govern run /path/to/your/ai-repo

# Generate standalone HTML report
ai-govern report

# Auto-fix issues interactively
ai-govern fix

# CI mode (returns exit code 1 if score below threshold)
ai-govern run --ci --output json

# Initialize configuration
ai-govern init

# List all governance rules
ai-govern plugins

Dashboard

Running ai-govern run launches a local dashboard at http://localhost:5172:

  • Overview — Governance score, issue summary, category breakdown
  • Issue Explorer — Searchable, filterable issue list with full details
  • Context Analysis — Quality analysis of CLAUDE.md, AGENTS.md, etc.
  • Automation Opportunities — Where AI is over-engineered (use deterministic code instead)
  • Security — Hardcoded secrets, prompt injection risks
  • Cost Optimization — Caching gaps, token limit issues, model selection
  • Observability — Missing telemetry, token logging, latency tracking
  • Agents — Agent definition quality, circular workflows
  • Auto-Fix Panel — Preview diffs, approve/reject, rollback

Governance Categories

Category Weight Example Rules
Security 20% Hardcoded API keys, prompt injection
Context 15% Missing CLAUDE.md, poor context quality
Prompt Engineering 15% Missing system prompt, duplicate prompts
Cost Optimization 10% No caching, no token limits
Agents 10% Missing descriptions, circular workflows
Observability 8% No telemetry, no token tracking
Documentation 7% Missing skill docs, no README AI section
RAG 5% No chunking strategy, no embedding model spec
Memory 4% No memory strategy, unbounded history
Tools/MCP 3% Missing tool descriptions, insecure transport
Model Governance 3% Unpinned model versions
Automation 1% LLM used for UUID/JSON/date formatting

Configuration

Create ai-govern.yaml in your repository root:

# Governance Policy
min_governance_score: 70.0
fail_on_critical: true

# Disable specific rules
disabled_rules:
  - PE001  # Hardcoded prompts (if you prefer inline prompts)

# LLM Analysis (optional)
llm:
  enabled: false
  provider: openai
  model: gpt-4o-mini
  api_key_env: OPENAI_API_KEY

# Dashboard
dashboard_port: 5172
auto_open_browser: true

Run ai-govern init to generate this file automatically.


CI/CD Integration

# .github/workflows/ai-governance.yml
- name: AI Governance Check
  run: |
    pip install ai-govern
    ai-govern run --ci --output sarif
  
- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: ai-govern-report.sarif

Plugin SDK

Write custom governance rules:

from ai_govern.plugins.sdk import GovernanceRule, RuleCategory, Severity, ScanContext, GovernanceIssue

class MyCustomRule(GovernanceRule):
    rule_id = "CUSTOM001"
    name = "My Custom Rule"
    category = RuleCategory.AGENTS
    severity = Severity.MEDIUM
    
    def evaluate(self, context: ScanContext) -> list[GovernanceIssue]:
        # Your rule logic here
        return []

Register in pyproject.toml:

[project.entry-points."ai_govern.rules"]
my_rule = "my_plugin.rules:MyCustomRule"

Architecture

ai-govern run
     │
     ├── FileScanner (AI-only file discovery)
     │       └── AI relevance filtering (50+ patterns)
     │
     ├── RuleEngine
     │       ├── RuleRegistry (built-in + plugins via entry_points)
     │       ├── RuleExecutor (concurrent, thread-pool)
     │       └── Scorer (weighted category scoring)
     │
     ├── AutoFixEngine (propose → preview → approve → apply → rollback)
     │
     └── FastAPI Server
             ├── API v1 (scan, issues, fixes, plugins, config)
             └── React Dashboard (pre-built, served as static files)

License

MIT License — see LICENSE for details.

Metadata

Release files for ai-govern 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-govern 0.1.0
File Size Uploaded Provenance
ai_govern-0.1.0.tar.gz 314.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-govern 0.1.0
File Interpreter ABI Platform
ai_govern-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 606.0 kB

Release files / ai_govern-0.1.0.tar.gz

Download URL ai_govern-0.1.0.tar.gz
Size 314.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9c09a4736c9d77712d501710a173023289ffece4e3e0cc5594af887cedbbb1de
BLAKE2b-256 checksum
How to use checksums
167df3b0c913b44f95be70fbeb99dba34b2e053538ea7925dc631c52b78ecaa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / ai_govern-0.1.0-py3-none-any.whl

Download URL ai_govern-0.1.0-py3-none-any.whl
Size 291.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61e8880ee2bbbde556edd7681c4cb846ed963ec6c12ddc750e6621befe02b690
BLAKE2b-256 checksum
How to use checksums
e7513bf6765e294ef32bbf0bf583d73a42843053985e7f42b854f8d448f89d94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for ai-govern 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page