copilot-cost-collection
Copilot OTel cost collection setup and interpretation guidance. Use when enabling local Copilot Chat OTel file export, installing the workspace sentinel, or explaining branch-correlated Copilot cost telemetry. DO NOT USE FOR: Claude-native cost capture, durable session memory handoff, review-pipeline scoring logic, or session-cost discipline behavior rules (see skills/terminal-hygiene/SKILL.md § Session-Cost Discipline).
- License 许可
- MIT
- 最近更新
- 2026-08-16
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- copilot-cost-collection
- description
- Copilot OTel cost collection setup and interpretation guidance. Use when enabling local Copilot Chat OTel file export, installing the workspace sentinel, or explaining branch-correlated Copilot cost telemetry. DO NOT USE FOR: Claude-native cost capture, durable session memory handoff, review-pipeline scoring logic, or session-cost discipline behavior rules (see skills/terminal-hygiene/SKILL.md § Session-Cost Discipline).
02 资源文件 3
- 参考文档platforms/claude.md1.1 KB
- 参考文档platforms/copilot.md1.4 KB
- 脚本scripts/Initialize-CopilotCostCollection.ps113.5 KB
03 SKILL.md 正文
Copilot Cost Collection
This skill documents the machine-local setup needed for Copilot-side cost telemetry in Agent Orchestra. It pairs the Copilot Chat OTel file exporter with the cost walker that attributes sessions to the active branch by joining OTel session timestamps to the git reflog.
Methodology
- Enable Copilot Chat OTel export to a local file.
- Write a literal workspace-specific
github.copilot.chat.otel.outfilepath. Do not rely on VS Code variable templates for this setting; issue #488 OQ1 showed the exporter did not expand them in this environment. - Keep setup state machine-local: user settings, workspace
.vscode/settings.json, the OTel JSONL directory, and.copilot-cost-collection-installedare local operating state, not durable plan or session memory. - Let the cost walker correlate sessions to branches from the git reflog. Branch switches, detached checkouts, and reflog pruning can reduce attribution confidence.
Install Contract
Run the installer from the repo root or pass -WorkspacePath explicitly:
pwsh -NoProfile -ExecutionPolicy Bypass -File skills/copilot-cost-collection/scripts/Initialize-CopilotCostCollection.ps1 -WorkspacePath . -Yes -NonInteractive
The installer is additive and idempotent:
- VS Code user settings: sets
github.copilot.chat.otel.enabled=true,github.copilot.chat.otel.exporterType="file", andgithub.copilot.chat.otel.captureContent=falsewhile preserving other keys. - Workspace settings: sets
github.copilot.chat.otel.outfileto a literal path shaped like<UserHome>/.copilot-otel/<workspaceFolderBasename>/copilot.jsonl. - Workspace root: writes
.copilot-cost-collection-installedwith provenance fields and keeps it ignored by git. - OTel directory: creates the parent directory for the JSONL file but does not create the JSONL file.
Use -UserSettingsPath for VS Code profiles, Insiders, portable installs, or any alternate user-data directory. The default targets stable VS Code user settings for the current OS.
Branch Correlation Rules
Copilot OTel records do not carry a repository branch. The walker groups token-bearing records by session.id, uses the earliest session timestamp, and joins that timestamp to the git reflog window for the target branch.
Known limitations:
- Multi-worktree or cross-checkout sessions can be ambiguous when the same OTel file receives events from more than one workspace.
- Reflog pruning, manual reflog expiry, or missing checkout entries can make old sessions unattributable.
- A long Copilot session that spans a branch switch is attributed by session start time, not by every later token event.
Machine-Local State
Survival: within-worktree; contract: SMC-08 style local setup note, not a durable phase-completion marker.
The sentinel and settings prove local install provenance only. Do not treat them as plan state, review state, CE evidence, or cross-tool durable handoff. Durable workflow state still belongs in GitHub issue comments, PR bodies, committed docs, or the session-memory mechanisms named by skills/session-memory-contract/SKILL.md.
Platform-specific invocation
This skill's methodology is tool-agnostic. Platform-specific setup notes live alongside:
- Copilot: platforms/copilot.md
- Claude Code: platforms/claude.md
Related
- scripts/Initialize-CopilotCostCollection.ps1
.github/scripts/lib/cost-walker-copilot.ps1- Documents/Design/copilot-otel-capability.md
Gotchas
| Trigger | Gotcha | Fix |
|---|---|---|
Writing ${userHome} or ${workspaceFolderBasename} into github.copilot.chat.otel.outfile |
Copilot Chat file export may treat the template as a literal and never create the expected JSONL file | Run the installer so the workspace setting receives a literal resolved path |
| Opening the repo in VS Code Insiders, a profile, or a portable user-data dir | The default user settings path may update stable VS Code instead of the active profile | Re-run with -UserSettingsPath pointing at the active settings.json |
Treating .copilot-cost-collection-installed as workflow memory |
The sentinel is local and uncommitted, so other machines and agents cannot rely on it | Use SMC durable markers or PR-body metrics for cross-session handoff |
Frame Ports Filled By This Skill
None. This is setup methodology only. The Step 9 implementation slice provides implement-code through Code-Smith; this skill declares no provides: field.
04 同仓库更多 Skills
webapp-testing
Playwright end-to-end testing guidance for web apps, with practical patterns and setup steps. Use when creating or improving browser-based E2E coverage, test stability, and CI execution. DO NOT USE FOR: React component tests (use ui-testing), canvas game interaction (use browser-canvas-testing), TDD workflow (use test-driven-development), debugging failures (use systematic-debugging), or randomized property tests (use property-based-testing).
verification-before-completion
Evidence-based verification checklist before marking work complete. Use before PRs, releases, marking tickets done, or any "I'm finished" declaration; also when naming a baseline commit for a differential suite claim, when designing a mutation campaign or red-run evidence, when making an absence claim, a universal claim, or a one-time demonstration offered as a standing guarantee, when attributing a measurement or claiming a sweep or verification loop is complete, and when stating what a check or a CI suite will do about a change. DO NOT USE FOR: post-merge cleanup or archival (use post-pr-review) or processing GitHub review comments (use code-review-intake).
validation-methodology
Reusable validation and review methodology for staged validation, failure triage, and prosecution-depth setup. Use when running validation ladders, triaging failures, or executing adversarial review passes. DO NOT USE FOR: CE Gate orchestration, specialist dispatch ownership, or step execution flow (keep those in Code-Conductor).
upstream-onboarding
Shared opening-phase protocol for upstream agents (Experience-Owner, Solution-Designer, Issue-Planner) and Code-Conductor when invoked on an existing GitHub issue. Renders a scaled context brief and runs a standards check on inherited work at each phase boundary. Use when a user-invocable agent receives a request referencing an existing GitHub issue and must load solution-authoring and upstream-onboarding at the opening phase. DO NOT USE FOR: subagent dispatches (which already operate within an assessed session context); post-merge review (use post-pr-review); research or non-tree subagents.
ui-testing
Resilient React component testing strategies focusing on user behavior. Use when writing or reviewing component-level React tests, fixing flaky component tests, or establishing React testing patterns. DO NOT USE FOR: Playwright E2E tests (use webapp-testing), canvas game interaction (use browser-canvas-testing), TDD workflow (use test-driven-development), debugging failures (use systematic-debugging), UI component design (use frontend-design), or randomized property tests (use property-based-testing).
ui-iteration
Reusable screenshot-driven UI polish workflow for iterative visual refinement. Use when improving layout, hierarchy, spacing, feedback, or Tailwind-based presentation through repeated review-and-adjust passes. DO NOT USE FOR: functional bug fixing, accessibility-only audits, or major redesign strategy work (use Code-Smith or frontend-design).