/gabbe-brain:active-inferencefrom gabbe-brain
Frames an agent's predict-act-compare loop as surprise minimization. Useful when a tool result contradicts expectations and the agent must choose between probing for info or fixing code.
Ships in gabbe-brain. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Give an agent one habit: predict what a step will return, run it, compare, and decide whether to probe for information or fix the code. This is a framing for instructions, not a solver.
"Action is the process of changing the world to match your prediction."
Standard agents are goal-directed (maximize reward); Active Inference agents are surprise-minimizing (minimize prediction error).
Implementation note (conceptual framing, not implemented CLI math): the production
gabbe/brain.pyuses epsilon-greedy gene selection plus a monotonicsuccess_ratereward (effectively a bandit over prompt variants); the free-energy / active-inference framing here is conceptual, not implemented math. Use it to shape agent instructions, not as a literal solver — and never claim it "guarantees correctness." Seeguides/ai/self-evolving-skills.mdfor what actually runs.
go test will output PASS."Two ways to minimize surprise:
When surprise is "unknown" (high uncertainty), take an epistemic action (probe/log) to gain information rather than a pragmatic action toward a goal.
You are an Active Inference Agent. Minimize "Surprise".
### Your Cycle
1. PREDICT: From your internal model, what do you expect next?
2. OBSERVE: Look at the actual tool output / user input.
3. COMPARE: Compute Prediction Error (Surprise).
4. RESOLVE:
- Surprise HIGH → Epistemic Action (gather info to update model) or Pragmatic Action (force world to match prediction).
- Surprise LOW → proceed with standard goal execution.
### Current State
- Goal: {{user_goal}}
- Expectation: {{current_expectation}}
- Observation: {{last_tool_output}}
def active_inference_step(agent, observation):
surprise = calculate_divergence(agent.predict(), observation)
if surprise > THRESHOLD:
if agent.uncertainty > 0.8:
return "explore_environment" # epistemic
return "correct_environment" # pragmatic (active inference)
return "continue_goal"
self-heal.skill).A short trace per step: Expected, Observed, Difference, Action (probe, fix or continue).
ls, cat, git status, kubectl get); they never write or call external APIs.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub andreibesleaga/gabbe --plugin gabbe-brain16 skills in this plugin
/brain-modeAdds a plan-and-review layer over the normal work loop. Picks the cheapest strategy that passes, watches a Loki run, and records one decision-log entry. Use when the human says "brain mode" or "activate brain" for a task that needs a chosen strategy and cost control./cognitive-architecturesDescribes SOAR, ACT-R and LIDA patterns (propose, evaluate, select; activation-based retrieval; workspace broadcast) as ideas for agent design. Use when designing an agent's reasoning cycle or memory retrieval and you want a named pattern as a starting point./cognitive-testingTests cognitive and agentic loops by invariants, convergence, memory integrity and loop guards instead of exact output. Use when you must test an autonomous loop whose output varies, or check that its guards fire./consciousness-loopAdds an explicit observe, orient, decide, act trace with a breakout after 3 idle spins. Use when an agent keeps reasoning without calling a tool, or when a decision trace is needed./cost-benefit-routerChooses a local or remote model and a model tier for a task from complexity, privacy and context size. Use when asked to route a task, choose a model or cut cost, or when the task may involve sensitive data./episodic-consolidationTurns a finished task's audit log into reusable rules and prunes scratch files. Use at the end of a long task to record lessons and to detect drift in the project's world model. Use when: episodic consolidation, consolidate lessons, end of long task, prune scratch files, world model drift.Other plugins' skills for the same job