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
| Variable | Set to | Used by |
|---|---|---|
OPENAI_BASE_URL | http://127.0.0.1:8642/v1 | OpenAI SDK, many compatible tools |
OPENAI_API_BASE | same | legacy alias in some agent wrappers |
ANTHROPIC_BASE_URL | http://127.0.0.1:8642 | Anthropic 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
| Command | Purpose |
|---|---|
cngx init --yes | Create .cngx/ local database |
cngx quickstart | Mock demo, no API keys |
cngx wrap -- <cmd> | Run agent through proxy (recommended) |
cngx watch | Proxy + live TUI dashboard |
cngx pin --label NAME | Pin baseline fingerprint |
cngx diff --baseline NAME | Compare recent traffic to baseline |
cngx check -c POLICY.yaml "prompt" | CI policy check (exit 0/1/2) |
cngx report --session ID | Session trajectory summary |
cngx submit --baseline NAME | Opt-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):
| Field | Type | Description |
|---|---|---|
schema_version | int | Always 1 |
record_id | string | UUID |
timestamp | string | ISO-8601 UTC |
model | string | Model name |
baseline_label | string | Submitter's baseline label |
drift_score | float | 0 to 1 vs baseline |
depth | int | Reasoning depth |
verification_steps | int | Verification step count |
hedging_ratio | float | Uncertainty language ratio |