The semantic punishment that taught the agent to behave
TatuEngine·

The semantic punishment that taught the agent to behave

The agent that needed limits

TatuEngine has an autopoietic agent — with LTM, ToolUse, GoalStack, SafetyGuard and GoalHamiltonian. It’s designed to learn, act and evolve on its own. But there’s a problem: an agent that is only rewarded for what it does right never learns how much a mistake costs.

Versions 1 and 2 of the punishment were rudimentary. v3 changed the game: progressive fines for repeat offenses.

The tools I use on this project live in the skills store — the first one is free.

The context: punishing like an immune system

The v3 idea is simple and powerful: if the agent makes one mistake, the fine is small. If it makes another, the fine multiplies. If it persists, the agent temporarily loses the ability to use tools — and receives a reprimand in its output.

# The decision logic that applies punishment
# The fine is progressive: fine_amplitude = base × fine_mult^fine_count

This is like an immune system: the first exposure triggers a light response, but the system remembers and responds stronger to each recurrence. The agent isn’t just punished — it learns that behavior has growing cost.

The struggle: the 3 versions

v1 — fixed punishment. Every mistake cost the same. The agent had no incentive not to repeat — the fine was predictable and “tolerable”.

v2 — punishment with memory. Added infraction accumulation. Better, but still without real progression.

v3 — progressive punishment + partial cold restart:

MechanismWhat it does
Progressive finefine_amplitude = base × fine_mult^fine_count — each recurrence grows the fine
Partial cold restartAfter max_fines, resets root_goal + denies tools for N tokens
Automatic tool denialAgent temporarily loses tool access
Output reprimandGenerated text includes clear error feedback

The best part: state is queryable — punishment metrics exposed in Python bindings. The system can be observed and tuned.

The resolution: punishment that educates

The result is an agent that:

  1. Makes few mistakes — the growing fine makes errors increasingly expensive
  2. Self-corrects — partial cold restart forces a goal reset when it persists
  3. Can be audited — everything is observable via bindings
  4. Doesn’t get stuck — tool denial is temporary, not permanent

v3 was validated with 27 test occurrences in the punishment module — the system has real coverage.

Metrics

MetricValue
Versionv3
Mechanisms4 (progressive fine, cold restart, tool deny, reprimand)
Fine formulafine_amplitude = base × fine_mult^fine_count
GoalHamiltonian tests27 punishment/denied occurrences

Lessons learned

  1. Progressive punishment > fixed punishment — the agent tolerates a predictable cost. What changes behavior is the growing cost of recurrence.
  2. Temporary punishment educates, permanent punishment mutilates — tool denial for N tokens forces reflection without breaking the agent.
  3. Observability is essential — exposing punishment metrics in bindings lets you tune the system without guessing.
  4. Immune system as a design metaphor — remembering and responding stronger to each recurrence is how the body learns to fight infections.

Related entries

Same project, same ground — the stories connect.

Next step

If this was useful, there is more: I write about the same ground in the other projects, and the store holds the tools I use here.

No spam, one-click unsubscribe. I am also here: Skills store · Portfolio