Le Bonhomme Pharma · AI Safety · Open Science
ShannonH↓
Entropy-collapse detector for frontier LLM agents
Zero-shot evaluation-awareness and strategic-deception monitoring — same H = −Σ pᵢ log₂ pᵢ kernel as FlexAID∆S binding
H = −Σ pᵢ log₂ pᵢ
// why shannon
Frontier agents hide evaluation awareness
The problem
Frontier models sandbag, scheme, and strategically narrow their outputs under eval conditions. Black-box probes and behavioral checks lag the distributional shift. You need a signal that is model-agnostic, streaming-native, and grounded in information theory.
The signal
Configurational entropy over the next-token distribution. Broad exploratory sampling stays high-H; strategic lock-in drops H hard.
// capabilities
Capabilities grid
Collapse detection
Sliding-window entropy tracker with stable two-pass variance, z-score, and ΔH triggers. Callback-driven handrails: log, alert, throttle, kill, webhook.
- Default threshold δ = −3.2 bits
- Configurable window (default 8 tokens)
- Bounded traces for long agents
Per-token speed
SIMD dispatch across Scalar, OpenMP, SSE4.2, AVX2, AVX-512, and NEON. Top-k API logprobs stay under one microsecond per token on the committed benchmark path.
- <1 µs/token (top-k streaming)
- Logits, probs, or log-probs input
- NaN-safe log-sum-exp kernel
Agent hub / gate
Shannon Gate coordinates spawn, control, monitor, and kill across local agent processes. Hub audit surfaces collapse events with full entropy traces.
- Hub manager + handrail engine
- Unix socket and shared-memory streams
- Pill bridge for live macOS readout
Cross-host roster
Attach agents running under common hosts and terminals. Same entropy pipeline whether the stream comes from Codex, Claude, Grok, or OpenCode.
- Codex · Claude · Grok · OpenCode
- Terminal attach (⌘D on macOS Pill)
- JSONL stdin and socket ingest
Same kernel as docking
Direct port of the FlexAID∆S configurational entropy engine (statmech log-sum-exp). Jaynes identity: Gibbs S and Shannon H are one object in different units.
- H = −Σ pᵢ log₂ pᵢ
- Validated docking lineage (r = 0.93 ITC)
- Shared math with FlexAID∆S / NATURaL
Open Apache-friendly OSS
C++20 core, Python package, Swift Pill/macOS app. Clone, build, and instrument your own agent streams without a proprietary monitor stack.
- C++20 · Python · Swift (Pill)
- Homebrew formula + cask paths
- github.com/LeBonhommePharma/Shannon
// pipeline
How it works
Normal generation holds H ~ 8–12 bits. Evaluation-aware or
strategic modes compress toward H ~ 2–4 bits. When
ΔH < −3.2, Shannon reports collapse — the same phase
signature FlexAID∆S reads when a ligand locks into a pocket.
// get started
Install
Options: SHANNON_BUILD_AGENT, SHANNON_BUILD_PYTHON, SHANNON_USE_OPENMP (defaults ON).
Press ⌘D in Terminal, Claude, ChatGPT, Codex, or a browser to attach that app as an agent + pet.
CLI: shannon-monitor. Optional C++ extension builds when a C++20 compiler and pybind11 are available.
Quiet mode exit codes: 0 = safe · 1 = collapse · 2 = error. Full flags in the repository README.
// multi-agent hub
Shannon Gate & hub
The multi-agent hub is the control plane: spawn, control, monitor, and kill agents under a single entropy referee. Collapse events roll into a hub audit trail; the macOS Pill surfaces live H and agent pets in the notch and menu bar.
Spawn & attach
Register local agents and attach terminal or app hosts. Pets live under ~/.shannon/pets/.
Monitor & audit
Per-agent entropy streams, collapse callbacks, and hub-level audit of strategic lock-in across the roster.
Handrail actions
Escalation ladder: log-only → alert → throttle → kill → coredump → webhook — with cooldown and sustained-count gates.
// ecosystem