Principle:23blocks OS Ai maestro Agent Deletion
| Knowledge Sources | |
|---|---|
| Domains | Agent_Orchestration, Lifecycle |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
A two-phase deletion pattern with soft-delete (mark + preserve) for reversibility and hard-delete (backup + remove) for permanence.
Description
Agent deletion in AI Maestro supports two modes. Soft-delete (default) kills the agent's tmux sessions, marks `deletedAt` in the registry, and cleans AMP directories — but preserves all data on disk for potential restore. Hard-delete creates a backup first, then permanently removes the registry entry, agent directory (database), messages, and AMP directories.
Both modes kill tmux sessions first. Soft-deleted agents are excluded from lookups by default but can be included with `includeDeleted=true`. The AMP directory is cleaned in both modes so deleted agents stop receiving messages.
Usage
Use this principle when designing deletion where:
- Operators may need to undo a deletion (soft-delete)
- Permanent removal requires a safety backup (hard-delete)
- External systems (AMP inbox) must be cleaned to stop side effects
Theoretical Basis
The pattern is two-phase deletion — a common database pattern:
soft-delete: mark deletedAt → exclude from queries → preserve data
hard-delete: backup → remove from store → remove from disk → clean external
The soft-delete tombstone (`deletedAt`) allows the agent to be found with `includeDeleted=true` and potentially restored. The hard-delete backup ensures no data is lost permanently without a recovery path.