Problem: Files scattered between /, ~/, external drives, with no clear organization or context.
Solution: A layered approach combining XDG compliance, intelligent categorization, and external drive integration.
Purpose: Active working files, configs, and caches
~/
βββ .config/ # XDG: Application configs
βββ .local/
β βββ bin/ # User executables
β βββ share/ # Application data
β βββ state/ # Logs, history, state
βββ .cache/ # Temporary/regenerable data
β
βββ Documents/ # Active documents
βββ Projects/ # Active development work
βββ Downloads/ # Temporary incoming files
βββ Desktop/ # Working surface (keep minimal)
β
βββ Archive/ # Local archive (symlink to external)
Purpose: Archives, media libraries, backups
/Volumes/4444-iivii/ # or ~/External (symlinked)
βββ Archive/
β βββ Documents/ # Old documents by year
β βββ Projects/ # Completed projects
β βββ Media/ # Photos, videos, music
β βββ System/ # Old system backups
β
βββ Workspace/ # Development environment
β βββ toolchains/
β βββ repos/
β
βββ Library/ # Reference materials
β βββ Books/
β βββ Courses/
β βββ Documentation/
β
βββ Backups/ # Time Machine, system backups
Purpose: Tag, categorize, and find files by purpose
~/.local/share/file-context/
βββ manifests/ # File inventories
β βββ archive.yaml
β βββ projects.yaml
β βββ media.yaml
β
βββ tags/ # Tag database
β βββ tags.db # SQLite tags database
β
βββ links/ # Symlink farm by category
βββ by-type/
β βββ code/
β βββ docs/
β βββ media/
βββ by-project/
β βββ [project-name]/
βββ by-year/
βββ [2024]/
Already XDG-Compliant:
~/.config/ - Configurations (87MB)~/.local/share/chezmoi/ - Dotfiles source~/.cache/ - Cached dataNeeds Migration:
AGENTS.md, README.md, firebase-debug.log, package-lock.json~/System/ (1.9GB) - Should be in ~/.local/share/ or external~/Workspace/ (7.8GB) - Should be ~/Projects/ or ~/Documents/Projects/# Configs (already good)
~/.config/ # App configurations
βββ chezmoi/
βββ gh/
βββ kitty/
βββ ...
# Data (consolidate here)
~/.local/share/ # Application data
βββ chezmoi/ # Dotfiles (current)
βββ file-context/ # NEW: File organization metadata
βββ projects/ # NEW: Symlinks to active projects
βββ ...
# State (logs, history)
~/.local/state/ # Persistent state
βββ command-history/
βββ logs/
βββ ...
# Cache (regenerable)
~/.cache/ # Temporary cached data
βββ pip/
βββ npm/
βββ ...
# User directories (visible, active)
~/Documents/ # Active documents
~/Projects/ # Active development (was Workspace)
~/Downloads/ # Temporary incoming
~/Desktop/ # Working surface
~/Pictures/ # Active photos
~/Music/ # Active music
Current issue in your .zshrc:
export PATH=$PATH:/Volumes/4444-iivii/ivi374forivi3ivi3/toolchains/bin
What breaks:
# In .zshrc.tmpl
# External toolchains (if available)
if [ -d "/Volumes/4444-iivii/ivi374forivi3ivi3/toolchains/bin" ]; then
export PATH="$PATH:/Volumes/4444-iivii/ivi374forivi3ivi3/toolchains/bin"
fi
Create stable symlinks in your home directory:
# One-time setup
ln -s /Volumes/4444-iivii ~/External
ln -s ~/External/ivi374forivi3ivi3/workspace ~/Projects/External
ln -s ~/External/ivi374forivi3ivi3/toolchains ~/.local/share/toolchains
# In .zshrc.tmpl
if [ -d "$HOME/.local/share/toolchains/bin" ]; then
export PATH="$PATH:$HOME/.local/share/toolchains/bin"
fi
Benefits:
# In ~/.config/environment (sourced by .zshrc)
export EXTERNAL_DRIVE="/Volumes/4444-iivii"
export WORKSPACE="$EXTERNAL_DRIVE/ivi374forivi3ivi3/workspace"
export TOOLCHAINS="$EXTERNAL_DRIVE/ivi374forivi3ivi3/toolchains"
# Then use variables
[ -d "$TOOLCHAINS/bin" ] && export PATH="$PATH:$TOOLCHAINS/bin"
Files need context:
# ~/.local/share/file-context/manifests/projects.yaml
projects:
active:
- name: "domus-semper-palingenesis"
path: "~/Documents/domus-semper-palingenesis"
external_backup: "~/External/Archive/domus-semper-palingenesis"
type: "configuration"
tags: ["system", "critical", "synced"]
- name: "ivi374forivi3ivi3"
path: "~/External/ivi374forivi3ivi3/workspace"
symlink: "~/Projects/ivi374"
type: "development"
tags: ["work", "external", "large"]
archived:
- name: "old-project-2023"
path: "~/External/Archive/Projects/2023/old-project"
archived_date: "2023-12-01"
tags: ["archived", "reference"]
Install tmsu (tag manager for Unix):
brew install tmsu
# Initialize
tmsu init
# Tag files
tmsu tag ~/Documents/important-doc.pdf important work active
tmsu tag ~/Pictures/vacation-2024/ personal photos 2024
# Query by tags
tmsu files important work
tmsu files photos 2024
Auto-organize files by creating categorized symlinks:
# ~/.local/share/file-context/links/by-type/
~/. local/share/file-context/links/
βββ by-type/
β βββ code/
β β βββ domus-semper-palingenesis -> ~/Documents/domus-semper-palingenesis
β β βββ ivi374 -> ~/External/workspace
β βββ docs/
β β βββ important -> ~/Documents/Work/Important/
β βββ media/
β βββ photos-2024 -> ~/Pictures/2024/
βββ by-project/
β βββ ivi374/
β βββ workspace -> ~/External/workspace
β βββ toolchains -> ~/External/toolchains
βββ by-status/
βββ active/
βββ archived/
organize-cli (Python)pip install organize-tool
# Create rules in ~/.config/organize/config.yaml
rules:
- name: "Clean Downloads"
locations:
- ~/Downloads/
filters:
- extension: [pdf, epub]
- created: {days: 7}
actions:
- move: ~/Documents/Reading/{created.year}/
- name: "Archive Old Projects"
locations:
- ~/Projects/
filters:
- lastmodified: {days: 90}
actions:
- echo: "Consider archiving {path}"
rmlint (Deduplication)brew install rmlint
# Find duplicates
rmlint ~/Documents ~/External/Archive
# Remove duplicates (careful!)
# rmlint creates a shell script you can review first
sh rmlint.sh -d # dry run
# ~/.local/bin/file-context
#!/bin/bash
case "$1" in
index)
# Index all files and create manifest
;;
find)
# Find files by tag or purpose
;;
archive)
# Move file to archive with metadata
;;
link)
# Create symlinks in categorized folders
;;
esac
# Add symlinks to chezmoi
chezmoi add --follow=false ~/.local/share/toolchains
# This creates a .chezmoi.symlink file
# ~/.local/share/chezmoi/private_dot_local/share/symlink_toolchains.tmpl
/Volumes/4444-iivii/ivi374forivi3ivi3/toolchains
# ~/.local/share/chezmoi/.chezmoiscripts/run_once_setup_structure.sh
#!/bin/bash
# Create XDG directories
mkdir -p ~/.config
mkdir -p ~/.local/{bin,share,state}
mkdir -p ~/.cache
# Create project structure
mkdir -p ~/Projects/{Active,Archive}
mkdir -p ~/Documents/{Work,Personal,Archive}
# Create context system
mkdir -p ~/.local/share/file-context/{manifests,tags,links}
mkdir -p ~/.local/share/file-context/links/{by-type,by-project,by-year}
# Create symlinks if external drive mounted
if [ -d "/Volumes/4444-iivii" ]; then
ln -sf /Volumes/4444-iivii ~/External
ln -sf ~/External/ivi374forivi3ivi3/workspace ~/Projects/ivi374
ln -sf ~/External/ivi374forivi3ivi3/toolchains ~/.local/share/toolchains
fi
# 1. List all root-level files in home
ls -la ~/ | grep -v "^d" > ~/file-inventory.txt
# 2. Identify large directories
du -sh ~/* | sort -hr > ~/directory-sizes.txt
# 3. Find duplicates
rmlint ~/ --size 1M > ~/duplicates.txt
Move scattered files to proper locations:
# Root-level files
AGENTS.md β ~/Documents/Notes/AGENTS.md
README.md β ~/Projects/[project]/README.md (or delete if from chezmoi)
firebase-debug.log β ~/.local/state/firebase/debug.log (or delete)
package-lock.json β ~/Projects/[project]/package-lock.json
# System folder
~/System/ β ~/External/Archive/System/ (or ~/.local/share/system/)
# Workspace
~/Workspace/ β ~/Projects/ (rename for clarity)
# Create the new organization
mkdir -p ~/Projects/{Active,Archive}
mkdir -p ~/Documents/{Work,Personal,Archive,Notes}
mkdir -p ~/.local/share/file-context/{manifests,links}
# Move active projects
mv ~/Workspace/active-project ~/Projects/Active/
# Archive old projects
mv ~/Workspace/old-project ~/External/Archive/Projects/2023/
# Create stable external drive symlink
ln -s /Volumes/4444-iivii ~/External
# Link active external projects to local
ln -s ~/External/ivi374forivi3ivi3/workspace ~/Projects/ivi374
# Link toolchains
ln -s ~/External/ivi374forivi3ivi3/toolchains ~/.local/share/toolchains
# Add directory creation script
chezmoi add --template ~/.zshrc # Already done
chezmoi add --follow=false ~/.local/share/toolchains # Add symlink
# Create setup script
cat > ~/.local/share/chezmoi/.chezmoiscripts/run_once_setup_structure.sh <<'EOF'
#!/bin/bash
# Setup directory structure
mkdir -p ~/Projects/{Active,Archive}
mkdir -p ~/.local/share/file-context
# ... etc
EOF
chmod +x ~/.local/share/chezmoi/.chezmoiscripts/run_once_setup_structure.sh
chezmoi add ~/.chezmoiscripts/run_once_setup_structure.sh
~/
βββ AGENTS.md # β What is this?
βββ Workspace/ # β Mixed active/old projects
βββ System/ # β 1.9GB of what?
βββ package-lock.json # β Why in root?
βββ /Volumes/4444-iivii/... # β Hardcoded paths break
~/
βββ .config/ # β
Configurations
βββ .local/
β βββ bin/ # β
User executables
β βββ share/
β β βββ file-context/ # β
Organization metadata
β β βββ toolchains/ β # β
Symlink to external
β βββ state/ # β
Logs and state
β
βββ Projects/
β βββ Active/ # β
Current work
β β βββ my-app/
β βββ ivi374 β # β
Symlink to external
β βββ Archive/ # β
Old projects
β
βββ Documents/
β βββ Work/
β βββ Personal/
β βββ Notes/
β β βββ AGENTS.md # β
Found it!
β βββ Archive/
β
βββ External β # β
Stable symlink
βββ /Volumes/4444-iivii/
Remember: Perfect organization is the enemy of good organization. Start with the critical paths (external drives, PATH variables), then gradually improve the rest.