ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 Skills-transfer-hub

sth-usage

Buddy:上下文、session 摘要与恢复、项目诊断、STH skills 和 fika 休息

Skills-transfer-hub@Skills-transfer-hub

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 会读取 session 和项目资料,并保存本地 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。在已经打开的 session 中,先运行 /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 安装指南 和 市集指南。

加载 mod

需要 Claude Code 2.1.287 或更高版本。从此目录运行:

claude --plugin-dir .

在已加载该 mod 的 session 中,每次保存都会重新加载模块。没有插件的桌面 session 不会自动获得这些功能。

使用

界面位于右侧面板。Home 画面保留 Buddy,下方是一行导航:STH、Summary 和 More(Context、Diagnostics、Resume)。STH 页面管理已安装的 skills 和目录。More 会展开三个导航按钮。其他画面提供一个 Home 按钮。导航会替换当前面板,不会在上面再叠一层。mod 不会在消息输入框上方新增带状区域。

Usage 卡片每项指标只显示一次:配额和重置时间、上下文、观察到的 token、费用和 agent。Pill 遵循 STH 设计系统的中性 token:细边框、Inter 标签和 JetBrains Mono SVG 数值。原生控件保留 Claude 要求的字体与尺寸;终端按钮使用中性边框。红色只用于错误。

桌面端的 pill 详情会在悬停时出现。倒计时每 30 秒重绘一次,但不会请求新的用量数据。“~” 表示从 mod 加载后累积的 token;更早的历史可能缺失。main 上的面板预览源代码展示了带示例数据的浅色、深色和窄版布局;它不是 Claude session。

| 入口 | 功能 | | --- | --- | | 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 | 上一个 session 的目标、文件、检查和下一步。明确把摘要加入草稿前请先检查;它不会自动发送。 |

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 status 检查;验证失败会继续如实显示。

本地摘要存储在 session 目录的 .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 标签可以操作。预览中禁用安装、删除、session 操作和 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.

更多类似作品