enforce_architecture_rules
Enforces architectural boundary rules by validating import graph compliance, preventing layer violations and architectural erosion in CI/CD pipelines.
Instructions
Enforces architectural boundary rules and layer isolation constraints defined in tzero.rules.json across the repository AST, distinguishing from 'manage_architecture_rules' and 'analyze_code_dependencies' by validating import graph compliance against defined architectural layers rather than editing rule definitions or tracing raw calls.
Parameters:
project_root(str, optional, default='.'): Root directory of the repository to validate (default: current directory).strict_mode(bool, optional, default=True): When True, fails on any boundary infraction; when False, warns without raising errors.
Behavior:
Read-only: Scans codebase imports and call paths; does not alter files.
Idempotent: Deterministic violation reporting for identical codebase states.
100% Offline: Local import graph validation against configured boundaries.
Auth & Rate Limits: Zero authentication or API keys required; completes in <500ms.
Error Handling: Reports missing configuration and lists passed vs violated rules clearly.
Usage Guidelines:
When to use: Run in CI/CD pipelines or before merging PRs to prevent architectural erosion (e.g. presentation layer importing database models or circular module dependencies).
When NOT to use: Do not use for creating, viewing, or editing architectural boundary definitions (use 'manage_architecture_rules' instead); do not use for inspecting general dependencies between modules (use 'analyze_code_dependencies' instead).
Returns: Detailed compliance audit report listing passed layer boundaries, identified architectural violations, and remediation guidance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| strict_mode | No | When True, fails on any boundary infraction; when False, warns without raising errors. | |
| project_root | No | Root directory of the repository to validate (default: current directory). | . |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |