Skip to content

[FEATURE]: Allow changing project folder path without losing session history #29703

Description

@yun-langdeng

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

  1. Renaming project folder - When I rename my-project to my-project-v2, I lose all previous conversation context
  2. Moving project location - When I move a project from ~/dev/ to ~/work/, sessions are gone
  3. Restructuring workspace - Reorganizing folders by category/type breaks session continuity
  4. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions