Repository navigation
Description
Summary
In OpenCode v1.15.x, multiple local directories that point to the same git remote origin are resolved to the same project ID, even when they are different local clones or checked out on different branches.
This makes it difficult to use OpenCode with several parallel feature branches of the same repository as independent projects.
Current Behavior
Given multiple local directories:
E:\cloudstone\feature\wangjie branch: feature/wangjie
E:\cloudstone\feature\UITransform branch: feature/ui-transform
E:\cloudstone\feature_wangjie branch: feature/wangjie
All of them use the same remote:
https://git.example.com/org/project.git
OpenCode resolves them to the same project, and additional directories are added as sandboxes / worktrees under the same project.
Even if .git/opencode is manually changed to a different ID, OpenCode rewrites/migrates it back to the remote-based project ID on startup.
Source Behavior
In v1.15.11, project identity appears to be resolved with this priority:
const previous = yield* cached(repo.store)
const id = (yield* remote(repo)) ?? previous ?? (yield* root(repo))So git remote origin takes precedence over the previously cached .git/opencode value.
Then migrateProjectId(previous, newID) migrates the old local project ID to the remote-based ID.
This means .git/opencode can no longer be used to keep separate local clones or branches as independent projects when they share the same remote.
Previous Behavior
In older versions such as v1.14.x, OpenCode appeared to respect the local .git/opencode / local Git identity first. That allowed different local directories of the same remote repository to be added and managed as separate projects.
Expected Behavior
It would be useful to support one of the following options:
- A config option to choose project identity strategy:
{
project: {
identity: remote | local | branch | path
}
}- An environment variable, for example:
OPENCODE_PROJECT_ID_STRATEGY=remote|local|branch|path
- A way to disable remote-based project ID resolution:
OPENCODE_DISABLE_REMOTE_PROJECT_ID=true
- A way to include branch name in the project ID:
git remote origin + current branch
This would allow these to be treated as separate projects:
same remote + branch A
same remote + branch B
Why This Matters
Many developers keep multiple local clones or branch-specific directories for the same repository, especially for:
- long-running feature branches
- UI refactors
- release branches
- parallel customer-specific work
- testing migrations independently
In these cases, merging all directories into one OpenCode project can cause confusion around:
- project list
- sessions
- permissions
- workspace/sandbox selection
- context isolation
- branch-specific work history
Workaround
Using a different OPENCODE_DB can partially isolate projects:
$env:OPENCODE_DB=opencode-uitransform.db
opencode E:\cloudstone\feature\UITransformHowever, this separates the whole OpenCode database and does not solve the project identity behavior within a single OpenCode instance.
Changing git remote origin also works around the issue, but it is risky because it affects normal Git workflows such as git pull and git push.
Request
Please consider adding an official option to make project identity configurable, especially allowing local path / branch / cached .git/opencode identity to take precedence over git remote origin.
This would restore the ability to manage multiple local clones or branches of the same remote repository as independent OpenCode projects.
Activity
github-actions commentedon May 28, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
[FEATURE]:(e.g.[FEATURE]: Support branch or local-clone based project identity strategy)Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon May 28, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.