Installation
Run the CLI from your project directory:$bitfab:setup.
Pass an initial setup request with --prompt (or -p) to send it straight to the agent:
codex login first.
For the experimental terminal-native flow, run
npx bitfab-cli init --v2 instead. It does not launch Codex: plan review, setup decisions, and edit approvals stay in the CLI while the Claude Agent SDK performs repository analysis and approved edits. Set ANTHROPIC_API_KEY or configure a supported Agent SDK cloud provider first. Use npx bitfab-cli setup --v2 instrument to run one setup mode, or add --diagram to print its declarative state graph without starting the agent.Manual installation (without the CLI)
Manual installation (without the CLI)
Set your API key as an environment variable:Then add this to
~/.codex/config.toml (global) or .codex/config.toml (project-level):What the Plugin Does
Automatic Setup
The$bitfab:setup skill runs a multi-phase workflow:
- Login — Opens your browser for OAuth authentication, saves credentials securely
- Explain — Walks through the two primitives you instrument with,
withSpanandreplay, including the five ways replay can change a method’s execution. Everything after this asks you to make per-method decisions, so it comes first - Approach — Asks whether the agent should walk you through instrumenting or hand you the docs so you can do it yourself
- Instrument + Replay (in parallel, per workflow) — Reads your codebase, finds all AI workflows (LLM calls, agents, AI-driven decisions), and presents them as a numbered list. You choose which to instrument, or name a file, function, or directory yourself and it reads only that instead of scanning. Either way it adds tracing with minimal diffs and creates a registry module for the replay command shipped with the SDK
Assistant
The$bitfab:assistant skill turns production traces into code improvements, whether the goal is correctness (improving pass rates) or efficiency (cutting token usage and cost). Your agent will do the mechanical work and collaborate with you on three steps:
- Build a dataset from production traces: search for failures, label them with expected outcomes
- Experiment against that dataset: make isolated code changes, replay, compare results
- Hill climb: repeat until the best change is found, then present results
Building the Dataset
Your coding agent does the data wrangling: it searches production traces for failures, reads full inputs and outputs, and identifies edge cases. It then presents edge cases for your judgment: is this a failure (and what should the output be), correct, or irrelevant? This labeled dataset becomes the benchmark for all experiments. The plugin opens a rich UI for navigating and labeling the dataset, then brings you back to your coding agent so you stay in flow. You can label every trace yourself, or label a few and let the agent classify the rest based on the patterns you’ve established.Running Experiments
The skill reads your code, diagnoses failure patterns, and categorizes proposed changes:- Code fixes: deterministic bugs, bundled into one experiment as a foundation
- Judgment-based fixes: prompt changes, search tuning, output formatting, each gets its own experiment
- Infrastructure proposals: larger changes noted for future work, not experimented on
Results
After each round, you see which traces now match expected outcomes, which still diverge, and whether any regressions occurred. The assistant works through the planned experiments in turn without pausing to ask whether to keep going, then wraps up once the plan is complete. The final summary shows pass rate improvement and all files changed, uncommitted in your working tree for review.MCP Tools
The plugin registers MCP tools that Codex can call during conversations. These let you inspect traces, diagnose failures, and improve your code without leaving the terminal.Core
Trace Inspection
Labeling and Datasets
Experiments
Templates
Instrumentation
Skills
Example Workflows
Instrument a new project
Diagnose and fix a failing function
Ask Codex naturally:search_traces and get_traces to inspect failing traces and suggests code fixes directly.
For a specific failing trace, run $bitfab:assistant fix <trace-id>. The agent diagnoses the failure, confirms why the original trace is wrong before editing when the trace or conversation does not already make that clear, makes the focused code fix, and replays only that trace first. Once the fix passes, it adds that trace to a dataset with a validated failing label, then branches: inspect the before/after in Studio, re-run the full dataset (in Studio or terminal-only), keep iterating, or stop. If that full-dataset re-run reveals real regressions (previously-passing traces the fix broke), it reports them and keeps the target trace saved as a red test to revisit. If the replay still fails, it offers to keep iterating or save the trace as a failing test instead.
Iterate on a trace function
Replay after a code change
After updating a function, pass your registry module to the replay command installed by the SDK:.bitfab/replays/<run-id>/items/ folder and referenced from .bitfab/replays/<run-id>/events.jsonl. If the replay command succeeds but its local result cannot be captured, the plugin reports the outcome as unverified instead of failed, then checks the server test run to recover the final result.
Configuration
Credentials
Credentials are stored in.bitfab/credentials.local.json when that project-local file exists, otherwise in ~/.config/bitfab/credentials.json (created by $bitfab:setup login with owner-readable permissions).
Environment Variables
Troubleshooting
Not authenticated
If you see “Not authenticated” on session start:- Run
$bitfab:setup loginto authenticate via browser - Check that
~/.config/bitfab/credentials.jsonexists and contains your API key - If using an environment variable, verify
BITFAB_API_KEYis set
MCP tools not available
If Codex can’t access the Bitfab tools:- Verify the MCP server configuration in
~/.codex/config.tomlor.codex/config.toml - Check that
BITFAB_API_KEYis set in your environment - Try restarting Codex
Plugin updates
Run$bitfab:update to install the latest version.