workspace-cleanup
Skill2 starsChanged 7 months agoMITView on GitHub
Clean up workspace ops artifacts according to the standard taxonomy (`.ops/backups`, `.ops/staging`, `.ops/tmp`, `.ops/trash`, `.ops/state`) after completing a task, using safe-first mode (dry-run first, path whitelist, retention threshold).
- Deletes or force-pushes
In this repository47 other files it gives its agents.
- brainstormingSkill
- claude-code-termux-runbookSkill
- cli-patcherSkill
- code-review-workflowSkill
- commit-commandsSkill
- consulting-analysisSkill
- context7-cleanSkill
- data-analysisSkill
- deep-researchSkill
- edit-tool-compat-guardSkill
- env-managerSkill
- executing-plansSkill
- feature-devSkill
- firecrawlSkill
- frontend-designSkill
- gateway-device-pairingSkill
- githubSkill
- glibc-prebuilt-bundleSkill
- gogSkill
- image-generationSkill
- memory-setupSkill
- module-auditorSkill
- module-scaffoldSkill
- openclaw-config-guardianSkill
- openclaw-ollama-runtime-kbSkill
- plugin-cutover-guardianSkill
- plugin-runtime-guardianSkill
- python-env-managerSkill
- self-improving-agentSkill
- simplify-and-hardenSkill
- skill-benchSkill
- skill-creatorSkill
- skill-unificationSkill
- skill-vetterSkill
- socratic-groundingSkill
- subagent-orchestrationSkill
- systematic-debuggingSkill
- tailscale-oauth-bridgeSkill
- termux-packagerSkill
- termux-runnerSkill
- test-driven-developmentSkill
- vercel-deploy-claimableSkill
- verification-before-completionSkill
- video-generationSkill
- writing-plansSkill
- yt-dlp-ingest-firstSkill
- zero-downtime-cutoverSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 12 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 32
After completing a task/work session.
- Distinctive: line 33
When the workspace accumulates many old operational artifacts that need cleanup.
- Distinctive: line 34
When Boss requests storage optimization while still preserving near-term rollback capability.
- Distinctive: line 38
Do not lose important data (memory, docs, real source).
- Very specific: line 40
Do not break the standard workspace/.ops/* taxonomy.
- Distinctive: line 43
Dry-run first: always list the files/directories to be moved/purged before applying.
- Very specific: line 44
Workspace-only: do not touch anything outside /data/adb/openclaw/home/.openclaw/workspace.
- Very specific: line 45
Do not delete core memory/config: do not touch MEMORY.md, memory/, SOUL.md, USER.md, AGENTS.md, TOOLS.md.
- Distinctive: line 47
Default retention: keep recent backups (e.g. 7 days) and the latest N copies for each group.
- Very specific: line 48
Rollback-friendly: prefer moving into workspace/.ops/trash/<timestamp>/ before permanent purge.
- Distinctive: line 91
If Boss says “standard cleanup”, use the skill's default policy.
- Very specific: line 95
Write cleanup-manifest.json in workspace/.ops/state/<timestamp>/ containing the list of moved/purged files.
- Very specific: line 97
If real purge is needed, only purge workspace/.ops/trash/ beyond retention or artifacts that were explicitly approved.
- Very specific: line 119
Do not delete directly with rm -rf outside the .ops/trash flow unless there is an explicit instruction.
- Distinctive: line 120
Do not clean outside the workspace.
- Distinctive: line 121
Do not clean secrets/runtime config outside the workspace.
- Distinctive: line 122
Do not mix artifact classes in the cleanup report.
- Distinctive: line 130
If a path is outside the whitelist/workspace boundary: block and clearly state the boundary rule that was hit.
- Distinctive: line 131
If the dry-run shows the pattern/class match is too broad: stop and narrow the scope before actual deletion.
- Very specific: line 132
If moving into .ops/trash or purge fails due to permission/path race: report which files failed and keep the rest unchanged in a safe …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Workspace Cleanup
Scope
- In-scope: clean up workspace ops artifacts according to the standard taxonomy, safe-first flow, dry-run first, path whitelist, retention threshold.
- Out-of-scope: reckless hard-delete or cleanup outside the workspace safe zone.
Indexed sub-skill references (source map)
- @[SKILL.md#L1-L111] Standard frontmatter (
name,description). - @[SKILL.md#L6-L111] Workspace Cleanup.
- @[SKILL.md#L8-L111] When to use.
- @[SKILL.md#L13-L111] Objectives.
- @[SKILL.md#L18-L111] Mandatory principles.
- @[SKILL.md#L27-L111] Standard taxonomy.
- @[SKILL.md#L40-L111] Default cleanup scope.
- @[SKILL.md#L52-L111] Hard excludes.
- @[SKILL.md#L59-L111] Standard SOP.
- @[SKILL.md#L80-L111] Suggested default policy.
- @[SKILL.md#L85-L111] Report template.
- @[SKILL.md#L92-L111] Do not do.
When to use
- After completing a task/work session.
- When the workspace accumulates many old operational artifacts that need cleanup.
- When Boss requests storage optimization while still preserving near-term rollback capability.
Objectives
- Reduce technical clutter according to the correct lifecycle class.
- Do not lose important data (memory, docs, real source).
- Have before/after reports for audit.
- Do not break the standard
workspace/.ops/*taxonomy.
Mandatory principles
- Dry-run first: always list the files/directories to be moved/purged before applying.
- Workspace-only: do not touch anything outside
/data/adb/openclaw/home/.openclaw/workspace. - Do not delete core memory/config: do not touch
MEMORY.md,memory/,SOUL.md,USER.md,AGENTS.md,TOOLS.md. - Taxonomy-first: prioritize cleanup by
.ops/*class, not ad hoc namespaces. - Default retention: keep recent backups (e.g. 7 days) and the latest N copies for each group.
- Rollback-friendly: prefer moving into
workspace/.ops/trash/<timestamp>/before permanent purge.
Standard taxonomy
workspace/.ops/backups = rollback assets
workspace/.ops/staging = candidate artifacts
workspace/.ops/tmp = disposable scratch artifacts
workspace/.ops/trash = quarantined removed items
workspace/.ops/state = metadata/checkpointsDefault cleanup scope
- Disposable artifacts:
workspace/.ops/tmp/**- temp files
*.tmp,*.temp,*.swp,*.swo,*~
- Quarantined removals:
workspace/.ops/trash/**beyond retention
- Stale staging:
workspace/.ops/staging/**with no active run and beyond retention
- Rollback assets:
workspace/.ops/backups/**beyond retention or exceeding keep-count
- State artifacts:
workspace/.ops/state/**only purge when the run is closed and the metadata is no longer needed for audit
- Incomplete shadow leftovers created by profile-only attempts (for example ad hoc
~/.openclaw-<profile>homes migrated into the workspace taxonomy) should be classified explicitly, then quarantined or removed instead of being left ambiguous. - Legacy/non-canonical tmp dirs in the workspace may only be touched when Boss explicitly requests separate migration.
Hard excludes
memory/**docs/**skills/**(unless Boss requests separate cleanup)RAG/**- core platform config files in the workspace root (
AGENTS.md,SOUL.md,USER.md,MEMORY.md,TOOLS.md,HEARTBEAT.md) - artifacts that have not been mapped to a clear lifecycle class
SOP
Step 1 — Inventory (dry-run)
- Measure storage usage before cleanup.
- List candidates by lifecycle class + file age.
- Print clearly: path, class (
backups|staging|tmp|trash|state), size, mtime, reason selected.
Step 2 — Approval scope
- Lock the exact cleanup scope (class + age + how much to retain).
- If Boss says “standard cleanup”, use the skill's default policy.
Step 3 — Safe cleanup
- Move candidates into
workspace/.ops/trash/<timestamp>/if they are not already quarantined. - Write
cleanup-manifest.jsoninworkspace/.ops/state/<timestamp>/containing the list of moved/purged files. - For incomplete shadow leftovers, include original method/context if known (example:
profile-only shadow leftover,invalid-isolation) so future audits can distinguish runtime debris from normal staging. - If real purge is needed, only purge
workspace/.ops/trash/**beyond retention or artifacts that were explicitly approved.
Step 4 — Verify + report
- Compare storage usage before/after.
- Report the number of files cleaned and total reclaimed storage.
- Report what was retained according to retention + lifecycle class.
Suggested default policy
tmponly clean when older than 3 days or the run is closed.stagingonly clean when older than 7 days and no active candidate remains.backupskeep at least 3 newest rollback copies for each important group.trashpurge when older than 14 days.statekeep longer thantmp; only purge when the checkpoint no longer has audit value.
Report template
⚡ [cleanup] dry-run → 42 artifacts | 128 MB candidate
⚡ [cleanup] apply → moved 39 artifacts to .ops/trash/20260222-2230 | reclaimed 121 MB
🛡️ [WARN] kept newest rollback assets + all active staging/state artifactsDo not do
- Do not delete directly with
rm -rfoutside the.ops/trashflow unless there is an explicit instruction. - Do not clean outside the workspace.
- Do not clean secrets/runtime config outside the workspace.
- Do not mix artifact classes in the cleanup report.
Trigger Rules
- Positive: Trigger when the user request matches
workspace-cleanupper the description: Clean up workspace ops artifacts according to the standard taxonomy after completing a task, using safe-first mode (dry-run first, path whitelist, retention threshold). - Negative: Do not trigger for requests outside scope or that do not need this skill's workflow/expertise.
- Escalation: If there is external action/network write or sensitive manipulation, an approval checkpoint must be added before execution.
Error Handling
- If a path is outside the whitelist/workspace boundary: block and clearly state the boundary rule that was hit.
- If the dry-run shows the pattern/class match is too broad: stop and narrow the scope before actual deletion.
- If moving into
.ops/trashor purge fails due to permission/path race: report which files failed and keep the rest unchanged in a safe best-effort manner.
Output Contract
- Deliverable: results aligned to the objectives of
workspace-cleanup; clearly state class/path/steps performed (if any). - Validation: report
PASS/FAILstatus with the main checks that were run. - Failure mode: when errors occur, state the root cause + suggested remediation.
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.

