A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
Shared 1DS Telemetry Library
Canonical source for 1DS telemetry used by plugins in this repo. Each adopting plugin keeps a physical copy of this library in its own tree at plugins/<plugin>/scripts/lib/telemetry/lib, so plugin-host installs and Windows checkouts never depend on symlink behavior.
shared/telemetry/lib is the canonical source. Per-plugin copies must be refreshed from it whenever the shared library changes. Each plugin keeps its own real ikey.json next to the copied library.
Zero npm dependencies. Node stdlib only.
For the repository-level user disclosure, see Telemetry.
What it does
Usage telemetry over the 1DS Common Schema 4.0 envelope. All
adopters emit skill_started; plugins may also emit allowlisted configuration,
validation, and completion events. A detached dispatcher child resolves the
destination iKey + collector URL (env override → plugin resolver.js → static
key in ikey.json), then POSTs the event; the process that emitted it returns
before the POST happens.
hook (~5ms when disabled, ~3-5s otherwise — incl. when the user opted out)
│
└─ fireAndForget(event, opts) ← shared/telemetry/lib/emit-spawn.js
│
└─ spawn(emit-dispatcher.js, detached) ← runs in background
├─ read ikey.json (null/unreadable → HARD OFF)
├─ kill switch (cfg.disabled) → exit ← HARD OFF: no local log, no POST
├─ sanitizeData (FIELD_TYPES allowlist)
├─ appendLocal({time,name,data}) → telemetry/<plugin>/sessions/<sessionId>/events.jsonl ← ALWAYS (the mirror)
├─ user opt-out (env var POWER_PLATFORM_SKILLS_TELEMETRY_<PLUGIN>_OPTOUT=1 OR config.json choice "off"; env wins) → exit (mirror written, no POST)
├─ resolve destination → iKey + collector_url ← resolver.js (plugin) or static key
├─ iKey missing/placeholder → exit (mirror already written, no POST)
├─ build CS4.0 envelope (same time + sanitized data)
└─ HTTPS POST to the resolved collector_url
The local log is the on-disk mirror of what is (or would be) sent to Kusto:
each line is {time, name, data} where data is the sanitized payload whose
field names ARE the Kusto column names. It is written for every event that
clears the repo disabled kill switch — irrespective of whether a real iKey is
resolved and irrespective of the user opt-out. Only the repo
disabled: true kill switch (or a missing/unreadable ikey.json) produces zero
side effects.
The per-plugin user opt-out (config.json telemetry[<plugin>] === "off", set
via /<plugin>:telemetry off) suppresses transmission, not the local
diagnostic mirror — so an opted-out run still writes the session's events.jsonl
(and pays the same event-building cost as an enabled run), it just never POSTs.
The mirror is laid out per-plugin, per-session at
~/.power-platform-skills/telemetry/<pluginName>/sessions/<sessionId>/events.jsonl,
so a user can hand over one self-contained file per problem. Session directories
older than 14 days are pruned best-effort whenever a new session starts, and an
individual session log is rotated to events.<stamp>.old if it ever exceeds 10 MB.
Current adopters
The committed disabled value in each plugin's ikey.json determines whether
that plugin currently emits telemetry. A user command or environment-variable
choice cannot override disabled: true.
| Plugin | Committed state | Current behavior | Plugin-specific fields |
|---|---|---|---|
| Power Pages | disabled: false |
Enabled and default-on for transmission. Organization-based geo routing selects a regional collector; without an organization ID, the configured US default is used. Events are written to the local mirror even after a user transmission opt-out. | eventInfo.aadObjectId when PAC exposes the signed-in user's Entra object ID; eventInfo.framework when the Power Pages code-site framework can be determined; eventInfo.auditPermissions (aggregate, identity-free) on the audit-permissions completion event. |
| Mobile Apps | disabled: false |
Enabled and default-on for transmission. Its project environment selects the regional collector. Until that cluster is resolved, events remain in the local mirror and are not transmitted. | eventInfo.invocationSource; random per-project eventInfo.appInstanceId (or null outside a prepared project); optional validated checkpoint eventInfo.additionalInfo; and eventInfo.appInsightsSelection. |
| Model Apps | disabled: false |
Enabled and default-on for transmission. A public-cloud organization is geo-routed to the US or EU collector (US default only without an organization ID; an organization whose geo cannot be determined is not transmitted); a sovereign or internal PAC cloud is routed from the cloud stamp alone, never to a public collector; an unrecognized cloud, or a signed-in organization with no cloud, is not transmitted. Events are written to the local mirror even after a user transmission opt-out. | No signed-in user object ID. skill_started can include orgId and tenantId when PAC is signed in. skill_completed (app build and page upload) adds outcome, durationMs, errorClass and the approved eventInfo below, with the target environment's orgId/tenantId. |
| PCF | disabled: false |
Enabled and default-on for transmission. Shares Model Apps' tenant and keys through a byte-identical config; routes as model-apps does. Uses clientType: "PcfAIPlugin" with pluginName: "pcf" in the shared Power Apps client event stream; keeps its local mirror after transmission opt-out. |
No signed-in user object ID. skill_started carries base fields only (including orgId/tenantId when PAC is signed in). skill_completed (control push) adds outcome, durationMs, errorClass and the approved eventInfo below. |
| Power Automate | disabled: false |
Enabled and default-on for transmission. Its resolver returns a destination only for public cloud, so sovereign-cloud events stay in the local mirror. Organization-based geo routing selects the US or EU collector; without an organization ID, the configured US default is used. Events are written to the local mirror even after a user transmission opt-out. | eventInfo.aadObjectId when PAC exposes the signed-in user's Entra object ID. The plugin's bundled MCP server and CLI emit on the same stream and additionally record outcome, durationMs, errorClass, and errorCode, a random per-invocation correlationId and per-process sessionId, and envId/envLocation/envRegion. Error messages are never recorded. |
| Power Apps Mobile Extension | disabled: false |
Enabled and default-on for transmission. Records starts for 12 workflow skills, not the telemetry control or generated native controls/PCFs. Public-cloud organizations resolve to US or EU; unknown authenticated regions and unsupported clouds remain local-only. Without usable PAC identity, the US default is used. User transmission opt-out retains the local mirror. | eventInfo.aadObjectId when available from PAC, with optional orgId and tenantId. No other nested eventInfo fields. Uses fixed clientType: "power-apps-mobile-extension" and pluginName in the shared event stream. |
Custom routing (the resolver contract)
The destination iKey/collector is not hard-coded, and the shared library is
routing-agnostic. A plugin may drop a resolver.js next to its ikey.json to
own that decision:
module.exports = {
// async; may do network I/O (must cache). Returns { iKey, collectorUrl } or null.
async resolve({ event, cfg, cloud, configDir }) { /* ... */ },
// optional sync fast-gate so hooks skip the ~3-5s pac shellout when unprovisioned.
isProvisioned(cfg) { return true; },
// optional: reshape the wire envelope for a tenant that ingests a different schema.
// `data` is the already-sanitized allowlisted payload. Throwing or returning nothing
// sends nothing (fail closed); the local mirror is unaffected.
formatEnvelope({ eventName, time, data, iKey, eventStreamName }) { /* ... */ },
};
Model Apps uses formatEnvelope to send the Power Apps client event shape
(app_Name, clientType: "ModelAppsAIPlugin", event_Name, session_Id, and the
remaining fields as a customDimensions JSON string) because its tenants ingest only
the event stream.
The dispatcher discovers it by convention (a resolver.js sibling of ikey.json)
and resolves the destination by precedence: env override (test seam) →
resolver.js → static instrumentationKey/collector_url in ikey.json → none.
The power-pages plugin ships a resolver.js that does Artemis geo + cloud-stamp
region routing; that implementation lives entirely in
plugins/power-pages/scripts/lib/telemetry/region/ — the shared library knows
nothing about it.
Mobile Apps also owns its routing implementation. Its custom dispatcher and resolver select a configured regional collector from the prepared project's resolved Power Platform environment. If no valid project cluster is available, the sanitized event remains in the local mirror and transmission is deferred.
What is sent
Every event carries a fixed allowlist enforced by lib/events.js. Field names match the destination Kusto column names (camelCase).
Identity / context (on every event):
pluginName,pluginVersion— read from the plugin's.claude-plugin/plugin.jsonsessionId— random UUID generated once per Node process; not persistedcorrelationId— a per-start unique ID generated inline at emit timeosName,osVersion—process.platformand OS release stringnodeVersion— major version only, e.g.v22
PAC + agent (when available, otherwise omitted):
orgId,tenantId— Dataverse org GUID and Entra tenant GUID, read frompac auth whoif the user is signed in. Power Pages and Power Automate hooks useorgIdfor organization-based region routing; Model Apps and PCF can include both fields. Mobile Apps excludes both and routes from its prepared project environment instead. Power Automate core MCP/CLI events can include a tenant GUID fromFLOWAGENT_TENANT_ID, but not an organization ID.pacCliVersion— semver frompac --versionaiAgentName,aiAgentVersion— host AI agent detected via env in the hook process before the detached dispatcher is spawned. Claude Code (CLAUDECODE=1) reportsClaude Codewith the version read from its installedpackage.jsonviaCLAUDE_CODE_EXECPATH; thatpackage.jsononly exists for npm-global installs, so when it can't be read (e.g. the native installer's standalone binary) the version falls back to the dotted semver parsed out ofAI_AGENT(claude-code_<maj>-<min>-<patch>_agent), which Claude Code sets regardless of install method. GitHub Copilot CLI (COPILOT_CLI=1) reportsCopilot CLIwith the version fromCOPILOT_CLI_BINARY_VERSIONorCOPILOT_CLI_VERSION. Codex, OpenCode, Hermes, and OpenClaw are detected from their agent-specific env flags/version variables (CODEX_*,OPENCODE_*,HERMES_*,OPENCLAW_*) or fromAI_AGENTwhen it includes a recognizable agent name. ExplicitAI_AGENT_NAME/AI_AGENT_VERSIONenv vars override detection (used for testing); whenAI_AGENT_NAMEis set butAI_AGENT_VERSIONis empty, the version is backfilled from whichever detector matches.
Per-event:
skillName(on every event)eventInfo— caller-supplied JSON object (dynamic Kusto column). Approved plugin schemas are:Power Pages
aadObjectId— the signed-in user's stable Entra ID / AAD directory object ID, parsed frompac auth who, when available. Omitted whenpac auth whodoes not surface an object ID.framework— the SPA framework of the Power Pages code site the skill is running against, drawn from the closed setreact,vue,angular,astro. Omitted unless the working directory resolves to a site with apowerpages.config.json.auditPermissions— present only on theaudit_permissions_run_completedevent, emitted once peraudit-permissionsrun when it produces its HTML report or reaches a controlled failure. It is built by a deterministic allowlist-only emitter (plugins/power-pages/scripts/emit-audit-permissions-telemetry.js) and must pass a closed outbound gate (plugins/power-pages/scripts/lib/audit-telemetry-gate.js) immediately before dispatch; raw report values are never copied into it. Every string is a fixed enum value or a random UUID v4, and every number is a bounded count, score, or version.- Always:
schemaVersion(1),auditRunId(random per-run UUID v4, not derived from any site, user, or environment value), andreportGenerated(boolean). - Success (
outcome: success,reportGenerated: true, recorded only after the final HTML report passes semantic validation):scoringStatus(complete|partial),verdict(safe_to_go|needs_revision|not_scored),majorIssueCount,minorIssueCount,totalIssueCount,categories(overExposure,underExposure,correctness, each{ major, minor }),dimensions(intentCoverage,privilegeCalibration,scopeCorrectness,roleCompleteness,tableCoverage,anonymousAccessHygiene,dataModelAlignment,internalConsistency,securityPosture, each{ major, minor }),majorRootCauses(permissions,mixed,dataModel,webApiCode,webApiSettings, each a count), and, when scoring is complete,scores(overExposure,underExposure,correctness, each 1–5). - Failure (
outcome: failure,reportGenerated: false):failureStageonly, one ofsite_verification,configuration_gathering,schema_validation,relationship_discovery,audit_checks,scoring,root_cause_attribution,report_rendering,report_validation,metrics_validation, orunknown_controlled_failure.
The completion event also carries the top-level
outcomeanddurationMsfields. It deliberately omitsorgId,tenantId,aadObjectId, andframework, so it routes to the configured default region, and it never includes site, environment, table, role, permission, path, finding, or report text.- Always:
Each key is omitted independently when its source is unavailable;
eventInfoitself is omitted only when every key would be absent.Power Automate
- Hook
aadObjectId— the signed-in user's Entra object ID, when PAC exposes it. - Its separate core MCP/CLI event schema records tool/command identity, outcome, duration, error class/code, random session/correlation IDs, system/agent versions and environment GUID/location/region. Core events do not carry organization or Entra user object IDs. See the plugin's bundled telemetry guide for the separate routing and log-retention rules.
Mobile Apps
invocationSource— one ofprompt,pretool, orcheckpoint.appInstanceId— a random per-project UUID, ornulloutside a prepared project.additionalInfo— optional author-defined checkpoint metadata, restricted tosnake_caseand at most 64 characters.appInsightsSelection—enabledordisabled, emitted by the/setup-app-insightsskill.
Mobile Apps does not add Dataverse organization or tenant IDs, or an Entra user object ID.
Model Apps and PCF (
skill_completedonly)Sent by the scripts that change an environment when they finish: the model-apps app build (
app-builder) and page upload (genpage), and the pcf control push (pcf). Built byscripts/lib/telemetry/skill-completed.js(pcf carries a verbatim copy), whose allowlist drops every key and value not listed here:schemaVersion(1) andoperation—app-build,page-uploadorcontrol-push.- App build:
scope(full,stagedfor a--stage/--only/--skip/--from/--torun,changed-only),publish(boolean),verify(passed,failed,not-run), andsteps— for each build phase that ran,{ ok, skip, error }step counts (okcreated or changed,skipalready present). Phase names are the engine's fixed set (solution,data-model,views,forms,app-shell,pages,publish, …), never a table, form, view or app name. - Page upload:
page(created,updated,unchanged),placedInAppandaddedToSolution(booleans). - Control push:
incremental(boolean),registration(verified,not-verified,skipped) andsteps.push. - On a failure,
haltPhase(one of the phase names above, orpreflight/push), with the top-levelerrorClassone ofauth,invalid-input,locked,halted,verify-failed,deploy-failed,timeoutorunexpected.
The completion event also carries the top-level
outcomeanddurationMs. ItsorgIdandtenantIdare those of the environment the script targeted — the organization from oneWhoAmIrequest (three-second budget) and the tenant from thetidclaim of the Azure CLI token that request was accepted with — not PAC's active profile; no user claim is read. If theWhoAmIis refused, fails or times out, neither ID is sent. A user who opted out of transmission gets no lookup, so their local mirror records the event without those two IDs. The event's routing cloud is read from the environment's host, and a host outside the known Dataverse families is not transmitted. Scripts run outside the hooks that see the agent's session, so each completion carries its own randomsessionId.The shared dispatcher used by Power Pages and Model Apps sends
eventInfoas a JSON string (re-serialized byemit-dispatcher.js, not the local mirror) because the tenant-side field mapping flattensdata.<key>to a singledata_<key>leaf and does not recurse into nested objects. The Kusto side mustparse_json()/todynamic()it back into a dynamic value. The Mobile Apps custom dispatcher serializes the sanitized event fields into the Power Appseventstream'scustomDimensions; its local mirror also keeps the structured object.FIELD_TYPESenforces only thateventInfois a structured JSON value; it does not enforce nested keys. Callers MUST restrict it to the documented schemas above. Power Pagesframeworkis restricted to its closed set and describes only the scaffold, not a user, project, or site. Mobile AppsappInstanceIdis randomly generated and is not derived from an app name, environment, tenant, organization, or user. Model Apps and PCF completion fields are enums, booleans and counts only. Callers MUST NOT add other personal data, prompts, project or site identifiers, paths, URLs, credentials, or arbitrary caller payloads. Any proposed expansion requires review and approval, plus updates to this privacy disclosure, the documented event schema, and tests before code emits the new field.emitSkillStartedFromPrompt(promptText, opts)accepts an optionalopts.eventInfoso a plugin can contribute its own approved keys from theUserPromptSubmithook. It takes either a plain object or a thunk returning one; the thunk is preferred, and is invoked only after the slash-command,disabled, andisProvisionedgates pass — that hook fires on every user prompt, so any real work (filesystem probing, shellouts) must not run on untracked prompts. A thunk that throws contributes nothing and never blocks the event. Non-object values (including arrays) are ignored.
Power Pages additionally emits:
skill_configuredfor approvedcreate-siteandadd-localizationconfiguration. Create-site records framework, canonical content locale, fixed purpose/audience categories, and whether the choice came from the initial request or a prompt. Localization records framework, operation, invocation source, existing-setup flag, mode, canonical default/added/resulting locales, package name/version/selection/verification, andagentversusblanktranslation population.localization_package_validationfor each package-validation attempt. It records intended canonical locales, package/mode selection, validation status, prerelease/unverified flags, and stable failure codes. Raw npm errors, exception messages, and evidence URLs are never included.skill_completedonly for Power Pagesadd-localization. It records outcome, duration, a stable error class on failure, validation outcome, readiness status, configured/unavailable locale counts, and translation method.
Locale telemetry strips private-use (-x-*) and extension sequences before
emission. Private-use-only identifiers are dropped.
What is NEVER sent
File paths, cwd, env vars, site names, site descriptions, page/route/component
names, free-text requirements, Dataverse URLs, stack traces, err.message text,
raw npm errors, evidence URLs, skill arguments, tool inputs, prompt text,
usernames, hostnames, or private-use locale subtags.
The dispatcher runs a defense-in-depth allowlist filter against FIELD_TYPES before serializing, so any top-level field that bypasses the builders is dropped before it reaches the wire. This filter does not inspect nested eventInfo keys; the caller restriction above is part of the telemetry contract.
Privacy posture
- Shipped state is per plugin. The committed
ikey.jsoncontrols whether a plugin is enabled or hard-disabled; see Current adopters. A hard-disabled plugin produces no network or local telemetry side effects. - Enabled plugins are default-on for transmission. There is no first-run
prompt. A plugin that ships
disabled: trueremains hard-off regardless of a user's saved telemetry choice. - Identifiers. Power Pages and Power Automate hooks, Model Apps and PCF can include the Dataverse organization GUID (
orgId) and Entra tenant GUID (tenantId) when PAC is signed in. Power Pages and Power Automate hooks can also include the signed-in user's Entra object ID (eventInfo.aadObjectId) when PAC exposes it. Power Automate core MCP/CLI events can include a tenant GUID and environment GUID/location/region, but not organization or Entra user object IDs. Mobile Apps excludes all three identity fields. The local diagnostic mirror retains the same fields as the event produced by each plugin. - Authenticated scenario. When an adopter has the authentication or project-environment context required by its routing implementation, the resolved cloud and geo select the corresponding configured regional collector. Depending on the adopter's documented schema, the transmitted event may include End User Pseudonymous Information (EUPI) or Organization Identifiable Information (OII).
- Unauthenticated or unresolved scenario. Hook identity fields derived from PAC are absent when PAC provides no authentication context. Power Automate core tenant metadata, if supplied separately, does not depend on PAC. Destination behavior when routing context is unavailable is adopter-specific: configurations with a default region use that configured destination, while configurations that require a resolved project cluster retain the event in the local mirror and do not transmit it until a valid cluster is available. Power Automate hooks additionally require positively identified public cloud; its core events require a recognized environment location and positively identified commercial cloud. The event can still contain the allowlisted operational and system metadata and separately documented non-identity plugin-specific fields.
- Opt out of transmission via
/<plugin>:telemetry off(per-user, per-plugin). This writestelemetry[<plugin>] = "off"into~/.power-platform-skills/config.jsonand stops the network POST to the collector — nothing leaves the machine — but the local diagnostic mirror (a per-sessionevents.jsonl) is still written so the user/developer can see exactly what would have been sent. It is therefore an opt-out of transmission, not of local logging. CI/headless can opt out by writing that file directly. Re-enable with/<plugin>:telemetry on. - Opt out for automation via the per-plugin opt-out env var
POWER_PLATFORM_SKILLS_TELEMETRY_<PLUGIN>_OPTOUT(e.g.POWER_PLATFORM_SKILLS_TELEMETRY_POWER_PAGES_OPTOUT=1). Set it to1ortrue(the dotnet*_TELEMETRY_OPTOUTconvention) to disable transmission; it only disables, never re-enables. It has the highest precedence — it overrides a persistedconfig.jsonchoice and/<plugin>:telemetry on. The dispatcher reads it inside the transmission gate, after the local mirror is written, so it suppresses transmission only — the local mirror is still written. - Repo-side kill switch (true hard-off).
ikey.jsoncarries adisabledflag. Whentrue(or whenikey.jsonis missing/unreadable), every entry point — hooks,emit-from-prompt, and the dispatcher — short-circuits BEFORE any PAC shellout or process spawn, so there is no POST and no local log. Shiptrueand flip tofalseonly after the tenant-side Kusto stream and annotation are provisioned.
The disabled flag is checked at every layer that could perform user-facing work: the pretool/posttool hooks and emit-from-prompt.js. A disabled plugin emits zero side effects. The per-plugin user opt-out, by contrast, is enforced inside the detached dispatcher AFTER the local mirror is written — so an opted-out run still produces the session's events.jsonl (and incurs the same event-building cost as an enabled run) but never transmits.
Layout
shared/telemetry/
├─ ikey.json # placeholder template config (each plugin keeps its own real ikey.json)
├─ lib/
│ ├─ events.js # FIELD_TYPES allowlist + event builders
│ ├─ emit-spawn.js # fireAndForget — spawn detached dispatcher
│ ├─ emit-dispatcher.js # detached child — kill switches, opt-out, destination resolve (resolver.js or static key), sanitize, POST
│ ├─ emit-from-prompt.js # UserPromptSubmit hook helper — detect slash command + emit skill_started
│ ├─ resolver-loader.js # discovers an optional plugin resolver.js next to ikey.json
│ ├─ user-config.js # reads/writes the per-plugin telemetry opt-out in config.json
│ ├─ telemetry-config.js # CLI behind /<plugin>:telemetry on|off|status
│ ├─ pac-auth.js # parses `pac auth who` for orgId / tenantId / cloud
│ ├─ agent-info.js # detects AI agent host + reads `pac --version`
│ ├─ session.js # per-process session UUID
│ ├─ prompt-detector.js # parses `/plugin:skill` slash commands from prompt text
│ ├─ scrubber.js # legacy text-scrubbing helper (unused by default — kept for callers that need it)
│ └─ local-log.js # appends every emitted event to ~/.power-platform-skills/telemetry/<plugin>/sessions/<sessionId>/events.jsonl (irrespective of iKey), with 14-day session retention and a 10 MB per-session rollover
└─ tests/ # node:test coverage for every module above; CI: .github/workflows/shared-telemetry-tests.yml
Adopting in a new plugin
These steps assume your plugin already lives under plugins/<your-plugin>/ with a .claude-plugin/plugin.json and hooks/hooks.json.
1. Copy the library
Copy shared/telemetry/lib into plugins/<your-plugin>/scripts/lib/telemetry/lib.
Use a physical directory, not a Git symlink. Some Windows checkouts and plugin hosts materialize symlinks as plain link files, which makes hook-time require() calls fail before the dispatcher can write the local diagnostic log. Any recursive copy command is fine; examples:
$target = "plugins/<your-plugin>/scripts/lib/telemetry/lib"
Remove-Item -LiteralPath $target -Recurse -Force -ErrorAction SilentlyContinue
Copy-Item -LiteralPath "shared/telemetry/lib" -Destination $target -Recurse -Force
target="plugins/<your-plugin>/scripts/lib/telemetry/lib"
rm -rf "$target"
mkdir -p "$(dirname "$target")"
cp -R shared/telemetry/lib "$target"
Now scripts/lib/telemetry/lib is self-contained inside the plugin directory. Commit the copied files together with any shared library change.
2. Configure ikey.json
Create plugins/<your-plugin>/scripts/lib/telemetry/ikey.json as a real file (it carries this plugin's config, distinct from shared/'s placeholder).
Tier 1 — one static key (no routing). Create a flat
plugins/<your-plugin>/scripts/lib/telemetry/ikey.json:
{
"instrumentationKey": "<your 1DS instrumentation key>",
"collector_url": "https://<region>-mobile.events.data.microsoft.com/OneCollector/1.0/",
"event_stream_name": "<your Kusto stream / annotation name>",
"disabled": true
}
No resolver needed — the dispatcher uses the static instrumentationKey / collector_url.
Tier 2 — bring your own routing. Shape ikey.json however your resolver wants,
and drop a resolver.js next to it implementing resolve() (and optionally
isProvisioned()). The dispatcher auto-discovers and calls it; the shared library
is never touched. (Power-pages is the reference example: see
plugins/power-pages/scripts/lib/telemetry/resolver.js + region/.)
Ship with disabled: true until the tenant-side annotation, Kusto table, and
FieldNameMappings are provisioned. Keep it disabled: true for as long as the plugin is
unprovisioned; once the tenant-side stream is live you flip it to disabled: false and the
committed ikey.json ships enabled (as power-pages does — see the CI opt-out guidance in
the repo-root AGENTS.md).
Provision a fresh key — never copy another plugin's outside the sanctioned pair. The sole exception is Model Apps + PCF: PCF ships a byte-identical Model Apps config on the same tenant, enforced by validate-plugin-copies.js and the key validator's SHARED_KEY_GROUPS; no outsider may share those keys. Your ikey.json must otherwise carry
this plugin's own instrumentation key(s) and event_stream_name. Do not lift another
adopter's ikey.json (e.g. power-pages') wholesale — that mis-attributes your events to
their Kusto stream. This is CI-enforced by scripts/validate-telemetry-ikeys.js (run in
the validate-repository-metadata workflow), which fails on key reuse outside that pair
or cross-plugin reuse of any stream name other than the shared event stream. Run it locally after editing
ikey.json:
node scripts/validate-telemetry-ikeys.js
3. Register hooks
In plugins/<your-plugin>/hooks/hooks.json, register the three hook scripts that ship with this library pattern. The Power Pages plugin's hooks.json is the reference example. Copy these three hook entry points into your hooks/ directory:
run-skill-pretool-telemetry.js— emitsskill_startedonPreToolUse(Skill)run-skill-posttool-validation.js— runs your validator onPostToolUse(Skill)run-user-prompt-telemetry.js— emitsskill_startedonUserPromptSubmitwhen the prompt is a tracked/plugin:skillslash command
These hooks must call out to your plugin's scripts/lib/<plugin>-hook-utils.js for the tracked-skill list, and pass ikeyJsonPath (the plugin's own ikey.json) into fireAndForget so the dispatcher reads the plugin's config rather than shared/'s placeholder. Adapt the imports to your plugin's layout.
4. Verify locally
Run the plugin's test suite:
node --test plugins/<your-plugin>/scripts/tests/*.test.js
Then invoke one of your tracked skills with disabled: true and confirm via Claude Code's hook logs that no telemetry-related work happens. With disabled: false and a real iKey, set POWER_PLATFORM_SKILLS_FAKE_HTTPS=/tmp/probe.json and verify the probe file is written with the expected envelope shape.
Updating the shared library
Edit shared/telemetry/lib/ directly, then refresh each adopting plugin's copied scripts/lib/telemetry/lib directory from it in the same change.
Each plugin's ikey.json is separate, so refreshing the copied library must not overwrite a plugin's provisioned key.
If you change the wire-level shape (envelope, transport, allowlist), refresh every adopting plugin copy, bump as needed, and validate accordingly.
Strict allowlist
shared/telemetry/lib/events.js enforces exactly the fields documented above. Never add a field to a builder without:
- Adding it to
FIELD_TYPESinevents.js - Adding the corresponding column to the Kusto stream / annotation
- Updating this README's "What is sent" section
Test seams
Every module exposes injectable test seams via opts._xxx properties so tests run hermetically (no real network, no real PAC shellouts):
pac-auth.js—opts._execswapsexecFileSyncagent-info.js—opts._execswapsexecFileSyncemit-from-prompt.js—opts._emit,opts._readPacAuth,opts._readAgentInfoemit-dispatcher.js—POWER_PLATFORM_SKILLS_FAKE_HTTPSenv var captures the would-be POST to a probe file;POWER_PLATFORM_SKILLS_IKEY/POWER_PLATFORM_SKILLS_COLLECTORbypass resolver.js / static-key resolutionsession.js—_resetCache()clears the per-process session-id cache between tests;getSessionId(override)accepts an explicit id (no filesystem state to redirect)
Follow this pattern for any new module.