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 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.

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.5.tar.gz (194.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.5-py3-none-any.whl (187.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cngx-0.1.5.tar.gz
  • Upload date:
  • Size: 194.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.5.tar.gz
Algorithm Hash digest
SHA256 d3ca341107cf144c12505f217cff3f31d5c23fe3768aefff8c0f411f633f1bfd
MD5 d3c4226fc9de35f0939e98934b996a68
BLAKE2b-256 14c90f586868cb9a76498c8c0729aaa7b9314813f5663eefcd23d1db2342571c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: cngx-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 187.9 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9287cee149d6c1e764d961e3cc38396ed461196ca212ea135103392fd4f5cfb6
MD5 427502d66ce0419b907f08b5016aa307
BLAKE2b-256 01ad67d3b31db29c7350f0a19380b43d500c03ddf9243337c7a940a4439d2e1c

See more details on using hashes here.

Provenance

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