hud by yeachan-heo/oh-my-claudecode
npx skills add https://github.com/yeachan-heo/oh-my-claudecode --skill hud为状态行配置 OMC HUD(平视显示器)。
注意:本指南中所有 ~/.claude/... 路径在设置了 CLAUDE_CONFIG_DIR 环境变量时,将遵循该变量。
| 命令 | 描述 |
|---|---|
/oh-my-claudecode:hud | 显示当前 HUD 状态(如果需要会自动设置) |
/oh-my-claudecode:hud setup | 安装/修复 HUD 状态行 |
/oh-my-claudecode:hud minimal | 切换到精简显示模式 |
/oh-my-claudecode:hud focused |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 切换到聚焦显示模式(默认) |
/oh-my-claudecode:hud full | 切换到完整显示模式 |
/oh-my-claudecode:hud status | 显示详细的 HUD 状态 |
当您运行 /oh-my-claudecode:hud 或 /oh-my-claudecode:hud setup 时,系统将自动:
~/.claude/hud/omc-hud.mjs 是否存在~/.claude/settings.json 中是否配置了 statusLine重要提示:如果参数是 setup 或者 HUD 脚本在 ~/.claude/hud/omc-hud.mjs 不存在,您必须按照以下说明直接创建 HUD 文件。
步骤 1: 检查是否需要设置:
node -e "const p=require('path'),f=require('fs'),d=process.env.CLAUDE_CONFIG_DIR||p.join(require('os').homedir(),'.claude');console.log(f.existsSync(p.join(d,'hud','omc-hud.mjs'))?'EXISTS':'MISSING')"
步骤 2: 验证插件是否已安装:
node -e "const p=require('path'),f=require('fs'),d=process.env.CLAUDE_CONFIG_DIR||p.join(require('os').homedir(),'.claude'),b=p.join(d,'plugins','cache','omc','oh-my-claudecode');try{const v=f.readdirSync(b).filter(x=>/^\d/.test(x)).sort((a,c)=>a.localeCompare(c,void 0,{numeric:true}));if(v.length===0){console.log('Plugin not installed - run: /plugin install oh-my-claudecode');process.exit()}const l=v[v.length-1],h=p.join(b,l,'dist','hud','index.js');console.log('Version:',l);console.log(f.existsSync(h)?'READY':'NOT_FOUND - try reinstalling: /plugin install oh-my-claudecode')}catch{console.log('Plugin not installed - run: /plugin install oh-my-claudecode')}"
步骤 3: 如果 omc-hud.mjs 为 MISSING 或者参数是 setup,创建 HUD 目录和脚本:
首先,创建目录:
node -e "require('fs').mkdirSync(require('path').join(process.env.CLAUDE_CONFIG_DIR||require('path').join(require('os').homedir(),'.claude'),'hud'),{recursive:true})"
然后,使用 Write 工具创建 ~/.claude/hud/omc-hud.mjs,内容必须与此完全一致:
#!/usr/bin/env node
/**
* OMC HUD - Statusline Script
* Wrapper that imports from dev paths, plugin cache, or npm package
*/
import { existsSync, readdirSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
async function main() {
const home = homedir();
let pluginCacheVersion = null;
let pluginCacheDir = null;
// 1. Development paths (only when OMC_DEV=1)
if (process.env.OMC_DEV === "1") {
const devPaths = [
join(home, "Workspace/oh-my-claudecode/dist/hud/index.js"),
join(home, "workspace/oh-my-claudecode/dist/hud/index.js"),
join(home, "projects/oh-my-claudecode/dist/hud/index.js"),
];
for (const devPath of devPaths) {
if (existsSync(devPath)) {
try {
await import(pathToFileURL(devPath).href);
return;
} catch { /* continue */ }
}
}
}
// 2. Plugin cache (for production installs)
// Respect CLAUDE_CONFIG_DIR so installs under a custom config dir are found
const configDir = process.env.CLAUDE_CONFIG_DIR || join(home, ".claude");
const pluginCacheBase = join(configDir, "plugins", "cache", "omc", "oh-my-claudecode");
if (existsSync(pluginCacheBase)) {
try {
const versions = readdirSync(pluginCacheBase);
if (versions.length > 0) {
// Filter to only versions with built dist/hud/index.js
// This prevents picking an unbuilt new version after plugin update
const builtVersions = versions.filter(version => {
const pluginPath = join(pluginCacheBase, version, "dist/hud/index.js");
return existsSync(pluginPath);
});
if (builtVersions.length > 0) {
const latestVersion = builtVersions.sort((a, b) => a.localeCompare(b, undefined, { numeric: true })).reverse()[0];
pluginCacheVersion = latestVersion;
pluginCacheDir = join(pluginCacheBase, latestVersion);
const pluginPath = join(pluginCacheDir, "dist/hud/index.js");
await import(pathToFileURL(pluginPath).href);
return;
}
}
} catch { /* continue */ }
}
// 3. npm package (global or local install)
try {
await import("oh-my-claudecode/dist/hud/index.js");
return;
} catch { /* continue */ }
// 4. Fallback: provide detailed error message with fix instructions
if (pluginCacheDir && existsSync(pluginCacheDir)) {
// Plugin exists but dist/ folder is missing - needs build
const distDir = join(pluginCacheDir, "dist");
if (!existsSync(distDir)) {
console.log(`[OMC HUD] Plugin installed but not built. Run: cd "${pluginCacheDir}" && npm install && npm run build`);
} else {
console.log(`[OMC HUD] Plugin dist/ exists but HUD not found. Run: cd "${pluginCacheDir}" && npm run build`);
}
} else if (existsSync(pluginCacheBase)) {
// Plugin cache directory exists but no built versions found
console.log("[OMC HUD] Plugin cache found but no built versions. Run: /oh-my-claudecode:omc-setup");
} else {
// No plugin installation found at all
console.log("[OMC HUD] Plugin not installed. Run: /oh-my-claudecode:omc-setup");
}
}
main();
步骤 3: 使其可执行(仅限 Unix,Windows 上跳过):
node -e "if(process.platform==='win32'){console.log('Skipped (Windows)')}else{require('fs').chmodSync(require('path').join(process.env.CLAUDE_CONFIG_DIR||require('path').join(require('os').homedir(),'.claude'),'hud','omc-hud.mjs'),0o755);console.log('Done')}"
步骤 4: 更新 settings.json 以使用 HUD:
读取 ~/.claude/settings.json,然后更新/添加 statusLine 字段。
重要提示: 不要在命令中使用 ~。在 Unix 上,使用 $HOME 以保持路径在不同机器间的可移植性。在 Windows 上,使用绝对路径,因为 Windows 不会在 shell 命令中展开 ~。
如果您在 Windows 上,首先确定正确的路径:
node -e "const p=require('path').join(require('os').homedir(),'.claude','hud','omc-hud.mjs').split(require('path').sep).join('/');console.log(JSON.stringify(p))"
重要提示: 命令路径在所有平台上必须使用正斜杠。Claude Code 通过 bash 执行 statusLine 命令,bash 会将反斜杠解释为转义字符并破坏路径。
然后设置 statusLine 字段。在 Unix 上,它应保持可移植性,看起来像:
{
"statusLine": {
"type": "command",
"command": "node $HOME/.claude/hud/omc-hud.mjs"
}
}
在 Windows 上,路径使用正斜杠(不是反斜杠):
{
"statusLine": {
"type": "command",
"command": "node C:/Users/username/.claude/hud/omc-hud.mjs"
}
}
使用 Edit 工具在保留其他设置的同时添加/更新此字段。
步骤 5: 清理旧的 HUD 脚本(如果有的话):
node -e "const p=require('path'),f=require('fs'),d=process.env.CLAUDE_CONFIG_DIR||p.join(require('os').homedir(),'.claude'),t=p.join(d,'hud','omc-hud.mjs');try{if(f.existsSync(t)){f.unlinkSync(t);console.log('Removed legacy script')}else{console.log('No legacy script found')}}catch{}"
步骤 6: 告诉用户重启 Claude Code 以使更改生效。
仅显示基本要素:
[OMC] ralph | ultrawork | todos:2/5
显示所有相关元素:
[OMC] branch:main | ralph:3/10 | US-002 | ultrawork skill:planner | ctx:67% | agents:2 | bg:3/5 | todos:2/5
显示所有内容,包括多行代理详细信息:
[OMC] repo:oh-my-claudecode branch:main | ralph:3/10 | US-002 (2/5) | ultrawork | ctx:[████░░]67% | agents:3 | bg:3/5 | todos:2/5
├─ O architect 2m analyzing architecture patterns...
├─ e explore 45s searching for test files
└─ s executor 1m implementing validation logic
当代理正在运行时,HUD 会在单独的行上显示详细信息:
├─, └─) 显示视觉层次结构| 元素 | 描述 |
|---|---|
[OMC] | 模式标识符 |
repo:name | Git 仓库名称(青色) |
branch:name | Git 分支名称(青色) |
ralph:3/10 | Ralph 循环迭代次数/最大值 |
US-002 | 当前 PRD 故事 ID |
ultrawork | 活动模式徽章 |
skill:name | 最后激活的技能(青色) |
ctx:67% | 上下文窗口使用率 |
agents:2 | 正在运行的子代理数量 |
bg:3/5 | 后台任务槽位 |
todos:2/5 | 待办事项完成情况 |
HUD 配置存储在 ~/.claude/settings.json 中的 omcHud 键下(或者如果设置了 CLAUDE_CONFIG_DIR,则存储在您的自定义配置目录中)。
旧版配置位置(已弃用):~/.claude/.omc/hud-config.json
您可以手动编辑配置文件。每个选项都可以单独设置 - 任何未设置的值将使用默认值。
{
"preset": "focused",
"elements": {
"omcLabel": true,
"ralph": true,
"autopilot": true,
"prdStory": true,
"activeSkills": true,
"lastSkill": true,
"contextBar": true,
"agents": true,
"agentsFormat": "multiline",
"backgroundTasks": true,
"todos": true,
"thinking": true,
"thinkingFormat": "text",
"permissionStatus": false,
"apiKeySource": false,
"profile": true,
"promptTime": true,
"sessionHealth": true,
"useBars": true,
"showCallCounts": true,
"safeMode": true,
"maxOutputLines": 4
},
"thresholds": {
"contextWarning": 70,
"contextCompactSuggestion": 80,
"contextCritical": 85,
"ralphWarning": 7
},
"staleTaskThresholdMinutes": 30,
"contextLimitWarning": {
"threshold": 80,
"autoCompact": false
}
}
当 safeMode 为 true(默认)时,HUD 会去除 ANSI 代码并使用纯 ASCII 输出,以防止在并发更新期间终端渲染损坏。这在 Windows 上以及使用终端多路复用器时尤其重要。
count: agents:2codes: agents:Oes(类型编码,带有模型层级大小写)codes-duration: agents:O(2m)es(代码加持续时间)detailed: agents:[architect(2m),explore,exec]descriptions: O:analyzing code | e:searching(代码 + 它们正在做什么)tasks: [analyzing code, searching...](仅描述)multiline: 多行显示,在单独的行上显示完整的代理详细信息如果 HUD 没有显示:
/oh-my-claudecode:hud setup 以自动安装和配置/oh-my-claudecode:omc-doctor 进行完整诊断旧版字符串格式迁移: 较旧的 OMC 版本将 statusLine 写为纯字符串(例如 "~/.claude/hud/omc-hud.mjs")。现代 Claude Code (v2.1+) 需要对象格式。运行安装程序或 /oh-my-claudecode:hud setup 将自动将旧版字符串迁移到正确的对象格式:
{
"statusLine": {
"type": "command",
"command": "node $HOME/.claude/hud/omc-hud.mjs"
}
}
Node 24+ 兼容性: HUD 包装脚本从 node:os(而不是 node:path)导入 homedir。如果您遇到 SyntaxError: The requested module 'path' does not provide an export named 'homedir',请重新运行安装程序以重新生成 omc-hud.mjs。
手动验证:
~/.claude/hud/omc-hud.mjs~/.claude/settings.json 应将 statusLine 配置为具有 type 和 command 字段的对象HUD 在活动会话期间每约 300 毫秒自动更新一次。
每周安装数
198
仓库
GitHub 星标数
11.2K
首次出现
2026年1月22日
安全审计
安装于
opencode186
claude-code185
codex181
gemini-cli180
cursor177
github-copilot167
Configure the OMC HUD (Heads-Up Display) for the statusline.
Note: All ~/.claude/... paths in this guide respect CLAUDE_CONFIG_DIR when that environment variable is set.
| Command | Description |
|---|---|
/oh-my-claudecode:hud | Show current HUD status (auto-setup if needed) |
/oh-my-claudecode:hud setup | Install/repair HUD statusline |
/oh-my-claudecode:hud minimal | Switch to minimal display |
/oh-my-claudecode:hud focused | Switch to focused display (default) |
/oh-my-claudecode:hud full | Switch to full display |
/oh-my-claudecode:hud status | Show detailed HUD status |
When you run /oh-my-claudecode:hud or /oh-my-claudecode:hud setup, the system will automatically:
~/.claude/hud/omc-hud.mjs existsstatusLine is configured in ~/.claude/settings.jsonIMPORTANT : If the argument is setup OR if the HUD script doesn't exist at ~/.claude/hud/omc-hud.mjs, you MUST create the HUD files directly using the instructions below.
Step 1: Check if setup is needed:
node -e "const p=require('path'),f=require('fs'),d=process.env.CLAUDE_CONFIG_DIR||p.join(require('os').homedir(),'.claude');console.log(f.existsSync(p.join(d,'hud','omc-hud.mjs'))?'EXISTS':'MISSING')"
Step 2: Verify the plugin is installed:
node -e "const p=require('path'),f=require('fs'),d=process.env.CLAUDE_CONFIG_DIR||p.join(require('os').homedir(),'.claude'),b=p.join(d,'plugins','cache','omc','oh-my-claudecode');try{const v=f.readdirSync(b).filter(x=>/^\d/.test(x)).sort((a,c)=>a.localeCompare(c,void 0,{numeric:true}));if(v.length===0){console.log('Plugin not installed - run: /plugin install oh-my-claudecode');process.exit()}const l=v[v.length-1],h=p.join(b,l,'dist','hud','index.js');console.log('Version:',l);console.log(f.existsSync(h)?'READY':'NOT_FOUND - try reinstalling: /plugin install oh-my-claudecode')}catch{console.log('Plugin not installed - run: /plugin install oh-my-claudecode')}"
Step 3: If omc-hud.mjs is MISSING or argument is setup, create the HUD directory and script:
First, create the directory:
node -e "require('fs').mkdirSync(require('path').join(process.env.CLAUDE_CONFIG_DIR||require('path').join(require('os').homedir(),'.claude'),'hud'),{recursive:true})"
Then, use the Write tool to create ~/.claude/hud/omc-hud.mjs with this exact content:
#!/usr/bin/env node
/**
* OMC HUD - Statusline Script
* Wrapper that imports from dev paths, plugin cache, or npm package
*/
import { existsSync, readdirSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import { pathToFileURL } from "node:url";
async function main() {
const home = homedir();
let pluginCacheVersion = null;
let pluginCacheDir = null;
// 1. Development paths (only when OMC_DEV=1)
if (process.env.OMC_DEV === "1") {
const devPaths = [
join(home, "Workspace/oh-my-claudecode/dist/hud/index.js"),
join(home, "workspace/oh-my-claudecode/dist/hud/index.js"),
join(home, "projects/oh-my-claudecode/dist/hud/index.js"),
];
for (const devPath of devPaths) {
if (existsSync(devPath)) {
try {
await import(pathToFileURL(devPath).href);
return;
} catch { /* continue */ }
}
}
}
// 2. Plugin cache (for production installs)
// Respect CLAUDE_CONFIG_DIR so installs under a custom config dir are found
const configDir = process.env.CLAUDE_CONFIG_DIR || join(home, ".claude");
const pluginCacheBase = join(configDir, "plugins", "cache", "omc", "oh-my-claudecode");
if (existsSync(pluginCacheBase)) {
try {
const versions = readdirSync(pluginCacheBase);
if (versions.length > 0) {
// Filter to only versions with built dist/hud/index.js
// This prevents picking an unbuilt new version after plugin update
const builtVersions = versions.filter(version => {
const pluginPath = join(pluginCacheBase, version, "dist/hud/index.js");
return existsSync(pluginPath);
});
if (builtVersions.length > 0) {
const latestVersion = builtVersions.sort((a, b) => a.localeCompare(b, undefined, { numeric: true })).reverse()[0];
pluginCacheVersion = latestVersion;
pluginCacheDir = join(pluginCacheBase, latestVersion);
const pluginPath = join(pluginCacheDir, "dist/hud/index.js");
await import(pathToFileURL(pluginPath).href);
return;
}
}
} catch { /* continue */ }
}
// 3. npm package (global or local install)
try {
await import("oh-my-claudecode/dist/hud/index.js");
return;
} catch { /* continue */ }
// 4. Fallback: provide detailed error message with fix instructions
if (pluginCacheDir && existsSync(pluginCacheDir)) {
// Plugin exists but dist/ folder is missing - needs build
const distDir = join(pluginCacheDir, "dist");
if (!existsSync(distDir)) {
console.log(`[OMC HUD] Plugin installed but not built. Run: cd "${pluginCacheDir}" && npm install && npm run build`);
} else {
console.log(`[OMC HUD] Plugin dist/ exists but HUD not found. Run: cd "${pluginCacheDir}" && npm run build`);
}
} else if (existsSync(pluginCacheBase)) {
// Plugin cache directory exists but no built versions found
console.log("[OMC HUD] Plugin cache found but no built versions. Run: /oh-my-claudecode:omc-setup");
} else {
// No plugin installation found at all
console.log("[OMC HUD] Plugin not installed. Run: /oh-my-claudecode:omc-setup");
}
}
main();
Step 3: Make it executable (Unix only, skip on Windows):
node -e "if(process.platform==='win32'){console.log('Skipped (Windows)')}else{require('fs').chmodSync(require('path').join(process.env.CLAUDE_CONFIG_DIR||require('path').join(require('os').homedir(),'.claude'),'hud','omc-hud.mjs'),0o755);console.log('Done')}"
Step 4: Update settings.json to use the HUD:
Read ~/.claude/settings.json, then update/add the statusLine field.
IMPORTANT: Do not use ~ in the command. On Unix, use $HOME to keep the path portable across machines. On Windows, use an absolute path because Windows does not expand ~ in shell commands.
If you are on Windows, first determine the correct path:
node -e "const p=require('path').join(require('os').homedir(),'.claude','hud','omc-hud.mjs').split(require('path').sep).join('/');console.log(JSON.stringify(p))"
IMPORTANT: The command path MUST use forward slashes on all platforms. Claude Code executes statusLine commands via bash, which interprets backslashes as escape characters and breaks the path.
Then set the statusLine field. On Unix it should stay portable and look like:
{
"statusLine": {
"type": "command",
"command": "node $HOME/.claude/hud/omc-hud.mjs"
}
}
On Windows the path uses forward slashes (not backslashes):
{
"statusLine": {
"type": "command",
"command": "node C:/Users/username/.claude/hud/omc-hud.mjs"
}
}
Use the Edit tool to add/update this field while preserving other settings.
Step 5: Clean up old HUD scripts (if any):
node -e "const p=require('path'),f=require('fs'),d=process.env.CLAUDE_CONFIG_DIR||p.join(require('os').homedir(),'.claude'),t=p.join(d,'hud','omc-hud.mjs');try{if(f.existsSync(t)){f.unlinkSync(t);console.log('Removed legacy script')}else{console.log('No legacy script found')}}catch{}"
Step 6: Tell the user to restart Claude Code for changes to take effect.
Shows only the essentials:
[OMC] ralph | ultrawork | todos:2/5
Shows all relevant elements:
[OMC] branch:main | ralph:3/10 | US-002 | ultrawork skill:planner | ctx:67% | agents:2 | bg:3/5 | todos:2/5
Shows everything including multi-line agent details:
[OMC] repo:oh-my-claudecode branch:main | ralph:3/10 | US-002 (2/5) | ultrawork | ctx:[████░░]67% | agents:3 | bg:3/5 | todos:2/5
├─ O architect 2m analyzing architecture patterns...
├─ e explore 45s searching for test files
└─ s executor 1m implementing validation logic
When agents are running, the HUD shows detailed information on separate lines:
├─, └─) show visual hierarchy| Element | Description |
|---|---|
[OMC] | Mode identifier |
repo:name | Git repository name (cyan) |
branch:name | Git branch name (cyan) |
ralph:3/10 | Ralph loop iteration/max |
US-002 | Current PRD story ID |
ultrawork | Active mode badge |
HUD config is stored in ~/.claude/settings.json under the omcHud key (or your custom config directory if CLAUDE_CONFIG_DIR is set).
Legacy config location (deprecated): ~/.claude/.omc/hud-config.json
You can manually edit the config file. Each option can be set individually - any unset values will use defaults.
{
"preset": "focused",
"elements": {
"omcLabel": true,
"ralph": true,
"autopilot": true,
"prdStory": true,
"activeSkills": true,
"lastSkill": true,
"contextBar": true,
"agents": true,
"agentsFormat": "multiline",
"backgroundTasks": true,
"todos": true,
"thinking": true,
"thinkingFormat": "text",
"permissionStatus": false,
"apiKeySource": false,
"profile": true,
"promptTime": true,
"sessionHealth": true,
"useBars": true,
"showCallCounts": true,
"safeMode": true,
"maxOutputLines": 4
},
"thresholds": {
"contextWarning": 70,
"contextCompactSuggestion": 80,
"contextCritical": 85,
"ralphWarning": 7
},
"staleTaskThresholdMinutes": 30,
"contextLimitWarning": {
"threshold": 80,
"autoCompact": false
}
}
When safeMode is true (default), the HUD strips ANSI codes and uses ASCII-only output to prevent terminal rendering corruption during concurrent updates. This is especially important on Windows and when using terminal multiplexers.
count: agents:2codes: agents:Oes (type-coded with model tier casing)codes-duration: agents:O(2m)es (codes with duration)detailed: agents:[architect(2m),explore,exec]descriptions: O:analyzing code | e:searching (codes + what they're doing)tasks: [analyzing code, searching...] (just descriptions)multiline: Multi-line display with full agent details on separate linesIf the HUD is not showing:
/oh-my-claudecode:hud setup to auto-install and configure/oh-my-claudecode:omc-doctor for full diagnosticsLegacy string format migration: Older OMC versions wrote statusLine as a plain string (e.g., "~/.claude/hud/omc-hud.mjs"). Modern Claude Code (v2.1+) requires an object format. Running the installer or /oh-my-claudecode:hud setup will auto-migrate legacy strings to the correct object format:
{
"statusLine": {
"type": "command",
"command": "node $HOME/.claude/hud/omc-hud.mjs"
}
}
Node 24+ compatibility: The HUD wrapper script imports homedir from node:os (not node:path). If you encounter SyntaxError: The requested module 'path' does not provide an export named 'homedir', re-run the installer to regenerate omc-hud.mjs.
Manual verification:
~/.claude/hud/omc-hud.mjs~/.claude/settings.json should have statusLine configured as an object with type and command fieldsThe HUD updates automatically every ~300ms during active sessions.
Weekly Installs
198
Repository
GitHub Stars
11.2K
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode186
claude-code185
codex181
gemini-cli180
cursor177
github-copilot167
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
111,800 周安装
skill:name| Last activated skill (cyan) |
ctx:67% | Context window usage |
agents:2 | Running subagent count |
bg:3/5 | Background task slots |
todos:2/5 | Todo completion |