Skip to content

Commit c97e337

Browse files
hubwriterCopilotCopilot
authored
Copilot CLI: Document the /research slash command (#59879)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9b17746 commit c97e337

File tree

10 files changed

+185
-13
lines changed

10 files changed

+185
-13
lines changed

content/copilot/concepts/agents/copilot-cli/about-cli-plugins.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ Any functionality that you could add with a plugin, you could also add by config
7272

7373
* [AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/plugins-creating)
7474
* [AUTOTITLE](/copilot/reference/cli-plugin-reference)
75+
* [AUTOTITLE](/copilot/how-tos/copilot-cli)

content/copilot/concepts/agents/copilot-cli/autopilot.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,4 @@ Use autopilot mode when you want {% data variables.product.prodname_copilot_shor
110110

111111
* [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli#get-copilot-to-work-autonomously)
112112
* [AUTOTITLE](/copilot/concepts/agents/copilot-cli/fleet)
113+
* [AUTOTITLE](/copilot/how-tos/copilot-cli)

content/copilot/concepts/agents/copilot-cli/comparing-cli-features.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ Subagents help {% data variables.product.prodname_copilot_short %}:
313313

314314
### What is a custom agent?
315315

316-
**Custom agents** are a way that you can provide {% data variables.product.prodname_copilot_short %} with specialist knowledge about a particular subject, and define a particular approach that you want {% data variables.product.prodname_copilot_short %} to use when working in that area. You can think of a custom agent as a "persona" that {% data variables.product.prodname_copilot_short %} can adopt when working on certain tasks.
316+
**Custom agents** provide {% data variables.product.prodname_copilot_short %} with specialist knowledge about a particular subject, and define a particular approach that {% data variables.product.prodname_copilot_short %} should use when working in that area. You can think of a custom agent as a "persona" that {% data variables.product.prodname_copilot_short %} can adopt when working on certain tasks.
317+
318+
{% data variables.copilot.copilot_cli_short %} has several built-in custom agents. For example, the `explore`, `task`, `research`, `code-review`, and `general-purpose` agents. You can also define your own custom agents, to meet your specific needs.
317319

318320
You define a custom agent in a Markdown file with YAML frontmatter. The file contains:
319321

@@ -408,3 +410,7 @@ Avoid plugins when:
408410
| When working on particular tasks, I want {% data variables.product.prodname_copilot_short %} to operate as a specialist with a constrained toolset. | **Custom agent** |
409411
| I want {% data variables.product.prodname_copilot_short %} to carry out a complex task on my behalf. | {% data variables.product.prodname_copilot_short %} automatically uses **subagents** when appropriate. |
410412
| I want to add a package of functionality to {% data variables.copilot.copilot_cli_short %} without configuring it manually myself. | **Plugin** |
413+
414+
## Further reading
415+
416+
* [AUTOTITLE](/copilot/how-tos/copilot-cli)

content/copilot/concepts/agents/copilot-cli/fleet.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ versions:
77
feature: copilot
88
contentType: concepts
99
category:
10-
- Learn about Copilot CLI
10+
- Learn about Copilot # Copilot discovery page
11+
- Learn about Copilot CLI # Copilot CLI bespoke page
1112
---
1213

1314
## Introduction
@@ -68,3 +69,5 @@ For more information about autopilot mode, see [AUTOTITLE](/copilot/concepts/age
6869
## Further reading
6970

7071
* [AUTOTITLE](/copilot/how-tos/copilot-cli/speeding-up-task-completion)
72+
* [AUTOTITLE](/copilot/how-tos/copilot-cli)
73+
* [AUTOTITLE](/copilot/how-tos/use-copilot-agents/use-copilot-cli)

content/copilot/concepts/agents/copilot-cli/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ children:
1111
- /comparing-cli-features
1212
- /autopilot
1313
- /fleet
14+
- /research
1415
contentType: concepts
1516
---
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
title: Researching with {% data variables.copilot.copilot_cli %}
3+
shortTitle: Researching with {% data variables.product.prodname_copilot_short %}
4+
allowTitleToDifferFromFilename: true
5+
intro: 'The `/research` slash command turns {% data variables.product.prodname_copilot_short %} into your research assistant, gathering in-depth information and insights on a topic.'
6+
versions:
7+
feature: copilot
8+
topics:
9+
- CLI
10+
contentType: concepts
11+
category:
12+
- Learn about Copilot # Copilot discovery page
13+
- Learn about Copilot CLI # Copilot CLI bespoke page
14+
---
15+
16+
## Introduction
17+
18+
{% data variables.copilot.copilot_cli_short %}'s `/research` slash command is a powerful tool for deep research and investigation. When you enter `/research` followed by details of what you want to know about, {% data variables.product.prodname_copilot_short %} activates a specialized research agent that gathers and processes information from your codebase, from relevant {% data variables.product.github %} repositories, and from the web. This built-in custom agent produces a comprehensive Markdown report with citations, along with a brief summary in the CLI. You can view the full report and save it as a gist on {% data variables.product.github %}, making it easy to share.
19+
20+
The command is designed to provide exhaustive, well-cited answers to complex questions about codebases, APIs, libraries, software architecture and other technical topics.
21+
22+
## Using the `/research` slash command
23+
24+
In an interactive CLI session, enter:
25+
26+
```copilot copy
27+
/research TOPIC
28+
```
29+
30+
Where `TOPIC` is a natural language description of what you want to find out about.
31+
32+
Depending on the permissions you have given the CLI, {% data variables.product.prodname_copilot_short %} may ask you to grant permission for it to create a directory in which to store data as it compiles the research.
33+
34+
When the research is complete, {% data variables.product.prodname_copilot_short %} shows you a summary of the key findings, and gives you a link to a Markdown file containing the full report.
35+
36+
## Viewing and sharing a research report
37+
38+
You can use the link displayed when the research completes to view the full report in your default editor for Markdown files.
39+
40+
Alternatively, press <kbd>Ctrl</kbd>+<kbd>Y</kbd> to open the current session's most recent research report in the terminal.
41+
42+
> [!NOTE]
43+
> The application used to display a report when you press <kbd>Ctrl</kbd>+<kbd>Y</kbd> is determined by the value of the `COPILOT_EDITOR`, `VISUAL`, or `EDITOR` environment variables (in that order of precedence). If none of these are set, the CLI will use vi on Linux or vim on macOS.
44+
45+
To share the report you can either save it to a file or create a {% data variables.product.github %} gist.
46+
47+
1. To create a gist enter:
48+
49+
```copilot copy
50+
/share gist research
51+
```
52+
53+
To save to a file, enter:
54+
55+
```copilot copy
56+
/share file research [PATH]
57+
```
58+
59+
If you omit the `[PATH]` parameter, the file will be saved to the current working directory with a filename based on the research topic.
60+
61+
1. Use the up/down and enter keys to select the report you want to share from the list of research reports you've created during the current session.
62+
63+
The URL of the gist, or the path to the file, is displayed in the CLI.
64+
65+
## Benefits of `/research`
66+
67+
* **Depth over speed**: Normal chat is optimized for quick answers. `/research` is optimized for thoroughness. It produces reports that can be hundreds of lines long, with architecture diagrams, code snippets, and citations.
68+
69+
* **Saved and shareable output**: Reports are saved to disk as Markdown files. You can view and share them at any time. This makes the research output a permanent artifact, rather than a transient chat message.
70+
71+
* **Works across repositories**: When logged into {% data variables.product.github %}, the agent can search across your organization's repositories, fetch files from any public or accessible private repository, and search the web—it's not limited to your local codebase.
72+
73+
* **Query-type adaptation**: Rather than generating a standard, one-size-fits-all report, the response format automatically adapts to whether you're asking a how-to question, a conceptual question, or requesting a technical deep-dive.
74+
75+
* **Autonomous operation**: The agent never interrupts you with clarifying questions. It makes reasonable assumptions and explicitly documents them in a "Confidence Assessment" section.
76+
77+
## Example prompts for `/research`
78+
79+
### Codebase architecture
80+
81+
```copilot copy
82+
/research What is the architecture of this codebase?
83+
```
84+
85+
**Why it works well**: The research agent has access to `grep`, `glob`, and `view` tools scoped to your current working directory. It can explore the full project tree, read key files, and synthesize an architectural overview—something a normal chat response might do only superficially. The agent will typically produce architecture diagrams, component breakdowns, and data flow descriptions.
86+
87+
### How a specific technology works
88+
89+
```copilot copy
90+
/research How does React implement concurrent rendering?
91+
```
92+
93+
**Why it works well**: The agent uses specialized tools to pull information from the internet, and to look at actual React source code on {% data variables.product.github %}. It's instructed to prioritize code over documentation and provide file paths with line numbers.
94+
95+
### Understanding internal implementation patterns
96+
97+
```copilot copy
98+
/research How are feature flags implemented at our organization?
99+
```
100+
101+
**Why it works well**: The agent is explicitly instructed to "always prioritize internal/private implementations over public/open-source alternatives" and to search the organization's repositories first using `org:ORGNAME` queries. It knows to look for internal naming patterns like `-hub`, `-service`, `-client`.
102+
103+
### Comparing technologies or approaches
104+
105+
```copilot copy
106+
/research What's the difference between JWT and session-based authentication?
107+
```
108+
109+
**Why it works well**: The agent adapts its response to "Conceptual/Explanatory Questions" with narrative explanations, trade-offs, and design decisions. It will typically use tables for comparisons of three or more items.
110+
111+
### Process/how-to questions
112+
113+
```copilot copy
114+
/research How do I add an endpoint to the API?
115+
```
116+
117+
**Why it works well**: The agent is trained to detect query type and provide step-by-step guidance with links to relevant docs, contacts, and systems for process/how-to type questions.
118+
119+
### Deep-diving into a specific codebase component
120+
121+
```copilot copy
122+
/research How is the session management system implemented in this repo?
123+
```
124+
125+
**Why it works well**: Combining local tools (`grep`, `glob`, `view`) with the agent's instructions to "trace imports, calls, and type references" and "follow dependencies" means it will walk through the actual implementation, not just give a high-level answer.
126+
127+
## When you might _not_ want to use `/research`
128+
129+
* **Quick, simple questions**: If you just want to know "What does this function do?" or "Fix this bug", a normal chat message is faster and more appropriate. `/research` is designed for questions requiring extensive investigation.
130+
131+
* **When you need code changes**: `/research` produces a report, not code modifications. It uses the `create` tool to save the report file, but does not use `edit`, `bash`, or other code-modification tools. If you need the agent to actually change your code, use a normal prompt (typically starting in plan mode).
132+
133+
* **Time-sensitive interactions**: Research takes longer than a normal response because the agent makes many tool calls (searching code, fetching files, searching the web). If you need a quick answer in the flow of coding, normal chat is better.
134+
135+
## Considerations and things to be aware of
136+
137+
* **Reports are tied to your session**: Research reports are stored in a session-specific research directory. If you start a new session, previous research won't be available within the CLI when you use the <kbd>Ctrl</kbd>+<kbd>Y</kbd> shortcut or the `/share` slash command. However, you can access previous reports from the appropriate `~/.copilot/session-state/SESSION-ID/research/` directory.
138+
139+
In Linux or macOS, you can use the following command at a terminal command prompt to list the 10 most recent CLI session directories:
140+
141+
```bash copy
142+
ls -dtl ~/.copilot/session-state/*/ | head -10
143+
```
144+
145+
* **The research agent uses a specific model**: The research agent is hard-coded to use a particular AI model (see [AUTOTITLE](/copilot/reference/cli-command-reference#built-in-agents)). The model selection is not configurable via the `/model` command. The research agent always uses the defined model regardless of what model you've selected for your main session.
146+
147+
* **Report quality varies by query type**: The agent classifies your query into three types and adapts its response accordingly:
148+
149+
* **Process questions** → step-by-step guidance (minimal code).
150+
* **Conceptual questions** → narrative explanation with context.
151+
* **Technical deep-dives** → full architecture diagrams, component sections, and code examples.
152+
153+
The way you phrase your prompt may affect the agent's choice of research classification. For example, if you want a technical deep-dive but you phrase your question as "What is X?", you might get a conceptual answer. In this situation you could rephrase your prompt to be more explicit about the type of report you want {% data variables.product.prodname_copilot_short %} to produce. For example: "Give me a technical deep-dive into X, with architecture diagrams and code examples."
154+
155+
## Further reading
156+
157+
* [AUTOTITLE](/copilot/how-tos/copilot-cli)
158+
* [AUTOTITLE](/copilot/how-tos/use-copilot-agents/use-copilot-cli)

content/copilot/how-tos/copilot-cli/customize-copilot/plugins-finding-installing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ copilot plugin uninstall PLUGIN-NAME # Remove plugin completely
122122

123123
## Where plugins are stored
124124

125-
Plugins installed from a marketplace are stored under: `~/.copilot/installed-plugins/MARKETPLACE/PLUGIN-NAME/`. Plugins installed directly (for example, from a local path) are stored under: `~/.copilot/installed-plugins/_direct/PLUGIN-NAME/`.
125+
Plugins installed from a marketplace are stored at: `~/.copilot/state/installed-plugins/MARKETPLACE/PLUGIN-NAME/`. Plugins installed directly (for example, from a local path) are stored at: `~/.copilot/state/installed-plugins/PLUGIN-NAME/`.
126126

127127
## Adding plugin marketplaces
128128

content/copilot/how-tos/copilot-cli/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ children:
3030
- /content/copilot/concepts/agents/copilot-cli/about-cli-plugins
3131
- /content/copilot/concepts/agents/copilot-cli/autopilot
3232
- /content/copilot/concepts/agents/copilot-cli/fleet
33+
- /content/copilot/concepts/agents/copilot-cli/research
3334
- /set-up-copilot-cli/install-copilot-cli
3435
- /set-up-copilot-cli/configure-copilot-cli
3536
- /customize-copilot/add-custom-instructions

content/copilot/reference/cli-command-reference.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,21 +423,22 @@ Custom agents are specialized AI agents defined in Markdown files. The filename
423423

424424
| Agent | Default model | Description |
425425
|-------|--------------|-------------|
426-
| `explore` | claude-haiku-4.5 | Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel. |
427-
| `task` | claude-haiku-4.5 | Command execution (tests, builds, lints). Returns brief summary on success, full output on failure. |
428426
| `code-review` | claude-sonnet-4.5 | High signal-to-noise code review. Analyzes diffs for bugs, security issues, and logic errors. |
427+
| `explore` | claude-haiku-4.5 | Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel. |
429428
| `general-purpose` | claude-sonnet-4.5 | Full-capability agent for complex multi-step tasks. Runs in a separate context window. |
429+
| `research` | claude-sonnet-4.6 | Deep research agent. Generates a report based on information in your codebase, in relevant repositories, and on the web. |
430+
| `task` | claude-haiku-4.5 | Command execution (tests, builds, lints). Returns brief summary on success, full output on failure. |
430431

431432
### Custom agent frontmatter fields
432433

433434
| Field | Type | Required | Description |
434435
|-------|------|----------|-------------|
435-
| `name` | string | No | Display name. Defaults to the filename. |
436436
| `description` | string | Yes | Description shown in the agent list and `task` tool. |
437+
| `infer` | boolean | No | Allow auto-delegation by the main agent. Default: `true`. |
438+
| `mcp-servers` | object | No | MCP servers to connect. Uses the same schema as `~/.copilot/mcp-config.json`. |
437439
| `model` | string | No | AI model for this agent. When unset, inherits the outer agent's model. |
440+
| `name` | string | No | Display name. Defaults to the filename. |
438441
| `tools` | string[] | No | Tools available to the agent. Default: `["*"]` (all tools). |
439-
| `mcp-servers` | object | No | MCP servers to connect. Uses the same schema as `~/.copilot/mcp-config.json`. |
440-
| `infer` | boolean | No | Allow auto-delegation by the main agent. Default: `true`. |
441442

442443
### Custom agent locations
443444

content/copilot/reference/cli-plugin-reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ If you install multiple plugins it's possible that some custom agents, skills, M
166166
The following diagram illustrates the loading order and precedence rules.
167167

168168
```text
169-
┌─────────────────────────────────────────────────────────┐
170-
│ BUILT-IN - HARDCODED, ALWAYS PRESENT │
171-
│ • tools: bash, view, apply_patch, glob, rg, task, ... │
172-
│ • agents: explore, task, code-review, general-purpose
173-
└────────────────────────┬────────────────────────────────┘
169+
┌──────────────────────────────────────────────────────────────────
170+
│ BUILT-IN - HARDCODED, ALWAYS PRESENT
171+
│ • tools: bash, view, apply_patch, glob, rg, task, ...
172+
│ • agents: explore, task, code-review, general-purpose, research
173+
└────────────────────────┬─────────────────────────────────────────
174174
175175
┌──────────────────────▼──────────────────────────────────────────────┐
176176
│ CUSTOM AGENTS - FIRST LOADED IS USED (dedup by ID) │

0 commit comments

Comments
 (0)