ccgauge: Instructions file for Codex

AGENTS.md

ccgauge AGENTS.md is an instructions file for Codex, OpenCode from chengzuopeng/ccgauge. It costs 9,454 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

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

This is chengzuopeng/ccgauge's own configuration. It tells Codex and OpenCode how to work on ccgauge itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ccgauge configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/chengzuopeng/ccgauge/main/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/github.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/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.

agentmods 80×15 button for ccgauge AGENTS.md

Your own site · 80×15
<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>
Per session 9,454 This file is loaded in full into every session.
When invoked 9,454 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.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

Measured 9d ago against content hash 5638cae4f96f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 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.

AGENTS.md · 601 lines

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

Read the full file on GitHub · 601 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. 9d ago Changed · +33 lines · +566 tokens per session 5638cae4f96f
  2. 11d ago Changed · +77 lines · +1,477 tokens per session 1052fb0473ae
  3. 13d ago Changed · +17 lines · +284 tokens per session 98ff894b3ad2
  4. 16d ago Changed · +64 lines · +1,078 tokens per session 124890949b47
  5. 1mo ago Changed · +19 lines · +323 tokens per session 2671c231118a
  6. 1mo 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 (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.

Related

Other instructions, from other repositories