Skip to main content

Aedile Mascot Logo

Aedile

Before an AI writes code, it should prove that the code deserves to exist.

CI PyPI Version Downloads Python 3.15 Code Style: Ruff Type Checked: mypy License: MIT

Aedile is a zero-dependency engineering intelligence layer for AI coding assistants. Before a single line of code is written, it parses your repository into an AST and Tarjan dependency graph—surfacing existing helpers, preferring the standard library, blocking circular imports and layer violations, and keeping generated diffs minimal on your own machine.


flowchart TD
    A(["Coding Agent<br/><i>Claude Code · Cursor · Codex · Windsurf</i>"]) -->|"Proposed plan: Build auth helper"| B{"Aedile MCP<br/><i>12 local tools</i>"}
    B --> C["BM25 + AST Symbol Reuse<br/><i>aedile_consult · aedile_map</i>"]
    B --> D["Stdlib & Declared Deps<br/><i>tomllib · pyproject.toml</i>"]
    B --> E["Tarjan Cycle & Layer Gate<br/><i>PEP 810 lazy · add / modify / delete</i>"]
    B --> F["Output Compression & Hotspots<br/><i>aedile_compress · recall · cProfile</i>"]
    C --> G(["Verified, Minimal Implementation"])
    D --> G
    E --> G
    F --> G

Why Aedile?

Modern coding assistants know how to write code. They usually don't know your architecture.

Static prompt rules drift as the context window fills, and regex-only maps miss nested definitions, import graphs, and layer boundaries. That leads to:

  • duplicated utilities (15–30 lines rewritten when 1–5 lines would reuse existing code)
  • unnecessary third-party dependencies
  • circular imports and broken layer boundaries
  • dangling imports when modules are deleted

Aedile verifies the repository deterministically before code is generated, giving coding assistants real AST and graph facts instead of relying on prompts alone.


Quick Example

Without Aedile

AI: "I'll write a custom TOML dependency parser and a new cache class."
↓
Repository already has tomllib and ScanCache.
↓
29 lines of duplicated code.

With Aedile

Aedile [Observed: AST/Graph]:
  "Reuse ScanCache in src/aedile/infrastructure/cache.py and stdlib tomllib."
  "ARCHITECTURAL VIOLATION: importing cli from shared violates layer order."
↓
AI reuses existing abstractions in 9 lines with zero violations.

Install & Setup

pip install aedile

Configure MCP servers and SessionStart / SubagentStart hooks automatically (creates .aedile.bak backups):

aedile setup

Check your environment, toolchain, and agent registrations:

aedile doctor

See SUPPORTED_AGENTS.md for manual Claude Code, Cursor, Windsurf, Copilot, and Gemini CLI setup.


Commands & MCP Tools

CLI Command MCP Tool What it does
aedile aedile_consult Consult reuse, stdlib, declared deps, and pre-edit verification
— aedile_verify_architecture Simulate add / modify / delete changes before writing files
aedile map aedile_map Emit token-budgeted AST symbol & layer map
aedile graph aedile_graph Export Mermaid, SVG, GraphML, or Cypher graphs + blast radius
aedile explain <mod> aedile_explain Inspect a module's imports, dependents, instability, and blast radius
aedile path <a> <b> aedile_path Shortest dependency path with EXTRACTED / LAZY hop provenance
aedile insights aedile_insights Surface god_nodes, subsystem communities, bridges, and questions
aedile review aedile_review Caller-aware diff review ranked Must / Should / Nice to have
aedile audit aedile_audit Whole-repo ranked audit combining rules, hubs, and debt
aedile debt aedile_debt Harvest # shortcut: / # aedile-waive: debt ledger
aedile hotspots <py> aedile_hotspots cProfile hotspot ranker with covered_by outermost-caller detection
aedile compress <cmd> aedile_compress Compress noisy pytest/git diff/ruff/mypy output + .aedile/recall/ recovery
aedile recall <id> / gain — Recover full raw failure logs and view cumulative token-savings telemetry
aedile check — CI gate (text, json, sarif, html, card) with --baseline
aedile mode / board / doctor — Intensity modes (lite|full|ultra|off), local telemetry board, and diagnostics

Benchmarks (Real Measured Runs)

All benchmarks were executed locally with zero fabricated numbers:

  1. 10-Task Bloat & LOC Test (qwen3:4b) — BLOAT_LOC_BENCHMARK.md:
    • Avg generated code dropped from 19.6 LOC (Without Aedile) to 9.9 LOC (With Aedile, -49.5% less code).
    • Codebase / stdlib reuse rose from 2/10 (20%) to 10/10 (100%).
  2. 12-Prompt Reuse & Architecture Suite (qwen3:4b) — BENCHMARKS.md:
    • Aedile vs. Ponytail (AGENTS.md + ponytail-map.js): 10/12 (83.3%) vs. 2/12 (16.7%) LLM hit rate, 11/12 (91.7%) vs. 0/12 deterministic tool catches, and lower avg prompt tokens (752.8 vs. 794.6).
  3. 10 Production Repositories (50k+ Stars Each) — MEGA_10_REPO_VALIDATION.md:
    • Validated across fastapi, flask, requests, yt-dlp, django, express, vite, nest, gin, and ripgrep (2,674 files, 5,367 edges): 915/923 (99.1%) checks passed.
  4. 100k+ Star Scale Benchmark — SCALE_100K_REPOS_ANALYSIS.md:
    • Measured across yt-dlp, ollama, deno, and react with 19.5x–91.5x warm-cache speedups (0.113s–1.095s warm scans).
  5. 55-Test Token Savings & Pre-Write Gate — TOKEN_SAVINGS_50_TESTS.md:
    • 62,429 / 82,411 (75.8%) CLI output tokens saved across 30 real pytest/git/ruff/mypy/aedile runs + 807,108 / 807,570 (99.9%) pre-write context tokens saved across 25 aedile_consult & verify checks.
  6. 4-Way Real LLM Comparison (qwen3:4b: Aedile vs. RTK vs. Ponytail vs. Baseline) — FOUR_WAY_BENCHMARK.md:
    • 43,860 / 47,278 (92.8%) total tokens saved (169.7 avg prompt tokens vs. 7,479.7 baseline and 6,709.7 RTK) on the playable Tesla Roadster Skyline .exe demo (0.0268 ms/frame across 1,000 simulated frames).
  7. Core Test Suite: 1,073 passing tests in pytest (Python 3.15.2, ruff + mypy strict clean).

FAQ

Does Aedile require internet access or API keys? No. All AST parsing, graph simulation, profiling, caching, and telemetry stay 100% local.

Which languages and Python versions are supported? Python 3.15 (including PEP 810 lazy import cycle awareness) via stdlib ast, plus zero-dependency structural parsers for TypeScript, JavaScript, Go, and Rust.

How do I adopt Aedile on an existing repo without fixing old violations first? Run aedile check --update-baseline, then gate CI with aedile check --baseline so only new regressions fail the build.


Documentation


Contributing & License

Contributions are welcome. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.

Aedile is released under the MIT License.


Star History

Star History Chart

Metadata

Release files for aedile 1.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 aedile 1.1.0
File Size Uploaded Provenance Actions
aedile-1.1.0.tar.gz 61.2 kB Without provenance Details for aedile-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aedile 1.1.0
File Interpreter ABI Platform Actions
aedile-1.1.0-py3-none-any.whl Python 3 none any Details for aedile-1.1.0-py3-none-any.whl

Total release size: 138.0 kB

Release files / aedile-1.1.0.tar.gz

Download URL aedile-1.1.0.tar.gz
Size 61.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8e17104cff16c86e67e8463cd465a1fa42429032a7a2acd09a17ae5242b8b4b5
BLAKE2b-256 checksum
How to use checksums
11684c51bf18b0bc646541d48c0db58ab3a50408907ce94a71eb41c9eb2fd41e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / aedile-1.1.0-py3-none-any.whl

Download URL aedile-1.1.0-py3-none-any.whl
Size 76.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5b3a245d00a7c6be94a3d973961ae0556e19e24338f0de35a2acabdd8ffc09a
BLAKE2b-256 checksum
How to use checksums
8caafdaf88624518f40664d46c725ce3b9b0ca7ea4c857fd587a501c81e8b867
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for aedile 1.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

1.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