Skip to content

feat(profile): add usage stats dashboard and profile page#181

Merged
SDSLeon merged 3 commits into
masterfrom
lightcode/swift-willow-511f23c5
Jun 15, 2026
Merged

feat(profile): add usage stats dashboard and profile page#181
SDSLeon merged 3 commits into
masterfrom
lightcode/swift-willow-511f23c5

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Jun 15, 2026

Copy link
Copy Markdown
Owner
  • Add a Profile page and overlay presenting a Codex/Synara-style identity and usage dashboard, including a 52-week activity heatmap, stat strips, model/plugin/AI-action breakdowns, and a shareable stats card.
  • Introduce durable usage capture: a renderer-side usageRecorder records prompts, runtime usage, and AI git actions (commits, PRs, conflict resolutions) into a usage_events log, hooked into thread, commit-gen, and Git review flows.
  • Add a main-process profile module that aggregates core stats, token stats, heatmap, identity, and device data from usage events, with a generation counter so high-frequency chat persistence does not churn the profile cache.
  • Add profile IPC contracts and procedures (shared/contracts/profile.ts, shared/ipc/procedures/profile.ts) shaped to survive a future jump from local-only aggregation to cross-device cloud sync.
  • Add a Profile settings section with identity editing, device picker, and share dialog, wired into the Settings overlay and sidebar.

- add main/profile stats engine (core, token, heatmap, identity, labels)
- add ProfileOverlay UI with activity, model/plugin usage, and share card
- record runtime usage events via renderer usageRecorder
- persist usage events and profile revision counter in db
- expose profile IPC procedures and contracts
- add Profile section to Settings overlay
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
lightcode-landing Skipped Skipped Jun 15, 2026 10:15am

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6344c2cc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/renderer/state/usageRecorder.ts Outdated
Comment on lines +265 to +266
const prev = lastUsedByThread.get(threadId) ?? 0;
const delta = Math.max(0, used - prev);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist token baselines across renderer restarts

When the renderer restarts or reloads, lastUsedByThread is empty while the durable usage_events rows are still present. The next context.updated for a resumed thread reports the existing context's usedTokens, so prev becomes 0 and this appends the already-counted context again, inflating lifetime and peak token stats for resumed sessions. Initialize the baseline from persisted context usage or skip emitting a token delta until a per-thread baseline has been established.

Useful? React with 👍 / 👎.

Comment on lines +224 to +225
if (autoGeneratedMessage && commitGenResult) {
recordAiAction("commit", commitGenResult.provider, commitGenResult.model);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve explicit commit-generation metadata

When the user presses the Generate button before committing, handleGenerateMessage only stores the generated text. The later commit enters handleCommit with a non-empty commitMessage, so autoGeneratedMessage and commitGenResult stay unset and this recordAiAction branch is skipped. Those successful commits using an AI-generated message are absent from the profile's AI commits count; keep the provider/model metadata with the generated draft until the commit succeeds.

Useful? React with 👍 / 👎.

Comment on lines +556 to +557
if (autoGenerated && summaryProvider) {
recordAiAction("pr", summaryProvider, summaryModel || "default");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve explicit PR-summary metadata

When the user clicks Generate PR summary first and then creates the PR, the title is already non-empty in handleCreatePr, so autoGenerated remains false and this new recordAiAction("pr", ...) branch never runs. The profile therefore misses PRs whose summary was generated explicitly with AI; store the generated summary's provider/model and consume it after ghCreatePr succeeds.

Useful? React with 👍 / 👎.

SDSLeon and others added 2 commits June 15, 2026 08:55
Resolve import conflict in src/main/ipc/localHandlers.ts: keep both the
profile stats imports (from ../profile) and applyClaudeProfileEnvironment
(from ../sharedSettingsFile) added by the two branches.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolve the three Codex review comments on PR #181:

- usageRecorder: stop re-counting a resumed thread's restored context on
  every renderer restart. recordThreadStarted now seeds a 0 token baseline
  for threads started this session, while a resumed thread (no baseline)
  only establishes the baseline on its first context.updated and emits no
  delta. This prevents the already-counted context from inflating lifetime
  and peak token stats. Adds usageRecorder.test.ts covering both cases.

- git review (commit/PR): attribute commits and PRs to AI when the message
  or summary was produced via the explicit Generate button. The generating
  provider/model is kept alongside the draft (commitGen / prGen in the
  git-review action store) and the AI action is recorded when the committed
  message / submitted PR title matches the generated draft, not only on the
  inline empty-field generation path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SDSLeon SDSLeon merged commit 09e4b9c into master Jun 15, 2026
4 checks passed
@SDSLeon SDSLeon deleted the lightcode/swift-willow-511f23c5 branch June 15, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant