claude-code - 💡(How to fix) Fix [BUG] `@` file mentions don't suggest untracked files in git repositories with no commits [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48968Fetched 2026-04-17 08:54:27
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1subscribed ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The @ file mention autocomplete does not suggest any project files when the git repository has no commits and all files are untracked. Only global files (e.g., ~/.claude/CLAUDE.md) appear as suggestions. Even typing the exact prefix of an existing file (e.g., @docs-hub for docs-hub.png) produces no matches.

What Should Happen?

Files in the working directory should appear as autocomplete suggestions regardless of their git tracking status.

Error Messages/Logs

Steps to Reproduce

  1. mkdir test-repo && cd test-repo && git init
  2. echo "hello" > test.txt
  3. Do NOT run git add or git commit (all files remain untracked)
  4. Run claude
  5. Type @test in the prompt
  6. No autocomplete suggestions appear for test.txt
  7. Global files like ~/.claude/CLAUDE.md still appear when typing @

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.110

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

It appears that @ autocomplete indexes only git-tracked files (git ls-files). In a repo with 0 tracked files / 0 commits, the index is empty, so no project files are suggested. Untracked files in any repo may also be affected.

Claude can still read these files via the Read tool, so they are accessible — just not discoverable via @.

extent analysis

TL;DR

The @ file mention autocomplete issue can be addressed by modifying the indexing mechanism to include untracked files in the git repository.

Guidance

  • The issue is likely caused by the current implementation of the @ autocomplete feature, which only indexes git-tracked files using git ls-files.
  • To verify this, try running git add and git commit on the files in the repository and see if the autocomplete suggestions appear.
  • A potential workaround could be to modify the Claude Code configuration to include untracked files in the index, or to use a different indexing mechanism that includes all files in the working directory.
  • The fact that global files like ~/.claude/CLAUDE.md still appear as suggestions when typing @ suggests that the issue is specific to the project file indexing.

Example

No code snippet is provided as the issue does not contain enough information about the implementation details of the @ autocomplete feature.

Notes

The issue is reported as a regression, which suggests that the behavior changed in a recent version of Claude Code. The exact version where the behavior changed is not specified.

Recommendation

Apply workaround: Modify the indexing mechanism to include untracked files, as the current implementation only indexes git-tracked files, causing the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] `@` file mentions don't suggest untracked files in git repositories with no commits [1 comments, 2 participants]