No slash command · from bitfab
Replay 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 replay.
Create or update replay registry modules for instrumented trace functions. Requires instrumentation in the codebase; does not require existing traces, replay registry modules are created from trace function keys in the code, not captured trace data.
The SDK-installed bitfab-replay command lets the team regression-test any registered trace function against production data with one command: it fetches historical traces, re-runs them through the current code, and reports old vs. new outputs side-by-side. The project owns only the registry module. Go has no installed command: a Go project compiles its registry into its own command, conventionally cmd/registry/main.go, which builds a bitfab.NewReplayRegistry() and passes it with os.Args[1:] to bitfab.RunReplayCLI. It runs as go run ./cmd/registry <pipeline> [flags] and takes the same flags. Wherever this phase says bitfab-replay --registry <path>, a Go project uses that command instead.
Relationship to Instrument. Instrument's write-instrumentation step writes each replay pipeline alongside the instrumentation edits. Run this mode standalone (/bitfab:setup replay) to catch pre-existing trace function keys that predate that step or were added outside the skill.
Source of truth: two pages, read both before creating or modifying a replay registry module. Do not improvise from memory.
replay API signature, options, and return shape: /reference/typescript.md, /reference/python.md, /reference/ruby.md, /reference/go.md. Use this for the exact field names (result / originalOutput vs original_output), default limit, maxConcurrency/max_concurrency, error behavior./typescript-sdk.md, /python-sdk.md, /ruby-sdk.md, /go-sdk.md. Use this for the language-specific registry shape and the standard bitfab-replay --registry <path> <pipeline> invocation (Go: go run ./cmd/registry <pipeline>).Gather all trace function keys by searching for SDK patterns (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()). This is the source of truth for what replay must cover.
Search for existing replay registry modules: files matching scripts/replayRegistry.*, scripts/replay_registry.*, or cmd/registry/main.go, or files defining an SDK ReplayRegistry / defineReplayRegistry / NewReplayRegistry (fall back to direct replay API calls for legacy scripts).
Compare coverage. Replay is non-interactive once entered, do not ask the user whether to create or add registry modules. Determine which case applies:
ReplayRegistry / defineReplayRegistry and every entry references the exact production root. The SDK-installed bitfab-replay executable owns the Replay Output Contract and all common flags; the project module must not invoke a runner or reimplement flags. Legacy expanded scripts should be migrated to a registry-only module. Once every key is registered, proceed to the replayable-root review.Create the replay registry module adapted to this codebase. Ground it in the docs, not memory: fetch https://docs.bitfab.ai/reference/<language>.md for the canonical registry shape, then https://docs.bitfab.ai/<language>-sdk.md for the module template, the executable command, and the worked example under "When the traced function needs the app's dependencies". Quote the exact registry export convention and command in your plan.
The project file holds only app imports and bootstrap, registry entries, and per-function defaults (adaptInputs / adapt_inputs, mock overrides, database branching). The SDK-installed bitfab-replay executable loads it through --registry and owns everything else: every flag (--limit, --trace-ids, --dataset-ids, --mock, the required --code-change, and the rest), progress callbacks, code-change capture, the stderr summary, stdout JSON, and BITFAB_REPLAY_RESULT_PATH. The registry never invokes a replay runner and never parses, forwards, or prints any of that. The one exception is Go, whose registry command ends by passing os.Args[1:] to bitfab.RunReplayCLI, which then owns all of it. The non-negotiables are:
cmd/registry/main.go), and bitfab-replay runs from that package's directory. When the root is defined in a lower-level library and an app package calls it with tools or clients it built, the registry goes in the app package, even when the Bitfab SDK is so far installed only in the library. Add the SDK to the app package's dependencies. That is normal setup, not a refactor or an architecture change, so it needs no confirmation. Name the added dependency in the summary you give the user. Never copy the app's dependencies into the library.adaptInputs / adapt_inputs / AdaptInputs) by calling the same code production uses. If production builds them inline, extract that code into an exported function that production and the registry both call. That edits production code, so confirm it first. Show the user the function being extracted, the file it moves to, and each call site that changes, state that the logic moves unchanged, and wait for a yes before editing. Present it as a small visibility change, not an architecture change. If the user declines, stop and say that replay cannot rebuild these arguments without it.mockOnReplay / mock_on_replay / WithMockOnReplay). Tool calls recorded by a framework handler, such as the Claude Agent SDK handler's tool spans, are records only, so those tools run for real. Before any replay, list every tool the registry wires in and put each one that writes, sends, charges, or calls a paid API behind a marked span. If a tool cannot be marked because it runs where replay cannot reach it, stop and tell the user that replaying this workflow runs that tool for real.optionsFactory / options_factory only changes replay options such as mocking, never how the app builds the root. Never add a second registry entry with the setting written into it.--dry-run first. Every replay command, dry runs included, names its code change, and a wiring check has none, so pass --code-change skip. The first real replay of an unchanged trace (after the replay safety check) should take the same tool path as the original. A real replay, unlike a dry run, needs an experiment group: pass a new UUID with --experiment-group-id and a name for what it tests with --experiment-group-name. A tool the original called that the replay skips means production wiring is still missing.(x) => fn(x)) carries no key and nests a duplicate root. For a TypeScript decorated method, register instance.method.bind(instance), which keeps its key. For Python class methods, register Class.method or a bound instance.method; for Ruby, the production receiver and method_name; for Go, the production function or method value with TraceFunctionKey, since a plain Go function carries no key. Import the Bitfab client the instrumentation uses; never construct a second one. Never register a stub or identity function; reshape old inputs with the entry's input adapter instead.runX, processX, or generateX. For handler-instrumented keys with explicit-key replay, verify parity against the production keyed handler/run-wrapper entrypoint that re-invokes the same framework entrypoint production calls. If exported-symbol parity is impossible, stop and document the concrete blocker.Replay root parity:, Production root symbol:, Production import/path:, Replay symbol:, Replay import/path:, Same symbol? yes/no, and If no, why is this impossible?.get_langgraph_callback_handler("key"), get_deep_agents_integration("key"), get_openai_agent_handler("key"), get_claude_agent_handler("key"), getVercelAiMiddleware("key"), getPiIntegration("key"), get_livekit_integration("key"), or the TS equivalents), register the plain callable that re-invokes the same production framework entrypoint, plus the key explicitly (TypeScript traceFunctionKey; Python/Ruby trace_function_key). The callable receives the recorded root input and reconstructs only the runtime wiring the production entrypoint needs. Every unsafe production action reached through that wiring must remain behind a replay-mockable marked span. Use a no-op only for a genuinely replay-only callback slot with no production action and no recorded call to mock.{ write: () => {}, merge: () => {} }), no client on the other endbitfab-replay loads the transform for the registry by itself, but it replays traces the application recorded. If the application build has no @bitfab/sdk/transform adapter, those traces hold the root alone, so there is no recorded output to serve and every call beneath the root runs for real. Before finishing, find the adapter in the build config or start command for each withTrace/trace key, and wire the matching one when it is missing (@bitfab/sdk/transform/next, the bundler plugin, or --import @bitfab/sdk/transform/register on the real start command), preserving existing config wrappers.Legacy instrumentation with a non-replayable root. First decide whether any instrumented trace function can't be replayed from the replay registry module. Two failure modes: (1) not invocable, the function isn't exported or is defined inline in a route handler; (2) not replayable, its root takes unserializable inputs (live SDK/DB clients, HTTP Request/Response, stream writers, sockets, opaque request contexts), so even an invocable call replays with empty or stubbed args. Such functions were introduced before Instrument's trace-boundary serializability requirement, or via another path. Reason from each function's signature and visibility, and where a captured trace exists for the key, compare the signature against the trace data: an empty or <unserializable: ...>-stubbed recorded root input confirms the root isn't replayable. Do not execute replay to detect this. A root whose only live arguments are objects the app builds from its own code (tools with their functions, clients, callbacks) is replayable, not a failure: the recording keeps the rest of its input, and the registry entry rebuilds those objects in its input adapter with the same code production uses (see the create step). Treat it as replayable once the entry does that.
Keyed root-handler keys are not affected. A key registered only via a callback handler or a trace-processor run wrapper (LangGraph / LangChain, LangChain Deep Agents, OpenAI Agents SDK, Claude Agent SDK, Vercel AI SDK, Pi agent harness, or LiveKit Agents) has no decorated function by design and records the framework's serializable input as the root; create its pipeline with the key-based replay pattern from step 4 instead of offering these resolutions. Bare trace-processor-only keys (OpenAI Agents SDK over plain run()) ARE affected, not exempt: the processor records an empty-input root, so a processor-only key without the run wrapper or an application root is not replayable. Offer "add a withTrace/trace root that takes the run input, or route the run through the run wrapper" in supported subtree runtimes; offer a manual span root only when opt-out is technically unavailable.
setup-cleanup skillIf one or more functions can't be invoked or aren't replayable, use AskUserQuestion offering Instrument's trace-boundary resolutions:
A) Move the trace to an inner function → the
setup-cleanupskill B) Refactor (recommended) → thesetup-cleanupskill C) Leave as-is: add a header comment explaining why this one can't be replayed later (it can't be called directly, or it records no inputs to replay from over plain run() with an empty-input root) and flag that the script will rot → thesetup-cleanupskill
If the user picks "Refactor" (or a boundary move that requires rewriting callers), present a refactor plan labeled as visibility or structural and get a second confirmation before modifying code (the "Refactor confirmation" rules below say what the plan must contain).
Next:
replay): invoke the setup-cleanup skill with mode replay, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).replay): invoke the setup-cleanup skill with mode replay, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).replay): invoke the setup-cleanup skill with mode replay, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).replay): invoke the setup-cleanup skill with mode replay, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).Whenever the user picks "refactor to extract a pure core" (or any option that modifies existing functions/call sites, not just adds new wrappers), you must:
Build a refactor plan listing:
getFunction(...) / SDK trace wrap after the refactorPresent the plan verbatim to the user, in the same format above.
Use AskUserQuestion with exactly two options:
Never modify existing code on a refactor path without completing this three-step confirmation. Adding new instrumentation wrappers to unchanged functions is not a refactor and does not need this confirmation (purely-additive instrumentation). But if the write-instrumentation step itself turns out to require modifying, re-implementing, or hand-reconstructing an existing call to seat a root (the wrap is not actually additive), that IS a refactor: stop and run this three-step confirmation before touching the code.
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)