[PR #4499] feat: deduplicate @-referenced files in session context #10991

Closed
opened 2026-02-16 18:15:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4499

State: closed
Merged: No


Prevents files and directories referenced via @ from being loaded into the context window multiple times if they are already present in the active conversation history.

This implementation:

  • Scans the current (non-compacted) message history for existing file parts.
  • Uses the absolute file path (derived from the file URL) to identify loaded resources.
  • Skips loading any @ reference that matches an already loaded file or directory path.
  • Ensures that if a message containing a file is compacted away, the file can be re-loaded in a new message.
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4499 **State:** closed **Merged:** No --- Prevents files and directories referenced via `@` from being loaded into the context window multiple times if they are already present in the active conversation history. This implementation: - Scans the current (non-compacted) message history for existing file parts. - Uses the absolute file path (derived from the file URL) to identify loaded resources. - Skips loading any `@` reference that matches an already loaded file or directory path. - Ensures that if a message containing a file is compacted away, the file can be re-loaded in a new message.
yindo added the pull-request label 2026-02-16 18:15:45 -05:00
yindo closed this issue 2026-02-16 18:15:46 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10991