agent-claimcheck 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agent_claimcheck-0.1.1/.env.example +24 -0
- agent_claimcheck-0.1.1/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
- agent_claimcheck-0.1.1/.github/ISSUE_TEMPLATE/config.yml +5 -0
- agent_claimcheck-0.1.1/.github/ISSUE_TEMPLATE/feature_request.md +26 -0
- agent_claimcheck-0.1.1/.github/workflows/ci.yml +59 -0
- agent_claimcheck-0.1.1/.github/workflows/publish.yml +29 -0
- agent_claimcheck-0.1.1/.gitignore +14 -0
- agent_claimcheck-0.1.1/.python-version +1 -0
- agent_claimcheck-0.1.1/CHANGELOG.md +74 -0
- agent_claimcheck-0.1.1/CONTRIBUTING.md +95 -0
- agent_claimcheck-0.1.1/LICENSE +202 -0
- agent_claimcheck-0.1.1/PKG-INFO +494 -0
- agent_claimcheck-0.1.1/README.md +462 -0
- agent_claimcheck-0.1.1/SECURITY.md +54 -0
- agent_claimcheck-0.1.1/benchmark/v1/DATASET_CARD.md +180 -0
- agent_claimcheck-0.1.1/benchmark/v1/manifest.json +119 -0
- agent_claimcheck-0.1.1/benchmark/v1/traces.test.jsonl +120 -0
- agent_claimcheck-0.1.1/benchmark/v1/traces.train.jsonl +180 -0
- agent_claimcheck-0.1.1/claimcheck.toml.example +37 -0
- agent_claimcheck-0.1.1/docs/adr/0001-stdlib-http-server.md +27 -0
- agent_claimcheck-0.1.1/docs/adr/0002-declarative-rule-dsl.md +31 -0
- agent_claimcheck-0.1.1/docs/adr/0003-json-model-artifacts.md +32 -0
- agent_claimcheck-0.1.1/docs/adr/0004-rule-scores-and-gate-thresholds.md +49 -0
- agent_claimcheck-0.1.1/docs/adr/0005-evaluation-protocol.md +40 -0
- agent_claimcheck-0.1.1/docs/adr/0006-platt-scaling-calibrator.md +40 -0
- agent_claimcheck-0.1.1/docs/adr/0007-no-vendor-adapters.md +33 -0
- agent_claimcheck-0.1.1/docs/benchmark-tools.md +211 -0
- agent_claimcheck-0.1.1/docs/detectors.md +305 -0
- agent_claimcheck-0.1.1/docs/img/check.svg +157 -0
- agent_claimcheck-0.1.1/docs/img/dashboard.png +0 -0
- agent_claimcheck-0.1.1/docs/interop.md +153 -0
- agent_claimcheck-0.1.1/docs/metrics.md +125 -0
- agent_claimcheck-0.1.1/docs/python-api.md +106 -0
- agent_claimcheck-0.1.1/docs/rules.md +180 -0
- agent_claimcheck-0.1.1/examples/README.md +85 -0
- agent_claimcheck-0.1.1/examples/browser-demo.jsonl +24 -0
- agent_claimcheck-0.1.1/examples/probes.jsonl +1 -0
- agent_claimcheck-0.1.1/examples/rules/custom.yaml +21 -0
- agent_claimcheck-0.1.1/examples/traces.jsonl +12 -0
- agent_claimcheck-0.1.1/pyproject.toml +99 -0
- agent_claimcheck-0.1.1/results/v0.1.0/bench.json +1013 -0
- agent_claimcheck-0.1.1/results/v0.1.0/bench.md +185 -0
- agent_claimcheck-0.1.1/results/v0.1.0/calibration.json +67 -0
- agent_claimcheck-0.1.1/results/v0.1.0/histogram.svg +79 -0
- agent_claimcheck-0.1.1/results/v0.1.0/judge-records.jsonl +1200 -0
- agent_claimcheck-0.1.1/results/v0.1.0/lodo-models.json +482 -0
- agent_claimcheck-0.1.1/results/v0.1.0/offline-predictions.jsonl +1500 -0
- agent_claimcheck-0.1.1/results/v0.1.0/offline-timings.jsonl +1200 -0
- agent_claimcheck-0.1.1/results/v0.1.0/reliability.svg +68 -0
- agent_claimcheck-0.1.1/results/v0.1.0/run.json +48 -0
- agent_claimcheck-0.1.1/schemas/agent-trace-v1.json +79 -0
- agent_claimcheck-0.1.1/schemas/claimcheck-result-v1.json +125 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/__init__.py +22 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/__init__.py +5 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/__init__.py +157 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/_blocked_words.py +4456 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/booking.py +468 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/card.py +196 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/coding.py +385 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/common.py +160 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/crm.py +500 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/leakage.py +77 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/plan.py +154 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/pools.py +375 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/generator/validate.py +285 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/live.py +483 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/report.py +1287 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/runner.py +288 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/bench/svg.py +215 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/calibration.py +209 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/checker.py +374 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/claims.py +163 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/cli.py +812 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/config.py +220 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/__init__.py +13 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/base.py +64 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/baselines.py +75 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/classifier.py +241 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/ensemble.py +169 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/judge.py +344 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/detectors/rules.py +92 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/features.py +328 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/gate.py +72 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/__init__.py +3 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/cache.py +71 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/client.py +153 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/parse.py +126 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/prompts/claim-audit.md +29 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/prompts/claim-by-claim.md +32 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/judge/render.py +202 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/ledger.py +332 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/metrics.py +267 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/models/calibrators-v1.json +67 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/models/lr-v1.json +161 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/redact.py +72 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/resources.py +70 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/rules/__init__.py +0 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/rules/engine.py +622 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/rules/packs/booking.yaml +27 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/rules/packs/coding.yaml +32 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/rules/packs/crm.yaml +31 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/rules/packs/generic.yaml +5 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/schema.py +399 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/__init__.py +0 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/app.py +703 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/batch.py +182 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/state.py +233 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/static/app.js +671 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/static/format.js +156 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/static/index.html +305 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/static/render.js +203 -0
- agent_claimcheck-0.1.1/src/agent_claimcheck/server/static/styles.css +1327 -0
- agent_claimcheck-0.1.1/tests/conftest.py +58 -0
- agent_claimcheck-0.1.1/tests/factory.py +108 -0
- agent_claimcheck-0.1.1/tests/js/format.test.mjs +199 -0
- agent_claimcheck-0.1.1/tests/js/render.test.mjs +262 -0
- agent_claimcheck-0.1.1/tests/test_bench_generator.py +281 -0
- agent_claimcheck-0.1.1/tests/test_bench_live.py +664 -0
- agent_claimcheck-0.1.1/tests/test_bench_report.py +778 -0
- agent_claimcheck-0.1.1/tests/test_bench_runner.py +125 -0
- agent_claimcheck-0.1.1/tests/test_bench_svg.py +48 -0
- agent_claimcheck-0.1.1/tests/test_calibration.py +125 -0
- agent_claimcheck-0.1.1/tests/test_checker.py +372 -0
- agent_claimcheck-0.1.1/tests/test_claims.py +162 -0
- agent_claimcheck-0.1.1/tests/test_cli.py +55 -0
- agent_claimcheck-0.1.1/tests/test_cli_bench.py +118 -0
- agent_claimcheck-0.1.1/tests/test_cli_check.py +794 -0
- agent_claimcheck-0.1.1/tests/test_cli_train.py +371 -0
- agent_claimcheck-0.1.1/tests/test_config.py +133 -0
- agent_claimcheck-0.1.1/tests/test_detectors_baselines.py +64 -0
- agent_claimcheck-0.1.1/tests/test_detectors_classifier.py +263 -0
- agent_claimcheck-0.1.1/tests/test_detectors_ensemble.py +176 -0
- agent_claimcheck-0.1.1/tests/test_detectors_judge.py +461 -0
- agent_claimcheck-0.1.1/tests/test_detectors_rules.py +142 -0
- agent_claimcheck-0.1.1/tests/test_docs.py +90 -0
- agent_claimcheck-0.1.1/tests/test_examples.py +24 -0
- agent_claimcheck-0.1.1/tests/test_features.py +229 -0
- agent_claimcheck-0.1.1/tests/test_gate.py +81 -0
- agent_claimcheck-0.1.1/tests/test_judge_cache.py +65 -0
- agent_claimcheck-0.1.1/tests/test_judge_client.py +243 -0
- agent_claimcheck-0.1.1/tests/test_judge_parse.py +111 -0
- agent_claimcheck-0.1.1/tests/test_judge_render.py +220 -0
- agent_claimcheck-0.1.1/tests/test_ledger.py +327 -0
- agent_claimcheck-0.1.1/tests/test_metrics.py +171 -0
- agent_claimcheck-0.1.1/tests/test_packaging.py +101 -0
- agent_claimcheck-0.1.1/tests/test_python_api.py +28 -0
- agent_claimcheck-0.1.1/tests/test_readme.py +48 -0
- agent_claimcheck-0.1.1/tests/test_recorded_run.py +96 -0
- agent_claimcheck-0.1.1/tests/test_redact.py +58 -0
- agent_claimcheck-0.1.1/tests/test_rules_engine.py +595 -0
- agent_claimcheck-0.1.1/tests/test_schema.py +225 -0
- agent_claimcheck-0.1.1/tests/test_server_app.py +626 -0
- agent_claimcheck-0.1.1/tests/test_server_batch.py +120 -0
- agent_claimcheck-0.1.1/tests/test_server_state.py +139 -0
- agent_claimcheck-0.1.1/uv.lock +1088 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copy to .env and fill in what you need. Never commit the real file.
|
|
2
|
+
# All variables are read from the process environment only; agent-claimcheck
|
|
3
|
+
# never parses a .env file itself.
|
|
4
|
+
|
|
5
|
+
# Base URL of an OpenAI-compatible /chat/completions endpoint.
|
|
6
|
+
CLAIMCHECK_BASE_URL=https://openrouter.ai/api/v1
|
|
7
|
+
|
|
8
|
+
# API key for CLAIMCHECK_BASE_URL. If unset and the base URL host is exactly
|
|
9
|
+
# openrouter.ai, OPENROUTER_API_KEY is used instead. That fallback key is
|
|
10
|
+
# never sent to any other host.
|
|
11
|
+
CLAIMCHECK_API_KEY=
|
|
12
|
+
|
|
13
|
+
# Model id passed to the judge detector, e.g. deepseek/deepseek-chat.
|
|
14
|
+
CLAIMCHECK_MODEL=
|
|
15
|
+
|
|
16
|
+
# Hard cap in USD for a single live run.
|
|
17
|
+
CLAIMCHECK_MAX_USD=
|
|
18
|
+
|
|
19
|
+
# Path to the cost ledger file. Defaults to ledger.jsonl in the cache
|
|
20
|
+
# directory ($XDG_CACHE_HOME/agent-claimcheck or ~/.cache/agent-claimcheck).
|
|
21
|
+
CLAIMCHECK_LEDGER=
|
|
22
|
+
|
|
23
|
+
# Lifetime spend cap in USD across all runs sharing the same ledger.
|
|
24
|
+
CLAIMCHECK_LEDGER_CAP_USD=
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something doesn't work the way this project documents
|
|
4
|
+
title: ""
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**What happened**
|
|
9
|
+
|
|
10
|
+
A clear description of the problem.
|
|
11
|
+
|
|
12
|
+
**What you expected instead**
|
|
13
|
+
|
|
14
|
+
**How to reproduce**
|
|
15
|
+
|
|
16
|
+
Steps, or a minimal trace file (`agent-trace/v1` JSON Lines) that shows the
|
|
17
|
+
issue. Redact anything sensitive from real data; a hand-written or
|
|
18
|
+
`example:mixed`-style trace that reproduces the issue is easiest to debug.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
paste a minimal reproduction here
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Command and output**
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
$ agent-claimcheck ...
|
|
28
|
+
paste the actual output here
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Environment**
|
|
32
|
+
|
|
33
|
+
- `agent-claimcheck` version (`agent-claimcheck --version` or your installed
|
|
34
|
+
package version):
|
|
35
|
+
- Python version:
|
|
36
|
+
- OS:
|
|
37
|
+
- Installed via (`uvx`, `pip`, editable checkout, ...):
|
|
38
|
+
|
|
39
|
+
**Anything else**
|
|
40
|
+
|
|
41
|
+
Logs, screenshots, or context that might help.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an addition or a change to this project
|
|
4
|
+
title: ""
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**What problem are you trying to solve?**
|
|
9
|
+
|
|
10
|
+
Describe the situation, not just the feature — what are you checking,
|
|
11
|
+
with what kind of agent/trace, and where does the current behavior fall
|
|
12
|
+
short?
|
|
13
|
+
|
|
14
|
+
**What would you like to happen?**
|
|
15
|
+
|
|
16
|
+
A concrete proposal, if you have one: a new CLI flag, a new detector, a new
|
|
17
|
+
rule-DSL check, a new config key, a new `docs/interop.md` mapping, etc.
|
|
18
|
+
|
|
19
|
+
**Alternatives you've considered**
|
|
20
|
+
|
|
21
|
+
Any workaround you're currently using, or another tool you compared this to.
|
|
22
|
+
|
|
23
|
+
**Additional context**
|
|
24
|
+
|
|
25
|
+
Anything else worth knowing (a link to a relevant trace, a related issue,
|
|
26
|
+
etc.).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v7
|
|
13
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
14
|
+
with:
|
|
15
|
+
enable-cache: true
|
|
16
|
+
- run: uv sync --frozen
|
|
17
|
+
- run: uv run ruff check .
|
|
18
|
+
- run: uv run ruff format --check .
|
|
19
|
+
- run: uv run mypy --strict src
|
|
20
|
+
|
|
21
|
+
test:
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
os: [ubuntu-latest, macos-latest]
|
|
25
|
+
runs-on: ${{ matrix.os }}
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v7
|
|
28
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
29
|
+
with:
|
|
30
|
+
enable-cache: true
|
|
31
|
+
- run: uv sync --frozen
|
|
32
|
+
- run: uv run pytest -q
|
|
33
|
+
|
|
34
|
+
reproduce:
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v7
|
|
38
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
39
|
+
with:
|
|
40
|
+
enable-cache: true
|
|
41
|
+
- run: uv sync --frozen
|
|
42
|
+
- run: uv run agent-claimcheck dataset generate --seed 20260924 --out /tmp/benchmark-regen
|
|
43
|
+
- run: diff -rq /tmp/benchmark-regen benchmark/v1
|
|
44
|
+
- run: uv run agent-claimcheck dataset validate benchmark/v1
|
|
45
|
+
- run: uv run agent-claimcheck bench --from-recorded results/v0.1.0 --out /tmp/recorded-regen --check-readme README.md
|
|
46
|
+
- run: |
|
|
47
|
+
for f in bench.md bench.json reliability.svg histogram.svg; do
|
|
48
|
+
cmp "results/v0.1.0/$f" "/tmp/recorded-regen/$f"
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
frontend:
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v7
|
|
55
|
+
- uses: actions/setup-node@v7
|
|
56
|
+
with:
|
|
57
|
+
node-version: "22"
|
|
58
|
+
- run: for f in src/agent_claimcheck/server/static/*.js; do node --check "$f"; done
|
|
59
|
+
- run: node --test tests/js/*.test.mjs
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Manual only: this workflow never runs on push, pull_request, schedule or
|
|
4
|
+
# any other automatic trigger, and it refuses to do anything unless it is
|
|
5
|
+
# run against a v* tag. Publishing is a deliberate, human-triggered action.
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch: {}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
environment: pypi
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v10.2.0
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Build sdist and wheel
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish to PyPI
|
|
27
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
28
|
+
with:
|
|
29
|
+
packages-dir: dist/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.1] - 2026-09-28
|
|
6
|
+
|
|
7
|
+
Packaging release: the code, benchmark and recorded results are unchanged from 0.1.0.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Published on PyPI (`pip install agent-claimcheck`); the package metadata now carries the README, with relative links rewritten to the tagged sources on GitHub, project URLs, keywords and classifiers.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- The licence is declared as the SPDX expression `Apache-2.0`.
|
|
16
|
+
- CI and the publishing workflow use the current major versions of `actions/checkout`, `actions/setup-node` and `astral-sh/setup-uv`.
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-09-28
|
|
19
|
+
|
|
20
|
+
Initial release.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **Trace I/O**: load and validate `agent-trace/v1` JSON Lines files against
|
|
25
|
+
the published `schemas/agent-trace-v1.json`, with per-line error reporting
|
|
26
|
+
(`agent-claimcheck validate`), an optional `--probes` file merged as
|
|
27
|
+
`state_probe` steps, and a redaction projection that keeps `ground_truth`
|
|
28
|
+
and `meta` out of every detector's input.
|
|
29
|
+
- **Claim handling**: structured `final_claim.claims`, or pattern-based
|
|
30
|
+
extraction over `final_claim.text` when none are present, with a negation
|
|
31
|
+
guard and a configurable set of non-success claim types.
|
|
32
|
+
- **Rules detector**: a declarative, code-free YAML rule DSL (`exists`,
|
|
33
|
+
`equals`, `in`, `contains`, `matches`, with typed normalisers and
|
|
34
|
+
`{subject.*}`/`{args.*}` interpolation), three built-in domain packs
|
|
35
|
+
(`booking`, `crm`, `coding`) plus a generic fallback, and support for
|
|
36
|
+
user-supplied packs (`--rules`).
|
|
37
|
+
- **LLM judge detector**: any OpenAI-compatible `/chat/completions`
|
|
38
|
+
endpoint, two built-in prompts (`claim-audit`, `claim-by-claim`) or a
|
|
39
|
+
custom prompt file, strict JSON parsing that abstains rather than
|
|
40
|
+
guesses, an on-disk response cache, and a cost ledger with a pre-call
|
|
41
|
+
budget reservation and a lifetime spend cap.
|
|
42
|
+
- **Trained classifier**: a logistic-regression detector (`classifier-lr`)
|
|
43
|
+
on 28 deterministic, domain-agnostic features, shipped as a JSON artifact
|
|
44
|
+
(never a pickle), with out-of-distribution abstention and retraining on
|
|
45
|
+
the user's own labelled traces (`agent-claimcheck train`).
|
|
46
|
+
- **Calibration**: Platt scaling fitted on non-abstaining raw scores,
|
|
47
|
+
applied by the shared gate whenever a calibrator exists for a detector.
|
|
48
|
+
- **Baselines and ensembles**: `trust-agent`, `any-error`, and the
|
|
49
|
+
`cascade-offline` (rules, then the classifier) and `cascade` (rules, then
|
|
50
|
+
the judge) ensembles.
|
|
51
|
+
- **Shared gate**: one pure, configurable-threshold function turning any
|
|
52
|
+
detector's output into `verified` / `false_success` / `unverifiable`, used
|
|
53
|
+
by every detector and every ensemble alike.
|
|
54
|
+
- **CLI**: `validate`, `check` (with `--detector`, `--rules`, `--prompt`,
|
|
55
|
+
`--calibration`, `--probes`, `--fail-on`, `--max-usd`, table/json/jsonl
|
|
56
|
+
output), `train`, `dataset generate`/`dataset validate`, and `bench`
|
|
57
|
+
(`--offline`, `--live`, `--from-recorded`, `--check-readme`).
|
|
58
|
+
- **Local dashboard** (`agent-claimcheck serve`): an overview, a review
|
|
59
|
+
queue for `unverifiable` traces with a trace inspector, human review
|
|
60
|
+
decisions written as `agent-trace/v1` (feeding straight into `train`), and
|
|
61
|
+
an on-demand judge run over the queue with a cost estimate and a cancel
|
|
62
|
+
button — localhost-only, with `Host`/`Origin`/content-type checks on
|
|
63
|
+
every state-changing request.
|
|
64
|
+
- **Python API**: `load_traces`, `Checker`, `CheckResult`, `Detector`,
|
|
65
|
+
`register_detector`, `load_rule_pack` and `metrics.evaluate`, documented
|
|
66
|
+
in `docs/python-api.md`.
|
|
67
|
+
- **Benchmark**: a synthetic, seeded, regenerable 300-trace false-success
|
|
68
|
+
benchmark across the three domains, with a leakage audit, and a
|
|
69
|
+
reproducible offline/recorded benchmark report (`bench.json`, `bench.md`,
|
|
70
|
+
reliability and histogram charts) with four pre-registered hypotheses.
|
|
71
|
+
- **Packaging**: installable via `uvx`/`pip`, with the schemas, examples and
|
|
72
|
+
benchmark shipped as package data so the packaged aliases
|
|
73
|
+
(`bench:train`, `bench:test`, `example:mixed`, `example:browser`,
|
|
74
|
+
`recorded:v0.1.0`) work without a clone.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development setup
|
|
4
|
+
|
|
5
|
+
The project uses [uv](https://docs.astral.sh/uv/) for the Python 3.12
|
|
6
|
+
environment and dependency locking.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
uv sync
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
This creates `.venv` and installs the runtime and dev dependency groups from
|
|
13
|
+
`uv.lock`. Run everything below through `uv run` so it uses that
|
|
14
|
+
environment.
|
|
15
|
+
|
|
16
|
+
## Checks to run before opening a pull request
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
uv run ruff check .
|
|
20
|
+
uv run ruff format --check .
|
|
21
|
+
uv run mypy --strict src
|
|
22
|
+
uv run pytest -q
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
All four must pass locally; CI runs the same commands (plus, on `ubuntu`, a
|
|
26
|
+
job that regenerates `benchmark/v1` from its seed and diffs it against the
|
|
27
|
+
committed files) and will not merge otherwise. Default CI makes no network
|
|
28
|
+
calls: the judge detector's integration test starts a fake
|
|
29
|
+
`/chat/completions` server inside the test process. A live judge run against
|
|
30
|
+
a real API is a separate, manually invoked path (`agent-claimcheck check
|
|
31
|
+
--detector judge`, `bench --live`), never part of CI.
|
|
32
|
+
|
|
33
|
+
## Adding a rule pack
|
|
34
|
+
|
|
35
|
+
Rule packs are YAML, loaded with `yaml.safe_load` and validated before use —
|
|
36
|
+
see `docs/rules.md` for the full DSL reference and `examples/rules/custom.yaml`
|
|
37
|
+
for a worked example that maps an invented tool API. To add one of your own:
|
|
38
|
+
|
|
39
|
+
1. Write a pack with `pack`, `version`, `tools` (globs matched against your
|
|
40
|
+
`tool_call` names) and `claims` (one rule per claim type: an `action`
|
|
41
|
+
glob, `receipt` checks, and an optional `probe`/`probe_checks`).
|
|
42
|
+
2. Load it directly with `load_rule_pack(path)`, or pass its path with
|
|
43
|
+
`Checker(rules=[path])` / the CLI's `--rules path.yaml`, on top of the
|
|
44
|
+
three built-in domain packs.
|
|
45
|
+
3. If the pack is meant to ship as a new built-in (rather than a
|
|
46
|
+
`--rules` addition users bring themselves), add the YAML file under
|
|
47
|
+
`src/agent_claimcheck/rules/packs/`, add its name to
|
|
48
|
+
`rules.engine._BUILTIN_PACK_NAMES`, and add it to the rule-engine tests
|
|
49
|
+
(`tests/test_rules_engine.py`).
|
|
50
|
+
|
|
51
|
+
A pack never embeds a Python expression — there is no code-execution path
|
|
52
|
+
through a rule pack, by design (ADR 0002). Keep new packs that way: if a
|
|
53
|
+
check you need cannot be expressed with `exists`/`equals`/`in`/`contains`/
|
|
54
|
+
`matches`, that is a signal to extend the DSL itself (with its own tests and
|
|
55
|
+
an ADR), not to bypass it.
|
|
56
|
+
|
|
57
|
+
## Adding a detector
|
|
58
|
+
|
|
59
|
+
A detector is anything implementing the `Detector` protocol: a `name` and a
|
|
60
|
+
`score(self, trace: DetectorView) -> DetectorOutput` method (see
|
|
61
|
+
`docs/python-api.md` for the exact shapes, and `docs/detectors.md` for how
|
|
62
|
+
the built-in detectors use them). Register it with `register_detector(name,
|
|
63
|
+
factory)` so `Checker(name)` and `--detector name` can find it. A detector
|
|
64
|
+
must only look at the `DetectorView` it is given — never at a `Trace`
|
|
65
|
+
directly — since `ground_truth` and `meta` are not on that view at all; the
|
|
66
|
+
redaction test (`tests/test_redact.py`) puts a canary string into both and
|
|
67
|
+
asserts it reaches no detector input.
|
|
68
|
+
|
|
69
|
+
## Benchmark regeneration
|
|
70
|
+
|
|
71
|
+
`agent-claimcheck dataset generate --seed 20260924 --out benchmark/v1`
|
|
72
|
+
regenerates the committed benchmark byte for byte from the in-repo
|
|
73
|
+
generator (`src/agent_claimcheck/bench/generator/`); `agent-claimcheck
|
|
74
|
+
dataset validate` checks the regenerated files against their manifest,
|
|
75
|
+
counts and leakage audit. If you change the generator, regenerate and
|
|
76
|
+
re-validate, and make sure `benchmark/v1/manifest.json`'s checksums are
|
|
77
|
+
updated in the same commit.
|
|
78
|
+
|
|
79
|
+
**Never tune the generator, a rule pack or the classifier against the test
|
|
80
|
+
split** (`benchmark/v1/traces.test.jsonl`). The leakage audit
|
|
81
|
+
(`dataset validate`) enforces this mechanically during development: it
|
|
82
|
+
scores a TF-IDF-plus-logistic-regression baseline on the final message alone
|
|
83
|
+
with 5-fold cross-validation on the *train* split only, and fails when that
|
|
84
|
+
CV AUROC is above 0.65. The test-split AUROC for that same baseline is
|
|
85
|
+
computed once, after the generator is frozen, and reported as a limitation
|
|
86
|
+
in `benchmark/v1/DATASET_CARD.md` — it is not iterated on. If a change to
|
|
87
|
+
the generator, a rule pack, the classifier's features or its
|
|
88
|
+
hyperparameters was made by looking at test-split results, that result is
|
|
89
|
+
no longer honest; regenerate the evaluation from the train split's own
|
|
90
|
+
signal instead.
|
|
91
|
+
|
|
92
|
+
## Commit style
|
|
93
|
+
|
|
94
|
+
Conventional commit messages (`feat:`, `fix:`, `docs:`, `test:`, `ci:`,
|
|
95
|
+
`refactor:`, ...), in English, describing one coherent change per commit.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Andrii Boiko
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|