Custom agent file reference
This article describes custom agent file syntax, frontmatter fields, and harness-specific configuration in VS Code. For creation steps, file locations, and a complete starter example, see Create and manage custom agents.
File structure
A custom agent file contains an optional YAML header, enclosed by --- delimiters, followed by a Markdown body with the agent's instructions:
---
name: Reviewer
description: Review changes without editing files
tools: ['read', 'search']
---
Review the supplied changes for correctness and missing tests.
Report actionable findings with file references. Do not edit files.
The fields below describe the VS Code format. Files in .claude/agents use the Claude agent format.
Harness compatibility
The selected agent harness determines which fields and tool names take effect. A shared file location does not imply identical behavior across harnesses.
- Local supports the VS Code tool names, subagent configuration, handoffs, and agent-scoped hooks described below.
- Copilot supports custom agent configuration through its runtime. Use the field-specific guidance below and the Copilot custom agent documentation. Local handoffs do not apply. Agent-scoped hooks have a current plugin-agent conversion limitation.
- Claude uses its own agent format and runtime behavior.
- Copilot cloud agent has a separate configuration reference. The
target: github-copilotvalue refers to that target, not the Copilot harness selected in VS Code.
Header fields
All fields in this table are optional. Defaults and harness-specific behavior are listed where applicable.
Tools
In Local, tools can include built-in tools, MCP tools, and tools contributed by extensions. Existing user-defined tool-set references are deprecated and are not supported in the Copilot harness. See Replace tool sets. Built-in aliases such as read and search are separate from user-defined tool-set files. To include all tools from an MCP server, use <server name>/*.
tools: ['read', 'search', '<server name>/*']
Replace <server name> with the name of a configured MCP server. If tools is omitted in Local, the tools enabled in the tools picker are available. Unavailable tools are ignored.
For Copilot and other harnesses, check tool availability before reusing a Local agent's tool list.
Model preferences
To specify a prioritized list, replace the placeholders with model names available in your harness:
model: ['<preferred model>', '<fallback model>']
Subagent configuration
In Local, restrict a coordinator to named workers by combining agents with the agent tool set:
tools: ['agent']
agents: ['Researcher', 'Implementer']
Agent names are case-sensitive. Explicitly listing an agent in agents permits invocation even if that worker sets disable-model-invocation: true. To allow a subagent to delegate further, enable
chat.subagents.allowInvocationsFromSubagents
. This also applies to an agent that lists itself. See Nested subagents.
For complete coordinator and worker files, see Delegate implementation to a worker.
Visibility and invocation
To hide an agent from the picker while keeping it available for delegation:
user-invocable: false
disable-model-invocation: false
These fields change the shared agent definition, not a personal visibility preference. See Customize the agents dropdown list.
Handoff fields
Each object in the handoffs array defines a transition in the Local harness:
| Field | Type | Description |
|---|---|---|
label |
String, required | Text on the handoff button. |
agent |
String, required | The target agent identifier. |
prompt |
String, required | The prompt to pre-fill when the user selects the handoff. |
send |
Boolean | Whether to submit the prompt automatically. Defaults to false. |
model |
String | Model to select for the handoff. Use the qualified name in the format <model name> (<vendor>), such as <model name> (copilot). |
handoffs:
- label: Implement Plan
agent: agent
prompt: Implement the plan outlined above.
send: false
model: <model name> (copilot)
Replace the model placeholder with an available model, or omit model. For a planning-to-implementation walkthrough, see Handoffs.
Body
The Markdown body contains the instructions the agent follows, such as its task, guidelines, and expected output.
Reference files with Markdown links or #file: syntax. Relative paths resolve from the custom agent file. Use ~ or ~/ to reference your home folder, and use Unix-style / separators to keep paths portable across operating systems.
Follow the [review checklist](./review-checklist.md).
Use #file:~/copilot/security-guidelines.md for security reviews.
In Local, reference a tool with #tool:<tool-name>, such as #tool:web/fetch.
When you select the custom agent in the Chat view, its body instructions are added after your custom instructions and take precedence if they conflict.
Tool list priority
In Local, a prompt file's tools list takes precedence over the custom agent's tools list. Other harnesses don't load prompt files. For the full order, see Tool list priority.
Claude agent format
Agent files in .claude/agents use plain .md files and the Claude subagents format.
The Claude harness implements these fields according to its provider documentation. When Local loads a Claude-format agent, it maps supported Claude tool and model names to their VS Code equivalents. This compatibility does not make all Claude runtime features available in Local.
