Skip to content

Prioritize recent file references in Codex chat autocomplete for @file mentions #17255

@sidscrazy

Description

@sidscrazy

What version of the IDE extension are you using?

26.325.31654

What subscription do you have?

Pro

Which IDE are you using?

Cursor

What platform is your computer?

Windows

What issue are you seeing?

Issue description
When referencing files in Codex chat, autocomplete does not prioritize files that were referenced very recently in the same workflow. This is especially painful for long filenames that I repeatedly use across multiple prompts.

For example, if I recently referenced GenerateQuestionsPage.tsx, and then start typing part of that filename again, Codex should strongly favor that same file in the top suggestions. Instead, the suggestion list often surfaces other similarly named files first, forcing me to continue typing much more of the full filename again and again.

This makes repeated file referencing unnecessarily slow and frustrating, particularly in real projects where long filenames are common and the same few files are referenced repeatedly during a session.

This feels like the ranking logic is underweighting a very strong signal: recent file references in Codex chat. Cursor chat handles this better. Browser URL bars are another good analogy: recently and frequently accessed items are typically ranked very highly once the typed prefix overlaps.

Expected behavior
If a file exists in the user’s recently referenced files in Codex chat, that recency should strongly influence autocomplete ranking.

At minimum:

the top 1–2 suggestions should prefer files referenced most recently
this should apply when the typed text partially matches one of the last several referenced files
recent-reference ranking should be especially strong for long filenames and repeated use within the same session

A reasonable heuristic would be:

maintain a rolling set of the last X referenced files in Codex chat, for example 10
when the user types a partial filename matching one of those files, boost those recent files above generic similarity matches
combine recency with prefix match quality, rather than using only fuzzy matching or global filename similarity

Actual behavior
Autocomplete appears to rank based mostly on generic name matching, without giving enough weight to files I referenced just moments ago. As a result, for long filenames with similar alternatives, I often have to type nearly the full filename every time.

Why this matters
This adds friction to a very common workflow:

reference a file
ask Codex to modify or inspect it
reference the same file again in the next prompt

When that loop repeats across several prompts, the autocomplete behavior noticeably slows down usage and makes Codex feel less context-aware than it should.

Concrete example
I repeatedly reference GenerateQuestionsPage.tsx in Codex chat. Even after recently using it, I still have to type a large portion of the filename again before it becomes the top suggestion.

Suggested fix
Update file mention autocomplete ranking to include a strong recency signal from Codex chat history. Recently referenced files should be boosted into the top suggestions when the user types a matching prefix or partial name.

A simple ranking improvement could be:

  1. exact prefix match
  2. recent references in current session
  3. recent references across recent sessions
  4. frequency of prior references
  5. then generic fuzzy match
Image

What steps can reproduce the bug?

  1. Open Codex chat in a repo containing multiple files with similar names, including one with a relatively long filename.
  2. Reference a long file, for example GenerateQuestionsPage.tsx.
  3. Send a prompt using that file reference.
  4. In the next prompt, start typing the same filename again using only an initial partial string, such as Gener or GenerateQ.
  5. Observe the autocomplete suggestions.

Actual result
The recently referenced file is not reliably prioritized, and I often need to type much more of the full filename before it appears at the top.

What is the expected behavior?

Expected result
The file that was referenced most recently, such as GenerateQuestionsPage.tsx, should appear in the top 1–2 suggestions.

Additional information

Cursor chat gets it better, you can also use the algorithm of browser typed suggestions to create a good useful and intuitive solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestextensionIssues related to the VS Code extension

    Type

    No type
    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