freecoding.school100% FREE · NO SIGNUP
The Seven LayersISSUE #65 of 73

apoptosis · programmed agent death · PRUNE on done

OMNIVSThe Silent Failure
OMNI saysSpawned agents must die. Apoptosis is the rule that SELF PRUNEs every worker the moment it is done, times out, or burns its budget.

In biology, cells that overstay their welcome become tumors; in a swarm, workers that never retire become leaks. Apoptosis is programmed agent death: every spawned worker carries the conditions for its own retirement, and SELF PRUNEs it the instant any one fires — task done, budget exhausted, deadline passed, or parent gone. This is R7: only SELF curates, so a worker cannot keep itself alive, and a sibling cannot kill it out of turn. Death is not failure; it is the normal end of a healthy worker.

What dies is the worker's runtime — its context, its tools, its budget. What survives is only the signal it REMEMBERed and the COMMIT it left on the chain (mol-67). That separation is what keeps a long-running orchestra flat in memory no matter how many thousands of workers it has spawned over its life: at any instant only the live ones cost anything. If you find memory climbing with uptime, you have a worker that forgot to die.

Power-ups you unlock

The Silent Failure attacks — common mistakes

Boss battleGive a spawned worker four apoptosis triggers and show SELF PRUNEing it on whichever fires first, leaving only its committed signal behind.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#b388ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>
const be = (layer, verb, payload) => ({ layer, verb, payload });
const SELF = {
  live: new Set(),
  prune(w, why){ this.live.delete(w.id); return be('SELF','PRUNE',{ id:w.id, why, kept:w.signal }); }
};
function spawn(id, budget, deadline){
  return { id, budget, deadline, signal:null, done:false };
}
function tick(w, now){               // whichever trigger fires first wins
  if(w.done)          return SELF.prune(w, 'task done');
  if(w.budget <= 0)   return SELF.prune(w, 'budget exhausted');
  if(now >= w.deadline) return SELF.prune(w, 'deadline passed');
  return null;
}
const out = [];
const w = spawn('w1', 2, Date.now() + 9999);
SELF.live.add(w.id);
let dead = false;
for(let step = 1; step <= 3 && !dead; step++){
  w.budget--;                        // burn one unit of budget per step
  w.signal = 'partial@' + step;
  const death = tick(w, Date.now());
  if(death){ out.push('step '+step+': budget='+w.budget+' → PRUNE ('+death.payload.why+') kept "'+death.payload.kept+'"'); dead = true; }
  else out.push('step ' + step + ': budget=' + w.budget + ' alive');
}
out.push('live workers now: ' + SELF.live.size + ' (runtime freed, signal survived)');
document.getElementById('o').textContent = out.join('\n');
</script></body></html>
▶ Open the interactive comic issue
‹ Fan-Out / Fan-In · Parallel Spawn · Quorum FuseThe BE Bus · How Agents Talk · Packets Never Globals ›