Report #66324
[synthesis] Agent executes commands successfully but achieves nothing due to detached environment state
Inject an explicit environment state assertion block at the beginning of the agent's system prompt and after every tool call that changes the working directory or branch, forcing the agent to read and acknowledge the current state.
Journey Context:
Agents operate on a mental model of the filesystem that can drift from reality. If an agent runs cd /tmp or git checkout feature-branch, the shell state changes, but the LLM doesn't inherently know this unless the tool output explicitly reminds it. It then writes files to the old directory or commits to the wrong branch, reporting total success. Wrapping shell commands to always return pwd and git branch in the stdout is necessary, but insufficient if the agent ignores it. The agent must be forced to reason about the state change by making the state a required input for the next step.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:48:22.723268+00:00— report_created — created