github / github/copilot-cli

Feature request: Allow plugins to declare tool requirements for custom agents when spawned as sub-agents

Đang mở
#3,506 0 bình luận 3 reaction 0 người được giao Xem trên GitHub
area:agents area:plugins area:tools
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

## Summary

When custom agents defined in a plugin (via `.github/agents/*.agent.md`) are invoked as **sub-agents** through the `task` tool, the CLI runtime provisions a restricted tool set that ignores the `tools:` frontmatter declared in the agent file.

This means sub-agents that are designed to create files (e.g. writing review reports, creating proposal documents) cannot do their job when running in the CLI — even though they work fine in VS Code where the `tools:` frontmatter is respected.

## Current behaviour

| Agent declaration | Tools in VS Code | Tools in CLI (sub-agent) |
|---|---|---|
| `tools: [read, search, edit, execute/sendToTerminal, agent, web]` | All declared tools | `view`, `task`, `apply_patch` |
| `tools: [read, search, web, edit/editFiles, agent]` | All declared tools | `view` only |
| `tools: [read, search, web, edit/editFiles]` | All declared tools | `view`, `edit` (existing files only) |

The CLI appears to assign tools based on internal logic rather than respecting the plugin agent's declared requirements.

## Proposed solution

Allow plugins to declare tool requirements for their agents that the CLI respects when spawning them as sub-agents. For example, in the agent frontmatter or in `plugin.json`:

```yaml
---
tools: [read, search, edit, execute/sendToTerminal, agent, web]
cli-tools: [view, edit, create, bash, apply_patch, task] # tools required in CLI runtime
---
```

Or in `plugin.json`:

```json
{
"agents": {
"review": {
"path": ".github/agents/review.agent.md",
"tools": ["view", "edit", "create", "bash", "apply_patch", "task"]
}
}
}
```

## Why this matters

Framework authors building multi-agent workflows (e.g. execute → review → architecture-review → security-review) need sub-agents to persist artifacts (review reports, proposal files). Without write tools, sub-agents must return content in their response text and rely on the calling agent to persist it — adding fragility, complexity, and token overhead to the workflow.

## Tested on

- Copilot CLI v1.0.53
- macOS (darwin-arm64)
- Plugin-based custom agents invoked via the `task` tool

## Workaround

Sub-agents detect whether write tools are available. If not, they return file content and intended paths in their response. The nearest parent agent with write capability persists the artifacts on their behalf.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by tracing how `.github/agents/*.agent.md` and `plugin.json` agent declarations are loaded, then follow the `task` tool path that provisions sub-agent tools. Compare the declared requirements with the CLI's restricted set; done means a documented, tested mechanism lets plugin agents receive the tools they require when spawned as sub-agents.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
json, shell, yaml
Lĩnh vực
cli, devtools
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.