dukechain2333/starfleet-panel/tree/main/plugin
关于这个 mod
starfleet-panel
适用于 Claude Code 的 LCARS 状态面板。 通常位于提示符下方的读数(模型、推理力度、上下文窗口、速率限制、目录、git 分支)会以《The Next Generation》中的操作控制台形式绘制:两端带弯角,标题栏按每项读数切成不同的彩色区段,标签位于区段下方,数值位于标签下方。它适合与 red-alert 并排使用。red-alert 发出警报声时,面板也会一起进入 RED ALERT。
- LCARS 风格,一眼看全。 模型和推理力度(显示为曲速因子)、上下文窗口和 5 小时上限的分段仪表、7 天上限、每次重置的倒计时、git 分支和工作目录,以及星历。
- 为 red-alert 打造。 它会显示 red-alert 的状态(绿色、静音、离线)。警报持续期间,整个边框会改用警报红色,并在 red-alert 播放警报声的整个动画期间闪烁。两个 mod 不会触碰彼此的屏幕空间、按键、命令或状态。
- 适应任何宽度。 各列会分摊可用宽度。终端变窄时,仪表先缩小,接着移除最不重要的列;低于 64 列时,边框会变成单行条带。宽终端还会显示 ENV、ENERGY 和 CREW 列。
- 本地且免费。 它不会发起模型调用,也不会发送网络请求。所有数字都来自状态行使用的同一份进程内数据。
读数
每个读数都有一个 Starfleet 名称和一个普通名称,你可以选择面板使用哪一种:/lcars plain 或 /lcars starfleet(会保存设置,就像 /config 中的 Terminology 行)。普通名称会像一般状态行一样显示:日期而不是星历、CONTEXT 42% used、5H LIMIT 72% left、ALERTS ONLINE。
| Starfleet 名称 | 普通名称 | 显示内容 | | --- | --- | --- | | STANDBY / ENGAGED | IDLE / WORKING | 侧栏上方区块:Claude 是否正在工作 | | stardate | date(OCT 02) | 侧栏下方区块;星历是 TNG 的播报计时:节目在 1987 年开始时为 41000,每年增加一千个单位 | | HELM | MODEL | 模型(OPUS 5.5)和以曲速因子表示的推理力度:低为 IMPULSE,中为 WARP 5,高为 WARP 7,xhigh 为 WARP 9,max 为 WARP 9.6 | | CORE | CONTEXT | 已使用的上下文窗口(42%;普通名称为 42% used),以及分段仪表 | | DILITHIUM | 5H LIMIT | 5 小时上限:剩余多少(普通名称为 72% left)、仪表,以及距离重置的时间(T-2H14M;普通名称为 reset 2h14m) | | ANTIMATTER | 7D LIMIT | 7 天上限:剩余多少以及距离重置的时间 | | COURSE / SECTOR | GIT / DIR | git 分支(分离状态时为 @<sha>)位于工作目录上方;主目录显示为 ~;在储存库外显示 SECTOR | | ENV | ENV | 活跃的 conda 环境(不是 base)或 virtualenv,在宽终端上显示 | | ENERGY | COST | 工作阶 session 的成本,在宽终端上显示(默认关闭) | | CREW | USER | user@host,在宽终端上显示(可以关闭) | | CONDITION | ALERTS | 末端区块:red-alert 的状态、GREEN(普通名称为 ONLINE)、MUTED、OFFLINE 或当前警报;没有 red-alert 时,在时钟上方显示 SHIP TIME(普通名称为 TIME) |
读数在使用量达到 60% 时变黄,达到 80% 时变红。这些是面板所取代的经典 statusLine 脚本使用的阈值。5 小时和 7 天上限会在 Claude Code 取得相应读数后显示:使用 Pro 或 Max 订阅时,会在第一次回应之后出现。
与 red-alert 一起使用
安装两者后,它们会共用一套控制台:red-alert 位于提示符上方的色带,本面板位于下方,使用同一套 LCARS 调色盘。
| red-alert 的状态 | 面板 | | --- | --- | | online | 末端区块显示 CONDITION / GREEN | | muted | CONDITION / MUTED | | offline | CONDITION / OFFLINE | | 有警报正在响起 | 整个边框变成警报红色,末端区块显示 RED ALERT(或该等级的标题) | | 红色或黄色警报正在播放动画 | 状态区块和末端区块随警报声闪烁,之后保持稳定,直到你静音或关闭警报(0,red-alert 的按键) | | 未安装 | 末端区块保持 SHIP TIME;其他功能不变 |
两个 mod 不会冲突,因为它们只绘制、绑定和储存各自拥有的内容:
| | red-alert | starfleet-panel | | --- | --- | --- | | 绘制 | 提示符上方的色带、/alert 控制台、其工具的行 | 提示符下方的提示行,除此之外没有其他内容 | | 命令 | /alert | /lcars | | 工具和系统提示词 | alert 工具与简短的警报政策 | 无 | | 按键 | 0 静音;色带项目使用 ctrl+x tab | 无:没有按钮,也没有快捷键 | | 状态 | 自己的状态 | 自己的状态;读取 red-alert 的 link 和 active,从不写入 |
red-alert 记录新警报的瞬间,面板就会得知。它通过 red-alert 状态上的只观察钩子来完成,钩子会把每个值原样传递,就像 red-alert 写入时一样。将 followRedAlert 设为 false 即可完全忽略 red-alert。
安装
git clone https://github.com/dukechain2333/starfleet-panel.git
cd starfleet-panel
./install.sh
这会把 mod 复制到 ~/.claude/skills/starfleet-panel。启动新的 Claude Code 工作阶 session,它会以 starfleet-panel@skills-dir 加载。开发时可以使用 ./install.sh --link,将储存库直接建立符号链接;使用 ./uninstall.sh 移除它。
该储存库同时也是一个插件 marketplace:
claude plugin marketplace add dukechain2333/starfleet-panel
claude plugin install starfleet-panel@starfleet-panel
退出使用你的 statusLine 命令。 如果 ~/.claude/settings.json 中有 statusLine 项目,它会继续绘制在面板上方,你会看到同一组数字两次。移除该项目,让面板接管。面板会提醒你一次,安装程序也会提醒你,设置了该项目时 /lcars 还会提到它。
要求:支持 mod 的 Claude Code(function-hook 插件;在 2.1.288 上构建并测试),以及支持真彩色和等宽字体的终端,字体还要包含区块字符(??? ???)。任何现代终端字体都可以。
使用
面板不需要你做任何事。它每 2 秒刷新上下文窗口和上限;每一轮之后以及每 30 秒重新读取目录、分支、环境和设置。
- 布局: bridge,三行操作控制台(默认);compact,采用 red-alert 闲置条带风格的单行;off,只显示 Claude Code 自己的提示行。在窄于 64 列的终端以及桌面应用中,bridge 会退回 compact。
- /lcars 输出完整状态报告。每项读数旁边都会列出其 Starfleet 名称代表的含义,所以它也能作为图例:
LCARS STATUS REPORT 繚 STARDATE 80753.1 繚 22:32
HELM (model, effort) OPUS 5.5 繚 xhigh effort (warp 9)
CORE (context window) 4% used 繚 43K of 1M tokens
DILITHIUM (5-hour limit) 95% left 繚 resets in 4h18m
ANTIMATTER (7-day limit) 63% left 繚 resets in 4h28m
ENERGY (session cost) $0.35
SECTOR (working directory) ~/starfleet_panel
COURSE (git branch) main
ENV (python env) none
CONDITION (red-alert) condition green
- /lcars plain | starfleet 切换名称,并为新的工作阶 session 保留选择。
- /lcars bridge | compact | off 切换本次工作阶 session 的布局。/lcars reset 恢复设置。
设置
在 /config 中设置这些选项(也可以使用 claude plugin configure starfleet-panel):
| 设置 | 默认值 | | | --- | --- | --- | | layout | bridge | bridge、compact 或 off | | labels(Terminology) | starfleet | starfleet(HELM、CORE、DILITHIUM、stardate)或 plain(MODEL、CONTEXT、5H LIMIT、date);/lcars plain 和 /lcars starfleet 也会设置它 | | showCost | false | 在宽终端上加入 ENERGY 列(工作阶 session 的成本) | | showUserHost | true | 在宽终端上加入 CREW 列(user@host) | | followRedAlert | true | 显示 red-alert 的状态,并随其警报重新绘制 | | refreshSeconds | 2 | 重新读取上下文窗口和上限的间隔 |
工作原理
mod 绘制 Claude Code 的 PromptHint 区域,也就是提示符下方的提示行。它会将自己的行与引擎的行一起返回,因此 mode pill(?菊 auto mode on)以及 esc to interrupt 之类的提示仍会在边框上方保持活动。数字来自 $.session.usage() 和 $.session.model(),这两个都是免费的进程内调用。推理力度是每个主循环请求实际发送时使用的值,由只观察 turn.step 钩子记录,不会触碰回应串流。第一次请求前,推理力度来自你的设置。
开发
claude plugin validate plugin # manifest and hooks, as the engine reads them
claude plugin test plugin # the tests: layouts, red-alert states, /lcars
claude --plugin-dir plugin # try it; saving a file reloads it
npx -p typescript tsc -p plugin # type-check, once a session has loaded the mod
# (it lays the types in plugin/.claude-plugin/types)
布局:plugin/hooks/register.tsx(钩子、传感器、绘制)、plugin/hooks/panel.ts(布局和报告)、plugin/hooks/lcars.ts(调色盘和行适配)、plugin/hooks/readouts.ts(星历、曲速因子、仪表、单元格宽度)、plugin/types/index.d.ts(状态契约)、plugin/tests/。
docs/preview.svg 来自真实工作阶 session。使用 tmux capture-pane -e -p -t <session> > capture.ans 捕获,再使用 python3 docs/ansi2svg.py capture.ans docs/preview.svg --rows <first>-<last> 转换。
致谢
面板借用了 LCARS 的外观;LCARS 是 Michael Okuda 为《Star Trek: The Next Generation》设计的电脑界面。这是非官方粉丝项目。Star Trek 及其标志归各自所有者所有。
授权
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add dukechain2333/starfleet-panel claude plugin install starfleet-panel
原文 / README
starfleet-panel
An LCARS status panel for Claude Code. The readouts that usually sit under the prompt (model, effort, context window, rate limits, directory, git branch) are drawn as an ops console from The Next Generation: elbows at both ends, a header bar cut into one colored segment per readout, the labels under their segments and the values under the labels. It's built to sit beside red-alert. When red-alert sounds the klaxon, the panel goes to RED ALERT with it.
- Everything at a glance, LCARS style. Model and effort (as a warp factor), segmented meters for the context window and the 5-hour limit, the 7-day limit, countdowns to each reset, the git branch and working directory, and the stardate.
- Made for red-alert. It shows red-alert's condition (green, muted, offline). While an alert is up, it repaints the whole frame in the alert's reds and blinks with red-alert's klaxon for as long as it animates. The two mods never touch each other's screen space, keys, commands or state.
- Fits any width. The columns share the width out. As the terminal narrows, the meters shrink first, then the least important columns go, and below 64 columns the frame becomes a one-row strip. Wide terminals gain the ENV, ENERGY and CREW columns.
- Local and free. It makes no model calls and no network requests. The figures come from the same in-process data the status line uses.
The readouts
Every readout has a Starfleet name and a plain one, and you pick which the
panel uses: /lcars plain or /lcars starfleet (saved, like the
Terminology row in /config). The plain terms read as an ordinary status
line: the date instead of the stardate, CONTEXT 42% used,
5H LIMIT 72% left, ALERTS ONLINE.
| Starfleet term | Plain term | What it shows |
| --- | --- | --- |
| STANDBY / ENGAGED | IDLE / WORKING | the sidebar's upper block: whether Claude is working |
| stardate | date (OCT 02) | the sidebar's lower block; the stardate is TNG's broadcast reckoning: 41000 when the show began in 1987, a thousand units a year |
| HELM | MODEL | the model (OPUS 5.5) and reasoning effort as a warp factor: low IMPULSE, medium WARP 5, high WARP 7, xhigh WARP 9, max WARP 9.6 |
| CORE | CONTEXT | context window used (42%; plain 42% used), with a segmented meter |
| DILITHIUM | 5H LIMIT | the 5-hour limit: how much is left (plain 72% left), a meter, and the time to the reset (T-2H14M; plain reset 2h14m) |
| ANTIMATTER | 7D LIMIT | the 7-day limit: how much is left and the time to the reset |
| COURSE / SECTOR | GIT / DIR | the git branch (or @<sha> when detached) over the working directory, ~ for home; SECTOR outside a repository |
| ENV | ENV | the active conda env (not base) or virtualenv, on wide terminals |
| ENERGY | COST | the session's cost, on wide terminals (off by default) |
| CREW | USER | user@host, on wide terminals (can be turned off) |
| CONDITION | ALERTS | the end block: red-alert's state, GREEN (plain ONLINE), MUTED, OFFLINE or the alert; without red-alert, SHIP TIME (plain TIME) over the clock |
Readings turn yellow at 60% used and red at 80%. These are the thresholds of
the classic statusLine script the panel replaces. The 5-hour and 7-day
limits appear once Claude Code has a reading for them: on a Pro or Max
subscription, after the first response.
With red-alert
Install both and they share one console: red-alert's band above the prompt and this panel below it, in the same LCARS palette.
| red-alert's state | The panel |
| --- | --- |
| online | the end block reads CONDITION / GREEN |
| muted | CONDITION / MUTED |
| offline | CONDITION / OFFLINE |
| an alert is up | the whole frame turns the alert's reds and the end block reads RED ALERT (or the level's title) |
| a red or yellow alert animating | the state block and the end block blink with the klaxon, then hold steady until you silence or dismiss the alert (0, red-alert's key) |
| not installed | the end block keeps SHIP TIME; everything else works the same |
The mods don't conflict because each one draws, binds and stores only what it owns:
| | red-alert | starfleet-panel |
| --- | --- | --- |
| Draws | the band above the prompt, the /alert console, its tool's row | the hint line under the prompt, nothing else |
| Command | /alert | /lcars |
| Tools and system prompt | the alert tool and a short alert policy | none |
| Keys | 0 silences; band items via ctrl+x tab | none: no buttons, no hotkeys |
| State | its own | its own; reads red-alert's link and active, never writes them |
The panel learns of a new alert the moment red-alert records it. It does this
with an observe-only hook on red-alert's state, which passes every value
through exactly as red-alert wrote it. Set followRedAlert to false to
ignore red-alert altogether.
Install
git clone https://github.com/dukechain2333/starfleet-panel.git
cd starfleet-panel
./install.sh
This copies the mod to ~/.claude/skills/starfleet-panel. Start a new
Claude Code session and it loads as starfleet-panel@skills-dir. Use
./install.sh --link to symlink the checkout instead while you work on it,
and ./uninstall.sh to remove it.
The repository is also a plugin marketplace:
claude plugin marketplace add dukechain2333/starfleet-panel
claude plugin install starfleet-panel@starfleet-panel
Retire your statusLine command. If ~/.claude/settings.json has a
statusLine entry, its line keeps drawing above the panel and you see the
same figures twice. Remove the entry to let the panel take over. The panel
tells you once, the installer reminds you, and /lcars mentions it while
one is set.
Requirements: Claude Code with mod support (function-hook plugins; built and
tested on 2.1.288), and a terminal with true color and a monospace font that
has the block elements (▄ ▀ ▌ ▗). Any modern terminal font does.
Using it
The panel needs nothing from you. It refreshes the context window and limits every 2 seconds. It re-reads the directory, branch, env and settings after every turn and every 30 seconds.
-
Layouts:
bridge, the three-row ops console (the default);compact, one row in the style of red-alert's idle strip;off, only Claude Code's own hint line. Bridge falls back to compact on terminals narrower than 64 columns and in the desktop app. -
/lcarsprints a full status report. It lists every reading beside what its Starfleet name stands for, which makes it a legend too:LCARS STATUS REPORT · STARDATE 80753.1 · 22:32 HELM (model, effort) OPUS 5.5 · xhigh effort (warp 9) CORE (context window) 4% used · 43K of 1M tokens DILITHIUM (5-hour limit) 95% left · resets in 4h18m ANTIMATTER (7-day limit) 63% left · resets in 4h28m ENERGY (session cost) $0.35 SECTOR (working directory) ~/starfleet_panel COURSE (git branch) main ENV (python env) none CONDITION (red-alert) condition green -
/lcars plain | starfleetswitches the terms, and keeps the choice for new sessions. -
/lcars bridge | compact | offswitches the layout for this session./lcars resetgoes back to the setting.
Settings
Set these in /config (or claude plugin configure starfleet-panel):
| Setting | Default | |
| --- | --- | --- |
| layout | bridge | bridge, compact or off |
| labels (Terminology) | starfleet | starfleet (HELM, CORE, DILITHIUM, stardate…) or plain (MODEL, CONTEXT, 5H LIMIT, date…); /lcars plain and /lcars starfleet set it too |
| showCost | false | add the ENERGY column (the session's cost) on wide terminals |
| showUserHost | true | add the CREW column (user@host) on wide terminals |
| followRedAlert | true | show red-alert's condition and repaint with its alerts |
| refreshSeconds | 2 | how often the context window and limits are re-read |
How it works
The mod draws Claude Code's PromptHint site, the hint line under the
prompt. It returns its own rows together with the engine's line, so the mode
pill (⏵⏵ auto mode on) and hints such as esc to interrupt stay live
above the frame. Its figures come from $.session.usage() and
$.session.model(), which are free in-process calls. The effort is the one
each main-loop request was actually sent with, recorded by an observe-only
turn.step hook that leaves the response stream untouched. Before the first
request, the effort comes from your settings.
Development
claude plugin validate plugin # manifest and hooks, as the engine reads them
claude plugin test plugin # the tests: layouts, red-alert states, /lcars
claude --plugin-dir plugin # try it; saving a file reloads it
npx -p typescript tsc -p plugin # type-check, once a session has loaded the mod
# (it lays the types in plugin/.claude-plugin/types)
Layout: plugin/hooks/register.tsx (hooks, sensors, drawing),
plugin/hooks/panel.ts (the layouts and the report), plugin/hooks/lcars.ts
(palette and row fitting), plugin/hooks/readouts.ts (stardate, warp
factor, gauges, cell widths), plugin/types/index.d.ts (the state contract),
plugin/tests/.
docs/preview.svg comes from a real session. Capture it with
tmux capture-pane -e -p -t <session> > capture.ans, then convert it with
python3 docs/ansi2svg.py capture.ans docs/preview.svg --rows <first>-<last>.
Credits
The panel borrows the look of LCARS, the computer interface designed by Michael Okuda for Star Trek: The Next Generation. This is an unofficial fan project. Star Trek and its marks belong to their respective owners.
