utils-reclaim-stale-snapshots
SkillMediaReclaim idle Daytona SNAPSHOTS org-wide to free space under the 60-snapshot cap, using scripts/daytona/daytona_snapshot_manager.py. Deletes only harbor__ per- environment snapshots idle past the standing threshold GT'd in .agents/projects/daytona/daytona.md — NEVER the shared base/template images (daytonaio/sandbox:*, daytona-*, windows-*), which do not rebuild-on-demand. Use when a datagen/eval launch hits SnapshotCapExceeded, when a monitor sweep finds the cap full, or as routine cap hygiene. This is the org-wide RECLAIM tool; to shrink a SINGLE dataset's unique-environment count instead, use datagen-reduce-dataset-snapshots. Snapshots are a DIFFERENT resource from sandboxes (for sandbox cleanup use utils-cleanup-stale-sandboxes).
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the utils-reclaim-stale-snapshots skill
What this skill tells your AI
The instructions your AI receives, as published by open-thoughts/openthoughts-agent in .agents/skills/utils-reclaim-stale-snapshots/SKILL.md and read by ahel’s review.
Free Daytona snapshot quota by deleting idle harbor__<hash>__snapshot environments under the hard cap of 60.
Why this is safe (and what it must never touch)
Harbor builds one snapshot per task-environment hash (harbor__<hash>__snapshot). auto_snapshot rebuilds a
deleted idle snapshot on demand.
The base/template images (daytonaio/sandbox:*, daytona-gpu, daytona-medium/large/small, windows-*) are
shared and do not rebuild on demand. Keep --name-prefix harbor__ so only Harbor snapshots are eligible.
For snapshots, state=active means built and available. Staleness uses last_used_at, falling back to
created_at; live-job environments remain below the idle threshold.
Which org
Datagen/eval pre-build uses the cli org and DAYTONA_API_KEY. RL uses the separate DAYTONA_RL_API_KEY org.
How to run
Always audit (read-only) first, then delete.
cd /Users/benjaminfeuer/Documents/OpenThoughts-Agent
source /Users/benjaminfeuer/miniconda3/etc/profile.d/conda.sh && conda activate otagent
source "${DC_AGENT_SECRET_ENV:?set DC_AGENT_SECRET_ENV to the secrets file first}"
PY=/Users/benjaminfeuer/miniconda3/envs/otagent/bin/python
SCRIPT=scripts/daytona/daytona_snapshot_manager.py
# 1. AUDIT — read-only, see what WOULD be reclaimed (at the stale threshold — see below)
$PY $SCRIPT --api-key-env DAYTONA_API_KEY --stale-days <threshold>
# 2. RECLAIM — actually delete the stale harbor__ snapshots
$PY $SCRIPT --api-key-env DAYTONA_API_KEY --stale-days <threshold> --delete-stale --yes
--stale-days accepts floats; use minutes/1440 for sub-day thresholds. The standing threshold is in
.agents/projects/daytona/daytona.md § "How to clean stale snapshots". Raise it for more conservative cleanup.
Flags (this tool)
| Flag | Default | Purpose |
|---|---|---|
--api-key-env | DAYTONA_DATA_API_KEY | Org key env var. Use DAYTONA_API_KEY for the cli/datagen org. |
--stale-days | 14 | Idle-days threshold (float). Standing value GT'd in .agents/projects/daytona/daytona.md § "How to clean stale snapshots" — don't restate it here. |
--name-prefix | harbor__ | Only names starting with this are deletable. Do not widen it — the default guards base images. |
--delete-stale | off (dry-run) | Actually delete. |
--yes | off | Skip the confirm prompt (for scripted/cron use). |
--json | off | Machine-readable output. |
Gotchas
- Source
$DC_AGENT_SECRET_ENV+ otagent env — thedaytonaSDK lives in the otagent conda env; use the full interpreter path. - Never pass
--name-prefix ''with--delete-stale— that would make base images deletable. The tool is safe only with theharbor__default. - Idle active
harbor__snapshots are reclaimable. - Reclaiming adds a one-time rebuild when the environment is next used.
In the monitor sweep
The every-3-hours Iris sweep audits each tick and reclaims for blocked datagen refills or cap ≥ ~58/60. See monitor-cron-sweep-iris §5.
Signals
- GitHub stars
- 291
- Forks
- 41
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
utils-reclaim-stale-snapshots- Source
- github.com/open-thoughts/openthoughts-agent