Skip to content

Add My AI Usage canvas extension (chronicle-stats) - #4559

Open
juliamuiruri4 wants to merge 2 commits into
github:mainfrom
juliamuiruri4:add-chronicle-stats-canvas
Open

juliamuiruri4 wants to merge 2 commits into
github:mainfrom
juliamuiruri4:add-chronicle-stats-canvas

Conversation

@juliamuiruri4

Copy link
Copy Markdown

Pull Request Checklist

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have read and followed the Guidance for submissions involving paid services.
  • My contribution adds a new instruction, prompt, agent, skill, workflow, or canvas extension file in the correct directory.
  • The file follows the required naming convention.
  • The content is clearly structured and follows the example format.
  • I have tested my instructions, prompt, agent, skill, workflow, or canvas extension with GitHub Copilot.
  • I have run npm start and verified that README.md is up to date.
  • I am targeting the main branch for this pull request.

Description

Adds My AI Usage (chronicle-stats), a canvas for seeing local Copilot token usage by day, model, and session, with tips to use it more efficiently.

  • Reads the local session store read-only. Insights run through the user's Copilot session.
  • No npm dependencies: Node built-ins (node:sqlite, Node 22.13+) and the host SDK only.
  • markdown.js is a vendored, minified Marked build (notices in LICENSE), so it's added to the .codespellrc skip list.
  • chronicle-stats is the canvas ID and storage path, so the folder and plugin use that name.

Screenshots

My AI Usage overview

My AI Usage activity view


Type of Contribution

  • New canvas extension.

By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 09:23
@juliamuiruri4
juliamuiruri4 requested review from a team as code owners October 6, 2026 09:23
@github-actions github-actions Bot added canvas-extension PR touches canvas extensions new-submission PR adds at least one new contribution plugin PR touches plugins labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔒 PR Risk Scan Results

Scanned 22 changed file(s).

Severity Count
🔴 High 0
🟠 Medium 1
ℹ️ Info 0
Severity Rule File Line Match
🟠 unpinned-version-indicator extensions/chronicle-stats/insight-view.mjs 524 answer.appendChild(el("summary", null, state.showLatestAnswer ? "Your answer" : "Latest saved answer"));
Skipped non-text or missing files
  • extensions/chronicle-stats/assets/activity.png
  • extensions/chronicle-stats/assets/preview.png

This is an automated soft-gate report. Findings indicate review targets and do not block merge by themselves.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🚦 Submission status: 👀 Ready for review

Risk tier: merge-risk:medium — New or substantially changed resource without privileged execution
Required to merge: passing submission-gate checks plus 1 approval from reviewers with write access.

Why this tier
  • Adds 22 file(s), e.g. extensions/chronicle-stats/LICENSE
  • Changes 4300 lines (low-risk limit is 40)

Automated checks

Check Status Details
Line endings ✅ Passed Passed · logs
Spelling ✅ Passed Passed · logs
Generated README consistency ✅ Passed Passed · logs
Plugin and extension validation ✅ Passed Passed · logs
Canvas extension validation ✅ Passed Passed · logs
Plugin structure ✅ Passed Passed · logs
Risk scan ✅ Passed Passed · logs
Contributor reputation ✅ Passed Passed · logs
Duplicate resource scan ✅ Passed Passed · logs
PR quality signal ⏭️ Skipped Skipped by its workflow · logs
Canvas/plugin smoke test ⏭️ Skipped Not reported for this commit

Review

  • Approvals: 0/1
  • Assigned reviewer: not assigned yet — comment /request-review to ask for one
  • Review target date: not set
  • Still needed: 1 more approval(s)
  • No staffed reviewer pool owns these files yet; any reviewer with write access counts as the domain reviewer.

Commands

Command Who What it does
/rerun-checks PR author, maintainers Re-runs failed or incomplete checks and re-evaluates this gate
/request-review PR author, maintainers Asks the review rotation to assign a reviewer (adds needs-reviewer)

Updated for 033b44e · gate run · This comment is maintained automatically — see submission gate docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Scoped coaching omits selected activity values, and two charts lack accessible data equivalents.

Review effort: Balanced
Findings: 3 Medium severity · 3 Low severity

Open (6)
What changed in this PR

Adds the installable My AI Usage canvas for exploring local Copilot usage and generating evidence-based insights.

Changes:

  • Adds local SQLite usage analytics, snapshots, and time handling.
  • Adds an accessible web canvas with usage exploration and coaching.
  • Registers the extension as the chronicle-stats plugin.
File Description
.codespellrc Excludes the vendored Markdown bundle.
.github/​plugin/​marketplace.json Registers the plugin in the marketplace.
docs/​README.plugins.md Adds the generated plugin listing.
plugins/​chronicle-stats/​README.md Provides installation documentation.
plugins/​chronicle-stats/​plugin.json Defines plugin metadata and composition.
extensions/​chronicle-stats/​LICENSE Adds licensing and third-party notices.
extensions/​chronicle-stats/​README.md Documents usage, privacy, and troubleshooting.
extensions/​chronicle-stats/​assets/​activity.png Provides an activity screenshot.
extensions/​chronicle-stats/​assets/​preview.png Provides the marketplace preview.
extensions/​chronicle-stats/​analytics.mjs Aggregates usage metrics and trends.
extensions/​chronicle-stats/​canvas.mjs Defines canvas actions and lifecycle.
extensions/​chronicle-stats/​chronicle.mjs Integrates native Chronicle analysis.
extensions/​chronicle-stats/​copilot-extension.json Declares extension identity.
extensions/​chronicle-stats/​db.mjs Reads the local session database.
extensions/​chronicle-stats/​explorer.mjs Implements usage inspection interactions.
extensions/​chronicle-stats/​extension.mjs Joins the Copilot session.
extensions/​chronicle-stats/​insight-view.mjs Implements insight and experiment views.
extensions/​chronicle-stats/​insights.mjs Persists insights and preferences.
extensions/​chronicle-stats/​markdown.js Vendors the Markdown lexer.
extensions/​chronicle-stats/​renderer.mjs Renders the canvas dashboard.
extensions/​chronicle-stats/​schemas.mjs Defines action input schemas.
extensions/​chronicle-stats/​server.mjs Serves the canvas and coordinates coaching.
extensions/​chronicle-stats/​snapshots.mjs Manages immutable usage snapshots.
extensions/​chronicle-stats/​time.mjs Handles timezone-aware date windows.
extensions/​chronicle-stats/​visuals.mjs Implements charts and visual controls.
Files not reviewed (1)
  • extensions/chronicle-stats/markdown.js: Generated file

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread extensions/chronicle-stats/renderer.mjs Outdated
Comment thread extensions/chronicle-stats/renderer.mjs
Comment thread extensions/chronicle-stats/snapshots.mjs Outdated
Comment thread extensions/chronicle-stats/LICENSE
Comment thread extensions/chronicle-stats/README.md Outdated
Comment thread plugins/chronicle-stats/README.md
@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Oct 6, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 6, 2026 10:24
@github-actions github-actions Bot added awaiting-automation and removed ready-for-review Submission passed intake validation and is ready for maintainer review labels Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Distribution aggregation can split identical labels, and experiment-panel updates do not preserve keyboard focus.

Review effort: Balanced
Findings: None

Resolved since last review (6)
Files not reviewed (1)
  • extensions/chronicle-stats/markdown.js: Generated file
Previously missed (2)

In code that hasn't changed since last review

Medium severity Group query results by the normalized value

extensions/​chronicle-stats/​db.mjs:106

The query normalizes both NULL and empty values to the same unknown label but groups by the original field, so those values produce separate rows with identical labels and split counts (visible as duplicate “unknown” tool chips). Group by the normalized alias, as the usage distribution query in analytics.mjs:80-82 already does.

Medium severity Restore focus when replacing or closing the experiment panel

extensions/​chronicle-stats/​insight-view.mjs:636

This replacement is also reached after successful Review and Done actions while focus is inside the experiment panel; Close hides that same focused subtree. Removing or hiding the focused control without restoring focus drops keyboard and screen-reader users back to the document, with no indication of where the updated content is. Preserve/restore focus to the refreshed experiment heading or invoking card, and move focus to a stable Insights control when closing.

@github-actions github-actions Bot added ready-for-review Submission passed intake validation and is ready for maintainer review and removed awaiting-automation labels Oct 6, 2026
@aaronpowell

Copy link
Copy Markdown
Contributor

@juliamuiruri4 we have a similar Canvas already, https://awesome-copilot.github.com/extension/cache-stats/, in the repo. At least, I think they have overlapping functionality. Does it look like there is an overlap between these two? If so, I think we'd be better to work on a single canvas.

@juliamuiruri4

Copy link
Copy Markdown
Author

Hey @aaronpowell, thanks for flagging this. I looked at Cache Stats, and I think these two canvases solve different problems.

Cache Stats appears to be a live monitor for a user's current session showing prompt-cache health (expiry, reuse, rebuild cost), refreshes every 2 seconds.

My AI Usage looks back at a user's usage history across all sessions and over 30 days, 90 days, or all time, and provides:

  • An activity heatmap, usage over time, model mix (top used models), top repos, and time of day when the user works, with drill-downs by model and session.

  • Insights provides on-demand standups, tips, and cost tips from Copilot (built on top of /chronicle, grounded in a user's own usage, plus experiments to track habit changes.

    Image Image

Yes, both read the local session store and show a token breakdown, but that's where the overlap ends. Cache Stats helps manage the session you're in, while My AI Usage helps you understand and improve your usage over time.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

canvas-extension PR touches canvas extensions merge-risk:medium new-submission PR adds at least one new contribution plugin PR touches plugins ready-for-review Submission passed intake validation and is ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants