`edit_file` and `run_terminal_cmd` tools have inconsistent working directory states causing file creation in wrong locations

Describe the Bug

The edit_file and run_terminal_cmd tools maintain separate working directory contexts, leading to inconsistent file operations. When a user changes directory using run_terminal_cmd with cd, the edit_file tool continues to operate from the original working directory, not the current terminal directory. This causes files to be created/edited in unexpected locations.

Specific Issue:

  • run_terminal_cmd maintains its own working directory state that can be changed via cd commands
  • edit_file tool uses an independent path resolution system that ignores the terminal’s current working directory
  • Users expect both tools to operate from the same working directory context
  • This leads to files being created in the wrong directories when using relative pathsSpecific Issue:
    run_terminal_cmd maintains its own working directory state that can be changed via cd commands
    edit_file tool uses an independent path resolution system that ignores the terminal’s current working directory
    Users expect both tools to operate from the same working directory context
    This leads to files being created in the wrong directories when using relative paths

Steps to Reproduce

  1. Start in workspace directory: /workspace/project-root/
  2. Use run_terminal_cmd to create a subdirectory:
    mkdir subproject
    
  3. Use run_terminal_cmd to change directory:
    cd subproject
    
  4. Verify terminal is in correct directory:
    pwd  # Shows: /workspace/project-root/subproject/
    
  5. Use edit_file to create a file with relative path:
    edit_file(target_file="config.txt", ...)
    

Actual Result: File is created at /workspace/project-root/config.txt (original directory)
Expected Result: File should be created at /workspace/project-root/subproject/config.txt (current terminal directory)

Operating System

Windows 10/11

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.0.0 (user setup)
VSCode Version: 1.96.2
Commit: 53b99ce608cba35127ae3a050c1738a959750860
Date: 2025-06-04T19:44:25.253Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Windows_NT x64 10.0.19045

Hey, appreciate the info here!

I agree that a lack of shared working directory is confusing here, both for you and the Agent, so I’ve logged this to the team to look into!