codecontext clean
Remove outdated documentation and clean up cache
Clean up outdated documentation files, remove orphaned docs, clear cache, and maintain a tidy documentation structure. Essential for keeping your docs lean and preventing stale information from confusing users.
Quick Usage
codecontext clean
Safely removes outdated docs and clears cache
What Gets Cleaned
Orphaned Documentation
- • Docs for deleted code files
- • Removed function docs
- • Old API documentation
- • Stale examples
Cache & Temporary Files
- • AI model cache
- • Processing temp files
- • Old backups
- • Build artifacts
Outdated Content
- • Deprecated feature docs
- • Old version guides
- • Archived changelogs
- • Legacy examples
Safe to Remove
- • Duplicate documentation
- • Auto-generated backups
- • Empty doc files
- • Broken symlinks
Cleaning Process
$ codecontext clean
🔍 Scanning for orphaned documentation...
Found 23 docs without corresponding code files
📊 Checking cache size...
Cache: 1.2GB (45 days old)
🗑️ Items to clean:
• 23 orphaned doc files (156KB)
• 892MB old cache files
• 12 empty directories
• 3 broken symlinks
⚠️ Total space to recover: 892MB
Proceed with cleanup? [y/N] y
✅ Cleanup complete! Freed 892MB
Cleaning Options
codecontext clean --dry-run
Preview what would be cleaned without removing
codecontext clean --force
Skip confirmation prompts
codecontext clean --cache-only
Only clean cache, keep all documentation
codecontext clean --older-than=30d
Only clean items older than specified time
Safety Features
What's Protected
- Active documentation files
- Custom documentation
- Manual overrides
- Configuration files
Cleanup Rules
- Always shows preview first
- Requires confirmation
- Creates backup list
- Respects .gitignore
Maintenance Schedule
Recommended Cleanup Frequency
Cache cleaningWeekly
Orphaned docs checkAfter major refactors
Full cleanupMonthly
Archive old versionsBefore releases
Cleanup Tips
- •Always use
--dry-run
first - •Schedule regular cleanups to prevent buildup
- •Run after major code refactoring
- •Check cleanup log for accidentally removed items