topgauge: Instructions file for Claude Code

CLAUDE.md

topgauge CLAUDE.md is an instructions file for Claude Code from cwf818/topgauge. It costs 9,021 tokens per session, scanned B, original, MIT.

Repository instructions for CreditGauge-CC, a Claude Code status-line plug-in that displays usage or account balance for supported AI service providers. A status line is the small information display shown in the coding tool's interface.

In plain words
What is it for?
Developing, installing, uninstalling, and testing the plug-in and its marketplace files, including support for the documented usage and balance sources.
Why use it?
They explain installation, provider detection, status-line chaining, and cleanup so the plug-in behaves correctly without disrupting an existing status display.

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/topgauge's own configuration. It tells Claude Code how to work on topgauge 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 topgauge 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/topgauge. 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/topgauge/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/cwf818/topgauge

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

README.md
[![agentmods](https://agentmods.dev/badge/instructions/cwf818/topgauge/claude-md.svg)](https://agentmods.dev/instructions/cwf818/topgauge/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/cwf818/topgauge/claude-md"><img src="https://agentmods.dev/badge/instructions/cwf818/topgauge/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 9,021 This file is loaded in full into every session.
When invoked 9,021 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.09021 $0.09021
Opus 5 $0.04510 $0.04510
Sonnet 5 $0.01804 $0.01804
Haiku 4.5 $0.00902 $0.00902

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

Security

Grade B, and why

topgauge 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 7d 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 · 270 lines

How it starts

The opening of the file, as written. The whole thing — 270 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 (64 tests across api/render/cache/composition)
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
  plugins/minimax/    # standalone Quota plugin source
  plugins/deepseek/   # standalone BALANCE plugin source
  # v0.8.36+ — m_windowMemUsage is the RAM-usage sibling of
  # m_memUsage (which renders absolute bytes "Mem:X.XG/Y.YG" with
  # a 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.
  # Opt-in; not in any default lineTemplate.
  render.ts           # v1.0 READ-ONLY against tickState.pending: 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 moved to data-processor.ts)
  data-processor.ts   # v1.0 processTick + setPrevTick + setAvg + setLastSpeed/ApiMs/TokenHitRate + computeAndCacheTickDeltaPure + getDeltaForRender — owns ALL writes to tickState.pending
  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
  tick-state.ts       # v1.0 per-tick in-memory Store: beginTick / mark / commit; backing the data-processor's writes + the single commit() flush
  __fixtures__/       # remains.real.json, balance.real.json, balance.multi.json, …
  session-parse.ts    # parseTokenSnapshot — stdin JSON → TokenSnapshot (extracted from index.ts so unit tests don't drag index side effects)
  token-store.ts      # append-only JSONL state file at state/<projectHash>/<sessionId>.jsonl for sum/avg modules (v0.4.x+; v0.8.0 adds readAllSamples cross-project scan)
  *.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)
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
  lib/edit-settings.mjs # ESM helper used by install.sh
  dev-uninstall.sh    # DEV-ONLY thin shim → exec uninstall.sh
  index.js            # gitignored, esbuild bundle, the actual entry point
settings.example.json # template (NEVER commit a real settings.json)

Read the full file on GitHub · 270 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. 7d ago First seen · 270 lines · 9,021 tokens per session scan B ee3a43d65633

Subscribe to this mod's changes

topgauge CLAUDE.md is an instructions file published in the GitHub repository cwf818/topgauge (2 stars, last pushed 1mo ago), licensed MIT. It adds 9,021 tokens to every session, about $0.0451 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

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens