home / skills / openclaw / skills / file-cleaner

file-cleaner skill

/skills/autogame-17/file-cleaner

This skill safely removes temporary files and directories within temp/, logs/, and cache/ to free space while guarding critical workspace.

npx playbooks add skill openclaw/skills --skill file-cleaner

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
863 B
---
name: file-cleaner
description: A specialized skill for safely cleaning up temporary files and directories. Use this when you need to remove temp files, clear caches, or delete logs to free up space or maintain hygiene. Restricted to 'temp/', 'logs/', and 'cache/' directories for safety.
---

# File Cleaner

Safely removes files and directories. Built with strict safety checks to prevent accidental deletion of critical workspace files.

## Usage

```bash
node skills/file-cleaner/index.js <path>
```

## Examples

Clean a specific temp directory:
```bash
node skills/file-cleaner/index.js temp/my-experiment
```

Clean a log file:
```bash
node skills/file-cleaner/index.js logs/debug.log
```

## Safety

- ONLY deletes paths starting with `temp/`, `logs/`, or `cache/`.
- Will block attempts to delete workspace root, `skills/`, or other protected paths.

Overview

This skill safely cleans temporary files, caches, and logs to free disk space and maintain workspace hygiene. It enforces strict path restrictions so only items under temp/, logs/, or cache/ can be removed. Designed for automated maintenance or ad-hoc cleanup tasks, it prevents accidental deletion of critical workspace files.

How this skill works

The skill inspects the target path and verifies it begins with one of the allowed prefixes: temp/, logs/, or cache/. It blocks any request that targets the workspace root, the skills/ directory, or other protected paths. When a path passes validation the skill deletes files or directories under that path and reports the result.

When to use it

  • Free up disk space by removing old temporary experiment folders under temp/
  • Clear application cache directories under cache/ to force a fresh build or reload
  • Remove rotated or verbose logs inside logs/ to reduce storage usage
  • Automated cleanup jobs that must avoid touching project source or configuration files
  • Ad-hoc housekeeping before creating backups or packaging artifacts

Best practices

  • Always target the most specific path possible (e.g., temp/run-123) to avoid broad deletions
  • Run a dry-check or list operation before deletion when available to confirm contents
  • Integrate into scheduled maintenance with conservative retention policies
  • Keep critical artifacts outside temp/, logs/, and cache/ to ensure protection
  • Monitor disk usage and log deletion actions for audit and recovery planning

Example use cases

  • Remove a completed experiment folder: temp/my-experiment
  • Clear a stale cache to resolve corrupt state: cache/build-cache
  • Trim large log files after a debugging session: logs/debug.log
  • Periodic CI cleanup to remove temp artifacts between runs
  • Pre-backup cleanup to exclude transient files and reduce backup size

FAQ

Can this skill delete files outside temp/, logs/, or cache/?

No. It only allows paths starting with temp/, logs/, or cache/ and will block protected directories like the workspace root and skills/.

Is there a dry-run or preview mode?

Prefer listing target contents before deletion. If a dry-run option is available in your integration, use it to verify what will be removed.