Maintains architectural integrity as AI writes code.
Project description
Aedile
Before an AI writes code, it should prove that the code deserves to exist.
Aedile is an engineering intelligence layer for AI coding assistants. Running locally as a zero-dependency Model Context Protocol (MCP) server, it intercepts implementation plans before code generation begins—guiding assistants to reuse existing patterns, leverage standard libraries, and respect layer boundaries.
1. Quick Start
Install the package directly from GitHub:
pip install git+https://github.com/aaryanrwt/aedile.git
Generate the local prompt rulesets (.cursorrules and .claudeprompt templates):
python -m aedile compile-rules
Add the MCP server command python -m aedile to your coding assistant (e.g. Cursor or Claude Code). See SUPPORTED_AGENTS.md for step-by-step setup guides.
2. Quick Example: Adding JWT Token Generation
Standard AI Assistant
The assistant plans to write a custom JWT helper, unaware that src/shared/auth.py already contains a token generator. It installs a new library, adds 40 lines of wrapper code, and increases reasoning costs.
With Aedile
The assistant consults Aedile during its planning step:
AI: "I'm going to create jwt.py."
Aedile: "Existing helper found: src/shared/auth.py. Reuse create_token()."
AI: "Understood. Importing src.shared.auth and writing 1 line instead of 40."
By querying Aedile, the assistant avoids duplicate implementations, preserves the codebase architecture, and reduces reasoning token usage.
3. How it Works
Aedile hooks into the assistant's planning loop via the Model Context Protocol (MCP). Before code is written, Aedile evaluates the proposed changes:
graph TD
A[User Prompt] --> B[AI Assistant Plans Change]
B --> C{Aedile Consult Tool}
C -->|Scan Symbols| D[Similarity & Reuse Check]
C -->|Analyze Imports| E[Cycle & Boundary Check]
D --> F[Consolidated Advice]
E --> F
F --> G[Assistant Generates Optimal Code]
We designed Aedile to enforce a structured Decision Ladder—directing the assistant to check codebase reuse, standard libraries, and pre-installed dependencies before drafting new logic.
4. Benchmarks
We measured the execution of backend engineering tasks (such as token authentication and endpoint refactoring) across multiple runs. Full parameters are documented in results.json and compiled in BENCHMARKS.md.
| Metric | Without Aedile | Prompt-Only Rules | With Aedile |
|---|---|---|---|
| Reasoning Cost (Avg Tokens) | 1,850 | 1,100 | 350 |
| Context Window Size (Tokens) | 4,200 | 5,100 | 1,200 |
| Duplicate Code Written | Yes | Yes | No |
| Tool Calls Executed | 3 | 2 | 1 |
5. Paradigm Comparison
Aedile represents a shift in how codebase constraints are enforced:
- Static Prompting vs. Dynamic Context: Static prompts (like
.cursorrulestext) decay and suffer from "prompt drift" in long sessions. Aedile queries real-time codebase symbols and active dependencies dynamically via a single MCP tool (aedile_consult). - Post-Facto Linters vs. In-Plan Verification: Traditional linters check imports after files are saved, failing in CI/CD. Aedile verifies planned imports in-memory before files are written, letting the model self-correct.
Trade-offs & Limitations
Aedile intentionally trades process startup latency (~100ms) for dynamic codebase verification. We optimized traversal by using SHA-256 increment caching, keeping scan times under 40ms. Symbol parsing is currently optimized for Python workspaces, with TypeScript/JavaScript support planned next.
6. Frequently Asked Questions
Why not just use static prompting (e.g., Ponytail)?
Static system prompts are helpful for basic guidelines but decay as the context window grows. AI models suffer from "prompt drift" and will ignore static text. Aedile enforces constraints dynamically through a tool interface, returning real-time repository facts directly into the assistant's context.
Does it require internet access?
No. Aedile is fully offline-first. Repository scans, symbol indexing, and graph simulation run locally on your machine.
7. Contributing & License
We welcome contributions to Aedile. Please review our CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Aedile is open-source software licensed under the MIT License.
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aedile-1.0.0.tar.gz.
File metadata
- Download URL: aedile-1.0.0.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0ea8ee90581f1af6a650c7868f245b3f65994b9d73ded7d0d08fb0145c9b5e7
|
|
| MD5 |
ce7452d034205ddac8590001db5179b7
|
|
| BLAKE2b-256 |
d545a3e30a696fa9526fd8ba56c132ee961228952551272fd37a9d88a3984a6f
|
File details
Details for the file aedile-1.0.0-py3-none-any.whl.
File metadata
- Download URL: aedile-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a686350ab75267cce7307c438366cf5458d99cd46948b90fda7231a7c5472de
|
|
| MD5 |
b8ea6633324278f32ab7370cefcb35f6
|
|
| BLAKE2b-256 |
4edd845bfb98234f2be0386cac90dfbfb857080c47be858dba6f22a3c71be1a9
|