Cannot @tag/reference files in dot-directories (e.g., .cursor/commands/*.md) #8262

Closed
opened 2026-02-16 18:09:33 -05:00 by yindo · 3 comments
Owner

Originally created by @raychrisgdp on GitHub (Feb 1, 2026).

Originally assigned to: @rekram1-node on GitHub.

Cannot @tag/reference files in dot-directories (e.g., .cursor/commands/*.md)

Status: Resolved via workaround

Solution: Create a .ignore file with !.cursor/ patterns to un-ignore the dot-directory. See comment below for full details.

Originally created by @raychrisgdp on GitHub (Feb 1, 2026). Originally assigned to: @rekram1-node on GitHub. Cannot @tag/reference files in dot-directories (e.g., .cursor/commands/*.md) **Status**: Resolved via workaround **Solution**: Create a `.ignore` file with `!.cursor/` patterns to un-ignore the dot-directory. See comment below for full details.
yindo closed this issue 2026-02-16 18:09:33 -05:00
Author
Owner

@raychrisgdp commented on GitHub (Feb 1, 2026):

Bug Description

Opencode cannot reference/tag files that are located in directories starting with a dot (.), even when those files are explicitly added to the instructions array in opencode.json.

Environment

  • Opencode version: (latest)
  • OS: Linux
  • Project structure: Has .cursor/commands/ directory with markdown files

Steps to Reproduce

  1. Create a directory structure with dot-prefixed folder (e.g., .cursor/commands/)
  2. Add files to that directory (e.g., .cursor/commands/review.md)
  3. Add the files to opencode.json instructions:
    {
      "$schema": "https://opencode.ai/config.json",
      "instructions": [".cursor/commands/*.md"]
    }
    
    Or even with explicit paths:
    {
      "instructions": [".cursor/commands/review.md"]
    }
    
  4. Try to @tag the file in chat (e.g., @.cursor/commands/review.md)

Expected Behavior

The file should appear in the autocomplete dropdown and be taggable/referenceable, just like files in non-dot directories.

Actual Behavior

  • The file does not appear when trying to @tag it
  • Typing @.cursor/commands/ shows no suggestions
  • The glob pattern in instructions does not make the files taggable

Workarounds Attempted

  • Tried glob pattern: ".cursor/commands/*.md"
  • Tried explicit file listing: ".cursor/commands/review.md"
  • Tried moving to non-dot directory (cursor/commands/) ✓ (works, but not ideal)

Additional Context

  • The glob search tool (glob) also fails to find these files when using patterns like .cursor/**/*.md
  • However, ls -la .cursor/commands/ confirms the files exist
  • This affects development workflows that rely on dot-directories (like .cursor/, .vscode/, etc.)

Possible Root Cause

Opencode may be filtering out dotfiles/dot-directories when building the file index for @tagging, even when they're explicitly listed in the instructions array.

@raychrisgdp commented on GitHub (Feb 1, 2026): ## Bug Description Opencode cannot reference/tag files that are located in directories starting with a dot (`.`), even when those files are explicitly added to the `instructions` array in `opencode.json`. ## Environment - **Opencode version**: (latest) - **OS**: Linux - **Project structure**: Has `.cursor/commands/` directory with markdown files ## Steps to Reproduce 1. Create a directory structure with dot-prefixed folder (e.g., `.cursor/commands/`) 2. Add files to that directory (e.g., `.cursor/commands/review.md`) 3. Add the files to `opencode.json` instructions: ```json { "$schema": "https://opencode.ai/config.json", "instructions": [".cursor/commands/*.md"] } ``` Or even with explicit paths: ```json { "instructions": [".cursor/commands/review.md"] } ``` 4. Try to @tag the file in chat (e.g., `@.cursor/commands/review.md`) ## Expected Behavior The file should appear in the autocomplete dropdown and be taggable/referenceable, just like files in non-dot directories. ## Actual Behavior - The file does **not** appear when trying to @tag it - Typing `@.cursor/commands/` shows no suggestions - The glob pattern in `instructions` does not make the files taggable ## Workarounds Attempted - Tried glob pattern: `".cursor/commands/*.md"` ❌ - Tried explicit file listing: `".cursor/commands/review.md"` ❌ - Tried moving to non-dot directory (`cursor/commands/`) ✓ (works, but not ideal) ## Additional Context - The glob search tool (`glob`) also fails to find these files when using patterns like `.cursor/**/*.md` - However, `ls -la .cursor/commands/` confirms the files exist - This affects development workflows that rely on dot-directories (like `.cursor/`, `.vscode/`, etc.) ## Possible Root Cause Opencode may be filtering out dotfiles/dot-directories when building the file index for @tagging, even when they're explicitly listed in the instructions array.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 1, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6618: '@' is not listing the available files - users report @ autocomplete not showing files in dot-directories like .ai/prompts/
  • #4689: list tool returns empty directory for readable hidden directories - files in hidden directories like .claude/commands/ are not discoverable
  • #6985: [FEATURE] Add .claude/commands/ compatibility - requests support for dot-directory commands similar to your use case

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 1, 2026): This issue might be a duplicate of existing issues. Please check: - #6618: '@' is not listing the available files - users report @ autocomplete not showing files in dot-directories like .ai/prompts/ - #4689: list tool returns empty directory for readable hidden directories - files in hidden directories like .claude/commands/ are not discoverable - #6985: [FEATURE] Add .claude/commands/ compatibility - requests support for dot-directory commands similar to your use case Feel free to ignore if none of these address your specific case.
Author
Owner

@raychrisgdp commented on GitHub (Feb 1, 2026):

Issue Resolved

The issue is now resolved. The problem was that dot-directories like .cursor/ are being ignored by default by the underlying ripgrep tool that OpenCode uses for file discovery.

Solution

Create a .ignore file in your project root with exclusion patterns to un-ignore the dot-directory:

!.cursor/
!.cursor/**

This tells ripgrep to not ignore the .cursor/ directory, making files within it discoverable by the @ tagging system.

Root Cause

As explained in #4689, the list tool uses ripgrep which respects ignore patterns. Dot-directories are often excluded by default or by global gitignore settings. The .ignore file takes precedence and allows explicit un-ignoring of specific directories.

Related Issues

  • #4689 - "list tool returns empty directory for readable hidden directories" - Contains the same root cause and solution
  • #6618 - "@ is not listing the available files" - Related issue about file autocomplete

Note: The instructions array in opencode.json is for providing instructions content to the LLM, not for making files discoverable for @ tagging. The .ignore file is the correct approach for file visibility.

Closing this as the workaround is effective.

@raychrisgdp commented on GitHub (Feb 1, 2026): ## ✅ Issue Resolved The issue is now **resolved**. The problem was that dot-directories like `.cursor/` are being ignored by default by the underlying ripgrep tool that OpenCode uses for file discovery. ### Solution Create a `.ignore` file in your project root with exclusion patterns to un-ignore the dot-directory: ``` !.cursor/ !.cursor/** ``` This tells ripgrep to **not ignore** the `.cursor/` directory, making files within it discoverable by the `@` tagging system. ### Root Cause As explained in #4689, the `list` tool uses ripgrep which respects ignore patterns. Dot-directories are often excluded by default or by global gitignore settings. The `.ignore` file takes precedence and allows explicit un-ignoring of specific directories. ### Related Issues - #4689 - "list tool returns empty directory for readable hidden directories" - Contains the same root cause and solution - #6618 - "`@` is not listing the available files" - Related issue about file autocomplete **Note**: The `instructions` array in `opencode.json` is for providing instructions content to the LLM, not for making files discoverable for `@` tagging. The `.ignore` file is the correct approach for file visibility. Closing this as the workaround is effective.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8262