Use Counterfact to understand and improve your agent.
Counterfact reads your agent's prompts, tools, and code, and tells you where it will misbehave: instructions that contradict each other, tools it can't use correctly, cases nobody handled. Each finding says what goes wrong if you leave it, and how to fix it.
You choose where the analysis runs. Run it in your coding agent and your agent's files stay on your machine, or connect GitHub in the web console and we run it for you.
Your first analysis is free at any size. No card needed.
In your coding agent
Your files stay on your machine
Run Counterfact from Claude Code, Codex, or any terminal. The analysis runs on your machine, and each model call goes through a sealed relay that neither we nor you can look inside. Your coding agent applies the fixes, so we never need access to your repository.
In the web console
Connect GitHub and we run it
Sign up, connect a repository, and Counterfact analyzes your agent on our servers. It can check every pull request that changes your agent, and open a pull request with each fix you choose.
Both ways give you the same findings, the same history in the console, and the same prices.
Who sees what
| In your coding agent | In the web console | |
|---|---|---|
| Where the analysis runs | On your machine | On Counterfact's servers |
| Your agent's files | Never reach Counterfact's servers | Read from GitHub for each analysis |
| The model provider | Anthropic reads each request, through the sealed relay | Anthropic reads each request |
| What Counterfact stores | Your findings, with short quotes from your files | Your findings, with short quotes from your files |
| Fixes | Your coding agent edits your files | Counterfact opens a pull request |
We never train models on your agent. See privacy.
Questions
- Which way should I choose? If your agent's prompts and code must stay in-house, use your coding agent. If you want pull request checks and fixes opened for you without installing anything, use the web console. You can use both from the same account.
- Who built Counterfact? Counterfact was developed by Arya Tafvizi, a Google DeepMind and Search veteran, and is backed by a group of the tech industry's most accomplished leaders. Meet them on the Counterfact team page.
- What does each analysis cost? Your first analysis is free at any size.
After that, each analysis has one price, set by your agent's size, whichever way you run it. Prices are listed below and on the top-up page, and nothing is charged unless the analysis finishes.
You pay from a prepaid balance, topped up $10, $25, or $50 at a time. Pull request analyses on a connected GitHub repository use the same prices. Prices are in US dollars, and tax is added at checkout where it applies.Size Text read Each analysis or fix Small agent up to about 200 KB of text $1.99 Medium agent up to about 480 KB of text $3.99 Large agent more than that $7.99 - What does a fix cost? In your coding agent, your agent applies the fix, and Counterfact charges nothing for it. In the web console, a fix costs the same as an analysis of its agent, and it is charged to your balance only if it opens a pull request.
- What counts as small, medium, or large? How much text the analysis reads from your agent's prompts and code: up to about 200 KB is small, up to about 480 KB is medium, and more than that is large. Most single agents are small or medium.
- What if an analysis fails? You aren't charged. The amount held for it returns to your balance. In your coding agent, if the relay can't be reached, the analysis stops; it never sends your files to us instead.
- Can my security team check the relay? Yes. The part that sends your files off your machine is small and open source, and it only talks to a relay whose published image Google Cloud vouches for. Get in touch for the details.
- Can I get a refund? Unused balance can be refunded within 30 days of the top-up. See the terms.
- Is Counterfact SOC 2 compliant? Counterfact is aligned with SOC 2 controls, and we are in the process of SOC 2 certification. See privacy.
- Is there a plan for teams? For a shared workspace, single sign-on, or a contract, get in touch.
Use Counterfact in Claude Code
- Sign in. It is free, and no credit card is needed. In a terminal, run:
It shows a link and a code: open the link on any device and enter the code. You can also skip this step, and Counterfact asks you to sign in the first time you run it in Claude Code. If no browser opens then, for example on a cloud workstation or over SSH, go to the link Claude shows, on any device, and enter the code.npx -y @counterfact-labs/cli login - Install the plugin. In a terminal, run:
Ifclaude plugin marketplace add counterfact-labs/claude-plugins && claude plugin install counterfact@counterfact-labs/counterfactdoesn't show up in Claude Code yet, run/reload-plugins. - Allow Counterfact's analysis once, so auto mode doesn't stop it. In Claude Code, run
/permissions, choose Allow, and add this rule:
The analysis runs on your machine. Model requests go encrypted to Counterfact's sealed relay, which we can't read, and only the findings are saved to your console. The first time you run Counterfact, it offers to add this rule for you.mcp__plugin_counterfact_counterfact__check_agent - If you use Claude Code's sandbox, allow
relay.counterfactlabs.comandapp.counterfactlabs.comwhen Claude Code asks, or add both to the sandbox's allowed domains. - Analyze your agent. Commit your agent's latest changes first, because the analysis
reads the committed version. Then run:
Or ask Claude in your own words, for example "Use Counterfact to analyze my agent in ./your-agent-folder". Claude shows which files it will analyze, then the analysis starts./counterfact:counterfact ./your-agent-folder - Fix what it finds. Ask Claude to fix a finding by its number, for example "Fix finding F-3 from Counterfact". Claude reads the fix plan and edits your files.
Codex and other terminals
In Codex, add Counterfact as a tool, then ask Codex to analyze your agent:
codex mcp add counterfact -- npx -y @counterfact-labs/cli mcp
From any terminal:
npx -y @counterfact-labs/cli check
Both run the analysis on your machine, the same as in Claude Code. If your terminal or coding agent
limits network access, allow relay.counterfactlabs.com and app.counterfactlabs.com.
Use the web console
- Sign up at app.counterfactlabs.com with your email. It is free, and no credit card is needed.
- Connect GitHub and choose the repository that holds your agent.
- Analyze your agent. Your first analysis is free.
- Fix what it finds. Answer the questions a finding asks, and Counterfact opens a pull request with the fix. Turn on pull request checks to catch new problems before they merge.