zed icon indicating copy to clipboard operation
zed copied to clipboard

Agent Panel: currently open file not used by AI

Open petri opened this issue 7 months ago • 4 comments

Summary

Many times (always?) the agent will needlessly look up and read the code module that's currently open.

Description

Steps to trigger the problem:

  1. Open code module and agent panel
  2. See code module is automatically included in context
  3. Give instructions to do something about something that is clearly shown in the code module currently open

Actual Behavior:

The agent tries to look up a relevant file and read its content, despite it being already open in the current editor (thus included in context)

Expected Behavior:

Agent tries to check if this is about the currently open module and tries finding other code ONLY if current context is not sufficient.

Zed Version and System Specs

newest Zed at this time, Mac M4, latest OS

petri avatar May 22 '25 07:05 petri

I'm not 100% sure but it could be that you might have to click the file in the agent to actually add it. If I click it there is a close 'x' shown next to it.

rayburgemeestre avatar May 23 '25 22:05 rayburgemeestre

Are you attaching the file?

When you first open the Agent Panel you'll see the current buffer listed as a suggestion:

Image

But it won't actually be included as context unless you accept the suggestion:

Image

maxdeviant avatar May 27 '25 22:05 maxdeviant

The agent should always include the current file into the context and make it opt in to remove it. Current behaviour adds too much friction

remorses avatar Jun 01 '25 09:06 remorses

The agent should always include the current file into the context and make it opt in to remove it. Current behaviour adds too much friction

Exactly.

petri avatar Jun 02 '25 21:06 petri

The agent should always include the current file into the context and make it opt in to remove it.

+1 from me, at least as an option, I've been working in a monorepo with a lot of identically named files recently, and it's annoying having to type @/long/part/of/path.txt to find that path.txt and not /other/dir/path.txt. In general I found the usability of the old context menu a bit higher, but just this option would be good enough for me.

genevieve-me avatar Sep 04 '25 23:09 genevieve-me

Hi there! 👋 We're working to clean up our issue tracker by closing older bugs that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and it will be kept open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, it will close automatically in 14 days. Thanks for your help!

github-actions[bot] avatar Nov 19 '25 11:11 github-actions[bot]

Or even a separate command which accepts arguments and can open agent with current buffer attached, then we could also open current chat with all open buffers attached!

amritk avatar Nov 25 '25 18:11 amritk