Skip to content

AI: When editing a single file, agent thinks it is a “project directory” #32923

@quinncomendant

Description

@quinncomendant

Summary

When opening a single file in Zed, the agent is unable to find the project directory, and believes the file itself is a directory.

Description

Steps to trigger the problem:

  1. Create a “Hello world” bash script at ~/bin/test
  2. Open the file: zed ~/bin/test
  3. Using the “Write” profile, ask the agent to execute the script and return its output with this prompt:
This file is a bash script named `test`. Please execute the file and provide me with its contents. 

Expected Behavior: The agent will execute ~/bin/test and return its output (“Hello world”).
Actual Behavior: The agent thinks ~/bin/test is a directory, and you will see cd: /Users/q/bin/test: Not a directory errors.

I'm guessing the problem may be caused by opening Zed with a single file, rather than opening a “project directory”. The agent was designed to work in the context of a project directory, and isn't makes the assumption that the path provided to it is a directory, rather than a single file.

This issue is important for me, because I often edit single file scripts from my ~/bin/ directory and want the agent to be able to modify the file and execute it.

Image

Model Provider Details

  • Provider: Anthropic via API key
  • Model Name: Sonnet 4 Thinking
  • Mode: Agent Panel
  • Other Details: using Write profile with default tools.

Zed Version and System Specs

Zed: v0.190.6 (Zed)
OS: macOS 15.5.0
Memory: 32 GiB
Architecture: aarch64

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:aiImprovement related to Agent Panel, Edit Prediction, Copilot, or other AI featuresstate:needs triagetriage is not complete: no `area:*` label, or no `priority:*`/`frequency:*` for Bugs/Crashes

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions