Repository navigation
Report GitHub Copilot usage with --source copilot|all - #2
Merged
Merged
Conversation
A new loader (src/copilot.mjs) reads the Copilot CLI's session logs (~/.copilot/session-state/<id>/events.jsonl, also written by Copilot's agent in VS Code) into the same records as the Claude Code loader, so every report works on them. --source all combines both products; the default stays claude. - Tokens: per request from session.usage_record where logged, else the per-run totals of session.shutdown (counted as that many requests, with no context size). Copilot's input includes cached tokens; they are subtracted to match Claude's columns. - Cost: what Copilot billed in AI credits (1 AIU = $0.01); unbilled Claude models are priced at API rates (dotted names like claude-sonnet-4.6 now resolve). The summary lists premium requests. - Tokens per tool are estimated as for Claude Code, then scaled down to at most each session's input, and get a matching share of its billed cost. - Tools keep Copilot's names; MCP tools become mcp__<server>__<tool>, task calls are subagent launches, shell commands are broken down, PRs come from gh pr create / create_pull_request output. - Recommendations run the same checks with Copilot's own advice (copilot-instructions.md, custom agents, explore agent, /compact, plan mode, autopilot); with --source all each product gets its own section. - The report skill knows about --source and the Copilot caveats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Adds GitHub Copilot as a second source. A new loader (
src/copilot.mjs) reads the Copilot CLI's session logs (~/.copilot/session-state/<id>/events.jsonl). Copilot's agent in VS Code writes them too. The loader produces the same records as the Claude Code loader, so every report works on them, including adoption and recommendations.The default stays
--source claude, so existing reports don't change. Claude recommendations are identical tomain. Session totals differ only by 1-token rounding from the live session's transcript.How Copilot's logs map onto the reports
session.usage_recordwhere Copilot logs it (recent versions). Otherwise from the per-run totals insession.shutdown, which count as that many requests and have no context size. Copilot's input count includes cached tokens, so they are subtracted.claude-sonnet-4.6now resolve. GPT and local models without credits show as unpriced. The summary lists premium requests.mcp__<server>__<tool>, andtaskcalls count as subagent launches.-xbreaks downpowershell/bashcommands. PRs are found ingh pr createandcreate_pull_requestoutput.copilot-instructions.md/AGENTS.md, custom agents, theexploreagent,/compact, plan mode, autopilot. The cheaper-subagent-model check is skipped. With--source all, each product gets its own section.--sourceand the Copilot caveats.Shared changes
aggregate.mjs: uses a record's billed cost when it has one, plus request counts and premium requests.attribution.mjs: tolerates requests whose context size is unknown.adoption.mjs: edit and web flags, Copilot surfaces.report.mjs,formats.mjs: product name in titles, cost note in the HTML header.Known limits
chatSessionslogs aren't read.Before release
Check the Copilot advice that couldn't be confirmed from logs:
/context,/mcp,.github/skillsand.github/agents.Tests
npm test: 44 pass.test/copilot.test.mjscovers the loader, cost and request aggregation, merging sources, and the Copilot recommendations.🤖 Generated with Claude Code