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
The local_directory binding (run an agent in-place in a real local dir instead of a git worktree) currently only exists at the project level, so it only reaches issue tasks and project-scoped quick-create. Chat sessions can never use it — which means to make a chat agent work in a specific local folder you have to ask it to cd on every turn. This is a proposal to let a chat session run in a user-specified local directory, and a question of whether it's worth doing upstream.
The gap
chat_session has no project link (creating one only takes agent_id + title).
The daemon's chat-task claim branch never attaches project_resources, so findLocalDirectoryAssignment always resolves to nil for chat tasks → they never enter the in-place path.
Net effect: CLI agents (Claude Code / Codex) treat the current working directory as session context with zero setup; chat has no equivalent, so you either cd every turn or bind a whole project.
Why this fits the existing architecture
The in-place execution machinery already exists and is path-driven, not project-specific:
execenvLocalWorkDir / LocalDirectory — in-place, no worktree
CleanupSidecars — restore the user's dir afterward
The only thing hard-wired to project resources is the source-resolution step. chat_session even already has a work_dir column (currently daemon-backfilled for session resume). So the missing piece is an input path + wiring, not new execution logic.
Proposed direction (minimal)
A session-level optional working directory, desktop + local-daemon only:
Store an explicit bound_work_dir + bound_daemon_id on chat_session, kept separate from the backfilled work_dir so it doesn't clash with prior-session reuse.
Session binding takes precedence over project resources; everything downstream (validate / lock / in-place / cleanup) is reused unchanged.
Excluded by construction: cloud runtime, web, and channel-originated (Slack/Lark) sessions — a channel message must never be able to bind or run against a local path.
Settable at session creation and/or from the composer; show the privacy-stripped bound path in the session header so it's always visible (an agent that edits real files in a real dir should never do so invisibly).
Open questions for maintainers
Scope — is per-session local-dir binding something you'd want upstream, or intentionally out of scope for chat?
Entry model — per-session explicit binding, a project-level default that new sessions inherit, or both (session overrides project)? I lean toward per-session explicit + a visible prefill of the agent's last-used dir, rather than silent inheritance — silently writing files into a dir the user forgot they set is risky.
Offline / mismatched daemon — should the task wait for the bound machine, or fall back to a temp worktree? I lean toward wait, to avoid "thought it ran in my repo, actually ran in a temp dir".
I have a working design + PR breakdown and am happy to contribute it upstream if there's interest.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
The
local_directorybinding (run an agent in-place in a real local dir instead of a git worktree) currently only exists at the project level, so it only reaches issue tasks and project-scoped quick-create. Chat sessions can never use it — which means to make a chat agent work in a specific local folder you have to ask it tocdon every turn. This is a proposal to let a chat session run in a user-specified local directory, and a question of whether it's worth doing upstream.The gap
chat_sessionhas no project link (creating one only takesagent_id+title).project_resources, sofindLocalDirectoryAssignmentalways resolves tonilfor chat tasks → they never enter the in-place path.Net effect: CLI agents (Claude Code / Codex) treat the current working directory as session context with zero setup; chat has no equivalent, so you either
cdevery turn or bind a whole project.Why this fits the existing architecture
The in-place execution machinery already exists and is path-driven, not project-specific:
validateLocalPath— blacklist + symlink double-resolve + read/write probeLocalPathLocker— per-path serializationexecenvLocalWorkDir/LocalDirectory— in-place, no worktreeCleanupSidecars— restore the user's dir afterwardThe only thing hard-wired to project resources is the source-resolution step.
chat_sessioneven already has awork_dircolumn (currently daemon-backfilled for session resume). So the missing piece is an input path + wiring, not new execution logic.Proposed direction (minimal)
A session-level optional working directory, desktop + local-daemon only:
bound_work_dir+bound_daemon_idonchat_session, kept separate from the backfilledwork_dirso it doesn't clash with prior-session reuse.Open questions for maintainers
I have a working design + PR breakdown and am happy to contribute it upstream if there's interest.
All reactions