Problem Description
When I change the project folder path (e.g., rename a directory, move to a different location, or reorganize folder structure), all my previous chat history and session data for that project are lost.
This happens because OpenCode stores session data tied to the project folder path. If the path changes, OpenCode treats it as a new project.
Use Cases
- Renaming project folder - When I rename
my-project to my-project-v2, I lose all previous conversation context
- Moving project location - When I move a project from
~/dev/ to ~/work/, sessions are gone
- Restructuring workspace - Reorganizing folders by category/type breaks session continuity
- Git repo migration - When transferring repos between organizations, the folder structure changes
Suggested Solution
Option A: Session aliasing/mapping
- Allow users to link/migrate session data when a folder path changes
- Add a command like
opencode session migrate --from /old/path --to /new/path
Option B: Use project identifier instead of path
- Store sessions based on a unique project ID (e.g., git remote URL, or a generated UUID)
- Create a
.opencode/project.json config that identifies the project
- Example:
{ "projectId": "my-project-uuid", "name": "my-project" }
Option C: Manual session import
- Export/import session history as JSON files
- Allow importing sessions into any project folder
Additional Context
Many developers rename/move projects as they evolve. Preserving conversation history is valuable for:
- Maintaining context of past decisions and discussions
- Continuing work without re-explaining project background
- Historical reference for debugging or feature development
Environment
- OpenCode Version: v1.15.11 (OpenCode Desktop)
- OS: Windows 10/11
Problem Description
When I change the project folder path (e.g., rename a directory, move to a different location, or reorganize folder structure), all my previous chat history and session data for that project are lost.
This happens because OpenCode stores session data tied to the project folder path. If the path changes, OpenCode treats it as a new project.
Use Cases
my-projecttomy-project-v2, I lose all previous conversation context~/dev/to~/work/, sessions are goneSuggested Solution
Option A: Session aliasing/mapping
opencode session migrate --from /old/path --to /new/pathOption B: Use project identifier instead of path
.opencode/project.jsonconfig that identifies the project{ "projectId": "my-project-uuid", "name": "my-project" }Option C: Manual session import
Additional Context
Many developers rename/move projects as they evolve. Preserving conversation history is valuable for:
Environment