creditgauge: Instructions file for Claude Code

CLAUDE.md

creditgauge CLAUDE.md is an instructions file for Claude Code from cwf818/creditgauge. It costs 10,003 tokens per session, scanned B, original, MIT.

A set of repository instructions for CreditGauge-CC, a Claude Code status-line plugin that displays token-plan usage or account balance for supported providers.

In plain words
What is it for?
Use it as a reference when installing, configuring, understanding, or uninstalling creditgauge in its repository.
Why use it?
It explains how the plugin works, which provider setting controls its display, and how installation and removal connect to Claude Code settings.

Instructions file for Claude Code

Written for Claude Code: ${CLAUDE_PLUGIN_ROOT} variable. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is cwf818/creditgauge's own configuration. It tells Claude Code how to work on creditgauge 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 creditgauge configures →

Runs only inside a plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else, and the catalogue could not identify which plugin ships it.

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/cwf818/creditgauge/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/cwf818/creditgauge

Made for: Claude Code.

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 creditgauge CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/cwf818/creditgauge/claude-md/github.svg)](https://agentmods.dev/instructions/cwf818/creditgauge/claude-md)
Your own site
<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.

agentmods 80×15 button for creditgauge CLAUDE.md

Your own site · 80×15
<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>
Per session 10,003 This file is loaded in full into every session.
When invoked 10,003 The same file — it is already loaded in full.
Security scan B 1 finding. 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.10003 $0.10003
Opus 5 $0.05001 $0.05001
Sonnet 5 $0.02001 $0.02001
Haiku 4.5 $0.01000 $0.01000

Measured 9d ago against content hash ebf1933f7f17, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

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.
CLAUDE.md · 304 lines

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)

Read the full file on GitHub · 304 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 First seen · 304 lines · 10,003 tokens per session scan B ebf1933f7f17

Subscribe to this mod's changes

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.

Related

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.

vercel/next.js · 7,296 tokens

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.

openai/codex · 5,153 tokens

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

microsoft/vscode · 6,785 tokens

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

microsoft/vscode · 5,001 tokens

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.

langchain-ai/langchain · 4,469 tokens

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.

deepseek-ai/deepseek-harness · 3,735 tokens