Metadata-Version: 2.5
Name: clm-kernel
Version: 0.0.11
Summary: Card Lifecycle Manager (CLM) Kernel — Sovereign Functional Agentic Operating System
Author: GovTech Digital Identity & Autonomous Systems
License: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Interpreters
Requires-Python: >=3.11
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: aiosqlite>=0.17.0
Requires-Dist: base58>=2.1.1
Requires-Dist: blake3>=0.4.0
Requires-Dist: chardet>=5.1.0
Requires-Dist: cryptography>=44.0.0
Requires-Dist: duckdb>=1.0.0
Requires-Dist: fastapi>=0.100.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: jsonschema>=4.26.0
Requires-Dist: mpmath>=1.3.0
Requires-Dist: networkx>=3.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: python-dateutil>=2.9.0
Requires-Dist: python-dotenv>=1.1.0
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: pyyaml>=6.0
Requires-Dist: reportlab>=4.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: result>=0.17.0
Requires-Dist: scipy>=1.14.0
Requires-Dist: sqlalchemy>=1.4.0
Requires-Dist: typing-extensions>=4.5.0
Requires-Dist: uvicorn>=0.20.0
Requires-Dist: websockets>=12.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: hatchling>=1.20.0; extra == 'dev'
Requires-Dist: hypothesis>=6.100.0; extra == 'dev'
Requires-Dist: mypy>=1.10.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Provides-Extra: native
Description-Content-Type: text/markdown

# clm-kernel

Card Lifecycle Manager (CLM) Kernel — Sovereign Functional Agentic Operating System.

`clm-kernel` is the foundational Python implementation of the Cubical Logic Model (CLM), providing a stratified **six-layer** architecture (`layer0` … `layer5`) for sovereign, functional, deterministically auditable agentic execution.

> **Layer model (DOC-02).** This package implements the six logical strata defined in
> [`docs/architecture/six_layers_architecture.md`](../../docs/architecture/six_layers_architecture.md)
> and [`docs/spec/20-architecture/system-architecture.md`](../../docs/spec/20-architecture/system-architecture.md).
> The authoritative stratum ↔ package mapping is
> [`docs/sprints/13_documentation-reconciliation/DOC-02-layer-model-reconciliation.md`](../../docs/sprints/13_documentation-reconciliation/DOC-02-layer-model-reconciliation.md).

## Architectural Layers

- **Layer 0: Stateless Kenotic Core (Microkernel)** (`clm/layer0/`)
  - Pure algebraic primitives, AST parsers, codecs, hashing, and static schemas
  - Content-addressable identity and MCard primitives
- **Layer 1: Colored Petri Net (CPN) Virtual Machine** (`clm/layer1/`)
  - Coloured Petri Net (CPN) virtual machine, token passing, transition firings
  - Incidence-matrix / Noetherian invariant solving; Baldwin operator algebra
- **Layer 2: Content-Addressable Storage (CAS) & Cordis Fiber Substrate** (`clm/layer2/`)
  - Tri-Database storage, CAS/Merkle substrate, Cordis spatiotemporal fibers
  - Effect isolation, savepoints (`SavepointGuard`), and cleanup scopes
- **Layer 3: Distributed Network Gateway & Multi-Agent Coordination** (`clm/layer3/`)
  - Reticulum mesh transport/discovery, Satori speech-act protocol, handle routing
- **Layer 4: Human Interaction Surface & Conversational Programming** (`clm/layer4/`)
  - Conversational gateways, presentation membranes, EOA sponsor signing, CLI (`clm`, `clmEval`)
- **Layer 5: System Orchestration, Evaluator Engine & Playbooks** (`clm/layer5/`)
  - Continuous-learning stratum ($\Gamma$), epistemic fitness ($\Delta E$), telemetry hooks

## Installation

```bash
pip install clm-kernel
```

## CLI Usage

```bash
# Display CLI help
clm --help

# Evaluate an action or workflow manifest
clm evaluate --file workflow.yaml

# Initialize TriDatabase storage
clm init-tridb --path ./data
```

## Python API Quick Start

```python
from clm.layer0.hash import prefixed_hash
from clm.layer0.mcard import MCardPayload, create_mcard, verify_mcard_integrity

# Construct a content-addressed MCard (BLAKE3) and verify its integrity
card = create_mcard(
    uri="mcard://example/greeting",
    payload=MCardPayload(kind="Text", value="payload data"),
    author="did:clm:example",
)

print(f"Content hash: {prefixed_hash(b'payload data')}")  # blake3:<hex>
print(f"Card hash:    {card.hash}")
assert verify_mcard_integrity(card)
```

## License

MIT License. See [LICENSE](https://github.com/xlp0/CLM/blob/main/LICENSE) for details.

## Monorepo & Documentation

Source code, formal proofs, and multi-language kernels (Rust, JavaScript/TypeScript, WASM) are maintained in the main [CLM Repository](https://github.com/xlp0/CLM).
