Workspace-root storage (~/.kiro/workspace-roots/) is not identifiable or cleanable
Kiro Product
IDE
Feature Description
~/.kiro/workspace-roots/<hash(workspaceRoot)>/ is created per workspace root
(each directory identified by a hash of the absolute root path, containing
.trust-migration.json with a root field and a per-root permissions.yaml),
with corresponding ~/.kiro/sessions/<hash>/ and
~/.kiro/session-index/<hash>.jsonl entries. There is currently no documented
way to:
- discover which
<hash>directory corresponds to which workspace root without opening.trust-migration.jsonand reading itsrootfield one directory at a time, and - clean up (or have Kiro automatically clean up) the
<hash>directory once the workspace root it refers to no longer exists on disk.
We rely on a Git-worktree-per-Issue workflow: for each GitHub Issue we create
a dedicated git worktree (e.g. ../<repo>-<issue-number>) as its own Kiro
workspace root, do the work, and remove the worktree once the Issue's PR is
merged. Every worktree we open becomes a new <hash> entry under
~/.kiro/workspace-roots/, ~/.kiro/sessions/, and
~/.kiro/session-index/, but removing the worktree never removes the
corresponding Kiro-side entries. After several months of this workflow, most
of our ~/.kiro/workspace-roots/ entries reference a root path that no
longer exists:
$ for d in ~/.kiro/workspace-roots/*/; do
root=$(jq -r .root "$d/.trust-migration.json")
[ -d "$root" ] && echo "EXISTS $root" || echo "MISSING $root"
done
EXISTS /home/user/Git/my-repo
EXISTS /home/user/Git/my-repo-92
MISSING /home/user/Git/my-repo-83
MISSING /home/user/Git/my-repo-101
MISSING /home/user/Git/my-repo-102
MISSING /home/user/Git/my-repo-103
... (16 of 22 entries stale, in our case)
Requested feature: a documented, supported way to (a) list workspace-root entries alongside the root path they reference and whether that path still exists, and (b) remove the stale ones — either as a Kiro-provided command (IDE command palette action, CLI subcommand, or settings UI action) or as an explicitly documented safe manual procedure (which files are safe to delete together, whether a running Kiro process can hold a reference to one of these hashes, and what happens if the same absolute path is reused later — does Kiro regenerate the hash directory identically, or is there a collision / stale-cache risk).
Use Case
How we currently work around this (and why the workaround causes a second, more concrete problem)
Every workspace root's permissions.yaml starts from a shared, deliberately
hand-tuned master file. We invest real effort into that master file to get a
workable balance between security and agent autonomy (fine-grained
allow/ask/deny rules per shell command / fs operation), and that
tuning is shared across nearly all our per-Issue workspace roots — copying
it into each new root is correct and desired, it is not itself the problem.
The problem is that ~/.kiro/workspace-roots/<hash>/ gives us no reliable,
human-readable way to know which hash directory belongs to which worktree
before we act on it. Right now, applying (or refreshing) the shared master
permissions.yaml across all current workspace roots looks like:
for d in ~/.kiro/workspace-roots/*/; do
cp ~/master-permissions.yaml "$d/permissions.yaml"
done
This blindly overwrites permissions.yaml under every <hash>/, including:
- hashes for worktrees that were already deleted (wasted writes to storage Kiro never cleans up on its own — see the cleanup request above), and
- any workspace root where we had intentionally customized
permissions.yamlbeyond the shared master (that customization is silently destroyed, with no warning, because the loop cannot distinguish "this hash still needs the shared baseline" from "this hash has a deliberate override").
We currently avoid the second failure mode only by discipline (not
customizing per-root permissions at all), which defeats part of the point of
per-root permissions existing in the first place. A workspace-root management
surface that shows <hash> → resolved root path (+ exists on disk: yes/no)
would let us target this refresh at only the live, non-customized roots
instead of a blind directory-wide overwrite, and would let us safely delete
the stale entries identified in the Feature Description above.
Concretely, we would use this to:
- List all workspace roots with their resolved absolute path and existence
status, so a
permissions.yamlrefresh script (or a manual review) can be scoped to specific real roots by path instead of blindly iterating every<hash>/directory. - Bulk-clean
workspace-roots/sessions/session-indexentries whose root path no longer exists, as part of our normal "Issue done → delete the worktree" step, without guessing whether a given<hash>is safe to remove. - Mark or protect a specific workspace root's
permissions.yamlas intentionally customized, so a bulk baseline-refresh operation (ours or a future built-in one) does not silently clobber it.
Additional Context
- This is a generalization of a narrower, personal pain point (the
permissions.yamlrefresh problem above); we are filing it at the level of "workspace-root lifecycle/management is not observable or maintainable", since we think that is the actual gap and thepermissions.yamlissue is one concrete symptom of it. - We did not find an existing IDE command, CLI subcommand, or documented
manual procedure covering this in kiro.dev docs (
permissions.md,configuration.md,cli/chat/session-management.md). The closest documented mechanism,/sessions clean, only removes empty CLI sessions and is not root-existence-aware. - Related but distinct existing reports we found, about unbounded growth of
other Kiro storage locations (not
~/.kiro/workspace-roots/specifically, but the same underlying "nothing is cleaned up automatically" theme):#4165("Unbounded growth of spec execution history in globalStorage"),#9977("kiro.kiroagent globalStorage grows unbounded (25 GB in 6 weeks)"). We think this Issue's scope (workspace-root identification + lifecycle management, including but not limited to space reclamation) is different enough from those two to file separately, but wanted to flag the overlap for triage. - We are not asking for a specific priority here; we think that judgment belongs to the Kiro team, not to us as a single reporting workspace.
- Environment: Kiro IDE on WSL2 (Linux), one repository with a Git-worktree-per-Issue workflow (multiple worktrees of the same repository opened as separate Kiro workspace roots over time).
Thanks for opening this issue and providing such a thorough write-up! The challenge of identifying and cleaning up stale workspace-root entries — especially in a worktree-heavy workflow like yours — is a really well-articulated usability gap. A maintainer will review this shortly and take a closer look. We appreciate you taking the time to detail the problem and the workflow behind it — this kind of feedback is incredibly valuable! 🙌
Thanks for raising this. ~/.kiro/workspace-roots/ accumulating stale entries with no way to identify or clean them (no documentation, no cleanup command) is a real UX gap. Marking this as a bug to investigate further.
Whenever I create a workspace-roots/‹hash› directory, I also create a symbolic link inside named workspace_dir pointing to the actual workspace path. Finding obsolete workspace-roots subdirectories becomes a test for symlink validity.