Skip to content

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

Closed

Description

@raychrisgdp

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.

Activity

  1. raychrisgdp commented on Feb 2, 2026

    @raychrisgdp
    Author

    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.

  2. github-actions commented on Feb 2, 2026

    @github-actions
    Contributor

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

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

  3. raychrisgdp commented on Feb 2, 2026

    @raychrisgdp
    Author

    ✅ 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

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions