oh-my-codex 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +136 -271
  2. package/dist/cli/__tests__/index.test.js +19 -1
  3. package/dist/cli/__tests__/index.test.js.map +1 -1
  4. package/dist/cli/index.d.ts +1 -0
  5. package/dist/cli/index.d.ts.map +1 -1
  6. package/dist/cli/index.js +44 -4
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/cli/setup.d.ts.map +1 -1
  9. package/dist/cli/setup.js +48 -1
  10. package/dist/cli/setup.js.map +1 -1
  11. package/dist/hud/__tests__/hud-tmux-injection.test.d.ts +10 -0
  12. package/dist/hud/__tests__/hud-tmux-injection.test.d.ts.map +1 -0
  13. package/dist/hud/__tests__/hud-tmux-injection.test.js +143 -0
  14. package/dist/hud/__tests__/hud-tmux-injection.test.js.map +1 -0
  15. package/dist/hud/index.d.ts +10 -0
  16. package/dist/hud/index.d.ts.map +1 -1
  17. package/dist/hud/index.js +32 -8
  18. package/dist/hud/index.js.map +1 -1
  19. package/dist/team/__tests__/tmux-session.test.js +100 -0
  20. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  21. package/dist/team/state.d.ts +1 -1
  22. package/dist/team/state.d.ts.map +1 -1
  23. package/dist/team/state.js +2 -2
  24. package/dist/team/state.js.map +1 -1
  25. package/dist/team/tmux-session.d.ts +1 -1
  26. package/dist/team/tmux-session.d.ts.map +1 -1
  27. package/dist/team/tmux-session.js +44 -4
  28. package/dist/team/tmux-session.js.map +1 -1
  29. package/package.json +1 -1
  30. package/prompts/analyst.md +102 -105
  31. package/prompts/api-reviewer.md +90 -93
  32. package/prompts/architect.md +102 -104
  33. package/prompts/build-fixer.md +81 -84
  34. package/prompts/code-reviewer.md +98 -100
  35. package/prompts/critic.md +79 -82
  36. package/prompts/debugger.md +85 -88
  37. package/prompts/deep-executor.md +105 -107
  38. package/prompts/dependency-expert.md +91 -94
  39. package/prompts/designer.md +96 -98
  40. package/prompts/executor.md +92 -94
  41. package/prompts/explore.md +104 -107
  42. package/prompts/git-master.md +84 -87
  43. package/prompts/information-architect.md +28 -29
  44. package/prompts/performance-reviewer.md +86 -89
  45. package/prompts/planner.md +108 -111
  46. package/prompts/product-analyst.md +28 -29
  47. package/prompts/product-manager.md +33 -34
  48. package/prompts/qa-tester.md +90 -93
  49. package/prompts/quality-reviewer.md +98 -100
  50. package/prompts/quality-strategist.md +33 -34
  51. package/prompts/researcher.md +88 -91
  52. package/prompts/scientist.md +84 -87
  53. package/prompts/security-reviewer.md +119 -121
  54. package/prompts/style-reviewer.md +79 -82
  55. package/prompts/test-engineer.md +96 -98
  56. package/prompts/ux-researcher.md +28 -29
  57. package/prompts/verifier.md +87 -90
  58. package/prompts/vision.md +67 -70
  59. package/prompts/writer.md +78 -81
  60. package/skills/analyze/SKILL.md +1 -1
  61. package/skills/autopilot/SKILL.md +11 -16
  62. package/skills/code-review/SKILL.md +1 -1
  63. package/skills/configure-discord/SKILL.md +6 -6
  64. package/skills/configure-telegram/SKILL.md +6 -6
  65. package/skills/doctor/SKILL.md +47 -45
  66. package/skills/ecomode/SKILL.md +1 -1
  67. package/skills/frontend-ui-ux/SKILL.md +2 -2
  68. package/skills/help/SKILL.md +1 -1
  69. package/skills/learner/SKILL.md +5 -5
  70. package/skills/omx-setup/SKILL.md +47 -1109
  71. package/skills/plan/SKILL.md +1 -1
  72. package/skills/project-session-manager/SKILL.md +5 -5
  73. package/skills/release/SKILL.md +3 -3
  74. package/skills/research/SKILL.md +10 -15
  75. package/skills/security-review/SKILL.md +1 -1
  76. package/skills/skill/SKILL.md +20 -20
  77. package/skills/tdd/SKILL.md +1 -1
  78. package/skills/ultrapilot/SKILL.md +11 -16
  79. package/skills/writer-memory/SKILL.md +1 -1
  80. package/templates/AGENTS.md +7 -7
@@ -1,1147 +1,85 @@
1
1
  ---
2
2
  name: omx-setup
3
- description: Setup and configure oh-my-codex (the ONLY command you need to learn)
3
+ description: Setup and configure oh-my-codex using current CLI behavior
4
4
  ---
5
5
 
6
6
  # OMX Setup
7
7
 
8
- This is the **only command you need to learn**. After running this, everything else is automatic.
8
+ Use this skill when users want to install or refresh oh-my-codex for the **current project plus user-level OMX directories**.
9
9
 
10
- Note: All `~/.claude/...` paths in this guide respect `CLAUDE_CONFIG_DIR` when that environment variable is set.
11
-
12
- ## Pre-Setup Check: Already Configured?
13
-
14
- **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.
15
-
16
- ```bash
17
- # Check if setup was already completed
18
- CONFIG_FILE="$HOME/.claude/.omx-config.json"
19
-
20
- if [ -f "$CONFIG_FILE" ]; then
21
- SETUP_COMPLETED=$(jq -r '.setupCompleted // empty' "$CONFIG_FILE" 2>/dev/null)
22
- SETUP_VERSION=$(jq -r '.setupVersion // empty' "$CONFIG_FILE" 2>/dev/null)
23
-
24
- if [ -n "$SETUP_COMPLETED" ] && [ "$SETUP_COMPLETED" != "null" ]; then
25
- echo "OMX setup was already completed on: $SETUP_COMPLETED"
26
- [ -n "$SETUP_VERSION" ] && echo "Setup version: $SETUP_VERSION"
27
- ALREADY_CONFIGURED="true"
28
- fi
29
- fi
30
- ```
31
-
32
- ### If Already Configured (and no --force flag)
33
-
34
- If `ALREADY_CONFIGURED` is true AND the user did NOT pass `--force`, `--local`, or `--global` flags:
35
-
36
- Use AskUserQuestion to prompt:
37
-
38
- **Question:** "OMX is already configured. What would you like to do?"
39
-
40
- **Options:**
41
- 1. **Update CLAUDE.md only** - Download latest CLAUDE.md without re-running full setup
42
- 2. **Run full setup again** - Go through the complete setup wizard
43
- 3. **Cancel** - Exit without changes
44
-
45
- **If user chooses "Update CLAUDE.md only":**
46
- - Detect if local (.claude/CLAUDE.md) or global (~/.claude/CLAUDE.md) config exists
47
- - If local exists, run the download/merge script from Step 2A
48
- - If only global exists, run the download/merge script from Step 2B
49
- - Skip all other steps
50
- - Report success and exit
51
-
52
- **If user chooses "Run full setup again":**
53
- - Continue with Step 0 (Resume Detection) below
54
-
55
- **If user chooses "Cancel":**
56
- - Exit without any changes
57
-
58
- ### Force Flag Override
59
-
60
- If user passes `--force` flag, skip this check and proceed directly to setup.
61
-
62
- ## Graceful Interrupt Handling
63
-
64
- **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.
65
-
66
- ### State File Location
67
- - `.omx/state/setup-state.json` - Tracks completed steps
68
-
69
- ### Resume Detection (Step 0)
70
-
71
- Before starting any step, check for existing state:
72
-
73
- ```bash
74
- # Check for existing setup state
75
- STATE_FILE=".omx/state/setup-state.json"
76
-
77
- # Cross-platform ISO date to epoch conversion
78
- iso_to_epoch() {
79
- local iso_date="$1"
80
- local epoch=""
81
- # Try GNU date first (Linux)
82
- epoch=$(date -d "$iso_date" +%s 2>/dev/null)
83
- if [ $? -eq 0 ] && [ -n "$epoch" ]; then
84
- echo "$epoch"
85
- return 0
86
- fi
87
- # Try BSD/macOS date
88
- local clean_date=$(echo "$iso_date" | sed 's/[+-][0-9][0-9]:[0-9][0-9]$//' | sed 's/Z$//' | sed 's/T/ /')
89
- epoch=$(date -j -f "%Y-%m-%d %H:%M:%S" "$clean_date" +%s 2>/dev/null)
90
- if [ $? -eq 0 ] && [ -n "$epoch" ]; then
91
- echo "$epoch"
92
- return 0
93
- fi
94
- echo "0"
95
- }
96
-
97
- if [ -f "$STATE_FILE" ]; then
98
- # Check if state is stale (older than 24 hours)
99
- TIMESTAMP_RAW=$(jq -r '.timestamp // empty' "$STATE_FILE" 2>/dev/null)
100
- if [ -n "$TIMESTAMP_RAW" ]; then
101
- TIMESTAMP_EPOCH=$(iso_to_epoch "$TIMESTAMP_RAW")
102
- NOW_EPOCH=$(date +%s)
103
- STATE_AGE=$((NOW_EPOCH - TIMESTAMP_EPOCH))
104
- else
105
- STATE_AGE=999999 # Force fresh start if no timestamp
106
- fi
107
- if [ "$STATE_AGE" -gt 86400 ]; then
108
- echo "Previous setup state is more than 24 hours old. Starting fresh."
109
- rm -f "$STATE_FILE"
110
- else
111
- LAST_STEP=$(jq -r ".lastCompletedStep // 0" "$STATE_FILE" 2>/dev/null || echo "0")
112
- TIMESTAMP=$(jq -r .timestamp "$STATE_FILE" 2>/dev/null || echo "unknown")
113
- echo "Found previous setup session (Step $LAST_STEP completed at $TIMESTAMP)"
114
- fi
115
- fi
116
- ```
117
-
118
- If state exists, use AskUserQuestion to prompt:
119
-
120
- **Question:** "Found a previous setup session. Would you like to resume or start fresh?"
121
-
122
- **Options:**
123
- 1. **Resume from step $LAST_STEP** - Continue where you left off
124
- 2. **Start fresh** - Begin from the beginning (clears saved state)
125
-
126
- If user chooses "Start fresh":
127
- ```bash
128
- rm -f ".omx/state/setup-state.json"
129
- echo "Previous state cleared. Starting fresh setup."
130
- ```
131
-
132
- ### Save Progress Helper
133
-
134
- After completing each major step, save progress:
135
-
136
- ```bash
137
- # Save setup progress (call after each step)
138
- # Usage: save_setup_progress STEP_NUMBER
139
- save_setup_progress() {
140
- mkdir -p .omx/state
141
- cat > ".omx/state/setup-state.json" << EOF
142
- {
143
- "lastCompletedStep": $1,
144
- "timestamp": "$(date -Iseconds)",
145
- "configType": "${CONFIG_TYPE:-unknown}"
146
- }
147
- EOF
148
- }
149
- ```
150
-
151
- ### Clear State on Completion
152
-
153
- After successful setup completion (Step 7/8), remove the state file:
10
+ ## Command
154
11
 
155
12
  ```bash
156
- rm -f ".omx/state/setup-state.json"
157
- echo "Setup completed successfully. State cleared."
13
+ omx setup [--force] [--dry-run] [--verbose]
158
14
  ```
159
15
 
160
- ## Usage Modes
161
-
162
- This skill handles three scenarios:
163
-
164
- 1. **Initial Setup (no flags)**: First-time installation wizard
165
- 2. **Local Configuration (`--local`)**: Configure project-specific settings (.claude/CLAUDE.md)
166
- 3. **Global Configuration (`--global`)**: Configure global settings (~/.claude/CLAUDE.md)
167
-
168
- ## Mode Detection
169
-
170
- Check for flags in the user's invocation:
171
- - If `--local` flag present → Skip Pre-Setup Check, go to Local Configuration (Step 2A)
172
- - If `--global` flag present → Skip Pre-Setup Check, go to Global Configuration (Step 2B)
173
- - If `--force` flag present → Skip Pre-Setup Check, run Initial Setup wizard (Step 1)
174
- - If no flags → Run Pre-Setup Check first, then Initial Setup wizard (Step 1) if needed
16
+ Supported setup flags (current implementation):
17
+ - `--force`: overwrite/reinstall managed artifacts where applicable
18
+ - `--dry-run`: print actions without mutating files
19
+ - `--verbose`: print per-file/per-step details
175
20
 
176
- ## Step 1: Initial Setup Wizard (Default Behavior)
21
+ ## What this setup actually does
177
22
 
178
- **Note**: If resuming and lastCompletedStep >= 1, skip to the appropriate step based on configType.
23
+ `omx setup` performs these steps:
179
24
 
180
- Use the AskUserQuestion tool to prompt the user:
25
+ 1. Create directories:
26
+ - `~/.codex/`
27
+ - `~/.codex/prompts/`
28
+ - `~/.agents/skills/`
29
+ - `./.omx/state/`, `./.omx/plans/`, `./.omx/logs/`
30
+ 2. Install agent prompt files from repo `prompts/*.md` to `~/.codex/prompts/`
31
+ 3. Remove legacy skill-prompt shim files from `~/.codex/prompts/` when detected
32
+ 4. Install skills from repo `skills/*` to `~/.agents/skills/*`
33
+ 5. Merge OMX config into `~/.codex/config.toml`
34
+ 6. Verify required team MCP comm tool exports exist in built `dist/mcp/state-server.js`
35
+ 7. Generate project-root `./AGENTS.md` from `templates/AGENTS.md` (or skip when existing and no force)
36
+ 8. Configure notify hook references and write `./.omx/hud-config.json`
181
37
 
182
- **Question:** "Where should I configure oh-my-codex?"
38
+ ## Important behavior notes
183
39
 
184
- **Options:**
185
- 1. **Local (this project)** - Creates `.claude/CLAUDE.md` in current project directory. Best for project-specific configurations.
186
- 2. **Global (all projects)** - Creates `~/.claude/CLAUDE.md` for all Codex CLI sessions. Best for consistent behavior everywhere.
40
+ - `omx setup` is **not** an interactive wizard in current code.
41
+ - Local project orchestration file is `./AGENTS.md` (project root).
42
+ - Prompts/skills are installed to user directories (`~/.codex/prompts`, `~/.agents/skills`).
43
+ - With `--force`, AGENTS overwrite may still be skipped if an active OMX session is detected (safety guard).
187
44
 
188
- ## Step 2A: Local Configuration (--local flag or user chose LOCAL)
45
+ ## Recommended workflow
189
46
 
190
- **CRITICAL**: This ALWAYS downloads fresh CLAUDE.md from GitHub to the local project. DO NOT use the Write tool - use bash curl exclusively.
191
-
192
- ### Create Local .claude Directory
47
+ 1. Run setup:
193
48
 
194
49
  ```bash
195
- # Create .claude directory in current project
196
- mkdir -p .claude && echo ".claude directory ready"
50
+ omx setup --force --verbose
197
51
  ```
198
52
 
199
- ### Download Fresh CLAUDE.md
53
+ 2. Verify installation:
200
54
 
201
55
  ```bash
202
- # Define target path
203
- TARGET_PATH=".claude/CLAUDE.md"
204
-
205
- # Extract old version before download
206
- OLD_VERSION=$(grep -m1 "^# oh-my-codex" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "none")
207
-
208
- # Backup existing
209
- if [ -f "$TARGET_PATH" ]; then
210
- BACKUP_DATE=$(date +%Y-%m-%d_%H%M%S)
211
- BACKUP_PATH="${TARGET_PATH}.backup.${BACKUP_DATE}"
212
- cp "$TARGET_PATH" "$BACKUP_PATH"
213
- echo "Backed up existing CLAUDE.md to $BACKUP_PATH"
214
- fi
215
-
216
- # Download fresh OMX content to temp file
217
- TEMP_OMX=$(mktemp /tmp/omc-claude-XXXXXX.md)
218
- trap 'rm -f "$TEMP_OMX"' EXIT
219
- curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-codex/main/docs/CLAUDE.md" -o "$TEMP_OMX"
220
-
221
- if [ ! -s "$TEMP_OMX" ]; then
222
- echo "ERROR: Failed to download CLAUDE.md. Aborting."
223
- rm -f "$TEMP_OMX"
224
- return 1
225
- fi
226
-
227
- # Strip existing markers from downloaded content (idempotency)
228
- if grep -q '<!-- OMX:START -->' "$TEMP_OMX"; then
229
- # Extract content between markers
230
- sed -n '/<!-- OMX:START -->/,/<!-- OMX:END -->/{//!p}' "$TEMP_OMX" > "${TEMP_OMX}.clean"
231
- mv "${TEMP_OMX}.clean" "$TEMP_OMX"
232
- fi
233
-
234
- if [ ! -f "$TARGET_PATH" ]; then
235
- # Fresh install: wrap in markers
236
- {
237
- echo '<!-- OMX:START -->'
238
- cat "$TEMP_OMX"
239
- echo '<!-- OMX:END -->'
240
- } > "$TARGET_PATH"
241
- rm -f "$TEMP_OMX"
242
- echo "Installed CLAUDE.md (fresh)"
243
- else
244
- # Merge: preserve user content outside OMX markers
245
- if grep -q '<!-- OMX:START -->' "$TARGET_PATH"; then
246
- # Has markers: replace OMX section, keep user content
247
- BEFORE_OMX=$(sed -n '1,/<!-- OMX:START -->/{ /<!-- OMX:START -->/!p }' "$TARGET_PATH")
248
- AFTER_OMX=$(sed -n '/<!-- OMX:END -->/,${ /<!-- OMX:END -->/!p }' "$TARGET_PATH")
249
- {
250
- [ -n "$BEFORE_OMX" ] && printf '%s\n' "$BEFORE_OMX"
251
- echo '<!-- OMX:START -->'
252
- cat "$TEMP_OMX"
253
- echo '<!-- OMX:END -->'
254
- [ -n "$AFTER_OMX" ] && printf '%s\n' "$AFTER_OMX"
255
- } > "${TARGET_PATH}.tmp"
256
- mv "${TARGET_PATH}.tmp" "$TARGET_PATH"
257
- echo "Updated OMX section (user customizations preserved)"
258
- else
259
- # No markers: wrap new content in markers, append old content as user section
260
- OLD_CONTENT=$(cat "$TARGET_PATH")
261
- {
262
- echo '<!-- OMX:START -->'
263
- cat "$TEMP_OMX"
264
- echo '<!-- OMX:END -->'
265
- echo ""
266
- echo "<!-- User customizations (migrated from previous CLAUDE.md) -->"
267
- printf '%s\n' "$OLD_CONTENT"
268
- } > "${TARGET_PATH}.tmp"
269
- mv "${TARGET_PATH}.tmp" "$TARGET_PATH"
270
- echo "Migrated existing CLAUDE.md (added OMX markers, preserved old content)"
271
- fi
272
- rm -f "$TEMP_OMX"
273
- fi
274
-
275
- # Extract new version and report
276
- NEW_VERSION=$(grep -m1 "^# oh-my-codex" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
277
- if [ "$OLD_VERSION" = "none" ]; then
278
- echo "Installed CLAUDE.md: $NEW_VERSION"
279
- elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then
280
- echo "CLAUDE.md unchanged: $NEW_VERSION"
281
- else
282
- echo "Updated CLAUDE.md: $OLD_VERSION -> $NEW_VERSION"
283
- fi
56
+ omx doctor
284
57
  ```
285
58
 
286
- **Note**: The downloaded CLAUDE.md includes Context Persistence instructions with `<remember>` tags for surviving conversation compaction.
287
-
288
- **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.
289
-
290
- **MANDATORY**: Always run this command. Do NOT skip. Do NOT use Write tool.
59
+ 3. Start Codex with OMX in the target project directory.
291
60
 
292
- **FALLBACK** if curl fails:
293
- Tell user to manually download from:
294
- https://raw.githubusercontent.com/Yeachan-Heo/oh-my-codex/main/docs/CLAUDE.md
61
+ ## Expected verification indicators
295
62
 
296
- ### Verify Plugin Installation
63
+ From `omx doctor`, expect:
64
+ - Prompts installed (30)
65
+ - Skills installed (40)
66
+ - AGENTS.md found in project root
67
+ - `.omx/state` exists
68
+ - OMX MCP servers configured in `~/.codex/config.toml`
297
69
 
298
- ```bash
299
- grep -q "oh-my-codex" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-codex"
300
- ```
301
-
302
- ### Confirm Local Configuration Success
70
+ ## Troubleshooting
303
71
 
304
- After completing local configuration, save progress and report:
72
+ - If using local source changes, run build first:
305
73
 
306
74
  ```bash
307
- # Save progress - Step 2 complete (Local config)
308
- mkdir -p .omx/state
309
- cat > ".omx/state/setup-state.json" << EOF
310
- {
311
- "lastCompletedStep": 2,
312
- "timestamp": "$(date -Iseconds)",
313
- "configType": "local"
314
- }
315
- EOF
75
+ npm run build
316
76
  ```
317
77
 
318
- **OMX Project Configuration Complete**
319
- - CLAUDE.md: Updated with latest configuration from GitHub at ./.claude/CLAUDE.md
320
- - Backup: Previous CLAUDE.md backed up to `.claude/CLAUDE.md.backup.YYYY-MM-DD` (if existed)
321
- - Scope: **PROJECT** - applies only to this project
322
- - Hooks: Provided by plugin (no manual installation needed)
323
- - Agents: 28+ available (base + tiered variants)
324
- - Model routing: Haiku/Sonnet/Opus based on task complexity
78
+ - If your global `omx` points to another install, run local entrypoint:
325
79
 
326
- **Note**: This configuration is project-specific and won't affect other projects or global settings.
327
-
328
- If `--local` flag was used, clear state and **STOP HERE**:
329
80
  ```bash
330
- rm -f ".omx/state/setup-state.json"
81
+ node bin/omx.js setup --force --verbose
82
+ node bin/omx.js doctor
331
83
  ```
332
- Do not continue to HUD setup or other steps.
333
-
334
- ## Step 2B: Global Configuration (--global flag or user chose GLOBAL)
335
-
336
- **CRITICAL**: This ALWAYS downloads fresh CLAUDE.md from GitHub to global config. DO NOT use the Write tool - use bash curl exclusively.
337
-
338
- ### Download Fresh CLAUDE.md
339
-
340
- ```bash
341
- # Define target path
342
- TARGET_PATH="$HOME/.claude/CLAUDE.md"
343
-
344
- # Extract old version before download
345
- OLD_VERSION=$(grep -m1 "^# oh-my-codex" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "none")
346
-
347
- # Backup existing
348
- if [ -f "$TARGET_PATH" ]; then
349
- BACKUP_DATE=$(date +%Y-%m-%d_%H%M%S)
350
- BACKUP_PATH="${TARGET_PATH}.backup.${BACKUP_DATE}"
351
- cp "$TARGET_PATH" "$BACKUP_PATH"
352
- echo "Backed up existing CLAUDE.md to $BACKUP_PATH"
353
- fi
354
-
355
- # Download fresh OMX content to temp file
356
- TEMP_OMX=$(mktemp /tmp/omc-claude-XXXXXX.md)
357
- trap 'rm -f "$TEMP_OMX"' EXIT
358
- curl -fsSL "https://raw.githubusercontent.com/Yeachan-Heo/oh-my-codex/main/docs/CLAUDE.md" -o "$TEMP_OMX"
359
-
360
- if [ ! -s "$TEMP_OMX" ]; then
361
- echo "ERROR: Failed to download CLAUDE.md. Aborting."
362
- rm -f "$TEMP_OMX"
363
- return 1
364
- fi
365
-
366
- # Strip existing markers from downloaded content (idempotency)
367
- if grep -q '<!-- OMX:START -->' "$TEMP_OMX"; then
368
- # Extract content between markers
369
- sed -n '/<!-- OMX:START -->/,/<!-- OMX:END -->/{//!p}' "$TEMP_OMX" > "${TEMP_OMX}.clean"
370
- mv "${TEMP_OMX}.clean" "$TEMP_OMX"
371
- fi
372
-
373
- if [ ! -f "$TARGET_PATH" ]; then
374
- # Fresh install: wrap in markers
375
- {
376
- echo '<!-- OMX:START -->'
377
- cat "$TEMP_OMX"
378
- echo '<!-- OMX:END -->'
379
- } > "$TARGET_PATH"
380
- rm -f "$TEMP_OMX"
381
- echo "Installed CLAUDE.md (fresh)"
382
- else
383
- # Merge: preserve user content outside OMX markers
384
- if grep -q '<!-- OMX:START -->' "$TARGET_PATH"; then
385
- # Has markers: replace OMX section, keep user content
386
- BEFORE_OMX=$(sed -n '1,/<!-- OMX:START -->/{ /<!-- OMX:START -->/!p }' "$TARGET_PATH")
387
- AFTER_OMX=$(sed -n '/<!-- OMX:END -->/,${ /<!-- OMX:END -->/!p }' "$TARGET_PATH")
388
- {
389
- [ -n "$BEFORE_OMX" ] && printf '%s\n' "$BEFORE_OMX"
390
- echo '<!-- OMX:START -->'
391
- cat "$TEMP_OMX"
392
- echo '<!-- OMX:END -->'
393
- [ -n "$AFTER_OMX" ] && printf '%s\n' "$AFTER_OMX"
394
- } > "${TARGET_PATH}.tmp"
395
- mv "${TARGET_PATH}.tmp" "$TARGET_PATH"
396
- echo "Updated OMX section (user customizations preserved)"
397
- else
398
- # No markers: wrap new content in markers, append old content as user section
399
- OLD_CONTENT=$(cat "$TARGET_PATH")
400
- {
401
- echo '<!-- OMX:START -->'
402
- cat "$TEMP_OMX"
403
- echo '<!-- OMX:END -->'
404
- echo ""
405
- echo "<!-- User customizations (migrated from previous CLAUDE.md) -->"
406
- printf '%s\n' "$OLD_CONTENT"
407
- } > "${TARGET_PATH}.tmp"
408
- mv "${TARGET_PATH}.tmp" "$TARGET_PATH"
409
- echo "Migrated existing CLAUDE.md (added OMX markers, preserved old content)"
410
- fi
411
- rm -f "$TEMP_OMX"
412
- fi
413
-
414
- # Extract new version and report
415
- NEW_VERSION=$(grep -m1 "^# oh-my-codex" "$TARGET_PATH" 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
416
- if [ "$OLD_VERSION" = "none" ]; then
417
- echo "Installed CLAUDE.md: $NEW_VERSION"
418
- elif [ "$OLD_VERSION" = "$NEW_VERSION" ]; then
419
- echo "CLAUDE.md unchanged: $NEW_VERSION"
420
- else
421
- echo "Updated CLAUDE.md: $OLD_VERSION -> $NEW_VERSION"
422
- fi
423
- ```
424
-
425
- **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.
426
-
427
- ### Clean Up Legacy Hooks (if present)
428
-
429
- Check if old manual hooks exist and remove them to prevent duplicates:
430
-
431
- ```bash
432
- # Remove legacy bash hook scripts (now handled by plugin system)
433
- rm -f ~/.claude/hooks/keyword-detector.sh
434
- rm -f ~/.claude/hooks/stop-continuation.sh
435
- rm -f ~/.claude/hooks/persistent-mode.sh
436
- rm -f ~/.claude/hooks/session-start.sh
437
- echo "Legacy hooks cleaned"
438
- ```
439
-
440
- 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:
441
-
442
- > **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.
443
-
444
- ### Verify Plugin Installation
445
-
446
- ```bash
447
- grep -q "oh-my-codex" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-codex"
448
- ```
449
-
450
- ### Confirm Global Configuration Success
451
-
452
- After completing global configuration, save progress and report:
453
-
454
- ```bash
455
- # Save progress - Step 2 complete (Global config)
456
- mkdir -p .omx/state
457
- cat > ".omx/state/setup-state.json" << EOF
458
- {
459
- "lastCompletedStep": 2,
460
- "timestamp": "$(date -Iseconds)",
461
- "configType": "global"
462
- }
463
- EOF
464
- ```
465
-
466
- **OMX Global Configuration Complete**
467
- - CLAUDE.md: Updated with latest configuration from GitHub at ~/.claude/CLAUDE.md
468
- - Backup: Previous CLAUDE.md backed up to `~/.claude/CLAUDE.md.backup.YYYY-MM-DD` (if existed)
469
- - Scope: **GLOBAL** - applies to all Codex CLI sessions
470
- - Hooks: Provided by plugin (no manual installation needed)
471
- - Agents: 28+ available (base + tiered variants)
472
- - Model routing: Haiku/Sonnet/Opus based on task complexity
473
-
474
- **Note**: Hooks are now managed by the plugin system automatically. No manual hook installation required.
475
-
476
- If `--global` flag was used, clear state and **STOP HERE**:
477
- ```bash
478
- rm -f ".omx/state/setup-state.json"
479
- ```
480
- Do not continue to HUD setup or other steps.
481
-
482
- ## Step 3: Setup HUD Statusline
483
-
484
- **Note**: If resuming and lastCompletedStep >= 3, skip to Step 3.5.
485
-
486
- The HUD shows real-time status in Codex CLI's status bar. **Invoke the hud skill** to set up and configure:
487
-
488
- Use the Skill tool to invoke: `hud` with args: `setup`
489
-
490
- This will:
491
- 1. Install the HUD wrapper script to `~/.claude/hud/omc-hud.mjs`
492
- 2. Configure `statusLine` in `~/.claude/settings.json`
493
- 3. Report status and prompt to restart if needed
494
-
495
- After HUD setup completes, save progress:
496
- ```bash
497
- # Save progress - Step 3 complete (HUD setup)
498
- mkdir -p .omx/state
499
- CONFIG_TYPE=$(cat ".omx/state/setup-state.json" 2>/dev/null | grep -oE '"configType":\s*"[^"]+"' | cut -d'"' -f4 || echo "unknown")
500
- cat > ".omx/state/setup-state.json" << EOF
501
- {
502
- "lastCompletedStep": 3,
503
- "timestamp": "$(date -Iseconds)",
504
- "configType": "$CONFIG_TYPE"
505
- }
506
- EOF
507
- ```
508
-
509
- ## Step 3.5: Clear Stale Plugin Cache
510
-
511
- Clear old cached plugin versions to avoid conflicts:
512
-
513
- ```bash
514
- # Clear stale plugin cache versions
515
- CACHE_DIR="$HOME/.claude/plugins/cache/omc/oh-my-codex"
516
- if [ -d "$CACHE_DIR" ]; then
517
- LATEST=$(ls -1 "$CACHE_DIR" | sort -V | tail -1)
518
- CLEARED=0
519
- for dir in "$CACHE_DIR"/*; do
520
- if [ "$(basename "$dir")" != "$LATEST" ]; then
521
- rm -rf "$dir"
522
- CLEARED=$((CLEARED + 1))
523
- fi
524
- done
525
- [ $CLEARED -gt 0 ] && echo "Cleared $CLEARED stale cache version(s)" || echo "Cache is clean"
526
- else
527
- echo "No cache directory found (normal for new installs)"
528
- fi
529
- ```
530
-
531
- ## Step 3.6: Check for Updates
532
-
533
- Notify user if a newer version is available:
534
-
535
- ```bash
536
- # Detect installed version
537
- INSTALLED_VERSION=""
538
-
539
- # Try cache directory first
540
- if [ -d "$HOME/.claude/plugins/cache/omc/oh-my-codex" ]; then
541
- INSTALLED_VERSION=$(ls -1 "$HOME/.claude/plugins/cache/omc/oh-my-codex" | sort -V | tail -1)
542
- fi
543
-
544
- # Try .omx-version.json second
545
- if [ -z "$INSTALLED_VERSION" ] && [ -f ".omx-version.json" ]; then
546
- INSTALLED_VERSION=$(grep -oE '"version":\s*"[^"]+' .omx-version.json | cut -d'"' -f4)
547
- fi
548
-
549
- # Try CLAUDE.md header third (local first, then global)
550
- if [ -z "$INSTALLED_VERSION" ]; then
551
- if [ -f ".claude/CLAUDE.md" ]; then
552
- INSTALLED_VERSION=$(grep -m1 "^# oh-my-codex" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | sed 's/^v//')
553
- elif [ -f "$HOME/.claude/CLAUDE.md" ]; then
554
- INSTALLED_VERSION=$(grep -m1 "^# oh-my-codex" "$HOME/.claude/CLAUDE.md" 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | sed 's/^v//')
555
- fi
556
- fi
557
-
558
- # Check npm for latest version
559
- LATEST_VERSION=$(npm view oh-my-claude-sisyphus version 2>/dev/null)
560
-
561
- if [ -n "$INSTALLED_VERSION" ] && [ -n "$LATEST_VERSION" ]; then
562
- # Simple version comparison (assumes semantic versioning)
563
- if [ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]; then
564
- echo ""
565
- echo "UPDATE AVAILABLE:"
566
- echo " Installed: v$INSTALLED_VERSION"
567
- echo " Latest: v$LATEST_VERSION"
568
- echo ""
569
- echo "To update, run: claude /install-plugin oh-my-codex"
570
- else
571
- echo "You're on the latest version: v$INSTALLED_VERSION"
572
- fi
573
- elif [ -n "$LATEST_VERSION" ]; then
574
- echo "Latest version available: v$LATEST_VERSION"
575
- fi
576
- ```
577
-
578
- ## Step 3.7: Set Default Execution Mode
579
-
580
- Use the AskUserQuestion tool to prompt the user:
581
-
582
- **Question:** "Which parallel execution mode should be your default when you say 'fast' or 'parallel'?"
583
-
584
- **Options:**
585
- 1. **ultrawork (maximum capability)** - Uses all agent tiers including Opus for complex tasks. Best for challenging work where quality matters most. (Recommended)
586
- 2. **ecomode (token efficient)** - Prefers Haiku/Sonnet agents, avoids Opus. Best for pro-plan users who want cost efficiency.
587
-
588
- Store the preference in `~/.claude/.omx-config.json`:
589
-
590
- ```bash
591
- # Read existing config or create empty object
592
- CONFIG_FILE="$HOME/.claude/.omx-config.json"
593
- mkdir -p "$(dirname "$CONFIG_FILE")"
594
-
595
- if [ -f "$CONFIG_FILE" ]; then
596
- EXISTING=$(cat "$CONFIG_FILE")
597
- else
598
- EXISTING='{}'
599
- fi
600
-
601
- # Set defaultExecutionMode (replace USER_CHOICE with "ultrawork" or "ecomode")
602
- echo "$EXISTING" | jq --arg mode "USER_CHOICE" '. + {defaultExecutionMode: $mode, configuredAt: (now | todate)}' > "$CONFIG_FILE"
603
- echo "Default execution mode set to: USER_CHOICE"
604
- ```
605
-
606
- **Note**: This preference ONLY affects generic keywords ("fast", "parallel"). Explicit keywords ("ulw", "eco") always override this preference.
607
-
608
- ### Optional: Disable Ecomode Entirely
609
-
610
- If the user wants to disable ecomode completely (so ecomode keywords are ignored), add to the config:
611
-
612
- ```bash
613
- echo "$EXISTING" | jq '. + {ecomode: {enabled: false}}' > "$CONFIG_FILE"
614
- echo "Ecomode disabled completely"
615
- ```
616
-
617
- ## Step 3.8: Install CLI Analytics Tools (Optional)
618
-
619
- The OMX CLI provides standalone token analytics commands (`omc stats`, `omc agents`, `omc tui`).
620
-
621
- Ask user: "Would you like to install the OMX CLI for standalone analytics? (Recommended for tracking token usage and costs)"
622
-
623
- **Options:**
624
- 1. **Yes (Recommended)** - Install CLI tools globally for `omc stats`, `omc agents`, etc.
625
- 2. **No** - Skip CLI installation, use only plugin skills
626
-
627
- ### CLI Installation Note
628
-
629
- The CLI (`omc` command) is **no longer supported** via npm/bun global install.
630
-
631
- All functionality is available through the plugin system:
632
- - Use `/help` for guidance
633
- - Use `/doctor` for diagnostics
634
-
635
- Skip this step - the plugin provides all features.
636
-
637
- ## Step 3.8.5: Select Task Management Tool
638
-
639
- First, detect available task tools:
640
-
641
- ```bash
642
- # Detect beads (bd)
643
- BD_VERSION=""
644
- if command -v bd &>/dev/null; then
645
- BD_VERSION=$(bd --version 2>/dev/null | head -1 || echo "installed")
646
- fi
647
-
648
- # Detect beads-rust (br)
649
- BR_VERSION=""
650
- if command -v br &>/dev/null; then
651
- BR_VERSION=$(br --version 2>/dev/null | head -1 || echo "installed")
652
- fi
653
-
654
- # Report findings
655
- if [ -n "$BD_VERSION" ]; then
656
- echo "Found beads (bd): $BD_VERSION"
657
- fi
658
- if [ -n "$BR_VERSION" ]; then
659
- echo "Found beads-rust (br): $BR_VERSION"
660
- fi
661
- if [ -z "$BD_VERSION" ] && [ -z "$BR_VERSION" ]; then
662
- echo "No external task tools found. Using built-in Tasks."
663
- fi
664
- ```
665
-
666
- If **neither** beads nor beads-rust is detected, skip this step (default to built-in).
667
-
668
- If beads or beads-rust is detected, use AskUserQuestion:
669
-
670
- **Question:** "Which task management tool should I use for tracking work?"
671
-
672
- **Options:**
673
- 1. **Built-in Tasks (default)** - Use Codex CLI's native TaskCreate/TodoWrite. Tasks are session-only.
674
- 2. **Beads (bd)** - Git-backed persistent tasks. Survives across sessions. [Only if detected]
675
- 3. **Beads-Rust (br)** - Lightweight Rust port of beads. [Only if detected]
676
-
677
- (Only show options 2/3 if the corresponding tool is detected)
678
-
679
- Store the preference:
680
-
681
- ```bash
682
- CONFIG_FILE="$HOME/.claude/.omx-config.json"
683
- mkdir -p "$(dirname "$CONFIG_FILE")"
684
84
 
685
- if [ -f "$CONFIG_FILE" ]; then
686
- EXISTING=$(cat "$CONFIG_FILE")
687
- else
688
- EXISTING='{}'
689
- fi
690
-
691
- # USER_CHOICE is "builtin", "beads", or "beads-rust" based on user selection
692
- echo "$EXISTING" | jq --arg tool "USER_CHOICE" '. + {taskTool: $tool, taskToolConfig: {injectInstructions: true, useMcp: false}}' > "$CONFIG_FILE"
693
- echo "sub-agent spawning set to: USER_CHOICE"
694
- ```
695
-
696
- **Note:** The beads context instructions will be injected automatically on the next session start. No restart is needed for config to take effect.
697
-
698
- ## Step 4: Verify Plugin Installation
699
-
700
- ```bash
701
- grep -q "oh-my-codex" ~/.claude/settings.json && echo "Plugin verified" || echo "Plugin NOT found - run: claude /install-plugin oh-my-codex"
702
- ```
703
-
704
- ## Step 5: Offer MCP Server Configuration
705
-
706
- MCP servers extend Codex CLI with additional tools (web search, GitHub, etc.).
707
-
708
- Ask user: "Would you like to configure MCP servers for enhanced capabilities? (Context7, Exa search, GitHub, etc.)"
709
-
710
- If yes, invoke the mcp-setup skill:
711
- ```
712
- /mcp-setup
713
- ```
714
-
715
- If no, skip to next step.
716
-
717
- ## Step 5.5: Configure Agent Teams (Optional)
718
-
719
- **Note**: If resuming and lastCompletedStep >= 5.5, skip to Step 6.
720
-
721
- Agent teams are an experimental Codex CLI 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`.
722
-
723
- Reference: https://code.claude.com/docs/en/agent-teams
724
-
725
- Use the AskUserQuestion tool to prompt:
726
-
727
- **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 Codex CLI feature."
728
-
729
- **Options:**
730
- 1. **Yes, enable teams (Recommended)** - Enable the experimental feature and configure defaults
731
- 2. **No, skip** - Leave teams disabled (can enable later)
732
-
733
- ### If User Chooses YES:
734
-
735
- #### Step 5.5.1: Enable Agent Teams in settings.json
736
-
737
- **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.
738
-
739
- First, read the current settings.json:
740
-
741
- ```bash
742
- SETTINGS_FILE="$HOME/.claude/settings.json"
743
-
744
- if [ -f "$SETTINGS_FILE" ]; then
745
- echo "Current settings.json found"
746
- cat "$SETTINGS_FILE"
747
- else
748
- echo "No settings.json found - will create one"
749
- fi
750
- ```
751
-
752
- 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.
753
-
754
- **If settings.json exists and has an `env` key**, merge the new env var into it:
755
-
756
- ```json
757
- {
758
- "env": {
759
- "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
760
- }
761
- }
762
- ```
763
-
764
- Use jq to safely merge without overwriting existing settings:
765
-
766
- ```bash
767
- SETTINGS_FILE="$HOME/.claude/settings.json"
768
-
769
- if [ -f "$SETTINGS_FILE" ]; then
770
- # Merge env var into existing settings, preserving everything else
771
- TEMP_FILE=$(mktemp)
772
- jq '.env = (.env // {} | . + {"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"})' "$SETTINGS_FILE" > "$TEMP_FILE" && mv "$TEMP_FILE" "$SETTINGS_FILE"
773
- echo "Added CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS to existing settings.json"
774
- else
775
- # Create new settings.json with just the teams env var
776
- mkdir -p "$(dirname "$SETTINGS_FILE")"
777
- cat > "$SETTINGS_FILE" << 'SETTINGS_EOF'
778
- {
779
- "env": {
780
- "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
781
- }
782
- }
783
- SETTINGS_EOF
784
- echo "Created settings.json with teams enabled"
785
- fi
786
- ```
787
-
788
- **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.
789
-
790
- #### Step 5.5.2: Configure Teammate Display Mode
791
-
792
- Use the AskUserQuestion tool:
793
-
794
- **Question:** "How should teammates be displayed?"
795
-
796
- **Options:**
797
- 1. **Auto (Recommended)** - Uses split panes if in tmux, otherwise in-process. Best for most users.
798
- 2. **In-process** - All teammates in your main terminal. Use Shift+Up/Down to select. Works everywhere.
799
- 3. **Split panes (tmux)** - Each teammate in its own pane. Requires tmux or iTerm2.
800
-
801
- If user chooses anything other than "Auto", add `teammateMode` to settings.json:
802
-
803
- ```bash
804
- SETTINGS_FILE="$HOME/.claude/settings.json"
805
-
806
- # TEAMMATE_MODE is "in-process" or "tmux" based on user choice
807
- # Skip this if user chose "Auto" (that's the default)
808
- jq --arg mode "TEAMMATE_MODE" '. + {teammateMode: $mode}' "$SETTINGS_FILE" > "${SETTINGS_FILE}.tmp" && mv "${SETTINGS_FILE}.tmp" "$SETTINGS_FILE"
809
- echo "Teammate display mode set to: TEAMMATE_MODE"
810
- ```
811
-
812
- #### Step 5.5.3: Configure Team Defaults in omc-config
813
-
814
- Use the AskUserQuestion tool with multiple questions:
815
-
816
- **Question 1:** "How many agents should teams spawn by default?"
817
-
818
- **Options:**
819
- 1. **3 agents (Recommended)** - Good balance of speed and resource usage
820
- 2. **5 agents (maximum)** - Maximum parallelism for large tasks
821
- 3. **2 agents** - Conservative, for smaller projects
822
-
823
- **Question 2:** "Which agent type should teammates use by default?"
824
-
825
- **Options:**
826
- 1. **executor (Recommended)** - General-purpose code implementation agent
827
- 2. **build-fixer** - Specialized for build/type error fixing
828
- 3. **designer** - Specialized for UI/frontend work
829
-
830
- Store the team configuration in `~/.claude/.omx-config.json`:
831
-
832
- ```bash
833
- CONFIG_FILE="$HOME/.claude/.omx-config.json"
834
- mkdir -p "$(dirname "$CONFIG_FILE")"
835
-
836
- if [ -f "$CONFIG_FILE" ]; then
837
- EXISTING=$(cat "$CONFIG_FILE")
838
- else
839
- EXISTING='{}'
840
- fi
841
-
842
- # Replace MAX_AGENTS, AGENT_TYPE with user choices
843
- echo "$EXISTING" | jq \
844
- --argjson maxAgents MAX_AGENTS \
845
- --arg agentType "AGENT_TYPE" \
846
- '. + {team: {maxAgents: $maxAgents, defaultAgentType: $agentType, monitorIntervalMs: 30000, shutdownTimeoutMs: 15000}}' > "$CONFIG_FILE"
847
-
848
- echo "Team configuration saved:"
849
- echo " Max agents: MAX_AGENTS"
850
- echo " Default agent: AGENT_TYPE"
851
- echo " Model: teammates inherit your session model"
852
- ```
853
-
854
- **Note:** Teammates do not have a separate model default. Each teammate is a full Codex CLI session that inherits your configured model. Subagents spawned by teammates can use any model tier.
855
-
856
- #### Verify settings.json Integrity
857
-
858
- After all modifications, verify settings.json is valid JSON and contains the expected keys:
859
-
860
- ```bash
861
- SETTINGS_FILE="$HOME/.claude/settings.json"
862
-
863
- # Verify JSON is valid
864
- if jq empty "$SETTINGS_FILE" 2>/dev/null; then
865
- echo "settings.json: valid JSON"
866
- else
867
- echo "ERROR: settings.json is invalid JSON! Restoring from backup..."
868
- # The backup from Step 2 should still exist
869
- exit 1
870
- fi
871
-
872
- # Verify teams env var is present
873
- if jq -e '.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS' "$SETTINGS_FILE" > /dev/null 2>&1; then
874
- echo "Agent teams: ENABLED"
875
- else
876
- echo "WARNING: Agent teams env var not found in settings.json"
877
- fi
878
-
879
- # Show final settings.json for user review
880
- echo ""
881
- echo "Final settings.json:"
882
- jq '.' "$SETTINGS_FILE"
883
- ```
884
-
885
- ### If User Chooses NO:
886
-
887
- Skip this step. Agent teams will remain disabled. User can enable later by adding to `~/.claude/settings.json`:
888
- ```json
889
- {
890
- "env": {
891
- "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
892
- }
893
- }
894
- ```
895
-
896
- Or by running `/omx-setup --force` and choosing to enable teams.
897
-
898
- ### Save Progress
899
-
900
- ```bash
901
- # Save progress - Step 5.5 complete (Teams configured)
902
- mkdir -p .omx/state
903
- CONFIG_TYPE=$(cat ".omx/state/setup-state.json" 2>/dev/null | grep -oE '"configType":\s*"[^"]+"' | cut -d'"' -f4 || echo "unknown")
904
- cat > ".omx/state/setup-state.json" << EOF
905
- {
906
- "lastCompletedStep": 5.5,
907
- "timestamp": "$(date -Iseconds)",
908
- "configType": "$CONFIG_TYPE"
909
- }
910
- EOF
911
- ```
912
-
913
- ## Step 6: Detect Upgrade from 2.x
914
-
915
- Check if user has existing configuration:
916
- ```bash
917
- # Check for existing 2.x artifacts
918
- ls ~/.claude/commands/ralph-loop.md 2>/dev/null || ls ~/.claude/commands/ultrawork.md 2>/dev/null
919
- ```
920
-
921
- If found, this is an upgrade from 2.x.
922
-
923
- ## Step 7: Show Welcome Message
924
-
925
- ### For New Users:
926
-
927
- ```
928
- OMX Setup Complete!
929
-
930
- You don't need to learn any commands. I now have intelligent behaviors that activate automatically.
931
-
932
- WHAT HAPPENS AUTOMATICALLY:
933
- - Complex tasks -> I parallelize and delegate to specialists
934
- - "plan this" -> I start a planning interview
935
- - "don't stop until done" -> I persist until verified complete
936
- - "stop" or "cancel" -> I intelligently stop current operation
937
-
938
- MAGIC KEYWORDS (optional power-user shortcuts):
939
- Just include these words naturally in your request:
940
-
941
- | Keyword | Effect | Example |
942
- |---------|--------|---------|
943
- | ralph | Persistence mode | "ralph: fix the auth bug" |
944
- | ralplan | Iterative planning | "ralplan this feature" |
945
- | ulw | Max parallelism | "ulw refactor the API" |
946
- | eco | Token-efficient mode | "eco refactor the API" |
947
- | plan | Planning interview | "plan the new endpoints" |
948
- | team | Coordinated agents | "/team 3:executor fix errors" |
949
-
950
- **ralph includes ultrawork:** When you activate ralph mode, it automatically includes ultrawork's parallel execution. No need to combine keywords.
951
-
952
- TEAMS:
953
- Spawn coordinated agents with shared task lists and real-time messaging:
954
- - /team 3:executor "fix all TypeScript errors"
955
- - /team 5:build-fixer "fix build errors in src/"
956
- Teams use Codex CLI native tools (TeamCreate/SendMessage/TaskCreate).
957
-
958
- MCP SERVERS:
959
- Run /mcp-setup to add tools like web search, GitHub, etc.
960
-
961
- HUD STATUSLINE:
962
- The status bar now shows OMX state. Restart Codex CLI to see it.
963
-
964
- CLI ANALYTICS (if installed):
965
- - omc - Full dashboard (stats + agents + cost)
966
- - omc stats - View token usage and costs
967
- - omc agents - See agent breakdown by cost
968
- - omc tui - Launch interactive TUI dashboard
969
-
970
- That's it! Just use Codex CLI normally.
971
- ```
972
-
973
- ### For Users Upgrading from 2.x:
974
-
975
- ```
976
- OMX Setup Complete! (Upgraded from 2.x)
977
-
978
- GOOD NEWS: Your existing commands still work!
979
- - /ralph, /ultrawork, /plan, etc. all still function
980
-
981
- WHAT'S NEW in 3.0:
982
- You no longer NEED those commands. Everything is automatic now:
983
- - Just say "don't stop until done" instead of /ralph
984
- - Just say "fast" or "parallel" instead of /ultrawork
985
- - Just say "plan this" instead of /plan
986
- - Just say "stop" instead of /cancel
987
-
988
- MAGIC KEYWORDS (power-user shortcuts):
989
- | Keyword | Same as old... | Example |
990
- |---------|----------------|---------|
991
- | ralph | /ralph | "ralph: fix the bug" |
992
- | ralplan | /ralplan | "ralplan this feature" |
993
- | ulw | /ultrawork | "ulw refactor API" |
994
- | eco | (new!) | "eco fix all errors" |
995
- | plan | /plan | "plan the endpoints" |
996
- | team | (new!) | "/team 3:executor fix errors" |
997
-
998
- TEAMS (NEW!):
999
- Spawn coordinated agents with shared task lists and real-time messaging:
1000
- - /team 3:executor "fix all TypeScript errors"
1001
- - Uses Codex CLI native tools (TeamCreate/SendMessage/TaskCreate)
1002
-
1003
- HUD STATUSLINE:
1004
- The status bar now shows OMX state. Restart Codex CLI to see it.
1005
-
1006
- CLI ANALYTICS (if installed):
1007
- - omc - Full dashboard (stats + agents + cost)
1008
- - omc stats - View token usage and costs
1009
- - omc agents - See agent breakdown by cost
1010
- - omc tui - Launch interactive TUI dashboard
1011
-
1012
- Your workflow won't break - it just got easier!
1013
- ```
1014
-
1015
- ## Step 8: Ask About Starring Repository
1016
-
1017
- First, check if `gh` CLI is available and authenticated:
1018
-
1019
- ```bash
1020
- gh auth status &>/dev/null
1021
- ```
1022
-
1023
- ### If gh is available and authenticated:
1024
-
1025
- Use the AskUserQuestion tool to prompt the user:
1026
-
1027
- **Question:** "If you're enjoying oh-my-codex, would you like to support the project by starring it on GitHub?"
1028
-
1029
- **Options:**
1030
- 1. **Yes, star it!** - Star the repository
1031
- 2. **No thanks** - Skip without further prompts
1032
- 3. **Maybe later** - Skip without further prompts
1033
-
1034
- If user chooses "Yes, star it!":
1035
-
1036
- ```bash
1037
- gh api -X PUT /user/starred/Yeachan-Heo/oh-my-codex 2>/dev/null && echo "Thanks for starring! ⭐" || true
1038
- ```
1039
-
1040
- **Note:** Fail silently if the API call doesn't work - never block setup completion.
1041
-
1042
- ### If gh is NOT available or not authenticated:
1043
-
1044
- ```bash
1045
- echo ""
1046
- echo "If you enjoy oh-my-codex, consider starring the repo:"
1047
- echo " https://github.com/Yeachan-Heo/oh-my-codex"
1048
- echo ""
1049
- ```
1050
-
1051
- ### Clear Setup State and Mark Completion
1052
-
1053
- After Step 8 completes (regardless of star choice), clear the temporary state and mark setup as completed:
1054
-
1055
- ```bash
1056
- # Setup complete - clear temporary state file
1057
- rm -f ".omx/state/setup-state.json"
1058
-
1059
- # Mark setup as completed in persistent config (prevents re-running full setup on updates)
1060
- CONFIG_FILE="$HOME/.claude/.omx-config.json"
1061
- mkdir -p "$(dirname "$CONFIG_FILE")"
1062
-
1063
- # Get current OMX version from CLAUDE.md
1064
- OMX_VERSION=""
1065
- if [ -f ".claude/CLAUDE.md" ]; then
1066
- OMX_VERSION=$(grep -m1 "^# oh-my-codex" .claude/CLAUDE.md 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
1067
- elif [ -f "$HOME/.claude/CLAUDE.md" ]; then
1068
- OMX_VERSION=$(grep -m1 "^# oh-my-codex" "$HOME/.claude/CLAUDE.md" 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "unknown")
1069
- fi
1070
-
1071
- if [ -f "$CONFIG_FILE" ]; then
1072
- EXISTING=$(cat "$CONFIG_FILE")
1073
- else
1074
- EXISTING='{}'
1075
- fi
1076
-
1077
- # Add setupCompleted timestamp and version
1078
- echo "$EXISTING" | jq --arg ts "$(date -Iseconds)" --arg ver "$OMX_VERSION" \
1079
- '. + {setupCompleted: $ts, setupVersion: $ver}' > "$CONFIG_FILE"
1080
-
1081
- echo "Setup completed successfully!"
1082
- echo "Note: Future updates will only refresh CLAUDE.md, not the full setup wizard."
1083
- ```
1084
-
1085
- ## Keeping Up to Date
1086
-
1087
- After installing oh-my-codex updates (via npm or plugin update):
1088
-
1089
- **Automatic**: Just run `/omx-setup` - it will detect you've already configured and offer a quick "Update CLAUDE.md only" option that skips the full wizard.
1090
-
1091
- **Manual options**:
1092
- - `/omx-setup --local` to update project config only
1093
- - `/omx-setup --global` to update global config only
1094
- - `/omx-setup --force` to re-run the full wizard (reconfigure preferences)
1095
-
1096
- This ensures you have the newest features and agent configurations without the token cost of repeating the full setup.
1097
-
1098
- ## Help Text
1099
-
1100
- When user runs `/omx-setup --help` or just `--help`, display:
1101
-
1102
- ```
1103
- OMX Setup - Configure oh-my-codex
1104
-
1105
- USAGE:
1106
- /omx-setup Run initial setup wizard (or update if already configured)
1107
- /omx-setup --local Configure local project (.claude/CLAUDE.md)
1108
- /omx-setup --global Configure global settings (~/.claude/CLAUDE.md)
1109
- /omx-setup --force Force full setup wizard even if already configured
1110
- /omx-setup --help Show this help
1111
-
1112
- MODES:
1113
- Initial Setup (no flags)
1114
- - Interactive wizard for first-time setup
1115
- - Configures CLAUDE.md (local or global)
1116
- - Sets up HUD statusline
1117
- - Checks for updates
1118
- - Offers MCP server configuration
1119
- - Configures team mode defaults (agent count, type, model)
1120
- - If already configured, offers quick update option
1121
-
1122
- Local Configuration (--local)
1123
- - Downloads fresh CLAUDE.md to ./.claude/
1124
- - Backs up existing CLAUDE.md to .claude/CLAUDE.md.backup.YYYY-MM-DD
1125
- - Project-specific settings
1126
- - Use this to update project config after OMX upgrades
1127
-
1128
- Global Configuration (--global)
1129
- - Downloads fresh CLAUDE.md to ~/.claude/
1130
- - Backs up existing CLAUDE.md to ~/.claude/CLAUDE.md.backup.YYYY-MM-DD
1131
- - Applies to all Codex CLI sessions
1132
- - Cleans up legacy hooks
1133
- - Use this to update global config after OMX upgrades
1134
-
1135
- Force Full Setup (--force)
1136
- - Bypasses the "already configured" check
1137
- - Runs the complete setup wizard from scratch
1138
- - Use when you want to reconfigure preferences
1139
-
1140
- EXAMPLES:
1141
- /omx-setup # First time setup (or update CLAUDE.md if configured)
1142
- /omx-setup --local # Update this project
1143
- /omx-setup --global # Update all projects
1144
- /omx-setup --force # Re-run full setup wizard
1145
-
1146
- For more info: https://github.com/Yeachan-Heo/oh-my-codex
1147
- ```
85
+ - If AGENTS.md was not overwritten during `--force`, stop active OMX session and rerun setup.