microsoft/hve-core

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
ef978c9692f64214d85e82b4715515e84f8772cb

Branches

Tags

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

Clone

HTTPS

Download ZIP

docs/contributing/custom-agents.md

599lines · 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. The model catalog (`scripts/linting/model-catalog.json`) contains the full list of models available in GitHub Copilot, but hve-core restricts usage to Anthropic and OpenAI.
97
98Accepted: Latest Claude and GPT models with `(copilot)` suffix (e.g., `Claude Sonnet 4.6 (copilot)`, `GPT-5.4 (copilot)`)
99
100Not Accepted: Models from other providers, older model versions not in the catalog, custom/fine-tuned models, deprecated versions
101
102### Model Selection for Subagents
103
104The `model` frontmatter property is **optional**. When omitted, the agent inherits the parent conversation model. Use explicit model selection for cost optimization on subagents that perform read-only or validation tasks:
105
106```yaml
107# Subagent that does research (read-only) — use fast-tier model
108model:
109 - Claude Haiku 4.5 (copilot)
110 - GPT-5.4 mini (copilot)
111```
112
113```yaml
114# Subagent that writes code — omit model to inherit session model
115# (no model property)
116```
117
118Parent agents can also pass `model` dynamically on `runSubagent` calls via instructions in the agent body. The cost tier constraint means subagent models cannot exceed the parent model's tier.
119
120Run `npm run lint:models` to validate model references against the catalog.
121
122## File Structure Requirements
123
124### Location
125
126Agent files are typically organized in a collection subdirectory by convention:
127
128```text
129.github/agents/{collection-id}/
130├── your-agent-name.agent.md
131└── subagents/
132 └── your-subagent-name.agent.md
133```
134
135> [!NOTE]
136> Collections can reference artifacts from any subfolder. The `path:` field in collection YAML files
137> accepts any valid repo-relative path regardless of the artifact's parent directory.
138
139### Naming Convention
140
141* Use lowercase kebab-case: `security-reviewer.agent.md`
142* Be descriptive and action-oriented: `task-planner.agent.md`, `pr-review.agent.md`, `rpi-agent.agent.md`
143* Avoid generic names: `helper.agent.md` ❌ → `ado-work-item-processor.agent.md` ✅
144
145### File Format
146
147Agent files MUST:
148
1491. Use the `.agent.md` extension
1502. Start with valid YAML frontmatter between `---` delimiters
1513. Begin content directly after frontmatter
1524. End with single newline character
153
154## Frontmatter Requirements
155
156### Required Fields
157
158**`description`** (string, MANDATORY)
159
160| Attribute | Details |
161|-----------|--------------------------------------------------------------------------------------|
162| Purpose | Concise explanation of agent functionality |
163| Format | Single sentence, 10-200 characters |
164| Style | Sentence case with proper punctuation |
165| Example | `'Validates contributed content for quality and compliance with hve-core standards'` |
166
167### Optional Fields
168
169**`name`** (string)
170
171| Attribute | Details |
172|-----------|----------------------------------------------------------|
173| Purpose | Custom display name for the agent |
174| Format | Lowercase kebab-case matching filename without extension |
175| Default | File name used if not specified |
176
177**`tools`** (array of strings)
178
179| Attribute | Details |
180|-----------|----------------------------------------------------------------|
181| Purpose | Lists GitHub Copilot tools available to this agent |
182| Format | Array of valid tool names in logical order (read before write) |
183
184Valid tools:
185
186* `codebase` - Semantic code search
187* `search` - Grep/regex search
188* `problems` - Error/warning diagnostics
189* `editFiles` - File modification
190* `changes` - Git change tracking
191* `usages` - Symbol reference search
192* `githubRepo` - External GitHub repository search
193* `fetch` - Web page content retrieval
194* `runCommands` - Terminal command execution
195* `think` - Extended reasoning
196* `findTestFiles` - Test file discovery
197* `terminalLastCommand` - Terminal history
198* `searchResults` - Search view results
199* `edit/createFile` - File creation
200* `edit/createDirectory` - Directory creation
201* `Bicep (EXPERIMENTAL)/*` - Bicep tooling
202* `terraform/*` - Terraform tooling
203* `context7/*` - Library documentation
204* `microsoft-docs/*` - Microsoft documentation
205
206**`agents`** (array of strings)
207
208| Attribute | Details |
209|-------------|------------------------------------------------------------------------------------|
210| Purpose | Declares subagent dependencies available to this agent |
211| Format | Array of agent names. Use `*` to allow all agents, or `[]` to prevent subagent use |
212| Requirement | When specified, include the `agent` tool in the `tools` property |
213
214**`model`** (string or array of strings)
215
216| Attribute | Details |
217|-----------|----------------------------------------------------------------------------------------------|
218| Purpose | Specifies the AI model for this agent |
219| Format | Single model name or prioritized list of models (system tries each in order until available) |
220| Default | Currently selected model in model picker when omitted |
221
222**`user-invocable`** (boolean)
223
224| Attribute | Details |
225|-----------|-----------------------------------------------------------------|
226| Purpose | Controls whether the agent appears in the agents dropdown |
227| Default | `true` |
228| Usage | Set to `false` for agents that are only accessible as subagents |
229
230**`disable-model-invocation`** (boolean)
231
232| Attribute | Details |
233|-----------|---------------------------------------------------------------------------------------------------------------|
234| Purpose | Prevents the agent from being invoked as a subagent by other agents |
235| Default | `false` |
236| Usage | Set to `true` for agents that run subagents, cause side effects, or should only run when explicitly requested |
237
238**`argument-hint`** (string)
239
240| Attribute | Details |
241|-----------|---------------------------------------------------------|
242| Purpose | Hint text shown in the chat input field to guide users |
243| Format | Brief text with required arguments first, then optional |
244
245**`target`** (string enum)
246
247| Attribute | Details |
248|--------------|-----------------------------------------|
249| Purpose | Target environment for the custom agent |
250| Valid values | `vscode`, `github-copilot` |
251
252**`mcp-servers`** (array of objects)
253
254| Attribute | Details |
255|-----------|----------------------------------------------------|
256| Purpose | MCP server configuration for GitHub Copilot agents |
257| Usage | Only applicable when `target: github-copilot` |
258
259**`handoffs`** (array of objects)
260
261| Attribute | Details |
262|--------------|--------------------------------------------------------------------|
263| Purpose | Declares agent-to-agent handoff buttons that appear in the chat UI |
264| Format | Array of handoff declarations |
265| Requirements | VS Code 1.106+ required for handoff support |
266
267Fields per handoff:
268
269* `label` (string, required): Button text displayed in UI, supports emoji
270* `agent` (string, required): Target agent filename without `.agent.md` extension
271* `prompt` (string, optional): Pre-filled prompt text, can include slash commands
272* `send` (boolean, optional): When true, auto-submits prompt; when false (default), user can edit
273* `model` (string, optional): Language model override for the handoff execution
274
275Example:
276
277```yaml
278 handoffs:
279 - label: "📋 Create Plan"
280 agent: Task Planner
281 prompt: /task-plan
282 send: true
283 ```
284
285### Deprecated Fields
286
287**`infer`** (boolean)
288
289| Attribute | Details |
290|-------------------|---------------------------------------------------------------------------------------------------------------------------------|
291| Status | Deprecated. Use `user-invocable` and `disable-model-invocation` instead. |
292| Previous behavior | `infer: true` (default) made the agent both visible in the picker and available as a subagent. `infer: false` hid it from both. |
293
294### Frontmatter Example
295
296```yaml
297---
298description: 'Validates and reviews contributed agents, prompts, and instructions for quality and compliance'
299tools: ['codebase', 'search', 'problems', 'editFiles', 'changes', 'usages']
300disable-model-invocation: true
301agents:
302 - Prompt Tester
303 - Prompt Evaluator
304---
305```
306
307## Collection Entry Requirements
308
309All agents must have matching entries in one or more `collections/*.collection.yml` manifests. Collection entries control selection and maturity.
310
311### Adding Your Agent to a Collection
312
313After creating your agent file, add an `items[]` entry to each target collection:
314
315```yaml
316items:
317 # path can reference artifacts from any subfolder
318 - path: .github/agents/{collection-id}/my-new-agent.agent.md
319 kind: agent
320 maturity: stable
321```
322
323### Selecting Collections for Agents
324
325Choose collections based on who benefits most from your agent:
326
327| Agent Type | Recommended Collections |
328|------------------------|-------------------------------------------|
329| Task workflow agents | `hve-core-all`, `hve-core` |
330| Architecture agents | `hve-core-all`, `project-planning` |
331| Documentation agents | `hve-core-all`, `hve-core` |
332| Data science agents | `hve-core-all`, `data-science` |
333| Design thinking agents | `hve-core-all`, `design-thinking` |
334| ADO/work item agents | `hve-core-all`, `ado`, `project-planning` |
335| Code review agents | `hve-core-all`, `hve-core` |
336
337### Declaring Agent Dependencies
338
339If 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.
340
341For complete collection documentation, see [AI Artifacts Common Standards - Collection Manifests](ai-artifacts-common.md#collection-manifests-and-dependencies).
342
343### MCP Tool Dependencies
344
345When agents reference MCP tools in their `tools:` frontmatter or body content, document the dependencies clearly.
346
347#### Frontmatter Declaration
348
349```yaml
350tools: ['github/*', 'ado/*', 'context7/*', 'microsoft-docs/*']
351```
352
353#### Curated MCP Servers Referenced by HVE Core Agents
354
355| Server | Tool Pattern | Purpose |
356|----------------|--------------------|-------------------------------------------|
357| github | `github/*` | GitHub repository and issue management |
358| ado | `ado/*` | Azure DevOps work items, pipelines, repos |
359| context7 | `context7/*` | Library and SDK documentation lookup |
360| microsoft-docs | `microsoft-docs/*` | Microsoft Learn documentation |
361
362#### Guidelines for MCP Tool References
363
364* Document MCP dependencies in agent body text when using `mcp_*` tool patterns
365* Agents should gracefully handle missing MCP servers (tools unavailable)
366* Reference the [MCP Server Configuration](../getting-started/mcp-configuration.md) guide when agents require MCP tools
367* Prefer built-in VS Code Copilot tools when equivalent functionality exists
368
369## Agent Content Structure Standards
370
371### Required Sections
372
373#### 1. Title (H1)
374
375* Clear, action-oriented heading matching agent purpose
376* Should align with filename and description
377
378```markdown
379# Content Validator Agent
380```
381
382#### 2. Overview/Role Definition
383
384* Explains what the agent does and when to use it
385* Defines scope and boundaries
386* Sets expectations for users
387
388```markdown
389You are an expert reviewer for GitHub Copilot agents, prompts, and instruction files.
390Your mission is to ensure all contributed guidance files meet hve-core quality standards
391before they're merged into the library.
392```
393
394#### 3. Core Directives/Instructions
395
396* Uses clear, imperative language
397* Employs RFC 2119 keywords consistently:
398 * MUST, WILL, MANDATORY, and CRITICAL indicate required behavior
399 * SHOULD and RECOMMENDED indicate strong guidance
400 * MAY and OPTIONAL indicate permitted but not required behavior
401* Provides step-by-step workflows
402* Includes decision points and branching logic
403
404#### 4. Examples and Templates
405
406* Demonstrates correct usage patterns
407* Shows both positive (✅) and negative (❌) examples
408* Wraps in XML-style blocks for reusability
409
410#### 5. Success Criteria
411
412* Defines completion conditions
413* Specifies validation checkpoints
414* Lists quality gates
415
416#### 6. Attribution Footer
417
418Include at end of file (MANDATORY):
419
420```markdown
421---
422
423Brought to you by microsoft/hve-core
424```
425
426### XML-Style Block Requirements
427
428See [AI Artifacts Common Standards - XML-Style Block Standards](ai-artifacts-common.md#xml-style-block-standards) for complete rules and examples.
429
430### Directive Language Standards
431
432Use 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.
433
434## Tool Usage Discipline
435
436When agents use tools, they **MUST** follow these patterns:
437
438### Tool Usage Preambles
439
440Before any batch of tool calls, include a one-sentence explanation:
441
442```markdown
443Tool Usage Preamble: "Analyzing file structure, reading schemas, and checking
444repository conventions to establish validation baseline."
445```
446
447### Checkpoints
448
449After 3-5 tool calls or more than 3 file edits, provide a compact checkpoint:
450
451```markdown
452Checkpoint After Discovery: "Identified [file type], loaded [schema name],
453found [N] related files for comparison."
454```
455
456### Tool Result Integration
457
458* Document how tool results inform next steps
459* Specify error handling for tool failures
460* Justify tool selection (why this tool for this task)
461
462## Output Formatting Requirements
463
464Define how the agent communicates with users:
465
466### Response Format
467
468* Start all responses with: `## [Agent Name]: [Action Description]`
469* Use short, action-oriented section headers
470* Employ proper markdown formatting
471* Include emojis for visual clarity (when appropriate)
472
473### Status Reporting
474
475Specify formats for:
476
477* Progress updates
478* Error messages
479* Completion confirmations
480* Validation results
481
482### Requirements Checklist
483
484For agents performing edits or validations:
485
486```markdown
487### Requirements Checklist
488
489- [x] Pre-validation analysis complete - Loaded schema, checked conventions
490- [x] Frontmatter validation - All required fields present
491- [ ] Technical validation - 2 broken file references found
492```
493
494### Quality Gates
495
496Report validation status:
497
498```markdown
499### Quality Gates
500
501- Build: PASS
502- Lint: FAIL - Markdownlint flagged: bare URLs (lines 45, 67)
503- Schema: PASS - Frontmatter validates
504```
505
506## Research and External Sources
507
508When 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.
509
510## Validation Checklist
511
512Before submitting your agent, verify:
513
514### Frontmatter
515
516* [ ] Valid YAML between `---` delimiters
517* [ ] `description` field present and descriptive (10-200 chars)
518* [ ] `tools` array contains only valid tool names (if present)
519* [ ] `agents` array contains valid subagent names (if present)
520* [ ] `user-invocable` and `disable-model-invocation` used correctly (if present)
521* [ ] No trailing whitespace in values
522* [ ] Single newline at EOF
523
524### Content Structure
525
526* [ ] Clear H1 title matching purpose
527* [ ] Overview/role definition section
528* [ ] Core directives with RFC 2119 keywords
529* [ ] Examples wrapped in XML-style blocks
530* [ ] Success criteria defined
531* [ ] Attribution footer present
532
533### Common Standards
534
535* [ ] Markdown quality (see [Common Standards - Markdown Quality](ai-artifacts-common.md#markdown-quality-standards))
536* [ ] XML-style blocks properly formatted (see [Common Standards - XML-Style Blocks](ai-artifacts-common.md#xml-style-block-standards))
537* [ ] RFC 2119 keywords used consistently (see [Common Standards - RFC 2119](ai-artifacts-common.md#rfc-2119-directive-language))
538
539### Technical Validation
540
541* [ ] All file references point to existing files
542* [ ] External links are valid and accessible
543* [ ] Tool names in frontmatter are correct
544* [ ] No conflicts with existing agents
545
546### Integration
547
548* [ ] Aligns with `.github/copilot-instructions.md`
549* [ ] Follows repository conventions
550* [ ] Compatible with existing workflows
551* [ ] Does not duplicate existing agent functionality
552
553## Testing Your Agent
554
555See [AI Artifacts Common Standards - Common Testing Practices](ai-artifacts-common.md#common-testing-practices) for testing guidelines. For agents specifically:
556
5571. Test with realistic scenarios matching the agent's purpose
5582. Verify tool usage patterns execute correctly
5593. Ensure decision points and branching logic work as intended
5604. Check edge cases: missing data, invalid inputs, tool failures
561
562## Common Issues and Fixes
563
564### Agent-Specific Issues
565
566### Invalid Tool Names
567
568Referencing tools that don't exist or using incorrect camelCase variants. Use exact tool names from VS Code Copilot's available tools list.
569
570For additional common issues (XML blocks, markdown, directives), see [AI Artifacts Common Standards - Common Issues and Fixes](ai-artifacts-common.md#common-issues-and-fixes).
571
572## Automated Validation
573
574Run these commands before submission (see [Common Standards - Common Validation](ai-artifacts-common.md#common-validation-standards)):
575
576* `npm run lint:frontmatter`
577* `npm run lint:md`
578* `npm run spell-check`
579* `npm run lint:md-links`
580
581All checks **MUST** pass before merge.
582
583## Related Documentation
584
585* [AI Artifacts Common Standards](ai-artifacts-common.md) - Shared standards for all contributions
586* [Contributing Prompts](prompts.md) - Workflow-specific guidance files
587* [Contributing Instructions](instructions.md) - Technology-specific standards
588* [Pull Request Template](https://github.com/microsoft/hve-core/blob/main/.github/PULL_REQUEST_TEMPLATE.md) - Submission requirements
589
590## Getting Help
591
592See [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).
593
594---
595
596<!-- markdownlint-disable MD036 -->
597*🤖 Crafted with precision by ✨Copilot following brilliant human instruction,
598then carefully refined by our team of discerning human reviewers.*
599<!-- markdownlint-enable MD036 -->
600