Session history becomes inaccessible when workspace folders change
Bug Description
Session history becomes completely inaccessible when the set of workspace folders changes (folders added or removed). Sessions created under the previous folder configuration disappear from the Session History panel with no way to access them from the UI.
Root Cause Analysis
Kiro stores sessions grouped by a hash derived from the workspace folder list (stored at ~/.kiro/sessions/{hash}/). When the folder list changes (even by a single folder being added or removed), the hash changes, and all sessions from the previous configuration become invisible.
This is particularly problematic because:
- Agent Focus may automatically change which folders are visible, silently altering the hash
- Users adding/removing a single repo from a multi-root workspace permanently loses access to all prior sessions
- There is no UI indication of what happened or how to recover
Steps to Reproduce
- Open a multi-root workspace with N folders (e.g., 20 folders)
- Create several chat sessions, have conversations
- Add one more folder to the workspace (now N+1 folders)
- Observe: all previous sessions disappear from Session History
Expected Behavior
Session history should remain accessible regardless of workspace folder changes. The session grouping key should be a stable workspace identifier (e.g., UUID or .code-workspace file path), not a hash of the folder list.
Actual Behavior
- Sessions from before the folder change are completely gone from the History panel
- No "Migrate" button or any indication they exist
- Data is still on disk at
~/.kiro/sessions/{old-hash}/but unreachable from UI - In my case, 48 different hashes accumulated over time due to incremental workspace changes, fragmenting months of session history
Environment
- OS: macOS (darwin arm64)
- Kiro Version: latest (2026-07-29)
- Workspace: Multi-root with ~20 folders
Related Issues
- microsoft/vscode#287896 — Same root cause in VS Code Copilot Chat
- #1279 — Symptom overlap (history spontaneously disappearing)
Suggested Fix
Replace the folder-list hash with a stable workspace identifier. Folder list changes should update session metadata, not create a new session group.
🤖 Potential Duplicate Detected
This issue appears to be similar to:
What happens next?
- ⏰ This issue will be automatically closed in 3 days
- 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
- 💬 Comment on the original issue if you have additional information
Why is this marked as duplicate? Both issues describe session/chat history becoming inaccessible when workspace configuration changes. Issue #8241 specifically describes losing chat history when renaming a directory, while the new issue describes losing session history when workspace folders change. Both share the same root cause: session storage is keyed to workspace path/folder configuration, so any change causes history to disappear from the UI.
Thank you for your feedback! 🙏
The 👎 reaction has been noted. The duplicate label has been removed and this issue has been sent back for maintainer review.
A maintainer will review this issue shortly.
This issue also affects separate single-folder workspaces that share a common parent directory. In my case, multiple independent workspaces exist under the same parent. A change in one workspace (e.g. opening it or modifying its structure) causes the session hash to rotate for all sibling workspaces, even though they are not multi-root workspaces. This suggests the hash is not scoped to the individual workspace folder but includes something from the parent or sibling context.
Also facing this problem. It's very frustrating when you want to add an additional workspace for more context and then everything you've been working on is gone.
Still happening on 1.0.242 / Linux x64 (CachyOS, kernel 7.1.5)
Same root cause confirmed. My workspace evolved from 11 → 13 → 14 → 15 folders over a few weeks, producing 5 different hash directories with 36 orphaned sessions across them. Sessions created minutes before a folder addition vanish silently.
Additional note: this also affects sessions created by the built-in "Migrate" feature for old-format chats. You migrate them, add a folder, and they're gone again.
Recovery is possible with a script that scans all hash directories for sessions whose workspacePaths are a subset of the current workspace and copies them to the correct hash — but this isn't sustainable as a workaround.
+1 for using the .code-workspace file path (or a stable UUID stored in it) as the session key instead of a content-derived hash.
Still happening on 1.0.242 / Linux x64 (CachyOS, kernel 7.1.5)
Same root cause confirmed. My workspace evolved from 11 → 13 → 14 → 15 folders over a few weeks, producing 5 different hash directories with 36 orphaned sessions across them. Sessions created minutes before a folder addition vanish silently.
Additional note: this also affects sessions created by the built-in "Migrate" feature for old-format chats. You migrate them, add a folder, and they're gone again.
Recovery is possible with a script that scans all hash directories for sessions whose workspacePaths are a subset of the current workspace and copies them to the correct hash — but this isn't sustainable as a workaround.
+1 for using the .code-workspace file path (or a stable UUID stored in it) as the session key instead of a content-derived hash.
Mac as well Version: 1.0.228 & 242 VSCode Version: 1.107.1. & 108.2
Thanks for raising this. The root cause is that Kiro stores KAS (V3) sessions under ~/.kiro/sessions/{workspaceHash}/ where the hash is derived from the sorted list of workspace folder paths. When any folder is added or removed, the hash changes and all sessions from the previous configuration become invisible in the UI, even though the data is still on disk under the old hash directory. Agent Focus can trigger this silently by changing which folders are visible.
The fix directions include a session recovery tool (scan all hash directories, not just the current one), a migration command for renamed workspaces, and a longer-term stable workspace identity that doesn't change when folders are added/removed.
Also related to #2718 which reports the same issue when a project folder is physically moved.
Marking this as a bug to investigate further.
I have encountered this issue when trying to relocate workspace folders out of a One Drive folder to a local folder not monitored by One Drive. I got tired of fighting the git issues that Kiro keeps blaming on One Drive. Luckily I explored this topic before making the move. I've had Kiro build a Python script that will, in theory, modify the session folder names and index to match the hashes for the new folder location. Haven't tried it yet. Thought I'd come here to github (and to the community discord) first to see if anyone has done this successfully yet,
I fully endorse the idea of a workspace ID that is created once and is not dependent on the folder location of the workspace.