aicodesign (Python)
Provenance and review tracking for AI-generated code.
In fast-moving environments, using LLMs to generate code accelerates development, but it introduces varying levels of risk. aicodesign provides lightweight Python decorators to explicitly mark the review status and trust boundaries of AI-generated code running in production.
Installation
Using pip
pip install aicodesign
Using uv
uv add aicodesign
The Three Tiers of Trust
This library standardizes AI code into three distinct categories based on human verification:
1. @ai_draft (High Risk)
- Code Reviews: 0
- Test Reviews: 0
- Concept: The code and its tests were generated by an LLM and pushed without human review. It is a raw draft. Emits a runtime logger warning when executed by default; pass
show_warning=Falseto make it an empty metadata-only decorator like@ai_blackbox.
2. @ai_blackbox (Medium Risk)
- Code Reviews: 0
- Test Reviews: 1+ (Human Verified)
- Concept: The internal logic is unreviewed (a black box), but the code is bounded by strict, human-reviewed unit tests. We know what it does, even if we haven't audited how it does it.
3. @ai_co_signed (Lower Risk)
- Code Reviews: 1 (Human Verified)
- Test Reviews: 1+ (Human Verified)
- Concept: A human developer has reviewed the AI's logic and tests, officially putting their name on the line alongside the LLM. Requires a mandatory reviewer argument.
Usage Examples
from aicodesign import ai_draft, ai_blackbox, ai_co_signed
# Tier 3: Pure AI Draft
@ai_draft(ticket="HFT-101")
def calculate_momentum_alpha(prices):
# Unreviewed logic and tests
pass
# Suppress the runtime warning and avoid wrapping the function
@ai_draft(ticket="HFT-104", show_warning=False)
def calculate_reviewed_offline_metric(values):
pass
# Tier 2: AI Blackbox
@ai_blackbox(ticket="HFT-102", notes="Tests verify strict output boundaries")
def parse_exchange_feed(payload):
# Logic is unreviewed, but a human vetted the test harness
pass
# Tier 1: Co-Signed Code
@ai_co_signed(reviewer="alice.dev", ticket="HFT-103")
def update_order_book(book, new_orders):
# A human has audited the logic and tests
pass
Introspection
All decorators attach metadata to the functions, making it easy to build CI/CD guardrails or runtime telemetry to track AI code execution:
print(update_order_book.__ai_provenance__) # Output: "co_signed"
print(update_order_book.__ai_reviewer__) # Output: "alice.dev"
License
MIT
Metadata
Release files for aicodesign 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aicodesign-0.1.1.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aicodesign-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / aicodesign-0.1.1.tar.gz
| Download URL | aicodesign-0.1.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b60ddcff240dad3a5b8c0f55f6f4fea5c92aa4524e50e4bf9bf33983cc526d9
|
|
BLAKE2b-256 checksum How to use checksums |
456297a0fa2256c92903e1de49cec740b6b53dda5f5ed0e6dd047ae40fd064d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / aicodesign-0.1.1-py3-none-any.whl
| Download URL | aicodesign-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
caa212232e7354c71be220c824771350f4687a61d11a92cf112fb2eb30b9c59a
|
|
BLAKE2b-256 checksum How to use checksums |
6cd16d2b781b2d54fd8876039c6121106e6c057313d0c161f7a6ab84de80f542
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|