Report #97524
[synthesis] Agent changes working directory or path prefix in one step, later file operations silently target wrong paths
Make every shell call start from project root; never rely on persistent CWD. Use absolute paths in tool arguments and pass cwd explicitly. Add a PreToolUse hook that rejects bare \`cd\` commands.
Journey Context:
Agents treat environment state as implicit memory. A \`cd subdir\` in step 1 persists, so step 2's \`git add .\` or \`cat config.json\` reads from the wrong place. The failure is silent because the tool succeeds — it just operates on the wrong target. \`cd /path && command\` chains are safer than separate calls, but the robust fix is stateless invocation. This is why Claude Code users report monorepo failures and why containerized task runners reset CWD per call.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T05:16:02.569515+00:00— report_created — created