- Status: Accepted
- Date: 2026-06-10
GABBE's "Brain Mode" needs a principled way to decide, at each step, whether to act locally (cheap heuristic / local model) or escalate to a remote SOTA model, and how to learn from past project outcomes. A purely reactive prompt-chain does not capture cost/benefit trade-offs or episodic memory.
Brain Mode (gabbe/brain.py) is framed conceptually as an Active-Inference / OODA
control loop, but its actual mechanism is deliberately small. Each activation:
- Reads project state — a single
GROUP BY statuscount of tasks in SQLite (the "observation"; not a read of PROJECT_STATE.md, the audit log, or recent outputs). - Selects a prompt gene via epsilon-greedy (≈20% explore the newest generation,
else exploit the highest
success_rate); genes are persisted in SQLite. - Calls the LLM once (through the gateway, under budget/hardstop controls) to emit a high-level action description.
- Bumps
success_ratefor the chosen gene by a fixed delta on success — a monotonic increment capped at 1.0. There is no free-energy computation, no prediction-error update, and no episodic-memory recall in this loop.
Active Inference and OODA are therefore framing, not math: they name the intent
(observe → choose → act → reinforce), not a literal variational free-energy implementation.
Cost/complexity routing is a separate concern handled by gabbe route (and described
conceptually in agents/guides/ai/self-evolving-skills.md), not inside this loop. This is
an experimental runtime: documented as such and gated behind explicit gabbe brain
subcommands, never on by default.
- The budget/hardstop controls are first-class, not bolt-ons; routing (
gabbe route) is a distinct, separately-invoked capability rather than a step inside the Brain loop. - Because it is experimental, claims in the README are marked Experimental and link to reproducible examples rather than implying production guarantees.
- Replay is deterministic because
gabbe replayre-emits RECORDED outputs from checkpoints — the live loop itself is stochastic (epsilon-greedy gene selection plus a non-deterministic LLM call), so a fresh live run is not bit-for-bit reproducible.
Honesty note: the Active-Inference / OODA description is conceptual framing for how the loop is organized, not a claim that
brain.pyminimizes free energy. The production engine is epsilon-greedy gene selection over a monotonicsuccess_rate— see the same caveat inagents/skills/brain/cognitive-testing.skill.mdand the brain README.