microsoft/hve-core

Public

mirrored fromhttps://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
hve-core-v3.3.10

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/contributing/custom-agents.md

581lines · modecode

1---
2title: 'Contributing Agents to HVE Core'
3description: 'Requirements and standards for contributing GitHub Copilot agent files to hve-core'
4sidebar_position: 5
5author: Microsoft
6ms.date: 2026-03-14
7ms.topic: how-to
8---
9
10This guide defines the requirements, standards, and best practices for contributing GitHub Copilot agent files (`.agent.md`) to the hve-core library.
11
12⚙️ Common Standards: See [AI Artifacts Common Standards](ai-artifacts-common.md) for shared requirements (XML blocks, markdown quality, RFC 2119, validation, testing).
13
14## What is an Agent?
15
16An **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.
17
18## Use Cases for Agents
19
20Create an agent when you need to:
21
22* Define a specialized AI agent role (e.g., security reviewer, PR analyzer, documentation generator)
23* Orchestrate multi-step workflows requiring specific tool sequences
24* Maintain consistent behavior patterns across development tasks
25* Provide domain-specific expertise (e.g., ADR creation, work item processing)
26* Automate complex decision-making with predefined logic flows
27
28## Agents Not Accepted
29
30The following agent types will likely be **rejected or closed automatically** because equivalent agents already exist in hve-core:
31
32### Duplicate Agent Categories
33
34#### Research or Discovery Agents
35
36Agents that search for, gather, or discover information.
37
38* ❌ Reason: Existing agents already handle research and discovery workflows
39* ✅ Alternative: Use existing research-focused agents in `.github/agents/`
40
41#### Indexing or Referencing Agents
42
43Agents that catalog, index, or create references to existing projects.
44
45* ❌ Reason: Existing agents already provide indexing and referencing capabilities
46* ❌ 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
47* ✅ Alternative: Use existing reference management agents that use standard VS Code GitHub Copilot tools and widely-adopted MCP tools
48
49#### Planning Agents
50
51Agents that plan work, break down tasks, or organize backlog items.
52
53* ❌ Reason: Existing agents already handle work planning and task organization
54* ✅ Alternative: Use existing planning-focused agents in `.github/agents/`
55
56#### Implementation Agents
57
58General-purpose coding agents that implement features.
59
60* ❌ Reason: Existing agents already provide implementation guidance
61* ✅ Alternative: Use existing implementation-focused agents
62
63### Rationale for Rejection
64
65These agent types are rejected because:
66
671. Existing agents are hardened and heavily used: the hve-core library already contains production-tested agents in these categories
682. Consistency and maintenance: coalescing around existing agents reduces fragmentation and maintenance burden
693. Avoid duplication: multiple agents serving the same purpose create confusion and divergent behavior
704. Standard tooling already integrated: VS Code GitHub Copilot built-in tools and widely-adopted MCP tools are already used by existing agents
71
72### Before Submitting
73
74When planning to submit an agent that falls into these categories:
75
761. Question necessity: does your use case truly require a new agent, or can existing agents meet your needs?
772. Review existing agents: examine `.github/agents/` to identify agents that already serve your purpose
783. Check tool integration: verify whether the VS Code GitHub Copilot tools or MCP tools you need are already used by existing agents
794. Consider enhancement over creation: if existing agents don't fully meet your requirements, evaluate whether your changes are generic enough to benefit all users and valuable enough to justify modifying the existing agent
805. Propose enhancements: submit a PR to enhance an existing agent rather than creating a duplicate
81
82### What Makes a Good New Agent
83
84Focus on agents that:
85
86| Criterion | Description |
87|----------------------|-------------------------------------------------------------------------------------------------|
88| Fill gaps | Address use cases not covered by existing agents |
89| Provide unique value | Offer specialized domain expertise or workflow patterns not present in the library |
90| Are non-overlapping | Have clearly distinct purposes from existing agents |
91| Cannot be merged | Represent functionality too specialized or divergent to integrate into existing agents |
92| Use standard tooling | Use widely-supported VS Code GitHub Copilot tools and MCP tools rather than custom integrations |
93
94### Model Version Requirements
95
96All agents **MUST** target the **latest available models** from **Anthropic and OpenAI only**.
97
98Accepted: Latest Claude models (e.g., Claude Sonnet 4, Claude Opus 4) and latest GPT models (e.g., GPT-5.1, o1)
99
100Not Accepted: Older model versions (e.g., GPT-3.5, GPT-4.1, Claude 2), models from other providers, custom/fine-tuned models
101
102Rationale: Latest models provide superior capabilities, reduce maintenance burden, and ensure future compatibility. Older model versions will be deprecated.
103
104## File Structure Requirements
105
106### Location
107
108Agent files are typically organized in a collection subdirectory by convention:
109
110```text
111.github/agents/{collection-id}/
112├── your-agent-name.agent.md
113└── subagents/
114 └── your-subagent-name.agent.md
115```
116
117> [!NOTE]
118> Collections can reference artifacts from any subfolder. The `path:` field in collection YAML files
119> accepts any valid repo-relative path regardless of the artifact's parent directory.
120
121### Naming Convention
122
123* Use lowercase kebab-case: `security-reviewer.agent.md`
124* Be descriptive and action-oriented: `task-planner.agent.md`, `pr-review.agent.md`, `rpi-agent.agent.md`
125* Avoid generic names: `helper.agent.md` ❌ → `ado-work-item-processor.agent.md` ✅
126
127### File Format
128
129Agent files MUST:
130
1311. Use the `.agent.md` extension
1322. Start with valid YAML frontmatter between `---` delimiters
1333. Begin content directly after frontmatter
1344. End with single newline character
135
136## Frontmatter Requirements
137
138### Required Fields
139
140**`description`** (string, MANDATORY)
141
142| Attribute | Details |
143|-----------|--------------------------------------------------------------------------------------|
144| Purpose | Concise explanation of agent functionality |
145| Format | Single sentence, 10-200 characters |
146| Style | Sentence case with proper punctuation |
147| Example | `'Validates contributed content for quality and compliance with hve-core standards'` |
148
149### Optional Fields
150
151**`name`** (string)
152
153| Attribute | Details |
154|-----------|----------------------------------------------------------|
155| Purpose | Custom display name for the agent |
156| Format | Lowercase kebab-case matching filename without extension |
157| Default | File name used if not specified |
158
159**`tools`** (array of strings)
160
161| Attribute | Details |
162|-----------|----------------------------------------------------------------|
163| Purpose | Lists GitHub Copilot tools available to this agent |
164| Format | Array of valid tool names in logical order (read before write) |
165
166Valid tools:
167
168* `codebase` - Semantic code search
169* `search` - Grep/regex search
170* `problems` - Error/warning diagnostics
171* `editFiles` - File modification
172* `changes` - Git change tracking
173* `usages` - Symbol reference search
174* `githubRepo` - External GitHub repository search
175* `fetch` - Web page content retrieval
176* `runCommands` - Terminal command execution
177* `think` - Extended reasoning
178* `findTestFiles` - Test file discovery
179* `terminalLastCommand` - Terminal history
180* `searchResults` - Search view results
181* `edit/createFile` - File creation
182* `edit/createDirectory` - Directory creation
183* `Bicep (EXPERIMENTAL)/*` - Bicep tooling
184* `terraform/*` - Terraform tooling
185* `context7/*` - Library documentation
186* `microsoft-docs/*` - Microsoft documentation
187
188**`agents`** (array of strings)
189
190| Attribute | Details |
191|-------------|------------------------------------------------------------------------------------|
192| Purpose | Declares subagent dependencies available to this agent |
193| Format | Array of agent names. Use `*` to allow all agents, or `[]` to prevent subagent use |
194| Requirement | When specified, include the `agent` tool in the `tools` property |
195
196**`model`** (string or array of strings)
197
198| Attribute | Details |
199|-----------|----------------------------------------------------------------------------------------------|
200| Purpose | Specifies the AI model for this agent |
201| Format | Single model name or prioritized list of models (system tries each in order until available) |
202| Default | Currently selected model in model picker when omitted |
203
204**`user-invocable`** (boolean)
205
206| Attribute | Details |
207|-----------|-----------------------------------------------------------------|
208| Purpose | Controls whether the agent appears in the agents dropdown |
209| Default | `true` |
210| Usage | Set to `false` for agents that are only accessible as subagents |
211
212**`disable-model-invocation`** (boolean)
213
214| Attribute | Details |
215|-----------|---------------------------------------------------------------------------------------------------------------|
216| Purpose | Prevents the agent from being invoked as a subagent by other agents |
217| Default | `false` |
218| Usage | Set to `true` for agents that run subagents, cause side effects, or should only run when explicitly requested |
219
220**`argument-hint`** (string)
221
222| Attribute | Details |
223|-----------|---------------------------------------------------------|
224| Purpose | Hint text shown in the chat input field to guide users |
225| Format | Brief text with required arguments first, then optional |
226
227**`target`** (string enum)
228
229| Attribute | Details |
230|--------------|-----------------------------------------|
231| Purpose | Target environment for the custom agent |
232| Valid values | `vscode`, `github-copilot` |
233
234**`mcp-servers`** (array of objects)
235
236| Attribute | Details |
237|-----------|----------------------------------------------------|
238| Purpose | MCP server configuration for GitHub Copilot agents |
239| Usage | Only applicable when `target: github-copilot` |
240
241**`handoffs`** (array of objects)
242
243| Attribute | Details |
244|--------------|--------------------------------------------------------------------|
245| Purpose | Declares agent-to-agent handoff buttons that appear in the chat UI |
246| Format | Array of handoff declarations |
247| Requirements | VS Code 1.106+ required for handoff support |
248
249Fields per handoff:
250
251* `label` (string, required): Button text displayed in UI, supports emoji
252* `agent` (string, required): Target agent filename without `.agent.md` extension
253* `prompt` (string, optional): Pre-filled prompt text, can include slash commands
254* `send` (boolean, optional): When true, auto-submits prompt; when false (default), user can edit
255* `model` (string, optional): Language model override for the handoff execution
256
257Example:
258
259```yaml
260 handoffs:
261 - label: "📋 Create Plan"
262 agent: Task Planner
263 prompt: /task-plan
264 send: true
265 ```
266
267### Deprecated Fields
268
269**`infer`** (boolean)
270
271| Attribute | Details |
272|-------------------|---------------------------------------------------------------------------------------------------------------------------------|
273| Status | Deprecated. Use `user-invocable` and `disable-model-invocation` instead. |
274| Previous behavior | `infer: true` (default) made the agent both visible in the picker and available as a subagent. `infer: false` hid it from both. |
275
276### Frontmatter Example
277
278```yaml
279---
280description: 'Validates and reviews contributed agents, prompts, and instructions for quality and compliance'
281tools: ['codebase', 'search', 'problems', 'editFiles', 'changes', 'usages']
282disable-model-invocation: true
283agents:
284 - Prompt Tester
285 - Prompt Evaluator
286---
287```
288
289## Collection Entry Requirements
290
291All agents must have matching entries in one or more `collections/*.collection.yml` manifests. Collection entries control selection and maturity.
292
293### Adding Your Agent to a Collection
294
295After creating your agent file, add an `items[]` entry to each target collection:
296
297```yaml
298items:
299 # path can reference artifacts from any subfolder
300 - path: .github/agents/{collection-id}/my-new-agent.agent.md
301 kind: agent
302 maturity: stable
303```
304
305### Selecting Collections for Agents
306
307Choose collections based on who benefits most from your agent:
308
309| Agent Type | Recommended Collections |
310|------------------------|-------------------------------------------|
311| Task workflow agents | `hve-core-all`, `hve-core` |
312| Architecture agents | `hve-core-all`, `project-planning` |
313| Documentation agents | `hve-core-all`, `hve-core` |
314| Data science agents | `hve-core-all`, `data-science` |
315| Design thinking agents | `hve-core-all`, `design-thinking` |
316| ADO/work item agents | `hve-core-all`, `ado`, `project-planning` |
317| Code review agents | `hve-core-all`, `hve-core` |
318
319### Declaring Agent Dependencies
320
321If your agent dispatches other agents at runtime via `runSubagent`, invokes prompts, or depends on skills, document those relationships in the agent content and validate packaging behavior in affected collections.
322
323For complete collection documentation, see [AI Artifacts Common Standards - Collection Manifests](ai-artifacts-common.md#collection-manifests-and-dependencies).
324
325### MCP Tool Dependencies
326
327When agents reference MCP tools in their `tools:` frontmatter or body content, document the dependencies clearly.
328
329#### Frontmatter Declaration
330
331```yaml
332tools: ['github/*', 'ado/*', 'context7/*', 'microsoft-docs/*']
333```
334
335#### Curated MCP Servers Referenced by HVE Core Agents
336
337| Server | Tool Pattern | Purpose |
338|----------------|--------------------|-------------------------------------------|
339| github | `github/*` | GitHub repository and issue management |
340| ado | `ado/*` | Azure DevOps work items, pipelines, repos |
341| context7 | `context7/*` | Library and SDK documentation lookup |
342| microsoft-docs | `microsoft-docs/*` | Microsoft Learn documentation |
343
344#### Guidelines for MCP Tool References
345
346* Document MCP dependencies in agent body text when using `mcp_*` tool patterns
347* Agents should gracefully handle missing MCP servers (tools unavailable)
348* Reference the [MCP Server Configuration](../getting-started/mcp-configuration.md) guide when agents require MCP tools
349* Prefer built-in VS Code Copilot tools when equivalent functionality exists
350
351## Agent Content Structure Standards
352
353### Required Sections
354
355#### 1. Title (H1)
356
357* Clear, action-oriented heading matching agent purpose
358* Should align with filename and description
359
360```markdown
361# Content Validator Agent
362```
363
364#### 2. Overview/Role Definition
365
366* Explains what the agent does and when to use it
367* Defines scope and boundaries
368* Sets expectations for users
369
370```markdown
371You are an expert reviewer for GitHub Copilot agents, prompts, and instruction files.
372Your mission is to ensure all contributed guidance files meet hve-core quality standards
373before they're merged into the library.
374```
375
376#### 3. Core Directives/Instructions
377
378* Uses clear, imperative language
379* Employs RFC 2119 keywords consistently:
380 * MUST, WILL, MANDATORY, and CRITICAL indicate required behavior
381 * SHOULD and RECOMMENDED indicate strong guidance
382 * MAY and OPTIONAL indicate permitted but not required behavior
383* Provides step-by-step workflows
384* Includes decision points and branching logic
385
386#### 4. Examples and Templates
387
388* Demonstrates correct usage patterns
389* Shows both positive (✅) and negative (❌) examples
390* Wraps in XML-style blocks for reusability
391
392#### 5. Success Criteria
393
394* Defines completion conditions
395* Specifies validation checkpoints
396* Lists quality gates
397
398#### 6. Attribution Footer
399
400Include at end of file (MANDATORY):
401
402```markdown
403---
404
405Brought to you by microsoft/hve-core
406```
407
408### XML-Style Block Requirements
409
410See [AI Artifacts Common Standards - XML-Style Block Standards](ai-artifacts-common.md#xml-style-block-standards) for complete rules and examples.
411
412### Directive Language Standards
413
414Use 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.
415
416## Tool Usage Discipline
417
418When agents use tools, they **MUST** follow these patterns:
419
420### Tool Usage Preambles
421
422Before any batch of tool calls, include a one-sentence explanation:
423
424```markdown
425Tool Usage Preamble: "Analyzing file structure, reading schemas, and checking
426repository conventions to establish validation baseline."
427```
428
429### Checkpoints
430
431After 3-5 tool calls or more than 3 file edits, provide a compact checkpoint:
432
433```markdown
434Checkpoint After Discovery: "Identified [file type], loaded [schema name],
435found [N] related files for comparison."
436```
437
438### Tool Result Integration
439
440* Document how tool results inform next steps
441* Specify error handling for tool failures
442* Justify tool selection (why this tool for this task)
443
444## Output Formatting Requirements
445
446Define how the agent communicates with users:
447
448### Response Format
449
450* Start all responses with: `## [Agent Name]: [Action Description]`
451* Use short, action-oriented section headers
452* Employ proper markdown formatting
453* Include emojis for visual clarity (when appropriate)
454
455### Status Reporting
456
457Specify formats for:
458
459* Progress updates
460* Error messages
461* Completion confirmations
462* Validation results
463
464### Requirements Checklist
465
466For agents performing edits or validations:
467
468```markdown
469### Requirements Checklist
470
471- [x] Pre-validation analysis complete - Loaded schema, checked conventions
472- [x] Frontmatter validation - All required fields present
473- [ ] Technical validation - 2 broken file references found
474```
475
476### Quality Gates
477
478Report validation status:
479
480```markdown
481### Quality Gates
482
483- Build: PASS
484- Lint: FAIL - Markdownlint flagged: bare URLs (lines 45, 67)
485- Schema: PASS - Frontmatter validates
486```
487
488## Research and External Sources
489
490When 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.
491
492## Validation Checklist
493
494Before submitting your agent, verify:
495
496### Frontmatter
497
498* [ ] Valid YAML between `---` delimiters
499* [ ] `description` field present and descriptive (10-200 chars)
500* [ ] `tools` array contains only valid tool names (if present)
501* [ ] `agents` array contains valid subagent names (if present)
502* [ ] `user-invocable` and `disable-model-invocation` used correctly (if present)
503* [ ] No trailing whitespace in values
504* [ ] Single newline at EOF
505
506### Content Structure
507
508* [ ] Clear H1 title matching purpose
509* [ ] Overview/role definition section
510* [ ] Core directives with RFC 2119 keywords
511* [ ] Examples wrapped in XML-style blocks
512* [ ] Success criteria defined
513* [ ] Attribution footer present
514
515### Common Standards
516
517* [ ] Markdown quality (see [Common Standards - Markdown Quality](ai-artifacts-common.md#markdown-quality-standards))
518* [ ] XML-style blocks properly formatted (see [Common Standards - XML-Style Blocks](ai-artifacts-common.md#xml-style-block-standards))
519* [ ] RFC 2119 keywords used consistently (see [Common Standards - RFC 2119](ai-artifacts-common.md#rfc-2119-directive-language))
520
521### Technical Validation
522
523* [ ] All file references point to existing files
524* [ ] External links are valid and accessible
525* [ ] Tool names in frontmatter are correct
526* [ ] No conflicts with existing agents
527
528### Integration
529
530* [ ] Aligns with `.github/copilot-instructions.md`
531* [ ] Follows repository conventions
532* [ ] Compatible with existing workflows
533* [ ] Does not duplicate existing agent functionality
534
535## Testing Your Agent
536
537See [AI Artifacts Common Standards - Common Testing Practices](ai-artifacts-common.md#common-testing-practices) for testing guidelines. For agents specifically:
538
5391. Test with realistic scenarios matching the agent's purpose
5402. Verify tool usage patterns execute correctly
5413. Ensure decision points and branching logic work as intended
5424. Check edge cases: missing data, invalid inputs, tool failures
543
544## Common Issues and Fixes
545
546### Agent-Specific Issues
547
548### Invalid Tool Names
549
550Referencing tools that don't exist or using incorrect camelCase variants. Use exact tool names from VS Code Copilot's available tools list.
551
552For additional common issues (XML blocks, markdown, directives), see [AI Artifacts Common Standards - Common Issues and Fixes](ai-artifacts-common.md#common-issues-and-fixes).
553
554## Automated Validation
555
556Run these commands before submission (see [Common Standards - Common Validation](ai-artifacts-common.md#common-validation-standards)):
557
558* `npm run lint:frontmatter`
559* `npm run lint:md`
560* `npm run spell-check`
561* `npm run lint:md-links`
562
563All checks **MUST** pass before merge.
564
565## Related Documentation
566
567* [AI Artifacts Common Standards](ai-artifacts-common.md) - Shared standards for all contributions
568* [Contributing Prompts](prompts.md) - Workflow-specific guidance files
569* [Contributing Instructions](instructions.md) - Technology-specific standards
570* [Pull Request Template](https://github.com/microsoft/hve-core/blob/main/.github/PULL_REQUEST_TEMPLATE.md) - Submission requirements
571
572## Getting Help
573
574See [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/{collection-id}/` (the conventional location for agent files).
575
576---
577
578<!-- markdownlint-disable MD036 -->
579*🤖 Crafted with precision by ✨Copilot following brilliant human instruction,
580then carefully refined by our team of discerning human reviewers.*
581<!-- markdownlint-enable MD036 -->
582