microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
docs/contributing/custom-agents.md
470lines · modecode
| 1 | --- |
| 2 | title: 'Contributing Agents to HVE Core' |
| 3 | description: 'Requirements and standards for contributing GitHub Copilot agent files to hve-core' |
| 4 | author: Microsoft |
| 5 | ms.date: 2025-11-26 |
| 6 | ms.topic: how-to |
| 7 | --- |
| 8 | |
| 9 | This guide defines the requirements, standards, and best practices for contributing GitHub Copilot agent files (`.agent.md`) to the hve-core library. |
| 10 | |
| 11 | **⚙️ Common Standards**: See [AI Artifacts Common Standards](ai-artifacts-common.md) for shared requirements (XML blocks, markdown quality, RFC 2119, validation, testing). |
| 12 | |
| 13 | ## What is an Agent? |
| 14 | |
| 15 | An **agent** is a specialized AI configuration that defines behavior, available tools, and instructions for GitHub Copilot to follow when performing specific tasks. Agents enable consistent, repeatable workflows for complex development activities. |
| 16 | |
| 17 | ## Use Cases for Agents |
| 18 | |
| 19 | Create an agent when you need to: |
| 20 | |
| 21 | * Define a specialized AI agent role (e.g., security reviewer, PR analyzer, documentation generator) |
| 22 | * Orchestrate multi-step workflows requiring specific tool sequences |
| 23 | * Maintain consistent behavior patterns across development tasks |
| 24 | * Provide domain-specific expertise (e.g., ADR creation, work item processing) |
| 25 | * Automate complex decision-making with predefined logic flows |
| 26 | |
| 27 | ## Agents Not Accepted |
| 28 | |
| 29 | The following agent types will likely be **rejected or closed automatically** because **equivalent agents already exist in hve-core**: |
| 30 | |
| 31 | ### Duplicate Agent Categories |
| 32 | |
| 33 | * **Research or Discovery Agents**: Agents that search for, gather, or discover information |
| 34 | * ❌ Reason: Existing agents already handle research and discovery workflows |
| 35 | * ✅ Alternative: Use existing research-focused agents in `.github/agents/` |
| 36 | |
| 37 | * **Indexing or Referencing Agents**: Agents that catalog, index, or create references to existing projects |
| 38 | * ❌ Reason: Existing agents already provide indexing and referencing capabilities |
| 39 | * ❌ Tool integration: Widely supported tools built into VS Code GitHub Copilot and MCP tools with extremely wide adoption are already supported by existing hve-core agents |
| 40 | * ✅ Alternative: Use existing reference management agents that leverage standard VS Code GitHub Copilot tools and widely-adopted MCP tools |
| 41 | |
| 42 | * **Planning Agents**: Agents that plan work, break down tasks, or organize backlog items |
| 43 | * ❌ Reason: Existing agents already handle work planning and task organization |
| 44 | * ✅ Alternative: Use existing planning-focused agents in `.github/agents/` |
| 45 | |
| 46 | * **Implementation Agents**: General-purpose coding agents that implement features |
| 47 | * ❌ Reason: Existing agents already provide implementation guidance |
| 48 | * ✅ Alternative: Use existing implementation-focused agents |
| 49 | |
| 50 | ### Rationale for Rejection |
| 51 | |
| 52 | These agent types are rejected because: |
| 53 | |
| 54 | 1. **Existing agents are hardened and heavily utilized**: The hve-core library already contains production-tested agents in these categories |
| 55 | 2. **Consistency and maintenance**: Coalescing around existing agents reduces fragmentation and maintenance burden |
| 56 | 3. **Avoid duplication**: Multiple agents serving the same purpose create confusion and divergent behavior |
| 57 | 4. **Standard tooling already integrated**: VS Code GitHub Copilot built-in tools and widely-adopted MCP tools are already leveraged by existing agents |
| 58 | |
| 59 | ### Before Submitting |
| 60 | |
| 61 | When planning to submit an agent that falls into these categories: |
| 62 | |
| 63 | 1. **Question necessity**: Does your use case truly require a new agent, or can existing agents meet your needs? |
| 64 | 2. **Review existing agents**: Examine `.github/agents/` to identify agents that already serve your purpose |
| 65 | 3. **Check tool integration**: Verify whether the VS Code GitHub Copilot tools or MCP tools you need are already used by existing agents |
| 66 | 4. **Consider enhancement over creation**: If existing agents don't fully meet your requirements, evaluate whether your changes are: |
| 67 | * **Generic enough** to benefit all users |
| 68 | * **Valuable enough** to justify modifying the existing agent |
| 69 | 5. **Propose enhancements**: Submit a PR to enhance an existing agent rather than creating a duplicate |
| 70 | |
| 71 | ### What Makes a Good New Agent |
| 72 | |
| 73 | Focus on agents that: |
| 74 | |
| 75 | * **Fill gaps**: Address use cases not covered by existing agents |
| 76 | * **Provide unique value**: Offer specialized domain expertise or workflow patterns not present in the library |
| 77 | * **Are non-overlapping**: Have clearly distinct purposes from existing agents |
| 78 | * **Cannot be merged**: Represent functionality too specialized or divergent to integrate into existing agents |
| 79 | * **Use standard tooling**: Leverage widely-supported VS Code GitHub Copilot tools and MCP tools rather than custom integrations |
| 80 | |
| 81 | ### Model Version Requirements |
| 82 | |
| 83 | All agents **MUST** target the **latest available models** from **Anthropic and OpenAI only**. |
| 84 | |
| 85 | **Accepted**: Latest Claude models (e.g., Claude Sonnet 4, Claude Opus 4) and latest GPT models (e.g., GPT-5.1, o1) |
| 86 | |
| 87 | **Not Accepted**: Older model versions (e.g., GPT-3.5, GPT-4.1, Claude 2), models from other providers, custom/fine-tuned models |
| 88 | |
| 89 | **Rationale**: Latest models provide superior capabilities, reduce maintenance burden, and ensure future compatibility. Older model versions will be deprecated. |
| 90 | |
| 91 | ## File Structure Requirements |
| 92 | |
| 93 | ### Location |
| 94 | |
| 95 | All agent files **MUST** be placed in: |
| 96 | |
| 97 | ```text |
| 98 | .github/agents/ |
| 99 | └── your-agent-name.agent.md |
| 100 | ``` |
| 101 | |
| 102 | ### Naming Convention |
| 103 | |
| 104 | * Use lowercase kebab-case: `security-reviewer.agent.md` |
| 105 | * Be descriptive and action-oriented: `task-planner.agent.md`, `pr-review.agent.md`, `rpi-agent.agent.md` |
| 106 | * Avoid generic names: `helper.agent.md` ❌ → `ado-work-item-processor.agent.md` ✅ |
| 107 | |
| 108 | ### File Format |
| 109 | |
| 110 | Agent files **MUST**: |
| 111 | |
| 112 | 1. Use the `.agent.md` extension |
| 113 | 2. Start with valid YAML frontmatter between `---` delimiters |
| 114 | 3. Begin content directly after frontmatter |
| 115 | 4. End with single newline character |
| 116 | |
| 117 | ## Frontmatter Requirements |
| 118 | |
| 119 | ### Required Fields |
| 120 | |
| 121 | **`description`** (string, MANDATORY) |
| 122 | |
| 123 | * **Purpose**: Concise explanation of agent functionality |
| 124 | * **Format**: Single sentence, 10-200 characters |
| 125 | * **Style**: Sentence case with proper punctuation |
| 126 | * **Example**: `'Validates contributed content for quality and compliance with hve-core standards'` |
| 127 | |
| 128 | **`maturity`** (string enum, MANDATORY) |
| 129 | |
| 130 | * **Purpose**: Controls which extension channel includes this agent |
| 131 | * **Valid values**: |
| 132 | * `stable` - Production-ready, included in Stable and Pre-release channels |
| 133 | * `preview` - Feature-complete, included in Pre-release channel only |
| 134 | * `experimental` - Early development, included in Pre-release channel only |
| 135 | * `deprecated` - Scheduled for removal, excluded from all channels |
| 136 | * **Default**: New agents should use `stable` unless targeting early adopters |
| 137 | * **Example**: `stable` |
| 138 | |
| 139 | ### Optional Fields |
| 140 | |
| 141 | **`tools`** (array of strings) |
| 142 | |
| 143 | * **Purpose**: Lists GitHub Copilot tools available to this agent |
| 144 | * **Format**: Array of valid tool names in logical order (read before write) |
| 145 | * **Valid tools**: |
| 146 | * `codebase` - Semantic code search |
| 147 | * `search` - Grep/regex search |
| 148 | * `problems` - Error/warning diagnostics |
| 149 | * `editFiles` - File modification |
| 150 | * `changes` - Git change tracking |
| 151 | * `usages` - Symbol reference search |
| 152 | * `githubRepo` - External GitHub repository search |
| 153 | * `fetch` - Web page content retrieval |
| 154 | * `runCommands` - Terminal command execution |
| 155 | * `think` - Extended reasoning |
| 156 | * `findTestFiles` - Test file discovery |
| 157 | * `terminalLastCommand` - Terminal history |
| 158 | * `searchResults` - Search view results |
| 159 | * `edit/createFile` - File creation |
| 160 | * `edit/createDirectory` - Directory creation |
| 161 | * `Bicep (EXPERIMENTAL)/*` - Bicep tooling |
| 162 | * `terraform/*` - Terraform tooling |
| 163 | * `context7/*` - Library documentation |
| 164 | * `microsoft-docs/*` - Microsoft documentation |
| 165 | |
| 166 | **`mode`** (string enum) |
| 167 | |
| 168 | * **Purpose**: Defines agent interaction pattern |
| 169 | * **Valid values**: `agent`, `assistant`, `copilot` |
| 170 | * **Default**: Auto-detected from usage pattern |
| 171 | |
| 172 | **`version`** (string) |
| 173 | |
| 174 | * **Purpose**: Tracks agent revisions |
| 175 | * **Format**: Semantic versioning (e.g., `1.0.0`) |
| 176 | |
| 177 | **`author`** (string) |
| 178 | |
| 179 | * **Purpose**: Attribution for agent creator |
| 180 | * **Example**: `microsoft/hve-core`, `your-team-name` |
| 181 | |
| 182 | **`handoffs`** (array of objects) |
| 183 | |
| 184 | * **Purpose**: Declares agent-to-agent handoff buttons that appear in the chat UI |
| 185 | * **Format**: Array of handoff declarations |
| 186 | * **Fields per handoff**: |
| 187 | * `label` (string, required): Button text displayed in UI, supports emoji |
| 188 | * `agent` (string, required): Target agent filename without `.agent.md` extension |
| 189 | * `prompt` (string, optional): Pre-filled prompt text, can include slash commands |
| 190 | * `send` (boolean, optional): When true, auto-submits prompt; when false (default), user can edit |
| 191 | * **Requirements**: VS Code 1.106+ required for handoff support |
| 192 | * **Example**: |
| 193 | |
| 194 | ```yaml |
| 195 | handoffs: |
| 196 | - label: "📋 Create Plan" |
| 197 | agent: task-planner |
| 198 | prompt: /task-plan |
| 199 | send: true |
| 200 | ``` |
| 201 | |
| 202 | ### Frontmatter Example |
| 203 | |
| 204 | ```yaml |
| 205 | --- |
| 206 | description: 'Validates and reviews contributed agents, prompts, and instructions for quality and compliance' |
| 207 | tools: ['codebase', 'search', 'problems', 'editFiles', 'changes', 'usages'] |
| 208 | mode: 'agent' |
| 209 | version: '1.0.0' |
| 210 | author: 'microsoft/hve-core' |
| 211 | --- |
| 212 | ``` |
| 213 | |
| 214 | ### MCP Tool Dependencies |
| 215 | |
| 216 | When agents reference MCP tools in their `tools:` frontmatter or body content, document the dependencies clearly. |
| 217 | |
| 218 | **Frontmatter declaration:** |
| 219 | |
| 220 | ```yaml |
| 221 | tools: ['github/*', 'ado/*', 'context7/*', 'microsoft-docs/*'] |
| 222 | ``` |
| 223 | |
| 224 | **Curated MCP servers referenced by HVE-Core agents:** |
| 225 | |
| 226 | | Server | Tool Pattern | Purpose | |
| 227 | |----------------|--------------------|-------------------------------------------| |
| 228 | | github | `github/*` | GitHub repository and issue management | |
| 229 | | ado | `ado/*` | Azure DevOps work items, pipelines, repos | |
| 230 | | context7 | `context7/*` | Library and SDK documentation lookup | |
| 231 | | microsoft-docs | `microsoft-docs/*` | Microsoft Learn documentation | |
| 232 | |
| 233 | **Guidelines for MCP tool references:** |
| 234 | |
| 235 | * Document MCP dependencies in agent body text when using `mcp_*` tool patterns |
| 236 | * Agents should gracefully handle missing MCP servers (tools unavailable) |
| 237 | * Reference the [MCP Server Configuration](../getting-started/mcp-configuration.md) guide when agents require MCP tools |
| 238 | * Prefer built-in VS Code Copilot tools when equivalent functionality exists |
| 239 | |
| 240 | ## Agent Content Structure Standards |
| 241 | |
| 242 | ### Required Sections |
| 243 | |
| 244 | #### 1. Title (H1) |
| 245 | |
| 246 | * Clear, action-oriented heading matching agent purpose |
| 247 | * Should align with filename and description |
| 248 | |
| 249 | ```markdown |
| 250 | # Content Validator Agent |
| 251 | ``` |
| 252 | |
| 253 | #### 2. Overview/Role Definition |
| 254 | |
| 255 | * Explains what the agent does and when to use it |
| 256 | * Defines scope and boundaries |
| 257 | * Sets expectations for users |
| 258 | |
| 259 | ```markdown |
| 260 | You are an expert reviewer for GitHub Copilot agents, prompts, and instruction files. |
| 261 | Your mission is to ensure all contributed guidance files meet hve-core quality standards |
| 262 | before they're merged into the library. |
| 263 | ``` |
| 264 | |
| 265 | #### 3. Core Directives/Instructions |
| 266 | |
| 267 | * Uses clear, imperative language |
| 268 | * Employs RFC 2119 keywords consistently: |
| 269 | * **MUST/WILL/MANDATORY/CRITICAL** - Required behavior |
| 270 | * **SHOULD/RECOMMENDED** - Strong guidance |
| 271 | * **MAY/OPTIONAL** - Permitted but not required |
| 272 | * Provides step-by-step workflows |
| 273 | * Includes decision points and branching logic |
| 274 | |
| 275 | #### 4. Examples and Templates |
| 276 | |
| 277 | * Demonstrates correct usage patterns |
| 278 | * Shows both positive (✅) and negative (❌) examples |
| 279 | * Wraps in XML-style blocks for reusability |
| 280 | |
| 281 | #### 5. Success Criteria |
| 282 | |
| 283 | * Defines completion conditions |
| 284 | * Specifies validation checkpoints |
| 285 | * Lists quality gates |
| 286 | |
| 287 | #### 6. Attribution Footer |
| 288 | |
| 289 | * **MANDATORY**: Include at end of file |
| 290 | |
| 291 | ```markdown |
| 292 | --- |
| 293 | |
| 294 | Brought to you by microsoft/hve-core |
| 295 | ``` |
| 296 | |
| 297 | ### XML-Style Block Requirements |
| 298 | |
| 299 | See [AI Artifacts Common Standards - XML-Style Block Standards](ai-artifacts-common.md#xml-style-block-standards) for complete rules and examples. |
| 300 | |
| 301 | ### Directive Language Standards |
| 302 | |
| 303 | Use RFC 2119 compliant keywords (MUST/SHOULD/MAY). See [AI Artifacts Common Standards - RFC 2119 Directive Language](ai-artifacts-common.md#rfc-2119-directive-language) for complete guidance. |
| 304 | |
| 305 | ## Tool Usage Discipline |
| 306 | |
| 307 | When agents use tools, they **MUST** follow these patterns: |
| 308 | |
| 309 | ### Tool Usage Preambles |
| 310 | |
| 311 | Before any batch of tool calls, include a one-sentence explanation: |
| 312 | |
| 313 | ```markdown |
| 314 | **Tool Usage Preamble**: "Analyzing file structure, reading schemas, and checking |
| 315 | repository conventions to establish validation baseline." |
| 316 | ``` |
| 317 | |
| 318 | ### Checkpoints |
| 319 | |
| 320 | After 3-5 tool calls or more than 3 file edits, provide a compact checkpoint: |
| 321 | |
| 322 | ```markdown |
| 323 | **Checkpoint After Discovery**: "Identified [file type], loaded [schema name], |
| 324 | found [N] related files for comparison." |
| 325 | ``` |
| 326 | |
| 327 | ### Tool Result Integration |
| 328 | |
| 329 | * Document how tool results inform next steps |
| 330 | * Specify error handling for tool failures |
| 331 | * Justify tool selection (why this tool for this task) |
| 332 | |
| 333 | ## Output Formatting Requirements |
| 334 | |
| 335 | Define how the agent communicates with users: |
| 336 | |
| 337 | ### Response Format |
| 338 | |
| 339 | * Start all responses with: `## **[Agent Name]**: [Action Description]` |
| 340 | * Use short, action-oriented section headers |
| 341 | * Employ proper markdown formatting |
| 342 | * Include emojis for visual clarity (when appropriate) |
| 343 | |
| 344 | ### Status Reporting |
| 345 | |
| 346 | Specify formats for: |
| 347 | |
| 348 | * Progress updates |
| 349 | * Error messages |
| 350 | * Completion confirmations |
| 351 | * Validation results |
| 352 | |
| 353 | ### Requirements Checklist |
| 354 | |
| 355 | For agents performing edits or validations: |
| 356 | |
| 357 | ```markdown |
| 358 | ### Requirements Checklist |
| 359 | |
| 360 | - [x] Pre-validation analysis complete - Loaded schema, checked conventions |
| 361 | - [x] Frontmatter validation - All required fields present |
| 362 | - [ ] Technical validation - 2 broken file references found |
| 363 | ``` |
| 364 | |
| 365 | ### Quality Gates |
| 366 | |
| 367 | Report validation status: |
| 368 | |
| 369 | ```markdown |
| 370 | ### Quality Gates |
| 371 | |
| 372 | - **Build**: PASS |
| 373 | - **Lint**: FAIL - Markdownlint flagged: bare URLs (lines 45, 67) |
| 374 | - **Schema**: PASS - Frontmatter validates |
| 375 | ``` |
| 376 | |
| 377 | ## Research and External Sources |
| 378 | |
| 379 | When agents integrate external knowledge, consult authoritative sources and provide minimal, annotated snippets with reference links. See [AI Artifacts Common Standards - Attribution Requirements](ai-artifacts-common.md#attribution-requirements) for guidelines. |
| 380 | |
| 381 | ## Validation Checklist |
| 382 | |
| 383 | Before submitting your agent, verify: |
| 384 | |
| 385 | ### Frontmatter |
| 386 | |
| 387 | * [ ] Valid YAML between `---` delimiters |
| 388 | * [ ] `description` field present and descriptive (10-200 chars) |
| 389 | * [ ] `tools` array contains only valid tool names (if present) |
| 390 | * [ ] `mode` is one of: `agent`, `assistant`, `copilot` (if present) |
| 391 | * [ ] No trailing whitespace in values |
| 392 | * [ ] Single newline at EOF |
| 393 | |
| 394 | ### Content Structure |
| 395 | |
| 396 | * [ ] Clear H1 title matching purpose |
| 397 | * [ ] Overview/role definition section |
| 398 | * [ ] Core directives with RFC 2119 keywords |
| 399 | * [ ] Examples wrapped in XML-style blocks |
| 400 | * [ ] Success criteria defined |
| 401 | * [ ] Attribution footer present |
| 402 | |
| 403 | ### Common Standards |
| 404 | |
| 405 | * [ ] Markdown quality (see [Common Standards - Markdown Quality](ai-artifacts-common.md#markdown-quality-standards)) |
| 406 | * [ ] XML-style blocks properly formatted (see [Common Standards - XML-Style Blocks](ai-artifacts-common.md#xml-style-block-standards)) |
| 407 | * [ ] RFC 2119 keywords used consistently (see [Common Standards - RFC 2119](ai-artifacts-common.md#rfc-2119-directive-language)) |
| 408 | |
| 409 | ### Technical Validation |
| 410 | |
| 411 | * [ ] All file references point to existing files |
| 412 | * [ ] External links are valid and accessible |
| 413 | * [ ] Tool names in frontmatter are correct |
| 414 | * [ ] No conflicts with existing agents |
| 415 | |
| 416 | ### Integration |
| 417 | |
| 418 | * [ ] Aligns with `.github/copilot-instructions.md` |
| 419 | * [ ] Follows repository conventions |
| 420 | * [ ] Compatible with existing workflows |
| 421 | * [ ] Does not duplicate existing agent functionality |
| 422 | |
| 423 | ## Testing Your Agent |
| 424 | |
| 425 | See [AI Artifacts Common Standards - Common Testing Practices](ai-artifacts-common.md#common-testing-practices) for testing guidelines. For agents specifically: |
| 426 | |
| 427 | 1. Test with realistic scenarios matching the agent's purpose |
| 428 | 2. Verify tool usage patterns execute correctly |
| 429 | 3. Ensure decision points and branching logic work as intended |
| 430 | 4. Check edge cases: missing data, invalid inputs, tool failures |
| 431 | |
| 432 | ## Common Issues and Fixes |
| 433 | |
| 434 | ### Agent-Specific Issues |
| 435 | |
| 436 | ### Invalid Tool Names |
| 437 | |
| 438 | * **Problem**: Referencing tools that don't exist or using incorrect camelCase variants |
| 439 | * **Solution**: Use exact tool names from VS Code Copilot's available tools list |
| 440 | |
| 441 | For additional common issues (XML blocks, markdown, directives), see [AI Artifacts Common Standards - Common Issues and Fixes](ai-artifacts-common.md#common-issues-and-fixes). |
| 442 | |
| 443 | ## Automated Validation |
| 444 | |
| 445 | Run these commands before submission (see [Common Standards - Common Validation](ai-artifacts-common.md#common-validation-standards)): |
| 446 | |
| 447 | * `npm run lint:frontmatter` |
| 448 | * `npm run lint:md` |
| 449 | * `npm run spell-check` |
| 450 | * `npm run lint:md-links` |
| 451 | |
| 452 | All checks **MUST** pass before merge. |
| 453 | |
| 454 | ## Related Documentation |
| 455 | |
| 456 | * [AI Artifacts Common Standards](ai-artifacts-common.md) - Shared standards for all contributions |
| 457 | * [Contributing Prompts](prompts.md) - Workflow-specific guidance files |
| 458 | * [Contributing Instructions](instructions.md) - Technology-specific standards |
| 459 | * [Pull Request Template](../../.github/PULL_REQUEST_TEMPLATE.md) - Submission requirements |
| 460 | |
| 461 | ## Getting Help |
| 462 | |
| 463 | See [AI Artifacts Common Standards - Getting Help](ai-artifacts-common.md#getting-help) for support resources. For agent-specific assistance, review existing examples in `.github/agents/`. |
| 464 | |
| 465 | --- |
| 466 | |
| 467 | <!-- markdownlint-disable MD036 --> |
| 468 | *🤖 Crafted with precision by ✨Copilot following brilliant human instruction, |
| 469 | then carefully refined by our team of discerning human reviewers.* |
| 470 | <!-- markdownlint-enable MD036 --> |
| 471 | |