← Back to Pull requests

Record skill reads as usage events, release 0.3.39 (CRAFT-8665) #231

Open
unknown opened this pull request with 321 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 30, 2026 14:20 UTC
Author

Linear: CRAFT-8665

What changes

Each time a model reads a skill:// resource, the server now records a new usage event, mcp_skill_read. Join it with mcp_tool_called on session_id to see which skills models read from the server and what they did next. The event never carries the skill's text.

| Property | Meaning |
| --- | --- |
| resource | index, skill (a SKILL.md) or reference (a file the skill links to) |
| skill_name, file | Names from the server's own bundle, such as lipsync and references/api.md |
| read_index | Position of this read among the session's skill reads |
| tool_calls_before | How many tool calls came before this read; 0 means the model read the skill before doing anything |
| previous_tool, ms_since_session_start | Where the read falls in the session |

Skills installed on the person's machine (the plugin, npx skills add) never reach this server, so those reads aren't counted.

This PR also bumps the version to 0.3.39, so the merge publishes to npm and the MCP Registry.

Safe to merge before the API change

The API rejects an entire batch if it contains an event type it doesn't know. The server therefore checks whether the collector's published schema lists mcp_skill_read. Until it does, the server drops skill reads from each batch, still sends everything else, and skips a batch made only of skill reads. It re-checks the schema every ten minutes, the same way it already handles referral_source. Session and tool-call events keep flowing as they do today.

The API side is a sync-api-v2 PR that adds mcp_skill_read to the validator and the event registry. Once that reaches production, servers that are already running start sending skill reads without a restart.

Verification

  • src/skill-resources.integration.test.ts: two new end-to-end tests over stdio through a real MCP client, against a stub API.

  • - With the collector listing the event, reading the index, a SKILL.md and a reference sends three ordered events with the right fields and no skill content.
    - With the collector not listing it, only mcp_session_initialized is sent.
  • src/telemetry/index.test.ts: a server that starts before the API supports the event begins sending skill reads after a recheck, without a restart. A batch made only of skill reads isn't sent until then.

  • Lint, knip and typecheck pass; test:scripts, test:memory and test:memory:http pass; pnpm test --no-file-parallelism passes (126 files, 1,488 tests).
  • 🤖 Generated with Claude Code

    Diff: 321 lines (+240 / -81) across 4 files Reviewer: greptile-apps[bot] Review duration: 4m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.42) × (1 − Review Confidence (0.30)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.42 · 321 lines diff across 4 files
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 52% · Reviewer familiarity: 35%
    30%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #231"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 30.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 41.9% (MEDIUM) · Higher = larger blast radius
    41.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 30.4% · Lower = rushed or shallow review
    30.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.2% · Safe to merge
    29.2%