@runchr/gstack-antigravity 0.1.1 → 0.1.3

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.

Potentially problematic release.


This version of @runchr/gstack-antigravity might be problematic. Click here for more details.

Files changed (229) hide show
  1. package/.agents/skills/gstack/.agents/skills/gstack/SKILL.md +651 -0
  2. package/.agents/skills/gstack/.agents/skills/gstack-autoplan/SKILL.md +678 -0
  3. package/.agents/skills/gstack/.agents/skills/gstack-benchmark/SKILL.md +482 -0
  4. package/.agents/skills/gstack/.agents/skills/gstack-browse/SKILL.md +511 -0
  5. package/.agents/skills/gstack/.agents/skills/gstack-canary/SKILL.md +486 -0
  6. package/.agents/skills/gstack/.agents/skills/gstack-careful/SKILL.md +50 -0
  7. package/.agents/skills/gstack/.agents/skills/gstack-cso/SKILL.md +607 -0
  8. package/.agents/skills/gstack/.agents/skills/gstack-design-consultation/SKILL.md +615 -0
  9. package/.agents/skills/gstack/.agents/skills/gstack-design-review/SKILL.md +988 -0
  10. package/.agents/skills/gstack/.agents/skills/gstack-document-release/SKILL.md +604 -0
  11. package/.agents/skills/gstack/.agents/skills/gstack-freeze/SKILL.md +67 -0
  12. package/.agents/skills/gstack/.agents/skills/gstack-guard/SKILL.md +62 -0
  13. package/.agents/skills/gstack/.agents/skills/gstack-investigate/SKILL.md +415 -0
  14. package/.agents/skills/gstack/.agents/skills/gstack-land-and-deploy/SKILL.md +873 -0
  15. package/.agents/skills/gstack/.agents/skills/gstack-office-hours/SKILL.md +986 -0
  16. package/.agents/skills/gstack/.agents/skills/gstack-plan-ceo-review/SKILL.md +1268 -0
  17. package/.agents/skills/gstack/.agents/skills/gstack-plan-design-review/SKILL.md +668 -0
  18. package/.agents/skills/gstack/.agents/skills/gstack-plan-eng-review/SKILL.md +826 -0
  19. package/.agents/skills/gstack/.agents/skills/gstack-qa/SKILL.md +1006 -0
  20. package/.agents/skills/gstack/.agents/skills/gstack-qa-only/SKILL.md +626 -0
  21. package/.agents/skills/gstack/.agents/skills/gstack-retro/SKILL.md +1065 -0
  22. package/.agents/skills/gstack/.agents/skills/gstack-review/SKILL.md +704 -0
  23. package/.agents/skills/gstack/.agents/skills/gstack-setup-browser-cookies/SKILL.md +325 -0
  24. package/.agents/skills/gstack/.agents/skills/gstack-setup-deploy/SKILL.md +450 -0
  25. package/.agents/skills/gstack/.agents/skills/gstack-ship/SKILL.md +1312 -0
  26. package/.agents/skills/gstack/.agents/skills/gstack-unfreeze/SKILL.md +36 -0
  27. package/.agents/skills/gstack/.agents/skills/gstack-upgrade/SKILL.md +220 -0
  28. package/.agents/skills/gstack/.env.example +5 -0
  29. package/.agents/skills/gstack/.github/workflows/skill-docs.yml +17 -0
  30. package/.agents/skills/gstack/AGENTS.md +49 -0
  31. package/.agents/skills/gstack/ARCHITECTURE.md +359 -0
  32. package/.agents/skills/gstack/BROWSER.md +271 -0
  33. package/.agents/skills/gstack/CHANGELOG.md +800 -0
  34. package/.agents/skills/gstack/CLAUDE.md +284 -0
  35. package/.agents/skills/gstack/CONTRIBUTING.md +370 -0
  36. package/.agents/skills/gstack/ETHOS.md +129 -0
  37. package/.agents/skills/gstack/LICENSE +21 -0
  38. package/.agents/skills/gstack/README.md +228 -0
  39. package/.agents/skills/gstack/SKILL.md +657 -0
  40. package/.agents/skills/gstack/SKILL.md.tmpl +281 -0
  41. package/.agents/skills/gstack/TODOS.md +564 -0
  42. package/.agents/skills/gstack/VERSION +1 -0
  43. package/.agents/skills/gstack/autoplan/SKILL.md +689 -0
  44. package/.agents/skills/gstack/autoplan/SKILL.md.tmpl +416 -0
  45. package/.agents/skills/gstack/benchmark/SKILL.md +489 -0
  46. package/.agents/skills/gstack/benchmark/SKILL.md.tmpl +233 -0
  47. package/.agents/skills/gstack/bin/dev-setup +68 -0
  48. package/.agents/skills/gstack/bin/dev-teardown +56 -0
  49. package/.agents/skills/gstack/bin/gstack-analytics +191 -0
  50. package/.agents/skills/gstack/bin/gstack-community-dashboard +113 -0
  51. package/.agents/skills/gstack/bin/gstack-config +38 -0
  52. package/.agents/skills/gstack/bin/gstack-diff-scope +71 -0
  53. package/.agents/skills/gstack/bin/gstack-global-discover.ts +591 -0
  54. package/.agents/skills/gstack/bin/gstack-repo-mode +93 -0
  55. package/.agents/skills/gstack/bin/gstack-review-log +9 -0
  56. package/.agents/skills/gstack/bin/gstack-review-read +12 -0
  57. package/.agents/skills/gstack/bin/gstack-slug +15 -0
  58. package/.agents/skills/gstack/bin/gstack-telemetry-log +158 -0
  59. package/.agents/skills/gstack/bin/gstack-telemetry-sync +127 -0
  60. package/.agents/skills/gstack/bin/gstack-update-check +196 -0
  61. package/.agents/skills/gstack/browse/SKILL.md +517 -0
  62. package/.agents/skills/gstack/browse/SKILL.md.tmpl +141 -0
  63. package/.agents/skills/gstack/browse/bin/find-browse +21 -0
  64. package/.agents/skills/gstack/browse/bin/remote-slug +14 -0
  65. package/.agents/skills/gstack/browse/scripts/build-node-server.sh +48 -0
  66. package/.agents/skills/gstack/browse/src/browser-manager.ts +634 -0
  67. package/.agents/skills/gstack/browse/src/buffers.ts +137 -0
  68. package/.agents/skills/gstack/browse/src/bun-polyfill.cjs +109 -0
  69. package/.agents/skills/gstack/browse/src/cli.ts +420 -0
  70. package/.agents/skills/gstack/browse/src/commands.ts +111 -0
  71. package/.agents/skills/gstack/browse/src/config.ts +150 -0
  72. package/.agents/skills/gstack/browse/src/cookie-import-browser.ts +417 -0
  73. package/.agents/skills/gstack/browse/src/cookie-picker-routes.ts +207 -0
  74. package/.agents/skills/gstack/browse/src/cookie-picker-ui.ts +541 -0
  75. package/.agents/skills/gstack/browse/src/find-browse.ts +61 -0
  76. package/.agents/skills/gstack/browse/src/meta-commands.ts +269 -0
  77. package/.agents/skills/gstack/browse/src/platform.ts +17 -0
  78. package/.agents/skills/gstack/browse/src/read-commands.ts +335 -0
  79. package/.agents/skills/gstack/browse/src/server.ts +369 -0
  80. package/.agents/skills/gstack/browse/src/snapshot.ts +398 -0
  81. package/.agents/skills/gstack/browse/src/url-validation.ts +91 -0
  82. package/.agents/skills/gstack/browse/src/write-commands.ts +352 -0
  83. package/.agents/skills/gstack/browse/test/bun-polyfill.test.ts +72 -0
  84. package/.agents/skills/gstack/browse/test/commands.test.ts +1836 -0
  85. package/.agents/skills/gstack/browse/test/config.test.ts +250 -0
  86. package/.agents/skills/gstack/browse/test/cookie-import-browser.test.ts +397 -0
  87. package/.agents/skills/gstack/browse/test/cookie-picker-routes.test.ts +205 -0
  88. package/.agents/skills/gstack/browse/test/find-browse.test.ts +50 -0
  89. package/.agents/skills/gstack/browse/test/fixtures/basic.html +33 -0
  90. package/.agents/skills/gstack/browse/test/fixtures/cursor-interactive.html +22 -0
  91. package/.agents/skills/gstack/browse/test/fixtures/dialog.html +15 -0
  92. package/.agents/skills/gstack/browse/test/fixtures/empty.html +2 -0
  93. package/.agents/skills/gstack/browse/test/fixtures/forms.html +55 -0
  94. package/.agents/skills/gstack/browse/test/fixtures/qa-eval-checkout.html +108 -0
  95. package/.agents/skills/gstack/browse/test/fixtures/qa-eval-spa.html +98 -0
  96. package/.agents/skills/gstack/browse/test/fixtures/qa-eval.html +51 -0
  97. package/.agents/skills/gstack/browse/test/fixtures/responsive.html +49 -0
  98. package/.agents/skills/gstack/browse/test/fixtures/snapshot.html +55 -0
  99. package/.agents/skills/gstack/browse/test/fixtures/spa.html +24 -0
  100. package/.agents/skills/gstack/browse/test/fixtures/states.html +17 -0
  101. package/.agents/skills/gstack/browse/test/fixtures/upload.html +25 -0
  102. package/.agents/skills/gstack/browse/test/gstack-config.test.ts +125 -0
  103. package/.agents/skills/gstack/browse/test/gstack-update-check.test.ts +467 -0
  104. package/.agents/skills/gstack/browse/test/handoff.test.ts +235 -0
  105. package/.agents/skills/gstack/browse/test/path-validation.test.ts +63 -0
  106. package/.agents/skills/gstack/browse/test/platform.test.ts +37 -0
  107. package/.agents/skills/gstack/browse/test/snapshot.test.ts +467 -0
  108. package/.agents/skills/gstack/browse/test/test-server.ts +57 -0
  109. package/.agents/skills/gstack/browse/test/url-validation.test.ts +72 -0
  110. package/.agents/skills/gstack/canary/SKILL.md +493 -0
  111. package/.agents/skills/gstack/canary/SKILL.md.tmpl +220 -0
  112. package/.agents/skills/gstack/careful/SKILL.md +59 -0
  113. package/.agents/skills/gstack/careful/SKILL.md.tmpl +57 -0
  114. package/.agents/skills/gstack/careful/bin/check-careful.sh +112 -0
  115. package/.agents/skills/gstack/codex/SKILL.md +677 -0
  116. package/.agents/skills/gstack/codex/SKILL.md.tmpl +356 -0
  117. package/.agents/skills/gstack/conductor.json +6 -0
  118. package/.agents/skills/gstack/cso/SKILL.md +615 -0
  119. package/.agents/skills/gstack/cso/SKILL.md.tmpl +376 -0
  120. package/.agents/skills/gstack/design-consultation/SKILL.md +625 -0
  121. package/.agents/skills/gstack/design-consultation/SKILL.md.tmpl +369 -0
  122. package/.agents/skills/gstack/design-review/SKILL.md +998 -0
  123. package/.agents/skills/gstack/design-review/SKILL.md.tmpl +262 -0
  124. package/.agents/skills/gstack/docs/images/github-2013.png +0 -0
  125. package/.agents/skills/gstack/docs/images/github-2026.png +0 -0
  126. package/.agents/skills/gstack/docs/skills.md +877 -0
  127. package/.agents/skills/gstack/document-release/SKILL.md +613 -0
  128. package/.agents/skills/gstack/document-release/SKILL.md.tmpl +357 -0
  129. package/.agents/skills/gstack/freeze/SKILL.md +82 -0
  130. package/.agents/skills/gstack/freeze/SKILL.md.tmpl +80 -0
  131. package/.agents/skills/gstack/freeze/bin/check-freeze.sh +68 -0
  132. package/.agents/skills/gstack/gstack-upgrade/SKILL.md +226 -0
  133. package/.agents/skills/gstack/gstack-upgrade/SKILL.md.tmpl +224 -0
  134. package/.agents/skills/gstack/guard/SKILL.md +82 -0
  135. package/.agents/skills/gstack/guard/SKILL.md.tmpl +80 -0
  136. package/.agents/skills/gstack/investigate/SKILL.md +435 -0
  137. package/.agents/skills/gstack/investigate/SKILL.md.tmpl +196 -0
  138. package/.agents/skills/gstack/land-and-deploy/SKILL.md +880 -0
  139. package/.agents/skills/gstack/land-and-deploy/SKILL.md.tmpl +575 -0
  140. package/.agents/skills/gstack/office-hours/SKILL.md +996 -0
  141. package/.agents/skills/gstack/office-hours/SKILL.md.tmpl +624 -0
  142. package/.agents/skills/gstack/package.json +55 -0
  143. package/.agents/skills/gstack/plan-ceo-review/SKILL.md +1277 -0
  144. package/.agents/skills/gstack/plan-ceo-review/SKILL.md.tmpl +838 -0
  145. package/.agents/skills/gstack/plan-design-review/SKILL.md +676 -0
  146. package/.agents/skills/gstack/plan-design-review/SKILL.md.tmpl +314 -0
  147. package/.agents/skills/gstack/plan-eng-review/SKILL.md +836 -0
  148. package/.agents/skills/gstack/plan-eng-review/SKILL.md.tmpl +279 -0
  149. package/.agents/skills/gstack/qa/SKILL.md +1016 -0
  150. package/.agents/skills/gstack/qa/SKILL.md.tmpl +316 -0
  151. package/.agents/skills/gstack/qa/references/issue-taxonomy.md +85 -0
  152. package/.agents/skills/gstack/qa/templates/qa-report-template.md +126 -0
  153. package/.agents/skills/gstack/qa-only/SKILL.md +633 -0
  154. package/.agents/skills/gstack/qa-only/SKILL.md.tmpl +101 -0
  155. package/.agents/skills/gstack/retro/SKILL.md +1072 -0
  156. package/.agents/skills/gstack/retro/SKILL.md.tmpl +833 -0
  157. package/.agents/skills/gstack/review/SKILL.md +849 -0
  158. package/.agents/skills/gstack/review/SKILL.md.tmpl +259 -0
  159. package/.agents/skills/gstack/review/TODOS-format.md +62 -0
  160. package/.agents/skills/gstack/review/checklist.md +190 -0
  161. package/.agents/skills/gstack/review/design-checklist.md +132 -0
  162. package/.agents/skills/gstack/review/greptile-triage.md +220 -0
  163. package/.agents/skills/gstack/scripts/analytics.ts +190 -0
  164. package/.agents/skills/gstack/scripts/dev-skill.ts +82 -0
  165. package/.agents/skills/gstack/scripts/eval-compare.ts +96 -0
  166. package/.agents/skills/gstack/scripts/eval-list.ts +116 -0
  167. package/.agents/skills/gstack/scripts/eval-select.ts +86 -0
  168. package/.agents/skills/gstack/scripts/eval-summary.ts +187 -0
  169. package/.agents/skills/gstack/scripts/eval-watch.ts +172 -0
  170. package/.agents/skills/gstack/scripts/gen-skill-docs.ts +2414 -0
  171. package/.agents/skills/gstack/scripts/skill-check.ts +167 -0
  172. package/.agents/skills/gstack/setup +269 -0
  173. package/.agents/skills/gstack/setup-browser-cookies/SKILL.md +330 -0
  174. package/.agents/skills/gstack/setup-browser-cookies/SKILL.md.tmpl +74 -0
  175. package/.agents/skills/gstack/setup-deploy/SKILL.md +459 -0
  176. package/.agents/skills/gstack/setup-deploy/SKILL.md.tmpl +220 -0
  177. package/.agents/skills/gstack/ship/SKILL.md +1457 -0
  178. package/.agents/skills/gstack/ship/SKILL.md.tmpl +528 -0
  179. package/.agents/skills/gstack/supabase/config.sh +10 -0
  180. package/.agents/skills/gstack/supabase/functions/community-pulse/index.ts +59 -0
  181. package/.agents/skills/gstack/supabase/functions/telemetry-ingest/index.ts +135 -0
  182. package/.agents/skills/gstack/supabase/functions/update-check/index.ts +37 -0
  183. package/.agents/skills/gstack/supabase/migrations/001_telemetry.sql +89 -0
  184. package/.agents/skills/gstack/test/analytics.test.ts +277 -0
  185. package/.agents/skills/gstack/test/codex-e2e.test.ts +197 -0
  186. package/.agents/skills/gstack/test/fixtures/coverage-audit-fixture.ts +76 -0
  187. package/.agents/skills/gstack/test/fixtures/eval-baselines.json +7 -0
  188. package/.agents/skills/gstack/test/fixtures/qa-eval-checkout-ground-truth.json +43 -0
  189. package/.agents/skills/gstack/test/fixtures/qa-eval-ground-truth.json +43 -0
  190. package/.agents/skills/gstack/test/fixtures/qa-eval-spa-ground-truth.json +43 -0
  191. package/.agents/skills/gstack/test/fixtures/review-eval-design-slop.css +86 -0
  192. package/.agents/skills/gstack/test/fixtures/review-eval-design-slop.html +41 -0
  193. package/.agents/skills/gstack/test/fixtures/review-eval-enum-diff.rb +30 -0
  194. package/.agents/skills/gstack/test/fixtures/review-eval-enum.rb +27 -0
  195. package/.agents/skills/gstack/test/fixtures/review-eval-vuln.rb +14 -0
  196. package/.agents/skills/gstack/test/gemini-e2e.test.ts +173 -0
  197. package/.agents/skills/gstack/test/gen-skill-docs.test.ts +1049 -0
  198. package/.agents/skills/gstack/test/global-discover.test.ts +187 -0
  199. package/.agents/skills/gstack/test/helpers/codex-session-runner.ts +282 -0
  200. package/.agents/skills/gstack/test/helpers/e2e-helpers.ts +239 -0
  201. package/.agents/skills/gstack/test/helpers/eval-store.test.ts +548 -0
  202. package/.agents/skills/gstack/test/helpers/eval-store.ts +689 -0
  203. package/.agents/skills/gstack/test/helpers/gemini-session-runner.test.ts +104 -0
  204. package/.agents/skills/gstack/test/helpers/gemini-session-runner.ts +201 -0
  205. package/.agents/skills/gstack/test/helpers/llm-judge.ts +130 -0
  206. package/.agents/skills/gstack/test/helpers/observability.test.ts +283 -0
  207. package/.agents/skills/gstack/test/helpers/session-runner.test.ts +96 -0
  208. package/.agents/skills/gstack/test/helpers/session-runner.ts +357 -0
  209. package/.agents/skills/gstack/test/helpers/skill-parser.ts +206 -0
  210. package/.agents/skills/gstack/test/helpers/touchfiles.ts +260 -0
  211. package/.agents/skills/gstack/test/hook-scripts.test.ts +373 -0
  212. package/.agents/skills/gstack/test/skill-e2e-browse.test.ts +293 -0
  213. package/.agents/skills/gstack/test/skill-e2e-deploy.test.ts +279 -0
  214. package/.agents/skills/gstack/test/skill-e2e-design.test.ts +614 -0
  215. package/.agents/skills/gstack/test/skill-e2e-plan.test.ts +538 -0
  216. package/.agents/skills/gstack/test/skill-e2e-qa-bugs.test.ts +194 -0
  217. package/.agents/skills/gstack/test/skill-e2e-qa-workflow.test.ts +412 -0
  218. package/.agents/skills/gstack/test/skill-e2e-review.test.ts +535 -0
  219. package/.agents/skills/gstack/test/skill-e2e-workflow.test.ts +586 -0
  220. package/.agents/skills/gstack/test/skill-e2e.test.ts +3325 -0
  221. package/.agents/skills/gstack/test/skill-llm-eval.test.ts +787 -0
  222. package/.agents/skills/gstack/test/skill-parser.test.ts +179 -0
  223. package/.agents/skills/gstack/test/skill-routing-e2e.test.ts +605 -0
  224. package/.agents/skills/gstack/test/skill-validation.test.ts +1520 -0
  225. package/.agents/skills/gstack/test/telemetry.test.ts +278 -0
  226. package/.agents/skills/gstack/test/touchfiles.test.ts +262 -0
  227. package/.agents/skills/gstack/unfreeze/SKILL.md +40 -0
  228. package/.agents/skills/gstack/unfreeze/SKILL.md.tmpl +38 -0
  229. package/package.json +2 -1
@@ -0,0 +1,677 @@
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
+ allowed-tools:
11
+ - Bash
12
+ - Read
13
+ - Write
14
+ - Glob
15
+ - Grep
16
+ - AskUserQuestion
17
+ ---
18
+ <!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
19
+ <!-- Regenerate: bun run gen:skill-docs -->
20
+
21
+ ## Preamble (run first)
22
+
23
+ ```bash
24
+ _UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
25
+ [ -n "$_UPD" ] && echo "$_UPD" || true
26
+ mkdir -p ~/.gstack/sessions
27
+ touch ~/.gstack/sessions/"$PPID"
28
+ _SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
29
+ find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
30
+ _CONTRIB=$(~/.claude/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
31
+ _PROACTIVE=$(~/.claude/skills/gstack/bin/gstack-config get proactive 2>/dev/null || echo "true")
32
+ _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
33
+ echo "BRANCH: $_BRANCH"
34
+ echo "PROACTIVE: $_PROACTIVE"
35
+ source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true
36
+ REPO_MODE=${REPO_MODE:-unknown}
37
+ echo "REPO_MODE: $REPO_MODE"
38
+ _LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")
39
+ echo "LAKE_INTRO: $_LAKE_SEEN"
40
+ _TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)
41
+ _TEL_PROMPTED=$([ -f ~/.gstack/.telemetry-prompted ] && echo "yes" || echo "no")
42
+ _TEL_START=$(date +%s)
43
+ _SESSION_ID="$$-$(date +%s)"
44
+ echo "TELEMETRY: ${_TEL:-off}"
45
+ echo "TEL_PROMPTED: $_TEL_PROMPTED"
46
+ mkdir -p ~/.gstack/analytics
47
+ echo '{"skill":"codex","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true
48
+ for _PF in ~/.gstack/analytics/.pending-*; do [ -f "$_PF" ] && ~/.claude/skills/gstack/bin/gstack-telemetry-log --event-type skill_run --skill _pending_finalize --outcome unknown --session-id "$_SESSION_ID" 2>/dev/null || true; break; done
49
+ ```
50
+
51
+ If `PROACTIVE` is `"false"`, do not proactively suggest gstack skills — only invoke
52
+ them when the user explicitly asks. The user opted out of proactive suggestions.
53
+
54
+ If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (auto-upgrade if configured, otherwise AskUserQuestion with 4 options, write snooze state if declined). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
55
+
56
+ If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle.
57
+ Tell the user: "gstack follows the **Boil the Lake** principle — always do the complete
58
+ thing when AI makes the marginal cost near-zero. Read more: https://garryslist.org/posts/boil-the-ocean"
59
+ Then offer to open the essay in their default browser:
60
+
61
+ ```bash
62
+ open https://garryslist.org/posts/boil-the-ocean
63
+ touch ~/.gstack/.completeness-intro-seen
64
+ ```
65
+
66
+ Only run `open` if the user says yes. Always run `touch` to mark as seen. This only happens once.
67
+
68
+ If `TEL_PROMPTED` is `no` AND `LAKE_INTRO` is `yes`: After the lake intro is handled,
69
+ ask the user about telemetry. Use AskUserQuestion:
70
+
71
+ > Help gstack get better! Community mode shares usage data (which skills you use, how long
72
+ > they take, crash info) with a stable device ID so we can track trends and fix bugs faster.
73
+ > No code, file paths, or repo names are ever sent.
74
+ > Change anytime with `gstack-config set telemetry off`.
75
+
76
+ Options:
77
+ - A) Help gstack get better! (recommended)
78
+ - B) No thanks
79
+
80
+ If A: run `~/.claude/skills/gstack/bin/gstack-config set telemetry community`
81
+
82
+ If B: ask a follow-up AskUserQuestion:
83
+
84
+ > How about anonymous mode? We just learn that *someone* used gstack — no unique ID,
85
+ > no way to connect sessions. Just a counter that helps us know if anyone's out there.
86
+
87
+ Options:
88
+ - A) Sure, anonymous is fine
89
+ - B) No thanks, fully off
90
+
91
+ If B→A: run `~/.claude/skills/gstack/bin/gstack-config set telemetry anonymous`
92
+ If B→B: run `~/.claude/skills/gstack/bin/gstack-config set telemetry off`
93
+
94
+ Always run:
95
+ ```bash
96
+ touch ~/.gstack/.telemetry-prompted
97
+ ```
98
+
99
+ This only happens once. If `TEL_PROMPTED` is `yes`, skip this entirely.
100
+
101
+ ## AskUserQuestion Format
102
+
103
+ **ALWAYS follow this structure for every AskUserQuestion call:**
104
+ 1. **Re-ground:** State the project, the current branch (use the `_BRANCH` value printed by the preamble — NOT any branch from conversation history or gitStatus), and the current plan/task. (1-2 sentences)
105
+ 2. **Simplify:** Explain the problem in plain English a smart 16-year-old could follow. No raw function names, no internal jargon, no implementation details. Use concrete examples and analogies. Say what it DOES, not what it's called.
106
+ 3. **Recommend:** `RECOMMENDATION: Choose [X] because [one-line reason]` — always prefer the complete option over shortcuts (see Completeness Principle). Include `Completeness: X/10` for each option. Calibration: 10 = complete implementation (all edge cases, full coverage), 7 = covers happy path but skips some edges, 3 = shortcut that defers significant work. If both options are 8+, pick the higher; if one is ≤5, flag it.
107
+ 4. **Options:** Lettered options: `A) ... B) ... C) ...` — when an option involves effort, show both scales: `(human: ~X / CC: ~Y)`
108
+
109
+ Assume the user hasn't looked at this window in 20 minutes and doesn't have the code open. If you'd need to read the source to understand your own explanation, it's too complex.
110
+
111
+ Per-skill instructions may add additional formatting rules on top of this baseline.
112
+
113
+ ## Completeness Principle — Boil the Lake
114
+
115
+ AI-assisted coding makes the marginal cost of completeness near-zero. When you present options:
116
+
117
+ - If Option A is the complete implementation (full parity, all edge cases, 100% coverage) and Option B is a shortcut that saves modest effort — **always recommend A**. The delta between 80 lines and 150 lines is meaningless with CC+gstack. "Good enough" is the wrong instinct when "complete" costs minutes more.
118
+ - **Lake vs. ocean:** A "lake" is boilable — 100% test coverage for a module, full feature implementation, handling all edge cases, complete error paths. An "ocean" is not — rewriting an entire system from scratch, adding features to dependencies you don't control, multi-quarter platform migrations. Recommend boiling lakes. Flag oceans as out of scope.
119
+ - **When estimating effort**, always show both scales: human team time and CC+gstack time. The compression ratio varies by task type — use this reference:
120
+
121
+ | Task type | Human team | CC+gstack | Compression |
122
+ |-----------|-----------|-----------|-------------|
123
+ | Boilerplate / scaffolding | 2 days | 15 min | ~100x |
124
+ | Test writing | 1 day | 15 min | ~50x |
125
+ | Feature implementation | 1 week | 30 min | ~30x |
126
+ | Bug fix + regression test | 4 hours | 15 min | ~20x |
127
+ | Architecture / design | 2 days | 4 hours | ~5x |
128
+ | Research / exploration | 1 day | 3 hours | ~3x |
129
+
130
+ - This principle applies to test coverage, error handling, documentation, edge cases, and feature completeness. Don't skip the last 10% to "save time" — with AI, that 10% costs seconds.
131
+
132
+ **Anti-patterns — DON'T do this:**
133
+ - BAD: "Choose B — it covers 90% of the value with less code." (If A is only 70 lines more, choose A.)
134
+ - BAD: "We can skip edge case handling to save time." (Edge case handling costs minutes with CC.)
135
+ - BAD: "Let's defer test coverage to a follow-up PR." (Tests are the cheapest lake to boil.)
136
+ - BAD: Quoting only human-team effort: "This would take 2 weeks." (Say: "2 weeks human / ~1 hour CC.")
137
+
138
+ ## Repo Ownership Mode — See Something, Say Something
139
+
140
+ `REPO_MODE` from the preamble tells you who owns issues in this repo:
141
+
142
+ - **`solo`** — One person does 80%+ of the work. They own everything. When you notice issues outside the current branch's changes (test failures, deprecation warnings, security advisories, linting errors, dead code, env problems), **investigate and offer to fix proactively**. The solo dev is the only person who will fix it. Default to action.
143
+ - **`collaborative`** — Multiple active contributors. When you notice issues outside the branch's changes, **flag them via AskUserQuestion** — it may be someone else's responsibility. Default to asking, not fixing.
144
+ - **`unknown`** — Treat as collaborative (safer default — ask before fixing).
145
+
146
+ **See Something, Say Something:** Whenever you notice something that looks wrong during ANY workflow step — not just test failures — flag it briefly. One sentence: what you noticed and its impact. In solo mode, follow up with "Want me to fix it?" In collaborative mode, just flag it and move on.
147
+
148
+ Never let a noticed issue silently pass. The whole point is proactive communication.
149
+
150
+ ## Search Before Building
151
+
152
+ Before building infrastructure, unfamiliar patterns, or anything the runtime might have a built-in — **search first.** Read `~/.claude/skills/gstack/ETHOS.md` for the full philosophy.
153
+
154
+ **Three layers of knowledge:**
155
+ - **Layer 1** (tried and true — in distribution). Don't reinvent the wheel. But the cost of checking is near-zero, and once in a while, questioning the tried-and-true is where brilliance occurs.
156
+ - **Layer 2** (new and popular — search for these). But scrutinize: humans are subject to mania. Search results are inputs to your thinking, not answers.
157
+ - **Layer 3** (first principles — prize these above all). Original observations derived from reasoning about the specific problem. The most valuable of all.
158
+
159
+ **Eureka moment:** When first-principles reasoning reveals conventional wisdom is wrong, name it:
160
+ "EUREKA: Everyone does X because [assumption]. But [evidence] shows this is wrong. Y is better because [reasoning]."
161
+
162
+ Log eureka moments:
163
+ ```bash
164
+ jq -n --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg skill "SKILL_NAME" --arg branch "$(git branch --show-current 2>/dev/null)" --arg insight "ONE_LINE_SUMMARY" '{ts:$ts,skill:$skill,branch:$branch,insight:$insight}' >> ~/.gstack/analytics/eureka.jsonl 2>/dev/null || true
165
+ ```
166
+ Replace SKILL_NAME and ONE_LINE_SUMMARY. Runs inline — don't stop the workflow.
167
+
168
+ **WebSearch fallback:** If WebSearch is unavailable, skip the search step and note: "Search unavailable — proceeding with in-distribution knowledge only."
169
+
170
+ ## Contributor Mode
171
+
172
+ If `_CONTRIB` is `true`: you are in **contributor mode**. You're a gstack user who also helps make it better.
173
+
174
+ **At the end of each major workflow step** (not after every single command), reflect on the gstack tooling you used. Rate your experience 0 to 10. If it wasn't a 10, think about why. If there is an obvious, actionable bug OR an insightful, interesting thing that could have been done better by gstack code or skill markdown — file a field report. Maybe our contributor will help make us better!
175
+
176
+ **Calibration — this is the bar:** For example, `$B js "await fetch(...)"` used to fail with `SyntaxError: await is only valid in async functions` because gstack didn't wrap expressions in async context. Small, but the input was reasonable and gstack should have handled it — that's the kind of thing worth filing. Things less consequential than this, ignore.
177
+
178
+ **NOT worth filing:** user's app bugs, network errors to user's URL, auth failures on user's site, user's own JS logic bugs.
179
+
180
+ **To file:** write `~/.gstack/contributor-logs/{slug}.md` with **all sections below** (do not truncate — include every section through the Date/Version footer):
181
+
182
+ ```
183
+ # {Title}
184
+
185
+ Hey gstack team — ran into this while using /{skill-name}:
186
+
187
+ **What I was trying to do:** {what the user/agent was attempting}
188
+ **What happened instead:** {what actually happened}
189
+ **My rating:** {0-10} — {one sentence on why it wasn't a 10}
190
+
191
+ ## Steps to reproduce
192
+ 1. {step}
193
+
194
+ ## Raw output
195
+ ```
196
+ {paste the actual error or unexpected output here}
197
+ ```
198
+
199
+ ## What would make this a 10
200
+ {one sentence: what gstack should have done differently}
201
+
202
+ **Date:** {YYYY-MM-DD} | **Version:** {gstack version} | **Skill:** /{skill}
203
+ ```
204
+
205
+ Slug: lowercase, hyphens, max 60 chars (e.g. `browse-js-no-await`). Skip if file already exists. Max 3 reports per session. File inline and continue — don't stop the workflow. Tell user: "Filed gstack field report: {title}"
206
+
207
+ ## Completion Status Protocol
208
+
209
+ When completing a skill workflow, report status using one of:
210
+ - **DONE** — All steps completed successfully. Evidence provided for each claim.
211
+ - **DONE_WITH_CONCERNS** — Completed, but with issues the user should know about. List each concern.
212
+ - **BLOCKED** — Cannot proceed. State what is blocking and what was tried.
213
+ - **NEEDS_CONTEXT** — Missing information required to continue. State exactly what you need.
214
+
215
+ ### Escalation
216
+
217
+ It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
218
+
219
+ Bad work is worse than no work. You will not be penalized for escalating.
220
+ - If you have attempted a task 3 times without success, STOP and escalate.
221
+ - If you are uncertain about a security-sensitive change, STOP and escalate.
222
+ - If the scope of work exceeds what you can verify, STOP and escalate.
223
+
224
+ Escalation format:
225
+ ```
226
+ STATUS: BLOCKED | NEEDS_CONTEXT
227
+ REASON: [1-2 sentences]
228
+ ATTEMPTED: [what you tried]
229
+ RECOMMENDATION: [what the user should do next]
230
+ ```
231
+
232
+ ## Telemetry (run last)
233
+
234
+ After the skill workflow completes (success, error, or abort), log the telemetry event.
235
+ Determine the skill name from the `name:` field in this file's YAML frontmatter.
236
+ Determine the outcome from the workflow result (success if completed normally, error
237
+ if it failed, abort if the user interrupted).
238
+
239
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This command writes telemetry to
240
+ `~/.gstack/analytics/` (user config directory, not project files). The skill
241
+ preamble already writes to the same directory — this is the same pattern.
242
+ Skipping this command loses session duration and outcome data.
243
+
244
+ Run this bash:
245
+
246
+ ```bash
247
+ _TEL_END=$(date +%s)
248
+ _TEL_DUR=$(( _TEL_END - _TEL_START ))
249
+ rm -f ~/.gstack/analytics/.pending-"$_SESSION_ID" 2>/dev/null || true
250
+ ~/.claude/skills/gstack/bin/gstack-telemetry-log \
251
+ --skill "SKILL_NAME" --duration "$_TEL_DUR" --outcome "OUTCOME" \
252
+ --used-browse "USED_BROWSE" --session-id "$_SESSION_ID" 2>/dev/null &
253
+ ```
254
+
255
+ Replace `SKILL_NAME` with the actual skill name from frontmatter, `OUTCOME` with
256
+ success/error/abort, and `USED_BROWSE` with true/false based on whether `$B` was used.
257
+ If you cannot determine the outcome, use "unknown". This runs in the background and
258
+ never blocks the user.
259
+
260
+ ## Step 0: Detect base branch
261
+
262
+ Determine which branch this PR targets. Use the result as "the base branch" in all subsequent steps.
263
+
264
+ 1. Check if a PR already exists for this branch:
265
+ `gh pr view --json baseRefName -q .baseRefName`
266
+ If this succeeds, use the printed branch name as the base branch.
267
+
268
+ 2. If no PR exists (command fails), detect the repo's default branch:
269
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
270
+
271
+ 3. If both commands fail, fall back to `main`.
272
+
273
+ Print the detected base branch name. In every subsequent `git diff`, `git log`,
274
+ `git fetch`, `git merge`, and `gh pr create` command, substitute the detected
275
+ branch name wherever the instructions say "the base branch."
276
+
277
+ ---
278
+
279
+ # /codex — Multi-AI Second Opinion
280
+
281
+ You are running the `/codex` skill. This wraps the OpenAI Codex CLI to get an independent,
282
+ brutally honest second opinion from a different AI system.
283
+
284
+ Codex is the "200 IQ autistic developer" — direct, terse, technically precise, challenges
285
+ assumptions, catches things you might miss. Present its output faithfully, not summarized.
286
+
287
+ ---
288
+
289
+ ## Step 0: Check codex binary
290
+
291
+ ```bash
292
+ CODEX_BIN=$(which codex 2>/dev/null || echo "")
293
+ [ -z "$CODEX_BIN" ] && echo "NOT_FOUND" || echo "FOUND: $CODEX_BIN"
294
+ ```
295
+
296
+ If `NOT_FOUND`: stop and tell the user:
297
+ "Codex CLI not found. Install it: `npm install -g @openai/codex` or see https://github.com/openai/codex"
298
+
299
+ ---
300
+
301
+ ## Step 1: Detect mode
302
+
303
+ Parse the user's input to determine which mode to run:
304
+
305
+ 1. `/codex review` or `/codex review <instructions>` — **Review mode** (Step 2A)
306
+ 2. `/codex challenge` or `/codex challenge <focus>` — **Challenge mode** (Step 2B)
307
+ 3. `/codex` with no arguments — **Auto-detect:**
308
+ - Check for a diff (with fallback if origin isn't available):
309
+ `git diff origin/<base> --stat 2>/dev/null | tail -1 || git diff <base> --stat 2>/dev/null | tail -1`
310
+ - If a diff exists, use AskUserQuestion:
311
+ ```
312
+ Codex detected changes against the base branch. What should it do?
313
+ A) Review the diff (code review with pass/fail gate)
314
+ B) Challenge the diff (adversarial — try to break it)
315
+ C) Something else — I'll provide a prompt
316
+ ```
317
+ - If no diff, check for plan files scoped to the current project:
318
+ `ls -t ~/.claude/plans/*.md 2>/dev/null | xargs grep -l "$(basename $(pwd))" 2>/dev/null | head -1`
319
+ If no project-scoped match, fall back to: `ls -t ~/.claude/plans/*.md 2>/dev/null | head -1`
320
+ but warn the user: "Note: this plan may be from a different project."
321
+ - If a plan file exists, offer to review it
322
+ - Otherwise, ask: "What would you like to ask Codex?"
323
+ 4. `/codex <anything else>` — **Consult mode** (Step 2C), where the remaining text is the prompt
324
+
325
+ ---
326
+
327
+ ## Step 2A: Review Mode
328
+
329
+ Run Codex code review against the current branch diff.
330
+
331
+ 1. Create temp files for output capture:
332
+ ```bash
333
+ TMPERR=$(mktemp /tmp/codex-err-XXXXXX.txt)
334
+ ```
335
+
336
+ 2. Run the review (5-minute timeout):
337
+ ```bash
338
+ codex review --base <base> -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR"
339
+ ```
340
+
341
+ Use `timeout: 300000` on the Bash call. If the user provided custom instructions
342
+ (e.g., `/codex review focus on security`), pass them as the prompt argument:
343
+ ```bash
344
+ codex review "focus on security" --base <base> -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR"
345
+ ```
346
+
347
+ 3. Capture the output. Then parse cost from stderr:
348
+ ```bash
349
+ grep "tokens used" "$TMPERR" 2>/dev/null || echo "tokens: unknown"
350
+ ```
351
+
352
+ 4. Determine gate verdict by checking the review output for critical findings.
353
+ If the output contains `[P1]` — the gate is **FAIL**.
354
+ If no `[P1]` markers are found (only `[P2]` or no findings) — the gate is **PASS**.
355
+
356
+ 5. Present the output:
357
+
358
+ ```
359
+ CODEX SAYS (code review):
360
+ ════════════════════════════════════════════════════════════
361
+ <full codex output, verbatim — do not truncate or summarize>
362
+ ════════════════════════════════════════════════════════════
363
+ GATE: PASS Tokens: 14,331 | Est. cost: ~$0.12
364
+ ```
365
+
366
+ or
367
+
368
+ ```
369
+ GATE: FAIL (N critical findings)
370
+ ```
371
+
372
+ 6. **Cross-model comparison:** If `/review` (Claude's own review) was already run
373
+ earlier in this conversation, compare the two sets of findings:
374
+
375
+ ```
376
+ CROSS-MODEL ANALYSIS:
377
+ Both found: [findings that overlap between Claude and Codex]
378
+ Only Codex found: [findings unique to Codex]
379
+ Only Claude found: [findings unique to Claude's /review]
380
+ Agreement rate: X% (N/M total unique findings overlap)
381
+ ```
382
+
383
+ 7. Persist the review result:
384
+ ```bash
385
+ ~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"codex-review","timestamp":"TIMESTAMP","status":"STATUS","gate":"GATE","findings":N,"findings_fixed":N}'
386
+ ```
387
+
388
+ Substitute: TIMESTAMP (ISO 8601), STATUS ("clean" if PASS, "issues_found" if FAIL),
389
+ GATE ("pass" or "fail"), findings (count of [P1] + [P2] markers),
390
+ findings_fixed (count of findings that were addressed/fixed before shipping).
391
+
392
+ 8. Clean up temp files:
393
+ ```bash
394
+ rm -f "$TMPERR"
395
+ ```
396
+
397
+ ## Plan File Review Report
398
+
399
+ After displaying the Review Readiness Dashboard in conversation output, also update the
400
+ **plan file** itself so review status is visible to anyone reading the plan.
401
+
402
+ ### Detect the plan file
403
+
404
+ 1. Check if there is an active plan file in this conversation (the host provides plan file
405
+ paths in system messages — look for plan file references in the conversation context).
406
+ 2. If not found, skip this section silently — not every review runs in plan mode.
407
+
408
+ ### Generate the report
409
+
410
+ Read the review log output you already have from the Review Readiness Dashboard step above.
411
+ Parse each JSONL entry. Each skill logs different fields:
412
+
413
+ - **plan-ceo-review**: \`status\`, \`unresolved\`, \`critical_gaps\`, \`mode\`, \`scope_proposed\`, \`scope_accepted\`, \`scope_deferred\`, \`commit\`
414
+ → Findings: "{scope_proposed} proposals, {scope_accepted} accepted, {scope_deferred} deferred"
415
+ → If scope fields are 0 or missing (HOLD/REDUCTION mode): "mode: {mode}, {critical_gaps} critical gaps"
416
+ - **plan-eng-review**: \`status\`, \`unresolved\`, \`critical_gaps\`, \`issues_found\`, \`mode\`, \`commit\`
417
+ → Findings: "{issues_found} issues, {critical_gaps} critical gaps"
418
+ - **plan-design-review**: \`status\`, \`initial_score\`, \`overall_score\`, \`unresolved\`, \`decisions_made\`, \`commit\`
419
+ → Findings: "score: {initial_score}/10 → {overall_score}/10, {decisions_made} decisions"
420
+ - **codex-review**: \`status\`, \`gate\`, \`findings\`, \`findings_fixed\`
421
+ → Findings: "{findings} findings, {findings_fixed}/{findings} fixed"
422
+
423
+ All fields needed for the Findings column are now present in the JSONL entries.
424
+ For the review you just completed, you may use richer details from your own Completion
425
+ Summary. For prior reviews, use the JSONL fields directly — they contain all required data.
426
+
427
+ Produce this markdown table:
428
+
429
+ \`\`\`markdown
430
+ ## GSTACK REVIEW REPORT
431
+
432
+ | Review | Trigger | Why | Runs | Status | Findings |
433
+ |--------|---------|-----|------|--------|----------|
434
+ | CEO Review | \`/plan-ceo-review\` | Scope & strategy | {runs} | {status} | {findings} |
435
+ | Codex Review | \`/codex review\` | Independent 2nd opinion | {runs} | {status} | {findings} |
436
+ | Eng Review | \`/plan-eng-review\` | Architecture & tests (required) | {runs} | {status} | {findings} |
437
+ | Design Review | \`/plan-design-review\` | UI/UX gaps | {runs} | {status} | {findings} |
438
+ \`\`\`
439
+
440
+ Below the table, add these lines (omit any that are empty/not applicable):
441
+
442
+ - **CODEX:** (only if codex-review ran) — one-line summary of codex fixes
443
+ - **CROSS-MODEL:** (only if both Claude and Codex reviews exist) — overlap analysis
444
+ - **UNRESOLVED:** total unresolved decisions across all reviews
445
+ - **VERDICT:** list reviews that are CLEAR (e.g., "CEO + ENG CLEARED — ready to implement").
446
+ If Eng Review is not CLEAR and not skipped globally, append "eng review required".
447
+
448
+ ### Write to the plan file
449
+
450
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This writes to the plan file, which is the one
451
+ file you are allowed to edit in plan mode. The plan file review report is part of the
452
+ plan's living status.
453
+
454
+ - Search the plan file for a \`## GSTACK REVIEW REPORT\` section **anywhere** in the file
455
+ (not just at the end — content may have been added after it).
456
+ - If found, **replace it** entirely using the Edit tool. Match from \`## GSTACK REVIEW REPORT\`
457
+ through either the next \`## \` heading or end of file, whichever comes first. This ensures
458
+ content added after the report section is preserved, not eaten. If the Edit fails
459
+ (e.g., concurrent edit changed the content), re-read the plan file and retry once.
460
+ - If no such section exists, **append it** to the end of the plan file.
461
+ - Always place it as the very last section in the plan file. If it was found mid-file,
462
+ move it: delete the old location and append at the end.
463
+
464
+ ---
465
+
466
+ ## Step 2B: Challenge (Adversarial) Mode
467
+
468
+ Codex tries to break your code — finding edge cases, race conditions, security holes,
469
+ and failure modes that a normal review would miss.
470
+
471
+ 1. Construct the adversarial prompt. If the user provided a focus area
472
+ (e.g., `/codex challenge security`), include it:
473
+
474
+ Default prompt (no focus):
475
+ "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."
476
+
477
+ With focus (e.g., "security"):
478
+ "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."
479
+
480
+ 2. Run codex exec with **JSONL output** to capture reasoning traces and tool calls (5-minute timeout):
481
+ ```bash
482
+ codex exec "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>/dev/null | python3 -c "
483
+ import sys, json
484
+ for line in sys.stdin:
485
+ line = line.strip()
486
+ if not line: continue
487
+ try:
488
+ obj = json.loads(line)
489
+ t = obj.get('type','')
490
+ if t == 'item.completed' and 'item' in obj:
491
+ item = obj['item']
492
+ itype = item.get('type','')
493
+ text = item.get('text','')
494
+ if itype == 'reasoning' and text:
495
+ print(f'[codex thinking] {text}')
496
+ print()
497
+ elif itype == 'agent_message' and text:
498
+ print(text)
499
+ elif itype == 'command_execution':
500
+ cmd = item.get('command','')
501
+ if cmd: print(f'[codex ran] {cmd}')
502
+ elif t == 'turn.completed':
503
+ usage = obj.get('usage',{})
504
+ tokens = usage.get('input_tokens',0) + usage.get('output_tokens',0)
505
+ if tokens: print(f'\ntokens used: {tokens}')
506
+ except: pass
507
+ "
508
+ ```
509
+
510
+ This parses codex's JSONL events to extract reasoning traces, tool calls, and the final
511
+ response. The `[codex thinking]` lines show what codex reasoned through before its answer.
512
+
513
+ 3. Present the full streamed output:
514
+
515
+ ```
516
+ CODEX SAYS (adversarial challenge):
517
+ ════════════════════════════════════════════════════════════
518
+ <full output from above, verbatim>
519
+ ════════════════════════════════════════════════════════════
520
+ Tokens: N | Est. cost: ~$X.XX
521
+ ```
522
+
523
+ ---
524
+
525
+ ## Step 2C: Consult Mode
526
+
527
+ Ask Codex anything about the codebase. Supports session continuity for follow-ups.
528
+
529
+ 1. **Check for existing session:**
530
+ ```bash
531
+ cat .context/codex-session-id 2>/dev/null || echo "NO_SESSION"
532
+ ```
533
+
534
+ If a session file exists (not `NO_SESSION`), use AskUserQuestion:
535
+ ```
536
+ You have an active Codex conversation from earlier. Continue it or start fresh?
537
+ A) Continue the conversation (Codex remembers the prior context)
538
+ B) Start a new conversation
539
+ ```
540
+
541
+ 2. Create temp files:
542
+ ```bash
543
+ TMPRESP=$(mktemp /tmp/codex-resp-XXXXXX.txt)
544
+ TMPERR=$(mktemp /tmp/codex-err-XXXXXX.txt)
545
+ ```
546
+
547
+ 3. **Plan review auto-detection:** If the user's prompt is about reviewing a plan,
548
+ or if plan files exist and the user said `/codex` with no arguments:
549
+ ```bash
550
+ ls -t ~/.claude/plans/*.md 2>/dev/null | xargs grep -l "$(basename $(pwd))" 2>/dev/null | head -1
551
+ ```
552
+ If no project-scoped match, fall back to `ls -t ~/.claude/plans/*.md 2>/dev/null | head -1`
553
+ but warn: "Note: this plan may be from a different project — verify before sending to Codex."
554
+ Read the plan file and prepend the persona to the user's prompt:
555
+ "You are a brutally honest technical reviewer. Review this plan for: logical gaps and
556
+ unstated assumptions, missing error handling or edge cases, overcomplexity (is there a
557
+ simpler approach?), feasibility risks (what could go wrong?), and missing dependencies
558
+ or sequencing issues. Be direct. Be terse. No compliments. Just the problems.
559
+
560
+ THE PLAN:
561
+ <plan content>"
562
+
563
+ 4. Run codex exec with **JSONL output** to capture reasoning traces (5-minute timeout):
564
+
565
+ For a **new session:**
566
+ ```bash
567
+ codex exec "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>"$TMPERR" | python3 -c "
568
+ import sys, json
569
+ for line in sys.stdin:
570
+ line = line.strip()
571
+ if not line: continue
572
+ try:
573
+ obj = json.loads(line)
574
+ t = obj.get('type','')
575
+ if t == 'thread.started':
576
+ tid = obj.get('thread_id','')
577
+ if tid: print(f'SESSION_ID:{tid}')
578
+ elif t == 'item.completed' and 'item' in obj:
579
+ item = obj['item']
580
+ itype = item.get('type','')
581
+ text = item.get('text','')
582
+ if itype == 'reasoning' and text:
583
+ print(f'[codex thinking] {text}')
584
+ print()
585
+ elif itype == 'agent_message' and text:
586
+ print(text)
587
+ elif itype == 'command_execution':
588
+ cmd = item.get('command','')
589
+ if cmd: print(f'[codex ran] {cmd}')
590
+ elif t == 'turn.completed':
591
+ usage = obj.get('usage',{})
592
+ tokens = usage.get('input_tokens',0) + usage.get('output_tokens',0)
593
+ if tokens: print(f'\ntokens used: {tokens}')
594
+ except: pass
595
+ "
596
+ ```
597
+
598
+ For a **resumed session** (user chose "Continue"):
599
+ ```bash
600
+ codex exec resume <session-id> "<prompt>" -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached --json 2>"$TMPERR" | python3 -c "
601
+ <same python streaming parser as above>
602
+ "
603
+ ```
604
+
605
+ 5. Capture session ID from the streamed output. The parser prints `SESSION_ID:<id>`
606
+ from the `thread.started` event. Save it for follow-ups:
607
+ ```bash
608
+ mkdir -p .context
609
+ ```
610
+ Save the session ID printed by the parser (the line starting with `SESSION_ID:`)
611
+ to `.context/codex-session-id`.
612
+
613
+ 6. Present the full streamed output:
614
+
615
+ ```
616
+ CODEX SAYS (consult):
617
+ ════════════════════════════════════════════════════════════
618
+ <full output, verbatim — includes [codex thinking] traces>
619
+ ════════════════════════════════════════════════════════════
620
+ Tokens: N | Est. cost: ~$X.XX
621
+ Session saved — run /codex again to continue this conversation.
622
+ ```
623
+
624
+ 7. After presenting, note any points where Codex's analysis differs from your own
625
+ understanding. If there is a disagreement, flag it:
626
+ "Note: Claude Code disagrees on X because Y."
627
+
628
+ ---
629
+
630
+ ## Model & Reasoning
631
+
632
+ **Model:** No model is hardcoded — codex uses whatever its current default is (the frontier
633
+ agentic coding model). This means as OpenAI ships newer models, /codex automatically
634
+ uses them. If the user wants a specific model, pass `-m` through to codex.
635
+
636
+ **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.
637
+
638
+ **Web search:** All codex commands use `--enable web_search_cached` so Codex can look up
639
+ docs and APIs during review. This is OpenAI's cached index — fast, no extra cost.
640
+
641
+ If the user specifies a model (e.g., `/codex review -m gpt-5.1-codex-max`
642
+ or `/codex challenge -m gpt-5.2`), pass the `-m` flag through to codex.
643
+
644
+ ---
645
+
646
+ ## Cost Estimation
647
+
648
+ Parse token count from stderr. Codex prints `tokens used\nN` to stderr.
649
+
650
+ Display as: `Tokens: N`
651
+
652
+ If token count is not available, display: `Tokens: unknown`
653
+
654
+ ---
655
+
656
+ ## Error Handling
657
+
658
+ - **Binary not found:** Detected in Step 0. Stop with install instructions.
659
+ - **Auth error:** Codex prints an auth error to stderr. Surface the error:
660
+ "Codex authentication failed. Run `codex login` in your terminal to authenticate via ChatGPT."
661
+ - **Timeout:** If the Bash call times out (5 min), tell the user:
662
+ "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."
663
+ - **Empty response:** If `$TMPRESP` is empty or doesn't exist, tell the user:
664
+ "Codex returned no response. Check stderr for errors."
665
+ - **Session resume failure:** If resume fails, delete the session file and start fresh.
666
+
667
+ ---
668
+
669
+ ## Important Rules
670
+
671
+ - **Never modify files.** This skill is read-only. Codex runs in read-only sandbox mode.
672
+ - **Present output verbatim.** Do not truncate, summarize, or editorialize Codex's output
673
+ before showing it. Show it in full inside the CODEX SAYS block.
674
+ - **Add synthesis after, not instead of.** Any Claude commentary comes after the full output.
675
+ - **5-minute timeout** on all Bash calls to codex (`timeout: 300000`).
676
+ - **No double-reviewing.** If the user already ran `/review`, Codex provides a second
677
+ independent opinion. Do not re-run Claude Code's own review.