Skip to content

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

Closed as not planned

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

Activity

  1. changed the title [-]feat: Allow changing project folder path without losing session history[/-] [+][FEATURE]: Allow changing project folder path without losing session history[/+] on May 28, 2026
  2. github-actions commented on May 28, 2026

    @github-actions
    Contributor

    Thank you for updating the issue! It now meets our contributing guidelines. We appreciate you taking the time to add the [FEATURE]: prefix and fill in your environment details.

  3. github-actions commented on May 28, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets our contributing guidelines. We'll take a look.

  4. sim590 commented on May 31, 2026

    @sim590

    @yun-langdeng: this is a duplicate of #23249. There's already a PR for this: #23250.

    It was wrongly closed by the bot and the maintainers seem to have a hard time to keep up with everything and they have not repoened my PR. I have been using this dialog daily on my local machine for a big month. You can go a put a thumbs up on that PR/issue and may be comment in the issue to show your support for the functionality. Otherwise, the bot criteria for keeping issues opened will keep closing my PR.

    Consider also closing this issue if you agree to keep the conversation over at #23249.

    Thanks!

  5. WhiteGiverMa commented on Jun 21, 2026

    @WhiteGiverMa

    +1 — hit this exact scenario on Windows 11 + WSL2. Renamed a project folder and lost all session history. The sessions are technically still in the SQLite DB but orphaned because their directory field stores the old absolute path.

    This feature would be very welcome. Even a simple "relink project directory" button in Desktop settings would be enough — no need for automatic detection, just let users manually point an existing project record to a new path and batch-update all associated session directory fields.

  6. DriftN2Forty commented on Jul 20, 2026

    @DriftN2Forty

    I believe this now works automatically. I just manually moved a project folder and all sessions are available when I opened the project.

  7. NicolasWebDev commented on Jul 21, 2026

    @NicolasWebDev

    It still doesn't work for me on archlinux, with opencode TUI 1.17.20-1, nor with 1.18.4-1.

  8. sim590 commented on Jul 22, 2026

    @sim590

    Any automated approach won't support the use case of moving a session from one existing and functional location to another. This was mentioned in #23249 and covered by #23250.

    However, both were closed by bots unfortunately. This is disappointing as I do use this feature every day using #23250 locally. The auto ticket closing policy is a real mess. It doesn't distinguish good tickets from anything else. That's a shame.

  9. predystopic-dev commented on Jul 27, 2026

    @predystopic-dev

    A plugin exists for the very same purpose
    https://github.com/moha-abdi/opencode-move-session/tree/main

  10. NicolasWebDev commented on Jul 27, 2026

    @NicolasWebDev

    @predystopic-dev this issue is about being able to change the path of a project, without losing its session history. E.g. mv ~/my_project ~/other_dir/my_project.
    https://github.com/moha-abdi/opencode-move-session on the other hand, moves a session from projectA to projectB.

    Different objectives.

    Moreover it didn't work when I tried it, at least for me. I had an sql command error.

  11. github-actions commented on Sep 26, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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