chore: add cache cleanup utility script for Kiro workspace storage#5755
Open
morozow wants to merge 2 commits intokirodotdev:mainfrom
Open
chore: add cache cleanup utility script for Kiro workspace storage#5755morozow wants to merge 2 commits intokirodotdev:mainfrom
morozow wants to merge 2 commits intokirodotdev:mainfrom
Conversation
- Add clean-kiro-cache.sh bash script for managing Kiro workspace storage - Support selective deletion of file version cache, chat history, and old workspaces - Include configurable age-based filtering via --chat-files-older-than and --workspaces-older-than flags - Implement dry-run analysis mode showing cache size and file counts before deletion - Add comprehensive help documentation with usage examples and safety information - Require explicit user confirmation before any deletion operations - Display progress indicators during bulk deletion operations
This was referenced Feb 14, 2026
- Add clean-kiro-ide-sessions.sh script to remove stale session storage and workspace metadata - Support --user flag to target specific user accounts - Support --sessions-older-than flag to delete files by modification date threshold - Include comprehensive help documentation with usage examples and safety information - Calculate and display cleanup size before deletion with user confirmation prompt - Prevent IDE performance degradation caused by stale session data referencing deleted chat files - Coordinate with clean-kiro-cache.sh for consistent cache and session cleanup workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
Description of changes:
Add maintenance script for cleaning Kiro workspace cache
Summary
Adds
scripts/bin/clean-kiro-cache.sh- a maintenance utility for managing Kiro workspace storage and reclaiming disk space.Problem
Kiro accumulates significant disk space over time:
.chatfiles)Users currently have no built-in way to clean old data, leading to:
Solution
Introduces a safe, user-friendly maintenance script with:
Features
1.
clean-kiro-cache.sh- Storage CleanupMain utility for managing Kiro workspace storage with:
Features
--userflag--helpwith examples and safety guarantees2.
clean-kiro-ide-sessions.sh- IDE Session CleanupCompanion utility that removes stale IDE session storage after chat cleanup:
Usage Examples
Recommended Workflow for Optimal IDE Performance
After cleaning cache and old chat files, it's recommended to also clean IDE session storage and restart Kiro IDE to prevent performance degradation:
This ensures consistency between chat storage and IDE session state, eliminating slowdowns caused by orphaned session references.
Implementation Details
Location:
scripts/bin/clean-kiro-cache.sh- Main cache and chat cleanup utilityscripts/bin/clean-kiro-ide-sessions.sh- IDE session storage cleanup utilityWhat gets deleted:
.chatfiles older than specified thresholdWhat is preserved:
index/directory (code search index)config.json,profile.json).migrations/)Safety mechanisms:
y/NconfirmationTesting
Tested on macOS with:
--userflag)--chat-files-older-than)--workspaces-older-than)--help)Test results: Successfully reclaimed 7+ GB from file cache and 15+ GB from old chat history without affecting active sessions.
Documentation
Comprehensive
--helpoutput includes:Breaking Changes
None. This is a new utility script with no impact on existing functionality.
Future Enhancements
Potential improvements for future PRs:
kiro-clias a subcommand (kiro clean)Checklist
chmod +x)du,find,rm)Impact: Low risk, high value. Provides essential maintenance capability without modifying core Kiro functionality.
Recommendation: Merge and document in user-facing documentation (README, troubleshooting guide).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.