CLI-based file classification and organization
Automatically categorizes and organizes files using a flow-based methodology
Requirements: Only uv needs to be installed on your system.
mkdir -p ~/.local/bin && curl -sSL https://raw.githubusercontent.com/jctosta/flowsort/main/flowsort.py -o ~/.local/bin/flowsort && chmod +x ~/.local/bin/flowsort# Initialize FlowSort
flowsort init
# Collect files from Downloads
flowsort collect
# Check status
flowsort statusHow it works: The script uses uv's inline script capabilities - no manual dependency installation needed! uv automatically handles everything in an isolated environment.
Need help? Most Linux distributions include ~/.local/bin in PATH by default. If flowsort isn't found, add export PATH="$HOME/.local/bin:$PATH" to your shell profile.
- Overview
- Core Philosophy
- File Flow Methodology
- Directory Structure
- Classification System
- Tagging System
- Usage Guide
- Configuration
- Time-Based Rules
- Architecture
- Advanced Features
- Best Practices
FlowSort is a digital life organization system that automatically manages file classification and organization using a flow-based methodology. It's designed to keep your digital workspace clean and organized with minimal manual intervention.
- Zero Data Loss: Files are never deleted, only moved and archived
- Automated Classification: Intelligent file categorization with minimal user input
- Flow-Based Organization: Files flow through stages (Downloads → INBOX → DOCUMENTS → ARCHIVE)
- Symlink-Based Categories: Single source of truth with categorized views via symlinks
- Time-Based Management: Automatic archival based on file age and access patterns
FlowSort treats file organization like water flowing through a river system:
Downloads (Collection Point)
↓
INBOX (Classification & Temporary Storage)
↓
DOCUMENTS (Active Work Area)
↓
ARCHIVE (Long-term Storage)
- Single Source of Truth: Each file exists exactly once in an
/all/folder - Multiple Views: Symlinks provide categorized views without file duplication
- Gradual Organization: Files naturally flow from chaotic to organized states
- Minimal Friction: System works automatically with optional manual intervention
- Reversible Actions: All operations can be undone or corrected
Source: Downloads folder (or any scattered files)
Destination: INBOX/all/
Process:
- Files are moved from Downloads to INBOX/all
- Automatic classification creates symlinks in category folders
- No manual sorting required
Location: INBOX/
Process:
- Heuristic classification based on file extensions and MIME types
- Future LLM integration for content-based classification
- Manual reclassification available for edge cases
Transition: INBOX/all/ → DOCUMENTS/all/
Trigger: Files accessed within classification period (default: 7 days)
Purpose: Active working files remain easily accessible
Transition: DOCUMENTS/all/ → ARCHIVE/all/
Triggers:
- Files not accessed for extended period (default: 30 days)
- Files remaining in INBOX too long (default: 90 days) Purpose: Long-term storage with organized retrieval
~/
├── INBOX/ # Temporary classification area
├── DOCUMENTS/ # Active working files
├── ARCHIVE/ # Long-term storage
└── SYSTEM/ # FlowSort scripts and configs
Each main directory follows the same pattern:
INBOX/
├── all/ # Real files live here
│ ├── document1.pdf
│ ├── image1.jpg
│ └── video1.mp4
├── documents/ # Symlinks to classified files
│ └── document1.pdf -> ../all/document1.pdf
├── images/
│ └── image1.jpg -> ../all/image1.jpg
├── media/
│ └── video1.mp4 -> ../all/video1.mp4
├── archives/
├── packages/
├── code/
├── spreadsheets/
├── presentations/
└── misc/ # Unclassified items
ARCHIVE/
├── all/ # All archived files
├── by-date/ # Organized by archival date
│ ├── 2025/
│ │ ├── january/
│ │ ├── february/
│ │ └── ...
│ └── 2024/
├── by-type/ # Organized by file type
│ ├── documents/
│ ├── images/
│ └── media/
└── from-downloads/ # Bulk moves from Downloads
Primary classification method using:
documents: .pdf, .doc, .docx, .txt, .odt, .rtf, .md
images: .jpg, .jpeg, .png, .gif, .svg, .bmp, .tiff
archives: .zip, .tar, .gz, .rar, .7z, .xz, .bz2
media: .mp4, .avi, .mkv, .mov, .mp3, .wav, .flac
packages: .deb, .rpm, .appimage, .snap, .flatpak
code: .py, .js, .html, .css, .json, .xml, .yml, .yaml
spreadsheets: .xls, .xlsx, .csv, .ods
presentations: .ppt, .pptx, .odp
text/*→ documentsimage/*→ imagesvideo/*oraudio/*→ mediaapplication/pdf→ documents- Archives by content type → archives
- 0.9: Direct extension match
- 0.6: MIME type fallback
- 0.8: Future LLM classification
Planned enhancement for content-based classification:
- Document content analysis
- Image recognition
- Contextual understanding
- Learning from user corrections
FlowSort includes a powerful xattr-based tagging system that stores metadata directly in file extended attributes, providing seamless integration with desktop environments like KDE, GNOME, and others.
- Cross-Platform Compatibility: Works on Linux, macOS, and modern Windows filesystems
- Desktop Integration: Compatible with KDE Dolphin, GNOME Files, and other file managers
- Dual Namespace Support: Supports both FlowSort tags and XDG standard tags
- Automatic Tagging: Files automatically get tagged with their categories
- Custom Tags: Add your own tags for better organization
- Metadata Preservation: Tags persist when files are moved or copied
FlowSort supports the freedesktop.org XDG tags standard (user.xdg.tags), ensuring compatibility with desktop environments:
- KDE Dolphin: Tags appear in the file properties and can be edited
- GNOME Files: Tags visible in file metadata
- Other File Managers: Any tool supporting XDG tags works seamlessly
# FlowSort namespace (internal metadata)
user.flowsort.category # File category (images, documents, etc.)
user.flowsort.confidence # Classification confidence score
user.flowsort.tags # FlowSort custom tags
# XDG namespace (desktop standard)
user.xdg.tags # Standard tags visible to desktop environments# Show all tags for a file
flowsort tags /path/to/file.pdf
# Show complete metadata
flowsort tags /path/to/file.pdf --metadata
# List tags only
flowsort tags /path/to/file.pdf --list# Add single tag
flowsort tags /path/to/file.pdf --add "important"
# Add multiple tags
flowsort tags /path/to/file.pdf --add "work,project,draft"
# Tags are automatically merged with existing ones
flowsort tags /path/to/file.pdf --add "final"# Remove specific tags
flowsort tags /path/to/file.pdf --remove "draft,old"
# Clear all FlowSort tags (including XDG tags)
flowsort tags /path/to/file.pdf --clear# Re-apply automatic category tags to a single file
flowsort retag --path /path/to/file.pdf --force
# Re-tag entire directory
flowsort retag --path /path/to/directory --recursive --force
# Re-tag all files in INBOX
flowsort retag --recursive --force
# Dry run to see what would be tagged
flowsort retag --path /path/to/directory --recursive --dry-run# Show recent files in INBOX with their tags
flowsort recent --location inbox --count 10 --tags
# Show recent files in DOCUMENTS
flowsort recent --location documents --count 5 --tags
# Show recent files without tag information
flowsort recent --location archive --count 20 --no-tags# Enable/disable tagging system
flowsort config --enable-tagging
flowsort config --disable-tagging
# Enable/disable automatic category tagging
flowsort config --auto-tag
flowsort config --no-auto-tag
# Enable/disable XDG compatibility
flowsort config --xdg-compat
flowsort config --no-xdg-compat
# Choose preferred namespace for writing tags
flowsort config --prefer-xdg # Write to XDG namespace first
flowsort config --prefer-flowsort # Write to FlowSort namespace only
# Control tag preservation behavior
flowsort config --preserve-tags # Merge with existing tags (default)
flowsort config --replace-tags # Replace existing tagsflowsort config --showSample output:
┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Setting ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Enable Tagging │ ✓ │
│ Auto Tag Categories │ ✓ │
│ XDG Compatibility │ ✓ │
│ Prefer XDG Tags │ ✓ │
│ Preserve Existing Tags │ ✓ │
│ Tag Namespace │ user.flowsort │
└────────────────────────┴────────────────────────────────────────┘
# Tag files for a specific project
flowsort tags project_file.pdf --add "project-alpha,client-work,priority"
# Find all project files using desktop search
# (KDE: search for tag "project-alpha" in Dolphin)# Mark files by workflow state
flowsort tags document.pdf --add "review-needed"
flowsort tags document.pdf --add "approved" --remove "review-needed"
flowsort tags document.pdf --add "archived" --remove "approved"# Tag files for team collaboration
flowsort tags report.pdf --add "shared,team-review,deadline-friday"
# Tags are preserved when files are shared via network drives- Viewing Tags: Right-click file → Properties → Details tab
- Editing Tags: Dolphin's tag panel shows FlowSort tags
- Searching: Use Dolphin's search to find tagged files
- Adding Tags: Tags added in Dolphin appear in FlowSort
- Viewing Tags: Right-click file → Properties → Details
- Custom Tags: Use FlowSort commands for advanced tagging
# View all xattrs on a file
getfattr -d /path/to/file.pdf
# Example output:
# user.flowsort.category="documents"
# user.flowsort.confidence="0.9"
# user.xdg.tags="project-alpha,important,documents"# Re-tag all files to ensure XDG compatibility
flowsort retag --recursive --force
# This updates files to current tagging standards- Tags are stored in file metadata, not separate databases
- Tags are preserved during file copies and moves
- Standard backup tools preserve extended attributes
- Cloud storage may or may not preserve xattrs (varies by service)
Tags Not Visible in Desktop:
# Check if XDG compatibility is enabled
flowsort config --show | grep "XDG Compatibility"
# Enable XDG compatibility if needed
flowsort config --xdg-compatTags Not Being Set:
# Check if tagging is enabled
flowsort config --show | grep "Enable Tagging"
# Re-tag files to apply current settings
flowsort retag --path /path/to/file --forceFilesystem Compatibility:
# Test if filesystem supports extended attributes
flowsort tags test_file.txt --add "test-tag"
# If this fails, the filesystem doesn't support xattrs- Extended attributes have minimal performance impact
- Tagging operations are fast (< 1ms per file)
- Large-scale retagging operations may take time on thousands of files
- Network filesystems may have slower xattr operations
| Transition | Default | Range | Description |
|---|---|---|---|
| INBOX → DOCUMENTS | 7 days | 1-365 | Files accessed recently |
| DOCUMENTS → ARCHIVE | 30 days | 1-365 | Files not accessed |
| INBOX → ARCHIVE | 90 days | 1-365 | Unprocessed files |
- atime (access time): Determines active files
- mtime (modification time): Secondary consideration
- Age since collection: Prevents indefinite accumulation
documents_to_archive_days>inbox_to_documents_daysinbox_to_archive_days> max(inbox_to_documents_days,documents_to_archive_days)
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ CLI Interface │────│ FlowSort Core │────│ Classification │
│ (Typer) │ │ │ │ Strategies │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│
┌────────┴────────┐
│ Configuration │
│ Management │
│ (Pydantic) │
└─────────────────┘
- Manages all configuration settings
- Automatic path validation and derivation
- Time rule validation
- JSON serialization/deserialization
- Directory setup and management
- File movement and symlink creation
- Statistics and reporting
- Extension-based classification
- MIME type fallback
- Confidence scoring
- Content-based classification
- Learning capabilities
- Higher accuracy for ambiguous files
- Configuration persistence
- User preference handling
- Migration support
# Collect files from Downloads
flowsort collect
# Auto-confirm collection
flowsort collect --yes
# Check system status
flowsort status
# View configuration
flowsort config --show
# Clean up broken symlinks
flowsort cleanup
# Classify a single file
flowsort classify path/to/file.pdf
# Show version
flowsort version# Update base path
flowsort config --base-path ~/NewPath
# Update Downloads location
flowsort config --downloads ~/Downloads
# Adjust time rules
flowsort config --inbox-days 5
flowsort config --docs-days 45
flowsort config --archive-days 120
# Configure tagging system
flowsort config --enable-tagging --xdg-compat --prefer-xdg
flowsort config --auto-tag --preserve-tags# Manage file tags
flowsort tags file.pdf --add "important,work"
flowsort tags file.pdf --remove "draft"
flowsort tags file.pdf --list
# Bulk retagging
flowsort retag --recursive --force
# View recent files with tags
flowsort recent --location inbox --tags- Morning:
flowsort collectto organize overnight downloads - Work: Files naturally flow to DOCUMENTS as you access them
- Weekly: Review INBOX categories for manual adjustments
- Monthly: Check ARCHIVE for any misplaced important files
{
"base_path": "/home/user",
"inbox_path": "/home/user/INBOX",
"documents_path": "/home/user/DOCUMENTS",
"archive_path": "/home/user/ARCHIVE",
"downloads_path": "/home/user/Downloads",
"system_path": "/home/user/SYSTEM",
"inbox_to_documents_days": 7,
"documents_to_archive_days": 30,
"inbox_to_archive_days": 90,
"categories": {
"documents": [".pdf", ".doc", ".docx", ...],
"images": [".jpg", ".png", ".gif", ...],
...
},
"enable_tagging": true,
"tag_namespace": "user.flowsort",
"auto_tag_categories": true,
"preserve_existing_tags": true,
"xdg_tags_compatibility": true,
"prefer_xdg_tags": true
}Add or modify file type classifications by editing the configuration file or extending the code.
Adjust based on your workflow:
- Fast-paced: Shorter timeframes (3, 14, 60 days)
- Deliberate: Longer timeframes (14, 60, 180 days)
Customize directory names and locations to match existing workflows.
FlowSort uses relative symlinks for portability:
# Example symlink
documents/report.pdf -> ../all/report.pdfBenefits:
- No broken links when moving directories
- Cross-platform compatibility
- Efficient storage usage
When moving files with duplicate names:
original.pdf
original_1.pdf
original_2.pdf
The status command provides insights:
- Total files per directory
- Files per category
- System health indicators
Planned features:
- Daemon mode for real-time processing
- Scheduled archival operations
- Integration with file watchers
- Backup system integration
- Trust the System: Let files flow naturally through stages
- Weekly Reviews: Manually check INBOX categories for accuracy
- Custom Categories: Add project-specific categories as needed
- Archive Exploration: Periodically review archived content
- Large Files: Consider separate handling for videos/archives
- Network Drives: Be cautious with remote storage locations
- Backup Strategy: Ensure ARCHIVE directory is backed up
- Monitoring: Regular
flowsort statuschecks
- Development: Keep code files in active DOCUMENTS
- Research: Let PDFs flow to ARCHIVE after projects complete
- Media: Separate personal vs. work media classifications
- Temporary Files: Use INBOX for quick file exchanges
Broken Symlinks:
flowsort cleanupConfiguration Errors:
flowsort config --show
flowsort init # Reset if neededMissing Files:
- Check ARCHIVE/by-date for auto-moved files
- Use system file search in ARCHIVE directory
- Lost Configuration: Re-run
flowsort init - Corrupted Symlinks: Use
flowsort cleanup - Wrong Classifications: Manually move files between category folders
- Accidental Archival: Move files back from ARCHIVE/all to DOCUMENTS/all
FlowSort provides a systematic approach to digital organization that balances automation with user control. By treating file organization as a natural flow process, it reduces cognitive overhead while maintaining flexibility for different workflows and preferences.
The system grows with your needs, starting simple with heuristic classification and expanding to include AI-powered organization as your requirements evolve.
Remember: The goal isn't perfect organization from day one, but sustainable, improving organization over time. Let FlowSort handle the mechanics while you focus on your work.
FlowSort v1.0.0 - Built with ❤️ for keeping your digital life tidy