ccgauge AGENTS.md

ccgauge AGENTS.md is an instructions file for Codex, OpenCode from chengzuopeng/ccgauge. It costs 5,726 tokens per session, scanned A, original, MIT.

A set of instructions for coding agents working on ccgauge, a local dashboard, command-line tool, and MCP server for inspecting Claude Code and OpenAI Codex CLI token usage and costs. An MCP server lets compatible agents access a program's tools.

In plain words
What is it for?
Use it when changing ccgauge's web dashboard, CLI, MCP server, APIs, or data indexer.
Why use it?
It explains the repository layout, shared data layer, working commands, and checks needed after source changes, so agents can edit the project without guessing.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/chengzuopeng/ccgauge/agents-md
Clone the repo
git clone --depth 1 https://github.com/chengzuopeng/ccgauge

Made for: Codex, OpenCode.

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

agentmods badge for ccgauge AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/chengzuopeng/ccgauge/agents-md.svg)](https://agentmods.dev/instructions/chengzuopeng/ccgauge/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/chengzuopeng/ccgauge/agents-md"><img src="https://agentmods.dev/badge/instructions/chengzuopeng/ccgauge/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 5,726 This file is loaded in full into every session.
When invoked 5,726 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.05726 $0.05726
Opus 5 $0.02863 $0.02863
Sonnet 5 $0.01145 $0.01145
Haiku 4.5 $0.00573 $0.00573

Measured 5d ago against content hash 29c81a18d304, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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

AGENTS.md · 391 lines

How it starts

The opening of the file, as written. The whole thing — 391 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.tsdist/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).

Read the full file on GitHub · 391 lines

Changes

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.

  1. 5d ago First seen · 391 lines · 5,726 tokens per session scan A 29c81a18d304

Subscribe to this mod's changes

ccgauge AGENTS.md is an instructions file published in the GitHub repository chengzuopeng/ccgauge (21 stars, last pushed 16d ago), licensed MIT. It adds 5,726 tokens to every session, about $0.0286 per session on Opus 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.

Related

Other instructions, from other repositories

Vibe-Research AGENTS.md

AGENTS.md instructions for simonlin1212/Vibe-Research, covering vibe-research-agent 金融研究宪法, 0. 三条不可越线, 1. 数据纪律(五问 gate:给出任何数字或结论前逐条自问), 2. 研究哲学(评估框架,不是预测工具) and 3. 估值口径(你只选输入、解释输出;计算交给 calc/).

simonlin1212/Vibe-Research · 4,469 tokens

worldmonitor AGENTS.md

AGENTS.md instructions for koala73/worldmonitor, covering agents.md, task mode and authority, start here, surface routing and architecture invariants.

koala73/worldmonitor · 2,568 tokens

vizro copilot-instructions.md

Copilot instructions for mckinsey/vizro, covering github copilot instructions for vizro, pull requests from bots and automated tooling and everything else.

mckinsey/vizro · 332 tokens

TreeMap-Disk-Visualizer AGENTS.md

AGENTS.md instructions for Prithvi-Web/TreeMap-Disk-Visualizer, covering treemap for agents, two ways in, the core workflow: scan → inspect → dry-run → act, the safety model (enforced server-side, not advisory) and mcp specifics.

Prithvi-Web/TreeMap-Disk-Visualizer · 6,731 tokens

openclaw-dashboard CLAUDE.md

Claude Code instructions for mudrii/openclaw-dashboard, covering go development standards, project constraints, internal packages, environment and commands.

mudrii/openclaw-dashboard · 1,519 tokens

metabase copilot-instructions.md

Copilot instructions for metabase/metabase, covering metabase developer assistant instructions, code review standards, security critical issues, performance red flags and code quality essentials.

metabase/metabase · 377 tokens