From d6663759b684bf47593f75d5a9be0f098e4ca222 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 6 Oct 2025 20:56:31 +0000 Subject: [PATCH 01/12] Initial plan From 78cc92bbdfeafd68f74de20257b05e0122971270 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 6 Oct 2025 21:01:34 +0000 Subject: [PATCH 02/12] Add LLM detection section to .NET CLI telemetry documentation Co-authored-by: meaghanlewis <10103121+meaghanlewis@users.noreply.github.com> --- docs/core/tools/telemetry.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 121c499658901..b4459b9ba364b 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -91,6 +91,7 @@ The telemetry feature collects the following data: | >=6.0.104 | Hashed CompileListCount used for build (MSBuild property) | | >=6.0.104 | Hashed _ReadyToRunCompilationFailures used for build (MSBuild property) | | >=6.0.300 | If the CLI was invoked from a Continuous Integration environment. For more information, see [Continuous Integration Detection](#continuous-integration-detection).| +| >=9.0.100 | If the CLI was invoked from an LLM agent environment and the detected agent type. For more information, see [LLM Detection](#llm-detection).| | >=7.0.100 | Hashed PublishAot used for build (MSBuild property) | | >=7.0.100 | Hashed PublishProtocol used for build (MSBuild property) | | >=8.0.100 | Hashed TargetPlatformIdentifier used for build (MSBuild property) | @@ -190,6 +191,16 @@ The full list of environment variables, and what is done with their values, is s | TEAMCITY_VERSION | TeamCity | Check if present and non-null | | JB_SPACE_API_URL | JetBrains Space | Check if present and non-null | +## LLM Detection + +To detect if the .NET CLI is running in the context of an LLM agent environment, the .NET CLI probes for the presence and values of several environment variables that LLM agents and AI coding assistants set. + +The following table shows the environment variables used for detection and the agent type that is reported. Similar to CI detection, the actual values of these environment variables are never collected—only used to identify the agent type. + +| Variable(s) | Agent Type | Action | +| ----------- | ---------- | ------ | +| COPILOT_AGENT_ACTION, COPILOT_CLOUD_ENVIRONMENT | GitHub Copilot | Check if all are present and non-null | + ## Avoid inadvertent disclosure of information .NET contributors and anyone else running a version of the .NET SDK that they built themselves should consider the path to their SDK source code. If a crash occurs while using a .NET SDK that is a custom debug build or configured with custom build symbol files, the SDK source file path from the build machine is collected as part of the stack trace and isn't hashed. From d44e51be891192d62745b0664eee0f5d84a0085f Mon Sep 17 00:00:00 2001 From: Meaghan Osagie Date: Mon, 6 Oct 2025 15:44:38 -0700 Subject: [PATCH 03/12] Update LLM detection section in telemetry documentation --- docs/core/tools/telemetry.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index b4459b9ba364b..5a19cce887c69 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -91,7 +91,6 @@ The telemetry feature collects the following data: | >=6.0.104 | Hashed CompileListCount used for build (MSBuild property) | | >=6.0.104 | Hashed _ReadyToRunCompilationFailures used for build (MSBuild property) | | >=6.0.300 | If the CLI was invoked from a Continuous Integration environment. For more information, see [Continuous Integration Detection](#continuous-integration-detection).| -| >=9.0.100 | If the CLI was invoked from an LLM agent environment and the detected agent type. For more information, see [LLM Detection](#llm-detection).| | >=7.0.100 | Hashed PublishAot used for build (MSBuild property) | | >=7.0.100 | Hashed PublishProtocol used for build (MSBuild property) | | >=8.0.100 | Hashed TargetPlatformIdentifier used for build (MSBuild property) | @@ -107,6 +106,7 @@ The telemetry feature collects the following data: | >=8.0.100 | Whether library mode for mobile is used. | | >=8.0.100 | Whether NativeAOT is used. | | >=8.0.100 | Used Mono runtime pack version. | +| >=10.0.100 | If the CLI was invoked from an LLM agent, the detected LLM agent name is reported. For more information, see [LLM Detection](#llm-detection).| ### Collected options @@ -193,13 +193,13 @@ The full list of environment variables, and what is done with their values, is s ## LLM Detection -To detect if the .NET CLI is running in the context of an LLM agent environment, the .NET CLI probes for the presence and values of several environment variables that LLM agents and AI coding assistants set. +To detect if the .NET CLI is running in the context of an LLM agent, the .NET CLI probes for the presence and values of several environment variables that LLM agents and AI coding assistants set. -The following table shows the environment variables used for detection and the agent type that is reported. Similar to CI detection, the actual values of these environment variables are never collected—only used to identify the agent type. +The following table shows the agent name, environment variables used for detection and the value of the agent type that is reported. The actual values of these environment variables are never collected—only used to identify the agent type. -| Variable(s) | Agent Type | Action | -| ----------- | ---------- | ------ | -| COPILOT_AGENT_ACTION, COPILOT_CLOUD_ENVIRONMENT | GitHub Copilot | Check if all are present and non-null | +| LLM agent | Variable | Value | +| --------- | -------- | ----- | +| Claude Code | CLAUDECODE | Return LLM tool name of "claude" | ## Avoid inadvertent disclosure of information From 8da2d428f2707c10cd2c74189f30e70b656ba280 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Oct 2025 00:46:01 +0000 Subject: [PATCH 04/12] Add additional LLM agent detections from SDK PR #51054 Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- docs/core/tools/telemetry.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 5a19cce887c69..8b3d891d13a41 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -197,9 +197,15 @@ To detect if the .NET CLI is running in the context of an LLM agent, the .NET CL The following table shows the agent name, environment variables used for detection and the value of the agent type that is reported. The actual values of these environment variables are never collected—only used to identify the agent type. -| LLM agent | Variable | Value | -| --------- | -------- | ----- | -| Claude Code | CLAUDECODE | Return LLM tool name of "claude" | +| LLM agent | Variable(s) | Value | +| --------- | ----------- | ----- | +| GitHub Copilot | COPILOT_CLOUD_ENVIRONMENT | "copilot" | +| Claude Code | CLAUDECODE | "claude" | +| Cursor | CURSOR_SESSION_ID | "cursor" | +| Windsurf | CASCADE_SESSION_ID | "windsurf" | +| Cline | CLINE | "cline" | +| Roo Code | ROOCODE | "roo-code" | +| Zed | ZED_TERM | "zed" | ## Avoid inadvertent disclosure of information From 6ddbe61313503bd28e6f4e0fb7df77a7d3efd43b Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 6 Oct 2025 19:57:19 -0500 Subject: [PATCH 05/12] Apply suggestion from @baronfel --- docs/core/tools/telemetry.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 8b3d891d13a41..60cc642023778 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -199,13 +199,12 @@ The following table shows the agent name, environment variables used for detecti | LLM agent | Variable(s) | Value | | --------- | ----------- | ----- | -| GitHub Copilot | COPILOT_CLOUD_ENVIRONMENT | "copilot" | +| GitHub Copilot | GITHUB_COPILOT_CLI_MODE | "copilot" | | Claude Code | CLAUDECODE | "claude" | -| Cursor | CURSOR_SESSION_ID | "cursor" | -| Windsurf | CASCADE_SESSION_ID | "windsurf" | -| Cline | CLINE | "cline" | -| Roo Code | ROOCODE | "roo-code" | -| Zed | ZED_TERM | "zed" | +| Cursor | CURSOR_EDITOR| "cursor" | +| Google Gemini | GEMINI_CLI | "gemini" | + +If multiple agents are detected, the different agent Values will be concatenated with a comma to produce the final value. ## Avoid inadvertent disclosure of information From 788e82c3a3b51b10c71dfe53197cbaa0a06447ab Mon Sep 17 00:00:00 2001 From: Meaghan Osagie Date: Tue, 7 Oct 2025 11:32:25 -0700 Subject: [PATCH 06/12] update ms.date --- docs/core/tools/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 60cc642023778..afc5cb7014f3e 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -2,7 +2,7 @@ title: .NET SDK and .NET CLI telemetry description: The .NET SDK and the .NET CLI collect usage information and send it to Microsoft. Learn what data is collected and how to opt out. author: KathleenDollard -ms.date: 02/24/2022 +ms.date: 10/07/2025 --- # .NET SDK and .NET CLI telemetry From 0db0ad0b0c42226cb8043692ee6284149b9043b9 Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Thu, 9 Oct 2025 12:18:52 -0700 Subject: [PATCH 07/12] Update docs/core/tools/telemetry.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/tools/telemetry.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index afc5cb7014f3e..8c73eaeefe309 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -105,8 +105,8 @@ The telemetry feature collects the following data: | >=8.0.100 | Whether Mono interpreter is used. | | >=8.0.100 | Whether library mode for mobile is used. | | >=8.0.100 | Whether NativeAOT is used. | -| >=8.0.100 | Used Mono runtime pack version. | -| >=10.0.100 | If the CLI was invoked from an LLM agent, the detected LLM agent name is reported. For more information, see [LLM Detection](#llm-detection).| +| >=8.0.100 | The Mono runtime pack version that was used. | +| >=10.0.100 | The detected LLM agent name (if the CLI was invoked from an LLM agent). For more information, see [LLM Detection](#llm-detection).| ### Collected options From 5da7b7581cac5a69108cd21db91774f5c6ad8166 Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Thu, 9 Oct 2025 12:19:02 -0700 Subject: [PATCH 08/12] Update docs/core/tools/telemetry.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/tools/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 8c73eaeefe309..b0c759a94a703 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -191,7 +191,7 @@ The full list of environment variables, and what is done with their values, is s | TEAMCITY_VERSION | TeamCity | Check if present and non-null | | JB_SPACE_API_URL | JetBrains Space | Check if present and non-null | -## LLM Detection +## LLM detection To detect if the .NET CLI is running in the context of an LLM agent, the .NET CLI probes for the presence and values of several environment variables that LLM agents and AI coding assistants set. From 4f5e6a696b4847e8b91829fd11f3027e32f8c677 Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Thu, 9 Oct 2025 12:19:13 -0700 Subject: [PATCH 09/12] Update docs/core/tools/telemetry.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/tools/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index b0c759a94a703..8b4e8f474a977 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -195,7 +195,7 @@ The full list of environment variables, and what is done with their values, is s To detect if the .NET CLI is running in the context of an LLM agent, the .NET CLI probes for the presence and values of several environment variables that LLM agents and AI coding assistants set. -The following table shows the agent name, environment variables used for detection and the value of the agent type that is reported. The actual values of these environment variables are never collected—only used to identify the agent type. +The following table shows the agent name, environment variable used for detection, and value of the agent type that's reported. The actual values of these environment variables are never collected—only used to identify the agent type. | LLM agent | Variable(s) | Value | | --------- | ----------- | ----- | From ddef33aa2f7cf7051072d1cdd8c811114c5a5030 Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Thu, 9 Oct 2025 12:19:32 -0700 Subject: [PATCH 10/12] Update docs/core/tools/telemetry.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/tools/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 8b4e8f474a977..36f78f1965632 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -204,7 +204,7 @@ The following table shows the agent name, environment variable used for detectio | Cursor | CURSOR_EDITOR| "cursor" | | Google Gemini | GEMINI_CLI | "gemini" | -If multiple agents are detected, the different agent Values will be concatenated with a comma to produce the final value. +If multiple agents are detected, the different agent values are concatenated with a comma to produce the final value. ## Avoid inadvertent disclosure of information From 42360c1ffde4592c6cb69fe7b6584403b05b113f Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Thu, 9 Oct 2025 12:19:39 -0700 Subject: [PATCH 11/12] Update docs/core/tools/telemetry.md Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/tools/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index 36f78f1965632..b11411cde0831 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -197,7 +197,7 @@ To detect if the .NET CLI is running in the context of an LLM agent, the .NET CL The following table shows the agent name, environment variable used for detection, and value of the agent type that's reported. The actual values of these environment variables are never collected—only used to identify the agent type. -| LLM agent | Variable(s) | Value | +| LLM agent | Variable | Value | | --------- | ----------- | ----- | | GitHub Copilot | GITHUB_COPILOT_CLI_MODE | "copilot" | | Claude Code | CLAUDECODE | "claude" | From 185721f17c0f8721f6c0408b2af6b49322b50923 Mon Sep 17 00:00:00 2001 From: "Meaghan Osagie (Lewis)" Date: Thu, 9 Oct 2025 12:33:07 -0700 Subject: [PATCH 12/12] Fix LLM agent name description formatting Corrected formatting in telemetry documentation. --- docs/core/tools/telemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/telemetry.md b/docs/core/tools/telemetry.md index b11411cde0831..fcb4fbc10fdeb 100644 --- a/docs/core/tools/telemetry.md +++ b/docs/core/tools/telemetry.md @@ -106,7 +106,7 @@ The telemetry feature collects the following data: | >=8.0.100 | Whether library mode for mobile is used. | | >=8.0.100 | Whether NativeAOT is used. | | >=8.0.100 | The Mono runtime pack version that was used. | -| >=10.0.100 | The detected LLM agent name (if the CLI was invoked from an LLM agent). For more information, see [LLM Detection](#llm-detection).| +| >=10.0.100 | The detected LLM agent name if the CLI was invoked from an LLM agent. For more information, see [LLM detection](#llm-detection).| ### Collected options