@oxgeneral/orch 1.0.7 → 1.0.9

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 (79) hide show
  1. package/dist/App-Q6LOPAZT.js +22 -0
  2. package/dist/{agent-Q34L27AY.js → agent-SI4JF5MV.js} +1 -1
  3. package/dist/{agent-shop-D2RS4BZK.js → agent-shop-JHDTCWCD.js} +1 -1
  4. package/dist/chunk-3AXNSYCM.js +2 -0
  5. package/dist/{chunk-4TDXD3LA.js → chunk-5YSW77VI.js} +104 -21
  6. package/dist/chunk-5YSW77VI.js.map +1 -0
  7. package/dist/{chunk-BCPUTULS.js → chunk-HWEMBO36.js} +83 -54
  8. package/dist/chunk-J7ITYXE6.js +116 -0
  9. package/dist/chunk-J7ITYXE6.js.map +1 -0
  10. package/dist/chunk-U2JVMD2G.js +66 -0
  11. package/dist/chunk-U2JVMD2G.js.map +1 -0
  12. package/dist/{chunk-EH3HRQP4.js → chunk-W3J7CURM.js} +8 -116
  13. package/dist/chunk-W3J7CURM.js.map +1 -0
  14. package/dist/{chunk-UMZEA3JT.js → chunk-XLBV2PFL.js} +1 -1
  15. package/dist/chunk-ZMLF5HI5.js +11 -0
  16. package/dist/cli.js +1 -1
  17. package/dist/container-LV3WOPMS.js +4 -0
  18. package/dist/doctor-Q3GHJNZL.js +2 -0
  19. package/dist/index.d.ts +44 -1
  20. package/dist/index.js +12 -5
  21. package/dist/index.js.map +1 -1
  22. package/dist/init-D4356W7G.js +73 -0
  23. package/dist/orchestrator-PSXVHP2L.js +17 -0
  24. package/dist/orchestrator-WLWIAFXH.js +6 -0
  25. package/dist/{orchestrator-XPEMMBOO.js.map → orchestrator-WLWIAFXH.js.map} +1 -1
  26. package/dist/{org-WAK3CDPG.js → org-KLYK6MMJ.js} +1 -1
  27. package/dist/serve-4RT4HERL.js +3 -0
  28. package/dist/skill-loader-IGRIELEM.js +9 -0
  29. package/dist/skill-loader-RHCFIK74.js +4 -0
  30. package/dist/skill-loader-RHCFIK74.js.map +1 -0
  31. package/dist/{task-QFLIIRKZ.js → task-6Z5P7ODZ.js} +1 -1
  32. package/dist/tui-GH3Z5CO4.js +2 -0
  33. package/dist/{update-FFKCOV63.js → update-XGJZFV4H.js} +1 -1
  34. package/dist/{update-check-HGMBDYHL.js → update-check-CZJC7VW6.js} +1 -1
  35. package/dist/{workspace-manager-5EYCMAEO.js → workspace-manager-RH24FSNT.js} +4 -3
  36. package/dist/workspace-manager-RH24FSNT.js.map +1 -0
  37. package/dist/workspace-manager-VJ4FN5PJ.js +3 -0
  38. package/package.json +1 -1
  39. package/readme.md +2 -2
  40. package/skills/library/autoplan.md +315 -0
  41. package/skills/library/benchmark.md +242 -0
  42. package/skills/library/browse.md +266 -0
  43. package/skills/library/canary.md +248 -0
  44. package/skills/library/careful.md +42 -0
  45. package/skills/library/codex.md +431 -0
  46. package/skills/library/design-consultation.md +367 -0
  47. package/skills/library/design-review.md +744 -0
  48. package/skills/library/document-release.md +365 -0
  49. package/skills/library/freeze.md +60 -0
  50. package/skills/library/guard.md +55 -0
  51. package/skills/library/investigate.md +171 -0
  52. package/skills/library/land-and-deploy.md +636 -0
  53. package/skills/library/office-hours.md +746 -0
  54. package/skills/library/plan-ceo-review.md +1029 -0
  55. package/skills/library/plan-design-review.md +428 -0
  56. package/skills/library/plan-eng-review.md +420 -0
  57. package/skills/library/qa-only.md +388 -0
  58. package/skills/library/qa.md +766 -0
  59. package/skills/library/retro.md +532 -0
  60. package/skills/library/review.md +421 -0
  61. package/skills/library/setup-browser-cookies.md +86 -0
  62. package/skills/library/setup-deploy.md +211 -0
  63. package/skills/library/ship.md +1018 -0
  64. package/skills/library/unfreeze.md +31 -0
  65. package/skills/library/upgrade.md +220 -0
  66. package/skills/orch/SKILL.md +138 -0
  67. package/dist/App-LEVUTWQN.js +0 -22
  68. package/dist/chunk-4TDXD3LA.js.map +0 -1
  69. package/dist/chunk-EH3HRQP4.js.map +0 -1
  70. package/dist/chunk-WVJTXBPL.js +0 -11
  71. package/dist/container-FXUUV6PP.js +0 -4
  72. package/dist/doctor-P2J6VAUX.js +0 -2
  73. package/dist/init-PTAYCSMO.js +0 -53
  74. package/dist/orchestrator-JOTMB5XT.js +0 -13
  75. package/dist/orchestrator-XPEMMBOO.js +0 -6
  76. package/dist/serve-5OAANN6J.js +0 -3
  77. package/dist/tui-BJHZBCIR.js +0 -2
  78. package/dist/workspace-manager-5EYCMAEO.js.map +0 -1
  79. package/dist/workspace-manager-XKOZ5WM6.js +0 -3
@@ -0,0 +1,431 @@
1
+ ---
2
+ name: codex
3
+ version: 1.0.0
4
+ description: |
5
+ OpenAI Codex CLI wrapper — three modes. Code review: independent diff review via
6
+ codex review with pass/fail gate. Challenge: adversarial mode that tries to break
7
+ your code. Consult: ask codex anything with session continuity for follow-ups.
8
+ The "200 IQ autistic developer" second opinion. Use when asked to "codex review",
9
+ "codex challenge", "ask codex", "second opinion", or "consult codex".
10
+ ---
11
+
12
+ ## Step 0: Detect base branch
13
+
14
+ Determine which branch this PR targets. Use the result as "the base branch" in all subsequent steps.
15
+
16
+ 1. Check if a PR already exists for this branch:
17
+ `gh pr view --json baseRefName -q .baseRefName`
18
+ If this succeeds, use the printed branch name as the base branch.
19
+
20
+ 2. If no PR exists (command fails), detect the repo's default branch:
21
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
22
+
23
+ 3. If both commands fail, fall back to `main`.
24
+
25
+ Print the detected base branch name. In every subsequent `git diff`, `git log`,
26
+ `git fetch`, `git merge`, and `gh pr create` command, substitute the detected
27
+ branch name wherever the instructions say "the base branch."
28
+
29
+ ---
30
+
31
+ # /codex — Multi-AI Second Opinion
32
+
33
+ You are running the `/codex` skill. This wraps the OpenAI Codex CLI to get an independent,
34
+ brutally honest second opinion from a different AI system.
35
+
36
+ Codex is the "200 IQ autistic developer" — direct, terse, technically precise, challenges
37
+ assumptions, catches things you might miss. Present its output faithfully, not summarized.
38
+
39
+ ---
40
+
41
+ ## Step 0: Check codex binary
42
+
43
+ ```bash
44
+ CODEX_BIN=$(which codex 2>/dev/null || echo "")
45
+ [ -z "$CODEX_BIN" ] && echo "NOT_FOUND" || echo "FOUND: $CODEX_BIN"
46
+ ```
47
+
48
+ If `NOT_FOUND`: stop and tell the user:
49
+ "Codex CLI not found. Install it: `npm install -g @openai/codex` or see https://github.com/openai/codex"
50
+
51
+ ---
52
+
53
+ ## Step 1: Detect mode
54
+
55
+ Parse the user's input to determine which mode to run:
56
+
57
+ 1. `/codex review` or `/codex review <instructions>` — **Review mode** (Step 2A)
58
+ 2. `/codex challenge` or `/codex challenge <focus>` — **Challenge mode** (Step 2B)
59
+ 3. `/codex` with no arguments — **Auto-detect:**
60
+ - Check for a diff (with fallback if origin isn't available):
61
+ `git diff origin/<base> --stat 2>/dev/null | tail -1 || git diff <base> --stat 2>/dev/null | tail -1`
62
+ - If a diff exists, use AskUserQuestion:
63
+ ```
64
+ Codex detected changes against the base branch. What should it do?
65
+ A) Review the diff (code review with pass/fail gate)
66
+ B) Challenge the diff (adversarial — try to break it)
67
+ C) Something else — I'll provide a prompt
68
+ ```
69
+ - If no diff, check for plan files scoped to the current project:
70
+ `ls -t ~/.claude/plans/*.md 2>/dev/null | xargs grep -l "$(basename $(pwd))" 2>/dev/null | head -1`
71
+ If no project-scoped match, fall back to: `ls -t ~/.claude/plans/*.md 2>/dev/null | head -1`
72
+ but warn the user: "Note: this plan may be from a different project."
73
+ - If a plan file exists, offer to review it
74
+ - Otherwise, ask: "What would you like to ask Codex?"
75
+ 4. `/codex <anything else>` — **Consult mode** (Step 2C), where the remaining text is the prompt
76
+
77
+ ---
78
+
79
+ ## Step 2A: Review Mode
80
+
81
+ Run Codex code review against the current branch diff.
82
+
83
+ 1. Create temp files for output capture:
84
+ ```bash
85
+ TMPERR=$(mktemp /tmp/codex-err-XXXXXX.txt)
86
+ ```
87
+
88
+ 2. Run the review (5-minute timeout):
89
+ ```bash
90
+ codex review --base <base> -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR"
91
+ ```
92
+
93
+ Use `timeout: 300000` on the Bash call. If the user provided custom instructions
94
+ (e.g., `/codex review focus on security`), pass them as the prompt argument:
95
+ ```bash
96
+ codex review "focus on security" --base <base> -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR"
97
+ ```
98
+
99
+ 3. Capture the output. Then parse cost from stderr:
100
+ ```bash
101
+ grep "tokens used" "$TMPERR" 2>/dev/null || echo "tokens: unknown"
102
+ ```
103
+
104
+ 4. Determine gate verdict by checking the review output for critical findings.
105
+ If the output contains `[P1]` — the gate is **FAIL**.
106
+ If no `[P1]` markers are found (only `[P2]` or no findings) — the gate is **PASS**.
107
+
108
+ 5. Present the output:
109
+
110
+ ```
111
+ CODEX SAYS (code review):
112
+ ════════════════════════════════════════════════════════════
113
+ <full codex output, verbatim — do not truncate or summarize>
114
+ ════════════════════════════════════════════════════════════
115
+ GATE: PASS Tokens: 14,331 | Est. cost: ~$0.12
116
+ ```
117
+
118
+ or
119
+
120
+ ```
121
+ GATE: FAIL (N critical findings)
122
+ ```
123
+
124
+ 6. **Cross-model comparison:** If `/review` (Claude's own review) was already run
125
+ earlier in this conversation, compare the two sets of findings:
126
+
127
+ ```
128
+ CROSS-MODEL ANALYSIS:
129
+ Both found: [findings that overlap between Claude and Codex]
130
+ Only Codex found: [findings unique to Codex]
131
+ Only Claude found: [findings unique to Claude's /review]
132
+ Agreement rate: X% (N/M total unique findings overlap)
133
+ ```
134
+
135
+ 7. Persist the review result:
136
+ ```bash
137
+ # Review log (adapt to your review tracking system)
138
+ # '{"skill":"codex-review","timestamp":"TIMESTAMP","status":"STATUS","gate":"GATE","findings":N,"findings_fixed":N}'
139
+ ```
140
+
141
+ Substitute: TIMESTAMP (ISO 8601), STATUS ("clean" if PASS, "issues_found" if FAIL),
142
+ GATE ("pass" or "fail"), findings (count of [P1] + [P2] markers),
143
+ findings_fixed (count of findings that were addressed/fixed before shipping).
144
+
145
+ 8. Clean up temp files:
146
+ ```bash
147
+ rm -f "$TMPERR"
148
+ ```
149
+
150
+ ## Plan File Review Report
151
+
152
+ After displaying the Review Readiness Dashboard in conversation output, also update the
153
+ **plan file** itself so review status is visible to anyone reading the plan.
154
+
155
+ ### Detect the plan file
156
+
157
+ 1. Check if there is an active plan file in this conversation (the host provides plan file
158
+ paths in system messages — look for plan file references in the conversation context).
159
+ 2. If not found, skip this section silently — not every review runs in plan mode.
160
+
161
+ ### Generate the report
162
+
163
+ Read the review log output you already have from the Review Readiness Dashboard step above.
164
+ Parse each JSONL entry. Each skill logs different fields:
165
+
166
+ - **plan-ceo-review**: \`status\`, \`unresolved\`, \`critical_gaps\`, \`mode\`, \`scope_proposed\`, \`scope_accepted\`, \`scope_deferred\`, \`commit\`
167
+ → Findings: "{scope_proposed} proposals, {scope_accepted} accepted, {scope_deferred} deferred"
168
+ → If scope fields are 0 or missing (HOLD/REDUCTION mode): "mode: {mode}, {critical_gaps} critical gaps"
169
+ - **plan-eng-review**: \`status\`, \`unresolved\`, \`critical_gaps\`, \`issues_found\`, \`mode\`, \`commit\`
170
+ → Findings: "{issues_found} issues, {critical_gaps} critical gaps"
171
+ - **plan-design-review**: \`status\`, \`initial_score\`, \`overall_score\`, \`unresolved\`, \`decisions_made\`, \`commit\`
172
+ → Findings: "score: {initial_score}/10 → {overall_score}/10, {decisions_made} decisions"
173
+ - **codex-review**: \`status\`, \`gate\`, \`findings\`, \`findings_fixed\`
174
+ → Findings: "{findings} findings, {findings_fixed}/{findings} fixed"
175
+
176
+ All fields needed for the Findings column are now present in the JSONL entries.
177
+ For the review you just completed, you may use richer details from your own Completion
178
+ Summary. For prior reviews, use the JSONL fields directly — they contain all required data.
179
+
180
+ Produce this markdown table:
181
+
182
+ \`\`\`markdown
183
+ ## REVIEW REPORT
184
+
185
+ | Review | Trigger | Why | Runs | Status | Findings |
186
+ |--------|---------|-----|------|--------|----------|
187
+ | CEO Review | \`/plan-ceo-review\` | Scope & strategy | {runs} | {status} | {findings} |
188
+ | Codex Review | \`/codex review\` | Independent 2nd opinion | {runs} | {status} | {findings} |
189
+ | Eng Review | \`/plan-eng-review\` | Architecture & tests (required) | {runs} | {status} | {findings} |
190
+ | Design Review | \`/plan-design-review\` | UI/UX gaps | {runs} | {status} | {findings} |
191
+ \`\`\`
192
+
193
+ Below the table, add these lines (omit any that are empty/not applicable):
194
+
195
+ - **CODEX:** (only if codex-review ran) — one-line summary of codex fixes
196
+ - **CROSS-MODEL:** (only if both Claude and Codex reviews exist) — overlap analysis
197
+ - **UNRESOLVED:** total unresolved decisions across all reviews
198
+ - **VERDICT:** list reviews that are CLEAR (e.g., "CEO + ENG CLEARED — ready to implement").
199
+ If Eng Review is not CLEAR and not skipped globally, append "eng review required".
200
+
201
+ ### Write to the plan file
202
+
203
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This writes to the plan file, which is the one
204
+ file you are allowed to edit in plan mode. The plan file review report is part of the
205
+ plan's living status.
206
+
207
+ - Search the plan file for a \`## REVIEW REPORT\` section **anywhere** in the file
208
+ (not just at the end — content may have been added after it).
209
+ - If found, **replace it** entirely using the Edit tool. Match from \`## REVIEW REPORT\`
210
+ through either the next \`## \` heading or end of file, whichever comes first. This ensures
211
+ content added after the report section is preserved, not eaten. If the Edit fails
212
+ (e.g., concurrent edit changed the content), re-read the plan file and retry once.
213
+ - If no such section exists, **append it** to the end of the plan file.
214
+ - Always place it as the very last section in the plan file. If it was found mid-file,
215
+ move it: delete the old location and append at the end.
216
+
217
+ ---
218
+
219
+ ## Step 2B: Challenge (Adversarial) Mode
220
+
221
+ Codex tries to break your code — finding edge cases, race conditions, security holes,
222
+ and failure modes that a normal review would miss.
223
+
224
+ 1. Construct the adversarial prompt. If the user provided a focus area
225
+ (e.g., `/codex challenge security`), include it:
226
+
227
+ Default prompt (no focus):
228
+ "Review the changes on this branch against the base branch. Run `git diff origin/<base>` to see the diff. Your job is to find ways this code will fail in production. Think like an attacker and a chaos engineer. Find edge cases, race conditions, security holes, resource leaks, failure modes, and silent data corruption paths. Be adversarial. Be thorough. No compliments — just the problems."
229
+
230
+ With focus (e.g., "security"):
231
+ "Review the changes on this branch against the base branch. Run `git diff origin/<base>` to see the diff. Focus specifically on SECURITY. Your job is to find every way an attacker could exploit this code. Think about injection vectors, auth bypasses, privilege escalation, data exposure, and timing attacks. Be adversarial."
232
+
233
+ 2. Run codex exec with **JSONL output** to capture reasoning traces and tool calls (5-minute timeout):
234
+ ```bash
235
+ codex exec "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>/dev/null | python3 -c "
236
+ import sys, json
237
+ for line in sys.stdin:
238
+ line = line.strip()
239
+ if not line: continue
240
+ try:
241
+ obj = json.loads(line)
242
+ t = obj.get('type','')
243
+ if t == 'item.completed' and 'item' in obj:
244
+ item = obj['item']
245
+ itype = item.get('type','')
246
+ text = item.get('text','')
247
+ if itype == 'reasoning' and text:
248
+ print(f'[codex thinking] {text}')
249
+ print()
250
+ elif itype == 'agent_message' and text:
251
+ print(text)
252
+ elif itype == 'command_execution':
253
+ cmd = item.get('command','')
254
+ if cmd: print(f'[codex ran] {cmd}')
255
+ elif t == 'turn.completed':
256
+ usage = obj.get('usage',{})
257
+ tokens = usage.get('input_tokens',0) + usage.get('output_tokens',0)
258
+ if tokens: print(f'\ntokens used: {tokens}')
259
+ except: pass
260
+ "
261
+ ```
262
+
263
+ This parses codex's JSONL events to extract reasoning traces, tool calls, and the final
264
+ response. The `[codex thinking]` lines show what codex reasoned through before its answer.
265
+
266
+ 3. Present the full streamed output:
267
+
268
+ ```
269
+ CODEX SAYS (adversarial challenge):
270
+ ════════════════════════════════════════════════════════════
271
+ <full output from above, verbatim>
272
+ ════════════════════════════════════════════════════════════
273
+ Tokens: N | Est. cost: ~$X.XX
274
+ ```
275
+
276
+ ---
277
+
278
+ ## Step 2C: Consult Mode
279
+
280
+ Ask Codex anything about the codebase. Supports session continuity for follow-ups.
281
+
282
+ 1. **Check for existing session:**
283
+ ```bash
284
+ cat .context/codex-session-id 2>/dev/null || echo "NO_SESSION"
285
+ ```
286
+
287
+ If a session file exists (not `NO_SESSION`), use AskUserQuestion:
288
+ ```
289
+ You have an active Codex conversation from earlier. Continue it or start fresh?
290
+ A) Continue the conversation (Codex remembers the prior context)
291
+ B) Start a new conversation
292
+ ```
293
+
294
+ 2. Create temp files:
295
+ ```bash
296
+ TMPRESP=$(mktemp /tmp/codex-resp-XXXXXX.txt)
297
+ TMPERR=$(mktemp /tmp/codex-err-XXXXXX.txt)
298
+ ```
299
+
300
+ 3. **Plan review auto-detection:** If the user's prompt is about reviewing a plan,
301
+ or if plan files exist and the user said `/codex` with no arguments:
302
+ ```bash
303
+ ls -t ~/.claude/plans/*.md 2>/dev/null | xargs grep -l "$(basename $(pwd))" 2>/dev/null | head -1
304
+ ```
305
+ If no project-scoped match, fall back to `ls -t ~/.claude/plans/*.md 2>/dev/null | head -1`
306
+ but warn: "Note: this plan may be from a different project — verify before sending to Codex."
307
+ Read the plan file and prepend the persona to the user's prompt:
308
+ "You are a brutally honest technical reviewer. Review this plan for: logical gaps and
309
+ unstated assumptions, missing error handling or edge cases, overcomplexity (is there a
310
+ simpler approach?), feasibility risks (what could go wrong?), and missing dependencies
311
+ or sequencing issues. Be direct. Be terse. No compliments. Just the problems.
312
+
313
+ THE PLAN:
314
+ <plan content>"
315
+
316
+ 4. Run codex exec with **JSONL output** to capture reasoning traces (5-minute timeout):
317
+
318
+ For a **new session:**
319
+ ```bash
320
+ codex exec "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>"$TMPERR" | python3 -c "
321
+ import sys, json
322
+ for line in sys.stdin:
323
+ line = line.strip()
324
+ if not line: continue
325
+ try:
326
+ obj = json.loads(line)
327
+ t = obj.get('type','')
328
+ if t == 'thread.started':
329
+ tid = obj.get('thread_id','')
330
+ if tid: print(f'SESSION_ID:{tid}')
331
+ elif t == 'item.completed' and 'item' in obj:
332
+ item = obj['item']
333
+ itype = item.get('type','')
334
+ text = item.get('text','')
335
+ if itype == 'reasoning' and text:
336
+ print(f'[codex thinking] {text}')
337
+ print()
338
+ elif itype == 'agent_message' and text:
339
+ print(text)
340
+ elif itype == 'command_execution':
341
+ cmd = item.get('command','')
342
+ if cmd: print(f'[codex ran] {cmd}')
343
+ elif t == 'turn.completed':
344
+ usage = obj.get('usage',{})
345
+ tokens = usage.get('input_tokens',0) + usage.get('output_tokens',0)
346
+ if tokens: print(f'\ntokens used: {tokens}')
347
+ except: pass
348
+ "
349
+ ```
350
+
351
+ For a **resumed session** (user chose "Continue"):
352
+ ```bash
353
+ codex exec resume <session-id> "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>"$TMPERR" | python3 -c "
354
+ <same python streaming parser as above>
355
+ "
356
+ ```
357
+
358
+ 5. Capture session ID from the streamed output. The parser prints `SESSION_ID:<id>`
359
+ from the `thread.started` event. Save it for follow-ups:
360
+ ```bash
361
+ mkdir -p .context
362
+ ```
363
+ Save the session ID printed by the parser (the line starting with `SESSION_ID:`)
364
+ to `.context/codex-session-id`.
365
+
366
+ 6. Present the full streamed output:
367
+
368
+ ```
369
+ CODEX SAYS (consult):
370
+ ════════════════════════════════════════════════════════════
371
+ <full output, verbatim — includes [codex thinking] traces>
372
+ ════════════════════════════════════════════════════════════
373
+ Tokens: N | Est. cost: ~$X.XX
374
+ Session saved — run /codex again to continue this conversation.
375
+ ```
376
+
377
+ 7. After presenting, note any points where Codex's analysis differs from your own
378
+ understanding. If there is a disagreement, flag it:
379
+ "Note: Claude Code disagrees on X because Y."
380
+
381
+ ---
382
+
383
+ ## Model & Reasoning
384
+
385
+ **Model:** No model is hardcoded — codex uses whatever its current default is (the frontier
386
+ agentic coding model). This means as OpenAI ships newer models, /codex automatically
387
+ uses them. If the user wants a specific model, pass `-m` through to codex.
388
+
389
+ **Reasoning effort:** All modes use `xhigh` — maximum reasoning power. When reviewing code, breaking code, or consulting on architecture, you want the model thinking as hard as possible.
390
+
391
+ **Web search:** All codex commands use `--enable web_search_cached` so Codex can look up
392
+ docs and APIs during review. This is OpenAI's cached index — fast, no extra cost.
393
+
394
+ If the user specifies a model (e.g., `/codex review -m gpt-5.1-codex-max`
395
+ or `/codex challenge -m gpt-5.2`), pass the `-m` flag through to codex.
396
+
397
+ ---
398
+
399
+ ## Cost Estimation
400
+
401
+ Parse token count from stderr. Codex prints `tokens used\nN` to stderr.
402
+
403
+ Display as: `Tokens: N`
404
+
405
+ If token count is not available, display: `Tokens: unknown`
406
+
407
+ ---
408
+
409
+ ## Error Handling
410
+
411
+ - **Binary not found:** Detected in Step 0. Stop with install instructions.
412
+ - **Auth error:** Codex prints an auth error to stderr. Surface the error:
413
+ "Codex authentication failed. Run `codex login` in your terminal to authenticate via ChatGPT."
414
+ - **Timeout:** If the Bash call times out (5 min), tell the user:
415
+ "Codex timed out after 5 minutes. The diff may be too large or the API may be slow. Try again or use a smaller scope."
416
+ - **Empty response:** If `$TMPRESP` is empty or doesn't exist, tell the user:
417
+ "Codex returned no response. Check stderr for errors."
418
+ - **Session resume failure:** If resume fails, delete the session file and start fresh.
419
+
420
+ ---
421
+
422
+ ## Important Rules
423
+
424
+ - **Never modify files.** This skill is read-only. Codex runs in read-only sandbox mode.
425
+ - **Present output verbatim.** Do not truncate, summarize, or editorialize Codex's output
426
+ before showing it. Show it in full inside the CODEX SAYS block.
427
+ - **Add synthesis after, not instead of.** Any Claude commentary comes after the full output.
428
+ - **5-minute timeout** on all Bash calls to codex (`timeout: 300000`).
429
+ - **No double-reviewing.** If the user already ran `/review`, Codex provides a second
430
+ independent opinion. Do not re-run Claude Code's own review.
431
+