Summary
Once #595 ships and Netclaw tracks a session CWD in WorkingContext, the next step is making path-taking tools (shell, file_read, file_write, file_edit, and any future tool that takes a path argument) resolve relative paths against the session CWD rather than the daemon's working directory.
This is the bigger blast-radius change — every path-taking tool needs to participate. Ships after #595 so the informational version of CWD tracking can be validated first.
Reference implementations
- OpenCode uses CWD via
InstanceState.context passed through the assistant-message path stamp (packages/opencode/src/session/message-v2.ts:429-432); shell tools spawn with cwd: set from that state.
- Claude Code
shell_execute is cwd-scoped to the session per the public docs — the agent observes its own working directory and the shell tool respects it.
Acceptance criteria
Design questions (resolve before implementation)
- Does
cd come from a dedicated CLI-style tool, or is it a side effect of a shell command execution (detecting cd in shell invocation)?
- Do we allow
cd outside the daemon's configured working tree? Probably not — security boundary.
- How does the session CWD interact with sub-agent spawn? Sub-agents inherit parent CWD by default?
- Symbolic links and realpath resolution — how do we present CWD to the model (cosmetic path vs real path)?
Background
Filed as a follow-up to the compaction architecture rework. Sequenced after #595 because it has a much larger implementation surface (every path-taking tool) and deserves its own review cycle.
Summary
Once #595 ships and Netclaw tracks a session CWD in
WorkingContext, the next step is making path-taking tools (shell, file_read, file_write, file_edit, and any future tool that takes a path argument) resolve relative paths against the session CWD rather than the daemon's working directory.This is the bigger blast-radius change — every path-taking tool needs to participate. Ships after #595 so the informational version of CWD tracking can be validated first.
Reference implementations
InstanceState.contextpassed through the assistant-message path stamp (packages/opencode/src/session/message-v2.ts:429-432); shell tools spawn withcwd:set from that state.shell_executeis cwd-scoped to the session per the public docs — the agent observes its own working directory and the shell tool respects it.Acceptance criteria
shell_executespawns child process withcwd= session CWD.file_read/file_write/file_editresolve relative paths against session CWD. Absolute paths continue to work unchanged.cd <path>operation (or equivalent API — TBD in design) updates session CWD persistently for the remainder of the session.cdcannot escape approved roots (interaction with existing tool access policy / security model — needs design).Design questions (resolve before implementation)
cdcome from a dedicated CLI-style tool, or is it a side effect of a shell command execution (detectingcdin shell invocation)?cdoutside the daemon's configured working tree? Probably not — security boundary.Background
Filed as a follow-up to the compaction architecture rework. Sequenced after #595 because it has a much larger implementation surface (every path-taking tool) and deserves its own review cycle.