You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I second this suggestion. Copilot in VS Code has something similar. It uses the folder structure .github/instructions/*.md where the markdown file has an "applyTo" frontmatter section that uses glob matching, then targeted instructions.
Example:
---applyTo: "internal/**/service/**/*.go"---
Business logic services MUST:
- depend on interfaces for all external effects
- return concrete result structs + error
The way I understand it works is when a file under edit matches the glob pattern, the custom instructions are automatically injected into the agent instructions that is currently running.
Reacted by Ian Fosbery, doodhout, dr-lucio, Connor Brent Hatcher, Roger Siegenthaler and Lingxi
I don't really know if this feature has already been included in opencode yet, but I have found this opencode plugin that does something really similar: https://github.com/frap129/opencode-rules
I would like this functionality to be included into vanilla opencode nonetheless!
Reacted by Mark Goho, Connor Brent Hatcher, kunimitsu1983 and Mark Vunder
this would especially be interesting for monorepos with cascading AGENTS.md (one in the root, one in each package). gh copilot automatically applies cascading agents.md, but making them accessible via instructions on glob-basis would also be a good step forward
For now, the closest workaround I found is to instruct the agent to lazy-load the rules using @ references in AGENTS.md (example).
Note that this is model-driven, not a deterministic extension matcher.
Activity
github-actions commentedon Nov 25, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
ljosephpratt commentedon Jan 13, 2026
I second this suggestion. Copilot in VS Code has something similar. It uses the folder structure
.github/instructions/*.mdwhere the markdown file has an "applyTo" frontmatter section that uses glob matching, then targeted instructions.Example:
The way I understand it works is when a file under edit matches the glob pattern, the custom instructions are automatically injected into the agent instructions that is currently running.
doodhout commentedon Feb 9, 2026
I don't really know if this feature has already been included in opencode yet, but I have found this opencode plugin that does something really similar: https://github.com/frap129/opencode-rules
I would like this functionality to be included into vanilla opencode nonetheless!
DerGernTod commentedon Mar 13, 2026
this would especially be interesting for monorepos with cascading AGENTS.md (one in the root, one in each package). gh copilot automatically applies cascading agents.md, but making them accessible via instructions on glob-basis would also be a good step forward
aosama commentedon Jun 1, 2026
Hope we can get this capability to reduce barrier to transition from Github Copilot CLI or Claude Code to OpenCode
Lingxi-Li commentedon Jun 20, 2026
Claude Code also provides this feature under the name path specific rules.
For now, the closest workaround I found is to instruct the agent to lazy-load the rules using
@references inAGENTS.md(example).Note that this is model-driven, not a deterministic extension matcher.
github-actions commentedon Aug 20, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.