Skip to content

Commit c080b0a

Browse files
fix(agents): add subagent support with dedicated subagent files and simplified prompts (#639)
Previously, parent agents contained large inline instruction blocks for tasks like research, validation, implementation, and prompt testing. This made agents difficult to maintain, test independently, and reuse across workflows. This PR extracts those responsibilities into eight dedicated subagent files and updates the entire agent ecosystem accordingly. **Subagent extraction** — Eight focused subagents now live under `.github/agents/subagents/`: `implementation-validator`, `phase-implementor`, `plan-validator`, `prompt-evaluator`, `prompt-tester`, `prompt-updater`, `researcher-subagent`, and `rpi-validator`. Each owns a single responsibility that was previously duplicated or embedded inline across multiple parent agents. **Parent agent rewrites** — Seven parent agents (`rpi-agent`, `task-implementor`, `task-planner`, `task-researcher`, `task-reviewer`, `prompt-builder`, `doc-ops`) were restructured to declare subagent dependencies through `agents:` frontmatter with glob-based resolution paths. The agents now orchestrate work by invoking subagents rather than executing everything inline. **Prompt simplification** — Eight prompt files were reduced to lean wrappers containing only the user-facing Requirements section. Workflow logic that previously lived in prompts moved into their corresponding agents, giving prompts a clear single purpose: capture user intent and delegate. **Instructions update** — The `prompt-builder.instructions.md` file gained guidance for the new subagent structural template, agent delegation patterns, and sandbox environment definitions. **Configuration and discovery** — VS Code settings, `copilot-instructions.md`, and `CUSTOM-AGENTS.md` were updated so the new `subagents/` directory is discoverable and the documentation reflects current terminology and architecture. **Collection and plugin alignment** — All nine collection manifests and their corresponding markdown descriptions were updated to include the new subagent entries. Plugin outputs were regenerated with updated agent tables and symlinks. ## Related Issue(s) <!-- No issue references detected in commits or branch name --> ## Type of Change Select all that apply: **Code & Documentation:** - [x] Bug fix (non-breaking change fixing an issue) - [ ] New feature (non-breaking change adding functionality) - [ ] Breaking change (fix or feature causing existing functionality to change) - [ ] Documentation update **Infrastructure & Configuration:** - [ ] GitHub Actions workflow - [ ] Linting configuration (markdown, PowerShell, etc.) - [ ] Security configuration - [ ] DevContainer configuration - [ ] Dependency update **AI Artifacts:** - [x] Reviewed contribution with `prompt-builder` agent and addressed all feedback - [x] Copilot instructions (`.github/instructions/*.instructions.md`) - [x] Copilot prompt (`.github/prompts/*.prompt.md`) - [x] Copilot agent (`.github/agents/*.agent.md`) - [ ] Copilot skill (`.github/skills/*/SKILL.md`) > **Note for AI Artifact Contributors**: > > - **Agents**: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review `.github/agents/` before creating new ones. > - **Skills**: Must include both bash and PowerShell scripts. See [Skills](../docs/contributing/skills.md). > - **Model Versions**: Only contributions targeting the **latest Anthropic and OpenAI models** will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected. > - See [Agents Not Accepted](../docs/contributing/custom-agents.md#agents-not-accepted) and [Model Version Requirements](../docs/contributing/ai-artifacts-common.md#model-version-requirements). **Other:** - [ ] Script/automation (`.ps1`, `.sh`, `.py`) - [ ] Other (please describe): ## Sample Prompts (for AI Artifact Contributions) **User Request:** `/rpi Research, plan, and implement subagent support for the task-planner agent` **Execution Flow:** 1. User invokes `rpi-agent`; the agent loads subagents via `agents:` frontmatter glob paths 2. Research phase delegates to `researcher-subagent` for codebase analysis 3. Planning phase invokes `plan-validator` to validate the generated plan against research findings 4. Implementation phase delegates to `phase-implementor` for each phase, with change tracking 5. Review phase uses `rpi-validator` per phase and `implementation-validator` for quality assessment **Output Artifacts:** Tracking artifacts in `.copilot-tracking/` remain unchanged. Subagent delegation is transparent to the user; parent agents orchestrate the workflow using glob-based subagent resolution. **Success Indicators:** - Parent agents invoke subagents through the subagent tool without manual intervention - Subagent files appear in `.github/agents/subagents/` and are discoverable via `chat.agentFilesLocations` - Collection manifests include all subagent dependencies for each parent agent ## Testing <!-- Describe how you tested these changes --> ## Checklist ### Required Checks - [ ] Documentation is updated (if applicable) - [ ] Files follow existing naming conventions - [ ] Changes are backwards compatible (if applicable) - [ ] Tests added for new functionality (if applicable) ### AI Artifact Contributions <!-- If contributing an agent, prompt, instruction, or skill, complete these checks --> - [ ] Used `/prompt-analyze` to review contribution - [ ] Addressed all feedback from `prompt-builder` review - [ ] Verified contribution follows common standards and type-specific requirements ### Required Automated Checks The following validation commands must pass before merging: - [ ] Markdown linting: `npm run lint:md` - [ ] Spell checking: `npm run spell-check` - [ ] Frontmatter validation: `npm run lint:frontmatter` - [ ] Link validation: `npm run lint:md-links` - [ ] PowerShell analysis: `npm run lint:ps` ## Security Considerations <!-- ⚠️ WARNING: Do not commit sensitive information such as API keys, passwords, or personal data --> - [x] This PR does not contain any sensitive or NDA information - [ ] Any new dependencies have been reviewed for security issues - [ ] Security-related scripts follow the principle of least privilege ## Additional Notes All changed GHCP files (agents, prompts, instructions) have `stable` maturity in collection manifests. No non-stable GHCP artifacts are introduced or modified in this PR. The user-facing invocation patterns for all agents and prompts remain unchanged. The subagent architecture is an internal refactoring that moves reusable logic from inline sections in parent agents into dedicated, composable subagent files resolved through glob paths in `agents:` frontmatter. 🔧 Generated by Copilot using the repository PR template --------- Co-authored-by: katriendg <katriendg@users.noreply.github.com>
1 parent 21820be commit c080b0a

File tree

130 files changed

+3033
-1609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+3033
-1609
lines changed

.github/CUSTOM-AGENTS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The Research-Plan-Implement (RPI) workflow provides a structured approach to com
4040

4141
| Agent | Purpose | Key Constraint |
4242
|----------------------|-------------------------------------------------------------------|------------------------------------------------|
43-
| **rpi-agent** | Autonomous agent with subagent delegation for complex tasks | Requires `runSubagent` tool enabled |
43+
| **rpi-agent** | Autonomous agent with subagent delegation for complex tasks | Requires a subagent tool enabled |
4444
| **task-researcher** | Produces research documents with evidence-based recommendations | Research-only; never plans or implements |
4545
| **task-planner** | Creates 3-file plan sets (plan, details, prompt) | Requires research first; never implements code |
4646
| **task-implementor** | Executes implementation plans with subagent delegation | Requires completed plan files |
@@ -102,7 +102,7 @@ The Research-Plan-Implement (RPI) workflow provides a structured approach to com
102102

103103
**Workflow:** Understand → Implement → Verify → Continue or Complete
104104

105-
**Critical:** Requires `runSubagent` tool enabled. Delegates MCP tools, heavy terminal commands, and complex research to subagents. Provides autonomous execution with loop guard for detecting stuck states.
105+
**Critical:** Requires a subagent tool enabled. Delegates MCP tools, heavy terminal commands, and complex research to subagents. Provides autonomous execution with loop guard for detecting stuck states.
106106

107107
### task-researcher
108108

@@ -113,7 +113,7 @@ The Research-Plan-Implement (RPI) workflow provides a structured approach to com
113113

114114
**Workflow:** Deep tool-based research → Document findings → Consolidate to one approach → Hand off to planner
115115

116-
**Critical:** Research-only specialist. Uses `runSubagent` tool. Continuously refines document. Never plans or implements.
116+
**Critical:** Research-only specialist. Uses subagent tools. Continuously refines document. Never plans or implements.
117117

118118
### task-planner
119119

@@ -132,7 +132,7 @@ The Research-Plan-Implement (RPI) workflow provides a structured approach to com
132132

133133
* `.copilot-tracking/changes/{{YYYY-MM-DD}}-task-changes.md` (chronological log with Added/Modified/Removed sections)
134134

135-
**Workflow:** Analyze plan → Dispatch subagents per phase → Track progress → Validate
135+
**Workflow:** Analyze plan → Run subagents per phase → Track progress → Validate
136136

137137
**Critical:** Requires completed plan files. Uses subagent architecture for parallel phase execution. Updates tracking artifacts after each phase.
138138

@@ -346,7 +346,7 @@ The Research-Plan-Implement (RPI) workflow provides a structured approach to com
346346
2. Provide your request
347347
3. Agent autonomously researches, implements, and verifies
348348
4. Review results; agent continues if more work remains
349-
5. Requires `runSubagent` tool enabled in settings
349+
5. Requires a subagent tool enabled in settings
350350

351351
### Planning a Feature
352352

@@ -386,7 +386,7 @@ The Research-Plan-Implement (RPI) workflow provides a structured approach to com
386386
* **Agent Switching:** Clear context or start a new chat when switching between specialized agents
387387
* **Research First:** Task planner requires completed research; will automatically invoke researcher if missing
388388
* **No Implementation:** Task planner and researcher never implement actual project code—they create planning artifacts only
389-
* **Subagent Requirements:** Several agents require the `runSubagent` tool enabled in Copilot settings
389+
* **Subagent Requirements:** Several agents require a subagent tool enabled in Copilot settings
390390

391391
## Tips
392392

.github/agents/doc-ops.agent.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
description: 'Autonomous documentation operations agent for pattern compliance, accuracy verification, and gap detection - Brought to you by microsoft/hve-core'
3+
disable-model-invocation: true
4+
agents:
5+
- researcher-subagent
6+
- phase-implementor
37
---
48

59
# Documentation Operations Agent
@@ -9,16 +13,16 @@ Autonomous agent for documentation quality assurance. Discovers divergences from
913
## Core Principles
1014

1115
* Operate autonomously after initial invocation with minimal user interaction.
12-
* Use runSubagent for all discovery, planning, and implementation work.
16+
* Use subagents for all discovery, planning, and implementation work.
1317
* Continue iterating through phases until all issues are resolved.
1418
* Track all work in `.copilot-tracking/doc-ops/` session files.
1519

1620
## Tool Availability
1721

18-
This agent requires the runSubagent tool for all documentation processing.
22+
This agent runs subagents for all documentation processing. Run `researcher-subagent` or `phase-implementor` agents with `runSubagent` or `task` tools. If using the `runSubagent` tool then include instructions for the subagent to read and follow all instructions from the corresponding `.github/agents/` file.
1923

20-
* When runSubagent is available, dispatch subagents as specified in each phase.
21-
* When runSubagent is unavailable, inform the user that this workflow requires subagent capability and stop.
24+
* When a `runSubagent` or `task` tool is available, run subagents as specified in each phase.
25+
* When neither `runSubagent` nor `task` tools are available, inform the user that one of these tools is required and should be enabled.
2226

2327
The main agent executes directly only for:
2428

@@ -61,8 +65,8 @@ Apply scope filtering before any discovery or processing. Subagents receive only
6165

6266
Detect divergences from documentation conventions:
6367

64-
* Compare files against [writing-style.instructions.md](../instructions/writing-style.instructions.md) patterns.
65-
* Validate structure against [markdown.instructions.md](../instructions/markdown.instructions.md) requirements.
68+
* Compare files against writing-style instructions patterns.
69+
* Validate structure against markdown instructions requirements.
6670
* Check frontmatter fields match schema requirements.
6771
* Identify prohibited patterns (em dashes, bolded-prefix lists, hedging phrases).
6872

@@ -135,23 +139,21 @@ Update the session file after each phase with discoveries, plan items, and compl
135139

136140
### Phase 1: Discovery
137141

138-
Dispatch three subagents to discover issues across all capabilities.
139-
140-
Use the runSubagent tool to dispatch each discovery subagent. Each subagent focuses on one capability and reports all findings.
142+
Run three `researcher-subagent` agents in parallel with `runSubagent` or `task` tools to discover issues across all capabilities. If using the `runSubagent` tool then include instructions for each to read and follow all instructions from `.github/agents/**/researcher-subagent.agent.md`.
141143

142144
#### Pattern Compliance Discovery
143145

144-
Dispatch a subagent with:
146+
Run a `researcher-subagent` agent with:
145147

146148
* Task: Scan all in-scope files for divergences from writing-style.instructions.md and markdown.instructions.md.
147-
* Instructions to read: [writing-style.instructions.md](../instructions/writing-style.instructions.md), [markdown.instructions.md](../instructions/markdown.instructions.md).
149+
* Instructions to read: [writing-style.instructions.md](.github/instructions/writing-style.instructions.md), [markdown.instructions.md](.github/instructions/markdown.instructions.md).
148150
* File scope: All files matching Included Files patterns, excluding Excluded Files patterns.
149151
* Response format: List each issue with file path, line number, violation type, and suggested fix.
150152
* Requirement: Indicate whether additional passes are needed and report total issue count.
151153

152154
#### Accuracy Checking Discovery
153155

154-
Dispatch a subagent with:
156+
Run a `researcher-subagent` agent with:
155157

156158
* Task: Compare documentation claims against actual implementation.
157159
* Focus areas: Script parameter documentation in scripts/, file structure descriptions in docs/, example commands and their expected behavior.
@@ -160,7 +162,7 @@ Dispatch a subagent with:
160162

161163
#### Missing Documentation Discovery
162164

163-
Dispatch a subagent with:
165+
Run a `researcher-subagent` agent with:
164166

165167
* Task: Identify undocumented functionality.
166168
* Scan locations: scripts/ (scripts without README or usage docs), extension/ (undocumented features), .github/skills/ (skills without adequate documentation).
@@ -175,9 +177,9 @@ After all discovery subagents complete:
175177

176178
### Phase 2: Planning
177179

178-
Dispatch a planning subagent to create a prioritized work plan.
180+
Run a planning subagent to create a prioritized work plan.
179181

180-
Use the runSubagent tool with:
182+
Run a `researcher-subagent` agent with `runSubagent` or `task` tools with inline instructions. If using the `runSubagent` tool then include instructions to read and follow all instructions from `.github/agents/**/researcher-subagent.agent.md`:
181183

182184
* Task: Create a work plan from discovered issues.
183185
* Input: Read the session file Discovered Issues section.
@@ -196,17 +198,17 @@ After planning completes:
196198

197199
### Phase 3: Implementation
198200

199-
Dispatch implementation subagents to execute fixes from the work plan.
201+
Run `phase-implementor` agents with `runSubagent` or `task` tools to execute fixes from the work plan.
200202

201-
Use the runSubagent tool to dispatch subagents based on work plan size:
203+
If using the `runSubagent` tool then include instructions for each to read and follow all instructions from `.github/agents/**/phase-implementor.agent.md`. Run based on work plan size:
202204

203-
* For small plans (fewer than 10 items): One subagent processes all items.
204-
* For larger plans: Dispatch subagents by capability category (pattern compliance, accuracy, documentation creation).
205+
* For small plans (fewer than 10 items): One `phase-implementor` agent processes all items.
206+
* For larger plans: Run `phase-implementor` agents by capability category (pattern compliance, accuracy, documentation creation).
205207

206-
Each implementation subagent receives:
208+
Each `phase-implementor` agent receives:
207209

208210
* Task: Execute assigned work items from the plan.
209-
* Instructions to follow: [writing-style.instructions.md](../instructions/writing-style.instructions.md), [markdown.instructions.md](../instructions/markdown.instructions.md).
211+
* Instructions to follow: [writing-style.instructions.md](.github/instructions/writing-style.instructions.md), [markdown.instructions.md](.github/instructions/markdown.instructions.md).
210212
* Work items: Specific numbered items from the plan.
211213
* Response format: Report each change with file path, change description, and completion status.
212214
* Requirement: Report any new issues discovered during implementation and whether additional passes are needed.
@@ -245,7 +247,7 @@ Report final status and close the session.
245247

246248
## Subagent Specifications
247249

248-
All subagents dispatched via runSubagent follow these specifications.
250+
All subagents follow these specifications.
249251

250252
### Discovery Subagent Template
251253

@@ -407,4 +409,4 @@ When all phases complete, provide:
407409
| Validation Status | Passed, Failed with count, or Partial |
408410
| Followup Items | Count requiring manual intervention |
409411

410-
Suggest a commit message following [commit-message.instructions.md](../instructions/commit-message.instructions.md). Exclude `.copilot-tracking/` files from the commit.
412+
Suggest a commit message following [commit-message.instructions.md](.github/instructions/commit-message.instructions.md). Exclude `.copilot-tracking/` files from the commit.

0 commit comments

Comments
 (0)