A high-performance, intelligent system optimization tool built in Nim for macOS.
- Intelligent Cache Scoring: Uses heuristics to prioritize what to clean based on size, age, and access patterns
- Parallel Processing: Cleans multiple cache directories simultaneously using async/await
- Safe Deletion: Checks permissions and safety before removing anything
- Real-time TUI: Beautiful terminal interface with live progress updates
- Modular Architecture: Clean separation of concerns for maintainability
- ✅ Browser caches (Safari, Chrome, Firefox)
- ✅ Developer caches (Xcode, npm, cargo, Homebrew)
- ✅ Application caches
- ✅ System logs
- ✅ Memory (purge inactive pages)
- ✅ Disk space
- ✅ Network (DNS cache, TCP settings)
- macOS 10.15+
- Nim 2.0.0+ (install via
brew install nim) - Sudo access
# Clone the repository
git clone <repo-url>
cd workaholic
# Build the project
nimble build
# Make it executable
chmod +x workaholicCreate ~/.config/workaholic/config.toml or use the included config.toml:
[general]
safety_level = "balanced" # conservative, balanced, or aggressive
parallel_jobs = 4
[protected_apps]
always_keep = ["Terminal", "Cursor", "Google Chrome"]
[cleaning]
browser_caches = true
developer_caches = true
application_caches = true
system_logs = true
age_filter_days = 7
[optimization]
memory = true
disk = true
network = trueCreate ~/.workaholic/.env:
SUDO_PASSWORD=your_password_hereOr set environment variable:
export SUDO_PASSWORD=your_password_here# Run optimization
./workaholic
# Development build
nimble dev
# Production build (optimized)
nimble buildsrc/
├── workaholic.nim # Main entry point
└── workaholic/
├── config.nim # Configuration management
├── types.nim # Type definitions
├── ui.nim # TUI interface
├── core/
│ ├── pipeline.nim # Pipeline orchestration
│ ├── scanner.nim # Cache discovery
│ ├── scorer.nim # Intelligent scoring
│ ├── cleaner.nim # Safe deletion
│ └── orchestrator.nim # Workflow coordinator
└── system/
├── apps.nim # App management
├── memory.nim # Memory optimization
├── disk.nim # Disk operations
├── network.nim # Network optimization
└── stats.nim # Statistics aggregation
score = (size_MB × age_days × safety_factor) / (access_frequency + 1)Items with higher scores are prioritized for deletion:
- Large, old caches score higher
- Recently accessed items score lower
- Safe items score higher than risky ones
- Scan Phase: Discover all cache candidates in parallel
- Score Phase: Calculate priority scores for each item
- Clean Phase: Delete items in parallel with concurrency limit
- Optimize Phase: Run system optimizations (memory, disk, network)
- Async I/O: Non-blocking file operations
- Parallel Scanning: Multiple directories scanned simultaneously
- Batch Processing: Items cleaned in optimized batches
- ORC Memory Management: Automatic reference counting with no GC pauses
- ✅ Only touches cache directories and temporary files
- ✅ Never deletes user documents or application data
- ✅ Checks write permissions before deletion
- ✅ Protected apps list to prevent closing critical apps
- ✅ Configurable safety levels
Compared to the Python version:
- 3-5x faster cleanup due to parallel processing
- Lower memory usage with ORC memory management
- No GC pauses during execution
- Single binary with no runtime dependencies
# Build for development
nimble dev
# Clean build artifacts
nimble clean
# Run directly
nimble runMIT License
Contributions welcome! Please ensure:
- Code follows Nim style guidelines
- Modules remain logically separated
- Safety checks are maintained
- Performance optimizations are documented