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 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:

Mechanism What it does
Progressive fine fine_amplitude = base × fine_mult^fine_count — each recurrence grows the fine
Partial cold restart After max_fines, resets root_goal + denies tools for N tokens
Automatic tool denial Agent temporarily loses tool access
Output reprimand Generated 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

Metric Value
Version v3
Mechanisms 4 (progressive fine, cold restart, tool deny, reprimand)
Fine formula fine_amplitude = base × fine_mult^fine_count
GoalHamiltonian tests 27 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.