# TokenTrust
[](https://github.com/RudrenduPaul/TokenTrust-CLI/actions/workflows/ci.yml)
[](./LICENSE)
[](https://www.npmjs.com/package/tokentrust-cli)
[](https://pypi.org/project/tokentrust-cli/)
[Install](#install) • [What it measures](#what-it-measures) • [Commands](#commands) • [Agent-native / MCP](#agent-native--mcp) • [FAQ](#faq)
Vendor-neutral CLI that independently verifies the token and cost savings AI-coding-agent
context-reduction proxies actually deliver, by running the proxy for real against a labeled
task corpus instead of trusting the maintainer's own number.
## Install
TokenTrust ships as two complementary, equally first-class distributions: an npm package for
Node.js toolchains and a PyPI package for Python toolchains. Both install a `tokentrust` command
with the identical CLI surface, the same TT01-TT05 verification categories, and the same bundled
task corpus, so pick whichever matches your existing stack.
**npm (Node.js):**
```sh
npx tokentrust-cli verify --proxy rtk
```
No clone, no local build. `npx` fetches the published package and runs it directly. To install
it as a dependency instead: `npm install -g tokentrust-cli`.
**pip (Python):**
```sh
pip install tokentrust-cli
tokentrust verify --proxy rtk
```
See [python/README.md](./python/README.md) for the Python package's full documentation,
including a note on the one real behavioral difference between the two: the npm package's
`js-tiktoken` dependency bundles its tokenizer data for fully offline use, while the Python
package's `tiktoken` dependency fetches and caches that same public data on first use.
Real output from that exact command, run against this repo's own bundled task corpus:
```
$ npx tokentrust-cli verify --proxy rtk
TokenTrust v0.1 -- Token/Context-Reduction Claims Verification
Proxy: rtk 0.43.0 | Repo: TokenTrust | Task corpus: 23 labeled tasks
[MEASURED] TT01 Compression Ratio
Claimed (rtk README): up to 70% context reduction
Measured (this repo, this corpus): 60.6% average reduction across 23 tasks
Range: 0.0% ("verify-go-build-filter") to 95.4% ("verify-git-log-filter")
[MEASURED] TT02 Cost-Savings Delta
Baseline (uncompressed): $0.02 across 23 tasks @ claude-5-sonnet pricing
Compressed (rtk-proxied): $0.00 across 23 tasks
Actual savings: 77.0% ($0.01) -- vs. claimed 70% ceiling
[FAIL] TT03 Never-Worse Output Guard
2/23 tasks regressed in task-completion diff vs. uncompressed baseline
[PASS] TT05 Version-Drift Regression Check
No prior verified baseline for rtk on this repo -- this run establishes the first baseline.
Summary: 77.0% measured cost savings (claimed: up to 70%) -- see full report
```
That's a real run's output, not a hand-typed example -- `npx tokentrust-cli` invokes the exact
same `dist/cli.js` entry point (the `tokentrust` command name is unchanged), so it reproduces on
your machine with no clone required.
## What it measures
- **TT01: Compression Ratio.** Actual token reduction, measured with a local tokenizer
(`js-tiktoken`), against every task in the corpus.
- **TT02: Cost-Savings Delta.** Dollar-cost savings computed from TT01's measured token delta at
published model pricing. Optional `--live` mode verifies the estimate against a real,
provider-billed sample (opt-in, your own API key, gated behind `--confirm-cost`, capped at 5
tasks by default).
- **TT03: Never-Worse Output Guard.** Checks whether a proxy's compressed output dropped content
a task marks as required to survive compression.
- **TT04: Cross-Tool Comparative Benchmark.** Pass `--proxy` more than once and TokenTrust runs
the identical task corpus through every named proxy side by side.
- **TT05: Version-Drift Regression Detection.** Compares a run's measured savings against the
last-verified baseline for the same proxy/repo pair, so a silent regression across a version
bump (like `rtk#582`) gets caught automatically.
## Commands
```
tokentrust verify --proxy