Skip to content

Judge

judge scores whether an AI answer is supported by the code context you supplied — a cheap, local check for confident-but-unsupported answers.

Use it

Save the context pack to a file with -o, capture the assistant's answer, then judge one against the other:

bash
tokengraph context "retry logic" -b 4000 -o context.md   # save the pack
# … paste context.md into your assistant, save its reply to response.txt …
tokengraph judge --answer-file response.txt --context-file context.md

Or pass strings inline:

bash
tokengraph judge --answer "the retry helper lives in http/client.py" \
                 --context "$(tokengraph context 'retry logic' -b 4000)"

Output

A grounding score (0–100%) with a grounded=True/False verdict (threshold 50%). A low score means the answer asserts things the context doesn't back up — treat it as a prompt to retrieve more or push back on the model.

Flags

FlagMeaning
--answer / --answer-fileThe answer to score (inline or file)
--context / --context-fileThe context it should be grounded in
--jsonMachine-readable output

Judge vs. Verify

  • Judge asks "is the reasoning supported by this context?" (a soft score).
  • Verify asks "does every file/symbol it names actually exist?" (a hard, exit-1 check).

Run both: judge catches hand-wavy answers, verify catches fabricated references.

Next steps

  • Hard-check references: Verify
  • Quantify the whole guard over a corpus: Benchmark

Released under the terms in the repository LICENSE.