Skip to content

Session data is keyed by absolute path, breaking context when reorganizing folders #48254

Closed as duplicate

Description

@carmelo77

Description

OpenCode stores per-project session data in ~/.local/share/opencode/project//storage/, where is derived from the absolute path of the working directory. Moving a project to a different folder (e.g. ~/Documents/repo → ~/Documents/new/repo) causes OpenCode to treat it as a brand-new project: the previous session history is no longer accessible from the new location, and the project appears to have lost all context.

Steps to reproduce:

Start OpenCode in ~/Documents/my-project and have a conversation.
Move the folder: mv ~/Documents/my-project ~/Documents/new/my-project.
Run opencode again from the new path.
Observe: previous sessions are not listed (opencode session list), --continue fails, and the model has no context from the prior conversation.
Expected behavior: Sessions should be tied to the project's identity, not its absolute path on disk. Reasonable identifiers:

Git remote URL (if a repo)
Repository root resolved via .git traversal
AGENTS.md / .opencode/ location
Moving or renaming the project directory should not orphan the conversation history.

Impact: Users who reorganize their folder structure (a very common operation: splitting work into subfolders, restructuring monorepos, moving projects to a new drive, syncing via symlinks, etc.) permanently lose all session context. This makes OpenCode fragile for any non-trivial workflow and forces users to either keep projects at fixed absolute paths or rely on symlinks.

Proposed solutions (any of these would help):

Key the slug by git remote URL when available, fall back to absolute path only for non-git projects.
Detect folder moves and offer to migrate/reassociate existing session data.
Add an opencode session migrate command.
Allow manual session reassociation via a config file or CLI flag.
Environment:

OS: linux/Macos
Project type: git repo

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Sep 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is specifically about using git remote URL or repository root as the stable project key (rather than absolute path), you may want to comment on one of the open issues above rather than opening a new one.

  2. Tarquinen commented on Oct 20, 2026

    @Tarquinen
    Member

    We're tracking this in #44256, so I'm closing this as a duplicate. Please follow that issue for updates.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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