copilot-session-usage 0.7.7__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/skills/gh-release-notes/SKILL.md +1 -1
  2. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/skills/gh-release-notes/scripts/generate_release_notes.py +12 -10
  3. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/AGENTS.md +2 -2
  4. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/CONSTITUTION.md +2 -2
  5. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/PKG-INFO +95 -7
  6. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/README.md +94 -6
  7. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/articles/presentation.md +17 -6
  8. copilot_session_usage-0.8.0/docs/source/explanation/how-cost-estimation-works.md +309 -0
  9. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/how-to/analyze-specific-session.md +34 -0
  10. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/how-to/batch-and-spending.md +36 -18
  11. copilot_session_usage-0.8.0/docs/source/how-to/copilot-cli-provider.md +146 -0
  12. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/how-to/index.md +1 -0
  13. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/index.md +12 -9
  14. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/tutorials/getting-started.md +29 -0
  15. copilot_session_usage-0.8.0/guidelines.yml +6 -0
  16. copilot_session_usage-0.8.0/knowledge/concepts/copilot-cli.md +51 -0
  17. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/concepts/index.md +1 -1
  18. copilot_session_usage-0.8.0/knowledge/log.md +9 -0
  19. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/skills/copilot-session-usage/SKILL.md +77 -7
  20. copilot_session_usage-0.8.0/skills/copilot-session-usage/references/span-analysis-template.md +105 -0
  21. copilot_session_usage-0.8.0/src/copilot_session_usage/_internal/copilot_cli.py +963 -0
  22. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/_internal/core.py +379 -91
  23. copilot_session_usage-0.8.0/src/copilot_session_usage/api.py +457 -0
  24. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/cli.py +350 -88
  25. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/data/models-and-pricing.lock +3 -3
  26. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/data/models-and-pricing.yml +50 -74
  27. copilot_session_usage-0.8.0/tests/conftest.py +175 -0
  28. copilot_session_usage-0.8.0/tests/test_api.py +587 -0
  29. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_cli.py +371 -7
  30. copilot_session_usage-0.8.0/tests/test_copilot_cli.py +1016 -0
  31. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_core.py +270 -0
  32. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_generate_release_notes.py +50 -0
  33. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_rendering.py +157 -0
  34. copilot_session_usage-0.7.7/docs/source/explanation/how-cost-estimation-works.md +0 -167
  35. copilot_session_usage-0.7.7/knowledge/concepts/copilot-cli.md +0 -51
  36. copilot_session_usage-0.7.7/knowledge/log.md +0 -3
  37. copilot_session_usage-0.7.7/src/copilot_session_usage/_internal/copilot_cli.py +0 -18
  38. copilot_session_usage-0.7.7/src/copilot_session_usage/api.py +0 -286
  39. copilot_session_usage-0.7.7/tests/conftest.py +0 -24
  40. copilot_session_usage-0.7.7/tests/test_api.py +0 -256
  41. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.editorconfig +0 -0
  42. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.gitattributes +0 -0
  43. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  44. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  45. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/changes/requests/skill-breakdown/01-request.md +0 -0
  46. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/guidelines/git-commit-message.guideline.md +0 -0
  47. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/guidelines/knowledge-base.guidelines.md +0 -0
  48. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/pull_request_template.md +0 -0
  49. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/skills/consolidate-knowledge-base/SKILL.md +0 -0
  50. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/skills/gh-commit-changes/SKILL.md +0 -0
  51. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/skills/gh-create-pull-request/SKILL.md +0 -0
  52. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/skills/record-finding/SKILL.md +0 -0
  53. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/workflows/ci.yml +0 -0
  54. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/workflows/publish.yml +0 -0
  55. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/workflows/refresh-pricing.yml +0 -0
  56. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/workflows/release-notes.yml +0 -0
  57. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.github/workflows/release.yml +0 -0
  58. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.gitignore +0 -0
  59. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/.readthedocs.yaml +0 -0
  60. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/CHANGELOG.md +0 -0
  61. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/CONTRIBUTING.md +0 -0
  62. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/LICENSE +0 -0
  63. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/internal/automated_release_proces.md +0 -0
  64. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/_static/changelog.js +0 -0
  65. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/_static/custom.css +0 -0
  66. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/changelog.md +0 -0
  67. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/conf.py +0 -0
  68. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/explanation/index.md +0 -0
  69. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/how-to/add-commit-trailer.md +0 -0
  70. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/how-to/export-json.md +0 -0
  71. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/how-to/wsl2.md +0 -0
  72. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/installation.md +0 -0
  73. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/reference/api.md +0 -0
  74. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/reference/cli.md +0 -0
  75. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/reference/index.md +0 -0
  76. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/reference/pricing.md +0 -0
  77. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/docs/source/tutorials/index.md +0 -0
  78. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/justfile +0 -0
  79. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Base.schema.yaml +0 -0
  80. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Concept.schema.yaml +0 -0
  81. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Experiment.schema.yaml +0 -0
  82. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Finding.schema.yaml +0 -0
  83. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Hypothesis.schema.yaml +0 -0
  84. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Outcome.schema.yaml +0 -0
  85. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Playbook.schema.yaml +0 -0
  86. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Principle.schema.yaml +0 -0
  87. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Reference.schema.yaml +0 -0
  88. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/_schema/Structure.schema.yaml +0 -0
  89. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/concepts/overview.md +0 -0
  90. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/concepts/session-cost-analysis.md +0 -0
  91. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/concepts/threshold-based-pricing.md +0 -0
  92. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/experiments/index.md +0 -0
  93. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/experiments/verify-subagent-cost-attribution.md +0 -0
  94. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/2026.07.02-00.00-subagent-logs-runsubagent-prefix.md +0 -0
  95. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/2026.07.02-22.00-title-generation-not-counted-as-model-turn.md +0 -0
  96. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/2026.07.02-23.00-cache-write-approximation.md +0 -0
  97. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/2026.07.13-14.27-release-notes-overreported-maintainer-changes.md +0 -0
  98. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/2026.07.24-15.01-actions-token-cannot-create-pr.md +0 -0
  99. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/2026.08.05-16.24-utility-models-appear-in-logs-but-are-not-billed.md +0 -0
  100. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/findings/index.md +0 -0
  101. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/guides/automation-scripts.md +0 -0
  102. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/guides/cost-optimization.md +0 -0
  103. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/guides/index.md +0 -0
  104. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/guides/wsl2-setup.md +0 -0
  105. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/ideas/index.md +0 -0
  106. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/ideas/multi-session-efficiency-analytics.md +0 -0
  107. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/index.md +0 -0
  108. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/principles/findings-are-immutable.md +0 -0
  109. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/principles/index.md +0 -0
  110. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/reference/debug-log-format.md +0 -0
  111. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/reference/index.md +0 -0
  112. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/reference/pricing-formats.md +0 -0
  113. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/structures/cache-cost-approximation.md +0 -0
  114. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/structures/index.md +0 -0
  115. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/structures/knowledge-base-information-types.md +0 -0
  116. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/structures/session-discovery-algorithm.md +0 -0
  117. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/structures/subagent-cost-tracking.md +0 -0
  118. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/knowledge/structures/vscode-copilot-extension.md +0 -0
  119. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/pyproject.toml +0 -0
  120. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/scripts/refresh_pricing.py +0 -0
  121. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/__init__.py +0 -0
  122. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/_internal/__init__.py +0 -0
  123. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/_internal/git.py +0 -0
  124. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/_internal/vscode.py +0 -0
  125. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/data/__init__.py +0 -0
  126. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/src/copilot_session_usage/data/custom-models-pricing.yml +0 -0
  127. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_coverage_gaps.py +0 -0
  128. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_git.py +0 -0
  129. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_pricing_runtime.py +0 -0
  130. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_release_notes.py +0 -0
  131. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_vscode.py +0 -0
  132. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/tests/test_vscode_platform.py +0 -0
  133. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/uv.lock +0 -0
  134. {copilot_session_usage-0.7.7 → copilot_session_usage-0.8.0}/uv.toml +0 -0
@@ -44,7 +44,7 @@ The skill includes `scripts/generate_release_notes.py`, a standalone Python scri
44
44
  - precomputes the commit log and complete diff locally so generation also works
45
45
  when the Copilot CLI cannot inspect Git history inside its tool environment;
46
46
  - invokes the Copilot CLI with `/gh-release-notes`;
47
- - writes the requested output file; and
47
+ - captures the final Markdown response and writes the requested output file; and
48
48
  - verifies only that the requested output file is readable and non-empty. The
49
49
  script does not normalize Markdown or decide user impact, categorize changes,
50
50
  discover documentation, infer breaking changes, or require examples; those
@@ -90,8 +90,10 @@ def build_prompt(
90
90
  prompt = (
91
91
  f"Use the /{SKILL_NAME} skill. Generate release notes for the exact Git range "
92
92
  f"{from_ref}..{to_ref} in {repo}. The skill is authoritative for analysis, "
93
- f"classification, wording, documentation, and Markdown format. Write only "
94
- f"the final release-note Markdown to {output}; do not summarize it in your response. "
93
+ f"classification, wording, documentation, and Markdown format. Return only "
94
+ f"the final release-note Markdown in your response; the wrapper writes it to {output}. "
95
+ "Do not create or edit the output file through tools, and do not summarize it in "
96
+ "your response. "
95
97
  "Before writing, enforce the skill's final output contract: render every "
96
98
  "documentation URL as concise inline Markdown such as "
97
99
  "See the [pricing reference for details](https://example.com/pricing), never as a "
@@ -126,10 +128,8 @@ def build_copilot_command(
126
128
  "--output-format",
127
129
  "text",
128
130
  "--disable-builtin-mcps",
129
- "--available-tools=read,create,edit,bash",
130
- "--allow-tool=read",
131
- "--allow-tool=write",
132
- "--allow-tool=shell(git:*)",
131
+ "--available-tools=read",
132
+ "--allow-all-tools",
133
133
  ]
134
134
  if model:
135
135
  command.extend(["--model", model])
@@ -203,8 +203,8 @@ def run_copilot(
203
203
  repo: Path,
204
204
  prompt: str,
205
205
  model: str | None,
206
- ) -> None:
207
- """Run Copilot CLI and fail with its captured diagnostics when needed."""
206
+ ) -> str:
207
+ """Run Copilot CLI and return its final response."""
208
208
  result = subprocess.run(
209
209
  build_copilot_command(prompt, model),
210
210
  cwd=repo,
@@ -215,10 +215,11 @@ def run_copilot(
215
215
  if result.returncode != 0:
216
216
  output = f"{result.stdout}\n{result.stderr}".strip()
217
217
  raise RuntimeError(f"Copilot CLI failed with exit code {result.returncode}:\n{output}")
218
+ return result.stdout
218
219
 
219
220
 
220
221
  def validate_output(output: Path) -> None:
221
- """Verify that Copilot created a readable, non-empty output file."""
222
+ """Verify that generated release notes are readable and non-empty."""
222
223
  try:
223
224
  content = output.read_text(encoding="utf-8")
224
225
  except OSError as error:
@@ -247,11 +248,12 @@ def generate_release_notes(
247
248
  require_copilot_token()
248
249
  run_skill_check(repo)
249
250
  git_context = build_git_context(repo, from_ref, to_ref)
250
- run_copilot(
251
+ release_notes = run_copilot(
251
252
  repo,
252
253
  build_prompt(from_ref, to_ref, repo, output, git_context),
253
254
  model,
254
255
  )
256
+ output.write_text(release_notes, encoding="utf-8")
255
257
 
256
258
  validate_output(output)
257
259
  print(f"Release notes written to {output}")
@@ -1,7 +1,7 @@
1
1
  # AGENTS.md — copilot-session-usage
2
2
 
3
3
  `copilot-session-usage` is a PyPI-installable Python package that extracts usage and
4
- cost analytics from local VS Code Copilot and Copilot CLI session logs.
4
+ cost analytics from local VS Code Copilot, Copilot CLI, and Copilot App session logs.
5
5
 
6
6
  Read [`CONSTITUTION.md`](CONSTITUTION.md) before changing code, tests, packaging,
7
7
  release automation, or knowledge. It contains the durable project rules. This file
@@ -37,7 +37,7 @@ src/copilot_session_usage/
37
37
  ├── cli.py Click CLI entry point
38
38
  ├── _internal/core.py Session parsing, cost analysis, and shaping
39
39
  ├── _internal/vscode.py VS Code workspace discovery
40
- ├── _internal/copilot_cli.py Future Copilot CLI provider stub
40
+ ├── _internal/copilot_cli.py Copilot CLI/App discovery and event parsing
41
41
  └── data/ Bundled model and pricing data
42
42
  tests/ Pytest suite
43
43
  scripts/ Maintenance scripts, including pricing refresh
@@ -24,8 +24,8 @@ Python package, usable from automation, and honest about unavailable evidence.
24
24
  - Public API belongs in `src/copilot_session_usage/api.py`; internal implementation
25
25
  belongs under `src/copilot_session_usage/_internal/`.
26
26
  - Public API functions retain the optional `agent` parameter used for provider
27
- routing. The supported provider values are `vscode` and `cli`; the CLI provider
28
- remains explicitly unsupported until implemented.
27
+ routing. The supported provider values are `vscode`, `cli`, and the explicit
28
+ combined mode `all`.
29
29
  - Keep provider discovery separate from parsing, pricing, shaping, and presentation.
30
30
  - Do not expose internal modules as public API merely to avoid a proper API change.
31
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: copilot-session-usage
3
- Version: 0.7.7
3
+ Version: 0.8.0
4
4
  Summary: Usage and cost analytics for GitHub Copilot and Copilot-CLI session logs
5
5
  Project-URL: Homepage, https://github.com/gsemet/copilot-session-usage
6
6
  Project-URL: Documentation, https://copilot-session-usage.readthedocs.io/en/stable/
@@ -27,7 +27,8 @@ Description-Content-Type: text/markdown
27
27
  [![Type checked](https://img.shields.io/badge/type%20checked-mypy%2Fty-blue.svg)](./)
28
28
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
29
29
 
30
- Extract VS Code Copilot session cost KPIs (tokens, estimated USD, model, duration) from local debug logs.
30
+ Extract Copilot session cost KPIs (tokens, estimated USD, model, duration) from local
31
+ VS Code Copilot debug logs and/or local Copilot CLI/Copilot App session logs.
31
32
 
32
33
  **Full documentation:** [copilot-session-usage.readthedocs.io](https://copilot-session-usage.readthedocs.io/en/stable/)
33
34
 
@@ -56,8 +57,8 @@ models without providing a reproducible split of tokens and dollars by model or
56
57
 
57
58
  ### What this project adds
58
59
 
59
- `copilot-session-usage` reads the original VS Code Copilot debug logs and turns them into
60
- repeatable reports. It provides:
60
+ `copilot-session-usage` reads the original VS Code Copilot debug logs and local
61
+ Copilot CLI/App event logs and turns them into repeatable reports. It provides:
61
62
 
62
63
  | Need | Chronicle | `copilot-session-usage` |
63
64
  | --- | --- | --- |
@@ -84,6 +85,38 @@ breakdown for it.
84
85
  Use Chronicle for **“What did I do?”** and use this project for **“How much did it cost,
85
86
  which model or subagent consumed it, and can I export the evidence?”**
86
87
 
88
+ ## Providers
89
+
90
+ `copilot-session-usage` supports two local session sources, selected explicitly
91
+ with `--agent` (default `vscode`):
92
+
93
+ - **`vscode`** (default) — VS Code Copilot Chat debug logs.
94
+ - **`cli`** — Copilot CLI and Copilot App local sessions, stored under
95
+ `~/.copilot/session-state/<session-id>/events.jsonl`. The macOS Copilot App
96
+ runs a bundled Copilot CLI runtime and uses the same session-state layout.
97
+ - **`all`** — an explicit, opt-in combined mode that discovers and
98
+ aggregates sessions from both providers, deduplicated by session UUID.
99
+ Commands never mix providers unless `--agent all` is passed. Missing
100
+ provider roots are ignored, including when both roots are absent.
101
+
102
+ Both providers share the same model catalog, pricing data, cache rules, and
103
+ estimated-USD calculation. Copilot CLI/App sessions additionally expose
104
+ provider-native counters (`provider_usage`: nanoAiu, premium requests) as
105
+ separate fields, and never turn missing evidence (for example, a session that
106
+ has not shut down yet) into a fabricated zero — see `diagnostics` in the
107
+ output when data is unavailable.
108
+
109
+ ```bash
110
+ # Analyze the latest Copilot CLI/App session
111
+ copilot-session-usage --agent cli latest
112
+
113
+ # Analyze a specific Copilot CLI/App session by its session-state directory
114
+ copilot-session-usage --agent cli analyze ~/.copilot/session-state/<uuid>
115
+
116
+ # List and aggregate sessions from both VS Code and Copilot CLI/App
117
+ copilot-session-usage --agent all list --format table
118
+ ```
119
+
87
120
  ## Installation
88
121
 
89
122
  ```bash
@@ -105,6 +138,12 @@ copilot-session-usage list
105
138
  # Batch analyze the last 10 sessions
106
139
  copilot-session-usage batch 10
107
140
 
141
+ # Compact total/model/session report for a date span
142
+ copilot-session-usage --agent all span \
143
+ --since 2026-07-01T00:00:00Z \
144
+ --until 2026-07-08T00:00:00Z \
145
+ --format table
146
+
108
147
  # Aggregate cost across all sessions matching a PRD path
109
148
  copilot-session-usage analyze --name "PRD: /path/to/prd" --aggregate --format table
110
149
 
@@ -118,6 +157,7 @@ copilot-session-usage list --dir /path/to/debug-logs --format table
118
157
  - **Multi-model sessions** — correctly handles sessions that call multiple models (e.g. Claude + Kimi)
119
158
  - **Threshold-aware pricing** — long-context tier switching (e.g. GPT-5.4 > 272k tokens)
120
159
  - **Subagent cost attribution** — tracks `runSubagent` calls and their token usage
160
+ - **VS Code and Copilot CLI/App providers** — `--agent vscode` (default), `--agent cli`, or the opt-in combined `--agent all`
121
161
  - **Cross-platform** — macOS, Linux, Windows, WSL2
122
162
  - **Three output formats** — `json` (default), `table`, `detailed`
123
163
  - **Three detail levels** — `minimal`, `compact`, `full`
@@ -125,7 +165,7 @@ copilot-session-usage list --dir /path/to/debug-logs --format table
125
165
  - **Session filtering** — regex match by name, date-range filtering
126
166
  - **Aggregation** — roll up costs across many sessions in one command
127
167
  - **Skill-aware cost attribution** — detect skills, attribute LLM and tool calls to the active skill
128
- - **Skill cost breakdown** — per-skill token counts and estimated cost
168
+ - **Skill cost breakdown** — per-skill token counts and estimated cost (VS Code provider)
129
169
  - **Tool-call attribution** — per-skill/per-subagent tool-call counts
130
170
  - **Title filtering** — find sessions by title substring
131
171
  - **Efficiency summaries** — cache ratio, model split, cost per 1M tokens
@@ -133,6 +173,8 @@ copilot-session-usage list --dir /path/to/debug-logs --format table
133
173
 
134
174
  ## How it works
135
175
 
176
+ ### VS Code provider (`--agent vscode`, default)
177
+
136
178
  `copilot-session-usage` reads VS Code Copilot debug logs stored in
137
179
  `~/Library/Application Support/Code/User/workspaceStorage/` (macOS),
138
180
  `%APPDATA%\Code\User\workspaceStorage\` (Windows), or
@@ -146,6 +188,44 @@ switching), and estimates the session cost in USD.
146
188
  Subagent calls (`runSubagent`) are tracked separately so you can see how much
147
189
  token usage was delegated to helper agents.
148
190
 
191
+ ### Copilot CLI/App provider (`--agent cli`)
192
+
193
+ Copilot CLI and the Copilot App store one directory per session under
194
+ `~/.copilot/session-state/<session-id>/` (override with `--session-root`).
195
+ Each session directory has a structured `events.jsonl` event log — the
196
+ primary evidence source — plus an optional `workspace.yaml` sidecar with
197
+ title, working directory, git branch, and timestamps.
198
+
199
+ `copilot-session-usage` also accepts an explicit session directory or a
200
+ relocated/exported `events.jsonl` file directly (for example
201
+ `copilot-session-usage --agent cli analyze /path/to/exported/events.jsonl`),
202
+ without requiring auto-discovery. An explicit source is only analyzed when it
203
+ contains recognizable Copilot CLI event records and a canonical session UUID
204
+ can be determined (from the directory name or a `session.start` event) —
205
+ otherwise it is rejected with an actionable error instead of being analyzed
206
+ with a fabricated identity.
207
+
208
+ Per-model token totals and cost come from the session's final
209
+ `session.shutdown` event and use the same shared, token-based pricing
210
+ calculation as the VS Code provider. GitHub Copilot's own `totalNanoAiu`
211
+ billing figure is kept separate under `provider_usage.total_nano_aiu` and
212
+ never substituted into the shared cost calculation. For a session that has
213
+ not shut down yet (still active, or interrupted), only provider-native
214
+ counters from the last usage checkpoint are available; token totals and cost
215
+ are reported as unavailable (`null`) via the shared `total` block, with
216
+ `diagnostics` explaining why, rather than as fabricated zeros. Tool calls and
217
+ skill attribution are scoped to the subagent that made them, using
218
+ `subagent.started`/`subagent.completed` events and each event's `agentId`;
219
+ `provider_usage.subagents` separately preserves the raw per-subagent evidence
220
+ available (name, model, tool-call count, reported tokens, duration). Parsing
221
+ tolerates unrecognized event types and schema versions other than the one
222
+ currently validated, recording a diagnostic instead of failing.
223
+
224
+ Pricing lookups for `--agent cli`/`--agent all` are local-only by default
225
+ (no runtime pricing refresh attempt over the network), unlike the `vscode`
226
+ provider's default daily refresh attempt. Run
227
+ `copilot-session-usage pricing refresh` to update pricing explicitly.
228
+
149
229
  ## Knowledge base
150
230
 
151
231
  This project includes an OKF knowledge bundle in `knowledge/` with structured
@@ -167,6 +247,7 @@ just knowledge-validate
167
247
  | `id SESSION_ID` | Analyze a session by exact UUID |
168
248
  | `list` | List recent sessions (metadata only by default) |
169
249
  | `batch N` | Analyze the N most recent sessions in one pass |
250
+ | `span` | Emit a compact total, per-model, and per-session date-span report |
170
251
  | `skills` | List skills used across sessions with aggregated cost |
171
252
 
172
253
  ### Analysis options
@@ -177,6 +258,7 @@ just knowledge-validate
177
258
  | `--title SUBSTRING` | Filter sessions by title substring (case-insensitive) |
178
259
  | `--since DATE` | Only sessions created after DATE (ISO 8601 with timezone) |
179
260
  | `--until DATE` | Only sessions created before DATE (ISO 8601 with timezone) |
261
+ | `--last DURATION` | Use a rolling window such as `7d`, `24h`, or `30m` with `span` |
180
262
  | `--workspace PATH` | Only sessions from this workspace folder |
181
263
  | `--aggregate` | Aggregate all matching sessions into one summary |
182
264
  | `--summary` | Output a cost-efficiency summary |
@@ -190,8 +272,9 @@ just knowledge-validate
190
272
 
191
273
  | Option | Description |
192
274
  |--------|-------------|
193
- | `--workspace-storage PATH` | Override workspaceStorage directory (auto-detected by default) |
194
- | `--agent {vscode,cli}` | Provider to use (`cli` not yet implemented) |
275
+ | `--workspace-storage PATH` | Override workspaceStorage directory (auto-detected by default). Used by `--agent vscode`/`all` |
276
+ | `--session-root PATH` | Override the Copilot CLI/App session-state root (default: `~/.copilot/session-state`). Used by `--agent cli`/`all` |
277
+ | `--agent {vscode,cli,all}` | Provider for session discovery: `vscode` (default), `cli`, or the explicit opt-in combined mode `all` |
195
278
  | `--detail {minimal,compact,full}` | Detail level (default: `compact`) |
196
279
  | `--format {json,table,detailed}` | Output format (default: `json`) |
197
280
  | `--output PATH` | Write output to file instead of stdout |
@@ -322,6 +405,11 @@ sessions = list_sessions(
322
405
  since="2026-07-01T00:00:00Z",
323
406
  until="2026-07-07T00:00:00Z",
324
407
  )
408
+
409
+ # Analyze a Copilot CLI/App session, or discover/aggregate across all
410
+ # providers with the explicit opt-in agent="all"
411
+ cli_result = analyze_session(Path("~/.copilot/session-state/<uuid>"), agent="cli")
412
+ combined = list_sessions(agent="all")
325
413
  ```
326
414
 
327
415
  ## Development
@@ -9,7 +9,8 @@
9
9
  [![Type checked](https://img.shields.io/badge/type%20checked-mypy%2Fty-blue.svg)](./)
10
10
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
11
 
12
- Extract VS Code Copilot session cost KPIs (tokens, estimated USD, model, duration) from local debug logs.
12
+ Extract Copilot session cost KPIs (tokens, estimated USD, model, duration) from local
13
+ VS Code Copilot debug logs and/or local Copilot CLI/Copilot App session logs.
13
14
 
14
15
  **Full documentation:** [copilot-session-usage.readthedocs.io](https://copilot-session-usage.readthedocs.io/en/stable/)
15
16
 
@@ -38,8 +39,8 @@ models without providing a reproducible split of tokens and dollars by model or
38
39
 
39
40
  ### What this project adds
40
41
 
41
- `copilot-session-usage` reads the original VS Code Copilot debug logs and turns them into
42
- repeatable reports. It provides:
42
+ `copilot-session-usage` reads the original VS Code Copilot debug logs and local
43
+ Copilot CLI/App event logs and turns them into repeatable reports. It provides:
43
44
 
44
45
  | Need | Chronicle | `copilot-session-usage` |
45
46
  | --- | --- | --- |
@@ -66,6 +67,38 @@ breakdown for it.
66
67
  Use Chronicle for **“What did I do?”** and use this project for **“How much did it cost,
67
68
  which model or subagent consumed it, and can I export the evidence?”**
68
69
 
70
+ ## Providers
71
+
72
+ `copilot-session-usage` supports two local session sources, selected explicitly
73
+ with `--agent` (default `vscode`):
74
+
75
+ - **`vscode`** (default) — VS Code Copilot Chat debug logs.
76
+ - **`cli`** — Copilot CLI and Copilot App local sessions, stored under
77
+ `~/.copilot/session-state/<session-id>/events.jsonl`. The macOS Copilot App
78
+ runs a bundled Copilot CLI runtime and uses the same session-state layout.
79
+ - **`all`** — an explicit, opt-in combined mode that discovers and
80
+ aggregates sessions from both providers, deduplicated by session UUID.
81
+ Commands never mix providers unless `--agent all` is passed. Missing
82
+ provider roots are ignored, including when both roots are absent.
83
+
84
+ Both providers share the same model catalog, pricing data, cache rules, and
85
+ estimated-USD calculation. Copilot CLI/App sessions additionally expose
86
+ provider-native counters (`provider_usage`: nanoAiu, premium requests) as
87
+ separate fields, and never turn missing evidence (for example, a session that
88
+ has not shut down yet) into a fabricated zero — see `diagnostics` in the
89
+ output when data is unavailable.
90
+
91
+ ```bash
92
+ # Analyze the latest Copilot CLI/App session
93
+ copilot-session-usage --agent cli latest
94
+
95
+ # Analyze a specific Copilot CLI/App session by its session-state directory
96
+ copilot-session-usage --agent cli analyze ~/.copilot/session-state/<uuid>
97
+
98
+ # List and aggregate sessions from both VS Code and Copilot CLI/App
99
+ copilot-session-usage --agent all list --format table
100
+ ```
101
+
69
102
  ## Installation
70
103
 
71
104
  ```bash
@@ -87,6 +120,12 @@ copilot-session-usage list
87
120
  # Batch analyze the last 10 sessions
88
121
  copilot-session-usage batch 10
89
122
 
123
+ # Compact total/model/session report for a date span
124
+ copilot-session-usage --agent all span \
125
+ --since 2026-07-01T00:00:00Z \
126
+ --until 2026-07-08T00:00:00Z \
127
+ --format table
128
+
90
129
  # Aggregate cost across all sessions matching a PRD path
91
130
  copilot-session-usage analyze --name "PRD: /path/to/prd" --aggregate --format table
92
131
 
@@ -100,6 +139,7 @@ copilot-session-usage list --dir /path/to/debug-logs --format table
100
139
  - **Multi-model sessions** — correctly handles sessions that call multiple models (e.g. Claude + Kimi)
101
140
  - **Threshold-aware pricing** — long-context tier switching (e.g. GPT-5.4 > 272k tokens)
102
141
  - **Subagent cost attribution** — tracks `runSubagent` calls and their token usage
142
+ - **VS Code and Copilot CLI/App providers** — `--agent vscode` (default), `--agent cli`, or the opt-in combined `--agent all`
103
143
  - **Cross-platform** — macOS, Linux, Windows, WSL2
104
144
  - **Three output formats** — `json` (default), `table`, `detailed`
105
145
  - **Three detail levels** — `minimal`, `compact`, `full`
@@ -107,7 +147,7 @@ copilot-session-usage list --dir /path/to/debug-logs --format table
107
147
  - **Session filtering** — regex match by name, date-range filtering
108
148
  - **Aggregation** — roll up costs across many sessions in one command
109
149
  - **Skill-aware cost attribution** — detect skills, attribute LLM and tool calls to the active skill
110
- - **Skill cost breakdown** — per-skill token counts and estimated cost
150
+ - **Skill cost breakdown** — per-skill token counts and estimated cost (VS Code provider)
111
151
  - **Tool-call attribution** — per-skill/per-subagent tool-call counts
112
152
  - **Title filtering** — find sessions by title substring
113
153
  - **Efficiency summaries** — cache ratio, model split, cost per 1M tokens
@@ -115,6 +155,8 @@ copilot-session-usage list --dir /path/to/debug-logs --format table
115
155
 
116
156
  ## How it works
117
157
 
158
+ ### VS Code provider (`--agent vscode`, default)
159
+
118
160
  `copilot-session-usage` reads VS Code Copilot debug logs stored in
119
161
  `~/Library/Application Support/Code/User/workspaceStorage/` (macOS),
120
162
  `%APPDATA%\Code\User\workspaceStorage\` (Windows), or
@@ -128,6 +170,44 @@ switching), and estimates the session cost in USD.
128
170
  Subagent calls (`runSubagent`) are tracked separately so you can see how much
129
171
  token usage was delegated to helper agents.
130
172
 
173
+ ### Copilot CLI/App provider (`--agent cli`)
174
+
175
+ Copilot CLI and the Copilot App store one directory per session under
176
+ `~/.copilot/session-state/<session-id>/` (override with `--session-root`).
177
+ Each session directory has a structured `events.jsonl` event log — the
178
+ primary evidence source — plus an optional `workspace.yaml` sidecar with
179
+ title, working directory, git branch, and timestamps.
180
+
181
+ `copilot-session-usage` also accepts an explicit session directory or a
182
+ relocated/exported `events.jsonl` file directly (for example
183
+ `copilot-session-usage --agent cli analyze /path/to/exported/events.jsonl`),
184
+ without requiring auto-discovery. An explicit source is only analyzed when it
185
+ contains recognizable Copilot CLI event records and a canonical session UUID
186
+ can be determined (from the directory name or a `session.start` event) —
187
+ otherwise it is rejected with an actionable error instead of being analyzed
188
+ with a fabricated identity.
189
+
190
+ Per-model token totals and cost come from the session's final
191
+ `session.shutdown` event and use the same shared, token-based pricing
192
+ calculation as the VS Code provider. GitHub Copilot's own `totalNanoAiu`
193
+ billing figure is kept separate under `provider_usage.total_nano_aiu` and
194
+ never substituted into the shared cost calculation. For a session that has
195
+ not shut down yet (still active, or interrupted), only provider-native
196
+ counters from the last usage checkpoint are available; token totals and cost
197
+ are reported as unavailable (`null`) via the shared `total` block, with
198
+ `diagnostics` explaining why, rather than as fabricated zeros. Tool calls and
199
+ skill attribution are scoped to the subagent that made them, using
200
+ `subagent.started`/`subagent.completed` events and each event's `agentId`;
201
+ `provider_usage.subagents` separately preserves the raw per-subagent evidence
202
+ available (name, model, tool-call count, reported tokens, duration). Parsing
203
+ tolerates unrecognized event types and schema versions other than the one
204
+ currently validated, recording a diagnostic instead of failing.
205
+
206
+ Pricing lookups for `--agent cli`/`--agent all` are local-only by default
207
+ (no runtime pricing refresh attempt over the network), unlike the `vscode`
208
+ provider's default daily refresh attempt. Run
209
+ `copilot-session-usage pricing refresh` to update pricing explicitly.
210
+
131
211
  ## Knowledge base
132
212
 
133
213
  This project includes an OKF knowledge bundle in `knowledge/` with structured
@@ -149,6 +229,7 @@ just knowledge-validate
149
229
  | `id SESSION_ID` | Analyze a session by exact UUID |
150
230
  | `list` | List recent sessions (metadata only by default) |
151
231
  | `batch N` | Analyze the N most recent sessions in one pass |
232
+ | `span` | Emit a compact total, per-model, and per-session date-span report |
152
233
  | `skills` | List skills used across sessions with aggregated cost |
153
234
 
154
235
  ### Analysis options
@@ -159,6 +240,7 @@ just knowledge-validate
159
240
  | `--title SUBSTRING` | Filter sessions by title substring (case-insensitive) |
160
241
  | `--since DATE` | Only sessions created after DATE (ISO 8601 with timezone) |
161
242
  | `--until DATE` | Only sessions created before DATE (ISO 8601 with timezone) |
243
+ | `--last DURATION` | Use a rolling window such as `7d`, `24h`, or `30m` with `span` |
162
244
  | `--workspace PATH` | Only sessions from this workspace folder |
163
245
  | `--aggregate` | Aggregate all matching sessions into one summary |
164
246
  | `--summary` | Output a cost-efficiency summary |
@@ -172,8 +254,9 @@ just knowledge-validate
172
254
 
173
255
  | Option | Description |
174
256
  |--------|-------------|
175
- | `--workspace-storage PATH` | Override workspaceStorage directory (auto-detected by default) |
176
- | `--agent {vscode,cli}` | Provider to use (`cli` not yet implemented) |
257
+ | `--workspace-storage PATH` | Override workspaceStorage directory (auto-detected by default). Used by `--agent vscode`/`all` |
258
+ | `--session-root PATH` | Override the Copilot CLI/App session-state root (default: `~/.copilot/session-state`). Used by `--agent cli`/`all` |
259
+ | `--agent {vscode,cli,all}` | Provider for session discovery: `vscode` (default), `cli`, or the explicit opt-in combined mode `all` |
177
260
  | `--detail {minimal,compact,full}` | Detail level (default: `compact`) |
178
261
  | `--format {json,table,detailed}` | Output format (default: `json`) |
179
262
  | `--output PATH` | Write output to file instead of stdout |
@@ -304,6 +387,11 @@ sessions = list_sessions(
304
387
  since="2026-07-01T00:00:00Z",
305
388
  until="2026-07-07T00:00:00Z",
306
389
  )
390
+
391
+ # Analyze a Copilot CLI/App session, or discover/aggregate across all
392
+ # providers with the explicit opt-in agent="all"
393
+ cli_result = analyze_session(Path("~/.copilot/session-state/<uuid>"), agent="cli")
394
+ combined = list_sessions(agent="all")
307
395
  ```
308
396
 
309
397
  ## Development
@@ -1,12 +1,13 @@
1
1
  ## Title
2
2
 
3
- I built `copilot-session-usage`: inspect the token usage and estimated cost of VS Code Copilot sessions
3
+ I built `copilot-session-usage`: inspect the token usage and estimated cost of VS Code, Copilot CLI, and Copilot App sessions
4
4
 
5
5
  ## Post
6
6
 
7
- I’ve released [`copilot-session-usage`](https://github.com/gsemet/copilot-session-usage), an open-source Python CLI for analyzing VS Code Copilot sessions.
7
+ I’ve released [`copilot-session-usage`](https://github.com/gsemet/copilot-session-usage), an open-source Python CLI for analyzing VS Code Copilot, Copilot CLI, and Copilot App sessions.
8
8
 
9
- VS Code’s UI does not provide a detailed per-session cost report. This tool reads the local Copilot debug logs and reports:
9
+ VS Code and Copilot CLI/App do not provide a detailed per-session cost report.
10
+ This tool reads local Copilot logs and reports:
10
11
 
11
12
  - Input, output, and cached token counts
12
13
  - Models used during a session
@@ -17,13 +18,18 @@ VS Code’s UI does not provide a detailed per-session cost report. This tool re
17
18
  - JSON output for scripts and a Python API for integration
18
19
  - Optional Git commit trailers containing session usage
19
20
 
20
- It supports multi-model sessions, cache-aware pricing, long-context pricing tiers, macOS, Linux, Windows, and WSL2. For Copilot-plan models, it uses the usage value recorded by VS Code when available. For externally billed Azure-hosted models, it falls back to token-based pricing, so reports should be treated as estimates.
21
+ It supports multi-model sessions, cache-aware pricing, long-context pricing tiers,
22
+ macOS, Linux, Windows, and WSL2. The VS Code provider reads workspace debug
23
+ logs; the Copilot CLI/App provider reads local `events.jsonl` session logs.
24
+ For Copilot-plan models, it uses the usage value recorded by VS Code when
25
+ available. For externally billed Azure-hosted models, it falls back to
26
+ token-based pricing, so reports should be treated as estimates.
21
27
 
22
28
 
23
29
  ## What this project adds
24
30
 
25
- `copilot-session-usage` reads the original VS Code Copilot debug logs and turns them into
26
- repeatable reports. It provides:
31
+ `copilot-session-usage` reads the original VS Code Copilot debug logs and local
32
+ Copilot CLI/App event logs and turns them into repeatable reports. It provides:
27
33
 
28
34
  | Need | Chronicle | `copilot-session-usage` |
29
35
  | --- | --- | --- |
@@ -43,6 +49,11 @@ repeatable reports. It provides:
43
49
  | Pricing provenance and custom model rates | ⚠️ Only for aggregated costs | ✅ |
44
50
  | Git commit cost trailers | ❌ | ✅ |
45
51
 
52
+ For CLI/App sessions, provider-native counters are preserved separately from
53
+ shared token-based cost totals. Per-skill cost and validated per-subagent cost
54
+ breakdowns are available only when the source log contains the required
55
+ per-request evidence.
56
+
46
57
  ## Example
47
58
 
48
59
  A typical workflow is simply: