copilot-spaces

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Copilot 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 工具(只读)

ToolPurpose
mcp__github__list_copilot_spaces
List all spaces accessible to the current user
mcp__github__get_copilot_space
Load a space's full context by owner and name
工具用途
mcp__github__list_copilot_spaces
列出当前用户可访问的所有空间
mcp__github__get_copilot_space
按所有者和名称加载空间的完整上下文

REST API via
gh api
(Full CRUD)

通过
gh api
调用的REST API(完整CRUD操作)

The Spaces REST API supports creating, updating, deleting spaces, and managing collaborators. The MCP server only exposes read operations, so use
gh api
for writes.
User Spaces:
MethodEndpointPurpose
POST
/users/{username}/copilot-spaces
Create a space
GET
/users/{username}/copilot-spaces
List spaces
GET
/users/{username}/copilot-spaces/{number}
Get a space
PUT
/users/{username}/copilot-spaces/{number}
Update a space
DELETE
/users/{username}/copilot-spaces/{number}
Delete a space
Organization Spaces: Same pattern under
/orgs/{org}/copilot-spaces/...
Collaborators: Add, list, update, and remove collaborators at
.../collaborators
Scope requirements: PAT needs
read:user
for reads,
user
for writes. Add with
gh auth refresh -h github.com -s user
.
Note: This API is functional but not yet in the public REST API docs. It may require the
copilot_spaces_api
feature flag.
Spaces REST API支持创建、更新、删除空间以及管理协作者。MCP服务器仅开放读取操作,因此请使用
gh api
执行写入操作。
用户空间:
请求方法接口地址用途
POST
/users/{username}/copilot-spaces
创建一个空间
GET
/users/{username}/copilot-spaces
列出空间
GET
/users/{username}/copilot-spaces/{number}
获取单个空间
PUT
/users/{username}/copilot-spaces/{number}
更新空间
DELETE
/users/{username}/copilot-spaces/{number}
删除空间
组织空间: 模式与用户空间一致,路径为
/orgs/{org}/copilot-spaces/...
协作者管理:
.../collaborators
路径下执行添加、列出、更新和移除协作者的操作
权限要求: 执行读取操作需要PAT具备
read:user
权限,执行写入操作需要
user
权限。可通过
gh auth refresh -h github.com -s user
添加权限。
注意: 此API已可用,但尚未纳入公开的REST API文档。它可能需要启用
copilot_spaces_api
功能标志。

When 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_spaces
This returns all spaces the user can access, each with a
name
and
owner_login
. Present relevant matches to the user.
To filter for a specific user's spaces, match
owner_login
against the username (e.g., "show me my spaces").
当用户询问有哪些可用空间,或者你需要找到合适的空间时:
Call mcp__github__list_copilot_spaces
该调用会返回用户可访问的所有空间,每个空间包含
name
owner_login
字段。向用户展示相关的匹配结果。
要筛选特定用户的空间,可将
owner_login
与用户名进行匹配(例如,“展示我的空间”)。

2. 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
    issue_read
    to get the latest comments.
  • A space links to a project board. Use project tools to check current status.
  • A space mentions a repo's masterplan. Use
    get_file_contents
    to read it.
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
)

5. 管理空间(通过
gh api

When a user wants to create, update, or delete a space, use
gh api
. First, find the space number from the list endpoint.
Update 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 DELETE
Updatable fields:
name
,
description
,
general_instructions
,
icon_type
,
icon_color
,
visibility
("private"/"public"),
base_role
("no_access"/"reader"),
resources_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
可更新字段:
name
description
general_instructions
icon_type
icon_color
visibility
("private"/"public")、
base_role
("no_access"/"reader")、
resources_attributes

Examples

示例

Example 1: User Asks for a Space

示例1:用户请求加载某个空间

User: "Load the Accessibility copilot space"
Action:
  1. Call
    mcp__github__get_copilot_space
    with owner
    "github"
    , name
    "Accessibility"
  2. Use the returned context to answer questions about accessibility standards, MAS grades, compliance processes, etc.
用户:"Load the Accessibility copilot space"
操作
  1. 使用所有者
    "github"
    、名称
    "Accessibility"
    调用
    mcp__github__get_copilot_space
  2. 使用返回的上下文回答关于无障碍标准、MAS等级、合规流程等问题。

Example 2: User Wants to Find Spaces

示例2:用户想要查找可用空间

User: "What copilot spaces are available for our team?"
Action:
  1. Call
    mcp__github__list_copilot_spaces
  2. Filter/present spaces relevant to the user's org or interests
  3. Offer to load any space they're interested in
用户:"What copilot spaces are available for our team?"
操作
  1. 调用
    mcp__github__list_copilot_spaces
  2. 筛选并展示与用户所在组织或兴趣相关的空间
  3. 主动提出加载用户感兴趣的任意空间

Example 3: Context-Grounded Question

示例3:基于上下文的问题

User: "Using the security space, what's our policy on secret scanning?"
Action:
  1. Call
    mcp__github__get_copilot_space
    with the appropriate owner and name
  2. Find the relevant policy in the space content
  3. Answer based on the actual internal documentation
用户:"Using the security space, what's our policy on secret scanning?"
操作
  1. 使用对应的所有者和名称调用
    mcp__github__get_copilot_space
  2. 在空间内容中找到相关的政策
  3. 基于实际的内部文档进行回答

Example 4: Space as a Workflow Engine

示例4:将Space作为工作流引擎使用

User: "Write my weekly update using the PM Weekly Updates space"
Action:
  1. Call
    mcp__github__get_copilot_space
    to load the space. It contains a template format and step-by-step instructions.
  2. Follow the space's workflow: pull data from attached initiative issues, gather metrics, draft each section.
  3. Fetch external resources referenced by the space (tracking issues, dashboards) using other MCP tools.
  4. Show the draft after each section so the user can review and fill in gaps.
  5. Produce the final output in the format the space defines.
用户:"Write my weekly update using the PM Weekly Updates space"
操作
  1. 调用
    mcp__github__get_copilot_space
    加载该空间,它包含模板格式和分步指令。
  2. 遵循空间中的工作流:从关联的计划议题中提取数据、收集指标、起草每个部分。
  3. 使用其他MCP工具获取空间引用的外部资源(追踪议题、仪表板)。
  4. 完成每个部分后展示草稿,以便用户审阅并补充信息。
  5. 按照空间定义的格式生成最终输出。

Example 5: Update Space Instructions Programmatically

示例5:以编程方式更新空间指令

User: "Update my PM Weekly Updates space to include a new writing guideline"
Action:
  1. Call
    mcp__github__list_copilot_spaces
    and find the space number (e.g., 19).
  2. Call
    mcp__github__get_copilot_space
    to read current instructions.
  3. Modify the instructions text as requested.
  4. 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"
操作
  1. 调用
    mcp__github__list_copilot_spaces
    并找到空间编号(例如19)。
  2. 调用
    mcp__github__get_copilot_space
    读取当前指令。
  3. 根据用户请求修改指令文本。
  4. 推送更新:
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
    owner
    and
    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 (
    gh api
    for create/update/delete) require the
    user
    PAT scope. If you get a 404 on write operations, run
    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
    { "id": 123, "_destroy": true }
    in the array.
  • 空间名称区分大小写。请使用
    list_copilot_spaces
    返回的准确名称。
  • 空间可由用户或组织拥有。请始终同时提供
    owner
    name
    参数。
  • 空间内容可能很大(超过20KB)。如果返回为临时文件,请使用grep或view_range查找相关部分,而不是一次性读取全部内容。
  • 如果未找到空间,建议列出可用空间以找到正确的名称。
  • 空间会随底层仓库的变化自动更新,因此上下文始终是最新的。
  • 某些空间包含自定义指令,这些指令应指导你的行为(编码标准、首选模式、工作流)。请将这些视为指令,而非建议。
  • 写入操作(使用
    gh api
    执行创建/更新/删除)需要
    user
    PAT权限。如果写入操作返回404错误,请运行
    gh auth refresh -h github.com -s user
  • 资源更新会替换整个数组。要添加资源,请包含所有现有资源和新资源。要删除资源,请在数组中包含
    { "id": 123, "_destroy": true }