Skip to content

Add a configurable default working directory for sessions without a specific project #2322

Closed

Description

@Astro-Han

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

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.workspace in the global config, written by openclaw setup --workspace <path>; OPENCLAW_WORKSPACE_DIR env 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.

Activity

  1. added
    help wanted
    on Aug 8, 2026
  2. M4n5ter commented on Aug 14, 2026

    @M4n5ter
    Member
    English

    Current status and overlap with the existing default Project

    This issue was opened before #2446 introduced a first-class default Project under Settings → Projects. The current behavior for a new conversation without an explicit workspace is now:

    1. An explicitly selected Project or folder
    2. The configured default Project
    3. The previously selected Project/workspace

    This ordering is implemented in resolveDesktopSessionWorkspace().

    As a result, the original “no workaround today” statement is no longer fully current: a user can add a general-purpose directory such as ~/agent as a Project and make it the default. New conversations will then start from that directory.

    #2998 is therefore not an exact duplicate, but its remaining scope is much narrower than the original issue suggests. It adds a second default location that applies only when the current selection has no Project identity. The existing default Project still wins for ordinary new conversations.

    There is also a Bot-specific inconsistency in the current implementation: Bot creation follows the current workspace selection rather than the configured default Project. #2998 addresses only the “no Project” branch by giving it a raw fallback path; it does not make Bots honor the existing default Project.

    Before proceeding with #2998, I think we should clarify the intended product behavior:

    1. Is “Ungrouped / No Project, but with a configurable cwd” a distinct capability we intentionally want?
    2. Or is the actual expectation simply that ordinary and Bot conversations should use the existing default Project?
    3. If both a default Project and a default working directory are required, what is their user-visible precedence, and how should the local-only directory behave while a remote Runtime Host is active?

    My current recommendation is to treat most of this issue as superseded by #2446. If Bots should follow the configured default, the smaller and more coherent fix would be to make Bot workspace resolution reuse the existing default-Project policy. We should add a second default setting only if keeping conversations ungrouped while assigning them a custom cwd is an explicit product requirement.

    中文

    当前状态以及与现有“默认项目”功能的重叠

    本 Issue 创建之后,#2446 已经在 设置 → 项目 中引入了正式的“默认项目”功能。目前,没有显式指定工作区的新对话会按以下顺序解析:

    1. 对话中显式选择的项目或文件夹
    2. 设置中的默认项目
    3. 上一次选择的项目或工作区

    这一优先级已经实现在 resolveDesktopSessionWorkspace() 中。

    因此,Issue 原文中“目前没有替代方案”的描述已经不完全符合现状:用户可以把 ~/agent 之类的通用目录添加为项目,并将其设为默认项目,之后的新对话就会从该目录开始。

    所以 #2998 并非代码层面的完全重复,但它实际补充的范围已经比原 Issue 所描述的窄很多:它新增的是第二个默认位置,并且只在当前选择没有项目身份时生效。对于普通新对话,现有默认项目仍然优先。

    当前实现还存在一个与 Bot 有关的不一致:Bot 创建会话时沿用当前工作区选择,并不会读取已经配置的默认项目。#2998 只是在“无项目”分支中增加了一个裸路径兜底,并没有让 Bot 遵循现有默认项目。

    在继续推进 #2998 前,我认为需要先明确产品语义:

    1. 我们是否明确需要一种独立能力:会话保持“未归属 / 无项目”,但 cwd 可以全局配置?
    2. 还是实际期望只是普通对话和 Bot 对话都遵循现有默认项目?
    3. 如果确实需要同时保留“默认项目”和“默认工作目录”,它们对用户可见的优先级是什么?连接远程 Runtime Host 时,这个仅适用于本机的目录设置又应该如何表现?

    我目前的建议是:将本 Issue 的大部分需求视为已被 #2446 取代。如果真正缺失的是 Bot 应当遵循默认项目,更小且更一致的修复是让 Bot 的工作区解析复用现有默认项目策略。只有在“保持会话未归属,同时为其指定自定义 cwd”被确认是明确产品需求时,才应增加第二个默认设置。

  3. removed
    help wanted
    on Aug 14, 2026
  4. added
    enhancement
    help wanted
    good first issue
    and removed
    help wanted
    good first issue
    on Aug 20, 2026
  5. added 5 commits that reference this issue on Aug 29, 2026
    f94b5cb
    de7c93e
    1d10097
    1e40a44
    4f8843d
  6. added
    stale
    on Sep 14, 2026
  7. github-actions commented on Sep 14, 2026

    @github-actions

    This issue has had no human activity for 30 days and has been marked stale. It will be closed in 30 days unless someone comments.

    If the issue is still current, please confirm it against the latest main and add any information that would help move it forward. Assigned issues and issues labelled pinned are exempt from this policy.

  8. removed
    good first issue
    on Sep 17, 2026
  9. Astro-Han commented on Sep 17, 2026

    @Astro-Han
    ContributorAuthor

    This is now covered by the default Project added in #2446. resolveDesktopSessionWorkspace() in apps/desktop/src/main/new-session-project.ts consults the configured default project before falling back to the previous selection or process.cwd(), so a general-purpose directory such as ~/agent can be registered as a Project and set as the default, and new conversations start there. Closing as resolved. If routing this through the Project catalog is the wrong shape for the original request, say so and we can reopen with that as the specific gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wantedstale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions