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.

Set up your coding agent

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.

Open the web console

Both ways give you the same findings, the same history in the console, and the same prices.

Who sees what

In your coding agentIn the web console
Where the analysis runsOn your machineOn Counterfact's servers
Your agent's filesNever reach Counterfact's serversRead from GitHub for each analysis
The model providerAnthropic reads each request, through the sealed relayAnthropic reads each request
What Counterfact storesYour findings, with short quotes from your filesYour findings, with short quotes from your files
FixesYour coding agent edits your filesCounterfact 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.
    SizeText readEach analysis or fix
    Small agentup to about 200 KB of text$1.99
    Medium agentup to about 480 KB of text$3.99
    Large agentmore than that$7.99
    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.
  • 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

  1. Sign in. It is free, and no credit card is needed. In a terminal, run:
    npx -y @counterfact-labs/cli login
    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.
  2. Install the plugin. In a terminal, run:
    claude plugin marketplace add counterfact-labs/claude-plugins && claude plugin install counterfact@counterfact-labs
    If /counterfact doesn't show up in Claude Code yet, run /reload-plugins.
  3. Allow Counterfact's analysis once, so auto mode doesn't stop it. In Claude Code, run /permissions, choose Allow, and add this rule:
    mcp__plugin_counterfact_counterfact__check_agent
    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.
  4. If you use Claude Code's sandbox, allow relay.counterfactlabs.com and app.counterfactlabs.com when Claude Code asks, or add both to the sandbox's allowed domains.
  5. Analyze your agent. Commit your agent's latest changes first, because the analysis reads the committed version. Then run:
    /counterfact:counterfact ./your-agent-folder
    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.
  6. 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

  1. Sign up at app.counterfactlabs.com with your email. It is free, and no credit card is needed.
  2. Connect GitHub and choose the repository that holds your agent.
  3. Analyze your agent. Your first analysis is free.
  4. 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.