Description
@file mentions cannot find or autocomplete any files located inside symlinked directories within the workspace. This makes it impossible to reference files via @file if they reside in a symlinked subtree.
For example, in a project like:
workspace/
.agents-global/ → /Users/user/.agents/ (symlink)
skills/
skill-foo/SKILL.md
Typing @file .agents-global/skills/skill-foo/SKILL.md does not resolve or autocomplete the file. The same issue applies to any symlinked directory — files are simply missing from the search index.
Root Cause
The file search cache is built by File.scan() which calls rg.files({ cwd: ctx.directory }) without the follow option. Ripgrep by default does not traverse symlinked directories unless --follow is explicitly passed.
Affected code paths:
- packages/opencode/src/file/index.ts:378 — rg.files({ cwd }) missing follow: true
- packages/opencode/src/file/ripgrep.ts:199-210 — filesArgs() only adds --follow when input.follow is truthy
- packages/opencode/src/file/index.ts:570-610 — list() maps symlink entries as "file" not "directory", so symlinked dirs also can't be browsed in the file tree
Suggested Fix
Add follow: true to the rg.files() call in scan():
// file/index.ts line 378
const files = yield* rg.files({ cwd: ctx.directory, follow: true }).pipe(
Plugins
No response
OpenCode version
1.15.10
Steps to reproduce
-
Create a symlink inside an OpenCode workspace:
cd /path/to/workspace
ln -s /some/external/directory my-symlink
-
Open the workspace in OpenCode.
-
In the chat input, type @file my-symlink/ and observe no autocomplete suggestions for files within.
-
Try to reference a specific file: @file my-symlink/foo.ts — the file is not found/attached.
Screenshot and/or share link
No response
Operating System
macOS 15.6 (Darwin 24.6.0 x86_64)
Terminal
Ghostty (xterm-ghostty)
Reactions are currently unavailable
Description
@file mentions cannot find or autocomplete any files located inside symlinked directories within the workspace. This makes it impossible to reference files via @file if they reside in a symlinked subtree.
For example, in a project like:
workspace/ .agents-global/ → /Users/user/.agents/ (symlink) skills/ skill-foo/SKILL.mdTyping @file .agents-global/skills/skill-foo/SKILL.md does not resolve or autocomplete the file. The same issue applies to any symlinked directory — files are simply missing from the search index.
Root Cause
The file search cache is built by File.scan() which calls rg.files({ cwd: ctx.directory }) without the follow option. Ripgrep by default does not traverse symlinked directories unless --follow is explicitly passed.
Affected code paths:
Suggested Fix
Add follow: true to the rg.files() call in scan():
Plugins
No response
OpenCode version
1.15.10
Steps to reproduce
Create a symlink inside an OpenCode workspace:
Open the workspace in OpenCode.
In the chat input, type @file my-symlink/ and observe no autocomplete suggestions for files within.
Try to reference a specific file: @file my-symlink/foo.ts — the file is not found/attached.
Screenshot and/or share link
No response
Operating System
macOS 15.6 (Darwin 24.6.0 x86_64)
Terminal
Ghostty (xterm-ghostty)