MridulNegi2005/glyph-hud
glyph-hud
Claude Code 的點陣 HUD 外掛,依模型顯示聊天 token、成本、上下文填充量、5 小時限制估算、快取計時器和程式統計,全部在本機執行,不呼叫模型。
關於這個 mod
Glyph HUD 是一個 Claude Code 外掛,會在受 Nothing 裝置啟發的單色點陣面板中顯示目前聊天的 token 用量。它不會呼叫模型,也不會向任何伺服器傳送資料,只讀取本機檔案以及 Claude Code 已經提供的資料。
面板會在工作階段開始時開啟(也可以透過 /glyph 開啟),顯示聊天 token 總數、成本、上下文填充量、請求次數、token 類型(輸入、快取寫入、快取讀取、輸出)、各模型的 token 分解、冷快取請求的預估 5 小時用量限制成本,以及程式統計(工具呼叫、常用工具、編輯、檔案、變更行數、Bash 錯誤、最長一輪)。
提示列下方的狀態列會彙整 token、成本、5 小時限制中的冷快取占比,以及提示快取到期前的時間(暖/冷指示器);輸入時還會顯示草稿大小。
計數會讀取工作階段記錄和子代理程式記錄,每次請求都重設快取計時器,並根據用量百分比變化進行校準,透過加權 token 類型估算 5 小時限制的消耗。文件記錄了已知限制,包括未公開的 Anthropic 權重,以及並行聊天造成的干擾。blockAttribution 設定可以拒絕包含 Co-Authored-By trailer 的 git 提交。
需要 Claude Code 2.1.286+,並且當記錄超過 4 MB 時,PATH 中需要有 Python 3。透過 /plugin marketplace add MridulNegi2005/glyph-hud 後執行 /plugin install glyph-hud@glyph-hud 安裝,也可以使用 claude --plugin-dir 從本機載入。授權條款為 MIT。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add MridulNegi2005/glyph-hud claude plugin install glyph-hud
原文 / README
Glyph HUD
Glyph HUD is a plugin for Claude Code. It shows the token use of the current chat in a dot-matrix pane. The design follows the monochrome dot-matrix style of Nothing devices.
The plugin makes no model calls. It reads local files and the figures that Claude Code already has. It sends no data to any server.
<img src="docs/pane.png" alt="The Glyph pane in the Claude Code desktop app" width="320">What the plugin shows
The pane
The pane opens at the start of each session. The /glyph command opens it again.
- Chat tokens. The total tokens of the current chat, in large dot-matrix digits.
- Cost and context. The cost in US dollars, the context fill as a percentage, and the number of requests.
- Token types. Input, cache-write, cache-read and output tokens.
- Tokens by model. One row for each model in the chat. Each row shows the total, the share as a dot bar, and the four token types.
- Cold cache call. The estimated part of the 5-hour usage limit that one request with a cold cache uses.
- Code stats. Tool calls, the most frequent tools, edits, files, changed lines, Bash errors and the longest turn.
The status line
The status line under the prompt shows a short summary:
◉ 5.14M tok · $2.95 · cold ≈ 3.1% of 5h · cache 52:10
cache 52:10is the time until the prompt cache expires. The valuecache ● warmshows during a turn. The valuecache ○ coldshows after the cache expires.- While you type a message, the line starts with
✎. It shows the approximate size of the draft and the estimated part of the 5-hour limit that the message uses.
In the terminal
The desktop app shows the pane as an image. The terminal shows the same data as text, with ● and · characters for the dots.
- In the fullscreen layout, the pane opens beside the transcript at the start of a session. The terminal must be 144 columns or wider.
- In a narrower terminal, use the
/glyphcommand to open the pane. - The status line is the same in the terminal and in the desktop app.
How the plugin counts
Chat tokens
The plugin reads the transcript file of the chat and the transcript files of its subagents. Each response row records the model and the token use. The plugin counts each response one time.
The count includes the full chat, also the part before the plugin loaded. Requests that the transcript does not record are not in the count. An example is a compaction summary.
The cache timer
Each request resets the lifetime of the prompt cache. The plugin reads the time of the last response and the cache lifetime from the transcript. The lifetime is 1 hour or 5 minutes.
The 5-hour limit estimate
After each response, the plugin reads the 5-hour usage percentage. It uses only changes between two responses less than 90 seconds apart. This step keeps the effect of other chats small.
The plugin sets a weight for each token type:
| Token type | Weight | |---|---| | Input | 1 | | Output | 5 | | Cache read | 0.1 | | Cache write, 1-hour lifetime | 2 | | Cache write, 5-minute lifetime | 1.25 |
The plugin divides the change in percentage by the weighted tokens of the last 60 requests. A request with a cold cache writes the full context again. The estimate is this rate multiplied by the context size and the cache-write weight.
The estimate shows "calibrating" until the percentage has moved by 0.3 points.
The pane also shows the last cold request: the percentage before and after the request, and the age of the "before" reading. Other chats can change the percentage during that time.
Limits of the estimates
- Anthropic does not publish how each token type counts against the usage limit. The weights come from the API prices.
- The plugin gives all models the same weight.
- Other chats that run at the same time can make the estimate too high.
- The draft size uses about 4 characters for each token. It is not an exact count.
Settings
| Setting | Default | Effect |
|---|---|---|
| blockAttribution | false | Denies git commit commands that contain a Co-Authored-By trailer. |
Change the setting in the /config menu.
Requirements
- Claude Code 2.1.286 or newer. The plugin API is early access. A later release can change it.
- Python 3 on the
PATHfor transcripts larger than 4 MB. The plugin reads smaller transcripts without Python.
Install
-
Add the marketplace in Claude Code:
/plugin marketplace add MridulNegi2005/glyph-hud -
Install the plugin:
/plugin install glyph-hud@glyph-hud
To load the plugin from a local folder, start Claude Code with this flag:
claude --plugin-dir path/to/glyph-hud
License
MIT. See LICENSE.
