No slash command · from bitfab
DB Snapshot 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 db-snapshot.
Set up the Postgres sandbox (per-trace database snapshots for replay) so the team can re-run a historical trace against the database state that existed when the trace was captured, not today's data. This is what makes replay trustworthy for any code that reads stored state (a refund decision over a since-cancelled order, a retrieval step over last week's rows). Triggered explicitly by /bitfab:setup db-snapshot, never reached from wizard.
This registry-based setup flow supports TypeScript, Python, and Ruby. Go also supports database-snapshot replay through its programmatic API. For Go, point to https://docs.bitfab.ai/go-sdk.md and https://docs.bitfab.ai/reference/go.md for ReplayOptions.DBBranch and GetCurrentReplayBranch(ctx), then stop this registry-specific flow.
Capture is automatic in current SDKs, there is nothing to turn on. Eligible root traces captured by an SDK version with always-on snapshot references pin the wall-clock instant they ran (no client config required), so those traces can later be replayed against their historical DB state, subject to replication lag. Older traces without a snapshot reference use the normal database path. Setup is therefore just two pieces:
sandboxModes: { postgres: true } in TypeScript, sandbox_modes={"postgres": True} in Python, db_branch: true in Ruby) and, inside the replayed function, connect using the sandbox's URL instead of your live DATABASE_URL.Source of truth: read https://docs.bitfab.ai/db-branching.md (the end-to-end, per-language setup) and your SDK's reference (/reference/typescript.md, /reference/python.md, /reference/ruby.md) for the exact replay / branch-accessor signatures before editing any code. The replay option and the accessor names differ per SDK, do not improvise from memory.
Confirm the SDK language. This registry-based flow supports TypeScript, Python, and Ruby. If the project is Go, explain that its SDK supports database-snapshot replay through the programmatic API, point to https://docs.bitfab.ai/go-sdk.md and https://docs.bitfab.ai/reference/go.md for ReplayOptions.DBBranch and GetCurrentReplayBranch(ctx), and route to cleanup.
Check authentication. Run:
node "${CLAUDE_PLUGIN_ROOT}/dist/commands/status.js"
If it reports not authenticated, run node "${CLAUDE_PLUGIN_ROOT}/dist/commands/login.js" (blocks until the browser login completes), then continue.
Locate the replay registry module(s) you'll edit later: search for files importing/calling the SDK's replay (commonly under scripts/). If there are no replay registry modules yet, tell the user to run /bitfab:setup replay first to create them, then come back (route to cleanup), DB-snapshot augments an existing replay registry module, it does not create one from scratch. No client-config edit is needed: snapshot capture is always on, so there is nothing to add to new Bitfab({ ... }).
Next:
db-snapshot): invoke the setup-cleanup skill with mode db-snapshot, forwarding $ARGUMENTS minus the leading mode keyword (if the user typed one).Call mcp__plugin_bitfab_Bitfab__get_database_connection_status once to read the current state:
connected: the database is already connected and provisioned. Tell the user, and continue to the next step.none: no database is connected yet. The tool's response includes the exact Sandboxes URL. Relay it to the user and ask them to open it, pick Postgres sandbox, and under Setup paste their Postgres connection string (or connect their Neon project directly). Provisioning the branchable copy takes a few minutes.checking: a connection is already provisioning; continue to the wait step.failed: a previous attempt failed. Point the user back to the Sandboxes page (Postgres sandbox, under Setup) to re-check the connection string, then continue.Do not ask the user to set any BITFAB_NEON_* or NEON_API_KEY environment variables, those are Bitfab-side server config, not customer config. The customer only pastes their source Postgres URL in the dashboard.
Poll mcp__plugin_bitfab_Bitfab__get_database_connection_status until the database is connected. Provisioning (source discovery + engine setup) takes a few minutes, so this loops:
When the status is checking, wait ~15 seconds before calling the tool again, do not hammer it. When it is none or failed, the user hasn't finished connecting (or it errored); re-surface the Sandboxes URL, give them a moment, then re-check. Only proceed once it reports connected.
Update the replay registry module(s) from step 1 so the replayed function connects to the per-trace branch. Ground every edit in https://docs.bitfab.ai/db-branching.md and your SDK's replay / branch-accessor reference, fetch the page for the project's language first; the replay option and the accessor names differ per SDK.
/bitfab:update first. To tune the branch's compute or warm-up SQL, pass postgresSandbox({ minCu, maxCu, warmupSql }) (TypeScript) or postgres_sandbox(min_cu=..., max_cu=..., warmup_sql=...) (Python) in sandboxes instead of the mode. The older dbBranch / db_branch option is deprecated in TypeScript and Python, and the replay command's --db-branch and --no-db-branch flags are removed there:TypeScript: sandboxModes on the replay options:
const result = await client.replay("my-function", myInstrumentedFn, {
limit: 10,
sandboxModes: { postgres: true },
experimentGroupId: randomUUID(),
experimentGroupName: "Database branch check",
})
Python: sandbox_modes=:
result = client.replay(
my_instrumented_fn,
limit=10,
sandbox_modes={"postgres": True},
experiment_group_id=str(uuid.uuid4()),
experiment_group_name="Database branch check",
)
Ruby: db_branch::
result = client.replay(
receiver, :my_method,
trace_function_key: "my-function",
limit: 10,
db_branch: true,
experiment_group_id: SecureRandom.uuid,
experiment_group_name: "Database branch check",
)
DATABASE_URL. The accessor returns the branch resolved for the item currently running, or null when there is none:const url = postgresSandboxUrl(), which is the sandbox inside a replay item and process.env.DATABASE_URL everywhere else (pass { envKey } when the app reads another variable)url = postgres_sandbox_url(), which is the sandbox inside a replay item and os.environ["DATABASE_URL"] everywhere else (pass env_key= when the app reads another variable)branch = Bitfab.current_replay_branch, then url = branch ? branch.database_url : ENV["DATABASE_URL"]Always keep the fallback (the TypeScript and Python helpers above include it): the branch accessor is null on the normal live request path, and for traces captured before the SDK version that added always-on snapshot capture.
Pool / engine / connection bound to DATABASE_URL) will never see the branch URL. If the app pins its DB client at import, refactor so the replayed function can build (or be handed) a client from the branch URL for the duration of the item. Flag this when you spot an import-time pool, it's the most common reason a wired replay still hits production data.Leave the live request path untouched: only the replayed function reads the branch. (Optional, TypeScript only: you can pass dbSnapshot: { provider: "neon" } to new Bitfab({ ... }) to pin the provider at capture time. It is not required: capture works without it; the provider is otherwise resolved at replay time.)
Verify the wiring end-to-end with one freshly captured, exactly identified trace. Capture is automatic in current SDKs, but older traces may have no snapshot reference and would use the normal database path, so --limit 1 is never an acceptable selector here:
mcp__plugin_bitfab_Bitfab__search_traces with { traceFunctionKey: "<key>", limit: 10 } and retain the returned IDs. Record the current timestamp, then run the instrumented function once (or have the user trigger it). Poll the same search once or twice and compare the returned IDs with the before set. Select the ID only when exactly one new root trace has a timestamp after the recorded time. If there are zero new IDs, stop and report that no fresh trace arrived; if concurrent traffic produces more than one candidate, stop and ask the user for the intended trace ID. search_traces does not return trace inputs, so never guess based on an assumed input match. Confirm the exact ID is eligible by calling mcp__plugin_bitfab_Bitfab__search_traces with { traceFunctionKey: "<key>", traceIds: ["<fresh-trace-id>"], hasDbSnapshot: true, limit: 1 }. If it is absent, do not replay it: report that the fresh trace did not capture a snapshot and diagnose SDK freshness/database connection first.mock: "marked" requires mockOnReplay on that boundary. Confirm the boundary runs in the same replay context: Python worker threads require trace_across_threads=True; Python async-generator spans cannot be mocked; Ruby child threads, pre-created consumers, and processes do not inherit replay interception; TypeScript synchronous selected spans cannot use lazy marked output and may use all only when freezing every matched child is acceptable. Also reject unsafe import-time/module initialization, because it runs before replay interception. Confirm the replay call requests dbBranch / db_branch. If any unsafe action is unselected, unmockable, outside context, or uncertain, do not run the smoke test; report the exact blocker and required boundary change. Mocking, not the app environment, is the safety boundary.--trace-ids <fresh-trace-id> (for example, pnpm with-env bitfab-replay --registry scripts/replayRegistry.ts <pipeline> --code-change skip --trace-ids <fresh-trace-id> --experiment-group-id <new UUID> --experiment-group-name "Setup instrumentation check", poetry run bitfab-replay --registry scripts/replay_registry.py <pipeline> --code-change skip --trace-ids <fresh-trace-id> --experiment-group-id <new UUID> --experiment-group-name "Setup instrumentation check", or bundle exec bitfab-replay --registry scripts/replay_registry.rb <pipeline> --code-change skip --trace-ids <fresh-trace-id> --experiment-group-id <new UUID> --experiment-group-name "Setup instrumentation check", with the app's normal environment loader). Pass --code-change skip: this run checks the instrumentation, not a code change. Every replay needs an experiment group, one series of experiments testing one thing: generate a new UUID for --experiment-group-id, since this check starts its own group. Never substitute --limit 1.getCurrentReplayBranch() (TypeScript), get_current_replay_branch() (Python), or Bitfab.current_replay_branch (Ruby) must be non-null. Compare its databaseUrl / database_url host and database with the app's normal DATABASE_URL; they should differ. Print the experiment URL from the replay output (experimentUrl in TypeScript, experiment_url in Python/Ruby; older SDKs print testRunUrl / test_run_url) so the user can open the experiment.If the branch accessor is null for a freshly captured trace, check that the source database is connected, that the trace actually carries a snapshot reference, and that the SDK supports always-on capture (upgrade with /bitfab:update when needed). Re-check the Postgres sandbox's status on the Sandboxes page in step 2; there is no separate replay-environment active flag.
Caveats to surface to the user: each branch lease is short-lived (a few minutes) and is created fresh per replay item; the branch reflects the source database's state at the snapshot instant, bounded by replication lag (typically sub-second to a few seconds).
Next:
db-snapshot: invoke the setup-cleanup skill with mode db-snapshot, 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)