Borrowing it
Nothing to install: this file belongs to cwf818/creditgauge. 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/cwf818/creditgauge/main/CLAUDE.mdgit clone --depth 1 https://github.com/cwf818/creditgaugeWrote 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/cwf818/creditgauge/claude-md)<a href="https://agentmods.dev/instructions/cwf818/creditgauge/claude-md"><img src="https://agentmods.dev/badge/instructions/cwf818/creditgauge/claude-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/cwf818/creditgauge/claude-md"><img src="https://agentmods.dev/badge/instructions/cwf818/creditgauge/claude-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.10003 | $0.10003 |
| Opus 5 | $0.05001 | $0.05001 |
| Sonnet 5 | $0.02001 | $0.02001 |
| Haiku 4.5 | $0.01000 | $0.01000 |
Grade B, and why
creditgauge CLAUDE.md scanned grade B with 1 finding 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
- `.gitignore` excludes `.claude/settings.json` (which contains the live token in this project) and `~/.claude/settings.json` is the user's file — never modify it programmatically without preserving all other keys. How it starts
The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
What this is
A Claude Code statusline plugin (creditgauge, formal name CreditGauge-CC) that renders MiniMax token-plan usage (5-hour and weekly windows) or DeepSeek account balance, picked by ANTHROPIC_BASE_URL. The plugin ships its own installer (scripts/install.sh) that hooks into Claude Code's statusLine slot and (optionally) chains any pre-existing statusline (e.g. ccstatusline, claude-hud) as the upstream. When ANTHROPIC_BASE_URL does not point at a supported provider, the plugin hides itself and passes upstream output through unchanged.
The plugin is shipped as a single-plugin marketplace: the repo root IS the marketplace, and .claude-plugin/plugin.json declares the plugin. Install with /plugin marketplace add cwf818/creditgauge then /plugin install creditgauge@creditgauge, then run /creditgauge:install to wire it into settings.json. Uninstall with /creditgauge:uninstall (a self-contained cleanup that works even after the cache and marketplace are gone).
v1.0.0 — Renamed from topgauge to creditgauge (hard cut, no compat shim). Full mapping in CHANGELOG; provider strings (minimax / MiniMax / DeepSeek etc.) are unchanged.
v0.7.0 — Renamed from tokenplan-usage-hud to topgauge (state-dir migration + legacy dual-strip one release).
Commands
npm install # install dev deps (esbuild, typescript, tsx, @types/node)
npm run typecheck # tsc --noEmit
npm test # node --test via tsx (1248 tests across api/render/cache/composition, ~28s on win32)
npm run build # esbuild → dist/index.js (single self-contained ESM bundle, target=node18)
npm run dev # esbuild --watch
There is no separate lint step; typecheck covers it. Tests run with built-in node:test + tsx — no vitest/jest dependency.
Architecture
src/
index.ts # entry — stdin drain, provider dispatch, cache, render, compose, loadConfig()
types.ts # Provider union + transport-free config/data types
api.ts # dynamic plugin loader + canonical Quota/Balance exports
plugins/data.ts # plugin ABI and canonical Quota/Balance shapes
plugins/parsers.ts # built-in field-mapping parsers
# v0.8.36+ — m_windowMemUsage is the RAM-usage sibling of
# m_memUsage (which renders absolute bytes "Mem:X.XG/Y.YG" as a
# two-tone string: the used chunk is band-colored via
# colorFor(pct, "used"), only the prefix + total keep the module's
# fixed cyan tint). m_windowMemUsage renders a bar+percent chunk
# (parallel of m_windowContext) — `▓▓▓▓▓░░░ 62%` — by wrapping
# getMemUsage()'s 0..100 ratio in a synthetic Window and routing
# through formatOneChunk / formatOneChunkColored. The value color
# is driven by colorFor(pct, "used") so thresholds.percentBands
# drives the hue. NO label prefix. Wired into the standard preset
# via the mem_info fragment (m_template|mem_info).
render.ts # v1.0 READ-ONLY against status-store's per-tick pending map: pctBar + ANSI color thresholds + renderProviderLine (sole public entry; the legacy formatLine / formatBalanceLine shims were dropped in v0.9.x); NO setAvg/setPrevTick/setLastSpeed calls (those live in status-store.ts)
status-store.ts # v1.0 per-tick state owner — beginTick / processTick / mark / setAvg / setPrevTick / setLastSpeed|ApiMs|TokenHitRate / computeAndCacheTickDeltaPure / getDeltaForRender / commit; owns ALL writes to the in-memory pending store + the single commit() flush to state/<projectHash>/state.json + the append-only JSONL samples
cache.ts # TTL + stale-on-error (Map<key, {at, value}>) — TTL passed in by index.ts from configStore
config.ts # config loader/store and provider facade
config.providers.ts # provider defaults, type validation, effective mappings
config.template.ts # line-template defaults and template-only types
composition.ts # reads CREDITGAUGE_UPSTREAM env, prepends (preserving ANSI/multi-line) and appends line
__fixtures__/ # quota.real.minimax.json, balance.real.json, balance.multi.json, stdin.real.json, …
session-parse.ts # parseTokenSnapshot — stdin JSON → TokenSnapshot (extracted from index.ts so unit tests don't drag index side effects)
*.test.ts # node:test unit tests
.claude-plugin/
plugin.json # plugin manifest (name, version, commands, homepage)
marketplace.json # single-plugin marketplace wiring
commands/
install.md # /creditgauge:install slash command (Pattern B2 — loader-executes-script via `!`-fenced block + ${CLAUDE_PLUGIN_ROOT}; scoped allowed-tools)
uninstall.md # /creditgauge:uninstall slash command (Pattern B2)
clean.md # /creditgauge:clean slash command (Pattern B2)
clean-cache.md # /creditgauge:clean-cache slash command (Pattern B2)
clean-journal.md # /creditgauge:clean-journal slash command (Pattern B2)
reset.md # /creditgauge:reset slash command (Pattern B2)
config.md # /creditgauge:config slash command (Pattern B2)
query_plugins/
plugins.json # registry metadata (title / config template / hasAuth) for the bundled providers
minimax/ # bundled QUOTA plugin (index.js) — seeded into the user dir by install.sh
deepseek/ # bundled BALANCE plugin (index.js) — seeded into the user dir by install.sh
kimi/ # bundled QUOTA plugin (kimi.com billing)
bigmodel/ # bundled QUOTA plugin (bigmodel.cn token-plan)
commandcode/ # bundled QUOTA plugin
copilot-api/ # bundled QUOTA plugin (local copilot-api proxy)
opencode/ # bundled QUOTA plugin
auth-cdp.cjs # shared zero-dep CDP browser-auth helper (v1.2.2)
# Resolution: ~/.claude/plugins/creditgauge/query_plugins/<id>/ (user) wins,
# then this bundled copy. install.sh seeds minimax/deepseek into the user
# dir on every (re-)install (no-clobber).
scripts/
wrapper.sh # bash wrapper: CREDITGAUGE_UPSTREAM_CMD → CREDITGAUGE_UPSTREAM → us
install.sh # settings.json patcher (install/restore/dry-run; uninstall is its own command in v0.9.x+)
uninstall.sh # self-contained uninstaller (used by :uninstall and dev:uninstall)
clean.sh # trim old .bak.<ts> files, keeping only the most recent per file
clean-cache.sh # remove stale plugin-cache version dirs, keeping only the newest
clean-journal.sh # remove old state/<projectHash>/*.jsonl journal files by age or --all
config.sh # read/modify runtime config (statuslineTemplate preset switch, upstream chain toggle)
reset.sh # wipe cache.json + state.json + cache.stat.json for the current project only
migrate-state.sh # legacy state/token-samples/<hash>/ → state/<hash>/ migration helper
dev-uninstall.sh # DEV-ONLY thin shim → exec uninstall.sh
lib/edit-settings.mjs # ESM helper used by install.sh
lib/edit-config.mjs # ESM helper used by config.sh
lib/journal.mjs # install-journal read/write helper used by uninstall.sh
lib/project-hash.sh # shared projectHash(cwd) helper for shell scripts
test-*.sh # isolated-tmpdir shell regression tests (install/uninstall/edit-settings/clean-cache/reset/config/rename-consistency)
settings.example.json # template (NEVER commit a real settings.json)
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 First seen · 304 lines · 10,003 tokens per session scan B ebf1933f7f17
creditgauge CLAUDE.md is an instructions file published in the GitHub repository cwf818/creditgauge (2 stars, last pushed yesterday), licensed MIT. It adds 10,003 tokens to every session, about $0.0500 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
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.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
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).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
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.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.