Communitygithub.com

omc-doctor

诊断并修复 oh-my-claudecode 安装问题

omc-doctor 是什么?

omc-doctor 是一个用于诊断和修复 oh-my-claudecode(OMC)插件安装相关问题的 AI 技能。它能够全面检查 OMC 的安装状态,包括插件版本对比、遗留钩子检测、CLAUDE.md 配置验证、Ralph 运行时前提条件检查等多个维度。该技能支持 Claude Code 平台,通过执行一系列 shell 命令和 node 脚本来收集诊断信息,并生成结构化的报告,包括健康状态、各检查项的详细状态以及具体问题列表。如果用户授权,它还可以自动修复检测到的问题,如清理遗留脚本、移除冗余缓存、更新 CLAUDE.md 等。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Yeachan-Heo/oh-my-claudecode/tree/main/skills/omc-doctor

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

诊断技能

注意:本文档中所有 ~/.claude/... 路径在设置 CLAUDE_CONFIG_DIR 环境变量时都会遵循该变量。

任务:运行安装诊断

你是 OMC 医生——负责诊断和修复安装问题。

步骤 1:检查插件版本

# 获取已安装版本和最新版本(跨平台)
node -e "const p=require('path'),f=require('fs'),h=require('os').homedir(),d=process.env.CLAUDE_CONFIG_DIR||p.join(h,'.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}));console.log('已安装:',v.length?v[v.length-1]:'(无)')}catch{console.log('已安装: (无)')}"
npm view oh-my-claude-sisyphus version 2>/dev/null || echo "最新版本: (不可用)"

诊断结果:

  • 如果未安装任何版本:严重 - 插件未安装
  • 如果已安装版本 != 最新版本:警告 - 插件版本过旧
  • 如果存在多个版本:警告 - 缓存中存在旧版本

步骤 2:检查 settings.json 中的遗留钩子

读取 ${CLAUDE_CONFIG_DIR:-~/.claude}/settings.json(配置文件级别)和 ./.claude/settings.json(项目级别),检查是否存在包含以下条目的 "hooks" 键:

  • bash ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/hooks/keyword-detector.sh
  • bash ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/hooks/persistent-mode.sh
  • bash ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/hooks/session-start.sh

诊断结果:

  • 如果找到:严重 - 遗留钩子导致重复

步骤 3:检查遗留 Bash 钩子脚本

ls -la "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/*.sh 2>/dev/null

诊断结果:

  • 如果 keyword-detector.sh、persistent-mode.sh、session-start.sh 或 stop-continuation.sh 存在:警告 - 遗留脚本(可能造成混淆)

步骤 4:检查 CLAUDE.md

# 检查 CLAUDE.md 是否存在
ls -la "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/CLAUDE.md 2>/dev/null

# 检查 OMC 标记(<!-- OMC:START --> 是标准标记)
grep -q "<!-- OMC:START -->" "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/CLAUDE.md" 2>/dev/null && echo "包含 OMC 配置" || echo "CLAUDE.md 中缺少 OMC 配置"

# 检查 CLAUDE.md(或确定性关联文件)的版本标记,并与最新安装的插件缓存版本比较
node -e "const p=require('path'),f=require('fs'),h=require('os').homedir(),d=process.env.CLAUDE_CONFIG_DIR||p.join(h,'.claude');const base=p.join(d,'CLAUDE.md');let baseContent='';try{baseContent=f.readFileSync(base,'utf8')}catch{};let candidates=[base];let referenced='';const importMatch=baseContent.match(/CLAUDE-[^ )]*\\.md/);if(importMatch){referenced=p.join(d,importMatch[0]);candidates.push(referenced)}else{const defaultCompanion=p.join(d,'CLAUDE-omc.md');if(f.existsSync(defaultCompanion))candidates.push(defaultCompanion);try{const others=f.readdirSync(d).filter(n=>/^CLAUDE-.*\\.md$/i.test(n)).sort().map(n=>p.join(d,n));for(const o of others){if(candidates.includes(o)===false)candidates.push(o)}}catch{}};let claudeV='(缺失)';let claudeSource='(无)';for(const file of candidates){try{const c=f.readFileSync(file,'utf8');const m=c.match(/<!--\\s*OMC:VERSION:([^\\s]+)\\s*-->/i);if(m){claudeV=m[1];claudeSource=file;break}}catch{}};if(claudeV==='(缺失)'&&candidates.length>0){claudeV='(缺失标记)';claudeSource='扫描到的确定性 CLAUDE 源';};let pluginV='(无)';try{const b=p.join(d,'plugins','cache','omc','oh-my-claudecode');const v=f.readdirSync(b).filter(x=>/^\\d/.test(x)).sort((a,c)=>a.localeCompare(c,void 0,{numeric:true}));pluginV=v.length?v[v.length-1]:'(无)';}catch{};console.log('CLAUDE.md OMC 版本:',claudeV);console.log('OMC 版本来源:',claudeSource);console.log('最新缓存插件版本:',pluginV);if(claudeV==='(缺失)'||claudeV==='(缺失标记)'||pluginV==='(无)'){console.log('版本检查跳过:缺少 CLAUDE 标记或插件缓存')}else if(claudeV===pluginV){console.log('版本匹配:CLAUDE 和插件缓存一致')}else{console.log('版本偏离:CLAUDE.md 和插件版本不同')}"

# 检查文件拆分模式下的关联文件(例如 CLAUDE-omc.md)
find "${CLAUDE_CONFIG_DIR:-$HOME/.claude}" -maxdepth 1 -type f -name 'CLAUDE-*.md' -print 2>/dev/null
while IFS= read -r f; do
  grep -q "<!-- OMC:START -->" "$f" 2>/dev/null && echo "关联文件中包含 OMC 配置: $f"
done < <(find "${CLAUDE_CONFIG_DIR:-$HOME/.claude}" -maxdepth 1 -type f -name 'CLAUDE-*.md' -print 2>/dev/null)

# 检查 CLAUDE.md 是否引用了关联文件
grep -o "CLAUDE-[^ )]*\.md" "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/CLAUDE.md" 2>/dev/null

诊断结果:

  • 如果 CLAUDE.md 缺失:严重 - 未配置 CLAUDE.md
  • 如果在 CLAUDE.md 中找到 <!-- OMC:START -->:正常
  • 如果在关联文件(例如 CLAUDE-omc.md)中找到 <!-- OMC:START -->:正常 - 检测到文件拆分模式
  • 如果 CLAUDE.md 或任何关联文件中没有 OMC 标记:警告 - CLAUDE.md 版本过旧
  • 如果确定性 CLAUDE 源扫描(基础 + 关联引用)中缺少 OMC:VERSION 标记:警告 - 无法验证 CLAUDE.md 是否为最新
  • 如果 CLAUDE.md OMC 版本 != 最新缓存插件版本:警告 - 检测到版本偏离(请运行 omc update 或 omc setup)

步骤 5:检查 Ralph 运行时前提条件

Ralph 是一个由代理驱动的持久性循环,而非编译的程序:它唯一的硬运行时前提条件是执行 OMC 钩子脚本(persistent-mode.mjs、keyword-detector.mjs)所需的 Node 运行时,以及用于存放 .omc/state/ 状态文件(如 ralph-state.json)的、可写的配置目录。

node --version || echo "Ralph 所需的 Node: 缺失"
mkdir -p "${CLAUDE_CONFIG_DIR:-$HOME/.claude}" 2>/dev/null
touch "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.omc-write-probe" 2>/dev/null && rm -f "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.omc-write-probe" && echo "配置目录可写" || echo "配置目录不可写"

诊断结果:

  • 如果 Node 运行并输出版本号:正常 - Ralph 运行时前提条件满足
  • 如果 node 缺失或运行失败:严重 - 没有 Node,OMC 钩子和 Ralph 无法运行(请参见 https://nodejs.org 获取安装程序;nvm/fnm 用户需确保 Node 在非交互式 Shell 的 PATH 环境变量中)
  • 如果配置目录不可写:警告 - 在使其可写之前,Ralph 状态持久化将失败

步骤 6:检查过期的插件缓存

# 统计缓存中的版本数(跨平台)
node -e "const p=require('path'),f=require('fs'),h=require('os').homedir(),d=process.env.CLAUDE_CONFIG_DIR||p.join(h,'.claude'),b=p.join(d,'plugins','cache','omc','oh-my-claudecode');try{const v=f.readdirSync(b).filter(x=>/^\d/.test(x));console.log(v.length+' 个版本:', v.join(', '))}catch{console.log('0 个版本')}"

诊断结果:

  • 如果版本数 > 1:警告 - 缓存中存在多个版本(建议清理)

步骤 7:检查通过 curl 安装的遗留内容

检查通过 curl 安装的(插件系统之前的)遗留 agents、commands 和 skills。 重要提示:仅标记名称与插件实际提供的名称匹配的文件。不要标记用户自定义且与 OMC 无关的 agents/commands/skills。

# 检查遗留 agents 目录
ls -la "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/agents/ 2>/dev/null

# 检查遗留 commands 目录
ls -la "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/commands/ 2>/dev/null

# 检查遗留 skills 目录
ls -la "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/skills/ 2>/dev/null

诊断结果:

  • 如果 ~/.claude/agents/ 存在且包含与插件 agent 名称匹配的文件:警告 - 遗留 agents(现由插件提供)
  • 如果 ~/.claude/commands/ 存在且包含与插件 command 名称匹配的文件:警告 - 遗留 commands(现由插件提供)
  • 如果 ~/.claude/skills/ 存在且包含与插件 skill 名称匹配的文件:警告 - 遗留 skills(现由插件提供)
  • 如果存在自定义文件且名称与插件名称不匹配:正常 - 这是用户自定义内容,不要标记

已知插件 agent 名称(检查 agents/ 中是否有以下文件): architect.md、document-specialist.md、explore.md、executor.md、debugger.md、planner.md、analyst.md、critic.md、verifier.md、test-engineer.md、designer.md、writer.md、qa-tester.md、scientist.md、security-reviewer.md、code-reviewer.md、git-master.md、code-simplifier.md

已知插件 skill 名称(检查 skills/ 中是否有以下文件): ai-slop-cleaner、ask、autopilot、cancel、configure-notifications、deep-interview、deepinit、external-context、hud、omc-doctor、omc-setup、plan、project-session-manager、ralph、ralplan、release、skill、team、visual-verdict、wiki

已知插件 command 名称(检查 commands/ 中是否有以下文件): deepsearch.md


报告格式

运行所有检查后,输出一份报告:

## OMC 医生报告

### 摘要
[健康 / 发现存在问题]

### 检查项

| 检查项 | 状态 | 详情 |
|-------|--------|---------|
| 插件版本 | 正常/警告/严重 | ... |
| 遗留钩子 (settings.json) | 正常/严重 | ... |
| 遗留脚本 (~/.claude/hooks/) | 正常/警告 | ... |
| CLAUDE.md | 正常/警告/严重 | ... |
| Ralph 运行时前提条件 (Node、配置目录) | 正常/严重 | ... |
| 插件缓存 | 正常/警告 | ... |
| 遗留 Agents (~/.claude/agents/) | 正常/警告 | ... |
| 遗留 Commands (~/.claude/commands/) | 正常/警告 | ... |
| 遗留 Skills (~/.claude/skills/) | 正常/警告 | ... |

### 发现的问题
1. [问题描述]
2. [问题描述]

### 建议的修复方法
[根据问题列出修复方法]

自动修复(如果用户确认)

如果发现问题,询问用户:“是否要自动修复这些问题?”

如果同意,应用修复:

修复:settings.json 中的遗留钩子

从 ${CLAUDE_CONFIG_DIR:-~/.claude}/settings.json 中移除 "hooks" 部分(保留其他设置不变)

修复:遗留 Bash 脚本

rm -f "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/keyword-detector.sh
rm -f "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/persistent-mode.sh
rm -f "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/session-start.sh
rm -f "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/hooks/stop-continuation.sh

修复:过期的插件

# 清除插件缓存(跨平台)
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{f.rmSync(b,{recursive:true,force:true});console.log('插件缓存已清除。请重启 Claude Code 以获取最新版本。')}catch{console.log('未找到插件缓存')}"

修复:过期的缓存(多个版本)

# 仅保留最新版本(跨平台)
node -e "const p=require('path'),f=require('fs'),h=require('os').homedir(),d=process.env.CLAUDE_CONFIG_DIR||p.join(h,'.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}));v.slice(0,-1).forEach(x=>f.rmSync(p.join(b,x),{recursive:true,force:true}));console.log('已移除',v.length-1,'个旧版本')}catch(e){console.log('无缓存可清理')}"

修复:缺失/过期的 CLAUDE.md

从 GitHub 获取最新内容并写入 ${CLAUDE_CONFIG_DIR:-~/.claude}/CLAUDE.md:

WebFetch(url: "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md", prompt: "返回完整的原始 Markdown 内容,保持原样")

修复:通过 curl 安装的遗留内容

移除遗留的 agents、commands 和 skills 目录(现由插件提供):

# 先备份(可选 - 询问用户)
# mv "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/agents "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/agents.bak
# mv "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/commands "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/commands.bak
# mv "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/skills "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/skills.bak

# 或直接删除
rm -rf "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/agents
rm -rf "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/commands
rm -rf "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/skills

注意:仅当这些目录包含 oh-my-claudecode 相关文件时才移除。如果用户有自定义的 agents/commands/skills,请先警告并在移除前询问。


修复后

应用修复后,告知用户:

修复已应用。请重启 Claude Code 以使更改生效。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

agent-doc-discipline

Writing-time discipline for documents agents consume (the five surfaces, specs, tickets, .omc/skills/) — every rule checkable and carrying a why, steps before reference, one meaning in one home, no restating what the environment already says. Mandatory at drydock seed generation and the launch C5 sediment pass; opt-in for any other agent-facing doc edit. The companion of minimal-code-discipline: that one disciplines code, this one disciplines papers.

ai-slop-cleaner

Clean AI-generated code slop with a regression-safe, deletion-first workflow and optional reviewer-only mode

ask

Process-first advisor routing for Claude, Codex, Gemini, Antigravity, Grok, or Cursor via `omc ask`, with artifact capture and no raw CLI assembly

ask-navigator

Shipyard

autopilot

Full autonomous execution from idea to working code

autoresearch

Stateful single-mission improvement loop with strict evaluator contract, markdown decision logs, and max-runtime stop behavior

cancel

Cancel any active OMC mode (autopilot, ralph, ultragoal, swarm, ultrapilot, pipeline, team) and clean up retired legacy state

configure-notifications

Configure notification integrations (Telegram, Discord, Slack) via natural language

debug

Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction

deepinit

Deep codebase initialization with hierarchical AGENTS.md documentation

deep-interview

Socratic deep interview with mathematical ambiguity gating before explicit execution approval

drydock

Lay the keel of the shipyard harness in any repo — the 4-pillar shared environment (Context, Rules, Tools, Standards) across 5 surfaces (CLAUDE.md, skills, design-system, mcp/cli, shared context) so that every human and agent inherits the same design language and anyone can ship. Run once per repo; re-run with --check to audit drift.

execute

Carry an approved task through to working, verified code

external-context

Invoke parallel document-specialist agents for external web searches and documentation lookup

graph

Deterministic orchestration graph runtime - declarative DAG pipelines with journal-based crash recovery

harbor

Harbor intake for external work — the captain only handles unresolved decisions. Sweeps incoming issues and PRs, verifies every claim before disposition, reuses every decision already made, and hands the maintainer a docket whose pending items each carry one question with options, recommendation, impact and evidence. Agent-autonomous for facts and for actions covered by standing authorization; signed for every new judgment. Never merges.

hud

Configure HUD display options (layout, presets, display elements)

launch

Shipyard

loft

Loft the shape before cutting steel — answer a design question that prose cannot settle by building a throwaway artifact: a pure logic module in a clickable shell, or structurally different UI variants behind one route. The captain reacts to the artifact; the answer folds into the decision; the artifact never docks. Use when a design question stalls in words, when a navigator map carries a loft ticket, or when a spec discussion reaches

minimal-code-discipline

YAGNI-ladder coding discipline for writing changes — existence-first, reuse before writing, dependency ladder, shortest correct diff, with non-negotiables that must never be minimized away

相关技能