sweep-drive
Find orphaned items under ACE's Drive root and trash the ones you approve. Needs a live-set from sweep-live-set.
Files1
View on GitHubSKILL.mdskills/sweep-drive/SKILL.md
GitHubsweep-drive
Find Drive folders under ACE/ that no current opp references, score them, present them to the human for triage, and trash approved items via drive_trash_file (reversible — 30-day Drive bin).
Inputs
- Live-set file path/id from
sweep-live-setskill output (a Drive path likeACE/_sweep/<timestamp>/live-set.yaml). mode—recommend(default) |execute. Inrecommendthe skill is report-only: diff/score/render + return the recommended-action list; 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 folder ids the human approved in chat. Trash nothing outside this set.
Products
ACE/_sweep/<timestamp>/drive-orphans.md— human-readable triage report (markdown).ACE/_sweep/<timestamp>/drive-orphans.yaml— machine-readableOrphanReport(for replay / per-item approval).- For each approved orphan: a Drive trash operation via
drive_trash_file. - For each approved open Google Form: a close via
forms_set_publish_settings(before any trash).
Process
- Read the live-set:
drive_read_fileon the path produced bysweep-live-set. Parse it as YAML into aLiveSet. - List
ACE/children:drive_list_folderonACE_DRIVE_ROOT_FOLDER_ID. Filter to folders (mimeTypeapplication/vnd.google-apps.folder) and skip names starting with_(e.g._sweep/). - Diff (opp-shape is the authority, not the name): for each folder whose name is NOT in
liveSet.oppSlugs, probe whether it is actually an opp folder before treating it as a candidate. Use the same test the live-set scan uses —isOppFolder(folderId, drive)fromlib/doctor-drive-layout.ts(true iff the folder containsopp.yamlor aninputs/subfolder). Record the result asisOppShapedon theDriveFolderInfo. A folder that is NOT opp-shaped (e.g. shared project folders likedocumentation,templates,videos,labs-ai-videos,ai-input-creation-runs,rooftop-surveys) is not an orphaned opp — the live-set only enumerates opp slugs, so a name-only diff would flag these every run. PassisOppShapedthrough so the scorer can downgrade them tolow. - Score: call
scoreDriveFolder(folder, liveSet, ACE_DRIVE_ROOT_FOLDER_ID)fromlib/sweep-fingerprint.tsfor each candidate, withfolder.isOppShapedpopulated from Step 3. The scorer returnslowfor shared/non-opp folders (safe-listed names +isOppShaped === false),highfor confirmed opp folders not in the live-set, and falls back to name-shape heuristics only whenisOppShapedis left undefined. Collect into anOrphan[]. Onlyhigh-confidence items (real orphaned opp folders) should be proposed for trashing. - Build the
OrphanReportwithsystem: 'drive',generatedAt: now ISO,liveSetGeneratedAt: liveSet.generatedAt, totals, and orphans. - Render the report via
renderOrphanReport()fromlib/sweep-report.ts.drive_create_filetoACE/_sweep/<timestamp>/drive-orphans.md. Also serialize the YAML form todrive-orphans.yamlin the same folder. - Recommend — stop here in
mode: recommend. Return the structured recommended-action list (only real orphaned opp folders —highconfidence, opp-shaped but not in the live-set — each with id, name, confidence; reversibility: 30-day Drive bin) plus 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 (seeagents/sweep.md § Human-confirmation gate).
Google Forms and ACE/_scratch
A run with google_form on (solicitation-google-form) leaves a public Google Form under its run folder. A public form keeps accepting submissions from anyone with the link until it is closed, and trashing the folder is not the same as closing it. So:
- Open forms in closed or orphaned runs. For every form (mimeType
application/vnd.google-apps.form) under a recommended folder, or under a run whosesolicitation.google_form.statusis notclosedwhile its solicitation is closed, recommend closing it:forms_set_publish_settings({ formId, isPublished: true, isAcceptingResponses: false }). The link keeps working and shows the form as closed (playbook/integrations/google-forms.md). Closing is reversible; it is still an approved action. - Close before trash. In the execute pass, close every approved form first, then trash its folder.
ACE/_scratchholds throwaway objects from live checks (Forms probes, PR5/PR5b). Step 2 skips_-prefixed folders as opp folders, so list_scratchon its own: recommend closing any form in it and trashing everything older than 24 hours.
Execute phase (mode: execute only)
Runs only when the orchestrator re-dispatches with mode: execute + approvedIds (the folder, form and _scratch item ids the human approved in chat). Close each approved form first (above). Then, for each approved orphan, call drive_trash_file with fileId: <id>. Trash nothing outside approvedIds; return the per-item result. Then (sanity check) drive_list_folder ACE/ again and confirm the trashed names are gone — this catches partial failures.
Failure modes
- Live-set path doesn't resolve: abort with a clear "Run
sweep-live-setfirst" message. drive_trash_filefails on a Shared-Drive permission error: report the item as "trash failed — needs admin"; don't retry, don't abort the rest of the batch.- An approved orphan was already deleted by something else between report and execution: treat as success.
Implementation notes for agents
- This skill must be invoked AFTER
sweep-live-setin the same/ace:sweeprun — the live-set is the safety boundary. If the live-set is more than 24 hours old, regenerate it first (active opps may have changed). - All scoring is done locally via the
lib/sweep-fingerprint.tsfunction; do not paraphrase the scoring rules into prompts.
Related skills
sweep-live-setproduces the live-set this skill diffs against.- Future:
sweep-connect,sweep-ocs,sweep-hq,sweep-labsfollow the same pattern for their respective systems.