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

glance

Claude Code 提示词下方的 HUD:一眼查看模型、git、成本、上下文和速率限制条、工具、skill、MCP、代理与 todos。

已翻译

关于这个 mod

English | 简体中文

glance

这是写成 Claude Code mod 的 Claude Code 提示词下 HUD。一眼可以看到模型、分支、会话成本、上下文占用、5 小时与 7 天限制,以及 Claude 当前运行的内容。

❯ █
◆ Opus 5.5 · main ↑1 ●3   $2.63 · ⏱ 16m
ctx █░░░░░░░░░ 14% · 145k/1M   5h █░░░░░░░░░ 8% · 2h21m   7d ░░░░░░░░░░ 2% · 6d21h
◐ Bash npm test   ✓ Read×12 Edit×3 Bash×5
✦ plugin-authoring · simplify   ⧉ Notion×2 Gmail×1
⚙ Explore find the config   2 agents
▸ 3/7 Writing the README
? for shortcuts

需要 Claude Code 2.1.289 或更新版本。 Mods 是可能随版本变化的早期 API。如果更新后 glance 停止绘制,请提交 issue。

Install

在 Claude Code 中:

/plugin marketplace add VibeMage/claude-mod-glance
/plugin install glance@claude-mod-glance

也可以从 shell 安装:

claude plugin marketplace add VibeMage/claude-mod-glance
claude plugin install glance@claude-mod-glance

开始新会话或运行 /reload-plugins 后,glance 会出现在提示词下方。它可以和 claude-hud 这样的 statusLine 并用;如果从一个切换到另一个,请从 ~/.claude/settings.json 移除 statusLine,避免数字显示两次。

What it shows

Header 显示模型(claude-opus-5-5 与 Opus 5.5)、git 分支、ahead/behind、变更文件、会话成本和持续时间。Bars 显示已用 token 的上下文填充及 5h、7d 速率窗口,并在警告阈值变红。Tools 显示当前工具和最常用工具。Skills and MCP 显示本会话载入的 skill 与 MCP 呼叫。Agents 显示运行中的 subagents 和已启动数量。Todos 显示 TodoWrite 或 Task 工具的进度。

加载 glance 时会读取转录,因此加载前使用过的工具、MCP server、skill 和 todo 也会计数。成本是 /cost 报告的 API 列表价估算;Pro 或 Max 订阅的实际账单不同。

What it runs and reads

glance 是一个 TypeScript 模块 hooks/register.tsx,在 mod sandbox 中运行。它没有依赖,不下载内容,不建立网络连接。

  • Runs:在会话开始、每回合后和每 30 秒运行 git status --porcelain=v2 --branch,读取分支、ahead/behind 与变更文件数。
  • Reads:通过 mod API 读取模型、上下文、速率窗口、成本、转录中的工具名称和输入,以及 theme 设置。
  • Observes:观察 tool.call 和 skill.prompt,只记录名称与短标签;调用会原样通过,不阻止或改写。
  • Keeps:只把数据保存在会话 mod 状态中,不写文件、不跨会话储存。
  • Sends:不向外发送任何内容,不对 git 传入固定参数之外的输入。

隐私说明见 Privacy: PRIVACY.md。

Configure

运行 /plugin configure glance@claude-mod-glance,或打开 /config。palette 支持 auto、catppuccin、mocha、macchiato、frappe、latte;barWidth 默认 10,warnAt 默认 85。showGit、showCost、showDuration、showTools、showSkills、showAgents、showTodos 和 keepHint 默认都为 true。keepHint 会保留 Claude Code 自己的提示行(? for shortcuts、esc to interrupt)。

Known limitations

glance 会取代提示词下的 hint line 并以暗色文字重绘,因此会失去原本的颜色。用 keepHint: false 关闭。以 /name 调用的 skill 不会出现在转录工具调用中,只有 glance 已经载入时才会计数。订阅用户在会话首次回报限制后才会看到速率条。

Develop

git clone https://github.com/VibeMage/claude-mod-glance
cd claude-mod-glance
claude --plugin-dir .
claude plugin validate .
claude plugin test .

引擎第一次加载 mod 时,会将 API 类型写入 .claude-plugin/types/ 并生成 tsconfig.json;tsc -p . 随后可以做类型检查。这两者都依赖构建版本并被 git 忽略。

License

MIT

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add VibeMage/claude-mod-glance
claude plugin install glance
原文 / README

English | 简体中文

glance

A HUD under your Claude Code prompt, written as a Claude Code mod. One look tells you the model, the branch, what the session has cost, how full the context is, where your 5-hour and 7-day limits stand, and what Claude is running right now.

❯ █
◆ Opus 5.5 ·  main ↑1 ●3   $2.63 · ⏱ 16m
ctx █░░░░░░░░░ 14% · 145k/1M   5h █░░░░░░░░░ 8% · 2h21m   7d ░░░░░░░░░░ 2% · 6d21h
◐ Bash npm test   ✓ Read×12 Edit×3 Bash×5
✦ plugin-authoring · simplify   ⧉ Notion×2 Gmail×1
⚙ Explore find the config   2 agents
▸ 3/7 Writing the README
? for shortcuts

Requires Claude Code 2.1.289 or newer. Mods are an early-access API that may change between releases. If glance stops drawing after an update, please open an issue.

Install

In Claude Code:

/plugin marketplace add VibeMage/claude-mod-glance
/plugin install glance@claude-mod-glance

Or from a shell:

claude plugin marketplace add VibeMage/claude-mod-glance
claude plugin install glance@claude-mod-glance

Start a new session (or run /reload-plugins) and glance appears under the prompt.

glance runs alongside a statusLine such as claude-hud. If you are switching from one, remove statusLine from ~/.claude/settings.json so you do not see the same figures twice.

What it shows

| Row | Contents | Source | | --- | --- | --- | | Header | Model (claude-opus-5-5 → Opus 5.5), git branch, ahead ↑ / behind ↓, changed files ●, session cost, session duration | $.session.model(), git status --porcelain=v2, $.session.usage() | | Bars | Context fill with tokens used, then each rate-limit window (5h, 7d) with the time until it resets. Each bar has its own colour and turns red at the warning threshold | $.session.usage(), refreshed on session.measure | | Tools | Tools running now (◐) and the session's most-used tools | tool.call | | Skills and MCP | Skills loaded this session, latest first (✦); MCP calls running now (◐) and calls per server (⧉) | skill.prompt, tool.call | | Agents | Subagents running (⚙) and how many the session has started | tool.call on Agent | | Todos | Progress and the item in progress, from TodoWrite or the Task tools | tool.call |

When glance loads (a new session, --resume, or installing it mid-session), it reads the transcript, so the tools, MCP servers, skills and todos used before it loaded are counted too.

The cost is what /cost reports: an estimate at API list prices. On a Pro or Max subscription it is not what you are billed.

What glance runs and reads

glance is a single TypeScript module (hooks/register.tsx) that Claude Code runs in its mod sandbox. It has no dependencies, downloads nothing and opens no network connections. Everything it reads stays on your machine.

  • Runs one program, git, as git status --porcelain=v2 --branch in the session's working directory, when the session starts, after each turn and every 30 seconds, for the branch, ahead/behind and changed-file count.
  • Reads, through the mod API: the session's model, context fill, rate-limit windows and cost ($.session.usage()), the session's transcript ($.session.messages(), only the names and inputs of tool calls, to count tools, MCP servers, skills and todos), and your Claude Code theme setting ($.settings.read(), to pick light or dark colours).
  • Observes tool calls (tool.call) and skill loads (skill.prompt) as they happen, to note the tool's name and a short label and the skill's name. Every call and every skill prompt passes through unchanged; glance never blocks, rewrites or adds to them.
  • Keeps its figures in the session's mod state only. It writes no files and stores nothing across sessions.
  • Sends nothing anywhere: it makes no network calls and passes no data to git, whose only input is the fixed argument list above.

Privacy: PRIVACY.md.

Configure

Run /plugin configure glance@claude-mod-glance, or open /config and find the glance rows. Changes apply immediately.

| Option | Default | What it does | | --- | --- | --- | | palette | auto | auto: Cupertino (iOS system colours), light or dark following your Claude Code theme. catppuccin: Latte or Mocha, chosen the same way. mocha, macchiato, frappe, latte: always that Catppuccin flavor | | barWidth | 10 | Cells in each bar (4–30) | | warnAt | 85 | Percentage at which a bar and its figure turn red | | showGit | true | Branch, ahead/behind, changed files | | showCost | true | Session cost | | showDuration | true | Session duration | | showTools | true | Tools row | | showSkills | true | Skills and MCP row | | showAgents | true | Agents row | | showTodos | true | Todos row | | keepHint | true | Keep Claude Code's own hint line (? for shortcuts, esc to interrupt) under the HUD |

Known limitations

  • glance draws in place of the hint line under the prompt and redraws that hint as plain dim text, so the hint's own colours (for example the auto mode on pill) are lost. Turn the line off with keepHint: false.
  • A skill you invoke as /name is not in the transcript's tool calls, so it is only counted if glance was already loaded when you ran it.
  • Rate-limit bars appear only on a subscription, after the first response of the session reports them.

Develop

git clone https://github.com/VibeMage/claude-mod-glance
cd claude-mod-glance
claude --plugin-dir .          # load it for one session; saving a file reloads it
claude plugin validate .       # what the engine would refuse
claude plugin test .           # tests/*.test.ts against the engine

The engine writes the API's types to .claude-plugin/types/ the first time it loads the mod, along with a tsconfig.json, so tsc -p . type-checks it. Both are build-specific and git-ignored.

License

MIT

其他同名作品

更多类似作品