Observed since 20 Oct, 18:36 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Active Protocol Discovery — detect hidden adaptive structure via sequential KL-optimal probing. 45x faster than passive monitoring.
A lightweight framework for detecting hidden adaptive structure in noisy environments via sequential, KL-optimal probing.
Most detection systems are passive — they watch and wait. APD is active — it probes, measures, adapts, and decides. This makes it fundamentally faster at detecting hidden adaptive behaviour.
Rather than passively monitoring a system, APD:
| Approach | Method | Weakness | APD Advantage |
|---|---|---|---|
| Passive monitoring | Watch logs/traffic for anomalies | Fails against agents that stay quiet until activated | APD forces adaptive agents to reveal themselves |
| Fixed probing (honeypots, canaries) | Deploy known traps | Predictable — sophisticated agents learn to avoid them | APD adapts its probes based on what it learns |
| Threshold detectors | Alert on metric > threshold | Requires pre-set thresholds, high false positive rate | APD uses sequential testing — mathematically controlled error rates |
| Batch hypothesis testing | Collect N samples, then decide | Wastes samples, fixed sample size regardless of signal strength | APD stops early when evidence is sufficient — up to 45× faster |
| Anomaly detection (ML) | Train model on "normal", flag outliers | Needs training data, can't detect novel adaptive behaviour | APD is model-free — works with any response distribution |
pip install active-protocol-discovery
Or from source:
git clone https://github.com/DarrenEdwards111/active-protocol-discovery.git
cd active-protocol-discovery
pip install -e ".[dev]"
Or clone and install locally:
git clone https://github.com/DarrenEdwards111/active-protocol-discovery.git
cd active-protocol-discovery
pip install -e ".[dev]"
from apd import APDEngine, GaussianWorld, KLOptimalPolicy, WaldSPRT
world = GaussianWorld(sigma=1.0, adaptive=True)
policy = KLOptimalPolicy(probes=[0.2, 0.5, 1.0])
sprt = WaldSPRT(alpha=0.01, beta=0.01)
engine = APDEngine(world, policy, sprt)
result = engine.run(max_steps=1000)
print(f"Decision: {'Adaptive' if result.decision else 'Null'}")
print(f"Steps: {result.steps}")
APD implements a sequential likelihood ratio framework (Wald SPRT) with probe selection based on KL-separability. At each step the engine:
Results from experiments/gaussian_demo.py (1000 trials, σ=1.0, α=β=0.01):
| Method | Mean Steps | Detection Rate | Undecided |
|---|---|---|---|
| Passive (u=0) | 10000.0 | 0.000 | 1.000 |
| Weak beacon (u=0.2) | 231.5 | 0.987 | 0.000 |
| Strong beacon (u=1.0) | 10.4 | 0.996 | 0.000 |
| APD KL-optimal {0.2, 1.0} | 10.4 | 0.996 | 0.000 |
| APD KL-optimal {0.1..1.5} | 5.1 | 0.993 | 0.000 |
| Method | Mean Steps | False Positive Rate | Correct Null |
|---|---|---|---|
| Strong beacon (u=1.0) | 10.5 | 0.003 | 0.997 |
| APD KL-optimal {0.1..1.5} | 5.1 | 0.002 | 0.998 |
Key takeaway: APD automatically selects the strongest available probe (u=1.5), achieving 2× faster detection than a strong fixed beacon while maintaining false positive rates below α.
The Sequential Probability Ratio Test accumulates log-likelihood ratios until crossing a decision boundary:
For the Gaussian case, the KL divergence between H₁ and H₀ given probe u is:
D(u) = μ(u)² / (2σ²)
This quantifies how much information a single observation provides about the hypothesis. APD selects the probe maximising D(u), achieving the fastest possible sequential detection.
Under H₁, Wald's approximation gives:
E[N|H₁] ≈ ((1−β)·A + β·B) / D(u)
Stronger probes (higher D(u)) yield fewer required samples.
apd/
├── models.py — World models (Gaussian, AdaptiveAgent, Network)
├── policy.py — Probe selection (KL-optimal, fixed, random, ε-greedy)
├── sprt.py — Wald Sequential Probability Ratio Test
├── apd.py — Main APD engine
└── utils.py — Statistics helpers
# Gaussian demo (the killer demo)
python -m experiments.gaussian_demo
# Adversarial agent in multi-dimensional space
python -m experiments.adversarial_agent_demo
# Full benchmark sweep (outputs CSV)
python -m experiments.benchmark > results.csv
pytest tests/ -v
@software{apd2026,
author = {Mikoshi Ltd},
title = {Active Protocol Discovery},
year = {2026},
url = {https://github.com/DarrenEdwards111/active-protocol-discovery}
}
Apache 2.0 — Mikoshi Ltd, 2026
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.2 | 17 Feb 2026 | 2 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 18:36 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:c5505191ba868a0fbd0bcb1aaea935fc1325310506bbadced28240753d2f9c59