Skip to content

Support COPILOT_HOME env var to relocate Copilot home directory. #314806

Closed

Description

Summary

On Windows, the extension uses a “Copilot home” directory that falls back to a dot-folder under the user profile (e.g. C:\Users\<user>\.copilot). This can clutter the user’s home directory with Unix-style dot folders. Although the code checks XDG_STATE_HOME, Windows does not implement or recognize the XDG Base Directory Specification by default, so XDG_STATE_HOME is typically unset and not a practical configuration mechanism for Windows users.

Environment

  • OS: Windows
  • VS Code version: 1.119.0

Current behavior

The Copilot home directory is derived from XDG_STATE_HOME (if set) and otherwise falls back to the OS home directory:

// src/extension/chatSessions/copilotcli/node/cliHelpers.ts
export function getCopilotHome(): string {
	const xdgHome = process.env.XDG_STATE_HOME;
	return xdgHome ? join(xdgHome, '.copilot') : join(homedir(), '.copilot');
}

Steps to observe

  1. Use Copilot Chat in VS Code (any scenario will trigger this folder).
  2. Observe that C:\Users\<user>\.copilot is created/used.

Expected behavior

Support COPILOT_HOME environment variable (full path) to override the base directory used as the Copilot home directory by the extension.

Suggested precedence:

  1. COPILOT_HOME (if set)
  2. (optional) XDG_STATE_HOME/.copilot (keeps current Linux behavior)
  3. ~/.copilot (current behavior)

Motivation

  • Better Windows “citizenship”: avoid Unix-style dot folders in the user profile.
  • Provide a practical, documented configuration mechanism on Windows (XDG env vars are generally not used there).
  • Enterprise/managed environments: allow redirecting state to a managed location.

Reference

Activity

  1. added
    chat-ext-issue
    on May 6, 2026
  2. removed
    chat-ext-issue
    on May 9, 2026
  3. Risae commented on Jun 27, 2026

    @Risae

    I just wanted to note that running VS Code in portable mode (data folder in root dir) doesn't affect the creation of this folder (but it should save this in the VS Code folder, since it is running in portable mode)

  4. added
    unreleased
    on Jul 31, 2026
  5. added this to the 1.132.0 milestone on Jul 31, 2026
  6. added
    insiders-released
    and removed
    unreleased
    on Jul 31, 2026
  7. locked and limited conversation to collaborators on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

insiders-released

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions