Skip to main content

cngx, local LLM reasoning fingerprinting, drift detection, and policy checks.

Project description

cngx

CI Python 3.10+ License: MIT

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

Created by Kavya Bhand and Aadi Joshi.

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cngx-0.1.3.tar.gz (197.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cngx-0.1.3-py3-none-any.whl (192.0 kB view details)

Uploaded Python 3

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

Hashes for cngx-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f876e7096cefcfe46eae36d3500084bc06f82f61867fd0ee86fcdb4523835e52
MD5 f0d780f0bb9db2708ae6b54c7cc61734
BLAKE2b-256 581f69cf1271903f317b9d56da020a3ea2f2c2b8d7c237efea9816184665ef02

See more details on using hashes here.

Provenance

The following attestation bundles were made for cngx-0.1.3.tar.gz:

Publisher: publish.yml on aadi-joshi/cngx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for cngx-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ad445020ac58707556f3dd0cb41ffc0741919620b9553867f40280e10e63d126
MD5 b0496eb38cba8c6ecfe5fb2f622e9c23
BLAKE2b-256 c18df554841e479c0f52a76116760ab791ecedf021b91d39fe3416921aee2155

See more details on using hashes here.

Provenance

The following attestation bundles were made for cngx-0.1.3-py3-none-any.whl:

Publisher: publish.yml on aadi-joshi/cngx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page