Chat modes, Agent HQ, and execution contexts
Chat modes, Agent HQ, and execution contexts
GitHub Copilot isnβt a single-mode tool. It offers multiple ways to interact β from quick Q&A to autonomous multi-file refactoring β and multiple places to run that work β from your local VS Code window to a cloud agent that creates pull requests overnight. Understanding these modes and contexts helps you choose the right approach for each task.
This article explains the four built-in chat modes, the Agent HQ unified management interface, and the three execution contexts that determine where and how your agent sessions run.
Table of contents
- π― The four chat modes
- ποΈ Agent HQ: unified session management
- π₯οΈ Execution contexts: local, background, and cloud
- π³ Work tree isolation
- π Plan β agent delegation workflow
- β Choosing the right mode and context
- π― Conclusion
- π References
π― The four chat modes
GitHub Copilot Chat provides four built-in chat modes, accessible via the mode picker in the chat input. Each mode defines a different level of autonomy and capability:
| Mode | What it does | Can edit files? | Best for |
|---|---|---|---|
| Agent | Autonomous mode β determines necessary changes and applies them | Yes | Complex multi-file refactoring, feature implementation |
| Plan | Creates detailed implementation plans without modifying files | No (read-only) | Architecture planning, understanding approach before execution |
| Ask | Q&A mode for questions without file modifications | No | Learning, code explanations, debugging assistance |
| Edit | Direct code editing for targeted changes | Yes | Quick fixes, single-file modifications |
How modes supersede custom patterns
Before these built-in modes existed, developers created complex multi-phase agent patterns β a βresearchβ agent that gathered context, a βplannerβ agent that created a plan, and an βimplementerβ agent that made changes. The built-in modes now handle the most common version of this workflow natively:
- Use Plan mode to analyze the problem and generate an implementation plan
- Review and refine the plan
- Use Agent mode (or delegate to background/cloud) to execute
This doesnβt eliminate the need for custom agents β specialized personas, tool restrictions, and domain-specific workflows still require .agent.md files. But for the general βthink, then doβ pattern, built-in modes are simpler and more reliable.
When to use each mode
Agent mode β your default for getting work done. The model reasons autonomously, searches your codebase, edits files, runs commands, and validates results. Use it when you want Copilot to complete a task end-to-end.
Plan mode β use before committing to a large change. Plan mode generates a structured approach without making any modifications. Itβs particularly valuable for complex refactoring where you want to understand the scope before starting.
Ask mode β use for learning and exploration. Ask mode answers questions about your codebase, explains how code works, and discusses architecture decisions β all without touching any files.
Edit mode β use for focused, single-file changes. Edit mode is faster than Agent mode for simple tasks because it doesnβt need to reason about multi-step workflows.
ποΈ Agent HQ: unified session management
Agent HQ is the centralized interface for managing all agent sessions across execution contexts. Introduced in VS Code 1.107, it provides visibility and control over local, background, and cloud sessions from a single view.
What Agent HQ shows
- Recent sessions list β all local, background, and cloud sessions with filtering and search
- Session state indicators β read/unread markers, input-required flags, completion status
- Quick actions β archive, continue, copy workspace changes, delegate to different context
Session management features
| Feature | Description |
|---|---|
| Side-by-side view | Agent sessions default to side-by-side layout for easier comparison |
| Input-required markers | Sessions needing user input are clearly flagged |
| Workspace copying | Copy workspace changes when creating background sessions |
| Persistent chat prompt | Chat prompt isnβt cleared when creating a new session |
| Collapsed tool calls | Tool calls in cloud sessions are collapsed by default |
Agent HQ is particularly valuable when running multiple sessions in parallel β you can have a background agent refactoring your test suite while you interact with a local agent on a different feature, and track both sessions from the same interface.
π₯οΈ Execution contexts: local, background, and cloud
Every agent session runs in one of three execution contexts. The choice of context determines where code runs, how isolation works, and what integration model applies.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EXECUTION CONTEXTS β
ββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββ€
β β β β
β LOCAL β BACKGROUND β CLOUD β
β β β β
β Interactive β Autonomous β Async (GitHub) β
β Same window β Git work tree β Creates PRs β
β Blocks UI β Non-blocking β Team collaboration β
β β β β
β Best for: β Best for: β Best for: β
β β’ Quick fixes β β’ Long tasks β β’ Overnight work β
β β’ Iterative β β’ Parallel β β’ Complex refactors β
β work β exploration β β’ Team review β
β β β’ Large changes β β
ββββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββββββββββββ
Local agents
The most familiar context. The agent runs in your current VS Code window, interacting with your workspace directly.
| Aspect | Description |
|---|---|
| Execution | Interactive, in the current window |
| Isolation | None β shares your workspace and files |
| Visibility | Full β you see every tool call and result |
| Blocking | Yes β the chat panel is occupied |
| Best for | Quick tasks, iterative debugging, guided exploration |
Local agents are ideal when you need tight feedback loops β youβre working alongside the agent, reviewing each step, and steering the conversation.
Background agents
Background agents run autonomously using Git work trees for complete isolation.
| Aspect | Description |
|---|---|
| Execution | Autonomous, in a separate Git work tree |
| Isolation | Full β uses an isolated work tree, no interference with your files |
| Visibility | Via Agent HQ β check progress, review changes |
| Blocking | No β you keep working while the agent runs |
| Best for | Long-running tasks, parallel exploration, large refactoring |
Background agents are the key productivity multiplier β you can launch three agents exploring different approaches to the same problem, continue your own work, and review results when theyβre done.
Cloud agents (GitHub Copilot coding agent)
Cloud agents run on GitHubβs infrastructure and create pull requests with their changes.
| Aspect | Description |
|---|---|
| Execution | On GitHubβs servers, asynchronous |
| Isolation | Full β separate branch, separate environment |
| Visibility | Via GitHub PR β standard code review workflow |
| Blocking | No β completely async |
| Best for | Overnight work, complex refactoring, team review |
Cloud agents integrate into your teamβs existing PR workflow β changes go through code review, CI runs, and standard approval processes.
π³ Work tree isolation
Background agents use Git work trees for complete isolation from your main workspace. This is a critical architecture detail that enables safe, parallel agent execution.
How it works
1. REQUEST
"Start background agent session"
β
βΌ
2. WORK TREE CREATION
Git creates isolated work tree:
/repo/.git/worktrees/agent-session-xyz/
β’ Full copy of current branch state
β’ Independent staging area
β’ No interference with main workspace
β
βΌ
3. AGENT EXECUTION
Agent works in isolated work tree:
β’ Makes changes without affecting your files
β’ Can run tests and builds in isolation
β’ Session visible in Agent HQ
β
βΌ
4. REVIEW & INTEGRATE
User reviews in Agent HQ:
β’ "Direct Apply" β merges to your workspace
β’ "Create PR" β pushes for team review
Work tree cleaned up after integration
Why work tree isolation matters
| Benefit | Description |
|---|---|
| No conflicts | Agent changes donβt interfere with your local uncommitted work |
| Parallel exploration | Run multiple agents exploring different approaches simultaneously |
| Safe experimentation | Agent can make breaking changes without affecting your environment |
| SCM integration | Changes appear in Source Control view with clear session attribution |
Without work tree isolation, running a background agent would risk modifying files youβre actively editing. With isolation, your workspace stays untouched until you explicitly choose to integrate the agentβs changes.
π Plan β agent delegation workflow
One of the most powerful patterns combines Plan mode with agent delegation:
1. PLAN MODE
"Plan authentication refactoring"
Copilot generates detailed plan:
β’ Step 1: Extract auth middleware
β’ Step 2: Create token service
β’ Step 3: Update route handlers
β’ Step 4: Add unit tests
β
βΌ
2. REVIEW
You review the plan, refine if needed
β
βΌ
3. DELEGATE
"Start Implementation" button appears
Choose execution context:
β Local agent (interactive)
β Background agent (work tree)
β Cloud agent (GitHub PR)
This pattern gives you control over the approach (Plan mode) while leveraging automation for execution (Agent mode in any context). Itβs especially valuable for complex changes where you want human judgment on the strategy before autonomous execution begins.
Entry points for delegation
You can delegate to different agent contexts from multiple places:
- Chat view β βContinue inβ¦β button in chat response
- Agent HQ β session actions menu β βContinue asβ¦β
- Command Palette β βGitHub Copilot: Start Background Sessionβ
- Untitled prompt files β βContinue inβ¦β button when drafting prompts
β Choosing the right mode and context
Mode selection
What do you need?
β
ββ Understand code or architecture
β ββ Ask mode
β
ββ Plan a complex change before doing it
β ββ Plan mode β then delegate to Agent
β
ββ Make a quick, single-file edit
β ββ Edit mode
β
ββ Complete a task end-to-end
ββ Agent mode
Context selection
How should the work run?
β
ββ Interactive, with tight feedback loops
β ββ Local agent
β
ββ Long-running, keep working meanwhile
β ββ Background agent (work tree)
β
ββ Async, team review, overnight
ββ Cloud agent (GitHub PR)
Combined decision table
| Scenario | Mode | Context |
|---|---|---|
| βFix this typoβ | Edit | Local |
| βExplain how auth worksβ | Ask | Local |
| βPlan database migrationβ | Plan | Local |
| βImplement the migration planβ | Agent | Background |
| βRefactor test suiteβ | Agent | Background (parallel) |
| βAdd new feature for next sprintβ | Agent | Cloud |
| βExplore three approaches to cachingβ | Agent | Background (Γ3, parallel) |
| βQuick iterative debuggingβ | Agent | Local |
π― Conclusion
Chat modes, Agent HQ, and execution contexts form the interaction layer of GitHub Copilot. Modes control what kind of work happens (ask, plan, edit, or autonomous). Execution contexts control where that work runs (locally, in a background work tree, or on GitHubβs cloud). Agent HQ ties everything together with unified session management.
Key takeaways
- Four chat modes provide different autonomy levels: Agent (autonomous editing), Plan (read-only planning), Ask (Q&A), Edit (focused changes)
- Built-in modes supersede many custom multi-phase patterns β βPlan then Agentβ replaces the common βresearch β plan β implementβ workflow
- Agent HQ provides centralized management of all sessions across contexts
- Three execution contexts determine where work runs: local (interactive), background (work tree isolation), cloud (GitHub PRs)
- Work tree isolation enables safe, parallel background agent execution without interfering with your workspace
- Plan β delegate is a powerful pattern: plan with human judgment, execute with agent automation
- Context selection depends on your need for interactivity, parallelism, and team collaboration
Next steps
- Understanding agents, invocation, handoffs, and subagents β the customization layer that builds on top of these modes
- How Copilot assembles and processes prompts β how your chat mode and context affect prompt assembly
- How to design orchestrator prompts β advanced workflows that leverage multiple modes and contexts
π References
VS Code Copilot Chat Overview [π Official] Microsoftβs documentation for Copilot Chat modes, including Agent, Plan, Ask, and Edit modes with usage guidance.
VS Code Agent HQ Documentation [π Official] Official documentation for Agent HQ β unified session management, execution contexts, work tree isolation, and delegation workflows.
VS Code v1.107 Release Notes [π Official] December 2024 release introducing Agent HQ, background agents with work tree isolation, cloud agent integration, and the Plan mode β delegation workflow.
GitHub Copilot Coding Agent [π Official] GitHubβs documentation for the cloud execution context β the Copilot coding agent that creates pull requests from issues and natural language task descriptions.