Skip to content

Skills: Track 'command' usage - #19

Open
wolff-singleton wants to merge 1 commit into
nateherkai:mainfrom
wolff-singleton:feat/skills-track-command-usage
Open

Skills: Track 'command' usage#19
wolff-singleton wants to merge 1 commit into
nateherkai:mainfrom
wolff-singleton:feat/skills-track-command-usage

Conversation

@wolff-singleton

Copy link
Copy Markdown

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.

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).
@muckybuzzwoo

muckybuzzwoo commented May 22, 2026

Copy link
Copy Markdown

Integrated this into a fork at https://github.com/muckybuzzwoo/token-dashboard (commit 2679b3d) with one behaviour-changing adjustment: the fork already synthesises Skill rows from typed slash commands via PR #12 (text-parsing of <command-name>/…</command-name> tags). Without a filter, every slash command would count in both your manual_sessions AND tool_invocations columns — verified empirically as 276 user-message rows that would have leaked into "Claude invoked".

The fix is a one-line EXISTS clause on tool_inv:

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
wolff-singleton force-pushed the feat/skills-track-command-usage branch from f743026 to f642687 Compare June 5, 2026 04:03
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.

2 participants