agentleFS
thoitiettxl-cyberthoitiettxl-cyber/Claw-II/skills/workspace-cleanup/SKILL.md

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

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
  1. Distinctive:

    After completing a task/work session.

    line 32
  2. Distinctive:

    When the workspace accumulates many old operational artifacts that need cleanup.

    line 33
  3. Distinctive:

    When Boss requests storage optimization while still preserving near-term rollback capability.

    line 34
  4. Distinctive:

    Do not lose important data (memory, docs, real source).

    line 38
  5. Very specific:

    Do not break the standard workspace/.ops/* taxonomy.

    line 40
  6. Distinctive:

    Dry-run first: always list the files/directories to be moved/purged before applying.

    line 43
  7. Very specific:

    Workspace-only: do not touch anything outside /data/adb/openclaw/home/.openclaw/workspace.

    line 44
  8. Very specific:

    Do not delete core memory/config: do not touch MEMORY.md, memory/, SOUL.md, USER.md, AGENTS.md, TOOLS.md.

    line 45
  9. Distinctive:

    Default retention: keep recent backups (e.g. 7 days) and the latest N copies for each group.

    line 47
  10. Very specific:

    Rollback-friendly: prefer moving into workspace/.ops/trash/<timestamp>/ before permanent purge.

    line 48
  11. Distinctive:

    If Boss says “standard cleanup”, use the skill's default policy.

    line 91
  12. Very specific:

    Write cleanup-manifest.json in workspace/.ops/state/<timestamp>/ containing the list of moved/purged files.

    line 95
  13. Very specific:

    If real purge is needed, only purge workspace/.ops/trash/ beyond retention or artifacts that were explicitly approved.

    line 97
  14. Very specific:

    Do not delete directly with rm -rf outside the .ops/trash flow unless there is an explicit instruction.

    line 119
  15. Distinctive:

    Do not clean outside the workspace.

    line 120
  16. Distinctive:

    Do not clean secrets/runtime config outside the workspace.

    line 121
  17. Distinctive:

    Do not mix artifact classes in the cleanup report.

    line 122
  18. Distinctive:

    If a path is outside the whitelist/workspace boundary: block and clearly state the boundary rule that was hit.

    line 130
  19. Distinctive:

    If the dry-run shows the pattern/class match is too broad: stop and narrow the scope before actual deletion.

    line 131
  20. Very specific:

    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 …

    line 132

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Reduce technical clutter according to the correct lifecycle class.
  2. Do not lose important data (memory, docs, real source).
  3. Have before/after reports for audit.
  4. Do not break the standard workspace/.ops/* taxonomy.

Mandatory principles

  1. Dry-run first: always list the files/directories to be moved/purged before applying.
  2. Workspace-only: do not touch anything outside /data/adb/openclaw/home/.openclaw/workspace.
  3. Do not delete core memory/config: do not touch MEMORY.md, memory/, SOUL.md, USER.md, AGENTS.md, TOOLS.md.
  4. Taxonomy-first: prioritize cleanup by .ops/* class, not ad hoc namespaces.
  5. Default retention: keep recent backups (e.g. 7 days) and the latest N copies for each group.
  6. 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/checkpoints

Default 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.json in workspace/.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

  • tmp only clean when older than 3 days or the run is closed.
  • staging only clean when older than 7 days and no active candidate remains.
  • backups keep at least 3 newest rollback copies for each important group.
  • trash purge when older than 14 days.
  • state keep longer than tmp; 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 artifacts

Do not do

  • Do not delete directly with rm -rf outside the .ops/trash flow 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-cleanup per 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/trash or 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/FAIL status with the main checks that were run.
  • Failure mode: when errors occur, state the root cause + suggested remediation.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.