dimagi-internal/ace/sweep-opp-runs
Claude Code and agent skill by dimagi-internal/ace
- community
Checking that the SKILL.md file is still in the repository.
Prune old ACE runs in Drive: keep the newest N per opp and trash the rest after approval.
Install
npx vskill@latest install dimagi-internal/ace/sweep-opp-runsSKILL.md
The same SKILL.md was published earlier as dimagi-internal/ace/sweep-opp-runs.
sweep-opp-runs
Per-opp retention prune, not orphan sweep. For every opp folder under ACE/, sort its runs/<run-id>/ children by createdTime descending, keep the newest N, propose the rest as trash candidates. Human approves, atom executes via drive_trash_file (reversible — 30-day Drive bin).
This is purely about retention to control /ace:status and other listing load times. It does not consult the live-set; orphan opp folders are sweep-drive's job. opp-runs assumes every opp under ACE/ is legitimate and only trims its run history.
Inputs
keep(required, int ≥ 1) — the number of newest runs to retain per opp. Sweep orchestrator surfaces this from the user; default is3if the user accepts the prompt without changing it.sweepFolder— the timestamped sweep folder built by the orchestrator (e.g.ACE/_sweep/<timestamp>/); products land here.mode—recommend(default) |execute. Inrecommendthe skill is report-only: build + render the per-opp prune plan + return it; no trashing. Inexecuteit trashes onlyapprovedIds. The human-confirmation gate between the two is the orchestrator's job — seeagents/sweep.md § Human-confirmation gate.approvedIds(executemode only) — the exact run-folder ids the human approved in chat. Trash nothing outside this set.
There is no live-set dependency. If the orchestrator built one (because the user ran a different system first in the same /ace:sweep all-style invocation), ignore it.
Products
ACE/_sweep/<timestamp>/opp-runs-prune.md— human-readable plan grouped by opp.ACE/_sweep/<timestamp>/opp-runs-prune.yaml— machine-readable per-opp plan (for replay / partial approval).- For each approved run folder: a
drive_trash_fileop.
Process
- Enumerate opps.
drive_list_folderonACE_DRIVE_ROOT_FOLDER_ID. Filter to folders only (mimeType == application/vnd.google-apps.folder). Skip names starting with_(e.g._sweep/,_archive/,ai-input-creation-runs/is NOT a sweep target — it doesn't start with_, but it's also not an opp; the runs-folder probe in step 3 naturally skips it). - Locate `runs/` per opp. For each opp folder,
drive_list_folderon the opp folder; find the child named exactlyruns(folder mimeType). If none exists, skip the opp (nothing to prune). - List runs.
drive_list_folderon theruns/folder. Filter to folders. These are individual run dirs (typicallyYYYYMMDD-HHMMSS-<short>or similar; do not parse the name — sort bycreatedTimefrom the Drive metadata, not the slug). - Sort + slice. Sort runs by
createdTimedescending (newest first). The firstkeepruns are retained. The remainder are prune candidates. - Build the per-opp plan. For each opp with >0 candidates, collect:
oppSlug— the opp folder namekept[]— thekeepnewest runs (id,name,createdTime)candidates[]— the runs to trash (id,name,createdTime)
- Render the markdown report. Per-opp section with two short tables (kept vs candidates). Headline at the top: "Prune plan — keep newest N per opp; M opps affected; K runs to trash." Write to
ACE/_sweep/<timestamp>/opp-runs-prune.mdand the YAML peer. - Recommend — stop here in `mode: recommend`. Return the per-opp prune plan (candidates to trash, grouped by opp — each with id, name, createdTime; reversibility: 30-day Drive bin) + the report Drive link, to the orchestrator. Trash nothing. Do not try to prompt the human from this skill — a dispatched subagent can't reach them; the orchestrator runs the confirmation gate (see
agents/sweep.md § Human-confirmation gate).
Execute phase (mode: execute only)
Runs only when the orchestrator re-dispatches with mode: execute + approvedIds (the run-folder ids the human approved in chat). For each approved candidate, drive_trash_file({ fileId: <id> }). Trash nothing outside approvedIds. Report success/failure per-item, but never abort the batch on a single-item failure — log and continue. Then (sanity check) for one affected opp, drive_list_folder on its runs/ again and confirm the trashed names are gone.
Failure modes
- `runs/` folder doesn't exist on a given opp — skip silently. Opps that never ran a
/ace:runhave noruns/. - `keep` >= run count for an opp — that opp has zero candidates; omit it from the report.
- `drive_trash_file` permission error on a Shared-Drive folder — log as "trash failed — needs admin"; continue.
- `keep == 0` — refuse. Retention prune always keeps at least 1 (the freshest run). Surface a clear error to the orchestrator; do not silently fall back.
Implementation notes for agents
- Use the Drive
createdTimefield — do not parse run-id slugs for timestamps. Run-id slug format has drifted historically; the metadata is authoritative. - This skill does not touch
opp.yaml,inputs/,eval-calibration/, or any other per-opp file. Onlyruns/<run-id>/direct children get trashed. - Run folders are deeply nested (per-phase verdicts, transcripts, screenshots).
drive_trash_fileon the run folder cascades naturally — no need to recurse. - Drive trash is reversible for 30 days. If the human asks "what if I want it back," point them at https://drive.google.com/drive/trash and the run-id slug.
Related skills
sweep-drivehandles orphan opp folders (the level above this skill's targets). The two are complementary:opp-runscontrols retention inside live opps;sweep-driveremoves opps that no longer match the live-set.sweep-live-setis not an input here.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sweep-opp-runs/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dimagi-internal/ace/sweep-opp-runs)