B.I.O.M.A. Micro-Kernel — lock-free hormonal bus + autonomous context apoptosis.
Project description
bioma-micro
B.I.O.M.A. Micro-Kernel — a lean efficiency & resilience core for LLM infrastructure, written in Rust, exposed to Python via PyO3.
Exactly two proven primitives, nothing else:
- Context apoptosis — autonomous history dehydration. Long agent sessions accumulate low-value ballast (verbose tool logs, stale turns). The kernel assigns each message a metabolic weight by class, applies half-life decay, and purges dead weight before the payload hits the API. Microsecond-scale, GIL-released, allocation-light.
- Hormonal bus — lock-free in-memory signal injection (~2M signals/s, ~5 µs).
Plus saturation_scan(), an O(n) repetition detector for cognitive-DDoS / flood inputs.
Install
pip install bioma-micro
Prebuilt wheel for Windows (Python ≥ 3.8, abi3). Other platforms build from the sdist
(requires a Rust toolchain: pip will invoke maturin automatically).
Quick start
import bioma_micro as bm
messages = [
("You are a precise operations copilot.", bm.SYSTEM), # never purged
("FACT: the deploy freeze ends on 2026-07-18.", bm.FACT), # never purged
("[tool log] 40 KB of verbose audit output ...", bm.TOOL), # prime target
("Round 1: any anomaly?", bm.USER),
("Nothing above baseline.", bm.ASSISTANT),
# ... hundreds of turns later ...
("What is the freeze end date?", bm.USER),
]
result = bm.dehydrate(messages, half_life=6.0, safe_threshold=0.35)
print(result["reduction"]) # fraction of input tokens purged (0..1)
print(result["kernel_latency_us"]) # pure-Rust decision pass, microseconds
prompt = "\n".join(result["kept"]) # dispatch this instead of the full history
Flood detection:
bm.saturation_scan(suspicious_text) # ~1.0 = repetitive flood, ~0.0 = natural text
The honest contract
Measured, auditable behavior (full methodology and raw data in the framework repo):
| Client behavior | Measured effect |
|---|---|
| Naive tool-calling agent (resends growing history) | −84% input tokens |
| Generic long session (16 rounds, resends everything) | −95.8% input tokens |
| Claude Code (already self-manages context) | ~0% — safe no-op |
- Values tagged
FACTand recent turns survive; answer quality stays at parity with the full-context baseline (verified with objective probes against real online models). - Durable info buried in old untagged turns is purged by design — tag it
FACT. - Against an already-lean agent the kernel is a no-op: it never helps, never hurts.
This is a safety net for agents that do not manage their own context — not a universal "−X%" claim.
API surface
| Symbol | Kind | Purpose |
|---|---|---|
dehydrate(messages, half_life=6.0, safe_threshold=0.35) |
function | one-shot history dehydration; returns kept blocks + audit dict |
saturation_scan(text, window=8) |
function | duplicate-shingle flood score (0..1) |
ContextApoptosis(half_life, safe_threshold, capacity) |
class | stateful incremental engine (insert / dehydrate / render) |
HormonalBus, HormonalSignal |
class | lock-free signal bus |
SYSTEM, USER, ASSISTANT, FACT, TOOL |
flags | metabolic signal classes |
License
FSL-1.1-MIT — Functional Source License 1.1 with MIT future license. Free for internal use, non-commercial use, and professional services; converts to MIT two years after each release.
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 Distributions
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 bioma_micro-1.0.1.tar.gz.
File metadata
- Download URL: bioma_micro-1.0.1.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aca8dc053115cf3a0edc026729750e3778ce01ca9ebc6200e2796ab897b2d51
|
|
| MD5 |
67033ce143adbe8121e6c70b90d0cb20
|
|
| BLAKE2b-256 |
7c18fbfab96513daa0a3c8af19cc635d94bbdcb4068a9b54705ac10a4ad68d5c
|
Provenance
The following attestation bundles were made for bioma_micro-1.0.1.tar.gz:
Publisher:
release.yml on jonathascordeiro20/bioma-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioma_micro-1.0.1.tar.gz -
Subject digest:
4aca8dc053115cf3a0edc026729750e3778ce01ca9ebc6200e2796ab897b2d51 - Sigstore transparency entry: 2187506504
- Sigstore integration time:
-
Permalink:
jonathascordeiro20/bioma-framework@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/jonathascordeiro20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bioma_micro-1.0.1-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: bioma_micro-1.0.1-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 177.0 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e27592f480c04d0e1425a9bc94b83f7cdc0f284f2a50ade46e6040700f21abe3
|
|
| MD5 |
c633ea5132dfe218f2b0fa5011281f0e
|
|
| BLAKE2b-256 |
92f26b6e1a0ad117c9ebf7090957405c63b475f53fd466bf8f78580872698295
|
Provenance
The following attestation bundles were made for bioma_micro-1.0.1-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on jonathascordeiro20/bioma-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioma_micro-1.0.1-cp38-abi3-win_amd64.whl -
Subject digest:
e27592f480c04d0e1425a9bc94b83f7cdc0f284f2a50ade46e6040700f21abe3 - Sigstore transparency entry: 2187506543
- Sigstore integration time:
-
Permalink:
jonathascordeiro20/bioma-framework@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/jonathascordeiro20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bioma_micro-1.0.1-cp38-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: bioma_micro-1.0.1-cp38-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 260.4 kB
- Tags: CPython 3.8+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f329cfba4f424c550ca1d8699eff8daebce0ad01f5c94dc13104af76543a3850
|
|
| MD5 |
d969162037d2634786678eb40c9c6c54
|
|
| BLAKE2b-256 |
855736699a6a732e5b484a9a4960f617f7e9d2576897e20f3cd6af9893dadde8
|
Provenance
The following attestation bundles were made for bioma_micro-1.0.1-cp38-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on jonathascordeiro20/bioma-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioma_micro-1.0.1-cp38-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
f329cfba4f424c550ca1d8699eff8daebce0ad01f5c94dc13104af76543a3850 - Sigstore transparency entry: 2187506525
- Sigstore integration time:
-
Permalink:
jonathascordeiro20/bioma-framework@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/jonathascordeiro20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bioma_micro-1.0.1-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: bioma_micro-1.0.1-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 238.5 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c6f65e2b043ae0a611e91d480ca44bc9028ad6f0a8d8cf0229156cecc4af4bf
|
|
| MD5 |
67749a00aff9ea7bdd0df7f06e9ba97d
|
|
| BLAKE2b-256 |
f0bd544572ba241e630f7097d420968af01de65e1076ab47f2942379a7aee04e
|
Provenance
The following attestation bundles were made for bioma_micro-1.0.1-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on jonathascordeiro20/bioma-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bioma_micro-1.0.1-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
1c6f65e2b043ae0a611e91d480ca44bc9028ad6f0a8d8cf0229156cecc4af4bf - Sigstore transparency entry: 2187506536
- Sigstore integration time:
-
Permalink:
jonathascordeiro20/bioma-framework@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/jonathascordeiro20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3c22a08ae35e77f0411465e5065f0e09450412e6 -
Trigger Event:
push
-
Statement type: