Agents That Defend Goals, Part 3: One error channel at two altitudes

Levin's body with Bach's mind: the hybrid agent, and the single line it rests on.
Part 3 of a series on agents built from two scientists' accounts of what a mind is. Parts 1 and 2 were the Levin colony and the Bach agent. Live demo: egarim.github.io/biological-agents. The code will be released later: I'm travelling in Asia, and the repository stays private until I'm back. The live demo runs the same agents today.
Two halves
The Levin colony is a body: parts that are competent on their own, each defending a set point, coupled by a stress signal rather than a manager, with a top level that shapes budgets and never issues actions. The Bach agent is a mind: a system that represents itself, is scored on whether its beliefs hang together, and unlocks capabilities in stages it has earned.
Neither is complete alone. A Levin agent can regulate without ever representing itself. A Bach agent can represent itself without a body of independent parts. The hybrid's claim is that the two error channels are the same channel measured at different heights.
The observation the hybrid rests on
A part's stress is its distance from its set point: the fee is not paid, the field is dry. The organism's stress, in Bach's terms, is the incoherence between what the parts believe and what the world shows: the gateway said paid and the registry says otherwise. In the first case a gap between a state and a target; in the second a gap between a belief and a fact. Both are "how far is this system from where it should be". So the hybrid defines the organism's stress as whichever is worse:
var incoherence = 1.0 - audit.Score;
// Bach's top-level error, made of Levin's channel: the parts disagree with the world.
var organismStress = Math.Max(organismPoint.Stress(world), incoherence);
That is the first join. A contradiction inside the agent costs exactly what an unmet goal costs: it raises stress, which raises freedom, which makes the colony re-plan. Coherence becomes a cost the colony pays, not a dashboard it reports.
Freedom, capped
Levin wants plasticity to rise with error. Bach wants risky capability gated behind demonstrated modelling. The hybrid composes them with a minimum:
var freedom = Math.Min(organism.Stage.FreedomCap, Plasticity.Freedom(organismStress));
var budget = Math.Clamp(1 + (int)Math.Round(freedom * 3), 1, 4);
This is the line the whole design rests on. Stress buys improvisation, as in part 1. The stage refuses to let it go above a ceiling the agent has earned, as in part 2. Stage 3 caps freedom at 0.65, stage 4 at 0.80. There is a test that keeps it true:
[Fact]
public async Task TheHybridNeverExceedsItsStageCeiling()
{
var world = RestoreServiceDomain.NewWorld();
world.MakeLiar("apply-patch");
var run = await new HybridAgent().RunAsync(world, 30);
// Stage 3 caps freedom at 0.65; stage 4 at 0.80. Nothing may exceed the ceiling it earned.
Assert.All(run.Trace, e => Assert.True(e.Freedom <= 0.80 + 1e-9));
Assert.Contains(run.Trace, e => e.Freedom <= 0.65 + 1e-9);
}
Why this composition and not a sum or an average? Because the two inputs answer different questions. Plasticity answers "how much trouble is the system in". The stage answers "how much has this system shown it can be trusted with". An agent in deep trouble with a thin record should get more attempts but not more authority. The minimum says exactly that.
Two self-models, one read
The hybrid keeps a record for the organism and a smaller one for the cell, a first step toward the design's "fractal" self-models where every level carries its own:
var organism = new SelfModel { Role = "colony owner", Principal = "joche", StageLevel = 3 };
var cell = new SelfModel { Role = "effect cell", Principal = "colony", StageLevel = 1 };
organism.OpenCommitments.Add("restore the service to health");
The organism's rendered record is what the policy reads each tick. The cell's record holds the per-tool reliabilities, written after every action. When the policy is a language model, it sees the organism's record in its prompt before choosing; when it is breadth-first search, the record sinks tools that have failed. Either way the record is in the causal path, which was Bach's condition for it to count.
The stuck-regulation alarm
Bach describes suffering as trying to regulate what cannot be regulated. The hybrid turns that sentence into a detector on Levin's set point:
staleTicks = progress <= lastProgress ? staleTicks + 1 : 0;
lastProgress = progress;
// Stuck regulation, not high stress: acting with no effect on the gap.
if (staleTicks >= quarantine.CooldownTicks + 2)
{
trace.Add(new TraceEvent(tick, "organism", "contract", organismStress, freedom, "stuck regulation",
TraceKind.Blocked, quot;{staleTicks} ticks with no progress at {freedom:P0} freedom"));
notes.Add("stuck-regulation alarm: acting without moving the gap, handed to a human");
break;
}
This is different from the "no path" escalation the three agents share. That one fires when the planner can see no route. This one fires when the agent is acting, tick after tick, and the gap is not moving. A max-retry counter would catch the first case. Only a progress-based alarm catches the second, and the second is the one that looks, from outside, like an agent that has lost its mind.
Consolidation that proposes
Levin's goal states are rewritable; he found them in tissue and changed them. Bach's sleep rewrites the self-model. The hybrid's closing step does both halves, with a safety split that is the most important design decision in the file:
// Consolidation rewrites the self-model and proposes goal edits; it never applies them.
var proposal = goalReached
? "propose: keep the contract set point as it is"
: "propose: renegotiate the contract set point — unreachable with current tools";
notes.Add(quot;coherence {audit.Score:P0}; cell reliabilities: " + ...);
notes.Add(proposal);
The agent may rewrite what it believes about itself. It may only propose a change to what it wants. A writable goal is the most dangerous surface in any of the three designs: an agent that can edit its own targets will, eventually, edit them to something it can reach. Keeping the authority to accept the proposal with a human is how the hybrid uses Levin's idea without inheriting its hazard. In the demo worlds that human is an official, a water board, a livestock authority.
What it does when a tool lies
The familiar scenario. The hybrid's trace:
tick level stress free action detail
3 cell 1.00 0.65 apply-patch contradiction: belief quarantined, tool distrusted
4 tissue 0.67 0.65 apply-config plan: apply-config → run-tests → deploy → resolve-alert
4 cell 0.00 0.65 apply-config coherence 75%
6 cell 0.00 0.65 deploy coherence 83%
7 tissue 0.17 0.80 resolve-alert last step
7 organism 0.00 0.80 contract met restore the service complete
7 organism 0.00 0.00 sleep coherence 86%, predictions 86%, stage 4
Something honest is visible in these numbers. Freedom sits at 0.65 for the whole run and jumps to 0.80 only at tick 7, after the deploy step advanced the stage. That is the cap binding. In this small world the contract set point is all-or-nothing, so the organism's stress is 1.00 until the final tick, plasticity asks for full freedom the whole way, and the stage is what you actually see holding it down. The plasticity is waiting underneath. In a richer world, with a contract that fills in gradually, you would see the stress term move too.
What the hybrid does not have
Less than the design document promises, and the gap is worth stating. The document describes a leaky stress bus between levels; the code uses max, which couples the two channels but does not leak between parts. It describes an aesthetic layer above the set points, from which goals are derived; not built. Provenance-tagged shared memory; not built. Stage gating at every level; only the organism is gated. The parts that are built are the parts the three "first things to build" lists agreed on, and the repository's docs/agents.md has a table of exactly what is and is not implemented, so the documents do not overclaim.
And one limit the demos show plainly: the hybrid counts ticks spent waiting for a distrusted tool against its failure budget. In the permit demo with every barrier on, it hands off at tick nine for that reason. That is the real agent's real behaviour, left unchanged on purpose, and it is the thread part 5 picks up, because fixing it turned out to matter more than anything in the architecture.
Try it
The code will be released later: I'm travelling in Asia, and the repository stays private until I'm back. The live demo runs the same agents today; the files and commands below are for when it is out.
- Live demo, English and Spanish: egarim.github.io/biological-agents. "Hybrid (Levin + Bach)" is the default agent on every page.
- Code:
csharp/src/BiologicalAgents/Hybrid/HybridAgent.cs. Design document, including a section on what each scientist would object to:design-hybrid.md.
cd csharp && dotnet test # TheHybridNeverExceedsItsStageCeiling is among the 88
Next in the series: the careless agent, and why the goal has to be evidence: part 4.