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"
cannot_depend_on = ["billing", "migrations"]
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 cannot_depend_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 corecannot_depend_on β this is a legitimate dependency if api owns the checkout flowsend_receipt into the payments module.
tach and import-linter are the established tools. Here's an honest comparison.
| code-governance | tach | import-linter | |
|---|---|---|---|
| Setup | --generate creates config from source | 50-100 lines TOML with regex | Manual contract definition |
| Monorepo support | β scans source directly | β scans source | Must be importable |
| Diff mode | β only check changed files | β | β |
| Baseline | β accept existing, fail on new | β | β |
| CI comments | β PR comments + fix suggestions | Exit code only | Exit code only |
| Auto-fix | β /governance fix | β | β |
| LLM advice | β architectural recommendations | β | β |
| Error guidance | LLM explains why + suggests fix | "cycle detected" β no context | Import chain shown, no fix |
| Module metrics | β cohesion, surface, symbol count | β | β |
| HTML report | β dependency matrix viewer | β | separate browser UI |
| Public interface enforcement | β | β visibility controls | β |
| Transitive imports | β transitive chains | direct only | β transitive chains |
| Speed (Django, 902 files) | ~1.2s | sub-second (Rust) | ~0.1s |
| Package needs installing | No β scans source directly | No β scans source | Yes β must be importable |
Choose tach if you need public interface enforcement or visibility controls. Choose code-governance for transitive chain detection, CI integration, auto-fix, LLM advice, and zero-config setup.
/governance fixto apply.