Function Description
Help users sort out messy folders, classify by ownership, unify naming, clean up redundancy, and make the directory structure clear at a glance.
/organize→ Organize the current working directory/organize [路径]→ Organize a specified directory
Workflow
Step 1: Scan the overall picture
ls -laView all files and folders in the root directory (including hidden files)- Expand subdirectories by one level to understand their contents
- Record the total number of files, total number of directories, and number of scattered files
Points of attention:
- Files scattered in the root directory (not placed into any subdirectory)
- Directories with inconsistent naming styles (e.g., some with prefixes and some without)
- Hidden directories/files (determine whether they are tool artifacts or user files)
- Files suspected to be duplicates (compare similarly named files using md5)
Step 2: Analyze ownership
Classify all files and directories byowner. Common ownership dimensions:
- By owner: client's / internal / personal
- By type: document / code / design / data / media
- By status: active / archived / deletable
Classification principles:
- Prioritize classification by owner; keep things belonging to the same owner together
- Do not touch directory structures that are already well organized (such as clearly organized subdirectories)
- Temporary files/caches/logs generated by tools should be classified as "cleanable"
Criteria for determining "cleanable":
- Hidden directories containing only .DS_Store or log files
- Cache/temporary directories generated by tool runs (such as .playwright-mcp, node_modules, etc.)
- Intermediate artifacts from evaluation/debugging that no longer have subsequent use value
- The older copy among duplicate files (only counted as a duplicate after confirmation by md5)
Step 3: Formulate a plan
Output an organization plan, including:
- Target structure: display the organized directory structure with a tree diagram
- Operation checklist:
- Which directories to create
- Which files/directories to move and where
- Which directories/files to rename
- Which can be deleted
- Parts left untouched: clearly specify which remain unchanged and why
Plan format:
整理后结构:
目标目录/
├── 分类A/
│ ├── ...
├── 分类B/
│ ├── ...
└── 保留不动的/
操作清单:
- [新建] 分类A/
- [移动] xxx → 分类A/xxx
- [重命名] yyy → zzz(统一命名风格)
- [删除] .cache/(工具缓存,无保留价值)
- [不动] 保留不动的/(已有结构,无需调整)
Step 4: Execute after confirmation
Must wait for user confirmation before executing. The user may:
- Agree to all → execute directly
- Partial adjustments → execute according to the adjusted plan
- Only clean up without classifying → execute only the deletion part
Execution order:
- First create directories
- Then move files (move files with no dependencies in parallel)
- Then rename
- Finally delete
- After execution,
ls -laverify the results
Step 5: Show results
Output the organized directory tree, marking the changes.
Core Principles
1. Sort by ownership, not by format
"Client A's Proposal.pptx" should be placed under 客户A/ , not under PPT/ . Ownership matters more than format.
2. Confirm before acting, don't make decisions on your own
The organization plan must be shown to the user and confirmed before execution. This is especially true for deletion operations—better to ask one extra question.
3. Unify naming style
The naming style of directories at the same level must be consistent:
- Either all have prefixes, or none do
- Either all use Chinese, or all use English
- Unify the date format
4. Don't touch existing structures
If a subdirectory is already well organized internally, don't break it apart and reorganize it. The goal of organizing is a clear root directory, not the pursuit of perfect symmetry.
5. Verify suspected duplicates first
Similar file names do not mean identical content. They must be compared and confirmed with md5 before being judged as duplicates.
6. Handle hidden files with caution
Directories starting with . may be tool configurations (such as .claude, .git); do not move or delete them casually. Only clean up those that are clearly caches/logs.