oaustegard/claude-code-mods/tree/main/usage-dollars
usage-dollars
세션별 비용을 일일 원장에 기록하고 상태 표시줄에 오늘과 현재 월 지출을 월간 예산과 함께 보여 주는 Claude Code 플러그인입니다. 80%/100% 토스트와 /spend 명령도 제공합니다.
이 mod 소개
usage-dollars는 달러 단위 지출을 추적하는 Claude Code 플러그인입니다. 각 세션의 비용($.session.usage().cost.usd, /cost가 합산하는 값)은 플러그인 저장소의 일일 원장에 기록되며 컴퓨터의 모든 세션에서 공유됩니다. 상태 표시줄에는 「$1.20 today · $34.10/$100.00 month (34%)」와 같은 내용이 표시되고, 예산의 80%와 100%에 도달하면 각각 한 번씩 토스트가 나타납니다. /spend는 같은 수치와 남은 금액을 출력합니다. 대화별 지출은 기본 도넛 차트 버튼에 맡깁니다. 예산은 설정 메뉴의 monthlyBudgetUsd로 구성할 수 있습니다(기본값 100, 0이면 숨김). 원장은 이 mod를 처음 불러온 시점부터 시작하므로 이전 지출은 계산하지 않으며, 재개한 세션의 과거 비용도 다시 기록하지 않습니다. .claude-plugin/plugin.json, 모듈을 지정하는 hooks/hooks.json, 모듈 자체(hooks/register.ts, hooks/ledger.ts)가 들어 있는 mod 폴더로 제공됩니다. ~/.claude/settings.json의 env 블록에서 CLAUDE_CODE_PLUGIN_DIRS로 폴더를 지정하면 활성화되며(사용자 설정만 읽음), 변경 사항은 claude plugin validate로 검증합니다. hook API는 얼리 액세스로 표시되어 릴리스마다 바뀔 수 있습니다.
설치
먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.
claude plugin marketplace add oaustegard/claude-code-mods claude plugin install usage-dollars
원문 / README
claude-code-mods
Plugins for Claude Code that run code around the agent's tool calls: they can block a call before it runs, add a note to its result, or put a message in front of the person. They work in the terminal and in the desktop app's Code tab. Each folder is one plugin.
| Mod | What it does |
|---|---|
| tripwire | Blocks or annotates shell mistakes that recur in Claude Code sessions: whole-disk find, long foreground sleep loops, errors hidden by \| tail, forgotten background shells |
| usage-dollars | Spend in dollars for today and the month so far against a monthly budget: status line, toast at 80% and 100%, /spend |
The hook API these mods use is marked early access in Claude Code's own type declarations and can change between releases. Those declarations were written by Claude Code 2.1.286, the version tripwire was developed against.
Layout
A mod folder holds .claude-plugin/plugin.json, hooks/hooks.json naming one module, the module itself, and types/index.d.ts when the mod keeps state. Claude Code generates .claude-plugin/types/ the first time it loads a mod, so that directory is not in the repo.
Enabling
List each mod folder, :-separated, in the env block of ~/.claude/settings.json. Claude Code reads this variable only from user settings, never from a project's:
"env": { "CLAUDE_CODE_PLUGIN_DIRS": "/path/to/claude-code-mods/tripwire" }
Interactive sessions watch the folder and reload on save. To check a change before committing it:
claude plugin validate tripwire
tripwire
Tripwire was built from 17 local session transcripts: 546 Bash calls. Each rule below answers a mistake that appears in them more than once. A rule can block a call before it runs, add a note the model reads after the result, or show the person a toast or a status line.
| Rule | Kind | Evidence (replayed on the transcripts) |
|---|---|---|
| find over /, ~, $HOME or /Users/<name> with no -maxdepth | block | 5 calls, each moved to the background automatically and left running past the end of the task |
| foreground loop whose sleep totals more than 120s (an unbounded while/until with sleep ≥ 5 counts; timeout N caps the total) | block | 35 calls; the person's reaction to one: "what on earth is taking so long?" |
| error text in output whose pipeline ends in tail/head and exits 0 | note | 20 of 233 such calls |
| zsh glob abort, macOS has no timeout, gh pr create without --head, gh pr view --json merged | note | one fix line each |
| background shells still open | status line, plus a toast at turn end | "what are the 5 shells that are open still doing?" |
| foreground call running longer than 5 minutes | status line, then a toast | a 51-minute foreground Agent call |
The replay applies the same patterns the rules use to the Bash calls in those transcripts. The counts describe one person's sessions, so another machine will see different numbers.
# tripwire:allow in a command lets a block through when the person asked for exactly that. /tripwire lists the counts for the current session and for all sessions (kept in the plugin store) and the open background tasks. The counts show whether a rule still fires, and a rule that never trips is a candidate for deletion.
usage-dollars
Books each session's cost ($.session.usage().cost.usd, what /cost totals) into a per-day ledger in the plugin store, shared by every session on the machine. The status line shows $1.20 today · $34.10/$100.00 month (34%), a toast fires once at 80% and once at 100% of the budget, and /spend prints the same figures plus what remains. Per-conversation spend is not shown: the default donut chart button covers it.
Set the budget in the config menu (monthlyBudgetUsd, default 100, 0 hides it). The ledger starts when the mod is first loaded, so earlier spend is not counted, and a resumed session's past cost is not re-booked.

