Metadata-Version: 2.4
Name: checkergate
Version: 0.1.0
Summary: Check what your AI agent says against what its logs show, then find out whether that check can be trusted on your traffic.
License-Expression: Apache-2.0
Project-URL: Homepage, https://huggingface.co/spaces/sarptandoven/checkergate
Project-URL: Source, https://huggingface.co/spaces/sarptandoven/checkergate/tree/main
Project-URL: Issues, https://huggingface.co/spaces/sarptandoven/checkergate/discussions
Keywords: agents,ai-agents,agent-traces,claims,evaluation,llm,observability,tool-calling
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: tfidf
Requires-Dist: scikit-learn>=1.3; extra == "tfidf"
Provides-Extra: train
Requires-Dist: scikit-learn>=1.3; extra == "train"
Requires-Dist: torch>=2.6; extra == "train"
Requires-Dist: transformers>=4.48; extra == "train"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: scikit-learn>=1.3; extra == "dev"
Dynamic: license-file

# checkergate

**Did your agent do what it said?**

checkergate compares what an AI agent tells you with what its logs show. Then it helps you find out how far that
comparison can be trusted on your own traffic, which is the part most tools skip.

It runs on your machine. The core has no dependencies, needs no API key and sends nothing anywhere. Model readers are
optional, and you choose where they run.

## Three ways in

**In your browser.** Open [the Space](https://huggingface.co/spaces/sarptandoven/checkergate) and drop in a log file. Python runs inside the page, so your logs stay in the tab.

**One command, on the logs you already have.** Reads Claude Code and Codex sessions from their usual folders:

    pip install checkergate
    checkergate audit
    checkergate audit --label        # judge five flags yourself and get a precision number for your logs

**A project of your own.** For your own agent and tools. The `coding` and `support` templates come with sample logs, so with
those every step works straight away; the other templates start with an empty `logs/` folder:

    checkergate init my-checker --template support
    cd my-checker
    checkergate next                 # looks at the folder and tells you the next step

## What you get

This is the coding pack on 1,090 public Claude Code sessions:

    claim                   said  backed  receipt  unbacked  contradicted  unknown  denied
    tests_passed             299     278        0        18             1        2       4
    test_count_right          15       5        0         0             0       10       4
    committed                 11      11        0         0             0        0       0
    files_changed              3       1        0         0             0        2       1
    whole_suite_passed         3       2        0         1             0        0       2
    pushed                     2       0        1         1             0        0       1

| Column | Meaning |
|---|---|
| said | Messages stating it happened. Every verdict below counts these. |
| backed | The log shows it happened. |
| receipt | The log shows a request was accepted, not the outcome. A push that printed success. An email API that said 202. |
| unbacked | No proof in the log, or the proof went stale because something changed after it. |
| contradicted | The log shows the opposite. |
| unknown | The log cannot tell, for example when another agent did the work. |
| denied | Messages saying it did not happen. Counted apart. |

The audit names the pack it used. Tool names compare without case, and the coding pack lists the shell and edit tools of
Claude Code, Codex, Gemini CLI, Cursor, Factory Droid, Pi, opencode, hermes and vtcode. If a claim's tools never appear in your
logs it marks that claim unknown, names the tools your logs do call, and says to list them in a pack folder of your own
(`checkergate init my-pack`, then `--pack my-pack`), rather than blaming your agent. Other built-in packs: `--pack support`,
`data`, `ops`, `browser`, `sales`. Inside a project, it uses your claims and your adapter.

Nothing here blocks your agent. It reports.

## Try it on public logs

The Hub has [hundreds of agent trace datasets](https://huggingface.co/datasets?format=format%3Aagent-traces). Point the
audit at one:

    hf download armand0e/claude-fable-5-claude-code --repo-type dataset --local-dir traces
    checkergate audit traces

## What to expect

We ran the audit on logs we did not write. Keyword matching was tuned while looking at these same logs, so read these as
a rough guide, not a measured accuracy.

- **1,090 public Claude Code sessions** from three datasets: 333 stated successes, of which 297 were backed, 1 was a receipt,
  14 could not be checked and 21 were flagged. The 21 were 10 distinct sentences, and "All tests pass." alone was 12 of them.
  Nobody has read all 21 sessions, so we give no count of how many are real. One you can judge from its evidence line:
  "All 43 tests pass." after `cargo test retry_with_backoff --lib`, a narrowed run, with edits after it.
  **Expect most flags to be wrong or unclear.**
- **985 public refund runs**, where a script graded what really happened and agents were honest: no false alarms, and
  473 of the 492 messages from runs with a refund read as claiming one. One keyword rule had to be fixed to get there.

That is why `--label` exists. Five judgements on your own logs tell you more than any figure here.

## Why it works this way

A few public measurements shaped the design. Each is one team or one study, so read them as direction, not as rates.

- **The usual failure is an unbacked claim, not a lie.** One team labelled 357 "all tests pass" claims from 150 sessions:
  178 backed, 80 unbacked, 92 uncheckable, 5 contradicted, 2 other. In their development set, 32 of 36 unbacked claims
  were stale passes: tests passed, the agent edited code, then reported the old pass as current.
  ([claude-code#104504](https://github.com/anthropics/claude-code/issues/104504))
- **Exit codes hide failures.** In the same report, 1,514 of 2,084 test runs were piped through `tail` or `head`, so a
  failing run could exit 0. checkergate reads the output as well as the exit code.
- **Whole-suite false claims look rare now.** One study of agent pull requests found CI contradicted 8.7% of them in 2025
  and 0.3% in mid 2026. Its own CONTRADICTED verdict was right 2 times in 12.
  ([testreceipt](https://github.com/amos689/testreceipt))
- **Checkers are often wrong too.** One author audited their own tool and found 11 correct flags in 30 decidable cases.
  ([write-up](https://dev.to/furkiak/i-tested-my-claude-code-plugin-across-1260-live-sessions-four-sentences-nearly-matched-it-46ao))
- **LLM judges anchor on confident wording.** One paper found no judge setup above AUROC 0.65 on false success in
  tau2-bench. ([Advani](https://arxiv.org/html/2606.09863))

So checkergate splits the job. A reader only answers "what does this message say?" and never sees the record. Plain
code compares that answer with the log. A gate then checks the evidence before anyone trusts the result.

## The full path

`checkergate next` walks you through this and `checkergate docs` holds the guides. The sample logs are small, so that path
ends at `NOT ENOUGH EVIDENCE`. That is the gate working, not a failure. A real project needs tens of real cases.

Three more commands sit outside the path. `checkergate demo` writes two reports from invented data, offline, one that fails
and one that passes, so you can see what a report looks like. `checkergate units` rebuilds the messages and what the record
says about each from the logs. `checkergate formats` lists the log formats that can be read.

| Step | Command | What it does |
|---|---|---|
| Look | `preflight` | Can these logs back up these claims at all? Names the closest tool when a rule can never fire. |
| Look | `scan` | Lists candidates now, from keywords. Leads, not findings. |
| Fix rules | `pilot`, `take` | A small page where you decide who was wrong. Most early contradictions are wrong rules. |
| Label | `label` | Two readers from different model families read every message. Where they fully agree, the reading trains. Messages they disagree on are left out of training and counted. |
| Split | `split` | Whole tasks set aside for the test, before any model exists. |
| Test labels | `page`, `take` | An offline page where a person reads test messages without seeing the record. |
| Seal | `seal` | Fixes the labels, plan and rules, once. Choose your checker here with `--primary`. Later edits show up. |
| Train | `train` | TF-IDF in seconds (`pip install "checkergate[tfidf]"`), then a small encoder (`pip install "checkergate[train]"`): minutes on a GPU, about an hour for three seeds on a 16 GB laptop with `--batch 4`. |
| Confirm | `confirm` | Optional. A stronger model checks each flag against the record. It is asked about every claim the record could contradict for a flagged message, so expect two to three questions per flag. |
| Try | `probes` | Controlled sentences with known answers: quoted, conditional, retracted. |
| Decide | `read` | Writes `gate/report.md` with what the evidence supports. |
| Again | `retest` | A new test from logs added since, after each reader has labelled them. Nothing an earlier test was picked from comes back. |
| Use | `check`, `card` | Run on new logs, export OpenTelemetry events, write a model card with the limits in it. |

## What the gate checks

It reads ids, labels and flags, never message text, so a report can be shared. It looks for:

- tuning on the test set (a seal, capped reads, one checker per test, and seeds that cannot be dropped or swapped once read)
- testing on tasks or agents seen in training, and repeated text across the split
- gold labels written by the same models as the training data, or a confirmer from the gold's model family
- quoting the luckiest seed, or a copy of it
- losing to a cheaper baseline
- too few real cases to say anything
- an enriched test scored as if it were a plain sample
- precision quoted at a base rate above your traffic's

Verdicts: `QUALIFIED: ALERTS`, `QUALIFIED: REVIEW QUEUE ONLY`, `SCREEN ONLY`, `NOT QUALIFIED`,
`NOT QUALIFIED FOR THIS CLAIM`, `NOT ENOUGH EVIDENCE`, `INVALID`. AI-written gold can reach `SCREEN ONLY` at most.
See [docs/reading-a-report.md](https://huggingface.co/spaces/sarptandoven/checkergate/blob/main/docs/reading-a-report.md).

## Claim packs

`coding` is built from the failures in the reports above: stale passes, hidden exit codes, narrowed runs, wrong counts,
phantom edits. `support`, `data`, `ops`, `browser` and `sales` are examples, not validated. Rename the tools to match yours.

## Log formats

Claude Code, Codex, OpenAI chat, tau-bench, OpenTelemetry GenAI, Inspect, ATIF, Hugging Face session traces, Langfuse,
LangSmith and a plain JSONL format. The format is worked out file by file, so one folder can hold several, and files that
are not a log it reads are counted and skipped with one line. For anything else, write a short `adapter.py`;
`checkergate skill` installs a skill that lets a coding agent do that for you.

Factory Droid and Cursor exports read as Claude Code, and Pi sessions as Hugging Face traces.

| Tried on real public logs | Tried on small fixtures only |
|---|---|
| Claude Code, Codex, tau-bench, Hugging Face traces, OpenAI chat, ATIF, Inspect | LangSmith tool runs |
| Langfuse trace exports | Langfuse API pages |
| OpenTelemetry trace documents | OTLP JSON from a collector |

Tell us when one breaks, on the Space's Community tab. A file that cannot be read is skipped with a note, never a crash.

## Do you need this?

Maybe not. If you can put the action in code rather than in the model's hands, do that first. In one self-run test, four
sentences of instructions matched a dedicated plugin on task success. Read
[docs/do-you-need-a-checker.md](https://huggingface.co/spaces/sarptandoven/checkergate/blob/main/docs/do-you-need-a-checker.md) before you label anything.

## What it can't do

- It can't see outside the log. A refund that settled, a healthy service and a fixed bug all need other evidence.
- The keyword reader behind `audit` and `scan` raises false alarms and misses claims. Measure it with `--label`.
- A rule can match the right tool for the wrong thing: a refund on another order still counts as a refund.
- Logs can be wrong too, including harnesses that report success on failure.
- A verdict covers this evidence, these claims and this sample. It does not transfer to another agent or another domain.
- The seal shows tampering; it does not prevent it. Keep test labels out of an agent's reach.

## Worked example

[`examples/tau_bench`](https://huggingface.co/spaces/sarptandoven/checkergate/blob/main/examples/tau_bench/README.md) runs the whole path on real public logs from tau-bench, and ends with the
gate saying there are too few false claims there to qualify a checker.
[`examples/refund_authority`](https://huggingface.co/spaces/sarptandoven/checkergate/blob/main/examples/refund_authority/README.md) checks support claims against script-graded runs.

## Status

0.1.0, a first release. Tested on macOS with Python 3.11 to 3.14, and in Chrome for the Space. Linux and Windows are
untested. The neural trainer has run on Apple GPUs only.

## Licence

Apache-2.0 for this code. The tau-bench logs used by the worked example are MIT, copyright Sierra.
