Skip to main content

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=False to 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aicodesign-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aicodesign-0.1.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file aicodesign-0.1.1.tar.gz.

File metadata

  • Download URL: aicodesign-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aicodesign-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8b60ddcff240dad3a5b8c0f55f6f4fea5c92aa4524e50e4bf9bf33983cc526d9
MD5 d0673d29e69227e6811c4dc79d713ce7
BLAKE2b-256 456297a0fa2256c92903e1de49cec740b6b53dda5f5ed0e6dd047ae40fd064d4

See more details on using hashes here.

File details

Details for the file aicodesign-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aicodesign-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aicodesign-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 caa212232e7354c71be220c824771350f4687a61d11a92cf112fb2eb30b9c59a
MD5 a4e336cc1df1136bd54ee505b8d50c64
BLAKE2b-256 6cd16d2b781b2d54fd8876039c6121106e6c057313d0c161f7a6ab84de80f542

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page