/rudder-ai-events:rudder-ai-events-verifyfrom rudder-ai-events
Verifies RudderStack AI events locally against v0.4 schema, validates captures, joins, switches, and legacy events. Use when testing AI tracking or debugging missing/wrong events.
Ships in rudder-ai-events. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Proves the instrumentation sends what ai-events.md promises, before any real traffic. Default checks run offline: a recorder or mock RudderStack client, a mock model, no provider keys. Verification is not optional: it runs, and passes, before a commit or PR is proposed. If the user commits first, say plainly that verify has not run.
The checker (check, what-changes), the recorders and both schemas ship with the SDKs, @rudderstack/ai / rudderstack-ai 0.8.0 or later and ai-sdk-go v0.4.0 or later (cmd/aicheck v0.2.0); this skill adds the mock data plane and model server (scripts/mock_server.py, Python 3) and the procedures and checklist in references/verification.md. The 0.8.0 checkers accept 0.3.0 and 0.4.0 captures; v0.4 events must carry 0.4.0 fields only when the plan pins a v0.4 SDK. For an app on an older SDK, run the latest checker from scratch and, in tests, import its Recorder from that scratch install.
Stacked delivery. When the plan splits the work into several PRs (## Files to change), verify the surfaces instrumented up to the PR at hand, with every check below; report the plan's later surfaces as n/a (later PR). The last PR's run covers the whole plan. With server_dependency, the backend PR lands first; browser verification drives that backend and combines both captures to check joins and the consumed switch.
Migration or new install. When the plan lists legacy events (the app already sends its own AI-related events through a RudderStack SDK), run every check below. With no legacy events, skip the legacy-switch capture, the legacy and breaking-change checks and the before/after diff: every event in ## What changes is new, taken from the switch-on capture.
yaml block under ## Config in ai-events.md (surfaces, identity sources, content capture, switches, legacy events, prices, event rules, MCP servers); it wins over the prose. Also read ## What changes, ## Breaking and semantic changes, ## Surfaces, ## Cost and ## Known limits: verify checks them against what it observes. No plan: check against the spec only, and say so in the report.$TMPDIR/ai-events-verify/) and copy scripts/mock_server.py into it when option B is used. Captures stay there, never in the user's source tree.npx -y @rudderstack/ai@<VERSION> check, python -m rudderstack.ai.check (the check extra) or go run github.com/rudderlabs/ai-sdk-go/cmd/[email protected]. Deno and browser-only apps may use any available checker at an exact published version from the plan or registry, from scratch; no server SDK is added to a browser repo. Any of them reads any app's capture, with the same flags and output, and each bundles the spec and browser-event schemas.Recorder from @rudderstack/ai/testing or rudderstack.ai.testing, Go ruddertest.NewRecorder) the app's own RudderStack client where the app builds it, before its configure() and switches run, then drive the surfaces.mock_server.py.rudderanalytics, driven with the interaction ID the server returned, appended to the same capture.rudder-ai-events-instrument. Only when checking an older instrumentation that predates the switch, take the "before" capture with configure() given a no-op client instead, and say so in the report.references/verification.md, section 2): instrumentation must not break them, and the new server-side tests that assert the captured AI events must exist and pass. Deno runs the repo's own deno test; browser-only plans require browser tests for client events, returned-ID joins and client_events.switch_source instead of local server tests. Missing tests are a FAIL that goes back to rudder-ai-events-instrument.check and the flags that match the plan (section 3): schema, SDK and specVersion per event, one final server answer per completed interaction_id, plus paused segments, client copies, joins, feature, surface, identity, content, background runs, MCP, legacy events, app-detected failures, switches. A requested_model on Anthropic models served through Bedrock or Vertex AI IDs, no requested_model from Bedrock, LangChain, the OpenAI Agents SDK or the Claude Agent SDK, and argument_keys in any order are not failures. Then the plan checks:
surfaces[].pauses, repeat pauses and resume in process or from JSON on a fresh worker; check segment totals and final pause_count / total_paused_ms. Use unsampled coverage capture, then exercise planned sample_rates separately.surfaces[].extra_properties values on successful and failed answers, including app-detected failures.usage_baseline_source: a persisted baseline survives a fresh process and yields per-turn cost; test the missing-baseline fallback in a fresh process without registered prices (no cost); same-process resumes may use cached baselines and report per-turn cost, even with resumed_no_cost. Then every model ID constant the app can send is priced; unpriced_models get dummy prices, so missing rates never fail (section 4).trigger: system and no ai_user_prompt_created. n/a only when no surface is UI-triggered.Spec coverage). Parity with legacy events does not show this: most gaps were never in legacy.rudder-ai-events-instrument; a wrong plan assumption goes back to rudder-ai-events-setup (plan status back to draft). A gap that matches a known limit in the plan is reported, not fixed.## What changes. After the first PASS, run the checker's what-changes on the switch-off and switch-on captures (section 5) and complete the six parts. Output it as a block ready for the PR body; update the plan's section only where the capture contradicts it.references/verification.md, section 7): parity and coverage, broken down by feature and surface.Keep it short and factual:
AI events verification: PASS | FAIL
Capture: A recorder | B mock data plane | C Live Events
App tests: <command> -> <result>
Events: ai_user_prompt_created 1, ai_response_received 2, ai_user_action 1, chatTurnCompleted 1
Checks: schema PASS, one final answer per turn PASS, joins PASS, identity PASS, content PASS, background n/a, failures PASS, switches PASS, mcp PASS (client_name 3/3), legacy PASS, cost PASS (dummy: claude-haiku-4-5), new tests PASS, breaking changes PASS, page-load PASS
Known limits hit: <e.g. mcp_stateless_no_client: docs-mcp has no client_name>
Not verified: <what could not run, e.g. streaming route, real data plane delivery, warehouse load>
Next: <fixes, or: open the PR with the What changes block below>
<## What changes block>
Finding-to-cause table: references/verification.md, section 8. Two that read oddly: feature None not in [...] on an ai_response_received is an answer that escaped its interaction (a model call after the interaction ended or without its context); and what-changes counts such stray answers as ordinary new ai_response_received, so compare its answer count with the final and paused segments of the turns and runs you drove.
local-test, test) for write keys and provider keys in the verification shell only. A planned Agent SDK upgrade smoke uses the app's approved development credential mechanism; never read or print keys, or write them to .env or any file.references/verification.md: the SDK checkers and recorders, the mock data plane and model server, an MCP client driver, the check flags, the cost check, what-changes, the checklist and common failures.What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/rudder-ai-events-instrumentAdds RudderStack AI events code from an approved ai-events.md plan: installs @rudderstack/ai, rudderstack-ai or ai-sdk-go, wraps model clients and MCP servers, opens interactions and tasks, wires feedback and browser events. Use when implementing an approved AI events plan./rudder-ai-events-setupOnboards an app to RudderStack AI events, including moving existing RudderStack LLM, chat or agent events to them: discovers chat, agent, browser and MCP surfaces and drafts ai-events.md. Use when adding @rudderstack/ai, rudderstack-ai or ai-sdk-go, or replacing custom AI tracking.npx claudepluginhub rudderlabs/rudder-agent-skills --plugin rudder-ai-eventsOther plugins' skills for the same job