You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: configurable default directory for new sessions #56932
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
New sessions only start in the launch directory or in the active session's directory (session.new_location: "launch" | "inherit" in cli.json). There is no way to pin a fixed working directory. When I open OpenCode from different places — a shortcut, a random terminal, or the desktop app — new sessions land in the wrong project and I have to open the right folder again every single time.
I would like to configure a default directory once, and have every new session start there.
Proposed approach:
CLI / TUI — let session.new_location also accept an absolute directory path, keeping launch and inherit as they are. newSessionLocation() in packages/tui/src/config/new-session-location.ts would return { directory: path } for a fixed path. This is a small change to the config schema, the resolver, and packages/tui/src/component/dialog-config.tsx.
Desktop / app — packages/app does not read new_location at all; new sessions always start from the project you pick. A "remember last folder / default folder" setting there would be a separate change in the projects/workspaces layer.
Notes:
#52166 asked for something close to this in the desktop attachment picker, but it was closed by the compliance bot (title/checkbox), not because the feature was declined.
A fixed directory is useful on Windows in particular, where the app is frequently launched from a shortcut rather than a shell in the project root.
Thanks for the detailed request! To restate it: you'd like to set a fixed default working directory once, for example by letting session.new_location in cli.json accept an absolute path alongside launch and inherit, so new sessions always start there however OpenCode was launched. You'd also like a similar default-folder option in the desktop app. Maintainers will consider it.
This can't be done as a plugin today, because the TUI chooses where a new session starts before it reaches the server, and plugins can't hook into that choice.
Follow-up with the concrete desktop plan, since packages/app does not read new_location at all.
New sessions start from the project picked in packages/app/src/new-session/project/controller.ts (createComposerProjectControls -> useDirectoryPicker). A "default folder" setting would have to live in the app's own settings (packages/app/src/settings/general/general.tsx, persisted like the other app-local settings) and seed the initial directory instead of the last picked project. That is a separate change from the TUI one and probably wants its own issue/PR.
For the CLI/TUI part I have a small patch ready locally: session.new_location also accepts { "directory": "..." }, keeping launch/inherit and the existing strict enum validation (new_location: "current" still fails to decode). It touches packages/tui/src/config/new-session-location.ts, the config schema, and the settings docs, with unit tests. Happy to open it as a PR once the design here is settled.
Activity
opencode-agent commentedon Oct 19, 2026
Thanks for the detailed request! To restate it: you'd like to set a fixed default working directory once, for example by letting
session.new_locationincli.jsonaccept an absolute path alongsidelaunchandinherit, so new sessions always start there however OpenCode was launched. You'd also like a similar default-folder option in the desktop app. Maintainers will consider it.Related issues:
/cdcommand to switch directories inside a sessionThis can't be done as a plugin today, because the TUI chooses where a new session starts before it reaches the server, and plugins can't hook into that choice.
lucasalsouza commentedon Oct 19, 2026
Follow-up with the concrete desktop plan, since
packages/appdoes not readnew_locationat all.New sessions start from the project picked in
packages/app/src/new-session/project/controller.ts(createComposerProjectControls->useDirectoryPicker). A "default folder" setting would have to live in the app's own settings (packages/app/src/settings/general/general.tsx, persisted like the other app-local settings) and seed the initial directory instead of the last picked project. That is a separate change from the TUI one and probably wants its own issue/PR.For the CLI/TUI part I have a small patch ready locally:
session.new_locationalso accepts{ "directory": "..." }, keepinglaunch/inheritand the existing strict enum validation (new_location: "current"still fails to decode). It touchespackages/tui/src/config/new-session-location.ts, the config schema, and the settings docs, with unit tests. Happy to open it as a PR once the design here is settled.