Skills-transfer-hub/sth-claude/tree/main/mods/sth-usage
關於這個 mod
Buddy · Claude Code
版本 0.3.1。Home 面板底部也會顯示版本。
Buddy 會追蹤 Claude 的上下文和配額、變更的檔案與檢查結果,接著協助你找出適合專案的 STH skills。
軟體原始碼採用 MIT 授權。Buddy 的美術、動畫資料和 STH 品牌標示保留所有權;參見 LICENSE。
常見用法
- Claude 工作時查看上下文和配額使用量,接著在 Context 中檢查作用中的 agent。
- 在 Summary 中檢視變更檔案和觀察到的測試結果,執行已辨識的檢查,並準備稍後恢復工作的草稿。
- 將專案連接到 STH 目錄,安裝相關 skill,並在更新或移除前檢查已安裝版本。
mod 會讀取工作階段和專案資訊,並儲存本機 Resume 摘要。精確的內容、保留時間、外部 CLI 行為和刪除步驟見 Privacy and data handling。需要協助時,請使用 GitHub issues;不要包含秘密或私人專案資料。
從 GitHub 安裝
需要 Claude Code 2.1.287 或更新版本和 Git。在終端機中執行:
claude plugin marketplace add https://github.com/Skills-transfer-hub/sth-claude.git
claude plugin install sth-usage@sth --scope user
在專案中啟動 Claude Code,接著執行 /sth-usage。在已開啟的工作階段中,先執行 /reload-plugins。user scope 會讓 Buddy 在你的所有專案中啟用。STH CLI 只需要用於目錄、安裝和更新操作;不使用它也能追蹤使用量。
更新:
claude plugin marketplace update sth
claude plugin update sth-usage@sth
更新後執行 /reload-plugins 或重新啟動 Claude Code。解除安裝時執行 claude plugin uninstall sth-usage@sth。
載入 mod
需要 Claude Code 2.1.287 或更新版本。從此目錄執行:
claude --plugin-dir .
在已載入這個 mod 的工作階段中,每次儲存都會重新載入模組。沒有外掛的桌面工作階段不會自動取得這些功能。
使用
介面位於右側面板。Home 畫面保留 Buddy,下方是一列導覽:STH、Summary 和 More(Context、Diagnostics、Resume)。STH 頁面管理已安裝的 skills 和目錄。More 會展開 3 個導覽按鈕。其他畫面提供一個 Home 按鈕。導覽會替換目前的面板,不會在上面疊加另一個面板。mod 不會在訊息輸入欄上方新增帶狀區域。
Usage 卡片每項指標只顯示一次:配額和重設時間、上下文、觀察到的 token、費用和 agent。Pill 遵循 STH 設計系統的中性 token:細邊框、Inter 標籤和 JetBrains Mono SVG 數值。原生控制項保留 Claude 規定的字型與尺寸;終端機按鈕採用中性邊框。紅色只用於錯誤。
桌面端的 pill 詳情會在滑鼠停留時出現。倒數每 30 秒重繪一次,但不會要求新的使用量資料。「~」表示從 mod 載入後累積的 token;較早的歷史可能缺少。main 上的面板預覽原始碼展示帶有範例資料的淺色、深色和窄版布局;它不是 Claude 工作階段。
| 入口 | 功能 |
| --- | --- |
| More → Context 或 /sth-context | 上下文拆分:系統、工具、MCP、記憶、訊息和作用中的 agent。 |
| /sth-usage | Buddy、合併後的使用量指標,以及前往其他面板的導覽。 |
| Summary 或 /sth-activity | 實際寫入的檔案、工具錯誤和觀察到的測試。按鈕可以開啟 diff、準備驗證草稿並顯示詳細摘要。已辨識的測試只有在面板中明確要求時才會執行。 |
| STH 或 /sth-skills | 已安裝的 skills、版本和更新;依據專案 manifest 提供目錄建議。 |
| /sth-doctor | 技術堆疊、可用的二進位檔、測試指令、STH 設定和觀察到的 MCP 工具狀態。診斷不會執行測試。 |
| More → Resume 或 /sth-resume | 上一個工作階段的目標、檔案、檢查和下一步。明確加入草稿前先檢查摘要;它不會自動送出。 |
Buddy 會區分進行中、等待權限、錯誤、已完成回合和中斷。一個主要回合持續至少 60 秒時,會在 Claude 中觸發低調通知。
終端機支援圖片時,Buddy 會嘗試顯示原始圖片像素:一般狀態為 384 × 384,Fika 為 720 × 720。原始碼 checkout 會讀取原始 PNG;精簡發布版會從無損壓縮的影格資料重建 RGBA 像素。編碼會保留像素、尺寸和影格順序,播放也保留原有時間。終端機真正拒絕圖片時,會啟用由 96 × 96 姿勢產生的彩色四象限備援圖。這仍是字元畫,細節取決於面板尺寸和終端機字型。在 tmux 下直接使用備援圖。面板會依尺寸調整動畫,空間有限時建議放大。桌面端保留現有的 HD 圖片。
上下文使用 Claude 的 summary 模式在本機估算。mod 不會為追蹤再呼叫模型。未知指標仍不可用;總計費 token 無法表示上下文視窗有多滿。
只有觀察到退出碼時,測試才會標記為通過或失敗。在 Bash 工具不提供該程式碼的版本中,結果仍是未驗證。執行按鈕使用已辨識的專案指令,並顯示實際結果。原生 diff 可能包含目前回合之前產生的變更。
MCP 狀態反映已暴露的工具和觀察到的呼叫,不能證明沒有工具的伺服器已連線。STH 提供版本時才會顯示 skill 版本。更新會跳過固定版本並保護本機變更。更新報告來自新的 STH 狀態檢查;驗證失敗會繼續如實顯示。
本機摘要儲存在工作階段目錄的 .sth/buddy-session.json。它包含縮略目標、最多 40 個路徑和 12 個檢查結果,不包含轉錄或指令輸出。常見秘密會被遮蔽,敏感路徑會被排除。寫入錯誤會顯示在面板中。
安裝 STH
如果找不到 STH 二進位檔,Buddy 會在專案設定前顯示安裝指南。
macOS 或 Linux,使用 Homebrew:
brew install skills-transfer-hub/sth/sth
sth version
Windows,使用 Scoop:
scoop bucket add sth https://github.com/Skills-transfer-hub/scoop-sth
scoop install sth
sth version
Windows 替代方式:winget install STH.STH 或 choco install sth。
沒有套件管理器時,使用官方發布版本,驗證 SHA256SUMS,並將二進位檔加入 PATH。參見 STH 安裝文件。
如有需要,重新啟動終端機,然後使用 Check installation 或 /sth-doctor。STH 可用後,/sth-skills 就能讓你把目錄連接到專案。
驗證 mod
claude plugin validate .
claude plugin test .
測試涵蓋終端機和桌面渲染、按鈕和草稿、缺少資料、權限、摘要與恢復,以及現有的 Buddy 和 Fika 動畫。
發布精簡發行版
使用main 上的原始碼 checkout;精簡發布版不包含建置工具和預覽。先提交原始碼變更和版本提升。建置器需要 Python 3.12、Pillow 12.3.0 和 NumPy 2.3.5。在 mod 的原始碼目錄中執行:
sth_release_dir=$(mktemp -d)
sth_source_root=$(git rev-parse --show-toplevel)
sth_source_commit=$(git rev-parse HEAD)
python3 tools/build_directory_bundle.py --source . --output "$sth_release_dir/bundle" --include-tests
claude plugin validate "$sth_release_dir/bundle/sth-usage"
claude plugin test "$sth_release_dir/bundle/sth-usage"
python3 tools/stage_directory_release.py --source-root "$sth_source_root" --bundle "$sth_release_dir/bundle/sth-usage" --output "$sth_release_dir/tree" --source-commit "$sth_source_commit"
python3 tools/publish_directory_release.py --source-root "$sth_source_root" --tree "$sth_release_dir/tree" --publish
發布器只更新包含精簡外掛、市集、文件和授權聲明的 codex/directory-release。它拒絕舊版本,從不強制推送。省略 --publish 會執行 dry run。原始美術和開發檔案保留在 main。
將 Claude Directory 來源設定為追蹤 codex/directory-release,讓之後的更新檢查看到精簡發布版。Directory 驗證和審查仍獨立於 GitHub 發布。市集使用者可以從 https://github.com/Skills-transfer-hub/sth-claude.git#codex/directory-release 安裝;他們需要在 /plugin → Marketplaces → sth 中另外啟用自動更新。
重建預覽
在main 上的原始碼 checkout中,準備 Node 22 或更新版本,以及本機可用的 STH 設計系統:
node tools/preview_usage_pills.mjs /path/to/design-system
python3 -m http.server 8768 --bind 127.0.0.1 --directory previews/usage-band
開啟本機預覽。STH、Summary 和 More 會在同一個面板中開啟範例檢視;Home 回到使用量總覽並關閉上一個檢視。STH 檢視中的 Installed 和 Catalog 分頁可以操作。預覽中停用安裝、移除、工作階段操作和 dashboard 導覽。
產生器使用 mod 的 SVG 渲染器,並複製原始 Buddy 圖片和設計系統樣式,不修改來源。預覽使用設計系統的 Google Fonts import 及其宣告的本機備援字型。mod 不會在執行時取得這些字型。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add Skills-transfer-hub/sth-claude claude plugin install sth-usage
原文 / README
Buddy · Claude Code
Version 0.3.1. The version is also visible at the bottom of the Home panel.
Buddy tracks Claude context and quotas, changed files and checks, then helps you find STH skills that fit your project.
Software source code is MIT-licensed. Buddy artwork, animation data and STH branding are reserved; see LICENSE.
Typical uses
- Watch context and quota usage while Claude works, then inspect active agents in Context.
- Review changed files and observed test results in Summary, run a recognized check, and prepare a draft to resume the work later.
- Connect a project to an STH catalog, install a relevant skill, and check installed versions before updating or removing it.
The mod reads session and project information and saves a local Resume summary. See Privacy and data handling for the exact contents, retention, external CLI behavior and deletion steps. For help, use GitHub issues; do not include secrets or private project data.
Install from GitHub
Requires Claude Code 2.1.287 or later and Git. Run in your terminal:
claude plugin marketplace add https://github.com/Skills-transfer-hub/sth-claude.git
claude plugin install sth-usage@sth --scope user
Start Claude Code in your project, then run /sth-usage. In an already open session, run /reload-plugins first. The user scope enables Buddy across your projects. The STH CLI is only needed for catalog, installation and update actions; usage tracking works without it.
To update:
claude plugin marketplace update sth
claude plugin update sth-usage@sth
Run /reload-plugins or restart Claude Code after updating. To uninstall, run claude plugin uninstall sth-usage@sth.
See the official mod installation guide and marketplace guide.
Load the mod
Claude Code 2.1.287 or later is required. From this directory:
claude --plugin-dir .
The module reloads on every save in a session that has loaded it. Desktop sessions without the plugin do not receive these features automatically.
Usage
The interface lives in the right panel. The home screen keeps Buddy, followed by a single navigation row: STH, Summary and More (Context, Diagnostics and Resume). The STH page manages installed skills and the catalog. More expands three navigation buttons. Other screens provide a single Home button. Navigation replaces the current panel instead of stacking another panel on top. The mod does not add a strip above the message field.
The Usage card shows each metric once: quotas and reset times, context, observed tokens, cost and agents. Pills follow the STH design system's neutral tokens: thin outlines, Inter labels and JetBrains Mono SVG values. Native controls keep the fonts and dimensions imposed by Claude; terminal buttons have neutral outlines. Red is reserved for errors.
Desktop pill details appear on hover. The countdown redraws every 30 seconds without requesting new usage data. “~” marks tokens accumulated since the mod loaded; earlier history may be missing. The panel preview source on main shows light, dark and narrow layouts with sample data; it is not a Claude session.
| Access | Function |
| --- | --- |
| More → Context or /sth-context | Context breakdown: system, tools, MCP, memory, messages and active agents. |
| /sth-usage | Buddy, combined usage metrics and navigation to the other panels. |
| Summary or /sth-activity | Files actually written, tool errors and observed tests. Buttons open the diff, prepare a verification draft and show the detailed summary. Recognized tests run only when explicitly requested in the panel. |
| STH or /sth-skills | Installed skills, versions and updates; catalog recommendations based on project manifests. |
| /sth-doctor | Stack, available binaries, test commands, STH configuration and observed MCP tool status. Diagnostics do not run tests. |
| More → Resume or /sth-resume | Goal, files, checks and next step from the previous session. Inspect the summary before explicitly adding it to the draft; it is not sent automatically. |
Buddy distinguishes work in progress, pending permission, errors, completed turns and interruptions. A main turn lasting at least 60 seconds triggers a discreet notification in Claude.
Buddy tries to display the original image pixels when the terminal supports images: 384 × 384 for regular states and 720 × 720 for Fika. Source checkouts read the original PNGs; compact releases reconstruct their RGBA pixels from lossless compressed frame data. The encoding preserves the pixels, dimensions and frame sequence, and playback keeps its existing timing. An actual image rejection from the terminal enables a colored quadrant fallback generated from 96 × 96 poses. This remains a character-based drawing: its detail depends on the panel size and terminal font. Under tmux, the fallback is used directly. The panel adapts the animation to its size and suggests enlarging it when space is limited. Desktop keeps the existing HD images.
Context is estimated locally using Claude's summary mode. The mod does not call an additional model for tracking. Unknown metrics remain unavailable; cumulative billed tokens do not indicate how full the context window is.
Tests are marked as passed or failed only when an exit code has been observed. In versions where the Bash tool does not provide that code, the result remains unverified. The run button uses a recognized project command and displays its actual result. The native diff may include changes made before the current turn.
MCP status reflects exposed tools and observed calls. It does not prove that a server with no tools is connected. Skill versions are displayed when STH provides them. Updates skip pinned versions and protect local changes. The update report comes from a fresh STH status check; a failed verification remains visible as such.
The local summary is stored in .sth/buddy-session.json in the session directory. It contains an abbreviated goal, up to 40 paths and 12 check results, without a transcript or command output. Common secrets are masked and sensitive paths are excluded. Write errors appear in the panel.
Install STH
If the STH binary is missing, Buddy shows the installation guide before project setup.
macOS or Linux with Homebrew:
brew install skills-transfer-hub/sth/sth
sth version
Windows with Scoop:
scoop bucket add sth https://github.com/Skills-transfer-hub/scoop-sth
scoop install sth
sth version
Windows alternatives: winget install STH.STH or choco install sth.
Without a package manager, use the official releases, verify SHA256SUMS and add the binary to PATH. See the STH installation documentation.
Restart the terminal if needed, then use Check installation or /sth-doctor. Once STH is available, /sth-skills lets you connect a catalog to the project.
Validate the mod
claude plugin validate .
claude plugin test .
Tests cover terminal and desktop rendering, buttons and drafts, missing data, permissions, summaries and resume, plus the existing Buddy and Fika animations.
Publish a compact distribution
Use a checkout of the source on main; compact releases omit build tools and previews. Commit the source changes and version bump first. The builder needs Python 3.12, Pillow 12.3.0 and NumPy 2.3.5. From the mod's source directory:
sth_release_dir=$(mktemp -d)
sth_source_root=$(git rev-parse --show-toplevel)
sth_source_commit=$(git rev-parse HEAD)
python3 tools/build_directory_bundle.py --source . --output "$sth_release_dir/bundle" --include-tests
claude plugin validate "$sth_release_dir/bundle/sth-usage"
claude plugin test "$sth_release_dir/bundle/sth-usage"
python3 tools/stage_directory_release.py --source-root "$sth_source_root" --bundle "$sth_release_dir/bundle/sth-usage" --output "$sth_release_dir/tree" --source-commit "$sth_source_commit"
python3 tools/publish_directory_release.py --source-root "$sth_source_root" --tree "$sth_release_dir/tree" --publish
The publisher updates only codex/directory-release, which contains the compact plugin, marketplace, documentation and licensing notices. It refuses older versions and never force-pushes. Omitting --publish performs a dry run. Original artwork and development files remain on main.
Configure the Claude Directory source to follow codex/directory-release so future update checks see compact releases. Directory validation and review remain separate from GitHub publication. Marketplace users can install from https://github.com/Skills-transfer-hub/sth-claude.git#codex/directory-release; they enable automatic updates separately in /plugin → Marketplaces → sth.
Rebuild the preview
From the source checkout on main, with Node 22 or later and the STH design system available locally:
node tools/preview_usage_pills.mjs /path/to/design-system
python3 -m http.server 8768 --bind 127.0.0.1 --directory previews/usage-band
Open the local preview. STH, Summary and More open sample views in the same panel; Home returns to the usage overview and closes the previous view. The STH view has working Installed and Catalog tabs. Installation, removal, session actions and dashboard navigation are disabled in the preview.
The generator uses the mod's SVG renderer and copies the original Buddy image and design system styles without modifying their sources. The preview uses the design system's Google Fonts import, with its declared local fallbacks. The mod does not fetch these fonts at runtime.
