feat(profile): add usage stats dashboard and profile page#181
Conversation
- 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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
💡 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".
| const prev = lastUsedByThread.get(threadId) ?? 0; | ||
| const delta = Math.max(0, used - prev); |
There was a problem hiding this comment.
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 👍 / 👎.
| if (autoGeneratedMessage && commitGenResult) { | ||
| recordAiAction("commit", commitGenResult.provider, commitGenResult.model); |
There was a problem hiding this comment.
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 👍 / 👎.
| if (autoGenerated && summaryProvider) { | ||
| recordAiAction("pr", summaryProvider, summaryModel || "default"); |
There was a problem hiding this comment.
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 👍 / 👎.
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>
usageRecorderrecords prompts, runtime usage, and AI git actions (commits, PRs, conflict resolutions) into ausage_eventslog, hooked into thread, commit-gen, and Git review flows.profilemodule 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.shared/contracts/profile.ts,shared/ipc/procedures/profile.ts) shaped to survive a future jump from local-only aggregation to cross-device cloud sync.