Manage Resource Lifecycle
Use runtime.resource_lifecycle as the sole runtime owner. Read
references/lifecycle-policy.md before authorizing reclamation, process-tree
termination, quarantine disposition, or run closure.
Workflow
- Identify the project, run, lane, creator, purpose, expected cleanup event, and
allowed cleanup root.
- Classify every resource as
protected,evidence,quarantine,ephemeral,
or unknown. Retain on ambiguity.
- Register owned paths and processes when created; do not infer ownership from a
name, age, size, executable, or location.
- Promote required outputs and evidence outside disposable workspaces, then
validate their presence and readability.
- Mark the owning run
completed,failed,cancelled,abandoned, or
recoverable. Preserve recoverable resources.
- Evaluate the safe reclamation gate. Treat every failed or unknown check as a
retain decision.
- Run one conservative cleanup worker by default, refuse link/reparse ambiguity,
verify the target is absent, and write a cleanup receipt.
- Reconcile active processes, unexplained ephemerals, quarantine, evidence,
cleanup failures, and receipts before certifying run closure.
Runtime interface
- Inspect:
python -m runtime.cli resources status --ledger <path> - Dry-run recovery:
python -m runtime.cli resources reconcile --ledger <path> - Apply eligible cleanup: add
--applyonly after declared authority exists. - Create managed workspaces with
ResourceManager.workspace(...). - Launch cancellable workers with
ResourceManager.spawn_owned_process(...).
Boundaries
- Never auto-delete protected, evidence, external, unknown, or unreviewed
quarantine data.
- Never crawl a whole machine during normal startup; reconcile from the ledger.
- Never kill a process by executable name. Terminate only the live handle whose
registered identity remains provable.
- Never certify functional success while resource reconciliation fails.