anomalyco / anomalyco/opencode
Session data is keyed by absolute path, breaking context when reorganizing folders
@nexxeln is already working on this.
Since Sep 10, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.