[FEATURE]: Setting Glob-based rules #3100

Open
opened 2026-02-16 17:38:38 -05:00 by yindo · 3 comments
Owner

Originally created by @EasyDevv on GitHub (Nov 24, 2025).

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Image

I discovered an interesting feature in Google Antigravity IDE.

Users can specify when rules should be triggered, and the glob functionality looks particularly useful.

The rules are stored in Markdown format, and when you specify glob patterns, the rules are only included for matching file types.

The general structure is as follows:

.agent/rules/frontend.md

---
trigger: glob
globs: *.svelte, *.ts
---

frontend rules

.agent/rules/AGENTS.md

---
trigger: always_on
---

main rules
Originally created by @EasyDevv on GitHub (Nov 24, 2025). ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request <img width="195" height="235" alt="Image" src="https://github.com/user-attachments/assets/51471515-3f06-4e8a-9e76-e55826c8e994" /> I discovered an interesting feature in Google Antigravity IDE. Users can specify when rules should be triggered, and the glob functionality looks particularly useful. The rules are stored in Markdown format, and when you specify glob patterns, the rules are only included for matching file types. The general structure is as follows: ## .agent/rules/frontend.md ```md --- trigger: glob globs: *.svelte, *.ts --- frontend rules ``` ## .agent/rules/AGENTS.md ```md --- trigger: always_on --- main rules ```
yindo added the discussion label 2026-02-16 17:38:38 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 24, 2025):

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

  • #1028: Improve AGENTS.md structure for task-specific instructions and reduced context crowding - Discusses conditional loading of instructions based on task context and file patterns
  • #583: feature request: ability to configure which file will contain agent rules - Related to flexible rule file configuration

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

@github-actions[bot] commented on GitHub (Nov 24, 2025): This issue might be a duplicate of existing issues. Please check: - #1028: Improve AGENTS.md structure for task-specific instructions and reduced context crowding - Discusses conditional loading of instructions based on task context and file patterns - #583: feature request: ability to configure which file will contain agent rules - Related to flexible rule file configuration Feel free to ignore if none of these address your specific case.
Author
Owner

@ljosephpratt commented on GitHub (Jan 12, 2026):

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.

@ljosephpratt commented on GitHub (Jan 12, 2026): 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: ```md --- 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.
Author
Owner

@doodhout commented on GitHub (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!

@doodhout commented on GitHub (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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3100