I have been working on Aetheris Microbrains and just added native Pi Coding Agent support as a zero-dependency Level 3 extension.
It is a deterministic, CPU-only pre-flight gate (sub-2ms p95 locally) that hooks directly into Pi's tool_call and tool_result lifecycle events. It catches dangerous shell commands, AST/code hazards, protected-path edits, and secret leaks before they execute or hit the LLM.
Why I built it for Pi specifically:
Pi's extension API is a great fit because tool_call gives us native ctx.ui.confirm() escalation in TUI and RPC modes (instead of blindly hard-blocking ambiguous commands), and tool_result lets us scrub secrets synchronously before the model sees tool output.
30-second setup:
git clone https://github.com/drtikov/microbrainsforagents
cd microbrainsforagents
pip install -e .
aetheris install pi --workspace .
aetheris-daemon --http --host pi --port 8765
Then launch pi (or run /reload). Inside Pi you get two commands:
- /aetheris (quick daemon health check + session counters)
- /aetheris-config (effective config with masked token + session stats)
Zero Node dependencies and zero build step — it is a single ESM file loaded directly by Pi, configurable via env vars or .pi/settings.json ("aetheris").
What the 4-layer gate does:
- Layer 0: Protects sensitive & control-plane paths (.pi/, .git/, .ssh/, .env*)
- Layer 1: Polyglot AST + shell inspection (catches eval/exec, obfuscated base64 execution, secret leaks, rm -rf, curl | sh, breaking changes)
- Layer 2: Deterministic Top-4 MoE tool routing + conformal abstention (narrows 32 tools down to 4 with session-sticky caching)
- Layer 3: Escalates uncertain actions to you via ctx.ui.confirm() in TUI/RPC (fail-closed in non-interactive runs)
Local CPU benchmarks (reproducible scripts in examples/, no live API calls):
- 25-step agent loop: 64,800 down to 12,312 schema tokens (81% reduction, ~52k tokens saved/loop), 0 missed hazards, 0 false positives, 0.95ms p95
- Agent security & anti-evasion suite: 22/22 attacks caught (100% TPR), 0/12 benign false positives (0% FPR), 0.38ms p50 / 2.1ms p95
- SWE-bench Lite (300 real gold diffs): 297/300 allowed/escalated (3/300 denied on eval/exec patterns, 0 AST syntax false positives), 36.7% schema saved, 1.76ms p50 / 4.5ms p95
- Frozen 120-task prompt-cache advisor: 100% Recall@4, 0 dropped tools, 56.7% cache-adjusted net token savings (session-sticky)
- Counterfactual safety gate: blocks obfuscated base64 + exec payloads and breaking signature regressions
Modeled token economics (local estimate, not live invoices): ~52k prefill tokens saved per 25-step loop (~ \$0.079/loop at \$1.50/M input, or ~ \$118/month at 50 loops/day), plus ~2.1 Wh avoided per loop, all running locally on CPU so your code never leaves your machine for the gate.
Quick FAQ:
- Does it replace my LLM? No, it is a pre-filter. Your LLM still does all reasoning; Microbrains narrows the tool surface, scrubs secrets, and blocks dangerous actions locally.
- What if the daemon is down? Fail-closed by default. Set AETHERIS_FAIL_CLOSED=0 to allow, or AETHERIS_HOOK_SHADOW=1 for observe-only shadow mode.
- Does it work with any provider/model? Yes, it is model-agnostic (Anthropic, OpenAI, Google, local models via Pi).
Repo: https://github.com/drtikov/microbrainsforagents
Pi extension folder: pi-aetheris-microbrains/
Reproducible benchmarks: examples/05_reproducible_25step_benchmark.py, examples/07_swebench_lite_gate_benchmark.py, examples/08_frozen_advisor_benchmark.py, examples/10_agent_security_benchmark.py
Disclaimer: I am the author of Microbrains. Built it because I wanted fast, deterministic local guardrails for my own coding agent workflows and figured other Pi users might find it useful. Try it out and let me know what breaks — happy to help debug any edge cases.