Install
openclaw skills install @jlacroix82/smart-filesContent-aware file management for OpenClaw agents. Search files by content (not just names), find duplicates by hash, auto-categorize by type, detect file types, analyze cleanup needs, and rename with context. Zero dependencies.
openclaw skills install @jlacroix82/smart-filesStop guessing where files are. Find them by what they contain.
Agent file operations are blind. find . -name "*.js" only matches filenames. grep only searches text. No tool connects what you're looking for to what's actually inside the files.
Smart Files fixes this with one tool, zero dependencies.
node skills/smart-files/smart-files.js --search "database connection"
Searches across all files in the workspace, not just filenames. Returns matches ranked by relevance with sanitized snippets.
⚠️ Privacy Note: Search returns content snippets. Sensitive patterns (API keys, tokens, passwords) are automatically redacted, but this is a best-effort filter. Do not trust content search on directories containing secrets.
node skills/smart-files/smart-files.js --dedup
Finds duplicate files by SHA-256 hash. Groups them with file sizes and paths.
node skills/smart-files/smart-files.js --organize /path/to/dir
Categorizes files into: code, data, docs, media, archives, images, other. Read-only — never modifies files.
node skills/smart-files/smart-files.js --info /path/to/file
Shows size, type, lines, words, modified date, and auto-detected content type.
node skills/smart-files/smart-files.js --cleanup /path/to/dir
Finds temp files, large files (>1MB), and duplicate groups.
node skills/smart-files/smart-files.js --status
Total files, total size, extension breakdown, largest files.
node skills/smart-files/smart-files.js --rename script.js app.js
Rename preview. Shows what would change without modifying.
# Dry-run preview (DEFAULT — safe, no files modified)
node skills/smart-files/smart-files.js --watch /path/to/dir
# Actually move/organize files (DESTRUCTIVE)
node skills/smart-files/smart-files.js --watch /path/to/dir --force
⚠️ Watch mode is DRY-RUN by default. It shows what would change without touching files. Use --force explicitly to enable destructive operations (move, rename, delete). --force includes a 5-second abort window.
Watch mode behavior (with --force):
fs.watch (fallback: polling)⚠️ Watch mode is inherently destructive with --force:
--dry-run first to preview what would changeCustom rules via .smart-files-rules.json in the watched directory:
[
{ "exts": [".js", ".ts"], "category": "Scripts" },
{ "exts": [".py", ".rb"], "category": "Scripts" },
{ "exts": [".jpg", ".png"], "category": "Images" }
]
Actions are journaled to memory/smart-files-journal.json.
fs.watch + polling fallback--force.smart-files-rules.json--force is usedNo config needed. Works out of the box.
Override workspace root:
--dir /path/to/workspace
Environment variables:
SMART_FILES_WORKSPACE — Override workspace root directoryWhen the agent needs file operations:
--search <query> instead of find or grep--cleanup to identify what to remove--dedup to find duplicates first--info to get metadata and type--organize to categorize a directory (read-only)--watch --dry-run first, only use --force after previewing| Protection | Details |
|---|---|
| Read-only by default | All modes except --watch --force never modify files |
| Binary detection | Null-byte check + binary extension filter |
| Oversized file skip | Configurable MAX_SCAN_SIZE (10MB default) |
| No shell execution | Pure Node.js fs ops — no child_process |
| Snippet sanitization | API keys, tokens, PEM keys automatically redacted from search output |
| Workspace path awareness | Detects and warns when scanning outside workspace |
| Watch safety gate | --watch defaults to dry-run; --force has 5-second abort window |
⚠️ Privacy Warning: Content search reads file contents and returns snippets. Even with automatic redaction, this is a best-effort filter — not a security boundary. Do not run --search on directories containing secrets, credentials, or personal data you don't want exposed in terminal output or agent context.
⚠️ Watch Mode Warning: --watch --force is destructive. It copies, moves, and deletes files. Always preview with --dry-run first. The journal provides an audit trail but is NOT a backup — there is no automatic rollback.
| Tool | What it searches | Safety | Setup |
|---|---|---|---|
find | Filenames only | Read-only | None |
grep | Text content | Read-only | None |
| Smart Files | Content + metadata + organize | Read-only default | None |
| ripgrep | Text content | Read-only | Install |
| fd | Filenames | Read-only | Install |
Smart Files gives you content-aware search + dedup + cleanup + metadata in one tool.
--force watch mode