Skip to main content

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 FACT and 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


Download files

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

Source Distribution

bioma_micro-1.0.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distributions

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

bioma_micro-1.0.0-cp38-abi3-win_amd64.whl (169.9 kB view details)

Uploaded CPython 3.8+Windows x86-64

bioma_micro-1.0.0-cp38-abi3-manylinux_2_34_x86_64.whl (253.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.34+ x86-64

bioma_micro-1.0.0-cp38-abi3-macosx_11_0_arm64.whl (230.9 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file bioma_micro-1.0.0.tar.gz.

File metadata

  • Download URL: bioma_micro-1.0.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bioma_micro-1.0.0.tar.gz
Algorithm Hash digest
SHA256 da74f80d67a46c6c7d0fd036ae2eaa6f790312fdfa14a7ad824d0df94303274e
MD5 f1330e957a21b7925e90c378c9d1ccd4
BLAKE2b-256 94aaf1cde04e4dba7936ec2e5738e3ee05b71e540e9c3f933aa4dbd48f754bbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for bioma_micro-1.0.0.tar.gz:

Publisher: release.yml on jonathascordeiro20/bioma-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bioma_micro-1.0.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: bioma_micro-1.0.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 169.9 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

Hashes for bioma_micro-1.0.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 18051a6bbbb11c950e28d5289049b9dd5f9a0e31f9d98a673598769b733d7168
MD5 b3dbb51235288284a850fcf74ffb9067
BLAKE2b-256 0c8050e79c2bafac278fed953c3e00f0e901ad1c1bc196e7c352c68c2c6842fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for bioma_micro-1.0.0-cp38-abi3-win_amd64.whl:

Publisher: release.yml on jonathascordeiro20/bioma-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bioma_micro-1.0.0-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for bioma_micro-1.0.0-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4b041757cc7b3211eff7f1634126489e660127051bb03add0cc24d5d6281ad13
MD5 ad963bd7a6cdb8af3efb643662b8960d
BLAKE2b-256 ae85d27969d2a85ac9f571c73ae161465b2233cc0e5761c61caa36e97c091ec1

See more details on using hashes here.

Provenance

The following attestation bundles were made for bioma_micro-1.0.0-cp38-abi3-manylinux_2_34_x86_64.whl:

Publisher: release.yml on jonathascordeiro20/bioma-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bioma_micro-1.0.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bioma_micro-1.0.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3acd2f17818b3f3e7014574c3f889bfbc946a55f0b70f8856c6b0ca21bd2086
MD5 be69a428772b3e7e7128407bc2e53ab5
BLAKE2b-256 de8cf932cfe58f840c5cad09da0f2ac4ca2e9c900ecb4ffd8ef91fc865027797

See more details on using hashes here.

Provenance

The following attestation bundles were made for bioma_micro-1.0.0-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on jonathascordeiro20/bioma-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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