omc-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OMC Setup

OMC 安装设置

This is the only command you need to learn. After running this, everything else is automatic.
Note: All
~/.claude/...
paths in this guide respect
CLAUDE_CONFIG_DIR
when that environment variable is set.
这是你唯一需要掌握的命令。运行此命令后,其他所有操作都会自动完成。
注意:本指南中所有
~/.claude/...
路径会遵循已设置的
CLAUDE_CONFIG_DIR
环境变量。

Pre-Setup Check: Already Configured?

前置检查:是否已配置?

CRITICAL: Before doing anything else, check if setup has already been completed. This prevents users from having to re-run the full setup wizard after every update.
bash
undefined
关键:在进行任何操作前,请检查是否已完成配置。这能避免用户在每次更新后都需要重新运行完整的安装向导。
bash
undefined

Check if setup was already completed

检查是否已完成配置

CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then SETUP_COMPLETED=$(jq -r '.setupCompleted // empty' "$CONFIG_FILE" 2>/dev/null) SETUP_VERSION=$(jq -r '.setupVersion // empty' "$CONFIG_FILE" 2>/dev/null)
if [ -n "$SETUP_COMPLETED" ] && [ "$SETUP_COMPLETED" != "null" ]; then echo "OMC setup was already completed on: $SETUP_COMPLETED" [ -n "$SETUP_VERSION" ] && echo "Setup version: $SETUP_VERSION" ALREADY_CONFIGURED="true" fi fi
undefined
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then SETUP_COMPLETED=$(jq -r '.setupCompleted // empty' "$CONFIG_FILE" 2>/dev/null) SETUP_VERSION=$(jq -r '.setupVersion // empty' "$CONFIG_FILE" 2>/dev/null)
if [ -n "$SETUP_COMPLETED" ] && [ "$SETUP_COMPLETED" != "null" ]; then echo "OMC 安装已完成,完成时间:$SETUP_COMPLETED" [ -n "$SETUP_VERSION" ] && echo "安装版本:$SETUP_VERSION" ALREADY_CONFIGURED="true" fi fi
undefined

If Already Configured (and no --force flag)

若已配置(且未使用 --force 标志)

If
ALREADY_CONFIGURED
is true AND the user did NOT pass
--force
,
--local
, or
--global
flags:
Use AskUserQuestion to prompt:
Question: "OMC is already configured. What would you like to do?"
Options:
  1. Update CLAUDE.md only - Download latest CLAUDE.md without re-running full setup
  2. Run full setup again - Go through the complete setup wizard
  3. Cancel - Exit without changes
If user chooses "Update CLAUDE.md only":
  • Detect if local (.claude/CLAUDE.md) or global (~/.claude/CLAUDE.md) config exists
  • If local exists, run the download/merge script from Step 2A
  • If only global exists, run the download/merge script from Step 2B
  • Skip all other steps
  • Report success and exit
If user chooses "Run full setup again":
  • Continue with Step 0 (Resume Detection) below
If user chooses "Cancel":
  • Exit without any changes
如果
ALREADY_CONFIGURED
为 true,且用户未传入
--force
--local
--global
标志:
使用 AskUserQuestion 工具提示用户:
问题:"OMC 已完成配置,你想要执行什么操作?"
选项
  1. 仅更新 CLAUDE.md - 下载最新的 CLAUDE.md,跳过完整安装流程
  2. 重新运行完整安装 - 启动完整的安装向导
  3. 取消 - 不做任何修改直接退出
若用户选择「仅更新 CLAUDE.md」
  • 检测本地(.claude/CLAUDE.md)或全局(~/.claude/CLAUDE.md)配置是否存在
  • 若本地配置存在,运行步骤2A中的下载/合并脚本
  • 若仅全局配置存在,运行步骤2B中的下载/合并脚本
  • 跳过所有其他步骤
  • 报告成功并退出
若用户选择「重新运行完整安装」
  • 继续执行下方的步骤0(恢复检测)
若用户选择「取消」
  • 不做任何修改直接退出

Force Flag Override

强制标志覆盖

If user passes
--force
flag, skip this check and proceed directly to setup.
如果用户传入
--force
标志,跳过此检查,直接进入安装流程。

Graceful Interrupt Handling

优雅中断处理

IMPORTANT: This setup process saves progress after each step. If interrupted (Ctrl+C or connection loss), the setup can resume from where it left off.
重要:此安装流程会在每个步骤完成后保存进度。如果被中断(Ctrl+C 或连接中断),安装可以从中断的位置恢复。

State File Location

状态文件位置

  • .omc/state/setup-state.json
    - Tracks completed steps
  • .omc/state/setup-state.json
    - 记录已完成的步骤

Resume Detection (Step 0)

恢复检测(步骤0)

Before starting any step, check for existing state:
bash
undefined
在启动任何步骤前,检查是否存在已保存的状态:
bash
undefined

Check for existing setup state

检查是否存在已保存的安装状态

STATE_FILE=".omc/state/setup-state.json"
STATE_FILE=".omc/state/setup-state.json"

Cross-platform ISO date to epoch conversion

跨平台的ISO日期转时间戳函数

iso_to_epoch() { local iso_date="$1" local epoch=""

Try GNU date first (Linux)

epoch=$(date -d "$iso_date" +%s 2>/dev/null) if [ $? -eq 0 ] && [ -n "$epoch" ]; then echo "$epoch" return 0 fi

Try BSD/macOS date

local clean_date=$(echo "$iso_date" | sed 's/[+-][0-9][0-9]:[0-9][0-9]$//' | sed 's/Z$//' | sed 's/T/ /') epoch=$(date -j -f "%Y-%m-%d %H:%M:%S" "$clean_date" +%s 2>/dev/null) if [ $? -eq 0 ] && [ -n "$epoch" ]; then echo "$epoch" return 0 fi echo "0" }
if [ -f "$STATE_FILE" ]; then

Check if state is stale (older than 24 hours)

TIMESTAMP_RAW=$(jq -r '.timestamp // empty' "$STATE_FILE" 2>/dev/null) if [ -n "$TIMESTAMP_RAW" ]; then TIMESTAMP_EPOCH=$(iso_to_epoch "$TIMESTAMP_RAW") NOW_EPOCH=$(date +%s) STATE_AGE=$((NOW_EPOCH - TIMESTAMP_EPOCH)) else STATE_AGE=999999 # Force fresh start if no timestamp fi if [ "$STATE_AGE" -gt 86400 ]; then echo "Previous setup state is more than 24 hours old. Starting fresh." rm -f "$STATE_FILE" else LAST_STEP=$(jq -r ".lastCompletedStep // 0" "$STATE_FILE" 2>/dev/null || echo "0") TIMESTAMP=$(jq -r .timestamp "$STATE_FILE" 2>/dev/null || echo "unknown") echo "Found previous setup session (Step $LAST_STEP completed at $TIMESTAMP)" fi fi

If state exists, use AskUserQuestion to prompt:

**Question:** "Found a previous setup session. Would you like to resume or start fresh?"

**Options:**
1. **Resume from step $LAST_STEP** - Continue where you left off
2. **Start fresh** - Begin from the beginning (clears saved state)

If user chooses "Start fresh":
```bash
rm -f ".omc/state/setup-state.json"
echo "Previous state cleared. Starting fresh setup."
iso_to_epoch() { local iso_date="$1" local epoch=""

先尝试GNU date(Linux)

epoch=$(date -d "$iso_date" +%s 2>/dev/null) if [ $? -eq 0 ] && [ -n "$epoch" ]; then echo "$epoch" return 0 fi

尝试BSD/macOS date

local clean_date=$(echo "$iso_date" | sed 's/[+-][0-9][0-9]:[0-9][0-9]$//' | sed 's/Z$//' | sed 's/T/ /') epoch=$(date -j -f "%Y-%m-%d %H:%M:%S" "$clean_date" +%s 2>/dev/null) if [ $? -eq 0 ] && [ -n "$epoch" ]; then echo "$epoch" return 0 fi echo "0" }
if [ -f "$STATE_FILE" ]; then

检查状态是否过期(超过24小时)

TIMESTAMP_RAW=$(jq -r '.timestamp // empty' "$STATE_FILE" 2>/dev/null) if [ -n "$TIMESTAMP_RAW" ]; then TIMESTAMP_EPOCH=$(iso_to_epoch "$TIMESTAMP_RAW") NOW_EPOCH=$(date +%s) STATE_AGE=$((NOW_EPOCH - TIMESTAMP_EPOCH)) else STATE_AGE=999999 # 如果没有时间戳,强制重新开始 fi if [ "$STATE_AGE" -gt 86400 ]; then echo "之前的安装状态已超过24小时,将重新开始安装。" rm -f "$STATE_FILE" else LAST_STEP=$(jq -r ".lastCompletedStep // 0" "$STATE_FILE" 2>/dev/null || echo "0") TIMESTAMP=$(jq -r .timestamp "$STATE_FILE" 2>/dev/null || echo "未知") echo "检测到之前的安装会话(步骤 $LAST_STEP 完成于 $TIMESTAMP)" fi fi

如果存在状态文件,使用 AskUserQuestion 工具提示用户:

**问题**:"检测到之前的安装会话,你想要恢复还是重新开始?"

**选项**:
1. **从步骤 $LAST_STEP 恢复** - 从中断的位置继续安装
2. **重新开始** - 从头开始安装(清除已保存的状态)

若用户选择「重新开始」:
```bash
rm -f ".omc/state/setup-state.json"
echo "已清除之前的状态,将重新开始安装。"

Save Progress Helper

进度保存助手

After completing each major step, save progress:
bash
undefined
在完成每个主要步骤后,保存进度:
bash
undefined

Save setup progress (call after each step)

保存安装进度(每个步骤完成后调用)

Usage: save_setup_progress STEP_NUMBER

使用方法:save_setup_progress 步骤编号

save_setup_progress() { mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": $1, "timestamp": "$(date -Iseconds)", "configType": "${CONFIG_TYPE:-unknown}" } EOF }
undefined
save_setup_progress() { mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": $1, "timestamp": "$(date -Iseconds)", "configType": "${CONFIG_TYPE:-unknown}" } EOF }
undefined

Clear State on Completion

完成后清除状态

After successful setup completion (Step 7/8), remove the state file:
bash
rm -f ".omc/state/setup-state.json"
echo "Setup completed successfully. State cleared."
在成功完成安装(步骤7/8)后,删除状态文件:
bash
rm -f ".omc/state/setup-state.json"
echo "安装已成功完成,状态已清除。"

Usage Modes

使用模式

This skill handles three scenarios:
  1. Initial Setup (no flags): First-time installation wizard
  2. Local Configuration (
    --local
    )
    : Configure project-specific settings (.claude/CLAUDE.md)
  3. Global Configuration (
    --global
    )
    : Configure global settings (~/.claude/CLAUDE.md)
此工具支持三种场景:
  1. 初始安装(无标志):首次安装向导
  2. 本地配置(
    --local
    :配置项目专属设置(.claude/CLAUDE.md)
  3. 全局配置(
    --global
    :配置全局设置(~/.claude/CLAUDE.md)

Mode Detection

模式检测

Check for flags in the user's invocation:
  • If
    --local
    flag present → Skip Pre-Setup Check, go to Local Configuration (Step 2A)
  • If
    --global
    flag present → Skip Pre-Setup Check, go to Global Configuration (Step 2B)
  • If
    --force
    flag present → Skip Pre-Setup Check, run Initial Setup wizard (Step 1)
  • If no flags → Run Pre-Setup Check first, then Initial Setup wizard (Step 1) if needed
检查用户调用时传入的标志:
  • 若存在
    --local
    标志 → 跳过前置检查,进入本地配置(步骤2A)
  • 若存在
    --global
    标志 → 跳过前置检查,进入全局配置(步骤2B)
  • 若存在
    --force
    标志 → 跳过前置检查,直接运行初始安装向导(步骤1)
  • 若无标志 → 先运行前置检查,若未配置则启动初始安装向导(步骤1)

Step 1: Initial Setup Wizard (Default Behavior)

步骤1:初始安装向导(默认行为)

Note: If resuming and lastCompletedStep >= 1, skip to the appropriate step based on configType.
Use the AskUserQuestion tool to prompt the user:
Question: "Where should I configure oh-my-claudecode?"
Options:
  1. Local (this project) - Creates
    .claude/CLAUDE.md
    in current project directory. Best for project-specific configurations.
  2. Global (all projects) - Creates
    ~/.claude/CLAUDE.md
    for all Claude Code sessions. Best for consistent behavior everywhere.
注意:如果是恢复安装且 lastCompletedStep >=1,根据 configType 跳转到对应步骤。
使用 AskUserQuestion 工具提示用户:
问题:"你想要在哪里配置 oh-my-claudecode?"
选项
  1. 本地(当前项目) - 在当前项目目录创建
    .claude/CLAUDE.md
    ,适合项目专属配置
  2. 全局(所有项目) - 创建
    ~/.claude/CLAUDE.md
    ,适用于所有 Claude Code 会话,确保所有场景下的行为一致性

Step 2A: Local Configuration (--local flag or user chose LOCAL)

步骤2A:本地配置(--local 标志或用户选择本地)

CRITICAL: This ALWAYS downloads fresh CLAUDE.md from GitHub to the local project. DO NOT use the Write tool - use bash curl exclusively.
关键:此步骤始终从 GitHub 下载最新的 CLAUDE.md 到本地项目。禁止使用 Write 工具,必须使用 bash curl 命令。

Create Local .claude Directory

创建本地 .claude 目录

bash
undefined
bash
undefined

Create .claude directory in current project

在当前项目创建 .claude 目录

mkdir -p .claude && echo ".claude directory ready"
undefined
mkdir -p .claude && echo ".claude 目录已准备就绪"
undefined

Download Fresh CLAUDE.md

下载最新的 CLAUDE.md

bash
undefined
bash
undefined

Define target path

定义目标路径

TARGET_PATH=".claude/CLAUDE.md"
TARGET_PATH=".claude/CLAUDE.md"

Extract old version before download

下载前提取旧版本号

OLD_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "none")
OLD_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "none")

Backup existing

备份现有文件

if [ -f "$TARGET_PATH" ]; then BACKUP_DATE=$(date +%Y-%m-%d_%H%M%S) BACKUP_PATH="${TARGET_PATH}.backup.${BACKUP_DATE}" cp "$TARGET_PATH" "$BACKUP_PATH" echo "Backed up existing CLAUDE.md to $BACKUP_PATH" fi
if [ -f "$TARGET_PATH" ]; then BACKUP_DATE=$(date +%Y-%m-%d_%H%M%S) BACKUP_PATH="${TARGET_PATH}.backup.${BACKUP_DATE}" cp "$TARGET_PATH" "$BACKUP_PATH" echo "已将现有 CLAUDE.md 备份到 $BACKUP_PATH" fi

Download fresh OMC content to temp file

下载最新的 OMC 内容到临时文件

TEMP_OMC=$(mktemp /tmp/omc-claude-XXXXXX.md) trap 'rm -f "$TEMP_OMC"' EXIT curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md" -o "$TEMP_OMC"
if [ ! -s "$TEMP_OMC" ]; then echo "ERROR: Failed to download CLAUDE.md. Aborting." rm -f "$TEMP_OMC" return 1 fi
TEMP_OMC=$(mktemp /tmp/omc-claude-XXXXXX.md) trap 'rm -f "$TEMP_OMC"' EXIT curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md" -o "$TEMP_OMC"
if [ ! -s "$TEMP_OMC" ]; then echo "错误:下载 CLAUDE.md 失败,安装终止。" rm -f "$TEMP_OMC" return 1 fi

Strip existing markers from downloaded content (idempotency)

从下载的内容中移除已有的标记(保证幂等性)

if grep -q '<!-- OMC:START -->' "$TEMP_OMC"; then

Extract content between markers

sed -n '/<!-- OMC:START -->/,/<!-- OMC:END -->/{//!p}' "$TEMP_OMC" > "${TEMP_OMC}.clean" mv "${TEMP_OMC}.clean" "$TEMP_OMC" fi
if [ ! -f "$TARGET_PATH" ]; then

Fresh install: wrap in markers

{ echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' } > "$TARGET_PATH" rm -f "$TEMP_OMC" echo "Installed CLAUDE.md (fresh)" else

Merge: preserve user content outside OMC markers

if grep -q '<!-- OMC:START -->' "$TARGET_PATH"; then # Has markers: replace OMC section, keep user content BEFORE_OMC=$(sed -n '1,/<!-- OMC:START -->/{ /<!-- OMC:START -->/!p }' "$TARGET_PATH") AFTER_OMC=$(sed -n '/<!-- OMC:END -->/,${ /<!-- OMC:END -->/!p }' "$TARGET_PATH") { [ -n "$BEFORE_OMC" ] && printf '%s\n' "$BEFORE_OMC" echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' [ -n "$AFTER_OMC" ] && printf '%s\n' "$AFTER_OMC" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "Updated OMC section (user customizations preserved)" else # No markers: wrap new content in markers, append old content as user section OLD_CONTENT=$(cat "$TARGET_PATH") { echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' echo "" echo "<!-- User customizations (migrated from previous CLAUDE.md) -->" printf '%s\n' "$OLD_CONTENT" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "Migrated existing CLAUDE.md (added OMC markers, preserved old content)" fi rm -f "$TEMP_OMC" fi
if grep -q '<!-- OMC:START -->' "$TEMP_OMC"; then

提取标记之间的内容

sed -n '/<!-- OMC:START -->/,/<!-- OMC:END -->/{//!p}' "$TEMP_OMC" > "${TEMP_OMC}.clean" mv "${TEMP_OMC}.clean" "$TEMP_OMC" fi
if [ ! -f "$TARGET_PATH" ]; then

全新安装:用标记包裹内容

{ echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' } > "$TARGET_PATH" rm -f "$TEMP_OMC" echo "已安装 CLAUDE.md(全新版本)" else

合并:保留 OMC 标记外的用户自定义内容

if grep -q '<!-- OMC:START -->' "$TARGET_PATH"; then # 已有标记:替换 OMC 部分,保留用户内容 BEFORE_OMC=$(sed -n '1,/<!-- OMC:START -->/{ /<!-- OMC:START -->/!p }' "$TARGET_PATH") AFTER_OMC=$(sed -n '/<!-- OMC:END -->/,${ /<!-- OMC:END -->/!p }' "$TARGET_PATH") { [ -n "$BEFORE_OMC" ] && printf '%s\n' "$BEFORE_OMC" echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' [ -n "$AFTER_OMC" ] && printf '%s\n' "$AFTER_OMC" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "已更新 OMC 部分(用户自定义内容已保留)" else # 无标记:用标记包裹新内容,将旧内容作为用户部分追加 OLD_CONTENT=$(cat "$TARGET_PATH") { echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' echo "" echo "<!-- 用户自定义内容(从之前的 CLAUDE.md 迁移) -->" printf '%s\n' "$OLD_CONTENT" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "已迁移现有 CLAUDE.md(添加了 OMC 标记,保留了旧内容)" fi rm -f "$TEMP_OMC" fi

Extract new version and report

提取新版本号并报告

NEW_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") if [ "$OLD_VERSION" = "none" ]; then echo "Installed CLAUDE.md: $NEW_VERSION" elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then echo "CLAUDE.md unchanged: $NEW_VERSION" else echo "Updated CLAUDE.md: $OLD_VERSION -> $NEW_VERSION" fi

**Note**: The downloaded CLAUDE.md includes Context Persistence instructions with `<remember>` tags for surviving conversation compaction.

**Note**: If an existing CLAUDE.md is found, it will be backed up to `.claude/CLAUDE.md.backup.YYYY-MM-DD` before downloading the new version.

**MANDATORY**: Always run this command. Do NOT skip. Do NOT use Write tool.

**FALLBACK** if curl fails:
Tell user to manually download from:
https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md
NEW_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") if [ "$OLD_VERSION" = "none" ]; then echo "已安装 CLAUDE.md:$NEW_VERSION" elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then echo "CLAUDE.md 未变更:$NEW_VERSION" else echo "已更新 CLAUDE.md:$OLD_VERSION -> $NEW_VERSION" fi

**注意**:下载的 CLAUDE.md 包含了上下文持久化说明,带有 `<remember>` 标签,可在对话压缩后保留关键信息。

**注意**:如果检测到已存在 CLAUDE.md,会在下载新版本前将其备份到 `.claude/CLAUDE.md.backup.YYYY-MM-DD`。

**强制要求**:必须始终运行此命令,禁止跳过,禁止使用 Write 工具。

**curl 失败的回退方案**:
告知用户手动从以下地址下载:
https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md

Verify Plugin Installation

验证插件安装

bash
grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-claudecode"
bash
grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "插件已验证" || echo "未找到插件 - 请运行:claude /install-plugin oh-my-claudecode"

Confirm Local Configuration Success

确认本地配置成功

After completing local configuration, save progress and report:
bash
undefined
完成本地配置后,保存进度并报告:
bash
undefined

Save progress - Step 2 complete (Local config)

保存进度 - 步骤2完成(本地配置)

mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 2, "timestamp": "$(date -Iseconds)", "configType": "local" } EOF

**OMC Project Configuration Complete**
- CLAUDE.md: Updated with latest configuration from GitHub at ./.claude/CLAUDE.md
- Backup: Previous CLAUDE.md backed up to `.claude/CLAUDE.md.backup.YYYY-MM-DD` (if existed)
- Scope: **PROJECT** - applies only to this project
- Hooks: Provided by plugin (no manual installation needed)
- Agents: 28+ available (base + tiered variants)
- Model routing: Haiku/Sonnet/Opus based on task complexity

**Note**: This configuration is project-specific and won't affect other projects or global settings.

If `--local` flag was used, clear state and **STOP HERE**:
```bash
rm -f ".omc/state/setup-state.json"
Do not continue to HUD setup or other steps.
mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 2, "timestamp": "$(date -Iseconds)", "configType": "local" } EOF

**OMC 项目配置完成**
- CLAUDE.md:已从 GitHub 更新到最新配置,路径为 ./.claude/CLAUDE.md
- 备份:之前的 CLAUDE.md 已备份到 `.claude/CLAUDE.md.backup.YYYY-MM-DD`(如果之前存在)
- 作用范围:**项目级** - 仅适用于当前项目
- 钩子:由插件提供(无需手动安装)
- 可用 Agent:28+ 个(基础版 + 分级变体)
- 模型路由:根据任务复杂度自动选择 Haiku/Sonnet/Opus

**注意**:此配置为项目专属,不会影响其他项目或全局设置。

如果使用了 `--local` 标志,清除状态并**在此处停止**:
```bash
rm -f ".omc/state/setup-state.json"
不要继续进行 HUD 安装或其他步骤。

Step 2B: Global Configuration (--global flag or user chose GLOBAL)

步骤2B:全局配置(--global 标志或用户选择全局)

CRITICAL: This ALWAYS downloads fresh CLAUDE.md from GitHub to global config. DO NOT use the Write tool - use bash curl exclusively.
关键:此步骤始终从 GitHub 下载最新的 CLAUDE.md 到全局配置目录。禁止使用 Write 工具,必须使用 bash curl 命令。

Download Fresh CLAUDE.md

下载最新的 CLAUDE.md

bash
undefined
bash
undefined

Define target path

定义目标路径

TARGET_PATH="$HOME/.claude/CLAUDE.md"
TARGET_PATH="$HOME/.claude/CLAUDE.md"

Extract old version before download

下载前提取旧版本号

OLD_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "none")
OLD_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "none")

Backup existing

备份现有文件

if [ -f "$TARGET_PATH" ]; then BACKUP_DATE=$(date +%Y-%m-%d_%H%M%S) BACKUP_PATH="${TARGET_PATH}.backup.${BACKUP_DATE}" cp "$TARGET_PATH" "$BACKUP_PATH" echo "Backed up existing CLAUDE.md to $BACKUP_PATH" fi
if [ -f "$TARGET_PATH" ]; then BACKUP_DATE=$(date +%Y-%m-%d_%H%M%S) BACKUP_PATH="${TARGET_PATH}.backup.${BACKUP_DATE}" cp "$TARGET_PATH" "$BACKUP_PATH" echo "已将现有 CLAUDE.md 备份到 $BACKUP_PATH" fi

Download fresh OMC content to temp file

下载最新的 OMC 内容到临时文件

TEMP_OMC=$(mktemp /tmp/omc-claude-XXXXXX.md) trap 'rm -f "$TEMP_OMC"' EXIT curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md" -o "$TEMP_OMC"
if [ ! -s "$TEMP_OMC" ]; then echo "ERROR: Failed to download CLAUDE.md. Aborting." rm -f "$TEMP_OMC" return 1 fi
TEMP_OMC=$(mktemp /tmp/omc-claude-XXXXXX.md) trap 'rm -f "$TEMP_OMC"' EXIT curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-claudecode/main/docs/CLAUDE.md" -o "$TEMP_OMC"
if [ ! -s "$TEMP_OMC" ]; then echo "错误:下载 CLAUDE.md 失败,安装终止。" rm -f "$TEMP_OMC" return 1 fi

Strip existing markers from downloaded content (idempotency)

从下载的内容中移除已有的标记(保证幂等性)

if grep -q '<!-- OMC:START -->' "$TEMP_OMC"; then

Extract content between markers

sed -n '/<!-- OMC:START -->/,/<!-- OMC:END -->/{//!p}' "$TEMP_OMC" > "${TEMP_OMC}.clean" mv "${TEMP_OMC}.clean" "$TEMP_OMC" fi
if [ ! -f "$TARGET_PATH" ]; then

Fresh install: wrap in markers

{ echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' } > "$TARGET_PATH" rm -f "$TEMP_OMC" echo "Installed CLAUDE.md (fresh)" else

Merge: preserve user content outside OMC markers

if grep -q '<!-- OMC:START -->' "$TARGET_PATH"; then # Has markers: replace OMC section, keep user content BEFORE_OMC=$(sed -n '1,/<!-- OMC:START -->/{ /<!-- OMC:START -->/!p }' "$TARGET_PATH") AFTER_OMC=$(sed -n '/<!-- OMC:END -->/,${ /<!-- OMC:END -->/!p }' "$TARGET_PATH") { [ -n "$BEFORE_OMC" ] && printf '%s\n' "$BEFORE_OMC" echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' [ -n "$AFTER_OMC" ] && printf '%s\n' "$AFTER_OMC" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "Updated OMC section (user customizations preserved)" else # No markers: wrap new content in markers, append old content as user section OLD_CONTENT=$(cat "$TARGET_PATH") { echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' echo "" echo "<!-- User customizations (migrated from previous CLAUDE.md) -->" printf '%s\n' "$OLD_CONTENT" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "Migrated existing CLAUDE.md (added OMC markers, preserved old content)" fi rm -f "$TEMP_OMC" fi
if grep -q '<!-- OMC:START -->' "$TEMP_OMC"; then

提取标记之间的内容

sed -n '/<!-- OMC:START -->/,/<!-- OMC:END -->/{//!p}' "$TEMP_OMC" > "${TEMP_OMC}.clean" mv "${TEMP_OMC}.clean" "$TEMP_OMC" fi
if [ ! -f "$TARGET_PATH" ]; then

全新安装:用标记包裹内容

{ echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' } > "$TARGET_PATH" rm -f "$TEMP_OMC" echo "已安装 CLAUDE.md(全新版本)" else

合并:保留 OMC 标记外的用户自定义内容

if grep -q '<!-- OMC:START -->' "$TARGET_PATH"; then # 已有标记:替换 OMC 部分,保留用户内容 BEFORE_OMC=$(sed -n '1,/<!-- OMC:START -->/{ /<!-- OMC:START -->/!p }' "$TARGET_PATH") AFTER_OMC=$(sed -n '/<!-- OMC:END -->/,${ /<!-- OMC:END -->/!p }' "$TARGET_PATH") { [ -n "$BEFORE_OMC" ] && printf '%s\n' "$BEFORE_OMC" echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' [ -n "$AFTER_OMC" ] && printf '%s\n' "$AFTER_OMC" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "已更新 OMC 部分(用户自定义内容已保留)" else # 无标记:用标记包裹新内容,将旧内容作为用户部分追加 OLD_CONTENT=$(cat "$TARGET_PATH") { echo '<!-- OMC:START -->' cat "$TEMP_OMC" echo '<!-- OMC:END -->' echo "" echo "<!-- 用户自定义内容(从之前的 CLAUDE.md 迁移) -->" printf '%s\n' "$OLD_CONTENT" } > "${TARGET_PATH}.tmp" mv "${TARGET_PATH}.tmp" "$TARGET_PATH" echo "已迁移现有 CLAUDE.md(添加了 OMC 标记,保留了旧内容)" fi rm -f "$TEMP_OMC" fi

Extract new version and report

提取新版本号并报告

NEW_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") if [ "$OLD_VERSION" = "none" ]; then echo "Installed CLAUDE.md: $NEW_VERSION" elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then echo "CLAUDE.md unchanged: $NEW_VERSION" else echo "Updated CLAUDE.md: $OLD_VERSION -> $NEW_VERSION" fi

**Note**: If an existing CLAUDE.md is found, it will be backed up to `~/.claude/CLAUDE.md.backup.YYYY-MM-DD` before downloading the new version.
NEW_VERSION=$(grep -m1 "^# oh-my-claudecode" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") if [ "$OLD_VERSION" = "none" ]; then echo "已安装 CLAUDE.md:$NEW_VERSION" elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then echo "CLAUDE.md 未变更:$NEW_VERSION" else echo "已更新 CLAUDE.md:$OLD_VERSION -> $NEW_VERSION" fi

**注意**:如果检测到已存在 CLAUDE.md,会在下载新版本前将其备份到 `~/.claude/CLAUDE.md.backup.YYYY-MM-DD`。

Clean Up Legacy Hooks (if present)

清理旧版钩子(如果存在)

Check if old manual hooks exist and remove them to prevent duplicates:
bash
undefined
检查是否存在旧的手动钩子并移除,避免重复执行:
bash
undefined

Remove legacy bash hook scripts (now handled by plugin system)

移除旧的 bash 钩子脚本(现在由插件系统处理)

rm -f ~/.claude/hooks/keyword-detector.sh rm -f ~/.claude/hooks/stop-continuation.sh rm -f ~/.claude/hooks/persistent-mode.sh rm -f ~/.claude/hooks/session-start.sh echo "Legacy hooks cleaned"

Check `~/.claude/settings.json` for manual hook entries. If the "hooks" key exists with UserPromptSubmit, Stop, or SessionStart entries pointing to bash scripts, inform the user:

> **Note**: Found legacy hooks in settings.json. These should be removed since the plugin now provides hooks automatically. Remove the "hooks" section from ~/.claude/settings.json to prevent duplicate hook execution.
rm -f ~/.claude/hooks/keyword-detector.sh rm -f ~/.claude/hooks/stop-continuation.sh rm -f ~/.claude/hooks/persistent-mode.sh rm -f ~/.claude/hooks/session-start.sh echo "已清理旧版钩子"

检查 `~/.claude/settings.json` 中的手动钩子条目。如果 "hooks" 键存在指向 bash 脚本的 UserPromptSubmit、Stop 或 SessionStart 条目,告知用户:

> **注意**:在 settings.json 中检测到旧版钩子。由于插件现在会自动提供钩子,这些旧钩子应该被移除。请从 ~/.claude/settings.json 中删除 "hooks" 部分,避免钩子重复执行。

Verify Plugin Installation

验证插件安装

bash
grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-claudecode"
bash
grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "插件已验证" || echo "未找到插件 - 请运行:claude /install-plugin oh-my-claudecode"

Confirm Global Configuration Success

确认全局配置成功

After completing global configuration, save progress and report:
bash
undefined
完成全局配置后,保存进度并报告:
bash
undefined

Save progress - Step 2 complete (Global config)

保存进度 - 步骤2完成(全局配置)

mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 2, "timestamp": "$(date -Iseconds)", "configType": "global" } EOF

**OMC Global Configuration Complete**
- CLAUDE.md: Updated with latest configuration from GitHub at ~/.claude/CLAUDE.md
- Backup: Previous CLAUDE.md backed up to `~/.claude/CLAUDE.md.backup.YYYY-MM-DD` (if existed)
- Scope: **GLOBAL** - applies to all Claude Code sessions
- Hooks: Provided by plugin (no manual installation needed)
- Agents: 28+ available (base + tiered variants)
- Model routing: Haiku/Sonnet/Opus based on task complexity

**Note**: Hooks are now managed by the plugin system automatically. No manual hook installation required.

If `--global` flag was used, clear state and **STOP HERE**:
```bash
rm -f ".omc/state/setup-state.json"
Do not continue to HUD setup or other steps.
mkdir -p .omc/state cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 2, "timestamp": "$(date -Iseconds)", "configType": "global" } EOF

**OMC 全局配置完成**
- CLAUDE.md:已从 GitHub 更新到最新配置,路径为 ~/.claude/CLAUDE.md
- 备份:之前的 CLAUDE.md 已备份到 `~/.claude/CLAUDE.md.backup.YYYY-MM-DD`(如果之前存在)
- 作用范围:**全局** - 适用于所有 Claude Code 会话
- 钩子:由插件提供(无需手动安装)
- 可用 Agent:28+ 个(基础版 + 分级变体)
- 模型路由:根据任务复杂度自动选择 Haiku/Sonnet/Opus

**注意**:钩子现在由插件系统自动管理,无需手动安装。

如果使用了 `--global` 标志,清除状态并**在此处停止**:
```bash
rm -f ".omc/state/setup-state.json"
不要继续进行 HUD 安装或其他步骤。

Step 3: Setup HUD Statusline

步骤3:安装 HUD 状态栏

Note: If resuming and lastCompletedStep >= 3, skip to Step 3.5.
The HUD shows real-time status in Claude Code's status bar. Invoke the hud skill to set up and configure:
Use the Skill tool to invoke:
hud
with args:
setup
This will:
  1. Install the HUD wrapper script to
    ~/.claude/hud/omc-hud.mjs
  2. Configure
    statusLine
    in
    ~/.claude/settings.json
  3. Report status and prompt to restart if needed
After HUD setup completes, save progress:
bash
undefined
注意:如果是恢复安装且 lastCompletedStep >=3,跳转到步骤3.5。
HUD 会在 Claude Code 的状态栏显示实时状态。调用 hud 技能来进行安装和配置:
使用 Skill 工具调用:
hud
,参数:
setup
这将:
  1. 安装 HUD 包装脚本到
    ~/.claude/hud/omc-hud.mjs
  2. ~/.claude/settings.json
    中配置
    statusLine
  3. 报告状态并提示是否需要重启
HUD 安装完成后,保存进度:
bash
undefined

Save progress - Step 3 complete (HUD setup)

保存进度 - 步骤3完成(HUD 安装)

mkdir -p .omc/state CONFIG_TYPE=$(cat ".omc/state/setup-state.json" 2>/dev/null | grep -oE '"configType":\s*"[^"]+"' | cut -d'"' -f4 || echo "unknown") cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 3, "timestamp": "$(date -Iseconds)", "configType": "$CONFIG_TYPE" } EOF
undefined
mkdir -p .omc/state CONFIG_TYPE=$(cat ".omc/state/setup-state.json" 2>/dev/null | grep -oE '"configType":\s*"[^"]+"' | cut -d'"' -f4 || echo "unknown") cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 3, "timestamp": "$(date -Iseconds)", "configType": "$CONFIG_TYPE" } EOF
undefined

Step 3.5: Clear Stale Plugin Cache

步骤3.5:清理过期插件缓存

Clear old cached plugin versions to avoid conflicts:
bash
undefined
清理旧的缓存插件版本,避免冲突:
bash
undefined

Clear stale plugin cache versions

清理过期的插件缓存版本

CACHE_DIR="$HOME/.claude/plugins/cache/omc/oh-my-claudecode" if [ -d "$CACHE_DIR" ]; then LATEST=$(ls -1 "$CACHE_DIR" | sort -V | tail -1) CLEARED=0 for dir in "$CACHE_DIR"/*; do if [ "$(basename "$dir")" != "$LATEST" ]; then rm -rf "$dir" CLEARED=$((CLEARED + 1)) fi done [ $CLEARED -gt 0 ] && echo "Cleared $CLEARED stale cache version(s)" || echo "Cache is clean" else echo "No cache directory found (normal for new installs)" fi
undefined
CACHE_DIR="$HOME/.claude/plugins/cache/omc/oh-my-claudecode" if [ -d "$CACHE_DIR" ]; then LATEST=$(ls -1 "$CACHE_DIR" | sort -V | tail -1) CLEARED=0 for dir in "$CACHE_DIR"/*; do if [ "$(basename "$dir")" != "$LATEST" ]; then rm -rf "$dir" CLEARED=$((CLEARED + 1)) fi done [ $CLEARED -gt 0 ] && echo "已清理 $CLEARED 个过期缓存版本" || echo "缓存已清理干净" else echo "未找到缓存目录(全新安装时为正常情况)" fi
undefined

Step 3.6: Check for Updates

步骤3.6:检查更新

Notify user if a newer version is available:
bash
undefined
如果有新版本可用,通知用户:
bash
undefined

Detect installed version

检测已安装的版本

INSTALLED_VERSION=""
INSTALLED_VERSION=""

Try cache directory first

先尝试从缓存目录获取

if [ -d "$HOME/.claude/plugins/cache/omc/oh-my-claudecode" ]; then INSTALLED_VERSION=$(ls -1 "$HOME/.claude/plugins/cache/omc/oh-my-claudecode" | sort -V | tail -1) fi
if [ -d "$HOME/.claude/plugins/cache/omc/oh-my-claudecode" ]; then INSTALLED_VERSION=$(ls -1 "$HOME/.claude/plugins/cache/omc/oh-my-claudecode" | sort -V | tail -1) fi

Try .omc-version.json second

再尝试从 .omc-version.json 获取

if [ -z "$INSTALLED_VERSION" ] && [ -f ".omc-version.json" ]; then INSTALLED_VERSION=$(grep -oE '"version":\s*"[^"]+' .omc-version.json | cut -d'"' -f4) fi
if [ -z "$INSTALLED_VERSION" ] && [ -f ".omc-version.json" ]; then INSTALLED_VERSION=$(grep -oE '"version":\s*"[^"]+' .omc-version.json | cut -d'"' -f4) fi

Try CLAUDE.md header third (local first, then global)

最后尝试从 CLAUDE.md 头部获取(先本地,后全局)

if [ -z "$INSTALLED_VERSION" ]; then if [ -f ".claude/CLAUDE.md" ]; then INSTALLED_VERSION=$(grep -m1 "^# oh-my-claudecode" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' | sed 's/^v//') elif [ -f "$HOME/.claude/CLAUDE.md" ]; then INSTALLED_VERSION=$(grep -m1 "^# oh-my-claudecode" "$HOME/.claude/CLAUDE.md" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' | sed 's/^v//') fi fi
if [ -z "$INSTALLED_VERSION" ]; then if [ -f ".claude/CLAUDE.md" ]; then INSTALLED_VERSION=$(grep -m1 "^# oh-my-claudecode" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' | sed 's/^v//') elif [ -f "$HOME/.claude/CLAUDE.md" ]; then INSTALLED_VERSION=$(grep -m1 "^# oh-my-claudecode" "$HOME/.claude/CLAUDE.md" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' | sed 's/^v//') fi fi

Check npm for latest version

检查 npm 上的最新版本

LATEST_VERSION=$(npm view oh-my-claude-sisyphus version 2>/dev/null)
if [ -n "$INSTALLED_VERSION" ] && [ -n "$LATEST_VERSION" ]; then

Simple version comparison (assumes semantic versioning)

if [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then echo "" echo "UPDATE AVAILABLE:" echo " Installed: v$INSTALLED_VERSION" echo " Latest: v$LATEST_VERSION" echo "" echo "To update, run: claude /install-plugin oh-my-claudecode" else echo "You're on the latest version: v$INSTALLED_VERSION" fi elif [ -n "$LATEST_VERSION" ]; then echo "Latest version available: v$LATEST_VERSION" fi
undefined
LATEST_VERSION=$(npm view oh-my-claude-sisyphus version 2>/dev/null)
if [ -n "$INSTALLED_VERSION" ] && [ -n "$LATEST_VERSION" ]; then

简单版本比较(假设使用语义化版本)

if [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then echo "" echo "发现更新:" echo " 已安装版本:v$INSTALLED_VERSION" echo " 最新版本: v$LATEST_VERSION" echo "" echo "如需更新,请运行:claude /install-plugin oh-my-claudecode" else echo "你当前使用的是最新版本:v$INSTALLED_VERSION" fi elif [ -n "$LATEST_VERSION" ]; then echo "可用最新版本:v$LATEST_VERSION" fi
undefined

Step 3.7: Set Default Execution Mode

步骤3.7:设置默认执行模式

Use the AskUserQuestion tool to prompt the user:
Question: "Which parallel execution mode should be your default when you say 'fast' or 'parallel'?"
Options:
  1. ultrawork (maximum capability) - Uses all agent tiers including Opus for complex tasks. Best for challenging work where quality matters most. (Recommended)
  2. ecomode (token efficient) - Prefers Haiku/Sonnet agents, avoids Opus. Best for pro-plan users who want cost efficiency.
Store the preference in
~/.claude/.omc-config.json
:
bash
undefined
使用 AskUserQuestion 工具提示用户:
问题:当你使用 "fast" 或 "parallel" 时,默认应使用哪种并行执行模式?
选项
  1. ultrawork(最大能力) - 使用所有 Agent 层级,包括处理复杂任务的 Opus。最适合对质量要求高的挑战性工作。(推荐)
  2. ecomode(令牌高效) - 优先使用 Haiku/Sonnet Agent,避免使用 Opus。最适合想要控制成本的专业版用户。
将偏好保存到
~/.claude/.omc-config.json
bash
undefined

Read existing config or create empty object

读取现有配置或创建空对象

CONFIG_FILE="$HOME/.claude/.omc-config.json" mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then EXISTING=$(cat "$CONFIG_FILE") else EXISTING='{}' fi
CONFIG_FILE="$HOME/.claude/.omc-config.json" mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then EXISTING=$(cat "$CONFIG_FILE") else EXISTING='{}' fi

Set defaultExecutionMode (replace USER_CHOICE with "ultrawork" or "ecomode")

设置 defaultExecutionMode(将 USER_CHOICE 替换为 "ultrawork" 或 "ecomode")

echo "$EXISTING" | jq --arg mode "USER_CHOICE" '. + {defaultExecutionMode: $mode, configuredAt: (now | todate)}' > "$CONFIG_FILE" echo "Default execution mode set to: USER_CHOICE"

**Note**: This preference ONLY affects generic keywords ("fast", "parallel"). Explicit keywords ("ulw", "eco") always override this preference.
echo "$EXISTING" | jq --arg mode "USER_CHOICE" '. + {defaultExecutionMode: $mode, configuredAt: (now | todate)}' > "$CONFIG_FILE" echo "默认执行模式已设置为:USER_CHOICE"

**注意**:此偏好仅影响通用关键词("fast"、"parallel")。明确的关键词("ulw"、"eco")会始终覆盖此偏好。

Optional: Disable Ecomode Entirely

可选:完全禁用 Ecomode

If the user wants to disable ecomode completely (so ecomode keywords are ignored), add to the config:
bash
echo "$EXISTING" | jq '. + {ecomode: {enabled: false}}' > "$CONFIG_FILE"
echo "Ecomode disabled completely"
如果用户想要完全禁用 ecomode(忽略 ecomode 关键词),添加到配置中:
bash
echo "$EXISTING" | jq '. + {ecomode: {enabled: false}}' > "$CONFIG_FILE"
echo "已完全禁用 Ecomode"

Step 3.8: Install CLI Analytics Tools (Optional)

步骤3.8:安装 CLI 分析工具(可选)

The OMC CLI provides standalone token analytics commands (
omc stats
,
omc agents
,
omc tui
).
Ask user: "Would you like to install the OMC CLI for standalone analytics? (Recommended for tracking token usage and costs)"
Options:
  1. Yes (Recommended) - Install CLI tools globally for
    omc stats
    ,
    omc agents
    , etc.
  2. No - Skip CLI installation, use only plugin skills
OMC CLI 提供独立的令牌分析命令(
omc stats
omc agents
omc tui
)。
询问用户:"你想要安装 OMC CLI 以进行独立分析吗?(推荐用于跟踪令牌使用情况和成本)"
选项
  1. 是(推荐) - 全局安装 CLI 工具,使用
    omc stats
    omc agents
    等命令
  2. - 跳过 CLI 安装,仅使用插件技能

CLI Installation Note

CLI 安装说明

The CLI (
omc
command) is no longer supported via npm/bun global install.
All functionality is available through the plugin system:
  • Use
    /oh-my-claudecode:help
    for guidance
  • Use
    /oh-my-claudecode:doctor
    for diagnostics
Skip this step - the plugin provides all features.
CLI(
omc
命令)不再支持通过 npm/bun 全局安装。
所有功能都可通过插件系统使用:
  • 使用
    /oh-my-claudecode:help
    获取指导
  • 使用
    /oh-my-claudecode:doctor
    进行诊断
跳过此步骤 - 插件已提供所有功能。

Step 3.8.5: Select Task Management Tool

步骤3.8.5:选择任务管理工具

First, detect available task tools:
bash
undefined
首先,检测可用的任务工具:
bash
undefined

Detect beads (bd)

检测 beads (bd)

BD_VERSION="" if command -v bd &>/dev/null; then BD_VERSION=$(bd --version 2>/dev/null | head -1 || echo "installed") fi
BD_VERSION="" if command -v bd &>/dev/null; then BD_VERSION=$(bd --version 2>/dev/null | head -1 || echo "已安装") fi

Detect beads-rust (br)

检测 beads-rust (br)

BR_VERSION="" if command -v br &>/dev/null; then BR_VERSION=$(br --version 2>/dev/null | head -1 || echo "installed") fi
BR_VERSION="" if command -v br &>/dev/null; then BR_VERSION=$(br --version 2>/dev/null | head -1 || echo "已安装") fi

Report findings

报告检测结果

if [ -n "$BD_VERSION" ]; then echo "Found beads (bd): $BD_VERSION" fi if [ -n "$BR_VERSION" ]; then echo "Found beads-rust (br): $BR_VERSION" fi if [ -z "$BD_VERSION" ] && [ -z "$BR_VERSION" ]; then echo "No external task tools found. Using built-in Tasks." fi

If **neither** beads nor beads-rust is detected, skip this step (default to built-in).

If beads or beads-rust is detected, use AskUserQuestion:

**Question:** "Which task management tool should I use for tracking work?"

**Options:**
1. **Built-in Tasks (default)** - Use Claude Code's native TaskCreate/TodoWrite. Tasks are session-only.
2. **Beads (bd)** - Git-backed persistent tasks. Survives across sessions. [Only if detected]
3. **Beads-Rust (br)** - Lightweight Rust port of beads. [Only if detected]

(Only show options 2/3 if the corresponding tool is detected)

Store the preference:

```bash
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"

if [ -f "$CONFIG_FILE" ]; then
  EXISTING=$(cat "$CONFIG_FILE")
else
  EXISTING='{}'
fi
if [ -n "$BD_VERSION" ]; then echo "已检测到 beads (bd):$BD_VERSION" fi if [ -n "$BR_VERSION" ]; then echo "已检测到 beads-rust (br):$BR_VERSION" fi if [ -z "$BD_VERSION" ] && [ -z "$BR_VERSION" ]; then echo "未找到外部任务工具,将使用内置任务系统。" fi

如果**既没有**检测到 beads 也没有检测到 beads-rust,跳过此步骤(默认使用内置系统)。

如果检测到 beads 或 beads-rust,使用 AskUserQuestion:

**问题**:我应该使用哪种任务管理工具来跟踪工作?

**选项**:
1. **内置任务系统(默认)** - 使用 Claude Code 原生的 TaskCreate/TodoWrite。任务仅在当前会话有效。
2. **Beads (bd)** - 基于 Git 的持久化任务,可跨会话保存。[仅当检测到时显示]
3. **Beads-Rust (br)** - 轻量级 Rust 版本的 beads。[仅当检测到时显示]

(仅在检测到对应工具时显示选项2/3)

保存偏好:

```bash
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"

if [ -f "$CONFIG_FILE" ]; then
  EXISTING=$(cat "$CONFIG_FILE")
else
  EXISTING='{}'
fi

USER_CHOICE is "builtin", "beads", or "beads-rust" based on user selection

根据用户选择,将 USER_CHOICE 替换为 "builtin"、"beads" 或 "beads-rust"

echo "$EXISTING" | jq --arg tool "USER_CHOICE" '. + {taskTool: $tool, taskToolConfig: {injectInstructions: true, useMcp: false}}' > "$CONFIG_FILE" echo "Task tool set to: USER_CHOICE"

**Note:** The beads context instructions will be injected automatically on the next session start. No restart is needed for config to take effect.
echo "$EXISTING" | jq --arg tool "USER_CHOICE" '. + {taskTool: $tool, taskToolConfig: {injectInstructions: true, useMcp: false}}' > "$CONFIG_FILE" echo "任务工具已设置为:USER_CHOICE"

**注意**:beads 上下文说明会在下次会话启动时自动注入,无需重启即可生效。

Step 4: Verify Plugin Installation

步骤4:验证插件安装

bash
grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-claudecode"
bash
grep -q "oh-my-claudecode" ~/.claude/settings.json && echo "插件已验证" || echo "未找到插件 - 请运行:claude /install-plugin oh-my-claudecode"

Step 5: Offer MCP Server Configuration

步骤5:提供 MCP 服务器配置

MCP servers extend Claude Code with additional tools (web search, GitHub, etc.).
Ask user: "Would you like to configure MCP servers for enhanced capabilities? (Context7, Exa search, GitHub, etc.)"
If yes, invoke the mcp-setup skill:
/oh-my-claudecode:mcp-setup
If no, skip to next step.
MCP 服务器为 Claude Code 扩展了额外工具(网页搜索、GitHub 等)。
询问用户:"你想要配置 MCP 服务器以增强功能吗?(Context7、Exa 搜索、GitHub 等)"
如果用户选择是,调用 mcp-setup 技能:
/oh-my-claudecode:mcp-setup
如果用户选择否,跳转到下一步。

Step 5.5: Configure Agent Teams (Optional)

步骤5.5:配置 Agent Teams(可选)

Note: If resuming and lastCompletedStep >= 5.5, skip to Step 6.
Agent teams are an experimental Claude Code feature that lets you spawn N coordinated agents working on a shared task list with inter-agent messaging. Teams are disabled by default and require enabling via
settings.json
.
Use the AskUserQuestion tool to prompt:
Question: "Would you like to enable agent teams? Teams let you spawn coordinated agents (e.g.,
/team 3:executor 'fix all errors'
). This is an experimental Claude Code feature."
Options:
  1. Yes, enable teams (Recommended) - Enable the experimental feature and configure defaults
  2. No, skip - Leave teams disabled (can enable later)
注意:如果是恢复安装且 lastCompletedStep >=5.5,跳转到步骤6。
Agent Teams 是 Claude Code 的实验性功能,允许你生成 N 个协同工作的 Agent,它们共享任务列表并支持 Agent 间消息传递。Teams 默认禁用,需要通过
settings.json
启用。
使用 AskUserQuestion 工具提示用户:
问题:你想要启用 Agent Teams 吗?Teams 允许你生成协同工作的 Agent(例如:
/team 3:executor '修复所有错误'
)。这是 Claude Code 的实验性功能。
选项
  1. 是,启用 Teams(推荐) - 启用此实验性功能并配置默认设置
  2. 否,跳过 - 保持 Teams 禁用状态(可稍后启用)

If User Chooses YES:

若用户选择是:

Step 5.5.1: Enable Agent Teams in settings.json

步骤5.5.1:在 settings.json 中启用 Agent Teams

CRITICAL: Agent teams require
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
to be set in
~/.claude/settings.json
. This must be done carefully to preserve existing user settings.
First, read the current settings.json:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"

if [ -f "$SETTINGS_FILE" ]; then
  echo "Current settings.json found"
  cat "$SETTINGS_FILE"
else
  echo "No settings.json found - will create one"
fi
Then use the Read tool to read
~/.claude/settings.json
(if it exists). Use the Edit tool to merge the teams configuration while preserving ALL existing settings.
If settings.json exists and has an
env
key
, merge the new env var into it:
json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
Use jq to safely merge without overwriting existing settings:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"

if [ -f "$SETTINGS_FILE" ]; then
  # Merge env var into existing settings, preserving everything else
  TEMP_FILE=$(mktemp)
  jq '.env = (.env // {} | . + {"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"})' "$SETTINGS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$SETTINGS_FILE"
  echo "Added CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to existing settings.json"
else
  # Create new settings.json with just the teams env var
  mkdir -p "$(dirname "$SETTINGS_FILE")"
  cat > "$SETTINGS_FILE" << 'SETTINGS_EOF'
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
SETTINGS_EOF
  echo "Created settings.json with teams enabled"
fi
IMPORTANT: The Edit tool is preferred for modifying settings.json when possible, since it preserves formatting and comments. The jq approach above is the fallback for when the file needs structural merging.
关键:Agent Teams 需要在
~/.claude/settings.json
中设置
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
。操作时必须小心,以保留现有用户设置。
首先,读取当前的 settings.json:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"

if [ -f "$SETTINGS_FILE" ]; then
  echo "找到当前 settings.json"
  cat "$SETTINGS_FILE"
else
  echo "未找到 settings.json - 将创建新文件"
fi
然后使用 Read 工具读取
~/.claude/settings.json
(如果存在)。使用 Edit 工具合并 Teams 配置,同时保留所有现有设置。
如果 settings.json 存在且有
env
,将新的环境变量合并到其中:
json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
使用 jq 安全合并,避免覆盖现有设置:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"

if [ -f "$SETTINGS_FILE" ]; then
  # 将环境变量合并到现有设置中,保留所有其他内容
  TEMP_FILE=$(mktemp)
  jq '.env = (.env // {} | . + {"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"})' "$SETTINGS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$SETTINGS_FILE"
  echo "已将 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 添加到现有 settings.json"
else
  # 创建仅包含 Teams 环境变量的新 settings.json
  mkdir -p "$(dirname "$SETTINGS_FILE")"
  cat > "$SETTINGS_FILE" << 'SETTINGS_EOF'
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
SETTINGS_EOF
  echo "已创建启用 Teams 的 settings.json"
fi
重要:如果可能,优先使用 Edit 工具修改 settings.json,因为它能保留格式和注释。上述 jq 方法是在需要结构化合并时的回退方案。

Step 5.5.2: Configure Teammate Display Mode

步骤5.5.2:配置队友显示模式

Use the AskUserQuestion tool:
Question: "How should teammates be displayed?"
Options:
  1. Auto (Recommended) - Uses split panes if in tmux, otherwise in-process. Best for most users.
  2. In-process - All teammates in your main terminal. Use Shift+Up/Down to select. Works everywhere.
  3. Split panes (tmux) - Each teammate in its own pane. Requires tmux or iTerm2.
If user chooses anything other than "Auto", add
teammateMode
to settings.json:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"
使用 AskUserQuestion 工具:
问题:队友应该如何显示?
选项
  1. 自动(推荐) - 如果在 tmux 中使用分屏,否则使用进程内模式。最适合大多数用户。
  2. 进程内 - 所有队友都在你的主终端中。使用 Shift+上/下选择。在所有环境中都能工作。
  3. 分屏(tmux) - 每个队友在独立的分屏中。需要 tmux 或 iTerm2。
如果用户选择除「自动」外的选项,将
teammateMode
添加到 settings.json:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"

TEAMMATE_MODE is "in-process" or "tmux" based on user choice

根据用户选择,将 TEAMMATE_MODE 替换为 "in-process" 或 "tmux"

Skip this if user chose "Auto" (that's the default)

如果用户选择「自动」则跳过此步骤(这是默认设置)

jq --arg mode "TEAMMATE_MODE" '. + {teammateMode: $mode}' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" && mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE" echo "Teammate display mode set to: TEAMMATE_MODE"
undefined
jq --arg mode "TEAMMATE_MODE" '. + {teammateMode: $mode}' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" && mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE" echo "队友显示模式已设置为:TEAMMATE_MODE"
undefined

Step 5.5.3: Configure Team Defaults in omc-config

步骤5.5.3:在 omc-config 中配置 Team 默认值

Use the AskUserQuestion tool with multiple questions:
Question 1: "How many agents should teams spawn by default?"
Options:
  1. 3 agents (Recommended) - Good balance of speed and resource usage
  2. 5 agents (maximum) - Maximum parallelism for large tasks
  3. 2 agents - Conservative, for smaller projects
Question 2: "Which agent type should teammates use by default?"
Options:
  1. executor (Recommended) - General-purpose code implementation agent
  2. build-fixer - Specialized for build/type error fixing
  3. designer - Specialized for UI/frontend work
Store the team configuration in
~/.claude/.omc-config.json
:
bash
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"

if [ -f "$CONFIG_FILE" ]; then
  EXISTING=$(cat "$CONFIG_FILE")
else
  EXISTING='{}'
fi
使用 AskUserQuestion 工具提出多个问题:
问题1:Teams 默认应生成多少个 Agent?
选项
  1. 3 个 Agent(推荐) - 在速度和资源使用间取得良好平衡
  2. 5 个 Agent(最大) - 为大型任务提供最大并行度
  3. 2 个 Agent - 保守配置,适合小型项目
问题2:队友默认应使用哪种 Agent 类型?
选项
  1. executor(推荐) - 通用代码实现 Agent
  2. build-fixer - 专门用于修复构建/类型错误
  3. designer - 专门用于 UI/前端工作
将 Team 配置保存到
~/.claude/.omc-config.json
bash
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"

if [ -f "$CONFIG_FILE" ]; then
  EXISTING=$(cat "$CONFIG_FILE")
else
  EXISTING='{}'
fi

Replace MAX_AGENTS, AGENT_TYPE with user choices

将 MAX_AGENTS、AGENT_TYPE 替换为用户选择的值

echo "$EXISTING" | jq
--argjson maxAgents MAX_AGENTS
--arg agentType "AGENT_TYPE"
'. + {team: {maxAgents: $maxAgents, defaultAgentType: $agentType, monitorIntervalMs: 30000, shutdownTimeoutMs: 15000}}' > "$CONFIG_FILE"
echo "Team configuration saved:" echo " Max agents: MAX_AGENTS" echo " Default agent: AGENT_TYPE" echo " Model: teammates inherit your session model"

**Note:** Teammates do not have a separate model default. Each teammate is a full Claude Code session that inherits your configured model. Subagents spawned by teammates can use any model tier.
echo "$EXISTING" | jq
--argjson maxAgents MAX_AGENTS
--arg agentType "AGENT_TYPE"
'. + {team: {maxAgents: $maxAgents, defaultAgentType: $agentType, monitorIntervalMs: 30000, shutdownTimeoutMs: 15000}}' > "$CONFIG_FILE"
echo "Team 配置已保存:" echo " 最大 Agent 数:MAX_AGENTS" echo " 默认 Agent 类型:AGENT_TYPE" echo " 模型:队友继承你的会话模型"

**注意**:队友没有单独的模型默认值。每个队友都是完整的 Claude Code 会话,会继承你配置的模型。由队友生成的子 Agent 可以使用任何模型层级。

Verify settings.json Integrity

验证 settings.json 完整性

After all modifications, verify settings.json is valid JSON and contains the expected keys:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"
完成所有修改后,验证 settings.json 是有效的 JSON 且包含预期的键:
bash
SETTINGS_FILE="$HOME/.claude/settings.json"

Verify JSON is valid

验证 JSON 是否有效

if jq empty "$SETTINGS_FILE" 2>/dev/null; then echo "settings.json: valid JSON" else echo "ERROR: settings.json is invalid JSON! Restoring from backup..."

The backup from Step 2 should still exist

exit 1 fi
if jq empty "$SETTINGS_FILE" 2>/dev/null; then echo "settings.json:有效的 JSON" else echo "错误:settings.json 是无效的 JSON!正在从备份恢复..."

步骤2中的备份应该仍然存在

exit 1 fi

Verify teams env var is present

验证 Teams 环境变量是否存在

if jq -e '.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS' "$SETTINGS_FILE" > /dev/null 2>&1; then echo "Agent teams: ENABLED" else echo "WARNING: Agent teams env var not found in settings.json" fi
if jq -e '.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS' "$SETTINGS_FILE" > /dev/null 2>&1; then echo "Agent Teams:已启用" else echo "警告:在 settings.json 中未找到 Teams 环境变量" fi

Show final settings.json for user review

显示最终的 settings.json 供用户查看

echo "" echo "Final settings.json:" jq '.' "$SETTINGS_FILE"
undefined
echo "" echo "最终的 settings.json:" jq '.' "$SETTINGS_FILE"
undefined

If User Chooses NO:

若用户选择否:

Skip this step. Agent teams will remain disabled. User can enable later by adding to
~/.claude/settings.json
:
json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
Or by running
/oh-my-claudecode:omc-setup --force
and choosing to enable teams.
跳过此步骤。Agent Teams 将保持禁用状态。用户可稍后通过在
~/.claude/settings.json
中添加以下内容启用:
json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  }
}
或运行
/oh-my-claudecode:omc-setup --force
并选择启用 Teams。

Save Progress

保存进度

bash
undefined
bash
undefined

Save progress - Step 5.5 complete (Teams configured)

保存进度 - 步骤5.5完成(Teams 已配置)

mkdir -p .omc/state CONFIG_TYPE=$(cat ".omc/state/setup-state.json" 2>/dev/null | grep -oE '"configType":\s*"[^"]+"' | cut -d'"' -f4 || echo "unknown") cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 5.5, "timestamp": "$(date -Iseconds)", "configType": "$CONFIG_TYPE" } EOF
undefined
mkdir -p .omc/state CONFIG_TYPE=$(cat ".omc/state/setup-state.json" 2>/dev/null | grep -oE '"configType":\s*"[^"]+"' | cut -d'"' -f4 || echo "unknown") cat > ".omc/state/setup-state.json" << EOF { "lastCompletedStep": 5.5, "timestamp": "$(date -Iseconds)", "configType": "$CONFIG_TYPE" } EOF
undefined

Step 6: Detect Upgrade from 2.x

步骤6:检测从 2.x 版本升级

Check if user has existing configuration:
bash
undefined
检查用户是否有现有配置:
bash
undefined

Check for existing 2.x artifacts

检查是否存在 2.x 版本的文件

ls ~/.claude/commands/ralph-loop.md 2>/dev/null || ls ~/.claude/commands/ultrawork.md 2>/dev/null

If found, this is an upgrade from 2.x.
ls ~/.claude/commands/ralph-loop.md 2>/dev/null || ls ~/.claude/commands/ultrawork.md 2>/dev/null

如果找到,说明是从 2.x 版本升级。

Step 7: Show Welcome Message

步骤7:显示欢迎消息

For New Users:

针对新用户:

OMC Setup Complete!

You don't need to learn any commands. I now have intelligent behaviors that activate automatically.

WHAT HAPPENS AUTOMATICALLY:
- Complex tasks -> I parallelize and delegate to specialists
- "plan this" -> I start a planning interview
- "don't stop until done" -> I persist until verified complete
- "stop" or "cancel" -> I intelligently stop current operation

MAGIC KEYWORDS (optional power-user shortcuts):
Just include these words naturally in your request:

| Keyword | Effect | Example |
|---------|--------|---------|
| ralph | Persistence mode | "ralph: fix the auth bug" |
| ralplan | Iterative planning | "ralplan this feature" |
| ulw | Max parallelism | "ulw refactor the API" |
| eco | Token-efficient mode | "eco refactor the API" |
| plan | Planning interview | "plan the new endpoints" |
| team | Coordinated agents | "/team 3:executor fix errors" |

**ralph includes ultrawork:** When you activate ralph mode, it automatically includes ultrawork's parallel execution. No need to combine keywords.

TEAMS:
Spawn coordinated agents with shared task lists and real-time messaging:
- /oh-my-claudecode:team 3:executor "fix all TypeScript errors"
- /oh-my-claudecode:team 5:build-fixer "fix build errors in src/"
Teams use Claude Code native tools (TeamCreate/SendMessage/TaskCreate).

MCP SERVERS:
Run /oh-my-claudecode:mcp-setup to add tools like web search, GitHub, etc.

HUD STATUSLINE:
The status bar now shows OMC state. Restart Claude Code to see it.

CLI ANALYTICS (if installed):
- omc           - Full dashboard (stats + agents + cost)
- omc stats     - View token usage and costs
- omc agents    - See agent breakdown by cost
- omc tui       - Launch interactive TUI dashboard

That's it! Just use Claude Code normally.
OMC 安装设置完成!

你无需学习任何命令。我现在具备了自动触发的智能行为。

自动执行的操作:
- 复杂任务 → 我会并行处理并委派给专业 Agent
- "plan this" → 我会启动规划会话
- "don't stop until done" → 我会持续工作直到验证完成
- "stop" 或 "cancel" → 我会智能停止当前操作

魔法关键词(可选的高级用户快捷方式):
只需在请求中自然包含这些词:

| 关键词 | 效果 | 示例 |
|---------|--------|---------|
| ralph | 持久化模式 | "ralph: 修复认证 bug" |
| ralplan | 迭代规划 | "ralplan 这个功能" |
| ulw | 最大并行度 | "ulw 重构 API" |
| eco | 令牌高效模式 | "eco 重构 API" |
| plan | 规划会话 | "plan 新的端点" |
| team | 协同 Agent | "/team 3:executor 修复错误" |

**ralph 包含 ultrawork**:当你激活 ralph 模式时,它会自动包含 ultrawork 的并行执行。无需组合关键词。

TEAMS:
生成协同工作的 Agent,共享任务列表并支持实时消息传递:
- /oh-my-claudecode:team 3:executor "修复所有 TypeScript 错误"
- /oh-my-claudecode:team 5:build-fixer "修复 src/ 中的构建错误"
Teams 使用 Claude Code 原生工具(TeamCreate/SendMessage/TaskCreate)。

MCP 服务器:
运行 /oh-my-claudecode:mcp-setup 添加网页搜索、GitHub 等工具。

HUD 状态栏:
状态栏现在会显示 OMC 状态。重启 Claude Code 即可看到。

CLI 分析工具(如果已安装):
- omc           - 完整仪表板(统计 + Agent + 成本)
- omc stats     - 查看令牌使用情况和成本
- omc agents    - 查看按成本划分的 Agent 明细
- omc tui       - 启动交互式 TUI 仪表板

就是这样!正常使用 Claude Code 即可。

For Users Upgrading from 2.x:

针对从 2.x 版本升级的用户:

OMC Setup Complete! (Upgraded from 2.x)

GOOD NEWS: Your existing commands still work!
- /ralph, /ultrawork, /plan, etc. all still function

WHAT'S NEW in 3.0:
You no longer NEED those commands. Everything is automatic now:
- Just say "don't stop until done" instead of /ralph
- Just say "fast" or "parallel" instead of /ultrawork
- Just say "plan this" instead of /plan
- Just say "stop" instead of /cancel

MAGIC KEYWORDS (power-user shortcuts):
| Keyword | Same as old... | Example |
|---------|----------------|---------|
| ralph | /ralph | "ralph: fix the bug" |
| ralplan | /ralplan | "ralplan this feature" |
| ulw | /ultrawork | "ulw refactor API" |
| eco | (new!) | "eco fix all errors" |
| plan | /plan | "plan the endpoints" |
| team | (new!) | "/team 3:executor fix errors" |

TEAMS (NEW!):
Spawn coordinated agents with shared task lists and real-time messaging:
- /oh-my-claudecode:team 3:executor "fix all TypeScript errors"
- Uses Claude Code native tools (TeamCreate/SendMessage/TaskCreate)

HUD STATUSLINE:
The status bar now shows OMC state. Restart Claude Code to see it.

CLI ANALYTICS (if installed):
- omc           - Full dashboard (stats + agents + cost)
- omc stats     - View token usage and costs
- omc agents    - See agent breakdown by cost
- omc tui       - Launch interactive TUI dashboard

Your workflow won't break - it just got easier!
OMC 安装设置完成!(从 2.x 版本升级)

好消息:你现有的命令仍然可以使用!
- /ralph、/ultrawork、/plan 等命令都能正常工作

3.0 版本的新特性:
你不再需要这些命令。现在一切都是自动的:
- 只需说 "don't stop until done" 而不是 /ralph
- 只需说 "fast" 或 "parallel" 而不是 /ultrawork
- 只需说 "plan this" 而不是 /plan
- 只需说 "stop" 而不是 /cancel

魔法关键词(高级用户快捷方式):
| 关键词 | 等同于旧命令... | 示例 |
|---------|----------------|---------|
| ralph | /ralph | "ralph: 修复 bug" |
| ralplan | /ralplan | "ralplan 这个功能" |
| ulw | /ultrawork | "ulw 重构 API" |
| eco | (新增!) | "eco 修复所有错误" |
| plan | /plan | "plan 新的端点" |
| team | (新增!) | "/team 3:executor 修复错误" |

TEAMS(新增!):
生成协同工作的 Agent,共享任务列表并支持实时消息传递:
- /oh-my-claudecode:team 3:executor "修复所有 TypeScript 错误"
- 使用 Claude Code 原生工具(TeamCreate/SendMessage/TaskCreate)

HUD 状态栏:
状态栏现在会显示 OMC 状态。重启 Claude Code 即可看到。

CLI 分析工具(如果已安装):
- omc           - 完整仪表板(统计 + Agent + 成本)
- omc stats     - 查看令牌使用情况和成本
- omc agents    - 查看按成本划分的 Agent 明细
- omc tui       - 启动交互式 TUI 仪表板

你的工作流程不会中断 - 只会变得更简单!

Step 8: Ask About Starring Repository

步骤8:询问是否为仓库点赞

First, check if
gh
CLI is available and authenticated:
bash
gh auth status &>/dev/null
首先,检查
gh
CLI 是否可用且已认证:
bash
gh auth status &>/dev/null

If gh is available and authenticated:

若 gh 可用且已认证:

Use the AskUserQuestion tool to prompt the user:
Question: "If you're enjoying oh-my-claudecode, would you like to support the project by starring it on GitHub?"
Options:
  1. Yes, star it! - Star the repository
  2. No thanks - Skip without further prompts
  3. Maybe later - Skip without further prompts
If user chooses "Yes, star it!":
bash
gh api -X PUT /user/starred/Yeachan-Heo/oh-my-claudecode 2>/dev/null && echo "Thanks for starring! ⭐" || true
Note: Fail silently if the API call doesn't work - never block setup completion.
使用 AskUserQuestion 工具提示用户:
问题:如果你喜欢 oh-my-claudecode,你想要通过在 GitHub 上为仓库点赞来支持项目吗?
选项
  1. 是,点赞! - 为仓库点赞
  2. 不用了,谢谢 - 跳过,不进行后续提示
  3. 以后再说 - 跳过,不进行后续提示
如果用户选择「是,点赞!」:
bash
gh api -X PUT /user/starred/Yeachan-Heo/oh-my-claudecode 2>/dev/null && echo "感谢你的点赞! ⭐" || true
注意:如果 API 调用失败,静默处理 - 绝不能阻止安装完成。

If gh is NOT available or not authenticated:

若 gh 不可用或未认证:

bash
echo ""
echo "If you enjoy oh-my-claudecode, consider starring the repo:"
echo "  https://github.com/Yeachan-Heo/oh-my-claudecode"
echo ""
bash
echo ""
echo "如果你喜欢 oh-my-claudecode,考虑为仓库点赞:"
echo "  https://github.com/Yeachan-Heo/oh-my-claudecode"
echo ""

Clear Setup State and Mark Completion

清除安装状态并标记完成

After Step 8 completes (regardless of star choice), clear the temporary state and mark setup as completed:
bash
undefined
步骤8完成后(无论用户是否选择点赞),清除临时状态并标记安装完成:
bash
undefined

Setup complete - clear temporary state file

安装完成 - 清除临时状态文件

rm -f ".omc/state/setup-state.json"
rm -f ".omc/state/setup-state.json"

Mark setup as completed in persistent config (prevents re-running full setup on updates)

在持久化配置中标记安装完成(避免在更新时重新运行完整安装)

CONFIG_FILE="$HOME/.claude/.omc-config.json" mkdir -p "$(dirname "$CONFIG_FILE")"
CONFIG_FILE="$HOME/.claude/.omc-config.json" mkdir -p "$(dirname "$CONFIG_FILE")"

Get current OMC version from CLAUDE.md

从 CLAUDE.md 获取当前 OMC 版本

OMC_VERSION="" if [ -f ".claude/CLAUDE.md" ]; then OMC_VERSION=$(grep -m1 "^# oh-my-claudecode" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") elif [ -f "$HOME/.claude/CLAUDE.md" ]; then OMC_VERSION=$(grep -m1 "^# oh-my-claudecode" "$HOME/.claude/CLAUDE.md" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") fi
if [ -f "$CONFIG_FILE" ]; then EXISTING=$(cat "$CONFIG_FILE") else EXISTING='{}' fi
OMC_VERSION="" if [ -f ".claude/CLAUDE.md" ]; then OMC_VERSION=$(grep -m1 "^# oh-my-claudecode" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") elif [ -f "$HOME/.claude/CLAUDE.md" ]; then OMC_VERSION=$(grep -m1 "^# oh-my-claudecode" "$HOME/.claude/CLAUDE.md" 2>/dev/null | grep -oE 'v[0-9]+.[0-9]+.[0-9]+' || echo "unknown") fi
if [ -f "$CONFIG_FILE" ]; then EXISTING=$(cat "$CONFIG_FILE") else EXISTING='{}' fi

Add setupCompleted timestamp and version

添加 setupCompleted 时间戳和版本号

echo "$EXISTING" | jq --arg ts "$(date -Iseconds)" --arg ver "$OMC_VERSION"
'. + {setupCompleted: $ts, setupVersion: $ver}' > "$CONFIG_FILE"
echo "Setup completed successfully!" echo "Note: Future updates will only refresh CLAUDE.md, not the full setup wizard."
undefined
echo "$EXISTING" | jq --arg ts "$(date -Iseconds)" --arg ver "$OMC_VERSION"
'. + {setupCompleted: $ts, setupVersion: $ver}' > "$CONFIG_FILE"
echo "安装已成功完成!" echo "注意:未来的更新只会刷新 CLAUDE.md,不会重新运行完整的安装向导。"
undefined

Keeping Up to Date

保持更新

After installing oh-my-claudecode updates (via npm or plugin update):
Automatic: Just run
/oh-my-claudecode:omc-setup
- it will detect you've already configured and offer a quick "Update CLAUDE.md only" option that skips the full wizard.
Manual options:
  • /oh-my-claudecode:omc-setup --local
    to update project config only
  • /oh-my-claudecode:omc-setup --global
    to update global config only
  • /oh-my-claudecode:omc-setup --force
    to re-run the full wizard (reconfigure preferences)
This ensures you have the newest features and agent configurations without the token cost of repeating the full setup.
安装 oh-my-claudecode 更新后(通过 npm 或插件更新):
自动方式:只需运行
/oh-my-claudecode:omc-setup
- 它会检测到你已完成配置,并提供「仅更新 CLAUDE.md」的快速选项,跳过完整向导。
手动选项
  • /oh-my-claudecode:omc-setup --local
    仅更新项目配置
  • /oh-my-claudecode:omc-setup --global
    仅更新全局配置
  • /oh-my-claudecode:omc-setup --force
    重新运行完整安装向导(重新配置偏好)
这确保你能获得最新功能和 Agent 配置,同时避免重复完整安装带来的令牌成本。

Help Text

帮助文本

When user runs
/oh-my-claudecode:omc-setup --help
or just
--help
, display:
OMC Setup - Configure oh-my-claudecode

USAGE:
  /oh-my-claudecode:omc-setup           Run initial setup wizard (or update if already configured)
  /oh-my-claudecode:omc-setup --local   Configure local project (.claude/CLAUDE.md)
  /oh-my-claudecode:omc-setup --global  Configure global settings (~/.claude/CLAUDE.md)
  /oh-my-claudecode:omc-setup --force   Force full setup wizard even if already configured
  /oh-my-claudecode:omc-setup --help    Show this help

MODES:
  Initial Setup (no flags)
    - Interactive wizard for first-time setup
    - Configures CLAUDE.md (local or global)
    - Sets up HUD statusline
    - Checks for updates
    - Offers MCP server configuration
    - Configures team mode defaults (agent count, type, model)
    - If already configured, offers quick update option

  Local Configuration (--local)
    - Downloads fresh CLAUDE.md to ./.claude/
    - Backs up existing CLAUDE.md to .claude/CLAUDE.md.backup.YYYY-MM-DD
    - Project-specific settings
    - Use this to update project config after OMC upgrades

  Global Configuration (--global)
    - Downloads fresh CLAUDE.md to ~/.claude/
    - Backs up existing CLAUDE.md to ~/.claude/CLAUDE.md.backup.YYYY-MM-DD
    - Applies to all Claude Code sessions
    - Cleans up legacy hooks
    - Use this to update global config after OMC upgrades

  Force Full Setup (--force)
    - Bypasses the "already configured" check
    - Runs the complete setup wizard from scratch
    - Use when you want to reconfigure preferences

EXAMPLES:
  /oh-my-claudecode:omc-setup           # First time setup (or update CLAUDE.md if configured)
  /oh-my-claudecode:omc-setup --local   # Update this project
  /oh-my-claudecode:omc-setup --global  # Update all projects
  /oh-my-claudecode:omc-setup --force   # Re-run full setup wizard

For more info: https://github.com/Yeachan-Heo/oh-my-claudecode
当用户运行
/oh-my-claudecode:omc-setup --help
或仅
--help
时,显示:
OMC 安装设置 - 配置 oh-my-claudecode

使用方法:
  /oh-my-claudecode:omc-setup           运行初始安装向导(如果已配置则进行更新)
  /oh-my-claudecode:omc-setup --local   配置本地项目(.claude/CLAUDE.md)
  /oh-my-claudecode:omc-setup --global  配置全局设置(~/.claude/CLAUDE.md)
  /oh-my-claudecode:omc-setup --force   强制运行完整安装向导,即使已配置
  /oh-my-claudecode:omc-setup --help    显示此帮助信息

模式说明:
  初始安装(无标志)
    - 首次安装的交互式向导
    - 配置 CLAUDE.md(本地或全局)
    - 安装 HUD 状态栏
    - 检查更新
    - 提供 MCP 服务器配置
    - 配置 Team 模式默认值(Agent 数量、类型、模型)
    - 如果已配置,提供快速更新选项

  本地配置(--local)
    - 下载最新的 CLAUDE.md 到 ./.claude/
    - 将现有 CLAUDE.md 备份到 .claude/CLAUDE.md.backup.YYYY-MM-DD
    - 项目专属设置
    - OMC 升级后使用此命令更新项目配置

  全局配置(--global)
    - 下载最新的 CLAUDE.md 到 ~/.claude/
    - 将现有 CLAUDE.md 备份到 ~/.claude/CLAUDE.md.backup.YYYY-MM-DD
    - 适用于所有 Claude Code 会话
    - 清理旧版钩子
    - OMC 升级后使用此命令更新全局配置

  强制完整安装(--force)
    - 跳过「已配置」检查
    - 从头运行完整安装向导
    - 当你想要重新配置偏好时使用

示例:
  /oh-my-claudecode:omc-setup           # 首次安装(如果已配置则更新 CLAUDE.md)
  /oh-my-claudecode:omc-setup --local   # 更新当前项目
  /oh-my-claudecode:omc-setup --global  # 更新所有项目
  /oh-my-claudecode:omc-setup --force   # 重新运行完整安装向导

更多信息:https://github.com/Yeachan-Heo/oh-my-claudecode