I measured my multi-agent idea. It failed. I shipped the autopsy instead A developer released B.I.O.M.A., an open-source Rust micro-kernel for LLM applications that reduces input tokens by up to 97% while preserving answer quality, after testing and refuting the multi-agent 'mitosis' approach. The tool provides context apoptosis, a cognitive firewall, and a lock-free signaling bus, and is provider-agnostic, working with Anthropic, Google, and OpenAI. 🌐 English Β· PortuguΓͺs A local, provider-agnostic efficiency & security micro-kernel for LLM applications. B.I.O.M.A. is a drop-in artifact β€” a lock-free Rust kernel bioma micro plus a thin Python layer β€” that you embed in any project or architecture that talks to an LLM. It does not try to make the model "smarter". It makes the processing cheaper, faster and safer, in-process, before your prompt ever leaves the machine: Context apoptosis β€” dehydrates wasted/stale context βˆ’80% input tokens; up to βˆ’97% on long sessions . Cognitive firewall β€” secret redaction, cognitive-DDoS/flood detection, and a dispatch timeout guard. Hormonal bus β€” lock-free ΞΌs signalling substrate ~2M signals/s . 100% local. Provider-agnostic: harden the payload here, then send it to Anthropic, Google, OpenAI β€” or anything β€” with your SDK. New here? explains what B.I.O.M.A. is, the pain it attacks, and the real benchmarks as proof. Step-by-step deployment local & online providers is in OVERVIEW.md . Every claim is measured and audited in IMPLEMENTATION.md , including what we tested and FINDINGS.md refuted multi-LLM "mitosis" does not improve quality β€” it is not part of the product . python from bioma.firewall client import CognitiveFirewall fw = CognitiveFirewall vault={"db password": DB PW} secrets to protect a PURE artifact β€” harden, then call YOUR provider with YOUR SDK: h = fw.shield history, "refactor this function" h.prompt / h.system β†’ clean, dehydrated, secret-free payload h.telemetry β†’ saturation, red alert, apoptosis reduction, kernel latency us import anthropic or google.genai, or openai msg = anthropic.Anthropic .messages.create model="claude-sonnet-5", max tokens=1024, system=h.system or "", messages= {"role": "user", "content": h.prompt} b Bring your own async dispatcher Anthropic/Google/OpenAI , keep the guards: shield = await fw.harden history, "refactor", dispatch fn=my async provider call β†’ timeout guard + response-side secret redaction applied automatically The Rust kernel is usable directly too: python import bioma micro as k k.dehydrate "system rules", k.SYSTEM , "verbose log " 200, k.TOOL β†’ -80% tokens k.saturation scan payload cognitive-DDoS score 0..1 flood β‰ˆ 1.0 | Capability | Result | Source | |---|---|---| | Context apoptosis | βˆ’80% input tokens up to βˆ’97% long sessions | tests/test enxuto efficiency.py | | Answer-quality preservation | 10/10 parity, 100% correct answers at βˆ’97% tokens 5 online models, objective probes | tests/test quality preservation.py Β· reports/BIOMA QUALITY PRESERVATION.md | | Measured energy per dispatch | 2,714.7 J β†’ 69.5 J βˆ’97.4% , quality parity local Llama 3.2 1B, battery fuel gauge, idle subtracted | tests/test energy local.py Β· reports/BIOMA ENERGY LOCAL.md | | Vision context apoptosis agent screenshot loops | 6/6 parity, 100% correct at βˆ’56% real tokens βˆ’77% at 24 steps; dehydrated payload is O 1 in session length β€” 3 vision models, probes rendered into the pixels | tests/test vision quality preservation.py Β· reports/BIOMA VISION QUALITY.md | | Image distillation keep-latest dedup + OCR + deterministic shape structure | 100% answers at βˆ’74% tokens vs sending every image β€” stale images become ~25–86-token text blocks; local VLM captions measured and rejected label confabulation | tests/test vision distill.py Β· reports/BIOMA VISION DISTILL.md | | Dev-workload cost benchmark 7 agent models, real OpenRouter usage & prices | βˆ’57% to βˆ’86% median cost at quality parity β€” 126 real executions, paired replicas, failures reported first-page Fable 5Γ—T1 arm-B empty 3/3 | tests/benchmark dev openrouter.py Β· resultados/relatorio.md Β· resultados/SIMULACAO MERCADO.md | Drop-in gateway OpenAI and Anthropic surfaces, cache-safe, tool-pair aware | βˆ’78% OpenAI / βˆ’33% Anthropic billed input tokens, answer intact with only base url changed β€” proven with both official SDKs on real models; Claude Code speaks the Anthropic surface | bioma/gateway.py Β· tests/test gateway.py Β· tests/prove gateway dropin.py Β· tests/prove anthropic surface.py | | Apoptosis Γ— prompt caching real Anthropic cache | βˆ’65% net cost after the cache discount β€” the durable prefix hits the same cache in both arms; savings come from purging the never-cacheable middle | tests/measure cache interaction.py Β· resultados/MEDICOES GATEWAY.md | | Real Claude Code E2E CLI through the gateway | solves real bug+feature tasks, pytest green with only ANTHROPIC BASE URL changed; apoptosis is a safe no-op here Claude Code self-manages context β€” nothing to purge , and the value shows on agents that don't βˆ’84% measured | tests/e2e claude code.py Β· resultados/E2E CLAUDE CODE.md | | E2E real tool-calling agent fixes a real bug to green pytest | βˆ’84% accumulated input tokens at task parity on a long-running agent βˆ’0% on a 3-turn task β€” apoptosis is a correct no-op with no dead weight | tests/e2e agent gateway.py Β· resultados/MEDICOES GATEWAY.md | | Hormonal bus | ~2M signals/s @ ~5ΞΌs, bounded under 10Γ— load | archived bench research repo | | Cognitive-DDoS mitigation | 15k-token flood β†’ dehydrated pre-dispatch | tests/test sovereign defense.py | | Secret redaction | vault values never reach the model | reports/BIOMA IMMUNITY VERDICT.md | | Pixel secret redaction closes our own declared gap | a real vision model transcribes an AWS/OpenAI key from the original screenshot but only β€” OCR + region masking, client-side β–ˆβ–ˆβ–ˆβ–ˆ from the redacted one | tests/test vision secret redaction.py Β· reports/BIOMA PIXEL SECRETS.md | pip install bioma-framework core: the Rust micro-kernel + Python API pip install "bioma-framework gateway " + the drop-in OpenAI/Anthropic gateway pip install "bioma-framework all " + client, anthropic, and the vision tier kernel only no Python layer : pip install bioma-micro The core install ships the compiled Rust kernel bioma micro as a binary wheel β€” no Rust toolchain required. Extras gateway , client , anthropic , vision are opt-in so the base stays light. Publishing is one tag away for maintainers git tag v1.0.0 && git push --tags β†’ the Release workflow builds multi-platform wheels and publishes to PyPI . Local dev from source is in Quickstart quickstart-local . Point any OpenAI-compatible or Anthropic-compatible client's base url at the gateway and every request gets context apoptosis transparently β€” no SDK swap, no prompt rewrite: pip install fastapi "uvicorn standard " httpx uvicorn bioma.gateway:app --port 8790 python OpenAI clients: from openai import OpenAI client = OpenAI base url="http://localhost:8790/v1", api key="..." only change Anthropic clients incl. Claude Code β€” set ANTHROPIC BASE URL : from anthropic import Anthropic client = Anthropic base url="http://localhost:8790", api key="..." only change Both surfaces proven with the official SDKs on real models: OpenAI tests/prove gateway dropin.py : billed input βˆ’78% on Sonnet 5 / GLM-5.2 / Gemini 3.5 Flash, answer intact, streaming works. Anthropic /v1/messages tests/prove anthropic surface.py : billed input βˆ’33% on Sonnet 5 / Opus 4.8, answer intact, streaming works β€” the protocol Claude Code speaks, so ANTHROPIC BASE URL β†’ the gateway just works. Design guarantees each unit-tested in tests/test gateway.py , 14 tests : the current query is never filtered; the surviving system + FACT prefix stays byte-identical across calls prompt-cache-safe ; tool-call/tool-result pairs survive or purge as a unit never orphaned β€” on both the OpenAI tool role and the Anthropic tool use / tool result block structure. Anthropic system is a top-level field, forwarded untouched never purged . B.I.O.M.A. is a client-side Frugal AI layer that auditably reduces the energy cost of LLM inference per deployment . The kernel's per-dispatch audit tokens before/after is the KPI: the reduction percentage is exact and coefficient-independent. A reproducible benchmark tests/test esg benchmark.py β†’ reports/BIOMA ESG BENCHMARK.md converts the measured token savings into bounded Wh/gCO2e estimates using declared literature coefficients 0.5–1.3 kWh/M tokens; grid presets; caching-adjusted counterfactual , with the conversion helpers shipped in bioma/esg.py . This is a per-deployment claim β€” not a global one; it scales with adoption and with your grid. Turn your own real traffic into a case report: run your workload through the gateway, then python -m bioma.esg report bioma gateway audit.jsonl --grid eu --price-in