| name | organize-files |
| category | thai-operations |
| version | 1.0.0 |
| description | Classify, rename, and organize files based on content with approval gate. |
| risk_level | high |
| output_type | markdown, csv |
Organize Files Skill
Purpose
Create safe content-aware file organization plan.
Use When
- User wants to organize Downloads/Inbox/scanned files
- User wants to rename or move many files
- User wants to archive old project folders
Required Inputs
- Source folder
- Target folder structure
- Rename rules
Workflow
- Require the
organize-files discovery manifest; the Demo profile is plan-only and never authorizes execution.
- Inventory files.
- Read metadata/content where possible.
- Classify file type; low-confidence items go to the exception list instead of a forced guess.
- Propose new path and filename.
- Create mapping table and machine-readable
plan.json ({"operations": [{"op", "old", "new", "approved": false}]} — format in .thclaws/hooks/scripts/verify_file_plan.py).
- Ask approval (Approval Gate message — see
.thclaws/hooks/approval-gate.md).
- Wait for the owner's approval record. The move/rename tool call is structurally blocked by the
approval_gate.py PreToolUse hook until the owner runs approve.py in their own terminal (record lands in .thclaws/approvals/approvals.json with a 15-min TTL). The agent cannot write that ledger — do not attempt the operation before the owner has approved.
- Pre-check: mark approved rows
"approved": true in plan.json, then run python3 .thclaws/hooks/scripts/verify_file_plan.py --pre plan.json. FAIL → fix the plan; do not execute.
- Execute only the approved subset of the mapping table. If the user amends or rejects part of it, redo steps 4–6 for that subset only (cap: 1 round) rather than re-planning everything.
- Post-check: run
verify_file_plan.py --post plan.json — approved rows executed exactly, unapproved rows untouched. FAIL = hard exception: report to the owner, do not continue.
- Create log (including pre/post-check results).
Output Contract
- file inventory
- proposed classification
- rename/move mapping (table +
plan.json)
- exception list
- operation log with pre/post verification results
Risk Control
- Do not execute without approval — enforced by the approval-gate hook, not just instruction.
- Never delete source files by default.