Metadata-Version: 2.4
Name: agdr-aki
Version: 1.8.9
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Legal Industry
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Topic :: Security
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Logging
Classifier: Topic :: System :: Monitoring
Requires-Dist: pydantic>=2.0
License-File: LICENSE-APACHE
License-File: LICENSE-CC0
Summary: AgDR-AKI: Sub-microsecond AI accountability SDK. Court-admissible forensic records (PPP Triplet) with cryptographic proof for regulated AI (EU AI Act, Canada Evidence Act).
Keywords: ai-accountability,ai-governance,forensic-logging,deterministic-ai,eu-ai-act,canada-compliance,cryptographic-audit,ppp-triplet,court-admissible,provenance-place-purpose,zero-latency,kernel-inference,agdr,aki,rust-python
Home-Page: https://accountability.ai
Author-email: Genesis Glass Foundation <founding@accountability.ai>
License: Apache-2.0 OR CC0-1.0
Requires-Python: >=3.10, <3.15
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# AgDR-Phoenix [![Version](https://img.shields.io/crates/v/agdr-aki)](https://crates.io/crates/agdr-aki) [![PyPI](https://img.shields.io/pypi/v/agdr-aki)](https://pypi.org/project/agdr-aki/) [![CI](https://github.com/aiccountability-source/AgDR-Phoenix/actions/workflows/ci.yml/badge.svg)](https://github.com/aiccountability-source/AgDR-Phoenix/actions/workflows/ci.yml) [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://spdx.org/licenses/Apache-2.0) [![License: CC0 1.0](https://img.shields.io/badge/License-CC0_1.0-lightgrey.svg)](https://creativecommons.org/publicdomain/zero/1.0/) [![Runtime: Rust + PyO3](https://img.shields.io/badge/Runtime-Rust_%2B_PyO3-orange.svg)](https://pyo3.rs) [![Stewarded by GGF](https://img.shields.io/badge/Stewarded_by-Genesis_Glass_Foundation-4B0082.svg)](https://accountability.ai)

**Atomic Kernel Inference SDK for Phoenix v1.8.9**

Developed by the [Genesis Glass Foundation](https://accountability.ai) (Fondation Genèse Cristal), a federally incorporated Canadian not-for-profit. [founding@accountability.ai](mailto:founding@accountability.ai)

> "AgDR satisfies a CISO. AgDR satisfies a judge."

## What It Does

AgDR-Phoenix seals every AI decision at the exact moment it occurs. Each record carries a **PPP Triplet** (Provenance, Place, Purpose), a coherence score, a reputation scalar, and a **HumanDeltaChain** linking machine output to human oversight or escalation.

The result is a tamper-evident, court-admissible decision record with a clear chain of custody from the instant of inference. Zero-knowledge proofs allow selective disclosure to regulators and courts without exposing the underlying reasoning.

## Installation

**Python (PyPI)**

```bash
pip install agdr-aki
```

**Rust (crates.io)**

```bash
cargo add agdr-aki
```

**Build from Source**

```bash
pip install maturin[patchelf]
git clone https://github.com/aiccountability-source/AgDR-Phoenix
cd AgDR-Phoenix
maturin develop --release
```

## Quick Start

```python
from agdr_aki import AKIEngine, PPPTriplet, HumanDeltaChain

engine = AKIEngine("records.db")

ppp = PPPTriplet(
    provenance="Phoenix v1.8 ACME",
    place="Toronto CA PIPEDA",
    purpose="AgDR"
)

hdc = HumanDeltaChain(
    agent_decision_ref="aki_001",
    resolved=True,
    terminal_node="autonomous"
)

record = engine.capture(
    ctx={"claim": "CLM-12345"},
    prompt="Process claim #12345",
    reasoning_trace={"steps": ["analyze", "decide"]},
    output="Approve",
    ppp_triplet=ppp,
    human_delta_chain=hdc
)

print(record.id)
print("Coherence:", record.coherence_score)
print("Reputation:", record.reputation_scalar)
```

## Zero-Knowledge Proofs

AgDR-Phoenix supports lightweight on-demand zero-knowledge proofs on sealed records.

```python
zk_proof = record.generate_zk_proof(mode="full_validity")
court_pkg = record.to_court_package(include_zk_proof=True)
print(court_pkg)
```

**Properties**

- Proves the record is contemporaneous, tamper-evident, PPP-compliant, and correctly signed
- Reveals nothing about the original context, prompt, reasoning trace, or output
- Verification uses only the public Merkle root
- Designed for regulators and courts under PIPEDA and the Canada Evidence Act

## Core Concepts

| Concept | Description |
|---|---|
| **PPP Triplet** | Provenance, Place, Purpose immutable legal anchor recorded at inference time |
| **Atomic Kernel Inference (AKI)** | Sub-microsecond sealed decision capture at the exact moment of inference |
| **HumanDeltaChain** | Required fiduciary link tracking human oversight or escalation and enforced at API level |
| **Coherence Score** | Normalized cosine similarity against the agent's historical spine (0.0 - 1.0) |
| **Reputation Scalar** | Exponentially weighted moving average of past coherence, provides a longitudinal reliability signal |
| **Sealed Record** | Tamper-evident post-encryption object with BLAKE3 hash and Ed25519 signature |
| **Zero-Knowledge Proof** | Selective disclosure of record integrity without revealing decision content |

## Evidentiary Architecture

| Layer | Implementation |
|---|---|
| Hashing | BLAKE3 |
| Signing | Ed25519 (downstream of AKI hot path) |
| Chaining | Forward-secret Merkle tree |
| Persistence | Write-Ahead Log (WAL) |
| Degradation | Limitations Act 2002 (Ontario): 2-year basic, 15-year ultimate |
| Admissibility | Canada Evidence Act, portable to EU AI Act (August 2026) |
| Privacy | Zero-knowledge proof layer for selective disclosure |

## Distinction from Structural Monitoring

AgDR captures **semantic decision provenance**: what the agent decided, why, under what authority, and with what confidence, sealed at the moment of inference.

Structural container monitoring (e.g., the AGA standard) records whether the system was running correctly. AgDR records what the system actually decided. Both serve different functions in an AI governance stack.

## Specification and Standards

| Resource | Reference |
|---|---|
| Reasoning Capture Methodology v1.0 | ISBN 978-1-7389042-1-1 |
| Library and Archives Canada | Deposited under CC-BY 4.0 |
| Steward | Genesis Glass Foundation, federally incorporated, royalty-free anchor in articles of incorporation |

## License

Dual-licensed under [Apache 2.0](https://spdx.org/licenses/Apache-2.0) OR [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/).

The AgDR open standard is stewarded by the [Genesis Glass Foundation](https://accountability.ai) (Fondation Genèse Cristal), a federally incorporated Canadian not-for-profit. The royalty-free grant is anchored in the Foundation's articles of incorporation.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md). All contributions are welcome. The standard is open.

## Contact

**Genesis Glass Foundation**

[founding@accountability.ai](mailto:founding@accountability.ai)

[https://accountability.ai](https://accountability.ai)

## Resources

- [AgDR Specification](https://accountability.ai/agdr-spec)
- [AKI Formal Definition](https://accountability.ai/aki-formal-definition)
- [Human Delta Chain Spec](https://accountability.ai/human-delta-chain-spec)
- [Technical Details](https://accountability.ai/technical-details)
- [PPP Pillars](https://accountability.ai/ppp-pillars)
- [Changelog](https://accountability.ai/CHANGELOG)
- [Contributing Guide](https://accountability.ai/CONTRIBUTING)
- [Rust API Documentation](https://docs.rs/agdr-aki)
- [PyPI Package](https://pypi.org/project/agdr-aki/)
- [Crates.io Registry](https://crates.io/crates/agdr-aki)

