Implement PostToolUse telemetry hook scripts#30
Draft
IEvangelist wants to merge 3 commits into
Draft
Conversation
Replace the no-op placeholder track-telemetry.{sh,ps1} hooks with the real
implementation. The scripts parse the hook JSON across Copilot CLI (camelCase),
Claude Code, and VS Code (snake_case) payloads, detect Aspire skill invocations,
Aspire MCP tool calls (aspire-*, mcp__aspire__*, mcp_aspire_*), and Aspire skill
reference-file reads, then forward a low-cardinality usage event to
'aspire agent telemetry'.
Only Aspire-owned identifiers are emitted (skill/tool name, the skill-relative
reference path, a session id) - never absolute paths, repo names, or user names.
Telemetry is suppressed when ASPIRE_CLI_TELEMETRY_OPTOUT or
ASPIRE_CLI_AGENT_TELEMETRY_OPTOUT is set; the Aspire CLI independently
re-validates and re-checks opt-out before publishing.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Honor only ASPIRE_CLI_TELEMETRY_OPTOUT in the PostToolUse telemetry hook scripts. Drop the AI-specific ASPIRE_CLI_AGENT_TELEMETRY_OPTOUT check; the Aspire CLI command honors the same switch before publishing, so the script short-circuit and the CLI now share one opt-out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 8, 2026
Draft
The hook scripts gate on a single ASPIRE_CLI_TELEMETRY_OPTOUT switch. Update the opt-out comment to describe it as the single opt-out that also gates the `aspire agent telemetry` command path, matching the embedded copies in microsoft/aspire so the two stay byte-identical. Comment-only; no behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the no-op placeholder
track-telemetry.{sh,ps1}hooks with the real implementation. The scripts run on every agentPostToolUseevent, parse the hook JSON across Copilot CLI (camelCase), Claude Code, and VS Code (snake_case) payloads, and detect:skill/Skilltool with an allowlisted Aspire skill name, or aSKILL.mdread under an Aspire skills path.aspire-*(Copilot),mcp__aspire__*(Claude),mcp_aspire_*(VS Code).SKILL.mdfiles under an Aspire skill folder.Matching events are forwarded to
aspire agent telemetry(resolved from PATH;ASPIRE_CLI_COMMANDoverrides for testing). Non-Aspire tool uses are ignored.Privacy: only Aspire-owned identifiers are emitted (allowlisted skill/tool name, the skill-relative reference path, a session id) — never absolute paths, repo/user names, file contents, or tool arguments. Output is redirected to null so a banner can never contaminate the hook's JSON stdout, and every path ends in
{"continue":true}/ exit 0 so a failure can't break the agent session.Opt-out: a single switch — the script skips entirely when
ASPIRE_CLI_TELEMETRY_OPTOUTis set, and the Aspire CLI command honors the same switch before publishing.The companion
aspire agent telemetrycommand andaspire agent initauto-registration live in microsoft/aspire#18009; transparency docs in microsoft/aspire.dev#1229. Draft pending coordinated review.Part of microsoft/aspire#18008
Testing
Validated both scripts (Git Bash + PowerShell 7) with sample Copilot CLI / Claude Code / VS Code payloads: skill, MCP-tool, and reference-file detection;
aspire:skill-prefix stripping; non-Aspire tool calls ignored; and the opt-out env var suppressing all output. The companion repo addsTelemetryHookScriptTeststhat exercise the materialized scripts end-to-end.