cngx, local LLM reasoning fingerprinting, drift detection, and policy checks.
Project description
cngx
cngx checks whether a coding agent actually ran the verification your policy requires before you trust its output.
pipx install cngx
cngx quickstart # mock demo, no API keys, under 30s
Gate existing agent output in CI (no provider calls, no API keys):
cngx check -c examples/contracts/coding_agent_verification.yaml \
-p "Fix the pagination bug and run tests" \
--output-file agent_output.txt
Live one-shot check against a provider:
cngx check -c examples/contracts/basic_reasoning.yaml "Fix the bug and run the test suite"
Python 3.10+. Requires pipx or pip install cngx. See installation.
What it does
Message one (offline CI): cngx check --output-file fingerprints agent text you already have and enforces a behavior policy. Did the agent run tests and show verification, or only sound merge-ready?
Message one (live): cngx check with a provider adapter fingerprints a single response the same way.
Long sessions: cngx wrap and cngx watch proxy your agent, fingerprint every call, and compare live traffic to a baseline you pin. Alerts use corroborated statistical tests, not length alone.
agent ──► cngx proxy ──► provider API
│
├── fingerprint each response
├── cngx check / policy gate (optional)
└── diff vs pinned baseline (session drift)
Measured (synthetic benchmarks, alpha=0.05)
| Scenario | Method | False positive rate |
|---|---|---|
| Correlated stationary, no drift (250 trials) | Legacy Fisher omnibus | 0.024 (6/250) |
| Correlated stationary, no drift (250 trials) | CCT batch (current) | 0.024 (6/250) |
| Independent stationary, no drift (250 trials) | Legacy (>=2 metrics) | 0.016 (4/250) |
| Independent stationary, no drift (250 trials) | CCT batch (current) | 0.032 (8/250) |
| Streaming stable series (150 steps) | KSWIN / MDDM | 0.000 (0/150) |
| Streaming stable series (150 steps) | Legacy ADWIN / Page-Hinkley | 0.000 (0/150) |
| Detection | Result |
|---|---|
| Streaming shift (injected at step 80) | First KSWIN/MDDM alert at step 87 |
| Session verification collapse (synthetic) | Collapse from turn 13, warning at turn 22 (9-turn delay) |
| McNemar suite shift (binary) | p ≈ 0.000002 |
| Paired permutation (continuous) | p = 0.0002 |
Synthetic draws only. Pin your own baseline on real traffic before treating alerts as production signals. Details: drift engine, sessions.
Commands
| Command | Use |
|---|---|
cngx quickstart |
Zero-key demo: unverified agent patch blocked |
cngx check -c policy.yaml "…" |
One-shot policy check (CI-friendly exit codes) |
cngx check -c policy.yaml --output-file out.txt |
Gate existing agent output offline |
cngx wrap -- aider |
Route an agent through the local proxy |
cngx watch |
Live dashboard on proxied traffic |
cngx pin --label baseline |
Save normal behavior for a task |
cngx diff --baseline baseline |
Compare recent captures to that baseline |
cngx submit --baseline baseline |
Opt-in metrics to the community tracker |
Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY for live providers. Keys stay in memory for forwarding; they are not written to the local database.
Local-first
Runs on your machine. Traces and fingerprints live in .cngx/ (DuckDB). Proxy binds to 127.0.0.1 by default. Nothing leaves the host unless you run cngx submit after an explicit preview and confirm (numeric metrics only; no personal identity collected or stored).
Docs
- Quickstart
- Gate a coding agent in CI (offline, no API keys)
- Proxy and privacy
- CLI reference
- Contributing
Created by Kavya Bhand and Aadi Joshi.
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cngx-0.1.3.tar.gz.
File metadata
- Download URL: cngx-0.1.3.tar.gz
- Upload date:
- Size: 197.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f876e7096cefcfe46eae36d3500084bc06f82f61867fd0ee86fcdb4523835e52
|
|
| MD5 |
f0d780f0bb9db2708ae6b54c7cc61734
|
|
| BLAKE2b-256 |
581f69cf1271903f317b9d56da020a3ea2f2c2b8d7c237efea9816184665ef02
|
Provenance
The following attestation bundles were made for cngx-0.1.3.tar.gz:
Publisher:
publish.yml on aadi-joshi/cngx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cngx-0.1.3.tar.gz -
Subject digest:
f876e7096cefcfe46eae36d3500084bc06f82f61867fd0ee86fcdb4523835e52 - Sigstore transparency entry: 2135445674
- Sigstore integration time:
-
Permalink:
aadi-joshi/cngx@a96b8b80dea20aef6159593b803e654c6bf08d32 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/aadi-joshi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a96b8b80dea20aef6159593b803e654c6bf08d32 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cngx-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cngx-0.1.3-py3-none-any.whl
- Upload date:
- Size: 192.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad445020ac58707556f3dd0cb41ffc0741919620b9553867f40280e10e63d126
|
|
| MD5 |
b0496eb38cba8c6ecfe5fb2f622e9c23
|
|
| BLAKE2b-256 |
c18df554841e479c0f52a76116760ab791ecedf021b91d39fe3416921aee2155
|
Provenance
The following attestation bundles were made for cngx-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on aadi-joshi/cngx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cngx-0.1.3-py3-none-any.whl -
Subject digest:
ad445020ac58707556f3dd0cb41ffc0741919620b9553867f40280e10e63d126 - Sigstore transparency entry: 2135445762
- Sigstore integration time:
-
Permalink:
aadi-joshi/cngx@a96b8b80dea20aef6159593b803e654c6bf08d32 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/aadi-joshi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a96b8b80dea20aef6159593b803e654c6bf08d32 -
Trigger Event:
release
-
Statement type: