@ file selector ignores path prefix instead of listing files relative to the provided path

Open 💬 1 comment Opened Jun 6, 2026 by richard-scott

What version of Codex is running?

<!-- Fill in with codex --version -->

Which Codex surface are you using?

Codex CLI / TUI

What platform is your computer?

<!-- Example: Linux x86_64, Ubuntu 24.04, bash -->

What issue are you seeing?

The @ file selector does not appear to treat path-like input as a path prefix. Instead of listing files relative to the path provided after @, it behaves like a global fuzzy filename search and returns unrelated matches.

Steps to reproduce

  1. Start Codex in a workspace with nested directories, for example:

``text
repo/
docs/
api.md
architecture.md
src/
main.rs
config.rs
``

  1. In the Codex composer, type:

``text
@docs
``

  1. Observe the selector results.
  1. Type a more specific path prefix:

``text
@docs/a
``

  1. Observe the selector results.

Expected behavior

The @ selector should list files relative to the path provided.

For example:

@docs

should list files/directories under docs/, such as:

docs/api.md
docs/architecture.md

And:

@docs/a

should list files under docs/ matching the a prefix, such as:

docs/api.md
docs/architecture.md

The selector should distinguish path-like input from global fuzzy search input. Bare input can continue using fuzzy matching, but once the user provides a path prefix, the selector should anchor results to that path.

Actual behavior

The selector returns fuzzy/global filename matches instead of listing files relative to the path typed after @.

This means a path-like selector input such as:

@docs/a

can return unrelated files from elsewhere in the workspace, instead of only files under docs/.

Why this matters

Path-relative selection is important in large codebases. Without it, the @ selector is unpredictable when multiple files have similar names across different directories, and it becomes harder to attach the intended file as context.

Suggested behavior

Use path-aware matching when the input after @ contains path syntax or resolves to a directory/prefix:

  • @docs should list files under docs/ when docs is a directory.
  • @docs/a should list files under docs/ matching a.
  • @./docs should resolve relative to the current Codex working directory.
  • @../docs should resolve relative to the current Codex working directory.
  • Bare strings that are not path prefixes can keep the current fuzzy filename search behavior.

Related issues

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗