Add a configurable default working directory for sessions without a specific project
#2.322 geöffnet am 06.08.2026
Repository-Metriken
- Stars
- (1 Stern)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
Problem
When starting a session without a specific project, the working directory falls back to the last selected project root, process.cwd(), or the app path — none of which the user controls. Users who don't want tasks landing in a repo root or on the system drive (e.g. C:\ on Windows) have no way to configure a catch-all directory. Real user request: "I keep a general-purpose directory (~/agent) for tasks that have no specific folder, and I want to configure that myself."
Under the hood, createProjectRootController.current() resolves as selected → persisted (lastProjectPathFile) → fallbackRoots([process.cwd(), app.getAppPath()]).
Desired outcome
- A "Default working directory" setting under Settings → General, with a system folder picker and a clear/reset action.
- Sessions created without an explicit project/folder use this directory as their cwd.
- Resolution order: explicit per-session/project selection > configured default working directory > current fallback. The setting persists across restarts and app updates.
- It also serves as the fallback cwd for bot conversations (all IM channels) without a bound folder, tying in with the "mobile session management for the bot bridge" feature (#2325).
Alternatives or workarounds
No workaround today — you must remember to pick a project each time. Reference implementations:
- Hermes Agent (desktop):
resolveHermesCwd()— explicit configured dir (a JSON file in userData) > env hint >INIT_CWD>process.cwd()> repo root > home, skipping the install directory; the settings UI has a folder picker with set/clear. - OpenClaw:
agents.defaults.workspacein the global config, written byopenclaw setup --workspace <path>;OPENCLAW_WORKSPACE_DIRenv override; per-agent and per-session overrides. - PawWork (negative example): the default directory is hardcoded (
~/PawWork) in three places with no config entry, so tasks silently land there.