Skip to main content

Local CLI that fingerprints coding-agent output and gates merges when verification is missing.

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 show test evidence, 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)

Honest limit: offline policies score the text of agent output. An agent that fabricates "12 passed" without running tests can still pass text-only checks. Pass --evidence-file pytest.log (or wire it in the GitHub Action) so cngx also requires a real tool log with a concrete result line. Pair with CI exit codes when you need proof of execution.

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 check ... --evidence-file pytest.log Also require a real test log with N passed
cngx wrap -- aider Route an OpenAI/Anthropic 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 / GEMINI_API_KEY for live providers. Keys stay in memory for forwarding; they are not written to the local database.

Gemini cannot use cngx wrap / the proxy: the official google-genai SDK ignores base-URL env vars. Use cngx check --adapter gemini (or capture) instead.

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.8.tar.gz (197.6 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.8-py3-none-any.whl (190.2 kB view details)

Uploaded Python 3

File details

Details for the file cngx-0.1.8.tar.gz.

File metadata

  • Download URL: cngx-0.1.8.tar.gz
  • Upload date:
  • Size: 197.6 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.8.tar.gz
Algorithm Hash digest
SHA256 23b843a22e96db3c8d1e40a181d0399c11079ad78148afda9bcc7a51652399a8
MD5 3aa3f49de2e8a577c891f5681e168a2b
BLAKE2b-256 438bc271ffbd7148ecc5f9be0f4eab4a5ec1fb04ddb9d0312d52371d2937c4de

See more details on using hashes here.

Provenance

The following attestation bundles were made for cngx-0.1.8.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.8-py3-none-any.whl.

File metadata

  • Download URL: cngx-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 190.2 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 683dc1882f4c583a4d71ad1a94c20a5296ce10991a38b5ff557482c9433f71ef
MD5 fada18eba166ed36a478d9bbb2f15043
BLAKE2b-256 b8f4c84af4cc427a74f9f7349de5272b70f1f02ae2baa91d9e32e3d6ee68a183

See more details on using hashes here.

Provenance

The following attestation bundles were made for cngx-0.1.8-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