Skip to content

plugin system: add support for rules/instructions#301172

Merged
connor4312 merged 2 commits intomainfrom
connor4312/plugin-rules
Mar 12, 2026
Merged

plugin system: add support for rules/instructions#301172
connor4312 merged 2 commits intomainfrom
connor4312/plugin-rules

Conversation

@connor4312
Copy link
Member

  • 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)

…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)
Copilot AI review requested due to automatic review settings March 12, 2026 17:27
@connor4312 connor4312 enabled auto-merge (squash) March 12, 2026 17:27
@connor4312 connor4312 self-assigned this Mar 12, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IAgentPluginInstruction and exposes plugin instructions via IAgentPlugin.instructions.
  • Implements rule file discovery from rules/ (and manifest-specified supplemental paths) supporting .mdc, .md, and .instructions.md with longest-suffix-first name derivation and deduping.
  • Wires plugin instructions into PromptsService so listPromptFiles(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.

Copy link
Member

@pwang347 pwang347 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@connor4312 connor4312 merged commit 2d08838 into main Mar 12, 2026
19 checks passed
@connor4312 connor4312 deleted the connor4312/plugin-rules branch March 12, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants