Skip to main content

CI gate for coding agents that sound merge-ready but never showed the tests.

Project description

cngx

CI Python 3.10+ License: MIT

CI gate for coding agents that sound merge-ready but never showed the tests.

cngx fingerprints agent output and fails the job when your policy requires verification evidence and the text (or log) does not have it.

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 limits (read these):

  • 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.
  • There is no measured "saves X% tokens" claim. wrap/watch observe and alert; they do not cut the upstream connection yet. Do not market this as a cost saver until that exists.
  • The community tracker is opt-in numeric metrics only. Early charts are sparse. Duplicate fingerprint shapes are rejected so the public index cannot be padded with the same response under two baselines.

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.10.tar.gz (199.5 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.10-py3-none-any.whl (191.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cngx-0.1.10.tar.gz
  • Upload date:
  • Size: 199.5 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.10.tar.gz
Algorithm Hash digest
SHA256 9f02fd2e22d3c6eaa8c95da1043a5e4fbd0a4372ca9cc4104b54d9c9637a0776
MD5 64ada3ba26c13216d259d7e5c1b2e33b
BLAKE2b-256 7ce16bfe6c242151e874e52af032dd7b8f5b5af4ecb7ccbf93c117fdbf0b7ff8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cngx-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 191.7 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 edaaed395dadb5346383009ccd7bf653db5e88e2edca734e78d4c733e0bb8393
MD5 37116482cce61eeca96ade4610d5d002
BLAKE2b-256 249de4e198bbbfd792d7c424cab825460ed63e02ed86308f5e297a83b0d050d1

See more details on using hashes here.

Provenance

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