Skip to main content

clm-kernel (0.0.21, Python package clm)

clm-kernel (0.0.21, Python >=3.11) is the Python reference kernel of the Cubical Logic Model (CLM), implementing the six logical layers (clm.layer0 through clm.layer5) with optional PyO3 acceleration via clm_rust_core.

See docs/architecture/six_layers_architecture.md and docs/spec/20-architecture/system-architecture.md for the layer boundary specification.

Architectural layers

  • Layer 0 (clm/layer0/): MCard, PCard, VCard, BLAKE3 g_time provenance, RFC 8785 canonical JSON, TypedValue, and TypeLattice.
  • Layer 1 (clm/layer1/): TokenMCard, PlaceMCard, TransitionMCard, bitset PlaceTypeLattice, ColoredPetriVM, and formal verification witnesses.
  • Layer 2 (clm/layer2/): Unified storage backends, MCardCollection, MCardFileSystem, DirectoryManifest, ChunkManifest, PetriProcessPCard, SyncContract v1, Open Petri Pullback, and Cellular Sheaf Cohomology.
  • Layer 3 (clm/layer3/): Cordis Fiber isolation, Satori speech-act envelopes, and Reticulum / mDNS mesh transport.
  • Layer 4 (clm/layer4/): clm and clmEval CLIs, presentation membranes, ViewPlaceMCard, and Triad Gateway.
  • Layer 5 (clm/layer5/): EpistemicPlaceMCard, LearningTransitionPCard, epistemic fitness evaluation, and telemetry guards.

Installation

Requires Python 3.11+ (uv recommended for workspace development).

pip install clm-kernel

CLI usage

clm --help
clm evaluate --file assets/clm/manifests/example.yaml

Quick start

from clm.layer0.hash import prefixed_hash
from clm.layer0.mcard import MCardPayload, create_mcard, verify_mcard_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')}")
print(f"Card hash:    {card.hash}")
assert verify_mcard_integrity(card)

Contract parameters and generated vocabulary

Contract-owned values come from generated Layer 0 modules, not from literals in kernel code: clm.layer0.vocabulary, vocabulary_env, vocabulary_types, and vocabulary_identities hold URI schemes, handle prefixes, hash algorithms, environment names, type URIs, MIME types, DIDs, versions, and URLs; clm.layer0.signature_defaults holds default argument values; and clm.layer0.parameter_context holds the typed parameters. Each is generated from the CLM runtime contract and starts with an @generated by header.

ParameterContext is resolved once at a process entry, with precedence CLI over environment over a signed card override over the contract default. Environment names are CLM_ plus the upper-cased contract key, and a value outside its refinement raises ParameterBoundaryError (exit code 5):

from clm.layer0.parameter_context import ParameterBoundaryError, ParameterContext

context = ParameterContext.from_mapping(env={"CLM_SQLITE_BUSY_TIMEOUT_MS": "8000"})
assert context.sqlite_busy_timeout_ms == 8000
assert context.as_mapping()["text.encoding"] == "utf-8"

try:
    ParameterContext.from_mapping(env={"CLM_SQLITE_BUSY_TIMEOUT_MS": "1"})
except ParameterBoundaryError as error:
    print(error.exit_code)  # 5: below the contract range of 100..120000 ms

Model providers resolve in-process from the packaged type dictionary: clm.layer0.provider_profiles.provider_value("ollama", "base_url") returns the configured endpoint. clm.layer0.functional provides pure identity, compose, and pipe combinators with property-tested category laws.

License

MIT License. Source code, formal proofs, and TypeScript and Rust kernels live in the CLM repository.

Metadata

Release files for clm-kernel 0.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clm-kernel 0.0.21
File Size Uploaded Provenance Actions
clm_kernel-0.0.21.tar.gz 784.8 kB Without provenance Details for clm_kernel-0.0.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clm-kernel 0.0.21
File Interpreter ABI Platform Actions
clm_kernel-0.0.21-py3-none-any.whl Python 3 none any Details for clm_kernel-0.0.21-py3-none-any.whl

Total release size: 1.8 MB

Release files / clm_kernel-0.0.21.tar.gz

Download URL clm_kernel-0.0.21.tar.gz
Size 784.8 kB
Tags Source
SHA-256 checksum
How to use checksums
88c0f5eb5ac88ea3bb2c12088caa5766a5c545e7ab2c51a99f5ab01bf6ba89cd
BLAKE2b-256 checksum
How to use checksums
6d3ba5cedf0840a65b15243fa3990da85afee36bb4294b8d5ae9bdaf2375014f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / clm_kernel-0.0.21-py3-none-any.whl

Download URL clm_kernel-0.0.21-py3-none-any.whl
Size 965.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb1adf6eecd5571575149fc4c47ffc9eb1a3c01630fe235a6bd9df872f5cee95
BLAKE2b-256 checksum
How to use checksums
5ef8d16aba9d1e1088929c17e02d7cf41aebd63bea15372cd2047eb8a0aa72d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for clm-kernel 0.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page