Change directory, move sessions, and other directory based operations for opencode sessions.
When working across monorepos or multiple repositories, sessions get stuck in the directory they were started in. This plugin adds /cd and /mv commands to move sessions between directories at runtime.
Run the install script:
curl -fsSL https://raw.githubusercontent.com/adiled/opencode-dir/main/install | bashOr install manually:
- Add to
opencode.json:
{
"plugin": ["opencode-dir"]
}- Restart OpenCode — the plugin auto-installs the
/cdand/mvcommands on first load.
Change the session's working directory. Tools (bash, glob, grep, read, write, edit) will operate in the new directory immediately. Message history is left untouched.
Same as /cd, but also rewrites path.cwd and path.root in all existing assistant messages to point to the new directory. Use this when you want the full conversation history to reflect the new location.
The session is fully operational in the new directory — system prompt, tools, and permissions are all updated immediately. When you next open opencode from the target directory, the session will appear under that project's session list.
MIT