Glob patterns with ~/ expansion don't work in instructions configuration #2180

Closed
opened 2026-02-16 17:34:33 -05:00 by yindo · 5 comments
Owner

Originally created by @ZarionX5 on GitHub (Oct 19, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Glob patterns in instructions array fail to load files when using tilde (~) for home directory:

OpenCode version

0.15.8

Steps to reproduce

Add in opencode.json

"instructions": [
    "~/.config/opencode/rules/*.md"
]

Should load all .md files from the rules directory.

Only works with explicit paths:

"instructions": [
    "~/.config/opencode/rules/mcp-list.md",
    "~/.config/opencode/rules/prog-global-rules.md", 
    "~/.config/opencode/rules/user-rules.md"
]

Files:

ls -la ~/.config/opencode/rules/
total 24
drwxrwxr-x 2 user user 4096 Oct 19 20:10 ./
drwxrwxr-x 5 user user 4096 Oct 20 00:06 ../
lrwxrwxrwx 1 user user   72 Oct 19 17:03 mcp-list.md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/mcp-list.md
lrwxrwxrwx 1 user user   77 Oct 19 17:03 prog-example.-md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/prog-example.-md
lrwxrwxrwx 1 user user   81 Oct 19 20:10 prog-global-rules.md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/prog-global-rules.md
lrwxrwxrwx 1 user user   74 Oct 19 20:10 user-rules.md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/user-rules.md

Operating System

Kubuntu 24.04.3 LTS x86_64

Originally created by @ZarionX5 on GitHub (Oct 19, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Glob patterns in instructions array fail to load files when using tilde (~) for home directory: ### OpenCode version 0.15.8 ### Steps to reproduce Add in opencode.json ```json "instructions": [ "~/.config/opencode/rules/*.md" ] ``` Should load all .md files from the rules directory. Only works with explicit paths: ```json "instructions": [ "~/.config/opencode/rules/mcp-list.md", "~/.config/opencode/rules/prog-global-rules.md", "~/.config/opencode/rules/user-rules.md" ] ``` Files: ``` ls -la ~/.config/opencode/rules/ total 24 drwxrwxr-x 2 user user 4096 Oct 19 20:10 ./ drwxrwxr-x 5 user user 4096 Oct 20 00:06 ../ lrwxrwxrwx 1 user user 72 Oct 19 17:03 mcp-list.md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/mcp-list.md lrwxrwxrwx 1 user user 77 Oct 19 17:03 prog-example.-md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/prog-example.-md lrwxrwxrwx 1 user user 81 Oct 19 20:10 prog-global-rules.md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/prog-global-rules.md lrwxrwxrwx 1 user user 74 Oct 19 20:10 user-rules.md -> /home/user/dotfiles/dotfiles/dotconfig/config/opencode/rules/user-rules.md ``` ### Operating System Kubuntu 24.04.3 LTS x86_64
yindo added the bug label 2026-02-16 17:34:33 -05:00
yindo closed this issue 2026-02-16 17:34:33 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 19, 2025):

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

  • #41: Feature suggestion: Optional tilde expansion support (~/path/home/user/path) - This issue specifically discusses tilde expansion support for paths, which is directly related to glob patterns with ~/ not working in instructions configuration

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

@github-actions[bot] commented on GitHub (Oct 19, 2025): This issue might be a duplicate of existing issues. Please check: - #41: Feature suggestion: Optional tilde expansion support (`~/path` → `/home/user/path`) - This issue specifically discusses tilde expansion support for paths, which is directly related to glob patterns with `~/` not working in instructions configuration Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

will fix

@rekram1-node commented on GitHub (Oct 19, 2025): will fix
Author
Owner

@rekram1-node commented on GitHub (Oct 19, 2025):

@ZarionX5 I just tested this we definitely do expand the instructions, what makes you say they aren't expanded?

Did you restart opencode after updating your opencode.json?

I just tested with your example and your exact file names and I verified they are all read correctly

@rekram1-node commented on GitHub (Oct 19, 2025): @ZarionX5 I just tested this we definitely do expand the instructions, what makes you say they aren't expanded? Did you restart opencode after updating your opencode.json? I just tested with your example and your exact file names and I verified they are all read correctly
Author
Owner

@ZarionX5 commented on GitHub (Oct 20, 2025):

Strange. The problem is clearly present. however, I tried to run opencode on a clean Kubuntu and there was no such error. I think the problem is on my side. It is possible that my nvm may be misconfigured. So far, I do not know how to reproduce the error.

@ZarionX5 commented on GitHub (Oct 20, 2025): Strange. The problem is clearly present. however, I tried to run `opencode` on a clean `Kubuntu` and there was no such error. I think the problem is on my side. It is possible that my `nvm` may be misconfigured. So far, I do not know how to reproduce the error.
Author
Owner

@rekram1-node commented on GitHub (Oct 20, 2025):

no problem, lmk if u run into any other issues

@rekram1-node commented on GitHub (Oct 20, 2025): no problem, lmk if u run into any other issues
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2180