I understand your frustration with Agent Mode getting confused about the current directory. This is a known issue with how terminals and shells handle directory tracking, and it's not specific to Warp's Agent Mode.
Based on the knowledge sources, this behavior is related to how Unix-based systems handle directory paths. When a directory is deleted and recreated (which can happen during file operations), the shell can get confused because it's still referencing the old directory identifier internally, even though the path looks the same.
As explained in a GitHub issue:
The current directory, while represented visually to you as a file path, is actually internally represented by a unique identifier for the working directory. When you delete and recreate the folder at a given path, the shell is still actually within the old working directory. GitHub Issue #2883
This is standard Unix behavior and would happen in any terminal, not just Warp.
Workarounds
The most reliable workaround is to use the cd command to reorient after operations that might affect the directory structure:
- Use
cd .. followed by cd back/to/directory to refresh the shell's understanding of the current directory
- Or simply use
cd . to refresh the current directory reference
This forces the shell to re-evaluate the directory structure and update its internal reference.
For Agent Mode specifically, you might want to:
- Start new conversations for distinct tasks to avoid confusion in long conversations
- Attach relevant context blocks to your queries using the context attachment feature (CMD+UP/DOWN on macOS or CTRL+UP/DOWN on Windows/Linux) Conversations with Agent Mode