When auto-mode creates a worktree and chdir's into it, the Node process cwd changes but AgentSession._cwd stays frozen at the original path. Every newSession() builds a system prompt telling the LLM "Current working directory: /original/path", so the LLM cd's back there and writes files to the wrong location. Update _cwd = process.cwd() at the start of newSession() so the system prompt reflects the actual working directory after chdir. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| tsconfig.json | ||