Enforce Workspace Architectural Layer Rules
enforce_architecture_rulesValidates codebase import graphs against configured layer boundaries, flagging forbidden cross-layer imports and circular dependencies to block architectural erosion in CI and pre-commit checks.
Instructions
Validates codebase import graphs against architectural boundary rules defined in tzero.rules.json, distinguishing from 'manage_architecture_rules' and 'analyze_code_dependencies' by enforcing layer isolation compliance rather than configuring boundary definitions or tracing raw symbol calls.
Parameters:
project_root: Repository root directory to inspect; scans all source files against configured architectural rules.strict_mode: When True, treats any forbidden cross-layer import or circular dependency as a critical violation; when False, reports infractions as non-fatal warnings for exploratory audits.
Behavior:
Mutability: Strictly read-only; parses import statements across the workspace without altering any files or configurations.
Idempotency: Deterministic; identical codebase revisions produce identical violation reports.
Privacy & Network: 100% offline local AST parsing; zero cloud telemetry or external network calls.
Performance & Resources: Completes in <300ms for 1,000 modules using <40MB RAM; thread-safe with zero rate limits.
Auth: Zero authentication or cloud credentials required.
Return Structure: Emits structured Markdown compliance audit listing passed layers, detected boundary violations, and exact offending source lines.
Error Handling: If tzero.rules.json is missing, applies enterprise standard layer boundaries (presentation -> domain -> persistence) and warns the user.
Usage Guidelines:
When to use: Run in CI/CD pipelines, pre-commit hooks, or before merging pull requests to prevent architectural erosion, circular imports, and unauthorized layer coupling.
When NOT to use: Do not use for defining, editing, or deleting architectural boundary rules (use 'manage_architecture_rules' instead); do not use for extracting raw caller/callee trees (use 'analyze_code_dependencies' instead).
Returns: Detailed compliance audit report listing passed layer boundaries, identified architectural violations, and remediation guidance.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "enforce_architecture_rules"
}
}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 |