docs(kyberforge): add GitHub Copilot plugins and sub-agents research
## Why Parallel research track to the Claude Code plugins research already committed. Needed to understand GitHub Copilot's extensibility model before designing cross-tool plugin compatibility for the kyberforge plugin system. ## Implementation Notes Three distinct Copilot extension tracks are covered: CLI plugins (plugin.json + marketplaces), cloud/IDE custom agents (frontmatter .md files committed to repos), and the SDK programmatic API. The SDK track got its own topic file (sdk.md) because the content doesn't fit neatly into the default topic list. Sources include Context7 (/websites/github_en_copilot), both user-provided reference URLs, and four additional deepened pages. ## Impact Provides a reference baseline for evaluating .claude-plugin/ / plugin.json compatibility between Claude Code and Copilot CLI — the two formats share a manifest discovery path and the strict:false field enables cross-tool plugin distribution. --- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
e09d1cd297
commit
83e1a50a51
10 files changed
+1279
No files matched your search
@@ -0,0 +1,263 @@
|
||||
---
|
||||
topic: examples
|
||||
source_keys:
|
||||
- context7-github-en-copilot
|
||||
- github-plugins-creating
|
||||
- github-custom-agents-configuration
|
||||
- github-sdk-custom-agents
|
||||
- github-cli-plugin-reference
|
||||
- github-plugins-marketplace
|
||||
---
|
||||
|
||||
# Examples
|
||||
|
||||
## Plugin Directory Structure
|
||||
|
||||
```
|
||||
my-plugin/
|
||||
├── plugin.json
|
||||
├── agents/
|
||||
│ └── helper.agent.md
|
||||
├── skills/
|
||||
│ └── deploy/
|
||||
│ └── SKILL.md
|
||||
├── hooks.json
|
||||
└── .mcp.json
|
||||
```
|
||||
|
||||
## Minimal `plugin.json`
|
||||
|
||||
```json
|
||||
{ "name": "my-plugin" }
|
||||
```
|
||||
|
||||
## Full `plugin.json`
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-dev-tools",
|
||||
"description": "React development utilities",
|
||||
"version": "1.2.0",
|
||||
"author": {
|
||||
"name": "Jane Doe",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": ["react", "frontend"],
|
||||
"agents": "agents/",
|
||||
"skills": ["skills/", "extra-skills/"],
|
||||
"hooks": "hooks.json",
|
||||
"mcpServers": ".mcp.json"
|
||||
}
|
||||
```
|
||||
|
||||
## CLI Agent Examples
|
||||
|
||||
### Read-Only Research Agent
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: researcher
|
||||
description: Explores codebases and answers questions; never modifies files
|
||||
tools: ["search", "read"]
|
||||
---
|
||||
|
||||
You are a research assistant. Analyze code and answer questions clearly.
|
||||
Do not modify any files under any circumstances.
|
||||
```
|
||||
|
||||
### Write-Capable Implementation Agent
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: implementer
|
||||
description: Makes targeted code changes based on provided specifications
|
||||
tools: ["read", "edit", "bash"]
|
||||
---
|
||||
|
||||
You are a code editor. Make minimal, surgical changes to files as instructed.
|
||||
Always read the relevant file before editing.
|
||||
```
|
||||
|
||||
## Cloud / IDE Agent Examples
|
||||
|
||||
### Testing Specialist (tool-unrestricted, behavioral constraint)
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: test-specialist
|
||||
description: Focuses on test coverage and quality without modifying production code
|
||||
---
|
||||
|
||||
You are a testing specialist. Write tests, identify coverage gaps, and improve
|
||||
test quality. Never modify source files outside of test directories.
|
||||
```
|
||||
|
||||
### Implementation Planner (tool-restricted)
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: implementation-planner
|
||||
description: Creates detailed implementation plans and technical specifications in markdown
|
||||
tools: ["read", "search", "edit"]
|
||||
---
|
||||
|
||||
You are a technical planning specialist. Produce comprehensive implementation plans
|
||||
as structured markdown. Do not execute code or run shell commands.
|
||||
```
|
||||
|
||||
### Agent with Custom MCP Server
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: db-analyst
|
||||
description: Analyzes database schema and queries using a Postgres MCP server
|
||||
tools: ["read", "search", "custom-db/query"]
|
||||
mcp-servers:
|
||||
custom-db:
|
||||
type: 'local'
|
||||
command: 'pg-mcp-server'
|
||||
args: ['--port', '5432']
|
||||
tools: ["*"]
|
||||
env:
|
||||
DB_PASSWORD: ${{ secrets.COPILOT_DB_PASSWORD }}
|
||||
---
|
||||
|
||||
You are a database analyst. Use the Postgres MCP server to run read-only queries
|
||||
and explain schema structure.
|
||||
```
|
||||
|
||||
## SDK Examples
|
||||
|
||||
### TypeScript — Researcher + Editor Pattern
|
||||
|
||||
```typescript
|
||||
import { CopilotClient } from "@github/copilot-sdk";
|
||||
|
||||
const client = new CopilotClient();
|
||||
await client.start();
|
||||
|
||||
const session = await client.createSession({
|
||||
model: "gpt-4.1",
|
||||
customAgents: [
|
||||
{
|
||||
name: "researcher",
|
||||
displayName: "Research Agent",
|
||||
description: "Explores codebases and answers questions using read-only tools",
|
||||
tools: ["grep", "glob", "view"],
|
||||
prompt: "You are a research assistant. Analyze code and answer questions. Do not modify any files.",
|
||||
},
|
||||
{
|
||||
name: "editor",
|
||||
displayName: "Editor Agent",
|
||||
description: "Makes targeted code changes",
|
||||
tools: ["view", "edit", "bash"],
|
||||
prompt: "You are a code editor. Make minimal, surgical changes to files as requested.",
|
||||
},
|
||||
],
|
||||
onPermissionRequest: async () => ({ kind: "approve-once" }),
|
||||
});
|
||||
```
|
||||
|
||||
### Python — Equivalent
|
||||
|
||||
```python
|
||||
from copilot import CopilotClient, PermissionDecisionApproveOnce
|
||||
|
||||
client = CopilotClient()
|
||||
await client.start()
|
||||
|
||||
session = await client.create_session(
|
||||
model="gpt-4.1",
|
||||
custom_agents=[
|
||||
{
|
||||
"name": "researcher",
|
||||
"display_name": "Research Agent",
|
||||
"description": "Explores codebases and answers questions using read-only tools",
|
||||
"tools": ["grep", "glob", "view"],
|
||||
"prompt": "You are a research assistant. Analyze code. Do not modify files.",
|
||||
},
|
||||
{
|
||||
"name": "editor",
|
||||
"display_name": "Editor Agent",
|
||||
"description": "Makes targeted code changes",
|
||||
"tools": ["view", "edit", "bash"],
|
||||
"prompt": "You are a code editor. Make minimal changes.",
|
||||
},
|
||||
],
|
||||
on_permission_request=lambda req, inv: PermissionDecisionApproveOnce(),
|
||||
)
|
||||
```
|
||||
|
||||
### Pre-Selecting an Agent at Session Start
|
||||
|
||||
```typescript
|
||||
const session = await client.createSession({
|
||||
model: "gpt-4.1",
|
||||
customAgents: [{ name: "researcher", ... }],
|
||||
agent: "researcher", // pre-activates without inference roundtrip
|
||||
onPermissionRequest: async () => ({ kind: "approve-once" }),
|
||||
});
|
||||
```
|
||||
|
||||
### Listening to Sub-Agent Lifecycle Events
|
||||
|
||||
```typescript
|
||||
session.on((event) => {
|
||||
if (event.type === "subagent.started") {
|
||||
console.log(`Sub-agent started: ${event.agentName} (${event.toolCallId})`);
|
||||
}
|
||||
if (event.type === "subagent.failed") {
|
||||
console.error(`Sub-agent failed: ${event.agentName}`, event.error);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Hooks Example
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"hooks": {
|
||||
"sessionStart": [
|
||||
{
|
||||
"type": "command",
|
||||
"bash": "echo 'Copilot session started'",
|
||||
"powershell": "Write-Output 'Copilot session started'",
|
||||
"cwd": ".",
|
||||
"timeoutSec": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Marketplace Manifest Example
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "my-team-marketplace",
|
||||
"owner": { "name": "My Team", "email": "[email protected]" },
|
||||
"metadata": { "description": "Internal tools", "version": "1.0.0" },
|
||||
"plugins": [
|
||||
{ "name": "backend-tools", "source": "./plugins/backend", "version": "1.0.0" },
|
||||
{ "name": "frontend-tools", "source": "./plugins/frontend", "version": "2.1.0" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Register it: `copilot plugin marketplace add myorg/my-team-plugins`
|
||||
|
||||
## Cross-Platform LSP Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"lspServers": {
|
||||
"my-lsp": {
|
||||
"bash": "${PLUGIN_ROOT}/scripts/start-lsp.sh",
|
||||
"powershell": "${PLUGIN_ROOT}/scripts/start-lsp.ps1",
|
||||
"fileExtensions": { ".myext": "mylang" }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user