Borrowing it
Nothing to install: this file belongs to chengzuopeng/ccgauge. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/chengzuopeng/ccgauge/main/AGENTS.mdgit clone --depth 1 https://github.com/chengzuopeng/ccgaugeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/chengzuopeng/ccgauge/agents-md)<a href="https://agentmods.dev/instructions/chengzuopeng/ccgauge/agents-md"><img src="https://agentmods.dev/badge/instructions/chengzuopeng/ccgauge/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/chengzuopeng/ccgauge/agents-md"><img src="https://agentmods.dev/badge/instructions/chengzuopeng/ccgauge/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.09454 | $0.09454 |
| Opus 5.5 | $0.03782 | $0.03782 |
| Sonnet 5.5 | $0.01891 | $0.01891 |
| Haiku 4.5 | $0.00945 | $0.00945 |
Grade A, and why
ccgauge AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 601 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Working agreement for AI coding agents (Claude Code, Codex CLI, Cursor agents, etc.) editing this repo. Humans should skim it too — it captures the non-obvious parts of the codebase that aren't in the README.
What this project is
ccgauge is a local web dashboard + CLI + MCP server for inspecting
Claude Code and OpenAI Codex CLI token usage and cost. Everything runs
on the user's machine; there are zero outbound network calls at runtime.
Three user-facing surfaces share one data layer:
| Surface | Entry | Talks to |
|---|---|---|
| Web dashboard | app/ (Next.js 15 RSC) |
the indexer singleton |
CLI (ccgauge) |
bin/cli.mjs |
the indexer via a bundled dist/report/index.mjs |
MCP server (ccgauge mcp) |
lib/mcp/entry.ts → dist/mcp/server.mjs |
the indexer via a separate 'mcp'-named instance |
Published to npm as ccgauge. End-users typically run npx ccgauge.
Repo layout
app/ Next.js routes (RSC pages + /api routes)
api/ Server-side JSON endpoints (scan, usage, sessions,
projects, turns, blocks, pricing, export/usage)
page.tsx Overview
usage/, sessions/[id]/, projects/[id]/, models/, tools/, settings/
Drill-down pages. Sessions / Projects / Models /
Tools live under the "Analytics" nav dropdown.
bin/cli.mjs Single-file CLI (commander). Imports the bundled
dist/report/index.mjs and dist/mcp/server.mjs lazily
when those subcommands run.
components/ React. All client UI atoms (KpiCard, Section,
usage-table, hover-card, activity-stats, …).
lib/
providers/ Per-CLI adapters (claude, codex). Add a new provider
by dropping a folder + one line in lib/providers/index.ts.
Each adapter owns resolvePricing() + costFromUsage().
data-loader/ scan.ts (entry), indexer.ts (singleton + watchers),
index-persist.ts (~/.ccgauge on-disk cache),
parse-jsonl.ts (claude parser), link-sidechain.ts
(sub-agent → parent-turn merge pass, both providers),
derived.ts (memoized per-scan derivations: model /
project lists, turn-row LRU).
aggregator/ Pure aggregations: totals, time-buckets, by-model,
by-project, by-session, activity heatmap (activity.ts),
and tool / skill / MCP context footprint (tools.ts,
feeds the /tools page — Claude source only).
api/ error-handler.ts: the withApiErrorHandling wrapper +
shared badRequest shape used by every /api route.
blocks/ 5-hour billing-block rollups (computeBlocks). Feeds
app/api/blocks + the block-progress components.
pricing/ LiteLLM-sourced. litellm-pricing.generated.js is the
committed snapshot (refresh: pnpm update-pricing);
builtin.ts gap-fills models LiteLLM lacks; store.ts
overlays a runtime LiteLLM cache + publishes to a
globalThis slot; merge.ts + litellm-transform.js hold
the pure merge/validate/transform; resolve.ts +
calculate.ts + cost-from-usage.ts do lookup + math.
source.ts / "Source" switch (claude / codex / merged), cookie-
source-merge.ts driven; folds two providers' totals + buckets into
one merged view.
serialize.ts Shape AssistantRecord[] → UsageTableRow[] /
UsageTurnRow[]; turn grouping lives here too.
turns.ts Parent-chain walking that decides which assistant
records collapse into the same "turn".
cli-report/ The pretty terminal report. Bundled into dist/report.
mcp/ MCP server (stdio JSON-RPC). Bundled into dist/mcp.
tools/ holds the 9 registered tools (usage.ts × 6,
activity.ts × 3); resources/ exposes provider
metadata; check.ts backs `ccgauge mcp --check`.
i18n/, theme/ Cookie-driven SSR + localStorage mirror + no-flash.
scripts/ Build & test helpers (esbuild bundlers, postbuild,
parser fixtures).
dist/ esbuild output. Not source-controlled — generated
by `pnpm build`. Listed in package.json#files so it
ships in the npm tarball.
site/ Astro 4 marketing site. Deployed twice from one
workflow: GitHub Pages at chengzuopeng.github.io/ccgauge
and EdgeOne at ccgauge.linkdiary.cn — see
`site/README.md#deploy`, which also records why
EdgeOne can't use its own Git integration and the
two setup traps (project must be `Upload` type;
the token must be a REPOSITORY secret). Source-only
subdirectory: commands and dependencies are managed
by the root `package.json` / `pnpm-lock.yaml`, while
site builds remain explicit via `pnpm site:*`.
NOT published to npm — excluded by the main
`package.json#files` allowlist and a
belt-and-suspenders `site/` line in `.npmignore`.
Develop with `pnpm site:dev` (runs on :4321 so it
doesn't clash with the dashboard on :3738).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago Changed · +33 lines · +566 tokens per session 5638cae4f96f
- 11d ago Changed · +77 lines · +1,477 tokens per session 1052fb0473ae
- 13d ago Changed · +17 lines · +284 tokens per session 98ff894b3ad2
- 16d ago Changed · +64 lines · +1,078 tokens per session 124890949b47
- 1mo ago Changed · +19 lines · +323 tokens per session 2671c231118a
- 1mo ago First seen · 391 lines · 5,726 tokens per session scan A 29c81a18d304
ccgauge AGENTS.md is an instructions file published in the GitHub repository chengzuopeng/ccgauge (24 stars, last pushed 9d ago), licensed MIT. It adds 9,454 tokens to every session, about $0.0378 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
vscode model-prompts.instructions.md
Model-specific prompt authoring and registry guidelines.