AI Software Engineering Agent 平台 :IDE Agent、CLI Agent、Cloud Agent、Code Review、MCP、Skills、Custom Agents 等组合起来,已经非常接近你之前研究的 AI Software Factory 。(GitHub Docs)
下面我按 "功能 → 原理 → Agent 架构 → 实现 → 使用 → 常用命令 → 工程实践" 来讲。
1. GitHub Copilot 到底是什么?
可以把 Copilot 理解成:
LLM + Code Context + Tools + Agent Loop + GitHub/IDE Integration
传统 Copilot:
Developer
↓
Prompt / Code
↓
LLM
↓
Code Suggestion
↓
Developer
Agentic Copilot:
Developer
│
▼
Task / Issue
│
▼
┌──────────────────────┐
│ Copilot Agent │
│ │
│ Understand Task │
│ ↓ │
│ Explore Repository │
│ ↓ │
│ Build Plan │
│ ↓ │
│ Modify Code │
│ ↓ │
│ Run Tests │
│ ↓ │
│ Analyze Errors │
│ ↓ │
│ Fix │
│ ↓ │
│ Review │
└──────────────────────┘
│
▼
Git Commit / PR
GitHub 官方目前把 Copilot 的能力扩展到了 IDE Agent Mode、CLI、Cloud Agent、Code Review、MCP 和 Agent Skills 等多个方向。(GitHub Docs)
所以从你的角度,不要把 Copilot 理解成 ChatGPT for coding。
更准确的理解是:
Copilot = 一个嵌入 GitHub 软件研发流程的 Coding Agent Platform。
2. Copilot 主要功能
目前可以从 7 个层次理解。
| 能力 | 作用 | Agentic 程度 |
|---|---|---|
| Code Completion | 自动补代码 | ★ |
| Copilot Chat | 问答、解释代码 | ★★ |
| Edit | 修改代码 | ★★★ |
| Agent Mode | 自动分析、修改、执行 | ★★★★ |
| Copilot CLI | Terminal Agent | ★★★★ |
| Cloud Agent | GitHub 后台异步开发 | ★★★★★ |
| Custom Agent / Skills / MCP | 构建企业级 Coding Agent | ★★★★★ |
3. Code Completion
这是最早的 Copilot。
例如:
public User findUserById(Long id) {
Copilot 推测:
return userRepository.findById(id)
.orElseThrow(() -> new UserNotFoundException(id));
}
这里本质上是:
当前代码
+
文件上下文
+
附近代码
+
项目上下文
+
语言信息
↓
LLM
↓
代码预测
它主要解决:
"下一段代码应该是什么?"
但这还不属于真正的 Agentic Coding。
4. Copilot Chat
进一步变成:
你:解释这个 Spring Boot Controller
Copilot:
1. 找到 Controller
2. 阅读代码
3. 分析调用关系
4. 解释代码
例如:
Explain how authentication works in this project.
Copilot 可以搜索:
Controller
↓
Service
↓
AuthenticationService
↓
JWT
↓
SecurityConfig
然后形成解释。
这里已经出现了一个重要概念:
Context Engineering
Copilot 并不是简单把你的问题发送给 LLM。
它需要构造:
System Prompt
+
User Prompt
+
Repository Context
+
Relevant Files
+
Git Context
+
Instructions
+
Tool Information
然后发送给模型。
5. Agent Mode ------ Agentic Coding 的核心
这是你真正应该重点学习的部分。
GitHub 官方对 IDE Agent Mode 的描述是:Agent 可以自主判断需要修改哪些文件、提出并执行终端命令,并持续迭代直到任务完成。(GitHub Docs)
例如你给它:
Add Redis caching to UserService.
传统 AI:
告诉你应该怎么写
Agent:
1. 找 UserService
2. 找 Redis 配置
3. 找现有 Cache 使用方式
4. 分析 pom.xml
5. 修改 Service
6. 修改配置
7. 创建测试
8. 执行测试
9. 根据错误修复
10. 再执行测试
也就是:
Goal
↓
Observe
↓
Reason
↓
Plan
↓
Act
↓
Observe
↓
Reason
↓
Act
↓
Verify
这就是经典的:
Agent Loop
6. Agent Loop 原理
可以抽象成:
┌───────────────┐
│ Task │
└───────┬───────┘
↓
┌───────────────┐
│ Planning │
└───────┬───────┘
↓
┌───────────────┐
│ Tools │
│ │
│ read_file │
│ search │
│ edit_file │
│ terminal │
│ git │
└───────┬───────┘
↓
┌───────────────┐
│ Execute │
└───────┬───────┘
↓
┌───────────────┐
│ Observe │
└───────┬───────┘
↓
Success?
/ \
No Yes
↓ ↓
Fix Complete
│
└──────→ Loop
这实际上就是现代 Coding Agent 的基本架构。
7. Copilot 使用哪些 Tools?
Agent 最关键的变化就是:
LLM 不再只是"回答问题",而是可以调用工具。
典型工具包括:
File Search
File Read
File Edit
Terminal
Git
GitHub
MCP
Browser / External APIs
例如:
Agent
│
├── search_code()
│
├── read_file()
│
├── edit_file()
│
├── run_terminal()
│
├── run_tests()
│
├── git_diff()
│
└── github_api()
所以:
LLM
+
Tools
+
Loop
=
Agent
这是理解 Agentic Coding 最重要的一条公式。
8. MCP 是 Copilot Agent 的重要扩展机制
GitHub Copilot 支持 MCP(Model Context Protocol),可以把外部系统能力接入 Copilot。(GitHub Docs)
例如:
Copilot
│
├── GitHub MCP
├── Jira MCP
├── Database MCP
├── Kubernetes MCP
├── AWS MCP
├── GCP MCP
└── Custom MCP
于是你可以让 Agent:
读取 Jira Issue
↓
分析 GitHub Repository
↓
修改代码
↓
执行测试
↓
查询数据库
↓
创建 PR
这就是从:
AI Coding
进化到:
AI Software Engineering
9. Copilot Cloud Agent
这个功能和 IDE Agent 有一个非常重要的区别。
IDE Agent:
你的电脑
↓
Copilot
↓
修改本地代码
Cloud Agent:
GitHub Issue
↓
Copilot Cloud Agent
↓
创建独立环境
↓
分析 Repository
↓
修改代码
↓
运行测试
↓
创建 Branch
↓
创建 Pull Request
↓
Human Review
GitHub 官方说明 Cloud Agent 是运行在 GitHub Actions 驱动环境中的异步 Agent,可以研究 repository、制定计划、修改代码并创建 PR。(GitHub Docs)
这个模型非常接近:
Jira
↓
Issue
↓
AI Agent
↓
Implementation
↓
Test
↓
PR
↓
Human Review
↓
Merge
这正是你之前研究的 AI Software Factory 的核心流程。
10. Copilot CLI
这是我非常建议你重点学习的。
GitHub Copilot CLI 可以直接在 Terminal 中作为 Agent 工作,可以回答问题、写代码、debug、操作 GitHub。(GitHub Docs)
安装方式目前官方提供:
curl -fsSL https://gh.io/copilot-install | bash
然后:
copilot
进入:
GitHub Copilot CLI
官方文档也特别提醒:CLI session 可以读取、修改甚至执行工作目录下的文件,因此应该只在你信任的目录中运行。(GitHub Docs)
11. Copilot CLI 常用工作方式
进入项目:
cd my-project
启动:
copilot
然后:
Explain this project.
或者:
Find how authentication works.
或者:
Fix the failing tests.
或者:
Add Redis caching to UserService.
12. /plan
这是非常重要的 Agentic Coding 命令。
例如:
/plan Add Redis caching to UserService
Copilot 会先制定计划,而不是立即修改代码。
典型过程:
Analyze repository
↓
Find UserService
↓
Find Redis configuration
↓
Analyze existing cache pattern
↓
Design changes
↓
Generate implementation plan
官方推荐复杂任务采用:
Explore
↓
Plan
↓
Review
↓
Implement
↓
Test
↓
Commit
并且可以通过 /plan 或快捷键 Shift+Tab 进入 Plan Mode。(GitHub Docs)
13. /context
查看当前 Agent Context:
/context
它可以帮助你理解:
System tokens
Conversation
Tools
Context usage
Remaining capacity
对于学习 Agentic Coding 非常重要。
因为 Agent 的一个核心问题就是:
Context Engineering
14. /clear
清理当前上下文:
/clear
适合:
Task A 完成
↓
/clear
↓
Task B
官方也建议不同任务之间使用 /clear 或 /new,避免无关上下文影响后续任务。(GitHub Docs)
15. /new
创建新的 session:
/new
例如:
/new
Analyze database migration architecture.
16. /session
查看当前 session 信息:
/session
例如:
/session files
查看 Agent 当前产生的临时文件。
还可以:
/session plan
查看当前 Plan。(GitHub Docs)
17. /pr
Copilot CLI 可以直接管理 Pull Request:
/pr
官方文档目前支持使用 /pr 查看、创建和修复 Pull Request。(GitHub Docs)
例如:
/pr create
或者让 Copilot:
Review this PR and fix the issues.
这就开始进入:
Coding Agent
+
Git Agent
+
Code Review Agent
18. /fleet
这是比较有意思的 Agentic 能力。
/fleet
用于把复杂任务拆分给多个并行 Agent。
例如:
/fleet
Implement the following modernization:
1. migrate JUnit4 → JUnit5
2. upgrade Spring Boot
3. update deprecated APIs
4. improve test coverage
可以理解为:
Master Agent
│
┌────────────┼────────────┐
↓ ↓ ↓
Agent A Agent B Agent C
JUnit Spring APIs
│ │ │
└────────────┼────────────┘
↓
Results
GitHub 当前 CLI 文档已经提供 /fleet 用于并行化多步骤实现任务。(GitHub Docs)
19. /delegate
这是另一个非常重要的命令。
/delegate
把任务交给 Cloud Agent。
例如:
/delegate Add dark mode support to the settings page
Agent 在云端工作,你可以继续做自己的事情。
完成以后:
Cloud Agent
↓
Code
↓
Branch
↓
PR
官方推荐 /delegate 用于异步、独立或者耗时较长的任务。(GitHub Docs)
20. Code Review
Copilot 不只是写代码,也可以做:
Code Review
例如:
Review my current changes for:
- bugs
- security issues
- performance problems
- missing tests
CLI 也提供专门的 code review 工作流。(GitHub Docs)
21. Custom Instructions
这是企业级 Agent 非常重要的一层。
例如:
.github/
copilot-instructions.md
可以写:
# Project Coding Rules
- Java 21
- Spring Boot 3
- Use constructor injection
- Never use field injection
- All public APIs require tests
- Use JUnit 5
- Use Mockito
- Follow Google Java Style
- Do not modify database schema without migration scripts
Copilot 在工作时可以自动读取这些规则。GitHub 官方支持 repository-level instructions,也支持 path-specific instruction files。(GitHub Docs)
这和你之前研究的:
AGENTS.md
copilot-instructions.md
是同一个方向。
22. Agent Skills
更进一步:
Instructions
只是告诉 Agent:
怎么工作。
而:
Skill
可以提供:
知识 + Instructions + Scripts + Resources
例如:
skills/
oracle-migration/
SKILL.md
scripts/
templates/
examples/
Agent 遇到:
Oracle → PostgreSQL
自动加载这个 Skill。
GitHub 官方现在把 Agent Skills 定义为可以由 Agent 按需加载的 instructions、scripts 和 resources 集合,并支持 Copilot CLI、Cloud Agent、VS Code/JetBrains Agent Mode 等。(GitHub Docs)
23. Custom Agents
这是我认为你特别值得研究的东西。
可以创建:
Architect Agent
Developer Agent
Tester Agent
Security Agent
Migration Agent
Code Review Agent
例如:
.github/
agents/
architect.agent.md
developer.agent.md
tester.agent.md
security.agent.md
每个 Agent 有自己的:
Role
Instructions
Tools
Skills
Context
GitHub 官方将 Custom Agent 定义为针对特定工作流、编码规范和团队实践定制的 Agent。(GitHub Docs)
24. 从架构上理解 Copilot
如果我们把 Copilot 拆开:
GitHub Copilot
│
┌───────────────┼───────────────┐
↓ ↓ ↓
Context Model Tools
│ │ │
Repository LLM File
Git │ Terminal
Instructions │ Git
History │ GitHub
Skills │ MCP
│ │ │
└───────────────┼───────────────┘
↓
Agent Loop
│
┌───────────┴───────────┐
↓ ↓
Planning Execution
│ │
└───────────┬───────────┘
↓
Verify
↓
PR / Commit
这实际上就是现代 Coding Agent 的基本架构。
25. Copilot 和普通 LLM Coding 最大区别
这是最值得理解的地方。
普通 ChatGPT
Prompt
↓
LLM
↓
Answer
AI Coding Assistant
Prompt
↓
LLM
↓
Code
Coding Agent
Goal
↓
Context
↓
Reason
↓
Plan
↓
Tool Call
↓
Execute
↓
Observe
↓
Reason
↓
Fix
↓
Test
↓
Complete
Software Engineering Agent
再进一步:
Business Requirement
↓
Jira Issue
↓
Product Agent
↓
Architect Agent
↓
Developer Agent
↓
Test Agent
↓
Security Agent
↓
Review Agent
↓
GitHub PR
↓
Human
↓
Merge
↓
CI/CD
这就是你之前研究的:
AI Software Factory
26. Copilot 的完整研发闭环
我建议你把它理解成下面这张图:
┌──────────────┐
│ Jira / Issue │
└──────┬───────┘
↓
┌───────────────┐
│ Copilot Agent │
└──────┬────────┘
↓
Explore
↓
Plan
↓
┌────────────┐
│ Repository │
└─────┬──────┘
↓
Implement
↓
Unit Test
↓
Integration
↓
Review
↓
PR
↓
┌──────────────┐
│ Human Review │
└──────┬───────┘
↓
Merge
↓
CI/CD
↓
Production
27. 一个真实项目应该怎么使用?
比如你有一个 Spring Boot 项目。
不要直接:
帮我实现订单系统
推荐:
Step 1:Explore
Analyze this repository.
Do not modify anything.
Explain:
1. architecture
2. modules
3. database layer
4. API layer
5. testing strategy
6. deployment architecture
Step 2:Plan
/plan
Implement order cancellation.
Step 3:Review Plan
你检查:
是否修改正确模块?
是否破坏架构?
是否需要 DB migration?
是否需要 API changes?
是否需要 tests?
Step 4:Implement
Implement the approved plan.
Step 5:Test
Run all relevant tests.
If tests fail:
1. analyze failure
2. identify root cause
3. fix the issue
4. rerun tests
Step 6:Review
Review all changes.
Check:
- correctness
- security
- performance
- code style
- test coverage
- backward compatibility
Step 7:Git
Show git diff.
然后:
Create a commit with a meaningful message.
28. 你应该建立这样的项目结构
如果你准备真正使用 Copilot 做 Agentic Coding,我建议:
my-project/
│
├── .github/
│ ├── copilot-instructions.md
│ │
│ ├── instructions/
│ │ ├── java.instructions.md
│ │ ├── testing.instructions.md
│ │ └── database.instructions.md
│ │
│ ├── agents/
│ │ ├── architect.agent.md
│ │ ├── developer.agent.md
│ │ ├── tester.agent.md
│ │ └── reviewer.agent.md
│ │
│ └── skills/
│ ├── java-development/
│ ├── database-migration/
│ ├── testing/
│ └── security/
│
├── src/
├── tests/
├── pom.xml
├── README.md
└── AGENTS.md
这样 Copilot 才真正从:
AI Assistant
升级成:
AI Engineering Agent
29. Copilot CLI 最值得记住的命令
给你一个实用 Cheat Sheet:
copilot
启动 CLI。
/plan
制定实现计划。
/context
查看上下文。
/session
查看 session。
/session plan
查看当前计划。
/session files
查看临时文件。
/clear
清理当前上下文。
/new
创建新 session。
/pr
管理 Pull Request。
/fleet
并行 Agent。
/delegate
交给 Cloud Agent 异步执行。
这些能力和当前 GitHub Copilot CLI 官方工作流基本一致。(GitHub Docs)
30. 我建议你的学习路线
结合你前面一直在研究的 OpenCode + OpenClaw + Harness + AI Software Factory,我不建议你把 Copilot 当成单纯的 IDE 插件学习。
建议按这个路线:
Agentic Coding
│
┌───────────┴───────────┐
↓ ↓
Coding Assistant Coding Agent
│ │
Completion Agent Loop
Chat Planning
Edit Tools
Context
Memory
Verification
│
↓
Software Agent
│
┌────────────────┼────────────────┐
↓ ↓ ↓
Skills MCP Custom Agent
│ │ │
└────────────────┼────────────────┘
↓
AI Software Factory
│
┌────────────────┼────────────────┐
↓ ↓ ↓
Product Developer Tester
Agent Agent Agent
│ │ │
└────────────────┼────────────────┘
↓
PR
↓
Human
↓
CI/CD
尤其建议重点掌握这 8 个关键词:
Context Engineering → Agent Loop → Tool Calling → MCP → Skills → Custom Agents → Cloud Agent → Human-in-the-loop
这 8 个概念,比单纯记 Copilot 的快捷键重要得多。
另外,GitHub 目前已经支持在 Copilot 体系中使用包括 OpenAI Codex 等第三方 Coding Agent,这说明 Copilot 正逐渐从"某一个模型驱动的编程助手"向"Agent orchestration / software development platform "发展。(GitHub Docs)
如果你的目标是继续研究 AI Software Factory,我建议下一步直接做一个完整的对比:GitHub Copilot vs Cursor vs Claude Code vs OpenCode vs Codex vs OpenClaw,重点从 Agent Loop、Context、Skills、MCP、Sub-Agent、Memory、Git/Jira、CI/CD、企业落地几个维度拆架构。 这会比单独学习某一个工具更有价值。