plugin system: add support for rules/instructions#301172
Merged
connor4312 merged 2 commits intomainfrom Mar 12, 2026
Merged
Conversation
…n spec
- Adds IAgentPluginInstruction interface and instructions property to IAgentPlugin
observable stream, following the same pattern as commands/skills/agents
- Implements _readRules() method in agentPluginServiceImpl to discover rule files
(.mdc, .md, .instructions.md) from the rules/ directory and supplemental paths
defined in the plugin manifest. Uses longest-match-first suffix stripping to
correctly derive rule names.
- Wires observeComponent('rules', ...) in _toPlugin() to integrate manifest
'rules' field configuration with the discovery mechanism
- Adds plugin instructions to the prompt file discovery system via watchPluginPromptFilesForType,
making instructions available alongside filesystem-discovered instructions
- Includes comprehensive test coverage for rule discovery patterns, suffix stripping,
deduplication, and reactive observable integration
(Commit message generated by Copilot)
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for plugin-provided “rules” as instruction files, integrating them into the agent plugin discovery pipeline and the prompts discovery system so they show up alongside filesystem/extension instructions.
Changes:
- Introduces
IAgentPluginInstructionand exposes plugin instructions viaIAgentPlugin.instructions. - Implements rule file discovery from
rules/(and manifest-specified supplemental paths) supporting.mdc,.md, and.instructions.mdwith longest-suffix-first name derivation and deduping. - Wires plugin instructions into
PromptsServicesolistPromptFiles(PromptsType.instructions)includes plugin-provided instruction files, and adds tests around discovery and listing behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/plugins/agentPluginService.ts | Adds the IAgentPluginInstruction type and instructions observable on IAgentPlugin. |
| src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts | Discovers rule/instruction files from rules/ and manifest-configured paths; exposes them as plugin instructions. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts | Includes plugin instructions in prompt file discovery via watchPluginPromptFilesForType. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts | Adds coverage for plugin instructions appearing in listPromptFiles and updating with observable changes. |
| src/vs/workbench/contrib/chat/test/common/plugins/agentPluginFormatDetection.test.ts | Adds discovery tests for rules/instructions files, manifest path options, suffix stripping, and deduping. |
You can also share your feedback on Copilot code review. Take the survey.
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/test/common/plugins/agentPluginFormatDetection.test.ts
Outdated
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts
Show resolved
Hide resolved
pwang347
approved these changes
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Commit message generated by Copilot)