copilot-spaces
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCopilot Spaces
Copilot Spaces
Use Copilot Spaces to bring curated, project-specific context into conversations. A Space is a shared collection of repositories, files, documentation, and instructions that grounds Copilot responses in your team's actual code and knowledge.
使用Copilot Spaces将经过精选的、特定于项目的上下文引入对话中。Space是一个包含仓库、文件、文档和指令的共享集合,能让Copilot的回复基于团队的实际代码和知识库。
Available Tools
可用工具
MCP Tools (Read-only)
MCP 工具(只读)
| Tool | Purpose |
|---|---|
| List all spaces accessible to the current user |
| Load a space's full context by owner and name |
| 工具 | 用途 |
|---|---|
| 列出当前用户可访问的所有空间 |
| 按所有者和名称加载空间的完整上下文 |
REST API via gh api
(Full CRUD)
gh api通过gh api
调用的REST API(完整CRUD操作)
gh apiThe Spaces REST API supports creating, updating, deleting spaces, and managing collaborators. The MCP server only exposes read operations, so use for writes.
gh apiUser Spaces:
| Method | Endpoint | Purpose |
|---|---|---|
| | Create a space |
| | List spaces |
| | Get a space |
| | Update a space |
| | Delete a space |
Organization Spaces: Same pattern under
/orgs/{org}/copilot-spaces/...Collaborators: Add, list, update, and remove collaborators at
.../collaboratorsScope requirements: PAT needs for reads, for writes. Add with .
read:userusergh auth refresh -h github.com -s userNote: This API is functional but not yet in the public REST API docs. It may require the feature flag.
copilot_spaces_apiSpaces REST API支持创建、更新、删除空间以及管理协作者。MCP服务器仅开放读取操作,因此请使用执行写入操作。
gh api用户空间:
| 请求方法 | 接口地址 | 用途 |
|---|---|---|
| | 创建一个空间 |
| | 列出空间 |
| | 获取单个空间 |
| | 更新空间 |
| | 删除空间 |
组织空间: 模式与用户空间一致,路径为
/orgs/{org}/copilot-spaces/...协作者管理: 在路径下执行添加、列出、更新和移除协作者的操作
.../collaborators权限要求: 执行读取操作需要PAT具备权限,执行写入操作需要权限。可通过添加权限。
read:userusergh auth refresh -h github.com -s user注意: 此API已可用,但尚未纳入公开的REST API文档。它可能需要启用功能标志。
copilot_spaces_apiWhen to Use Spaces
何时使用Spaces
- User mentions "Copilot space" or asks to "load a space"
- User wants answers grounded in specific project docs, code, or standards
- User asks "what spaces are available?" or "find a space for X"
- User needs onboarding context, architecture docs, or team-specific guidance
- User wants to follow a structured workflow defined in a Space (templates, checklists, multi-step processes)
- 用户提及“Copilot space”或要求“加载一个空间”
- 用户希望基于特定项目文档、代码或标准获取答案
- 用户询问“有哪些可用的空间?”或“为X找到对应的空间”
- 用户需要入职上下文、架构文档或团队特定指南
- 用户希望遵循Space中定义的结构化工作流(模板、检查清单、多步骤流程)
Workflow
工作流程
1. Discover Spaces
1. 发现空间
When a user asks what spaces are available or you need to find the right space:
Call mcp__github__list_copilot_spacesThis returns all spaces the user can access, each with a and . Present relevant matches to the user.
nameowner_loginTo filter for a specific user's spaces, match against the username (e.g., "show me my spaces").
owner_login当用户询问有哪些可用空间,或者你需要找到合适的空间时:
Call mcp__github__list_copilot_spaces该调用会返回用户可访问的所有空间,每个空间包含和字段。向用户展示相关的匹配结果。
nameowner_login要筛选特定用户的空间,可将与用户名进行匹配(例如,“展示我的空间”)。
owner_login2. Load a Space
2. 加载空间
When a user names a specific space or you've identified the right one:
Call mcp__github__get_copilot_space with:
owner: "org-or-user" (the owner_login from the list)
name: "Space Name" (exact space name, case-sensitive)This returns the space's full content: attached documentation, code context, custom instructions, and any other curated materials. Use this context to inform your responses.
当用户指定某个空间,或者你已经确定了合适的空间时:
Call mcp__github__get_copilot_space with:
owner: "org-or-user" (列表返回的owner_login)
name: "Space Name" (精确的空间名称,区分大小写)该调用会返回空间的完整内容:附带的文档、代码上下文、自定义指令以及其他精选材料。使用此上下文来辅助你的回复。
3. Follow the Breadcrumbs
3. 追踪关联资源
Space content often references external resources: GitHub issues, dashboards, repos, discussions, or other tools. Proactively fetch these using other MCP tools to gather complete context. For example:
- A space references an initiative tracking issue. Use to get the latest comments.
issue_read - A space links to a project board. Use project tools to check current status.
- A space mentions a repo's masterplan. Use to read it.
get_file_contents
Space内容通常会引用外部资源:GitHub议题、仪表板、仓库、讨论或其他工具。主动使用其他MCP工具获取这些资源,以收集完整的上下文。例如:
- 某个空间引用了一个用于追踪计划的议题。使用获取最新评论。
issue_read - 某个空间链接到一个项目看板。使用项目工具检查当前状态。
- 某个空间提到了仓库的总体规划。使用读取该内容。
get_file_contents
4. Answer or Execute
4. 回复或执行
Once loaded, use the space content based on what it contains:
If the space contains reference material (docs, code, standards):
- Answer questions about the project's architecture, patterns, or standards
- Generate code that follows the team's conventions
- Debug issues using project-specific knowledge
If the space contains workflow instructions (templates, step-by-step processes):
- Follow the workflow as defined, step by step
- Gather data from the sources the workflow specifies
- Produce output in the format the workflow defines
- Show progress after each step so the user can steer
加载完成后,根据Space包含的内容来使用它:
如果Space包含参考资料(文档、代码、标准):
- 回答关于项目架构、模式或标准的问题
- 生成符合团队规范的代码
- 使用项目特定知识调试问题
如果Space包含工作流指令(模板、分步流程):
- 按照定义的工作流逐步执行
- 从工作流指定的来源收集数据
- 按照工作流定义的格式生成输出
- 完成每个步骤后展示进度,以便用户进行指导
5. Manage Spaces (via gh api
)
gh api5. 管理空间(通过gh api
)
gh apiWhen a user wants to create, update, or delete a space, use . First, find the space number from the list endpoint.
gh apiUpdate a space's instructions:
bash
gh api users/{username}/copilot-spaces/{number} \
-X PUT \
-f general_instructions="New instructions here"Update name, description, or instructions together:
bash
gh api users/{username}/copilot-spaces/{number} \
-X PUT \
-f name="Updated Name" \
-f description="Updated description" \
-f general_instructions="Updated instructions"Create a new space:
bash
gh api users/{username}/copilot-spaces \
-X POST \
-f name="My New Space" \
-f general_instructions="Help me with..." \
-f visibility="private"Attach resources (replaces entire resource list):
json
{
"resources_attributes": [
{ "resource_type": "free_text", "metadata": { "name": "Notes", "text": "Content here" } },
{ "resource_type": "github_issue", "metadata": { "repository_id": 12345, "number": 42 } },
{ "resource_type": "github_file", "metadata": { "repository_id": 12345, "file_path": "docs/guide.md" } }
]
}Delete a space:
bash
gh api users/{username}/copilot-spaces/{number} -X DELETEUpdatable fields: , , , , , ("private"/"public"), ("no_access"/"reader"),
namedescriptiongeneral_instructionsicon_typeicon_colorvisibilitybase_roleresources_attributes当用户想要创建、更新或删除空间时,使用。首先从列表接口获取空间编号。
gh api更新空间的指令:
bash
gh api users/{username}/copilot-spaces/{number} \
-X PUT \
-f general_instructions="New instructions here"同时更新名称、描述或指令:
bash
gh api users/{username}/copilot-spaces/{number} \
-X PUT \
-f name="Updated Name" \
-f description="Updated description" \
-f general_instructions="Updated instructions"创建新空间:
bash
gh api users/{username}/copilot-spaces \
-X POST \
-f name="My New Space" \
-f general_instructions="Help me with..." \
-f visibility="private"关联资源(替换整个资源列表):
json
{
"resources_attributes": [
{ "resource_type": "free_text", "metadata": { "name": "Notes", "text": "Content here" } },
{ "resource_type": "github_issue", "metadata": { "repository_id": 12345, "number": 42 } },
{ "resource_type": "github_file", "metadata": { "repository_id": 12345, "file_path": "docs/guide.md" } }
]
}删除空间:
bash
gh api users/{username}/copilot-spaces/{number} -X DELETE可更新字段: 、、、、、("private"/"public")、("no_access"/"reader")、
namedescriptiongeneral_instructionsicon_typeicon_colorvisibilitybase_roleresources_attributesExamples
示例
Example 1: User Asks for a Space
示例1:用户请求加载某个空间
User: "Load the Accessibility copilot space"
Action:
- Call with owner
mcp__github__get_copilot_space, name"github""Accessibility" - Use the returned context to answer questions about accessibility standards, MAS grades, compliance processes, etc.
用户:"Load the Accessibility copilot space"
操作:
- 使用所有者、名称
"github"调用"Accessibility"mcp__github__get_copilot_space - 使用返回的上下文回答关于无障碍标准、MAS等级、合规流程等问题。
Example 2: User Wants to Find Spaces
示例2:用户想要查找可用空间
User: "What copilot spaces are available for our team?"
Action:
- Call
mcp__github__list_copilot_spaces - Filter/present spaces relevant to the user's org or interests
- Offer to load any space they're interested in
用户:"What copilot spaces are available for our team?"
操作:
- 调用
mcp__github__list_copilot_spaces - 筛选并展示与用户所在组织或兴趣相关的空间
- 主动提出加载用户感兴趣的任意空间
Example 3: Context-Grounded Question
示例3:基于上下文的问题
User: "Using the security space, what's our policy on secret scanning?"
Action:
- Call with the appropriate owner and name
mcp__github__get_copilot_space - Find the relevant policy in the space content
- Answer based on the actual internal documentation
用户:"Using the security space, what's our policy on secret scanning?"
操作:
- 使用对应的所有者和名称调用
mcp__github__get_copilot_space - 在空间内容中找到相关的政策
- 基于实际的内部文档进行回答
Example 4: Space as a Workflow Engine
示例4:将Space作为工作流引擎使用
User: "Write my weekly update using the PM Weekly Updates space"
Action:
- Call to load the space. It contains a template format and step-by-step instructions.
mcp__github__get_copilot_space - Follow the space's workflow: pull data from attached initiative issues, gather metrics, draft each section.
- Fetch external resources referenced by the space (tracking issues, dashboards) using other MCP tools.
- Show the draft after each section so the user can review and fill in gaps.
- Produce the final output in the format the space defines.
用户:"Write my weekly update using the PM Weekly Updates space"
操作:
- 调用加载该空间,它包含模板格式和分步指令。
mcp__github__get_copilot_space - 遵循空间中的工作流:从关联的计划议题中提取数据、收集指标、起草每个部分。
- 使用其他MCP工具获取空间引用的外部资源(追踪议题、仪表板)。
- 完成每个部分后展示草稿,以便用户审阅并补充信息。
- 按照空间定义的格式生成最终输出。
Example 5: Update Space Instructions Programmatically
示例5:以编程方式更新空间指令
User: "Update my PM Weekly Updates space to include a new writing guideline"
Action:
- Call and find the space number (e.g., 19).
mcp__github__list_copilot_spaces - Call to read current instructions.
mcp__github__get_copilot_space - Modify the instructions text as requested.
- Push the update:
bash
gh api users/labudis/copilot-spaces/19 -X PUT -f general_instructions="updated instructions..."用户:"Update my PM Weekly Updates space to include a new writing guideline"
操作:
- 调用并找到空间编号(例如19)。
mcp__github__list_copilot_spaces - 调用读取当前指令。
mcp__github__get_copilot_space - 根据用户请求修改指令文本。
- 推送更新:
bash
gh api users/labudis/copilot-spaces/19 -X PUT -f general_instructions="updated instructions..."Tips
提示
- Space names are case-sensitive. Use the exact name from .
list_copilot_spaces - Spaces can be owned by users or organizations. Always provide both and
owner.name - Space content can be large (20KB+). If returned as a temp file, use grep or view_range to find relevant sections rather than reading everything at once.
- If a space isn't found, suggest listing available spaces to find the right name.
- Spaces auto-update as underlying repos change, so the context is always current.
- Some spaces contain custom instructions that should guide your behavior (coding standards, preferred patterns, workflows). Treat these as directives, not suggestions.
- Write operations (for create/update/delete) require the
gh apiPAT scope. If you get a 404 on write operations, runuser.gh auth refresh -h github.com -s user - Resource updates replace the entire array. To add a resource, include all existing resources plus the new one. To remove one, include in the array.
{ "id": 123, "_destroy": true }
- 空间名称区分大小写。请使用返回的准确名称。
list_copilot_spaces - 空间可由用户或组织拥有。请始终同时提供和
owner参数。name - 空间内容可能很大(超过20KB)。如果返回为临时文件,请使用grep或view_range查找相关部分,而不是一次性读取全部内容。
- 如果未找到空间,建议列出可用空间以找到正确的名称。
- 空间会随底层仓库的变化自动更新,因此上下文始终是最新的。
- 某些空间包含自定义指令,这些指令应指导你的行为(编码标准、首选模式、工作流)。请将这些视为指令,而非建议。
- 写入操作(使用执行创建/更新/删除)需要
gh apiPAT权限。如果写入操作返回404错误,请运行user。gh auth refresh -h github.com -s user - 资源更新会替换整个数组。要添加资源,请包含所有现有资源和新资源。要删除资源,请在数组中包含。
{ "id": 123, "_destroy": true }