Copilot 成本遥测收集配置
copilot-cost-collection
Copilot OTel 成本收集的设置与解读指南。用于启用本地 Copilot Chat 的 OTel 文件导出、安装工作区 sentinel,或解释与分支相关的 Copilot 成本遥测。请勿用于:Claude 原生成本捕获、持久会话记忆交接、审查管线评分逻辑,或会话成本纪律行为规则(见 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
Playwright 端到端测试
webapp-testing
面向 Web 应用的 Playwright 端到端测试指南,包含实用模式和设置步骤。在创建或改进基于浏览器的 E2E 覆盖率、测试稳定性和 CI 执行时使用。不要用于:React 组件测试(使用 ui-testing)、Canvas 游戏交互(使用 browser-canvas-testing)、TDD 工作流(使用 test-driven-development)、失败调试(使用 systematic-debugging)或随机化属性测试(使用 property-based-testing)。
任务完成前验证
verification-before-completion
在将工作标记为完成前使用的基于证据的验证清单。适用于提交 PR、发布、将工单标记为完成,或任何「我已完成」的声明之前;也适用于为差异测试套件的主张指定基线提交、设计变异测试活动或红灯运行证据、做出「不存在」的主张、普遍性主张,或将一次性演示作为长期保证提供时、归因某项测量结果或声称某次扫描或验证循环已完成时,以及陈述某项检查或 CI 套件将如何处理某个变更时。不要用于:合并后清理或归档(使用 post-pr-review),或处理 GitHub 审查意见(使用 code-review-intake)。
验证与审查方法论
validation-methodology
用于分阶段验证、故障分诊和追查深度设置的可复用验证与审查方法论。在运行验证阶梯、对失败进行分诊或执行对抗性审查时使用。不要用于:CE Gate 编排、专家派发的职责归属或步骤执行流程(这些保留在 Code-Conductor 中)。
上游智能体接手协议
upstream-onboarding
供上游智能体(Experience-Owner、Solution-Designer、Issue-Planner)与 Code-Conductor 在针对现有 GitHub issue 被调用时使用的共享开场阶段协议。它会生成适配规模的上下文简报,并在每个阶段边界对承接的工作执行标准检查。当用户可调用的智能体收到引用现有 GitHub issue 的请求、且必须在开场阶段加载 solution-authoring 与 upstream-onboarding 时使用。不要用于:子智能体派发(其已在经评估的会话上下文中运行)、合并后审查(使用 post-pr-review)、研究类或非树形子智能体。
React 组件测试策略
ui-testing
以用户行为为核心的弹性 React 组件测试策略。适用于编写或审阅组件级 React 测试、修复不稳定的组件测试,或建立 React 测试模式。不适用于:Playwright E2E 测试(使用 webapp-testing)、canvas 游戏交互(使用 browser-canvas-testing)、TDD 工作流(使用 test-driven-development)、失败调试(使用 systematic-debugging)、UI 组件设计(使用 frontend-design),或随机属性测试(使用 property-based-testing)。
UI 界面视觉迭代优化
ui-iteration
可复用的截图驱动 UI 打磨工作流,用于迭代式视觉优化。适用于通过反复审阅与调整来改进布局、层级、间距、反馈或基于 Tailwind 的呈现效果。不适用于:功能性 Bug 修复、仅针对无障碍的审计,或重大重设计策略工作(使用 Code-Smith 或 frontend-design)。