anthropics / anthropics/claude-code

[BUG] @ file mentions cannot reference files inside nested git repositories (desktop Code tab)

Open
#94,991 0 comments 0 reactions 0 assignees View on GitHub
area:desktop bug has repro platform:linux
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

# @ file mentions cannot reference files inside nested git repositories

## Environment

- Claude Code 2.1.260 (Agent SDK 0.3.260), entrypoint `claude-desktop`
- Claude Desktop 1.49585.0
- Linux 7.0.0-31-generic

## Summary

In the desktop app's Code tab, the `@` file-mention picker returns no suggestions
for any file located inside a nested git repository, even when that path is fully
readable by the agent and excluded from no ignore rule.

The agent process and the picker disagree about which files exist: the agent can
read and grep these files without issue, but the user cannot reference them.

## Setup

A parent repo containing two independently-managed child repos, each with its own
`.git`:

```
options_app/ <- parent repo, project root
├── .git/
├── ib_trading/ <- independent repo
│ ├── .git/
│ └── app.py
└── options_ui/ <- independent repo
└── .git/
```

## Steps to reproduce

1. Open the parent repo as the project in the desktop app's Code tab.
2. Type `@app.py` in the input box (the file exists at `ib_trading/app.py`).

## Expected

`ib_trading/app.py` is suggested.

## Actual

No suggestions appear. The same holds for every file under either child repo.
`@README.md` (a file at the project root) works correctly, so the picker itself
is functional — it just never descends into the nested repos.

## What we ruled out

This is not a `.gitignore` problem. Each was tested with a full app restart:

1. **A `.ignore` file negating the entries.** `ripgrep` honors it — `rg --files
ib_trading` lists the files, and the agent's own search works. The picker is
unaffected.

2. **`respectGitignore: false` in project `.claude/settings.json`.** No effect on
the picker. Project settings *are* being read: an `env` marker set in the same
file appeared in the agent's environment, confirming the file is loaded and
parsed. The setting is documented as "Whether file picker should respect
.gitignore files", but appears to govern only the CLI/TUI picker, not the
desktop one.

3. **`fileSuggestion: { type: "command", ... }` in project settings.** Documented
as "Custom file suggestion configuration for @ mentions". Pointed at a script
returning 894 paths including `ib_trading/app.py`. No effect on the picker.

4. **Removing the entries from `.gitignore` entirely.** After restart, the child
repos were no longer ignored by git (`git check-ignore` confirmed), and the
picker still returned nothing for files inside them.

Step 4 is the important one: with no ignore rule in play at all, the picker still
skips these paths. That points at the directory walker stopping at the nested
`.git` boundary (or enumerating only git-tracked files of the root repo), rather
than at ignore-rule handling.

5. **`permissions.additionalDirectories`.** Adding the child repos here grants the
agent permission scope but does not add them to the picker's index, and the
grants are dropped on restart.

## Impact

Nested independent repositories are a common layout for a backend/frontend pair
developed together but released separately. In that layout the `@` mention
feature — the primary way to point Claude at a specific file — is unusable for
essentially the entire codebase. The only workaround is to open each child repo
as its own project window, which gives up the cross-repo context that motivated
the parent workspace.

## Suggested fix

Either have the desktop picker traverse into nested repositories (applying each
one's own ignore rules, which correctly excludes `node_modules`, `__pycache__`,
build output, etc.), or make it honor `respectGitignore` / `fileSuggestion` so
there is at least a documented escape hatch for this layout.

## Related issues

- #14904 — `respectGitignore: false` not honored by the file picker. Matches
finding 2 above; this report adds that the problem persists with no ignore rule
present at all, which suggests a second, independent cause.
- #94522, #7412 — `@` autocomplete ignores additional working directories.
Matches finding 5 above.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the claude-desktop Code tab’s @ file-mention picker and reproduce with a parent repo containing ib_trading/app.py and a nested .git directory. Compare its traversal with the agent’s search, checking whether the walker stops at nested .git boundaries or only enumerates root-repository files. Done when files in both child repositories are suggested without breaking normal ignore behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.