How to use ClearRun mock mode for local development (forceMock)

Create the client with createKernelClient({ forceMock: true }). It returns local test verdicts on your computer with no key and no network. Mock verdicts are not real evaluations and are never signed.

Last updated

Steps

  1. Turn on mock mode

    import { createKernelClient } from '@clearrun/sdk';
    const client = createKernelClient({ forceMock: true });
  2. Use it like the real client

    const { verdict } = await client.score({ responseText: 'Our API never stores customer data.' });
    console.log(verdict.verdictId, verdict.score, verdict.signature);
  3. Switch to hosted for real scores

    Remove forceMock and set CLEARRUN_API_KEY.

How to tell a mock verdict

  • verdictId starts with mock_.
  • scoringVersion is mock-1.0.0.
  • signature, signatureKeyId and signatureAlg are null.
  • The summary says "Mock verdict for local/standalone use; not a real evaluation."

Good for

Building before you have a key, and unit tests. Hosted scores work differently: a later run of the same text can score differently.

Only the SDK has it

The CLI and MCP server always call ClearRun.