apache / apache/maka

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

Open
#2,322 2 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted stale
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
715

Description

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

Contributor guide

Open the contributing guide

Research direction

Start by tracing createProjectRootController.current(), lastProjectPathFile, and fallbackRoots([process.cwd(), app.getAppPath()]) to understand current resolution and persistence. Add the Settings → General picker and clear action, then verify that explicit folders take precedence, the configured directory persists across restarts, and unbound bot conversations use it as their cwd.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.