@runchr/gstack-antigravity 0.1.0 → 0.1.2

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 (231) 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/README.md +12 -7
  230. package/README_KO.md +12 -6
  231. package/package.json +3 -2
@@ -0,0 +1,849 @@
1
+ ---
2
+ name: review
3
+ version: 1.0.0
4
+ description: |
5
+ Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust
6
+ boundary violations, conditional side effects, and other structural issues. Use when
7
+ asked to "review this PR", "code review", "pre-landing review", or "check my diff".
8
+ Proactively suggest when the user is about to merge or land code changes.
9
+ allowed-tools:
10
+ - Bash
11
+ - Read
12
+ - Edit
13
+ - Write
14
+ - Grep
15
+ - Glob
16
+ - Agent
17
+ - AskUserQuestion
18
+ - WebSearch
19
+ ---
20
+ <!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
21
+ <!-- Regenerate: bun run gen:skill-docs -->
22
+
23
+ ## Preamble (run first)
24
+
25
+ ```bash
26
+ _UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
27
+ [ -n "$_UPD" ] && echo "$_UPD" || true
28
+ mkdir -p ~/.gstack/sessions
29
+ touch ~/.gstack/sessions/"$PPID"
30
+ _SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
31
+ find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
32
+ _CONTRIB=$(~/.claude/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
33
+ _PROACTIVE=$(~/.claude/skills/gstack/bin/gstack-config get proactive 2>/dev/null || echo "true")
34
+ _BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
35
+ echo "BRANCH: $_BRANCH"
36
+ echo "PROACTIVE: $_PROACTIVE"
37
+ source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || true
38
+ REPO_MODE=${REPO_MODE:-unknown}
39
+ echo "REPO_MODE: $REPO_MODE"
40
+ _LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")
41
+ echo "LAKE_INTRO: $_LAKE_SEEN"
42
+ _TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)
43
+ _TEL_PROMPTED=$([ -f ~/.gstack/.telemetry-prompted ] && echo "yes" || echo "no")
44
+ _TEL_START=$(date +%s)
45
+ _SESSION_ID="$$-$(date +%s)"
46
+ echo "TELEMETRY: ${_TEL:-off}"
47
+ echo "TEL_PROMPTED: $_TEL_PROMPTED"
48
+ mkdir -p ~/.gstack/analytics
49
+ echo '{"skill":"review","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
50
+ 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
51
+ ```
52
+
53
+ If `PROACTIVE` is `"false"`, do not proactively suggest gstack skills — only invoke
54
+ them when the user explicitly asks. The user opted out of proactive suggestions.
55
+
56
+ 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.
57
+
58
+ If `LAKE_INTRO` is `no`: Before continuing, introduce the Completeness Principle.
59
+ Tell the user: "gstack follows the **Boil the Lake** principle — always do the complete
60
+ thing when AI makes the marginal cost near-zero. Read more: https://garryslist.org/posts/boil-the-ocean"
61
+ Then offer to open the essay in their default browser:
62
+
63
+ ```bash
64
+ open https://garryslist.org/posts/boil-the-ocean
65
+ touch ~/.gstack/.completeness-intro-seen
66
+ ```
67
+
68
+ Only run `open` if the user says yes. Always run `touch` to mark as seen. This only happens once.
69
+
70
+ If `TEL_PROMPTED` is `no` AND `LAKE_INTRO` is `yes`: After the lake intro is handled,
71
+ ask the user about telemetry. Use AskUserQuestion:
72
+
73
+ > Help gstack get better! Community mode shares usage data (which skills you use, how long
74
+ > they take, crash info) with a stable device ID so we can track trends and fix bugs faster.
75
+ > No code, file paths, or repo names are ever sent.
76
+ > Change anytime with `gstack-config set telemetry off`.
77
+
78
+ Options:
79
+ - A) Help gstack get better! (recommended)
80
+ - B) No thanks
81
+
82
+ If A: run `~/.claude/skills/gstack/bin/gstack-config set telemetry community`
83
+
84
+ If B: ask a follow-up AskUserQuestion:
85
+
86
+ > How about anonymous mode? We just learn that *someone* used gstack — no unique ID,
87
+ > no way to connect sessions. Just a counter that helps us know if anyone's out there.
88
+
89
+ Options:
90
+ - A) Sure, anonymous is fine
91
+ - B) No thanks, fully off
92
+
93
+ If B→A: run `~/.claude/skills/gstack/bin/gstack-config set telemetry anonymous`
94
+ If B→B: run `~/.claude/skills/gstack/bin/gstack-config set telemetry off`
95
+
96
+ Always run:
97
+ ```bash
98
+ touch ~/.gstack/.telemetry-prompted
99
+ ```
100
+
101
+ This only happens once. If `TEL_PROMPTED` is `yes`, skip this entirely.
102
+
103
+ ## AskUserQuestion Format
104
+
105
+ **ALWAYS follow this structure for every AskUserQuestion call:**
106
+ 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)
107
+ 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.
108
+ 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.
109
+ 4. **Options:** Lettered options: `A) ... B) ... C) ...` — when an option involves effort, show both scales: `(human: ~X / CC: ~Y)`
110
+
111
+ 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.
112
+
113
+ Per-skill instructions may add additional formatting rules on top of this baseline.
114
+
115
+ ## Completeness Principle — Boil the Lake
116
+
117
+ AI-assisted coding makes the marginal cost of completeness near-zero. When you present options:
118
+
119
+ - 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.
120
+ - **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.
121
+ - **When estimating effort**, always show both scales: human team time and CC+gstack time. The compression ratio varies by task type — use this reference:
122
+
123
+ | Task type | Human team | CC+gstack | Compression |
124
+ |-----------|-----------|-----------|-------------|
125
+ | Boilerplate / scaffolding | 2 days | 15 min | ~100x |
126
+ | Test writing | 1 day | 15 min | ~50x |
127
+ | Feature implementation | 1 week | 30 min | ~30x |
128
+ | Bug fix + regression test | 4 hours | 15 min | ~20x |
129
+ | Architecture / design | 2 days | 4 hours | ~5x |
130
+ | Research / exploration | 1 day | 3 hours | ~3x |
131
+
132
+ - 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.
133
+
134
+ **Anti-patterns — DON'T do this:**
135
+ - BAD: "Choose B — it covers 90% of the value with less code." (If A is only 70 lines more, choose A.)
136
+ - BAD: "We can skip edge case handling to save time." (Edge case handling costs minutes with CC.)
137
+ - BAD: "Let's defer test coverage to a follow-up PR." (Tests are the cheapest lake to boil.)
138
+ - BAD: Quoting only human-team effort: "This would take 2 weeks." (Say: "2 weeks human / ~1 hour CC.")
139
+
140
+ ## Repo Ownership Mode — See Something, Say Something
141
+
142
+ `REPO_MODE` from the preamble tells you who owns issues in this repo:
143
+
144
+ - **`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.
145
+ - **`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.
146
+ - **`unknown`** — Treat as collaborative (safer default — ask before fixing).
147
+
148
+ **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.
149
+
150
+ Never let a noticed issue silently pass. The whole point is proactive communication.
151
+
152
+ ## Search Before Building
153
+
154
+ 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.
155
+
156
+ **Three layers of knowledge:**
157
+ - **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.
158
+ - **Layer 2** (new and popular — search for these). But scrutinize: humans are subject to mania. Search results are inputs to your thinking, not answers.
159
+ - **Layer 3** (first principles — prize these above all). Original observations derived from reasoning about the specific problem. The most valuable of all.
160
+
161
+ **Eureka moment:** When first-principles reasoning reveals conventional wisdom is wrong, name it:
162
+ "EUREKA: Everyone does X because [assumption]. But [evidence] shows this is wrong. Y is better because [reasoning]."
163
+
164
+ Log eureka moments:
165
+ ```bash
166
+ 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
167
+ ```
168
+ Replace SKILL_NAME and ONE_LINE_SUMMARY. Runs inline — don't stop the workflow.
169
+
170
+ **WebSearch fallback:** If WebSearch is unavailable, skip the search step and note: "Search unavailable — proceeding with in-distribution knowledge only."
171
+
172
+ ## Contributor Mode
173
+
174
+ If `_CONTRIB` is `true`: you are in **contributor mode**. You're a gstack user who also helps make it better.
175
+
176
+ **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!
177
+
178
+ **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.
179
+
180
+ **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.
181
+
182
+ **To file:** write `~/.gstack/contributor-logs/{slug}.md` with **all sections below** (do not truncate — include every section through the Date/Version footer):
183
+
184
+ ```
185
+ # {Title}
186
+
187
+ Hey gstack team — ran into this while using /{skill-name}:
188
+
189
+ **What I was trying to do:** {what the user/agent was attempting}
190
+ **What happened instead:** {what actually happened}
191
+ **My rating:** {0-10} — {one sentence on why it wasn't a 10}
192
+
193
+ ## Steps to reproduce
194
+ 1. {step}
195
+
196
+ ## Raw output
197
+ ```
198
+ {paste the actual error or unexpected output here}
199
+ ```
200
+
201
+ ## What would make this a 10
202
+ {one sentence: what gstack should have done differently}
203
+
204
+ **Date:** {YYYY-MM-DD} | **Version:** {gstack version} | **Skill:** /{skill}
205
+ ```
206
+
207
+ 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}"
208
+
209
+ ## Completion Status Protocol
210
+
211
+ When completing a skill workflow, report status using one of:
212
+ - **DONE** — All steps completed successfully. Evidence provided for each claim.
213
+ - **DONE_WITH_CONCERNS** — Completed, but with issues the user should know about. List each concern.
214
+ - **BLOCKED** — Cannot proceed. State what is blocking and what was tried.
215
+ - **NEEDS_CONTEXT** — Missing information required to continue. State exactly what you need.
216
+
217
+ ### Escalation
218
+
219
+ It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
220
+
221
+ Bad work is worse than no work. You will not be penalized for escalating.
222
+ - If you have attempted a task 3 times without success, STOP and escalate.
223
+ - If you are uncertain about a security-sensitive change, STOP and escalate.
224
+ - If the scope of work exceeds what you can verify, STOP and escalate.
225
+
226
+ Escalation format:
227
+ ```
228
+ STATUS: BLOCKED | NEEDS_CONTEXT
229
+ REASON: [1-2 sentences]
230
+ ATTEMPTED: [what you tried]
231
+ RECOMMENDATION: [what the user should do next]
232
+ ```
233
+
234
+ ## Telemetry (run last)
235
+
236
+ After the skill workflow completes (success, error, or abort), log the telemetry event.
237
+ Determine the skill name from the `name:` field in this file's YAML frontmatter.
238
+ Determine the outcome from the workflow result (success if completed normally, error
239
+ if it failed, abort if the user interrupted).
240
+
241
+ **PLAN MODE EXCEPTION — ALWAYS RUN:** This command writes telemetry to
242
+ `~/.gstack/analytics/` (user config directory, not project files). The skill
243
+ preamble already writes to the same directory — this is the same pattern.
244
+ Skipping this command loses session duration and outcome data.
245
+
246
+ Run this bash:
247
+
248
+ ```bash
249
+ _TEL_END=$(date +%s)
250
+ _TEL_DUR=$(( _TEL_END - _TEL_START ))
251
+ rm -f ~/.gstack/analytics/.pending-"$_SESSION_ID" 2>/dev/null || true
252
+ ~/.claude/skills/gstack/bin/gstack-telemetry-log \
253
+ --skill "SKILL_NAME" --duration "$_TEL_DUR" --outcome "OUTCOME" \
254
+ --used-browse "USED_BROWSE" --session-id "$_SESSION_ID" 2>/dev/null &
255
+ ```
256
+
257
+ Replace `SKILL_NAME` with the actual skill name from frontmatter, `OUTCOME` with
258
+ success/error/abort, and `USED_BROWSE` with true/false based on whether `$B` was used.
259
+ If you cannot determine the outcome, use "unknown". This runs in the background and
260
+ never blocks the user.
261
+
262
+ ## Step 0: Detect base branch
263
+
264
+ Determine which branch this PR targets. Use the result as "the base branch" in all subsequent steps.
265
+
266
+ 1. Check if a PR already exists for this branch:
267
+ `gh pr view --json baseRefName -q .baseRefName`
268
+ If this succeeds, use the printed branch name as the base branch.
269
+
270
+ 2. If no PR exists (command fails), detect the repo's default branch:
271
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
272
+
273
+ 3. If both commands fail, fall back to `main`.
274
+
275
+ Print the detected base branch name. In every subsequent `git diff`, `git log`,
276
+ `git fetch`, `git merge`, and `gh pr create` command, substitute the detected
277
+ branch name wherever the instructions say "the base branch."
278
+
279
+ ---
280
+
281
+ # Pre-Landing PR Review
282
+
283
+ You are running the `/review` workflow. Analyze the current branch's diff against the base branch for structural issues that tests don't catch.
284
+
285
+ ---
286
+
287
+ ## Step 1: Check branch
288
+
289
+ 1. Run `git branch --show-current` to get the current branch.
290
+ 2. If on the base branch, output: **"Nothing to review — you're on the base branch or have no changes against it."** and stop.
291
+ 3. Run `git fetch origin <base> --quiet && git diff origin/<base> --stat` to check if there's a diff. If no diff, output the same message and stop.
292
+
293
+ ---
294
+
295
+ ## Step 1.5: Scope Drift Detection
296
+
297
+ Before reviewing code quality, check: **did they build what was requested — nothing more, nothing less?**
298
+
299
+ 1. Read `TODOS.md` (if it exists). Read PR description (`gh pr view --json body --jq .body 2>/dev/null || true`).
300
+ Read commit messages (`git log origin/<base>..HEAD --oneline`).
301
+ **If no PR exists:** rely on commit messages and TODOS.md for stated intent — this is the common case since /review runs before /ship creates the PR.
302
+ 2. Identify the **stated intent** — what was this branch supposed to accomplish?
303
+ 3. Run `git diff origin/<base> --stat` and compare the files changed against the stated intent.
304
+ 4. Evaluate with skepticism:
305
+
306
+ **SCOPE CREEP detection:**
307
+ - Files changed that are unrelated to the stated intent
308
+ - New features or refactors not mentioned in the plan
309
+ - "While I was in there..." changes that expand blast radius
310
+
311
+ **MISSING REQUIREMENTS detection:**
312
+ - Requirements from TODOS.md/PR description not addressed in the diff
313
+ - Test coverage gaps for stated requirements
314
+ - Partial implementations (started but not finished)
315
+
316
+ 5. Output (before the main review begins):
317
+ ```
318
+ Scope Check: [CLEAN / DRIFT DETECTED / REQUIREMENTS MISSING]
319
+ Intent: <1-line summary of what was requested>
320
+ Delivered: <1-line summary of what the diff actually does>
321
+ [If drift: list each out-of-scope change]
322
+ [If missing: list each unaddressed requirement]
323
+ ```
324
+
325
+ 6. This is **INFORMATIONAL** — does not block the review. Proceed to Step 2.
326
+
327
+ ---
328
+
329
+ ## Step 2: Read the checklist
330
+
331
+ Read `.claude/skills/review/checklist.md`.
332
+
333
+ **If the file cannot be read, STOP and report the error.** Do not proceed without the checklist.
334
+
335
+ ---
336
+
337
+ ## Step 2.5: Check for Greptile review comments
338
+
339
+ Read `.claude/skills/review/greptile-triage.md` and follow the fetch, filter, classify, and **escalation detection** steps.
340
+
341
+ **If no PR exists, `gh` fails, API returns an error, or there are zero Greptile comments:** Skip this step silently. Greptile integration is additive — the review works without it.
342
+
343
+ **If Greptile comments are found:** Store the classifications (VALID & ACTIONABLE, VALID BUT ALREADY FIXED, FALSE POSITIVE, SUPPRESSED) — you will need them in Step 5.
344
+
345
+ ---
346
+
347
+ ## Step 3: Get the diff
348
+
349
+ Fetch the latest base branch to avoid false positives from stale local state:
350
+
351
+ ```bash
352
+ git fetch origin <base> --quiet
353
+ ```
354
+
355
+ Run `git diff origin/<base>` to get the full diff. This includes both committed and uncommitted changes against the latest base branch.
356
+
357
+ ---
358
+
359
+ ## Step 4: Two-pass review
360
+
361
+ Apply the checklist against the diff in two passes:
362
+
363
+ 1. **Pass 1 (CRITICAL):** SQL & Data Safety, Race Conditions & Concurrency, LLM Output Trust Boundary, Enum & Value Completeness
364
+ 2. **Pass 2 (INFORMATIONAL):** Conditional Side Effects, Magic Numbers & String Coupling, Dead Code & Consistency, LLM Prompt Issues, Test Gaps, View/Frontend, Performance & Bundle Impact
365
+
366
+ **Enum & Value Completeness requires reading code OUTSIDE the diff.** When the diff introduces a new enum value, status, tier, or type constant, use Grep to find all files that reference sibling values, then Read those files to check if the new value is handled. This is the one category where within-diff review is insufficient.
367
+
368
+ **Search-before-recommending:** When recommending a fix pattern (especially for concurrency, caching, auth, or framework-specific behavior):
369
+ - Verify the pattern is current best practice for the framework version in use
370
+ - Check if a built-in solution exists in newer versions before recommending a workaround
371
+ - Verify API signatures against current docs (APIs change between versions)
372
+
373
+ Takes seconds, prevents recommending outdated patterns. If WebSearch is unavailable, note it and proceed with in-distribution knowledge.
374
+
375
+ Follow the output format specified in the checklist. Respect the suppressions — do NOT flag items listed in the "DO NOT flag" section.
376
+
377
+ ---
378
+
379
+ ## Step 4.5: Design Review (conditional)
380
+
381
+ ## Design Review (conditional, diff-scoped)
382
+
383
+ Check if the diff touches frontend files using `gstack-diff-scope`:
384
+
385
+ ```bash
386
+ source <(~/.claude/skills/gstack/bin/gstack-diff-scope <base> 2>/dev/null)
387
+ ```
388
+
389
+ **If `SCOPE_FRONTEND=false`:** Skip design review silently. No output.
390
+
391
+ **If `SCOPE_FRONTEND=true`:**
392
+
393
+ 1. **Check for DESIGN.md.** If `DESIGN.md` or `design-system.md` exists in the repo root, read it. All design findings are calibrated against it — patterns blessed in DESIGN.md are not flagged. If not found, use universal design principles.
394
+
395
+ 2. **Read `.claude/skills/review/design-checklist.md`.** If the file cannot be read, skip design review with a note: "Design checklist not found — skipping design review."
396
+
397
+ 3. **Read each changed frontend file** (full file, not just diff hunks). Frontend files are identified by the patterns listed in the checklist.
398
+
399
+ 4. **Apply the design checklist** against the changed files. For each item:
400
+ - **[HIGH] mechanical CSS fix** (`outline: none`, `!important`, `font-size < 16px`): classify as AUTO-FIX
401
+ - **[HIGH/MEDIUM] design judgment needed**: classify as ASK
402
+ - **[LOW] intent-based detection**: present as "Possible — verify visually or run /design-review"
403
+
404
+ 5. **Include findings** in the review output under a "Design Review" header, following the output format in the checklist. Design findings merge with code review findings into the same Fix-First flow.
405
+
406
+ 6. **Log the result** for the Review Readiness Dashboard:
407
+
408
+ ```bash
409
+ ~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"design-review-lite","timestamp":"TIMESTAMP","status":"STATUS","findings":N,"auto_fixed":M,"commit":"COMMIT"}'
410
+ ```
411
+
412
+ Substitute: TIMESTAMP = ISO 8601 datetime, STATUS = "clean" if 0 findings or "issues_found", N = total findings, M = auto-fixed count, COMMIT = output of `git rev-parse --short HEAD`.
413
+
414
+ Include any design findings alongside the findings from Step 4. They follow the same Fix-First flow in Step 5 — AUTO-FIX for mechanical CSS fixes, ASK for everything else.
415
+
416
+ ---
417
+
418
+ ## Step 4.75: Test Coverage Diagram
419
+
420
+ 100% coverage is the goal. Evaluate every codepath changed in the diff and identify test gaps. Gaps become INFORMATIONAL findings that follow the Fix-First flow.
421
+
422
+ ### Test Framework Detection
423
+
424
+ Before analyzing coverage, detect the project's test framework:
425
+
426
+ 1. **Read CLAUDE.md** — look for a `## Testing` section with test command and framework name. If found, use that as the authoritative source.
427
+ 2. **If CLAUDE.md has no testing section, auto-detect:**
428
+
429
+ ```bash
430
+ # Detect project runtime
431
+ [ -f Gemfile ] && echo "RUNTIME:ruby"
432
+ [ -f package.json ] && echo "RUNTIME:node"
433
+ [ -f requirements.txt ] || [ -f pyproject.toml ] && echo "RUNTIME:python"
434
+ [ -f go.mod ] && echo "RUNTIME:go"
435
+ [ -f Cargo.toml ] && echo "RUNTIME:rust"
436
+ # Check for existing test infrastructure
437
+ ls jest.config.* vitest.config.* playwright.config.* cypress.config.* .rspec pytest.ini phpunit.xml 2>/dev/null
438
+ ls -d test/ tests/ spec/ __tests__/ cypress/ e2e/ 2>/dev/null
439
+ ```
440
+
441
+ 3. **If no framework detected:** still produce the coverage diagram, but skip test generation.
442
+
443
+ **Step 1. Trace every codepath changed** using `git diff origin/<base>...HEAD`:
444
+
445
+ Read every changed file. For each one, trace how data flows through the code — don't just list functions, actually follow the execution:
446
+
447
+ 1. **Read the diff.** For each changed file, read the full file (not just the diff hunk) to understand context.
448
+ 2. **Trace data flow.** Starting from each entry point (route handler, exported function, event listener, component render), follow the data through every branch:
449
+ - Where does input come from? (request params, props, database, API call)
450
+ - What transforms it? (validation, mapping, computation)
451
+ - Where does it go? (database write, API response, rendered output, side effect)
452
+ - What can go wrong at each step? (null/undefined, invalid input, network failure, empty collection)
453
+ 3. **Diagram the execution.** For each changed file, draw an ASCII diagram showing:
454
+ - Every function/method that was added or modified
455
+ - Every conditional branch (if/else, switch, ternary, guard clause, early return)
456
+ - Every error path (try/catch, rescue, error boundary, fallback)
457
+ - Every call to another function (trace into it — does IT have untested branches?)
458
+ - Every edge: what happens with null input? Empty array? Invalid type?
459
+
460
+ This is the critical step — you're building a map of every line of code that can execute differently based on input. Every branch in this diagram needs a test.
461
+
462
+ **Step 2. Map user flows, interactions, and error states:**
463
+
464
+ Code coverage isn't enough — you need to cover how real users interact with the changed code. For each changed feature, think through:
465
+
466
+ - **User flows:** What sequence of actions does a user take that touches this code? Map the full journey (e.g., "user clicks 'Pay' → form validates → API call → success/failure screen"). Each step in the journey needs a test.
467
+ - **Interaction edge cases:** What happens when the user does something unexpected?
468
+ - Double-click/rapid resubmit
469
+ - Navigate away mid-operation (back button, close tab, click another link)
470
+ - Submit with stale data (page sat open for 30 minutes, session expired)
471
+ - Slow connection (API takes 10 seconds — what does the user see?)
472
+ - Concurrent actions (two tabs, same form)
473
+ - **Error states the user can see:** For every error the code handles, what does the user actually experience?
474
+ - Is there a clear error message or a silent failure?
475
+ - Can the user recover (retry, go back, fix input) or are they stuck?
476
+ - What happens with no network? With a 500 from the API? With invalid data from the server?
477
+ - **Empty/zero/boundary states:** What does the UI show with zero results? With 10,000 results? With a single character input? With maximum-length input?
478
+
479
+ Add these to your diagram alongside the code branches. A user flow with no test is just as much a gap as an untested if/else.
480
+
481
+ **Step 3. Check each branch against existing tests:**
482
+
483
+ Go through your diagram branch by branch — both code paths AND user flows. For each one, search for a test that exercises it:
484
+ - Function `processPayment()` → look for `billing.test.ts`, `billing.spec.ts`, `test/billing_test.rb`
485
+ - An if/else → look for tests covering BOTH the true AND false path
486
+ - An error handler → look for a test that triggers that specific error condition
487
+ - A call to `helperFn()` that has its own branches → those branches need tests too
488
+ - A user flow → look for an integration or E2E test that walks through the journey
489
+ - An interaction edge case → look for a test that simulates the unexpected action
490
+
491
+ Quality scoring rubric:
492
+ - ★★★ Tests behavior with edge cases AND error paths
493
+ - ★★ Tests correct behavior, happy path only
494
+ - ★ Smoke test / existence check / trivial assertion (e.g., "it renders", "it doesn't throw")
495
+
496
+ ### E2E Test Decision Matrix
497
+
498
+ When checking each branch, also determine whether a unit test or E2E/integration test is the right tool:
499
+
500
+ **RECOMMEND E2E (mark as [→E2E] in the diagram):**
501
+ - Common user flow spanning 3+ components/services (e.g., signup → verify email → first login)
502
+ - Integration point where mocking hides real failures (e.g., API → queue → worker → DB)
503
+ - Auth/payment/data-destruction flows — too important to trust unit tests alone
504
+
505
+ **RECOMMEND EVAL (mark as [→EVAL] in the diagram):**
506
+ - Critical LLM call that needs a quality eval (e.g., prompt change → test output still meets quality bar)
507
+ - Changes to prompt templates, system instructions, or tool definitions
508
+
509
+ **STICK WITH UNIT TESTS:**
510
+ - Pure function with clear inputs/outputs
511
+ - Internal helper with no side effects
512
+ - Edge case of a single function (null input, empty array)
513
+ - Obscure/rare flow that isn't customer-facing
514
+
515
+ ### REGRESSION RULE (mandatory)
516
+
517
+ **IRON RULE:** When the coverage audit identifies a REGRESSION — code that previously worked but the diff broke — a regression test is written immediately. No AskUserQuestion. No skipping. Regressions are the highest-priority test because they prove something broke.
518
+
519
+ A regression is when:
520
+ - The diff modifies existing behavior (not new code)
521
+ - The existing test suite (if any) doesn't cover the changed path
522
+ - The change introduces a new failure mode for existing callers
523
+
524
+ When uncertain whether a change is a regression, err on the side of writing the test.
525
+
526
+ Format: commit as `test: regression test for {what broke}`
527
+
528
+ **Step 4. Output ASCII coverage diagram:**
529
+
530
+ Include BOTH code paths and user flows in the same diagram. Mark E2E-worthy and eval-worthy paths:
531
+
532
+ ```
533
+ CODE PATH COVERAGE
534
+ ===========================
535
+ [+] src/services/billing.ts
536
+
537
+ ├── processPayment()
538
+ │ ├── [★★★ TESTED] Happy path + card declined + timeout — billing.test.ts:42
539
+ │ ├── [GAP] Network timeout — NO TEST
540
+ │ └── [GAP] Invalid currency — NO TEST
541
+
542
+ └── refundPayment()
543
+ ├── [★★ TESTED] Full refund — billing.test.ts:89
544
+ └── [★ TESTED] Partial refund (checks non-throw only) — billing.test.ts:101
545
+
546
+ USER FLOW COVERAGE
547
+ ===========================
548
+ [+] Payment checkout flow
549
+
550
+ ├── [★★★ TESTED] Complete purchase — checkout.e2e.ts:15
551
+ ├── [GAP] [→E2E] Double-click submit — needs E2E, not just unit
552
+ ├── [GAP] Navigate away during payment — unit test sufficient
553
+ └── [★ TESTED] Form validation errors (checks render only) — checkout.test.ts:40
554
+
555
+ [+] Error states
556
+
557
+ ├── [★★ TESTED] Card declined message — billing.test.ts:58
558
+ ├── [GAP] Network timeout UX (what does user see?) — NO TEST
559
+ └── [GAP] Empty cart submission — NO TEST
560
+
561
+ [+] LLM integration
562
+
563
+ └── [GAP] [→EVAL] Prompt template change — needs eval test
564
+
565
+ ─────────────────────────────────
566
+ COVERAGE: 5/13 paths tested (38%)
567
+ Code paths: 3/5 (60%)
568
+ User flows: 2/8 (25%)
569
+ QUALITY: ★★★: 2 ★★: 2 ★: 1
570
+ GAPS: 8 paths need tests (2 need E2E, 1 needs eval)
571
+ ─────────────────────────────────
572
+ ```
573
+
574
+ **Fast path:** All paths covered → "Step 4.75: All new code paths have test coverage ✓" Continue.
575
+
576
+ **Step 5. Generate tests for gaps (Fix-First):**
577
+
578
+ If test framework is detected and gaps were identified:
579
+ - Classify each gap as AUTO-FIX or ASK per the Fix-First Heuristic:
580
+ - **AUTO-FIX:** Simple unit tests for pure functions, edge cases of existing tested functions
581
+ - **ASK:** E2E tests, tests requiring new test infrastructure, tests for ambiguous behavior
582
+ - For AUTO-FIX gaps: generate the test, run it, commit as `test: coverage for {feature}`
583
+ - For ASK gaps: include in the Fix-First batch question with the other review findings
584
+ - For paths marked [→E2E]: always ASK (E2E tests are higher-effort and need user confirmation)
585
+ - For paths marked [→EVAL]: always ASK (eval tests need user confirmation on quality criteria)
586
+
587
+ If no test framework detected → include gaps as INFORMATIONAL findings only, no generation.
588
+
589
+ **Diff is test-only changes:** Skip Step 4.75 entirely: "No new application code paths to audit."
590
+
591
+ This step subsumes the "Test Gaps" category from Pass 2 — do not duplicate findings between the checklist Test Gaps item and this coverage diagram. Include any coverage gaps alongside the findings from Step 4 and Step 4.5. They follow the same Fix-First flow — gaps are INFORMATIONAL findings.
592
+
593
+ ---
594
+
595
+ ## Step 5: Fix-First Review
596
+
597
+ **Every finding gets action — not just critical ones.**
598
+
599
+ Output a summary header: `Pre-Landing Review: N issues (X critical, Y informational)`
600
+
601
+ ### Step 5a: Classify each finding
602
+
603
+ For each finding, classify as AUTO-FIX or ASK per the Fix-First Heuristic in
604
+ checklist.md. Critical findings lean toward ASK; informational findings lean
605
+ toward AUTO-FIX.
606
+
607
+ ### Step 5b: Auto-fix all AUTO-FIX items
608
+
609
+ Apply each fix directly. For each one, output a one-line summary:
610
+ `[AUTO-FIXED] [file:line] Problem → what you did`
611
+
612
+ ### Step 5c: Batch-ask about ASK items
613
+
614
+ If there are ASK items remaining, present them in ONE AskUserQuestion:
615
+
616
+ - List each item with a number, the severity label, the problem, and a recommended fix
617
+ - For each item, provide options: A) Fix as recommended, B) Skip
618
+ - Include an overall RECOMMENDATION
619
+
620
+ Example format:
621
+ ```
622
+ I auto-fixed 5 issues. 2 need your input:
623
+
624
+ 1. [CRITICAL] app/models/post.rb:42 — Race condition in status transition
625
+ Fix: Add `WHERE status = 'draft'` to the UPDATE
626
+ → A) Fix B) Skip
627
+
628
+ 2. [INFORMATIONAL] app/services/generator.rb:88 — LLM output not type-checked before DB write
629
+ Fix: Add JSON schema validation
630
+ → A) Fix B) Skip
631
+
632
+ RECOMMENDATION: Fix both — #1 is a real race condition, #2 prevents silent data corruption.
633
+ ```
634
+
635
+ If 3 or fewer ASK items, you may use individual AskUserQuestion calls instead of batching.
636
+
637
+ ### Step 5d: Apply user-approved fixes
638
+
639
+ Apply fixes for items where the user chose "Fix." Output what was fixed.
640
+
641
+ If no ASK items exist (everything was AUTO-FIX), skip the question entirely.
642
+
643
+ ### Verification of claims
644
+
645
+ Before producing the final review output:
646
+ - If you claim "this pattern is safe" → cite the specific line proving safety
647
+ - If you claim "this is handled elsewhere" → read and cite the handling code
648
+ - If you claim "tests cover this" → name the test file and method
649
+ - Never say "likely handled" or "probably tested" — verify or flag as unknown
650
+
651
+ **Rationalization prevention:** "This looks fine" is not a finding. Either cite evidence it IS fine, or flag it as unverified.
652
+
653
+ ### Greptile comment resolution
654
+
655
+ After outputting your own findings, if Greptile comments were classified in Step 2.5:
656
+
657
+ **Include a Greptile summary in your output header:** `+ N Greptile comments (X valid, Y fixed, Z FP)`
658
+
659
+ Before replying to any comment, run the **Escalation Detection** algorithm from greptile-triage.md to determine whether to use Tier 1 (friendly) or Tier 2 (firm) reply templates.
660
+
661
+ 1. **VALID & ACTIONABLE comments:** These are included in your findings — they follow the Fix-First flow (auto-fixed if mechanical, batched into ASK if not) (A: Fix it now, B: Acknowledge, C: False positive). If the user chooses A (fix), reply using the **Fix reply template** from greptile-triage.md (include inline diff + explanation). If the user chooses C (false positive), reply using the **False Positive reply template** (include evidence + suggested re-rank), save to both per-project and global greptile-history.
662
+
663
+ 2. **FALSE POSITIVE comments:** Present each one via AskUserQuestion:
664
+ - Show the Greptile comment: file:line (or [top-level]) + body summary + permalink URL
665
+ - Explain concisely why it's a false positive
666
+ - Options:
667
+ - A) Reply to Greptile explaining why this is incorrect (recommended if clearly wrong)
668
+ - B) Fix it anyway (if low-effort and harmless)
669
+ - C) Ignore — don't reply, don't fix
670
+
671
+ If the user chooses A, reply using the **False Positive reply template** from greptile-triage.md (include evidence + suggested re-rank), save to both per-project and global greptile-history.
672
+
673
+ 3. **VALID BUT ALREADY FIXED comments:** Reply using the **Already Fixed reply template** from greptile-triage.md — no AskUserQuestion needed:
674
+ - Include what was done and the fixing commit SHA
675
+ - Save to both per-project and global greptile-history
676
+
677
+ 4. **SUPPRESSED comments:** Skip silently — these are known false positives from previous triage.
678
+
679
+ ---
680
+
681
+ ## Step 5.5: TODOS cross-reference
682
+
683
+ Read `TODOS.md` in the repository root (if it exists). Cross-reference the PR against open TODOs:
684
+
685
+ - **Does this PR close any open TODOs?** If yes, note which items in your output: "This PR addresses TODO: <title>"
686
+ - **Does this PR create work that should become a TODO?** If yes, flag it as an informational finding.
687
+ - **Are there related TODOs that provide context for this review?** If yes, reference them when discussing related findings.
688
+
689
+ If TODOS.md doesn't exist, skip this step silently.
690
+
691
+ ---
692
+
693
+ ## Step 5.6: Documentation staleness check
694
+
695
+ Cross-reference the diff against documentation files. For each `.md` file in the repo root (README.md, ARCHITECTURE.md, CONTRIBUTING.md, CLAUDE.md, etc.):
696
+
697
+ 1. Check if code changes in the diff affect features, components, or workflows described in that doc file.
698
+ 2. If the doc file was NOT updated in this branch but the code it describes WAS changed, flag it as an INFORMATIONAL finding:
699
+ "Documentation may be stale: [file] describes [feature/component] but code changed in this branch. Consider running `/document-release`."
700
+
701
+ This is informational only — never critical. The fix action is `/document-release`.
702
+
703
+ If no documentation files exist, skip this step silently.
704
+
705
+ ---
706
+
707
+ ## Step 5.7: Adversarial review (auto-scaled)
708
+
709
+ Adversarial review thoroughness scales automatically based on diff size. No configuration needed.
710
+
711
+ **Detect diff size and tool availability:**
712
+
713
+ ```bash
714
+ DIFF_INS=$(git diff origin/<base> --stat | tail -1 | grep -oE '[0-9]+ insertion' | grep -oE '[0-9]+' || echo "0")
715
+ DIFF_DEL=$(git diff origin/<base> --stat | tail -1 | grep -oE '[0-9]+ deletion' | grep -oE '[0-9]+' || echo "0")
716
+ DIFF_TOTAL=$((DIFF_INS + DIFF_DEL))
717
+ which codex 2>/dev/null && echo "CODEX_AVAILABLE" || echo "CODEX_NOT_AVAILABLE"
718
+ # Respect old opt-out
719
+ OLD_CFG=$(~/.claude/skills/gstack/bin/gstack-config get codex_reviews 2>/dev/null || true)
720
+ echo "DIFF_SIZE: $DIFF_TOTAL"
721
+ echo "OLD_CFG: ${OLD_CFG:-not_set}"
722
+ ```
723
+
724
+ If `OLD_CFG` is `disabled`: skip this step silently. Continue to the next step.
725
+
726
+ **User override:** If the user explicitly requested a specific tier (e.g., "run all passes", "paranoid review", "full adversarial", "do all 4 passes", "thorough review"), honor that request regardless of diff size. Jump to the matching tier section.
727
+
728
+ **Auto-select tier based on diff size:**
729
+ - **Small (< 50 lines changed):** Skip adversarial review entirely. Print: "Small diff ($DIFF_TOTAL lines) — adversarial review skipped." Continue to the next step.
730
+ - **Medium (50–199 lines changed):** Run Codex adversarial challenge (or Claude adversarial subagent if Codex unavailable). Jump to the "Medium tier" section.
731
+ - **Large (200+ lines changed):** Run all remaining passes — Codex structured review + Claude adversarial subagent + Codex adversarial. Jump to the "Large tier" section.
732
+
733
+ ---
734
+
735
+ ### Medium tier (50–199 lines)
736
+
737
+ Claude's structured review already ran. Now add a **cross-model adversarial challenge**.
738
+
739
+ **If Codex is available:** run the Codex adversarial challenge. **If Codex is NOT available:** fall back to the Claude adversarial subagent instead.
740
+
741
+ **Codex adversarial:**
742
+
743
+ ```bash
744
+ TMPERR_ADV=$(mktemp /tmp/codex-adv-XXXXXXXX)
745
+ codex exec "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." -s read-only -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR_ADV"
746
+ ```
747
+
748
+ Use a 5-minute timeout (`timeout: 300000`). After the command completes, read stderr:
749
+ ```bash
750
+ cat "$TMPERR_ADV"
751
+ ```
752
+
753
+ Present the full output verbatim. This is informational — it never blocks shipping.
754
+
755
+ **Error handling:** All errors are non-blocking — adversarial review is a quality enhancement, not a prerequisite.
756
+ - **Auth failure:** If stderr contains "auth", "login", "unauthorized", or "API key": "Codex authentication failed. Run \`codex login\` to authenticate."
757
+ - **Timeout:** "Codex timed out after 5 minutes."
758
+ - **Empty response:** "Codex returned no response. Stderr: <paste relevant error>."
759
+
760
+ On any Codex error, fall back to the Claude adversarial subagent automatically.
761
+
762
+ **Claude adversarial subagent** (fallback when Codex unavailable or errored):
763
+
764
+ Dispatch via the Agent tool. The subagent has fresh context — no checklist bias from the structured review. This genuine independence catches things the primary reviewer is blind to.
765
+
766
+ Subagent prompt:
767
+ "Read the diff for this branch with `git diff origin/<base>`. Think like an attacker and a chaos engineer. Your job is to find ways this code will fail in production. Look for: edge cases, race conditions, security holes, resource leaks, failure modes, silent data corruption, logic errors that produce wrong results silently, error handling that swallows failures, and trust boundary violations. Be adversarial. Be thorough. No compliments — just the problems. For each finding, classify as FIXABLE (you know how to fix it) or INVESTIGATE (needs human judgment)."
768
+
769
+ Present findings under an `ADVERSARIAL REVIEW (Claude subagent):` header. **FIXABLE findings** flow into the same Fix-First pipeline as the structured review. **INVESTIGATE findings** are presented as informational.
770
+
771
+ If the subagent fails or times out: "Claude adversarial subagent unavailable. Continuing without adversarial review."
772
+
773
+ **Persist the review result:**
774
+ ```bash
775
+ ~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"adversarial-review","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","status":"STATUS","source":"SOURCE","tier":"medium","commit":"'"$(git rev-parse --short HEAD)"'"}'
776
+ ```
777
+ Substitute STATUS: "clean" if no findings, "issues_found" if findings exist. SOURCE: "codex" if Codex ran, "claude" if subagent ran. If both failed, do NOT persist.
778
+
779
+ **Cleanup:** Run `rm -f "$TMPERR_ADV"` after processing (if Codex was used).
780
+
781
+ ---
782
+
783
+ ### Large tier (200+ lines)
784
+
785
+ Claude's structured review already ran. Now run **all three remaining passes** for maximum coverage:
786
+
787
+ **1. Codex structured review (if available):**
788
+ ```bash
789
+ TMPERR=$(mktemp /tmp/codex-review-XXXXXXXX)
790
+ codex review --base <base> -c 'model_reasoning_effort="xhigh"' --enable web_search_cached 2>"$TMPERR"
791
+ ```
792
+
793
+ Use a 5-minute timeout. Present output under `CODEX SAYS (code review):` header.
794
+ Check for `[P1]` markers: found → `GATE: FAIL`, not found → `GATE: PASS`.
795
+
796
+ If GATE is FAIL, use AskUserQuestion:
797
+ ```
798
+ Codex found N critical issues in the diff.
799
+
800
+ A) Investigate and fix now (recommended)
801
+ B) Continue — review will still complete
802
+ ```
803
+
804
+ If A: address the findings. Re-run `codex review` to verify.
805
+
806
+ Read stderr for errors (same error handling as medium tier).
807
+
808
+ After stderr: `rm -f "$TMPERR"`
809
+
810
+ **2. Claude adversarial subagent:** Dispatch a subagent with the adversarial prompt (same prompt as medium tier). This always runs regardless of Codex availability.
811
+
812
+ **3. Codex adversarial challenge (if available):** Run `codex exec` with the adversarial prompt (same as medium tier).
813
+
814
+ If Codex is not available for steps 1 and 3, note to the user: "Codex CLI not found — large-diff review ran Claude structured + Claude adversarial (2 of 4 passes). Install Codex for full 4-pass coverage: `npm install -g @openai/codex`"
815
+
816
+ **Persist the review result AFTER all passes complete** (not after each sub-step):
817
+ ```bash
818
+ ~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"adversarial-review","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","status":"STATUS","source":"SOURCE","tier":"large","gate":"GATE","commit":"'"$(git rev-parse --short HEAD)"'"}'
819
+ ```
820
+ Substitute: STATUS = "clean" if no findings across ALL passes, "issues_found" if any pass found issues. SOURCE = "both" if Codex ran, "claude" if only Claude subagent ran. GATE = the Codex structured review gate result ("pass"/"fail"), or "informational" if Codex was unavailable. If all passes failed, do NOT persist.
821
+
822
+ ---
823
+
824
+ ### Cross-model synthesis (medium and large tiers)
825
+
826
+ After all passes complete, synthesize findings across all sources:
827
+
828
+ ```
829
+ ADVERSARIAL REVIEW SYNTHESIS (auto: TIER, N lines):
830
+ ════════════════════════════════════════════════════════════
831
+ High confidence (found by multiple sources): [findings agreed on by >1 pass]
832
+ Unique to Claude structured review: [from earlier step]
833
+ Unique to Claude adversarial: [from subagent, if ran]
834
+ Unique to Codex: [from codex adversarial or code review, if ran]
835
+ Models used: Claude structured ✓ Claude adversarial ✓/✗ Codex ✓/✗
836
+ ════════════════════════════════════════════════════════════
837
+ ```
838
+
839
+ High-confidence findings (agreed on by multiple sources) should be prioritized for fixes.
840
+
841
+ ---
842
+
843
+ ## Important Rules
844
+
845
+ - **Read the FULL diff before commenting.** Do not flag issues already addressed in the diff.
846
+ - **Fix-first, not read-only.** AUTO-FIX items are applied directly. ASK items are only applied after user approval. Never commit, push, or create PRs — that's /ship's job.
847
+ - **Be terse.** One line problem, one line fix. No preamble.
848
+ - **Only flag real problems.** Skip anything that's fine.
849
+ - **Use Greptile reply templates from greptile-triage.md.** Every reply includes evidence. Never post vague replies.