{"slug": "coding-agent-token-economics-standard", "title": "Coding Agent Token Economics Standard", "summary": "Microsoft published the reference implementation of the Coding Agent Token Economics Standard (CATES), a vendor-neutral tool that scores coding-agent configurations for token efficiency, security and CATES conformance with zero LLM calls, using static analysis of repository instructions, prompt libraries, chat modes, MCP configs, setup steps, hooks and editor settings. The package installs two commands, cates-analyzer and cates-optimize, requires Node.js >= 22.12 and npm >= 10, and is release-ready but has no version tag or GHCR package published yet, so users must build from a source checkout. Scores start at 100 and deduct detected findings after policy overrides, and Microsoft states a grade is not an assurance certificate and that no findings does not establish safety or task correctness.", "body_md": "Score coding-agent configurations for **token efficiency**, **security**, and **CATES conformance** — zero LLM calls required.\n\nThis is the reference implementation for the **Coding Agent Token Economics Standard (CATES)**. It is vendor-neutral and analyzes common coding-agent configuration surfaces, including repository and path-specific instructions, prompt libraries, chat modes, MCP configs, setup steps, hooks, and editor settings.\n\nThe **initial scan remains a static configuration assessment**, not a bill or\nproof of economic performance. For end-to-end costs and accepted-task outcomes,\nuse the separate, opt-in [experimental economics assessment](#experimental-end-to-end-token-economics).\n\n**A grade is not an assurance certificate.** Scores start at 100 and deduct\ndetected findings after policy overrides and exclusions; one critical finding\ncan coexist with an A. Reports highlight unresolved critical findings regardless\nof grade and disclose disabled/suppressed findings and discovery limits.\nNo findings does not establish safety, effective permissions or task correctness.\nCompare scores only under the same policy and scan scope.\n\nTo pair static results with controlled permission probes and before/after\naccepted-task costs, attach [optional runtime evidence](https://github.com/microsoft/cates/blob/main/docs/RUNTIME-EVIDENCE.md):\n`cates-analyzer . --runtime-evidence runtime-evidence.json`.\nThese records are **caller-reported, not independently verified**, and never\nchange scores, conformance levels or CI gates.\n\nThe [Modern Agent Assurance proposal](https://github.com/microsoft/cates/blob/main/docs/MODERN-AGENT-ASSURANCE.md) records\nthe October 29, 2026 standards review and current primary sources. It adds\nmanual guidance for skills, effective permissions, MCP authorization, and\noutcome validation, not new scored rules or gates. Legacy prompt-secrecy checks\nare configuration heuristics, not enforceable security controls.\n\nFor deeper **GitHub Copilot hygiene**, run `cates-analyzer . --copilot`.\nThe [Copilot profile](https://github.com/microsoft/cates/blob/main/docs/COPILOT-HYGIENE.md) adds 15 experimental checks across\n11 configuration families, explicit coverage limits, and a manual-verification\nchecklist. It is available in the CLI, library, API and hosted UI without\nchanging the stable scoring model or gates.\n\n**OpenSSF Best Practices status: not registered; no badge claimed.**\nSee the [maintainer setup and assurance runbook](https://github.com/microsoft/cates/blob/main/docs/MAINTAINER-SETUP.md) for\nbranch-protection activation, release bootstrap, and the managed-fuzzing decision.\n\nThe [agentic SDLC guide](https://github.com/microsoft/cates/blob/main/docs/AGENTIC-SDLC.md) connects issue intake, planning,\nimplementation, review, releases, deployment and maintenance using the existing\ntoolchain. Start with the **Agent-ready task** template and the **CATES SDLC**\nCopilot agent; run `npm run verify` before handoff. Agents assist with delivery;\nmaintainers retain merge, publication and deployment authority.\n\n**Distribution status:** This repository is release-ready, but no version tag\nor GHCR package has been published yet. Use the source-checkout instructions\nbelow until the first GitHub release is available.\n\nBuild and run the current source:\n\n```\ngit clone https://github.com/microsoft/cates.git\ncd cates\nnpm ci\nnpm run build\nnode dist/cli/index.js .\n```\n\nRequires Node.js **>= 22.12** and npm **>= 10**. After the first release,\nthe npm and GHCR installation paths documented in the release notes become\nthe recommended options.\n\nThe package installs two commands: **`cates-analyzer`** (reports inefficiencies)\nand **`cates-optimize`** (deliberately applies structurally checked edits — see\n[Optimizer](#-optimizer--apply-lossless-fixes-cates-optimize)).\nThe programmatic package API is ESM-only; CommonJS callers must use dynamic\n`import()`.\n\n```\n# Analyze current directory\ncates-analyzer .\n\n# Analyze a specific repo\ncates-analyzer /path/to/repo\n\n# JSON output for CI\ncates-analyzer . --format json\n\n# SARIF output for code scanning systems\ncates-analyzer . --format sarif\n\n# Repository URL, branch folder, file, or pull request\n# (auto-detected — also works as `cates-analyzer review <url>`)\ncates-analyzer https://github.com/OWNER/REPO\ncates-analyzer https://github.com/OWNER/REPO/tree/main/path/to/folder\ncates-analyzer https://github.com/OWNER/REPO/pull/123\n\n# Quieter pretty output (drops the banner; keeps all data)\ncates-analyzer . --quiet\n\n# Shell completion\ncates-analyzer completion bash > /usr/local/etc/bash_completion.d/cates-analyzer\ncates-analyzer completion zsh  > \"${fpath[1]}/_cates-analyzer\"\n```\n\nExit codes:\n\n| Code | Meaning | \n|---|---|\n| `0` | Analysis succeeded; all CI gates passed | \n| `1` | CATES gate failed ( `--min-score` ,`--require-level` ,`--fail-on` ,`--max-always-loaded` , or conformance) | \n| `2` | Usage error (invalid flag, missing argument, parse failure) | \n\nWhen running from this source checkout before publishing/installing the package, use one of these forms:\n\n```\nnpm run --silent review -- https://github.com/OWNER/REPO\nnpm run --silent cates -- review https://github.com/OWNER/REPO\nnpx tsx src/cli/index.ts review https://github.com/OWNER/REPO\n```\n\nDo not run `tsc review ...` or `npm run typecheck -- review ...`; those commands invoke the TypeScript compiler and it will treat `review` and the URL as files to compile.\n\nA small, non-root Alpine image is the easiest way to get a consistent\ntoolchain across Windows, macOS, and Linux (plus the right `git` and `gh`\nversions baked in).\n\n```\n# Build locally\ndocker build -t cates-analyzer .\n\n# Analyze the current directory (bind-mount it as /work)\ndocker run --rm -v \"$PWD:/work\" cates-analyzer .\n\n# Review a public repo\ndocker run --rm cates-analyzer review https://github.com/OWNER/REPO\n\n# Review a private repo (token never written to disk)\ndocker run --rm -e GH_TOKEN cates-analyzer review https://github.com/OWNER/REPO\n\n# JSON to stdout, piped into your tooling\ndocker run --rm -v \"$PWD:/work\" cates-analyzer . --format json > report.json\n```\n\nWindows PowerShell users substitute `${PWD}` for `$PWD`.\n\nThe image runs as a non-root user, uses a read-only root filesystem, and\nships with `tini` as PID 1 so it behaves cleanly under container orchestrators.\nPublished `ghcr.io/microsoft/cates` tags become available with the first\nGitHub release.\n\nThe chart in [`deploy/helm/cates`](https://github.com/microsoft/cates/blob/main/deploy/helm/cates/README.md) deploys\nCATES as a `CronJob` (default) or one-shot `Job`. It supports\nNetworkPolicies, a persistent reports volume, and a\nConfigMap-mounted `.cates.yml` policy.\n\n```\nhelm install cates ./deploy/helm/cates \\\n  -n cates --create-namespace \\\n  --set githubToken.value=$GH_TOKEN \\\n  --set-json 'args=[\"demo\",\"--limit\",\"25\",\"--format\",\"json\"]'\n```\n\nSee [`deploy/helm/cates/README.md`](https://github.com/microsoft/cates/blob/main/deploy/helm/cates/README.md) for\nproduction values, Workload Identity setup, and PVC-backed reports.\n\nDon't want to install the CLI? Use the **CATES Service** — a hosted\ncompanion that lets you score a primitive in two ways:\n\n1. **Paste** an instruction file, prompt, MCP config, agent definition,\nor`.cursorrules` directly into the browser.\n2. **Scan a GitHub URL** — repo, folder, file, or pull request.\n\nBehind the scenes the service runs the exact same analyzer as the CLI\n(`analyze()` / `analyzeInMemory()`), so a score from the service is\nidentical to a score from `cates-analyzer` on the same bytes. There are\n**no LLM calls**, **no telemetry**, and **no content logging** —\nsubmitted text is analyzed in-process and discarded; repos fetched via\n\"Scan\" are cloned shallowly into a temp directory that is removed as soon\nas the score is returned.\n\n| Method | Endpoint | Purpose | \n|---|---|---|\n| `POST` | `/api/analyze` | In-memory analysis. Body: `{ files: [{path, content}], policy?, tokenizer? }` . | \n| `POST` | `/api/scan` | GitHub-URL analysis. Body: `{ url, policy?, tokenizer? }` . | \n| `POST` | `/api/economics` | Experimental, separate accounting over a normalized usage ledger; no scan or score. | \n| `GET` | `/api/rules` | Stable/cache-output `rules` , separate`copilotChecks` , and service limits. | \n| `GET` | `/api/healthz` | Liveness probe. | \n| `GET` | `/api/readyz` | Readiness probe. | \n\nAll endpoints accept and return JSON. The `AnalysisResult` shape returned\nby the analyze and scan endpoints is **the same** type the CLI emits with\n`--format json` — every existing report consumer (dashboard, CI gates,\nSARIF converter) works unchanged.\n\n`/api/economics` instead returns an experimental `EconomicsReport`. It accepts\ncaller-supplied records only; it does not collect telemetry, import invoices,\nor fetch prices. Economics remains separate from the hosted scan/paste UI;\nthe UI's Copilot hygiene selector adds static advice, not usage accounting.\n\n| Limit | Value | \n|---|---|\n| Max files per request | 50 | \n| Max bytes per file | 100 KB | \n| Max total payload | 1 MB | \n| Per-IP rate limit | 60 requests / minute | \n\nLimits are exposed live at `GET /api/rules` so UIs and CI integrations can\ndisplay them or pre-validate.\n\nRule/dimension overrides, suppressions, `experimental`, and `copilot` are\naccepted in the request's `policy` field. HTTP overrides use the long object\nform, not YAML shorthand. Threshold fields are accepted for shared-policy\ncompatibility, but HTTP endpoints return analysis reports rather than enforcing\nCLI exit-code gates; callers can evaluate those reports with `evaluateGates`.\n\n```\n{\n  \"files\": [\n    { \"path\": \".github/copilot-instructions.md\", \"content\": \"...\" }\n  ],\n  \"policy\": {\n    \"copilot\": \"all\",\n    \"dimensions\": { \"security\": { \"enabled\": false } },\n    \"rules\": { \"TE004\": { \"severity\": \"low\" } }\n  }\n}\n```\n\nFile URLs analyze the requested file; folder URLs preserve repository-relative\nclassification while restricting traversal. Resource-limited, unreadable and\nunrecognized inputs are not evidence of a clean repository. See the\n[coverage contract and resource limits](https://github.com/microsoft/cates/blob/main/docs/COPILOT-HYGIENE.md#honest-boundaries-and-resource-limits).\n\n```\n# Build and run (Node 22.12+)\nnpm ci\nnpm run build:service\nnpm run service:start         # listens on :8080\n\n# Or in watch mode while developing\nnpm run service:dev\n```\n\nOpen `http://localhost:8080`.\n\nThe same image powers both the CLI and the service. Override `CMD` to\nlaunch the service:\n\n```\ndocker build -t cates .\ndocker run --rm -p 8080:8080 --entrypoint node cates \\\n  /app/dist-service/service/server.js\n```\n\nThe hosted UI ships with a **toggle drawer** at the top of the page that\nfetches `GET /api/rules` and lets you:\n\n- Disable any individual rule (single-click on the rule pill)\n- Disable an entire dimension (click the dimension button — e.g. \"security\" if you already enforce those checks elsewhere)\n- Override severity per rule\n- Export the current state as `.cates.yml` for committing to your repo\n\nEvery toggle is sent in the `policy` field of the next request, so the\nscore updates immediately and the result includes `disabledRuleIds` /\n`disabledDimensions` for auditability.\n\n| Concern | Mitigation | \n|---|---|\n| Pasted content exfiltration | No persistence, no telemetry, no content logging. The access log records `method/path/status/durationMs` only. | \n| Cross-site framing / SEO indexing | Strict CSP, `frame-ancestors 'none'` ,`X-Frame-Options: SAMEORIGIN` ,`X-Robots-Tag: noindex, nofollow` set on every response. | \n| Argv-injection via `/api/scan` URLs | URLs flow through the same `parseGitHubLink` guards used by the CLI; refs starting with`-` , traversal segments, and shell metacharacters all return`HTTP 400` . | \n| DoS via giant payloads | Hard per-file + per-request byte caps + JSON body limit, all enforced *before* the analyzer runs. | \n| DoS via repo cloning | Shallow clones with depth=1, temp dir is removed in a `finally` block even if scoring throws. | \n| Auth / multi-tenant data | None in v1 — the service is stateless and anonymous. OAuth, persisted reports, and org dashboards are on the Phase 3 roadmap; see [`VERSIONING.md`](https://github.com/microsoft/cates/blob/main/VERSIONING.md) and the session plan. | \n\n| Capability | What you get | \n|---|---|\n| **Zero-LLM static analysis** | Deterministic, fast, no API keys, no data exfiltration | \n| **49 stable rules** across 6 scored dimensions, plus 10 experimental rules | Token efficiency, security, specificity, completeness, conflict/reachability, harness quality, cache shaping, and output shaping | \n| **Per-family tokenizers** | Model-family tokenizers or an offline approximation — pick one or compare side-by-side | \n| **Multi-surface discovery** | Repository + path-specific instructions, prompt libraries, chat modes, MCP configs, hooks, setup steps, editor settings | \n| **Configurable** | Toggle any rule or whole dimension on/off, override severities, suppress with reasons + expirations | \n| **Multiple output formats** | Human-readable text, JSON, **SARIF** for code scanning systems | \n| **CI-ready gates** | `--min-score` ,`--require-level` ,`--fail-on` ,`--max-always-loaded` | \n| **Conformance levels** | Score against CATES Level 1, 2, or 3 | \n| **Repository review** | `cates-analyzer review <url>` for repos, branches, folders, files, or PRs | \n| **Hosted service + HTTP API** | Paste / scan / programmatic access via the [CATES Service](#-cates-service-hosted-ui--http-api) — same engine, no install | \n| **Portfolio scanning** | Roll up many repos into one report | \n| **Demo mode** | Scan repositories supplied through a custom manifest | \n| **Safe autofix** | `--fix` /`--fix-dry-run` for mechanical, reviewable changes | \n| **Static economics signals** | Per-finding heuristic impact and legacy savings estimates; not measured spend or proven reductions | \n| **Experimental lifecycle accounting** | Separate usage-ledger assessment: cache/input/output, retries and child calls, explicit rates, non-model costs, and cost per accepted task | \n| **Hardened runtime** | Sandboxed reads, argv-injection guards, size/depth limits, binary detection, no network calls in analyze mode | \n| **Multiple ship targets** | npm CLI, Docker image, Helm chart, and local HTTP service | \n\nCATES is policy-driven. Drop a `.cates.yml`, `.cates.yaml`, or `.cates.json`\nat your repo root (or pass `--policy <path>`) and you can:\n\n- Set CI quality gates (`minScore` ,`requireLevel` ,`failOn` ,`maxAlwaysLoadedTokens` )\n- **Toggle any individual rule on/off**\n- **Toggle an entire dimension on/off** (e.g. skip all security rules\nbecause your org already uses GitHub Advanced Security)\n- **Override the severity** of any rule or dimension\n- Suppress specific findings (with required reasons and optional expirations)\n\nBoth YAML and JSON are accepted. A minimal annotated example:\n\n```\n# .cates.yml — full schema\nminScore: 80\nrequireLevel: 1\nfailOn: [critical]\nmaxAlwaysLoadedTokens: 1500\n\n# ─── Whole-dimension toggles ─────────────────────────────────────────\n# Disable an entire category of rules in one line. Useful when another\n# tool already covers it (e.g., another approved scanner owns these checks).\ndimensions:\n  security: off              # skip CATES SEC* and security-tagged MCP/STP rules\n  # token-efficiency: off\n  # specificity: off\n  # completeness: off\n  # conflict-reachability: off\n  # harness-quality: off\n\n# ─── Per-rule toggles & severity overrides ───────────────────────────\n# Most specific wins: rules[<id>] > dimensions[<dim>] > built-in defaults.\n# Shorthand:  off | on | <severity>   (critical|high|medium|low|info)\n# Long form:  { enabled: true|false, severity: <severity> }\nrules:\n  SEC001: off                # disable a single rule\n  TE004: low                 # downgrade Forced Verbosity from high to low\n  MCP002: on                 # re-enable one rule even though `security: off`\n  CMP002: { severity: high } # long form\n\n# ─── Suppressions (for documented false positives / accepted risk) ───\nsuppressions:\n  - ruleId: SEC004\n    file: .github/copilot-instructions.md\n    reason: Legacy wording criterion waived; host access controls reviewed separately\n    owner: @platform-team\n    expires: 2026-12-31\n```\n\nThe same shape works as JSON:\n\n```\n{\n  \"minScore\": 80,\n  \"dimensions\": { \"security\": \"off\" },\n  \"rules\": { \"SEC001\": \"off\", \"TE004\": \"low\" }\n}\n```\n\n**Tip:** set `dimensions.security: off` when another approved scanner owns\nsecret scanning and code scanning. CATES will\nstill score token efficiency, specificity, completeness, conflicts, and\nharness quality, and any individual security rule you want to keep\n(e.g. `MCP002`, `SEC005`) can be re-enabled with `rules.<ID>: on`.\n\nDisabled rules and dimensions are reported in the JSON output under\n`disabledFindings`, `disabledRuleIds`, and `disabledDimensions` so you\ncan audit exactly what was filtered.\n\nOnce you have a report, here's how to drive the score up:\n\n1. **Critical findings first** — almost always`SEC001` (hardcoded secrets)\nor`MCP002` (secrets in MCP config). Rotate the credential, then remove\nit from history and move it behind an env var / secret manager.\n2. **High-severity security & token waste** —`SEC003` (overly permissive\nscope),`SEC005` (system-prompt leakage),`TE004` (forced verbosity),`TE006` (cross-file duplication).\n3. **Token budget breach** — if`TE001` fires, your always-loaded config\nis over the 1,500-token budget. Move conditional or rarely-used\nguidance into scoped instruction files or on-demand prompt files.\n4. **Specificity & completeness** — replace vague language (`SPC001` ) with\nconcrete file paths, commands, and decision criteria; add the missing\nessential topics flagged by`CMP002` .\n\n```\n# Explain any rule, including the CATES section it maps to and how to fix it\ncates-analyzer explain SEC003\ncates-analyzer explain TE004\n\n# Apply mechanical, reviewable fixes (only rules marked autofix-safe)\ncates-analyzer . --fix-dry-run     # preview\ncates-analyzer . --fix             # apply\n\n# Re-run with a stricter gate to confirm the fix\ncates-analyzer . --min-score 85 --fail-on critical,high\n```\n\n- Commit a `.cates.yml` so the policy is reviewed like code.\n- If a rule is genuinely not applicable, **disable\nit** in`.cates.yml` rather than ignoring it everywhere.\n- If a finding is a known false positive, **suppress it** with a reason\nand (ideally) an`expires` date — the suppression report tells you\nwhen those expire.\n- Wire CATES into CI with `--format sarif` and upload to your code scanning\nsystem, or`--format json` and feed it into your own dashboards.\n\nEvery report contains a `recommendations` block, prioritized and\nestimated as heuristic configuration-token impacts, not measured savings. Impacts\ncan overlap and may not reflect actual client loading. Start at priority 1 and work\ndown — each item lists the affected files, the safety classification,\nand whether it's autofixable.\n\n```\n# Compare scores across runs by saving JSON reports per commit\ncates-analyzer . --format json > reports/$(git rev-parse --short HEAD).json\n```\n\nFor multi-repo views use `cates-analyzer portfolio <path>` or the demo\nmanifest (`cates-analyzer demo --limit 25`).\n\nThe analyzer **reports** what's inefficient. `cates-optimize` is a **separate,\ndeliberately-run tool** that **acts on that report**: it rewrites your Copilot\nprimitives (instructions, prompts, chat modes, agents, skills, rules files) to be\nreduce configuration source tokens using structural text checks, then\nprints source-token counts and a static re-score. It does **not** establish\nunchanged model behavior, task quality, request-token reductions or lower bills.\n\nIt is intentionally **not** wired into `cates-analyzer` — you run it on purpose.\n\n`cates-optimize` retains the legacy `lossless` safety label for compatibility.\nIt removes duplicates, recognized filler and whitespace; even these edits can\nchange how a model follows instructions. Available transformations:\n\n| Optimizer | Rule | What it removes | \n|---|---|---|\n| `dedupe-lines` | TE007 | Later exact duplicates of an instruction line (first copy stays) | \n| `dedupe-blocks` | TE007 | Later byte-identical multi-line blocks within a file | \n| `remove-filler` | TE003 | Standalone lines that only restate model defaults (e.g. \"You are a helpful assistant\") | \n| `whitespace` | — | Trailing whitespace, blank-line runs (code fences untouched) | \n\nBefore writing any file, the tool compares a **normalized set of non-filler lines\nand code-line entries**, then **re-scores with the same CATES engine**.\nThe signature ignores order and repetition and uses heuristic filler matching;\nit does not prove byte-identical code blocks or semantic/behavioral equivalence.\nRun representative before/after tasks before adopting edits. Anything that needs human\njudgement (restructuring always-loaded context, extracting big code examples,\nrewriting forced verbosity or negative-constraint lists, deduping across files,\nremoving secrets) is **left untouched** and surfaced as \"remaining opportunities\".\n\nWant the strictest purely-mechanical run? Add `--skip remove-filler` to keep only\nwhitespace + exact-duplicate removal.\n\n```\ncates-optimize .                          # optimize the current repo, write changes\ncates-optimize . --dry-run                # preview the gain, write nothing\ncates-optimize . --backup                 # keep a <file>.orig next to each change\ncates-optimize . --format json            # machine-readable achievement report\n\n# Reuse a report you already produced with the analyzer:\ncates-analyzer . --format json > report.json\ncates-optimize --report report.json\n\ncates-optimize --list-optimizers          # show available optimizers\ncates-optimize . --only dedupe-lines,whitespace\n```\n\nThe report leads with the headline efficiency gain (token reduction on active and always-loaded config), a before/after table (tokens, CATES score, findings), the per-file changes, the text-check details and limitations, and the remaining manual opportunities.\n\nBeyond configuration size, two possible economic improvement areas are assessed\nstatically through **experimental, non-normative** rules — **cache-shaping**\n(`CS001`–` CS005`: volatile tokens in the always-loaded prefix, dynamic-before-static\nordering, …) and **output-shaping** (`OS001`–` OS005`: missing output contract,\nfull-file-rewrite mandates, unconditional verbose reasoning, …).\n\nThese are **OFF by default, carry zero scoring weight, and are excluded from\nconformance and CI gates** — your score and grade are byte-identical whether the\nflag is on or off. Run them to *see the wider token impact*:\n\n```\ncates-analyzer . --experimental         # full report + a labeled experimental section\ncates-analyzer . --experimental-only    # just the cache/output-shaping findings\nCATES_EXPERIMENTAL=1 cates-analyzer .    # or via env var\ncates-optimize . --experimental          # advisory token impact (never auto-applied)\n```\n\nOr opt in via policy:\n\n```\n# .cates.yml\nexperimental: true\nrules:\n  OS002: off                  # disable a specific experimental rule\n  CS001: { severity: low }    # or soften one\n```\n\nFindings live in a separate `result.experimental` channel with\n`\"stability\": \"experimental\"` and are **SemVer-exempt**. See\n[`docs/EXPERIMENTAL-CACHE-OUTPUT-DIMENSIONS.md`](https://github.com/microsoft/cates/blob/main/docs/EXPERIMENTAL-CACHE-OUTPUT-DIMENSIONS.md)\nand `CATES-v1.0.md` §5.4 / §9.9 / §9.10. These are informative parts of the\nworking draft, **not normative conformance requirements**. Static signals do\nnot establish cache hits, universal price ratios, or behavior-preserving savings.\n\n**Annex L** expands CATES beyond configuration hygiene while leaving the\ninitial scan, its 49 stable rules, six scored dimensions, and CI gates intact.\nInvoke the separate accounting mode only when you have usage/outcome records:\n\n```\n# Synthetic worked example, not real vendor pricing\nnode dist/cli/index.js economics examples/economics.json\nnode dist/cli/index.js economics examples/economics.json --format json\n# Installed command: cates-analyzer economics usage.json\n```\n\nThe experimental assessment accounts for **uncached input, cache reads/writes,\noutput including reasoning, retries, failed/cancelled work, child-agent calls,\nretrieval and compaction calls**, and separately supplied tool, compute, storage,\nnetwork, human-review, and adjustment costs. It reports cost/tokens per\n**accepted task**, provider/model and purpose attribution, and elapsed latency.\n\nIt prevents double counting, retains rate provenance, distinguishes reported\ncharges from estimates, and keeps missing data **unknown rather than zero**.\nThere are no hardcoded vendor prices, model calls, telemetry collectors, or\neconomic gates. Complete coverage is caller-declared, not independently audited;\nempirical optimization benefits remain unproven until evaluated.\n\nSee the [full economics contract and lifecycle coverage matrix](https://github.com/microsoft/cates/blob/main/docs/TOKEN-ECONOMICS.md)\nfor every field, accounting equation, provider-normalization boundary, worked\nexample, limitation, and evidence/graduation requirement. The same assessment\nis available as `analyzeEconomics(input)` and `POST /api/economics`; no runtime\neconomics UI or automatic provider adapters are included.\n\n| Dimension | Weight | What It Checks | \n|---|---|---|\n| **Security** | 25% | Secrets, prompt injection vectors, overly permissive grants, system prompt leakage | \n| **Token Efficiency** | 25% | Redundancy, verbose examples, generic filler, forced verbosity, negative constraint spam | \n| **Specificity** | 15% | Vague vs actionable instructions, project-specific context, concrete patterns | \n| **Completeness** | 15% | Coverage of testing, error handling, style, architecture, security, scope, output | \n| **Conflict & Reachability** | 10% | Contradictory instructions and precedence conflicts | \n| **Harness Quality** | 10% | Scope limits, failure handling, output constraints, verification steps | \n\nThis tool is hardened against adversarial configs:\n\n- **Sandboxed reads** —`realpath()` verification prevents symlink escapes\n- **Size/depth/count limits** — no DoS via deep trees or huge files\n- **Binary detection** — skips non-text files\n- **No execution** — never runs or evaluates discovered content\n- **Secret redaction** — findings never expose full secrets\n- **No network calls** — purely local analysis (zero data exfiltration risk)\n- **Strict CLI validation** — invalid formats, gates, severities, and limits fail loudly\n- **Auditable suppressions** —`.cates.yml` suppressions require reasons and support expiration dates\n\nThis tool practices what it preaches:\n\n- **Zero LLM calls** for core scoring — pure heuristic-based analysis\n- **Real tokenizers per model family** :\n  - `openai-cl100k` (default) — GPT-3.5, GPT-4, GPT-4 Turbo\n  - `openai-o200k` — GPT-4o, o1, o3, o4 series\n  - `anthropic-claude` — Claude (BPE; exact for Claude 2, approximation for Claude 3+)\n  - `approx` — offline character heuristic\n- **Config precedence awareness** — knows which files are always-loaded vs conditional\n- **Token reduction projections** with conservative direct-token reduction and projected retry/tool-call reduction percentages\n\nPick one for scoring with `--tokenizer`, or compare side-by-side with `--compare-tokenizers`:\n\n```\ncates-analyzer . --tokenizer anthropic-claude\ncates-analyzer . --compare-tokenizers openai-cl100k,openai-o200k,anthropic-claude\ncates-analyzer tokenizers                # list supported tokenizers\n```\n\nThe default tokenizer can also be set via `CATES_TOKENIZER=anthropic-claude`.\n\n| File Pattern | Type | Loading Scope | \n|---|---|---|\n| `AGENTS.md` ,`CLAUDE.md` ,`GEMINI.md` ,`QWEN.md` ,`.ai/instructions.md` ,`.github/copilot-instructions.md` | Root instructions | Always-loaded | \n| Nested `AGENTS.md` ,`CLAUDE.md` ,`GEMINI.md` ,`QWEN.md` | Scoped instructions | Conditional | \n| `.github/instructions/*.instructions.md` ,`.ai/instructions/*.instructions.md` | Path-specific instructions ( `applyTo` ) | Conditional (always-loaded when `applyTo` targets every file) | \n| `.github/prompts/*.md` ,`.ai/prompts/*.md` ,`.claude/commands/*.md` ,`.gemini/commands/*.md` | Prompt/command files | On-demand | \n| `.github/chatmodes/*.chatmode.md` ,`.ai/chatmodes/*.chatmode.md` | Custom chat modes | On-demand | \n| `agents/*` ,`.github/agents/*` ,`.ai/agents/*` ,`.claude/agents/*` ,`.gemini/agents/*` | Agent definitions | Conditional | \n| `.cursorrules` ,`.cursor/rules/*.mdc` ,`.windsurfrules` ,`.windsurf/rules/*` ,`.clinerules` ,`.cline/rules/*` ,`.roo/rules/*` ,`.ai/rules/*` | Rule files | Always/conditional | \n| MCP configs ( `mcp.json` ,`.mcp.json` ,`.vscode/mcp.json` ,`.claude/mcp.json` ,`.gemini/mcp.json` ,`.ai/mcp.json` ) | Tool/server configs | Conditional | \n| `.vscode/settings.json` ,`.cursor/settings.json` ,`.claude/settings*.json` ,`.gemini/settings.json` ,`.aider.conf.yml` ,`.aiderignore` | Editor/CLI settings | Conditional | \n| Setup and hook configs ( `.ai/agent-setup.yml` ,`.github/workflows/copilot-setup-steps.yml` ,`.pre-commit-config.yaml` ,`.claude/hooks/*` ,`.ai/hooks/*` ) | Agent environment/harness | Environmental | \n\n```\nUsage:\n  cates-analyzer analyze [options] [path]\n  cates-analyzer review [options] <source>\n  cates-analyzer conformance [options] [path]\n  cates-analyzer rules [options]\n  cates-analyzer explain <ruleId>\n  cates-analyzer portfolio [options] [path]\n  cates-analyzer demo [options]\n  cates-analyzer tokenizers [options]\n\nCommon analyze options:\n  -f, --format <format>       pretty, json, sarif\n  --policy <path>             .cates.yml/.json policy file\n  --min-score <n>             quality gate\n  --require-level <n>         require CATES Level 1, 2, or 3\n  --fail-on <list>            e.g. critical,high\n  --max-always-loaded <n>     token budget gate\n  --tokenizer <name>          openai-cl100k (default), openai-o200k, anthropic-claude, approx\n  --compare-tokenizers <list> side-by-side counts\n  --files <list>              comma-separated relative files to analyze\n  --individual                score each --files entry separately\n  --fix / --fix-dry-run       safe mechanical fixes\n```\n\n`review` accepts local folders and GitHub URLs. For private repositories, authenticate with `gh auth login` and use `review`; CATES uses local GitHub CLI credentials instead of asking for tokens.\n\n`demo` scans repositories supplied with `--repos-file repos.txt`, where each non-comment line is either a repository URL or `<category> <repository URL>`.\n\nYou can also run demo mode through the default command with `cates-analyzer --demo`.\n\nPolicy suppressions can be used for documented false positives or temporary accepted risk:\n\n```\nsuppressions:\n  - ruleId: SEC004\n    file: .github/copilot-instructions.md\n    reason: Legacy wording criterion waived; host access controls reviewed separately\n    expires: 2026-12-31\nsrc/\n├── cli/index.ts              # Commander.js CLI entry point\n├── analyzers/\n│   ├── index.ts              # Orchestrator (parallel analyzer execution)\n│   ├── discovery.ts          # Secure file enumeration + tokenization\n│   ├── token-efficiency.ts   # Waste pattern detection\n│   ├── security.ts           # Secret/injection/permission analysis\n│   ├── specificity.ts        # Vagueness and project-context checks\n│   ├── completeness.ts       # Topic coverage analysis\n│   └── conflicts.ts          # Contradiction detection + harness quality\n├── rules/\n│   └── catalog.ts            # Machine-readable CATES rule catalog\n├── scoring/\n│   ├── calculator.ts         # Weighted multi-dimension scoring\n│   ├── recommendations.ts    # Prioritized action generation\n│   └── report.ts             # Pretty/JSON/SARIF formatters\n├── conformance.ts            # Level/gate evaluation\n├── policy.ts                 # .cates.yml loading\n├── autofix.ts                # Safe fix/dry-run support\n├── portfolio.ts              # Multi-repo scanning\n├── utils/\n│   └── tokenizer.ts          # cl100k_base tokenizer + context measurement\n├── types.ts                  # Zod-validated type definitions\n└── index.ts                  # Library entry point\nnpm ci\nnpm run typecheck:all   # CLI + service TypeScript validation\nnpm test                # Vitest suite (284 tests, ~2s)\nnpm run test:coverage   # Coverage + enforce the floor (stmt 88, branch 82, func 92, line 88)\nnpm run service:dev     # Run the HTTP service locally with hot reload\nnpx tsx src/cli/index.ts ./fixtures/bad   # Test against bad config\nnpx tsx src/cli/index.ts ./fixtures/good  # Test against good config\nnpm run release:check   # Full release validation + package preview\n```\n\nCI runs `npm run test:coverage`, so any PR that drops below the configured\ncoverage thresholds (set in `vitest.config.ts`) will fail. The floor is\nintentionally below the achieved coverage (~93 / 85 / 96 / 94)\nso normal refactors don't trigger flakes; raise it when you legitimately\nimprove coverage, never silently lower it.\n\nThe analyzer catalog contains **49 stable rules** grouped by scored dimension\nand **10 opt-in experimental rules** for cache and output shaping. The same\ndata is available programmatically:\n\n```\ncates-analyzer rules --format json     # full machine-readable catalog\ncates-analyzer explain SEC003          # full detail + remediation for one rule\n```\n\nUse the [`Configuring CATES`](#configuring-cates) section to\nturn any rule on/off or override its severity in `.cates.yml`.\n\n**Legend:** Severity follows CATES §9. **Autofix ✅** means\n`cates-analyzer . --fix` can apply a safe, mechanical change for this\nrule; `—` means the fix is manual.\n\n| Rule | Title | Severity | CATES § | Autofix | \n|---|---|---|---|---|\n| MCP002 | Secrets in MCP Configuration | Critical | Annex C | — | \n| SEC001 | Hardcoded Secrets | Critical | 9.3 | — | \n| SEC007 | Autonomy / Approval Bypass | Critical | 9.3 | — | \n| AGT001 | Subagent Missing Tool Restriction | High | 9.8 | — | \n| CMD001 | Command Auto-Executes Shell | High | 9.8 | — | \n| EDC003 | Overly Permissive Tool Allowlist | High | Annex F | — | \n| MCP003 | Insecure MCP Endpoint | High | Annex C | — | \n| MCP005 | Shell Operators in MCP Command | High | Annex C | — | \n| SEC002 | Injection Vectors | High | 9.3 | — | \n| SEC003 | Overly Permissive Scope | High | 9.3 | — | \n| SEC005 | System Prompt Leakage Risk | High | 9.3 | — | \n| SEC006 | Unsafe Execution Patterns | High | 9.3 | — | \n| STP001 | Pipe-to-Shell Setup Pattern | High | Annex D | — | \n| MCP006 | Unpinned MCP Server Package | Medium | Annex C | — | \n| SEC004 | Missing Prompt Protection | Medium | 9.3 | ✅ | \n| STP003 | Broad Setup Permissions | Medium | Annex D | — | \n| HK003 | Outdated Hook Version | Low | Annex E | — | \n\n| Rule | Title | Severity | CATES § | Autofix | \n|---|---|---|---|---|\n| TE004 | Forced Verbosity | High | 9.2 | — | \n| TE006 | Cross-File Duplication | High | 9.2 | — | \n| PRM002 | Oversized Prompt File | Medium | Annex B | — | \n| TE001 | Excessive Always-Loaded Token Count | Medium | 9.2 | — | \n| TE002 | Excessive Inline Code Examples | Medium | 9.2 | — | \n| TE005 | Negative Constraint Spam | Medium | 9.2 | — | \n| TE007 | Within-File Duplicate Instructions | Medium | 9.2 | ✅ | \n| TE008 | Unbounded Context Includes | Medium | 9.2 | — | \n| HK002 | Heavy Hook Operation | Low | Annex E | — | \n| STP002 | Missing Dependency Caching | Low | Annex D | — | \n| TE003 | Generic Filler Instructions | Low | 9.2 | — | \n\n| Rule | Title | Severity | CATES § | Autofix | \n|---|---|---|---|---|\n| SPC001 | Vague Language | Medium | 9.4 | — | \n| SPC002 | Missing Project Context | Medium | 9.4 | — | \n| AGT002 | Subagent Missing Description | Low | 9.8 | — | \n| MCP004 | Missing MCP Server Descriptions | Low | Annex C | — | \n| PRM001 | Missing Prompt Purpose Header | Low | Annex B | ✅ | \n| PRM003 | Excessive Hardcoded File Paths | Low | Annex B | — | \n| SPC003 | Missing Architecture Structure | Low | 9.4 | — | \n| SPC004 | Long Abstract Instruction Block | Low | 9.4 | — | \n\n| Rule | Title | Severity | CATES § | Autofix | \n|---|---|---|---|---|\n| CMP001 | No Configuration Content | High | 9.5 | — | \n| CMP002 | Missing Essential Topics | Medium | 9.5 | — | \n| MCP001 | Invalid MCP Config Syntax | Medium | Annex C | — | \n| STP004 | Missing Test Framework Setup | Medium | Annex D | — | \n| CMP003 | Monolithic Configuration File | Low | 9.5 | — | \n| EDC001 | Invalid Editor Settings Syntax | Low | Annex F | — | \n| EDC002 | AI Assistance Disabled Broadly | Low | Annex F | — | \n| PRM004 | No Variables in Large Prompt | Low | Annex B | — | \n| PRM005 | Prompt Library Sprawl | Low | Annex B | — | \n| STP005 | Missing Linter Setup | Low | Annex D | — | \n\n| Rule | Title | Severity | CATES § | Autofix | \n|---|---|---|---|---|\n| CNF001 | Contradictory Instructions | High | 9.6 | — | \n| HK001 | Interactive Hook | Medium | Annex E | — | \n\n| Rule | Title | Severity | CATES § | Autofix | \n|---|---|---|---|---|\n| CNF002 | Missing Harness Element | Medium | 9.6 | — | \n\n| Prefix | Surface | \n|---|---|\n| `SEC` | Core security checks across all configuration | \n| `TE` | Token-efficiency / waste pattern checks | \n| `SPC` | Specificity / actionability checks | \n| `CMP` | Completeness / topic-coverage checks | \n| `CNF` | Conflict & reachability checks | \n| `PRM` | Prompt-file checks (CATES Annex B) | \n| `MCP` | MCP configuration checks (CATES Annex C) | \n| `STP` | Setup-step checks (CATES Annex D) | \n| `HK` | Hook checks (CATES Annex E) | \n| `EDC` | Editor configuration checks (CATES Annex F) | \n| `AGT` | Subagent-definition checks (CATES §9.8) | \n| `CMD` | Slash-command checks (CATES §9.8) | \n\nThis package follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html).\nReleases are automated by\n[release-please](https://github.com/googleapis/release-please) from\n[Conventional Commits](https://www.conventionalcommits.org/) on `main`:\n\n- `feat:` → MINOR bump\n- `fix:` /`perf:` → PATCH bump\n- `feat!:` or`BREAKING CHANGE:` → MAJOR bump\n\nThe full policy (including how the CATES standard document is versioned\nseparately from the analyzer) is in [`VERSIONING.md`](https://github.com/microsoft/cates/blob/main/VERSIONING.md), and\nall releases are recorded in [`CHANGELOG.md`](https://github.com/microsoft/cates/blob/main/CHANGELOG.md).\n\nCopyright (c) Microsoft Corporation.\n\nLicensed under the [MIT License](https://github.com/microsoft/cates/blob/main/LICENSE.TXT).\n\nThis project welcomes contributions and suggestions. See [CONTRIBUTING.md](https://github.com/microsoft/cates/blob/main/CONTRIBUTING.md) for details,\nincluding the Microsoft Contributor License Agreement requirement.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\n\nFor information about reporting security vulnerabilities, please see [SECURITY.md](https://github.com/microsoft/cates/blob/main/SECURITY.md).\nDo not report security issues through public issue trackers; use the Microsoft Security Response\nCenter reporting process described there.\n\nSee [SUPPORT.md](https://github.com/microsoft/cates/blob/main/SUPPORT.md) for how to file issues and get help.\n\nCATES does not collect telemetry and does not send usage data or analyzed content to Microsoft.\nSee [PRIVACY](https://github.com/microsoft/cates/blob/main/PRIVACY) for details.\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of\nMicrosoft trademarks or logos is subject to and must follow\n[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion\nor imply Microsoft sponsorship. Any use of third-party trademarks or logos is subject to those\nthird-party policies.", "url": "https://wpnews.pro/news/coding-agent-token-economics-standard", "canonical_source": "https://github.com/microsoft/cates", "published_at": "2026-11-29 16:55:43+00:00", "updated_at": "2026-11-29 17:14:16.133670+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-safety", "agent-protocols"], "entities": ["Microsoft", "Coding Agent Token Economics Standard", "cates-analyzer", "cates-optimize", "GitHub Copilot", "OpenSSF", "Node.js", "npm"], "also_reported_by": [], "takeaway": "cates-analyzer scores coding-agent configs statically from a 100-point baseline with no LLM calls, and its optional --copilot profile adds 15 experimental checks across 11 configuration families without changing the stable scoring model or CI gates.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/coding-agent-token-economics-standard", "markdown": "https://wpnews.pro/news/coding-agent-token-economics-standard.md", "text": "https://wpnews.pro/news/coding-agent-token-economics-standard.txt", "jsonld": "https://wpnews.pro/news/coding-agent-token-economics-standard.jsonld"}}