Chat modes, Agent HQ, and execution contexts

tech
prompt-engineering
github-copilot
concepts
Understand the four built-in chat modes, how Agent HQ provides unified session management, and how the three execution contexts (local, background, cloud) enable different work patterns.
Author

Dario Airoldi

Published

March 1, 2026

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

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:

  1. Use Plan mode to analyze the problem and generate an implementation plan
  2. Review and refine the plan
  3. 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


πŸ“š 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.