Skip to content

[ENHANCEMENT] Make @ file references lazy when filesystem tools are available #840

Description

@FeuFeve

Problem (one or two sentences)

@ references always inject the full contents of files and folders into the prompt. This can consume a large amount of context unnecessarily, especially when the agent already has tools to read files on demand.

Context (who is affected and when)

This mainly affects users working on medium to large codebases. It's particularly noticeable when referencing folders or mentioning the same file multiple times throughout a conversation.

Desired behavior (conceptual, not technical)

@ should remain the easiest way to reference files and folders, but it shouldn't necessarily consume context immediately. When possible, the agent should be able to use the reference only as needed instead of eagerly including all contents.

Constraints / preferences (optional)

The current behavior may still be useful in some situations, so making this configurable or automatically adapting based on the available tools would be ideal. The UX of @ references should remain unchanged.

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Zoo Code Task Links (optional)

No response

Acceptance criteria (optional)

Given an agent with filesystem read capabilities,
When a user references a file or folder with @,
Then the reference should not unnecessarily consume prompt context before the file contents are actually needed.
And the user should still benefit from the convenience of @ references.
But users who rely on the current eager behavior should still have a way to use it (e.g. through a setting or explicit action).

Proposed approach (optional)

Treat @ references as lightweight path references when the agent has filesystem read tools available, allowing it to read the contents on demand. Alternatively, provide a setting to choose between eager and lazy behavior.

Trade-offs / risks (optional)

Some prompts may intentionally rely on files being embedded immediately. Preserving the current behavior as an option would avoid breaking those workflows while allowing more efficient behavior by default for tool-enabled agents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions