utils-reclaim-stale-snapshots
Skill309 starsChanged 4 months agoApache-2.0View on GitHub
Reclaim 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).
- Reads credentials
In this repository50 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- analyze-datagen-campaign-summarySkill
- analyze-dataset-token-lengthSkill
- analyze-id-eval-rankingSkill
- analyze-job-history-irisSkill
- analyze-rl-behaviorSkill
- analyze-training-run-irisSkill
- build-tpu-image-irisSkill
- code-create-staged-planSkill
- code-execute-staged-planSkill
- commitSkill
- crud-archive-runSkill
- crud-otagent-supabaseSkill
- crud-purge-below-gate-evalsSkill
- crud-purge-stale-eval-placeholdersSkill
- datagen-create-task-datasetSkill
- datagen-job-cleanupSkill
- datagen-launch-irisSkill
- datagen-launchSkill
- datagen-reduce-dataset-snapshotsSkill
- datagen-standard-launchSkill
- debugSkill
- docs-deslopSkill
- eval-agentic-cleanupSkill
- eval-agentic-launch-irisSkill
- eval-agentic-launchSkill
- eval-standard-cleanupSkill
- eval-standard-launchSkill
- file-issueSkill
- monitor-cron-sweep-irisSkill
- monitor-cron-sweepSkill
- monitor-job-tablesSkill
- monitor-restore-irisSkill
- monitor-restoreSkill
- monitor-restore-unifiedSkill
- rl-agentic-job-cleanupSkill
- rl-agentic-launch-irisSkill
- rl-agentic-launch-jupiterSkill
- rl-job-health-deep-diveSkill
- rl-standard-job-cleanupSkill
- rl-standard-launch-leonardoSkill
- serve-model-vibe-testSkill
- sft-cleanup-hf-onlySkill
- sft-job-cleanupSkill
- sft-launchSkill
- supervisor-initSkill
- utils-cleanup-stale-sandboxesSkill
- utils-fix-permissionsSkill
- write-testsSkill
- writing-styleSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
Always audit (read-only) first, then delete.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
utils-reclaim-stale-snapshots
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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

