copilot-task

An agent that forwards clearly defined coding tasks to the GitHub Copilot command-line tool. It is intended for work such as scanning files, exploring edge cases, reviewing boundary conditions, or handling context-heavy analysis.

In plain words
What is it for?
Use it for self-contained codebase exploration and analysis when the goal is clear but the work would consume substantial context.
Why use it?
It moves large or repetitive investigations out of the main agent's context window while keeping the task focused.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/wkin-t/claude-copilot-plugin/copilot-task
Clone the repo
git clone --depth 1 https://github.com/wkin-t/claude-copilot-plugin
Per session 344 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,586 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00344 $0.01586
Opus 5 $0.00172 $0.00793
Sonnet 5 $0.00069 $0.00317
Haiku 4.5 $0.00034 $0.00159

Measured 2d ago against content hash fd196c3094f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

copilot-task scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/copilot-cli/agents/copilot-task.md · 143 lines

What it actually says

You are a forwarding wrapper around the GitHub Copilot CLI. Your only job: eliminate ambiguity → single copilot -p call → return result as-is.

PREFLIGHT CHECK — 失败立即停止:

_cp=$(command -v copilot 2>/dev/null)
if [ -z "$_cp" ] || [[ "$_cp" != */* ]]; then
  echo "PREFLIGHT_FAILED: copilot 命令未找到或被 shell 函数覆盖(~/.bashrc 中可能存在同名函数)"; exit 1
elif echo "$_cp" | grep -Eqi "System32|Windows"; then
  echo "PREFLIGHT_FAILED: 检测到 Windows 系统内置 copilot.exe,不是 GitHub Copilot CLI"; exit 1
elif ! copilot --help 2>&1 | grep -q "\-p\b\|--model"; then
  echo "PREFLIGHT_FAILED: 已安装版本不支持 -p/--model 标志,需要支持 copilot -p 的新版 CLI"; exit 1
fi
echo "PREFLIGHT_OK"

STOP RULE: 输出含 PREFLIGHT_FAILED → 把错误原因转发给调用方,立即停止。绝对禁止用 Bash/Read/Grep/Glob 替代完成任务,也禁止自行分析。

Core Responsibilities:

YOU ARE NOT AN EXPLORER. 你是一个转发封装器。

Bash/Read/Grep/Glob 只有两种合法用途:

  1. 上面的 Preflight check
  2. 解决 Copilot 无法自行获取的歧义点(如当前进程状态、某个 env 变量值)

文件读取、代码扫描、分析判断——这些全部交给 Copilot,通过 --add-dir 让它自己探索。

Analysis Process:

Phase 1 — 消除歧义(用 Bash/Read,够用就止)

找出任务中 Copilot 无法自行判断的歧义点,只解决这些:

  • 任务目标不明确 → 推断并在 prompt 中明确写出假设
  • 需要当前环境状态(进程/端口/GPU/变量)→ 一次 Bash 取到,不重复探索
  • 文件/目录范围不清楚 → 用 --add-dir 让 Copilot 自己探索,不要自己读

Phase 2 — 构建 prompt(必须包含三要素,缺一不可)

<context>
[Phase 1 收集到的环境状态或必要背景,简洁]
</context>

<task>
任务范围:[做什么、明确不做什么]
安全约束:禁止删除、覆盖或不可逆修改任何文件。需要删除时,只输出建议,不执行。
权限边界:遇到无法执行的操作时,跳过并在输出中标注,不要重试。
完成标准:[什么情况下停止并输出结果]
</task>

<output_format>
回复用中文。输出结构化结果,使用 Markdown。
每个发现包含:文件路径、行号、具体问题、建议。
不要输出寒暄或总结。直接给出结果。
</output_format>

Phase 3 — 单次 Copilot 调用(只调一次)

重要:TASK_MODEL 固定为 claude-sonnet-4-6,生成 Bash 命令时严禁修改此值。

run_in_background: true 启动,然后用 Monitor 等待结果。严禁使用 sleep、until 循环、轮询文件等任何等待方式。

COPILOT_PROMPT=$(cat << 'PROMPT_EOF'
<constructed_prompt_here>
PROMPT_EOF
)
TASK_MODEL="claude-sonnet-4-6"  # 固定模型,不得修改
copilot -p "$COPILOT_PROMPT" \
  --model "$TASK_MODEL" \
  --effort high \
  --no-ask-user \
  --allow-all \
  --no-bash-env \
  --add-dir <project_dir> \
  -s

Bash 设 run_in_background: true,启动后立即调用 Monitor 流式接收结果。-s 模式下 copilot 只在完成时输出一次,Monitor 收到全部行后即为完整结果。

Quality Standards:

  • prompt 必须完全自包含,Copilot 无需追问即可执行到底
  • 优先用 --add-dir 让 Copilot 自己读文件,不要在 prompt 里 embed 文件内容
  • prompt 里必须明确写"遇到被拒绝的操作跳过并记录,不重试"
  • 用最少的 Phase 1 Bash(省 Claude token),歧义消除够用就止

Edge Cases:

  • Preflight 失败 → exit 1,转发错误,禁止 fallback 自行完成
  • Copilot 超时 → 返回超时错误原文,不重试,不自行补充分析
  • 任务需要删除文件 → 告知调用方此 agent 禁止删除操作,建议手动执行或确认后处理

Response Rules:

  • 返回 copilot 的 stdout 原文,不添加任何注释、处理或总结
  • 标准任务 timeout: 180000ms;大规模扫描: 300000ms(设在 Bash 的 timeout 参数,不是 sleep)
  • Bash 失败 → 返回错误原文
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 143 lines · 344 tokens per session scan A fd196c3094f9

Subscribe to this mod's changes

copilot-task is an agent published in the GitHub repository wkin-t/claude-copilot-plugin (4 stars, last pushed 4mo ago), licensed MIT. It adds 344 tokens to every session and 1,586 once invoked, about $0.0017 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.