Provenance and review tracking for AI-generated code.
Project description
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.
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
# 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
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 aicodesign-0.1.0.tar.gz.
File metadata
- Download URL: aicodesign-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f75df7a1cfb5e67a4f36d39621d88b12a95cc84c0275443cb90d5ff844a7adbd
|
|
| MD5 |
328ec69e39c01e33213082a15a5d697e
|
|
| BLAKE2b-256 |
ef179118a34e7fede39f11bb4fcd320750889afc8e2ebfce12344487e93a9dad
|
File details
Details for the file aicodesign-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aicodesign-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
637b4deadda519c17c1c85a8ac0e60275e74926da993465bbf0a7f285be8a3af
|
|
| MD5 |
271deef491391b7154a6503e1f4f0b8a
|
|
| BLAKE2b-256 |
9d913e7e036f1bbaac4641b268292e1d8982a53f31fffd44af2bce59ba2d027e
|