plugins/copilot-cli/skills/copilot-cli-agent/SKILL.md
Copilot CLI sub-agent system for dispatching tasks and persona-based analysis to GitHub Copilot models. Use for task delegation (agent reads/writes files directly), security audits, architecture reviews, or any work requiring a fresh model context.
npx skillsauth add richfrem/agent-plugins-skills copilot-cli-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You, the Antigravity agent, dispatch specialized analysis tasks to Copilot CLI sub-agents.
[!IMPORTANT] Default model:
gpt-5-mini(free tier — no per-request cost). Use this unless the user explicitly requests a premium model. Premium models (e.g.,claude-sonnet-4.6) are charged per request, not per token — see the 💰 Premium Model Cost Discipline section before using them.
To ensure Copilot CLI behaves as a specialized persona rather than a generic responder, always embed the persona and source material directly into the prompt flag (-p).
copilot -p "$(cat agents/persona.md)
---SOURCE CODE---
$(cat target.py)
---INSTRUCTION---
Perform a full code review. Use severity levels: 🔴 CRITICAL, 🟡 MODERATE, 🟢 MINOR.
You are operating as an isolated sub-agent.
Do NOT use tools. Do NOT access filesystem." > review.md
run_agent.py (Cross-Platform)For reusable sub-agent execution, use the provided Python orchestrator which handles temp file assembly and prompt concatenation reliably across Windows, macOS, and Linux.
# Signature:
python ./scripts/run_agent.py <PERSONA_FILE> <INPUT_FILE> <OUTPUT_FILE> "<INSTRUCTION>" [MODEL] [isolated]
# ^ ^
# optional optional (default: false)
Task dispatch (default — agent has full filesystem access via --yolo):
# Agent reads/writes files directly. Pass the task prompt as INPUT_FILE.
python plugins/copilot-cli/scripts/run_agent.py \
/dev/null \
tasks/todo/copilot_prompt_0025.md \
temp/copilot_output_0025.md \
"Implement all changes specified in the prompt." \
claude-sonnet-4.6
Isolated analysis (no filesystem tools — text output only):
# Pass isolated=true as 6th arg. Agent generates text output only.
python plugins/copilot-cli/scripts/run_agent.py \
agents/security-auditor.md target.py security.md \
"Find vulnerabilities." gpt-5-mini true
run_agent.py)| Inputs present | Assembled prompt |
|:---|:---|
| persona + input | persona / ---SOURCE--- input / ---INSTRUCTION--- instruction |
| input only (task dispatch) | input / ---INSTRUCTION--- instruction |
| instruction only (heartbeat) | instruction |
Passing /dev/null for persona or input skips that block cleanly.
gpt-5-mini (Free — use for most tasks)# No model arg = gpt-5-mini (free tier, no per-request cost)
python ./scripts/run_agent.py agents/security-auditor.md target.py security.md \
"Find vulnerabilities."
claude-sonnet-4.6 (Charged per request — batch everything)# Pass model name as the 5th argument to override the default
python ./scripts/run_agent.py /dev/null /tmp/copilot_prompt.md /tmp/copilot_output.md \
"Generate all files exactly as specified using ===FILE:=== delimiters." \
claude-sonnet-4.6
[!NOTE] When to use
claude-sonnet-4.6: Complex multi-file generation, nuanced content requiring reasoning, tasks where output quality matters more than cost. See 💰 Premium Model Cost Discipline for request-batching rules before calling.
| Model | Identifier | Cost |
|:---|:---|:---|
| GitHub Copilot default | gpt-5-mini | Free / flat rate |
| GPT-5.4 (default non-free) | gpt-5.4 | 1x |
| GPT-5.4 mini | gpt-5.4-mini | 0.33x |
| Claude Sonnet 4.6 | claude-sonnet-4.6 | 1x per request (premium) |
| Claude Sonnet 4.5 | claude-sonnet-4.5 | 1x per request (premium) |
| Claude Haiku 4.5 | claude-haiku-4.5 | 0.33x per request (premium) |
| Claude Opus 4.7 | claude-opus-4.7 | 7.5x per request (premium) |
[!WARNING] Model identifiers use dots not dashes —
claude-sonnet-4.6NOTclaude-sonnet-4.6. Using dashes returns "model not available" error. Verify withcopilot --model <id> -p "test"before a premium batch run. Identifiers change with Copilot CLI updates — runcopilot -i "list models"or check the interactive model selector to confirm current names.
agents/)| Persona | Use For |
|:---|:---|
| security-auditor.md | Red team, vulnerability scanning, threat modeling |
| refactor-expert.md | Optimizing code for readability, performance, and DRY |
| architect-review.md | Assessing system design, modularity, and complexity |
Using cat code.py | copilot -p "review this" is unreliable. The CLI often prioritizes the prompt flag and ignores the piped input. Always embed the code inside the command string as shown in the Core Pattern.
Large prompt expansions (e.g., $(cat ...) > 10KB) can silently fail when run in the background (&).
run_agent.py).wc -l.Always add these instructions to your dispatch prompt to prevent the sub-agent from attempting to use external tools. Strictly use gpt-5-mini as the default model.
To dramatically improve review results, add:
"Think step-by-step internally, but output only final results. Be strict and critical. Do not be polite."
[!CAUTION] Premium models (e.g.,
claude-sonnet-4.6,claude-opus) are billed per REQUEST, not per token. A 5-request workflow costs 5× more than a 1-request workflow with the same total content. Maximize token density per call — do NOT make iterative follow-up requests.
| Model | Cost Model | Request Strategy |
|:---|:---|:---|
| gpt-5-mini (default) | Free / flat rate | Iterative fine-grained requests are fine |
| claude-sonnet-4.6, claude-opus, etc. | Per request | ONE big dense request — batch everything |
===FILE: [relative/path/to/file]===
[complete file content]
===ENDFILE===
===FILE:=== markers in your prompt — confirm the same count appears in output before parsing.gpt-5-mini (default), never against a premium model — it's a waste of a paid request.&) premium model calls. Large prompt expansions can silently fail in background processes. Run sequentially and verify output with wc -l (expect 200+ lines for multi-file generation).# Write the full multi-file prompt to a temp file first
cat > /tmp/copilot_prompt.md << 'PROMPT_EOF'
[Your complete, dense, multi-file generation prompt]
PROMPT_EOF
# Dispatch ONE request — all output in a single call
python ./scripts/run_agent.py \
/dev/null \
/tmp/copilot_prompt.md \
/tmp/copilot_output.md \
"Generate all files exactly as specified using ===FILE:=== delimiters." \
claude-sonnet-4.6
# Verify output is substantial before parsing
wc -l /tmp/copilot_output.md # expect 200+ lines for multi-file output
# Confirm all expected FILE markers are present before assuming success
grep -c '===FILE:' /tmp/copilot_output.md # should equal your expected file count
Before initiating major orchestrations or long-running iterative loops (e.g., Triple-Loop), you MUST perform a zero-shot heartbeat check to verify the host CLI has end-to-end connectivity and correct model defaults.
python .agents/skills/copilot-cli-agent/scripts/run_agent.py \
/dev/null /dev/null ./HEARTBEAT_MD.md \
"HEARTBEAT CHECK: Respond with 'HEARTBEAT_OK' only."
# Verification Logic:
[ -s ./HEARTBEAT_MD.md ] && grep -q "HEARTBEAT_OK" ./HEARTBEAT_MD.md && echo "HEARTBEAT_OK" || echo "HEARTBEAT_FAIL"
Logging Requirement: The result of this heartbeat (Success or Failure) MUST be explicitly written to the session log before proceeding. If it fails, halt execution and report the error details (e.g., 401 Unauthorized, 429 Rate Limit, or Network Error).
python ./scripts/run_agent.py agents/refactor-expert.md target.py output.md "Refactor this code."
Examine output.md. It should contain ONLY the refactored code and a brief 3-bullet summary.
claude-sonnet-4.6 works; claude-sonnet-4-6 returns "model not available". Always use dot notation for Claude version numbers in Copilot CLI.copilot --yolo --model <id> -p "HEARTBEAT_OK" first — if it echoes back any response, the identifier is valid. Do not assume identifiers from docs or memory are current.run_agent.py passes the 5th argument directly to --model. If the identifier is wrong, the script exits with a non-zero code and produces no output file. Check exit code and output file size before claiming success.&) a premium model call. Run foreground and verify with wc -l output.md — expect 200+ lines for multi-file output.gpt-5-mini (default, no model arg). Heartbeating against a premium model wastes a paid request.tools
Ingests repository files into the ChromaDB vector store. Builds or updates the vector index from a manifest or directory scan using ingest.py. Use when new files need to be indexed or the vector store is out of date. <example> user: "Index these new plugin files into the vector database" assistant: "I'll use vector-db-ingest to add them to the vector store." </example> <example> user: "The vector store is missing recent files -- update it" assistant: "I'll use vector-db-ingest to re-index the changes." </example>
data-ai
Removes stale and orphaned chunks from the ChromaDB vector store for files that have been deleted or renamed. Use after files are removed or moved to keep the vector index in sync with the filesystem. <example> user: "Clean up the vector store after I deleted some files" assistant: "I'll use vector-db-cleanup to remove orphaned chunks." </example> <example> user: "The vector database has chunks for files that no longer exist" assistant: "I'll run vector-db-cleanup to prune them." </example>
testing
Audit Vector DB coverage -- compares the live filesystem manifest against the ChromaDB index to identify coverage gaps.
development
3-Phase Knowledge Search strategy for the RLM Factory ecosystem. Auto-invoked when tasks involve finding code, documentation, or architecture context in the repository. Enforces the optimal search order: RLM Summary Scan (O(1)) -> Vector DB Semantic Search -> Grep/Exact Match. Never skip phases.