Define allowed dependencies between modules in a governance.toml. Run it locally, in CI, or let an LLM tell you what to fix.
One "quick" import across a module boundary becomes ten. Suddenly everything depends on everything. Tests break for no reason. Refactors are impossible.
Scans your source code, detects modules, and maps every real import.
governance-ast --generate --source-root src/
Review the generated governance.toml. Adjust boundaries to match your intended architecture.
[[modules]]
name = "api"
depends_on = ["core", "auth"]
Run locally or in CI. Violations fail the build. No more silent boundary erosion.
governance-ast
Add one GitHub Action. Get violation reports as PR comments with LLM-powered fix suggestions.
Reply /governance fix on the PR and the bot auto-updates your governance.toml with correct depends_on and commits to your branch.
Adopting on an existing codebase? Save a baseline and only fail on new violations:
Pass --advise and get architectural recommendations powered by OpenAI or Anthropic.
charge_customer() into a shared interface in coredepends_on β this is a legitimate dependency if api owns the checkout flowsend_receipt into the payments module.
import-linter is the established tool for this. Here's an honest comparison.
| code-governance | import-linter | |
|---|---|---|
| Setup | --generate creates config from source | Manual contract definition |
| Diff mode | β only check changed files | β |
| Baseline | β accept existing, fail on new | β |
| CI comments | β PR comments + fix suggestions | β |
| Auto-fix | β /governance fix | β |
| LLM advice | β architectural recommendations | β |
| Module metrics | β cohesion, surface, symbol count | β |
| HTML report | β dependency matrix viewer | separate browser UI |
| Transitive imports | direct only | β transitive chains |
| Forbidden contracts | β | β |
| Speed (Django, 902 files) | ~1.2s | ~0.1s |
| Package needs installing | No β scans source directly | Yes β must be importable |
Choose import-linter if you need transitive import detection. Choose code-governance if you want CI integration, auto-fix, LLM advice, or zero-config setup.
/governance fixto apply.