Skip to content

Report the skills a turn loads in studio_code_turn_completed - #5407

Merged
chubes4 merged 2 commits into
trunkfrom
add/track-skill-loads
Oct 25, 2026
Merged

chubes4 merged 2 commits into
trunkfrom
add/track-skill-loads

Conversation

@chubes4

@chubes4 chubes4 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Related issues

  • None

How AI was used in this PR

Claude (via the Pi coding agent in a Roadie session) found the gap by reading the Tracks code and querying the events, wrote the change and its tests, and checked that each test catches a mutation of the code it covers. Chris Huber directed the work and reviewed the diff.

Proposed Changes

  • studio_code_message_sent's ability_name names a skill only when the user starts it with a slash command. A skill the agent loads itself through the Skill tool, which is how skills mostly get used, is recorded nowhere. Since 2026-09-25, 35,714 of 35,819 studio_code_message_sent events carry no ability_name. So we can't tell which skills get used, how often, or whether turns that load one go better.
  • studio_code_turn_completed gains skills_loaded: the sorted, de-duplicated names of the skills the turn loaded, empty when none. It reads the Skill tool's arguments and keeps only names of skills Studio ships, so no model-written text reaches Tracks, the same way failed_tools reports unknown.
  • Next to the existing token and tool-call props, this lets us compare per skill how often it loads, what turns that load it cost, and how they end.
  • docs/design-docs/analytics-tracks.md documents the prop. As that doc notes, it needs registering in the Tracks Registration tool.

Testing Instructions

  • npx vitest run apps/cli/ai/tests/turn-stats.test.ts apps/cli/commands/ai/tests/index.test.ts
  • Manually: run studio code, ask for something that loads a skill (for example "build me a bakery site"), and check that the studio_code_turn_completed event's skills_loaded names it (for example build-site,visual-design).

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
  • Register skills_loaded for studio_code_turn_completed in the Tracks Registration tool.

studio_code_message_sent's ability_name names a skill only when the user
starts it with a slash command. A skill the agent loads itself, through the
Skill tool, reached Tracks nowhere. Since 2026-09-25, 35,714 of 35,833
studio_code_message_sent events carried no ability_name.

The turn stats tracker now reads the Skill tool's tool_execution_start
and reports skills_loaded: the sorted, de-duplicated names, empty when none.
Only names findSkill() knows are kept, so no model-written text reaches
Tracks, as with failed_tools.
The empty case repeated the zero-props test, and the index test's line asserted nothing toMatchObject checks. The other-tool case now uses site_create, a tool that takes a name.
@chubes4
chubes4 marked this pull request as ready for review October 25, 2026 16:13
@chubes4
chubes4 merged commit 0e868fe into trunk Oct 25, 2026
12 checks passed
@chubes4
chubes4 deleted the add/track-skill-loads branch October 25, 2026 18:10
chubes4 added a commit that referenced this pull request Oct 25, 2026
Trunk's #5407 test loads block-content, which the spike removed, so the
merge left it failing; it now loads rank-me-up.
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