Help users intelligently organize cluttered directories such as the desktop and Downloads folder: classify by semantics, remove duplicates, and archive old files.
Use Cases
- The user says "My desktop is too messy, help me organize it" or "Clean up the Downloads folder"
- The user says "Classify files by project/type" or "Archive old files"
- The user says "Find duplicate files" or "Clean up unnecessary temporary files"
Execution Method
Accomplished through bash commands + LLM semantic judgment. First scan the directory, then have the LLM analyze the purpose and classification of each file, and finally perform the organization.
Step 1: Scan the directory
# 列出目标目录的文件(含大小和修改日期)
ls -lhS ~/Desktop/ | head -50
ls -lhS ~/Downloads/ | head -50
Step 2: LLM semantic classification
Based on file name, extension, and modification date, classify files into the following categories:
| Category | Typical Files | Target Folder |
|---|---|---|
| Documents | .pdf, .docx, .xlsx, .pptx | ~/Documents/Organized/ |
| Images | .png, .jpg, .gif, .svg | ~/Pictures/Organized/ |
| Archives | .zip, .tar.gz, .rar | ~/Documents/Archives/ |
| Installers | .dmg, .exe, .pkg | Clean up or archive |
| Temp | .tmp, .crdownload, partial | Delete directly |
Step 3: Perform organization
# 创建分类目录
mkdir -p ~/Documents/Organized ~/Pictures/Organized ~/Documents/Archives
# 移动文件(示例)
mv ~/Desktop/*.pdf ~/Documents/Organized/
mv ~/Desktop/*.png ~/Pictures/Organized/
Step 4: Find duplicate files
# 按 MD5 查找重复文件
find ~/Downloads -type f -exec md5sum {} + | sort | uniq -w32 -dD
Step 5: Archive old files
# 找出 90 天未修改的文件
find ~/Desktop -type f -mtime +90 -not -name ".*"
Safety Rules
- Do not automatically delete any files: only move and archive; deletion must be confirmed with the HITL tool beforehand
- Prefer moving to the trash: on macOS use
trash, avoidrm - Show the plan before operating: first list the classification plan for the user to confirm, then execute
- Skip hidden files: do not organize files starting with
.file starting with - Skip system files: do not operate on paths such as /System, /Library
Output Specifications
- First show the organization plan (which files move where)
- After execution, report: moved X files, freed Y MB of space
- Remind the user to check the archived contents