cngx

cngx documentation

Local CLI that fingerprints coding-agent output and gates merges when verification is missing. Also proxies long agent sessions for baseline-relative drift. No cloud account required.

overview

Day-one use: cngx check --output-file gates agent text in CI with no API keys. Longer runs: wrap the agent, pin a baseline, and watch for mid-session verification collapse.

Install with pipx, gate offline or run agents through cngx wrap, optionally submit opt-in metrics to this tracker.

install

Recommended: pipx puts cngx on your PATH in an isolated environment. No virtualenv to manage.

pipx install cngx
cngx version

Alternative: pip install cngx inside a project virtualenv.

No Python: standalone binaries on GitHub Releases (PyInstaller builds per platform).

Docker is optional for containerizing the proxy on a server. It is not required for normal CLI use.

quickstart

Zero API keys. Mock adapter demo in under 30 seconds.

cngx quickstart

gate agent output

Gate existing agent text in CI with no API keys: cngx check --output-file output.txt -c policy.yaml. Full walkthrough: docs/guides/gate-coding-agent.md

wrap

Zero-code instrumentation for existing agent CLIs. Starts the local proxy if needed and injects SDK base URL environment variables into the child process.

cngx wrap -- aider
cngx wrap --session-id long-run -- python my_agent.py
VariableSet toUsed by
OPENAI_BASE_URLhttp://127.0.0.1:8642/v1OpenAI SDK, many compatible tools
OPENAI_API_BASEsamelegacy alias in some agent wrappers
ANTHROPIC_BASE_URLhttp://127.0.0.1:8642Anthropic SDK, Claude Code-style CLIs

Manual base URL configuration remains for tools that ignore environment overrides.

watch and sessions

cngx watch runs the proxy with a live terminal dashboard. Each turn gets a session id and turn number.

After 20+ turns, cngx can raise a session stability warning when verification-step variance collapses (distinct from per-turn structural drift). See session thresholds in the repository docs under docs/concepts/sessions.md.

cngx report --session my-long-run

drift detection

Structural drift compares heuristic fingerprint metrics (depth, verification steps, hedging, corrections) to your pinned baseline. Live proxy uses KSWIN and MDDM streaming tests; batch paths use Mann-Whitney U with Benjamini-Hochberg FDR and the Cauchy Combination Test (CCT).

Semantic drift (optional, watch --semantic) uses local embeddings. Neither structural nor semantic drift alone proves the model got worse.

Alerts require corroboration across multiple metrics. Length-only shifts do not alert alone.

cli reference

CommandPurpose
cngx init --yesCreate .cngx/ local database
cngx quickstartMock demo, no API keys
cngx wrap -- <cmd>Run agent through proxy (recommended)
cngx watchProxy + live TUI dashboard
cngx pin --label NAMEPin baseline fingerprint
cngx diff --baseline NAMECompare recent traffic to baseline
cngx check -c POLICY.yaml "prompt"CI policy check (exit 0/1/2)
cngx report --session IDSession trajectory summary
cngx submit --baseline NAMEOpt-in tracker submission (numeric metrics only)

submit and privacy

By default nothing leaves your machine. cngx submit is opt-in, shows the exact JSON before sending, and posts only after you confirm.

Submitted payloads contain only: model name, timestamp, numeric metrics, drift score, and your baseline label. No prompts, outputs, trace IDs, or task names. Application storage keeps payload fields only; CloudFront/API Gateway access logs are separate infrastructure concerns.

No GitHub account or pull request is required.

cngx submit --baseline my-baseline --dry-run
cngx submit --baseline my-baseline

tracker schema

Each community record is one JSON object (schema version 1):

FieldTypeDescription
schema_versionintAlways 1
record_idstringUUID
timestampstringISO-8601 UTC
modelstringModel name
baseline_labelstringSubmitter's baseline label
drift_scorefloat0 to 1 vs baseline
depthintReasoning depth
verification_stepsintVerification step count
hedging_ratiofloatUncertainty language ratio