Skills: Track 'command' usage - #19
Open
wolff-singleton wants to merge 1 commit into
Open
Conversation
muckybuzzwoo
added a commit
to muckybuzzwoo/token-dashboard
that referenced
this pull request
May 22, 2026
…e-invoked Adapts upstream PR nateherkai#19 (wolff-singleton) to this fork, with one behaviour-changing adjustment to avoid double-counting against the PR nateherkai#12 slash-command synthesiser already in this fork. Changes: - New messages.attribution_skill column, populated from each JSONL record's top-level attributionSkill field. Verified against real JSONLs: present on every assistant message inside an active slash- command session, plugin-namespaced (e.g. "buzzwoo-memory:memory- review"). Migration clears messages/tool_calls/files AND summary_meta (so the materialised summary tables get fully rebuilt instead of serving stale data) and forces a full rescan on the next launch. Settings, plan, and dismissed_tips tables are preserved. - skill_breakdown() now returns two counts per row: manual_sessions (distinct sessions where attribution_skill was set, i.e. the user typed a slash command) and tool_invocations (Skill tool_use blocks Claude emitted itself, typically Task/Agent subagents). Combined total drives ordering. - Skills route renamed "Skills & Commands". KPI tiles split into "You ran" / "Claude invoked". Table gains two columns matching. Fork's existing budget / p50 / p95 / total-$ / total-inc-subagents columns preserved (from PR nateherkai#12). Chart uses groupedBarChart for the two-series view, with a single-series fallback when only one category has data in the window. De-dupe fix vs. PR nateherkai#12: synthesised Skill rows from PR nateherkai#12 live on user-type messages; real tool_use rows live on assistant-type messages. The merged skill_breakdown's tool_inv CTE adds AND EXISTS (SELECT 1 FROM messages m WHERE m.uuid = tc.message_uuid AND m.type = 'assistant') so PR nateherkai#12's synthesised rows no longer double-count against PR nateherkai#19's attribution_skill counts. Verified on a real DB: 276 synthesised rows on user messages were correctly filtered out of "Claude invoked", while 51 real rows on assistant messages still count. PR nateherkai#12's rescan-slash-commands one-shot remains for back-filling DBs that pre-date this column. Test updates: SkillBreakdownTests fixture extended to cover both manual-only skills, tool-only skills, the COALESCE merge for skills with both, and an explicit de-dupe guard test that places a synthesised Skill row on a user-type message and asserts it does NOT inflate tool_invocations. The two server-side fixture files (test_server_skills_budget.py) had to parent their fake tool_calls rows to a real assistant message uuid so the new EXISTS join resolves. Upstream PR: nateherkai#19
muckybuzzwoo
added a commit
to muckybuzzwoo/token-dashboard
that referenced
this pull request
May 22, 2026
…kai#19 - nateherkai#18 (perf scanner) and nateherkai#19 (attributionSkill + split skills view) added to the Integrated upstream PRs table with adaptation notes. - nateherkai#17 added to Deliberately skipped with the reason: PR nateherkai#17's progress callback signature (scanned, total, totals) is strictly less informative than this fork's (index, total, path, totals) from PR #2, so integrating it would degrade the CLI progress printer. - Differences from upstream rewritten: clarifies the new Skills & Commands route's split between "You ran" (slash commands via attribution_skill) and "Claude invoked" (real Skill tool calls), and notes that the two sources are de-duplicated against each other so the same slash command never inflates both columns. - Scanner performance section updated to reflect the post-nateherkai#18 measurement (~7.5s full rescan of ~600 files / 60k+ messages).
|
Integrated this into a fork at https://github.com/muckybuzzwoo/token-dashboard (commit The fix is a one-line AND EXISTS (SELECT 1 FROM messages m
WHERE m.uuid = tc.message_uuid AND m.type = 'assistant')
Real Skill tool_use blocks always land on assistant messages; synthesised rows always land on user messages. So the filter cleanly separates them while keeping PR #12's rescan-slash-commands one-shot as a backward-compat fallback for older DBs. |
Store attributionSkill on scanned messages and split the Skills view between slash-command sessions and Skill tool invocations. Filters out synthesized skill invocations on user messages to avoid double-counting them as tool calls. Cover manual-only commands, merged usage, distinct session counting, and date filtering.
wolff-singleton
force-pushed
the
feat/skills-track-command-usage
branch
from
June 5, 2026 04:03
f743026 to
f642687
Compare
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.
The Skills tab now also tracks custom and plugin-installed slash commands you run directly, not just times Claude invoked the Skill tool mid-conversation.
Built-in Claude Code commands (/help, /clear, /model, etc.) are not tracked — Claude Code doesn't tag them as skill invocations.
The page is renamed to Skills & Commands, gains two KPIs ("You ran" / "Claude invoked"), and the table splits the old invocations column into the same two.
On first launch after upgrade, the dashboard re-scans all JSONLs to backfill historical attribution.