No slash command · from bitfab
Inspect phase of the Bitfab Setup flow. Invoked by the setup flow; not run directly
Ships in bitfab. 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.
None: SKILL.md is the whole skill.
Run only when mode is inspect.
Diagnose, and optionally fix, an existing Bitfab tracing setup. Triggered explicitly by /bitfab:setup inspect (or natural-language asks like "why aren't my traces showing up" / "what's instrumented" / "debug my tracing setup" / "inspect my tracing"). Reports auth/connection status, what's instrumented in this repo, whether the plugin and SDK are up to date, whether replay registry modules cover every trace function key, and whether traces are actually arriving, then offers to apply the fixes, each confirmed individually before any change. Does not open Bitfab.
This is about trace delivery and setup health (is the SDK wired up and current, is the key set, are traces landing, are replay registry modules in place). For improving the quality of a traced function's outputs (pass rates, failing cases), work on it directly with the Bitfab MCP tools instead.
Run the status check and report the result to the user:
node "${CLAUDE_PLUGIN_ROOT}/dist/commands/status.js"
Report whether they're authenticated and which org/account the plugin is connected to. If not authenticated, note that trace arrival can't be confirmed without login and suggest /bitfab:setup login, but continue with the read-only code inspection below regardless (it does not require auth).
Search the codebase for SDK usage and trace function keys (getFunction("key"), get_function("key"), bitfab_function "key", WithFunctionName("key"), plus keyed framework handlers: getLangGraphCallbackHandler("key") / get_langgraph_callback_handler("key") (or the LangChain-named aliases) and getDeepAgentsIntegration("key") / get_deep_agents_integration("key") and getOpenAiAgentHandler("key") / get_openai_agent_handler("key") and getClaudeAgentHandler("key") / get_claude_agent_handler("key") and getVercelAiMiddleware("key") and getPiIntegration("key") and getLiveKitIntegration("key") / get_livekit_integration("key"); plus trace-processor registrations (unkeyed in code, the key is derived server-side from the workflow name): getOpenAiTracingProcessor() / get_openai_tracing_processor()). In a monorepo, search each application directory separately: a root-level search can miss subdirectories. Report:
BITFAB_API_KEY is set (in .env-style files or the environment), do not print the key value.setTraceProcessors / set_trace_processors with the Bitfab processor) is itself an instrumented workflow whose key is derived server-side from the workflow name. Note whether each run is routed through the run wrapper (getOpenAiAgentHandler / get_openai_agent_handler), enclosed by an opt-out withTrace/trace root, or, only in a fallback runtime, wrapped in a manual withSpan/@span root. The replayability check in step 4 needs this; a bare processor over plain run() with none of these is not replayable.lib/bitfab.*).If no SDK usage is found, say so and suggest /bitfab:setup instrument to wire up the first workflow. Continue through the remaining steps anyway, with no trace function keys, the trace-arrival check (step 3) has nothing to look up and is a no-op, but the freshness check (step 4) still matters: plugin and SDK staleness, including the legacy bitfab → @bitfab/sdk migration, apply regardless of whether this repo has any trace functions yet.
For each trace function key found in step 2, check whether traces are actually landing in Bitfab:
mcp__plugin_bitfab_Bitfab__list_trace_functions to see which keys the org has received traces for. Cross-reference against the keys instrumented in this repo: a key present in code but absent here usually means traces have never reached Bitfab (app not run with the key set, or the key is bound to a different org).mcp__plugin_bitfab_Bitfab__search_traces with { traceFunctionKey: "<key>", limit: 1 } to confirm a recent trace and capture its timestamp.Mark each key as ✅ traces arriving (with most recent timestamp), ⚠️ instrumented here but no traces yet, or ❓ traces exist in the org but the key isn't found in this repo. If not authenticated (from step 1), skip the tool calls and note that arrival can't be checked until login.
Check whether the plugin, SDK, and replay registry modules are current, so the report can offer to fix what's stale:
status output already captured in the status-check step (step 1). If that status line included v<X> available, run ... to update, the plugin is behind./bitfab:update uses):node "${CLAUDE_PLUGIN_ROOT}/dist/commands/update.js" sdk
Parse the <bitfab-sdk-status> block it prints, one JSON object per (workspace, language) with packageName, current, latest, latestSource ("remote" | "baked"), updateAvailable, and renameFrom. Treat updateAvailable: true as needing a fix, that flag is set both when latest > current and when renameFrom is non-null. A non-null renameFrom (e.g. "bitfab") means the TypeScript workspace is on the legacy bitfab npm package and must switch to @bitfab/sdk; this counts as needing a fix even when the installed version already equals latest (the rename itself is the fix). If remoteCheckFailed is true for an entry, note the latest version couldn't be confirmed (offline / sandbox) rather than asserting it's current.
3. Replay registries: Glob for scripts/replayRegistry.*, scripts/replay_registry.*, or another module defining ReplayRegistry / defineReplayRegistry, then grep it for each trace function key found in step 2. Mark replay as ✅ covers all keys, ⚠️ exists but missing keys, or ❌ no replay registry module.
4. Replayability of each root: registry coverage is only half of replay, an entry that points at a non-replayable root still won't run. Determine each key's replayability statically from source (this step does not fetch recorded trace inputs, so reason from signatures, not trace data):
@span/withSpan-decorated root in the app) are replayable by design: the handler (or run wrapper, getOpenAiAgentHandler / get_openai_agent_handler) records the framework's own serializable input as the root. Never flag these ⚠️, and never treat the absence of a decorated root function as non-replayable (this mirrors Instrument's rule).run()): the processor captures the run but its root span records an empty input, so a processor-only key without the run wrapper getOpenAiAgentHandler / get_openai_agent_handler or an application root is NOT replayable. Flag it ⚠️ root not replayable and recommend adding a withTrace/trace root that takes the run input in supported subtree runtimes, or routing through the run wrapper. Recommend a manual withSpan/@span root only when opt-out is technically unavailable. When an application root exists, check its signature like any decorated key (next bullet).Request/Response, stream writers, sockets, opaque request contexts) as ⚠️ root not replayable, reasoning from the signature, not the function name. This is independent of the replay-registry coverage in sub-step 3 above: a non-replayable root is ⚠️ whether or not a registry exists for it (a key can be ❌ no replay registry module AND ⚠️ root not replayable at once), so never roll a non-replayable root up into ✅ just because it has no registry entry.trace/withTrace root records the root and nothing beneath it unless the runtime support is actually there, which looks like healthy tracing until someone opens a trace and finds one node. Only check this when step 2 found an opt-out root; a repo whose roots are all withSpan/span needs none of it. TypeScript needs two things, both required: (a) @bitfab/sdk in that workspace's manifest, and (b) an adapter wired into the build that produces the server entrypoint. Grep the build configuration and start scripts for either the current @bitfab/sdk/transform/ prefix or the still-supported @bitfab/transform/ compatibility prefix: next.config.*, vite.config.*, webpack.config.*, rspack.config.*, rsbuild.config.*, rollup.config.*, tsup.config.*, babel.config.*, Nest's webpackConfigPath target, or the corresponding --import .../register on the real start command. Treat either adapter prefix as wired; do not add an SDK adapter alongside an existing compatibility adapter. Mark ✅ package present and adapter wired, ⚠️ package installed but no adapter in the real build path, or ❌ package missing. Python needs 3.12+ instead; read the project's declared version and flag anything below it. The application's own log corroborates a ❌ or ⚠️ finding: both SDKs log one [bitfab] warning when an opt-out root runs without its runtime support.Hold these results for the report. (If nothing is instrumented, no trace function keys AND no trace-processor registrations, skip both the replay and the replayability checks, they are per-workflow, so there's nothing to evaluate; report both as n/a (nothing instrumented), never ✅. Still run the plugin and SDK checks: the SDK may be installed and stale, or on the legacy bitfab package needing the @bitfab/sdk rename, independent of whether any trace functions exist in this repo yet.)
Summarize the setup health in one compact report:
v<X> available (from step 4).BITFAB_API_KEY set / not set; per workspace, current → latest when out of date, and call out any workspace on the legacy bitfab package that should switch to @bitfab/sdk (TypeScript, from renameFrom).<key> root not replayable / n/a (nothing instrumented) (from the per-root replayability check in step 4; flagged whether or not a replay registry module exists for the key; never ✅ when nothing is instrumented).@bitfab/sdk installed but no transform adapter in the real build path / ❌ @bitfab/sdk missing / ❌ Python below 3.12 / n/a (no opt-out roots) (from the subtree-capture check in step 4).Then, for anything not healthy, name the most likely cause and the fix:
bitfab package: apply via the fix prompt below (upgrades the version and/or switches bitfab → @bitfab/sdk; same effect as /bitfab:update)./bitfab:setup replay (non-interactive; creates or extends registry entries to cover every key).withTrace/trace root that wraps the run and takes its input in a supported subtree runtime, or route the run through the run wrapper (getOpenAiAgentHandler / get_openai_agent_handler). Use a manual withSpan/@span root only when opt-out is technically unavailable. Either way, re-instrument via /bitfab:setup modify (or /bitfab:setup instrument for a fresh boundary). This is a code change, recommended here, not applied blanket.BITFAB_API_KEY isn't set in the run environment. Run the app with the key loaded./bitfab:setup instrument./bitfab:setup modify.Then continue to the fix prompt. Inspect does not open Bitfab.
If the report surfaced anything stale or missing (plugin behind, SDK out of date or on the legacy bitfab package, replay registry modules missing/incomplete, or TypeScript subtree capture not wired), use AskUserQuestion whether to apply them, each fix is then confirmed individually in the next step (nothing is changed blanket). If everything is healthy, skip the question and go straight to cleanup.
A) Review and apply fixes: go through each fix one at a time, confirming before any change (recommended) → step 7 B) Just report: make no changes → the
setup-cleanupskill
Next:
inspect): invoke the setup-cleanup skill with mode inspect, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).inspect): invoke the setup-cleanup skill with mode inspect, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).Apply fixes individually, confirm each before changing anything; never bundle them into one blanket change. Go through only the items step 4 flagged as stale or missing, and for each, use AskUserQuestion (one decision per question) and apply only if the user approves. Skip any they decline and continue to the next.
AskUserQuestion to update; if yes, run node "${CLAUDE_PLUGIN_ROOT}/dist/commands/update.js" plugin and remind the user to restart Claude Code so the new plugin loads.updateAvailable: true, renameFrom null), name the workspace and the current → latest jump, then use AskUserQuestion to upgrade; if yes, run the package manager's upgrade from that workspace directory (the same commands /bitfab:update uses): npm / pnpm / yarn / bun add @bitfab/sdk@latest; uv / poetry / pip bitfab-py@latest; bundle update bitfab; go get github.com/Project-White-Rabbit/bitfab-go@latest && go mod tidy. Read the manifest afterward to confirm the new version. Each workspace is its own decision.bitfab package (renameFrom non-null), this rewrites import sites, so preview before touching code: list every from "bitfab" / require("bitfab") site you would change, then use AskUserQuestion to proceed. If yes, remove the old package and add the new one in one step (e.g. pnpm remove bitfab && pnpm add @bitfab/sdk@latest, or the npm / yarn / bun equivalent) and rewrite those imports to @bitfab/sdk. Do this even when current already equals latest, the rename is the fix. (TypeScript-only; Python / Ruby / Go package names don't change.)AskUserQuestion to refresh; if yes, run /bitfab:setup replay to create or extend the scripts so every trace function key is covered (it is non-interactive).AskUserQuestion to proceed. If yes, use the installed SDK and wire the matching @bitfab/sdk/transform adapter: @bitfab/sdk/transform/next wrapping the existing next.config, the /vite, /rollup, /rolldown, /esbuild, /bun, /webpack, /rspack, /rsbuild, /babel, /nest, or /typescript entry in the existing build config, or --import @bitfab/sdk/transform/register on the real start command. Preserve every existing wrapper; never replace or bypass one. Python below 3.12 is a runtime upgrade, report it and do not attempt it.For unusual monorepos or private registries, defer to /bitfab:update. Report what was applied and what the user declined. Do not open Bitfab.
Next:
inspect: invoke the setup-cleanup skill with mode inspect, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub project-white-rabbit/bitfab-claude-plugin --plugin bitfab19 skills in this plugin
/assistantBitfab Assistant (retired)Retired. Only use when the user explicitly types the bitfab assistant command by name; it tells them the assistant has been retired. Never use it for requests about traces, datasets, labels, verdicts, replays, experiments, or improving a traced function: handle those directly with the Bitfab MCP tools/setupBitfab SetupSet up and maintain Bitfab tracing, replay registries, and cloud replay. Use for instrumenting AI/LLM code, adding observability or evaluation, tracing another workflow, changing captured inputs/outputs, re-instrumenting a function, moving side effects across trace boundaries, inspecting missing traces, explaining Bitfab, login, organization switching, session-log consent, database snapshots, templates, or read-only repo instrumentation recommendations (analyze-repo). Also use for 'setup cloud', 'set up cloud replay', or 'replay on GitHub'. Re-enter this skill for each additional function to instrument, even after earlier setup. Do not use for improving output quality, pass rates, verdicts (labeling), or experiments (the agent does those directly with the Bitfab MCP tools), or upgrading SDK/plugin versions (use bitfab:update)