From 90f944108f364b6eeac6c971f17cf46db9399260 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 14 May 2026 20:50:32 -0700 Subject: [PATCH 1/3] feat: EXIT PLAN MODE GATE for plan-mode review skills MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a terminal BLOCKING checklist that verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Lives at EOF of all four plan-* review skills (eng/ceo/design/devex) and inside codex Step 2A. Tones down the preamble's "Plan Status Footer" to a neutral forward reference so review-report rules don't bleed into operational skills (/ship /qa /review). Single source of truth: `generateExitPlanModeGate` in scripts/resolvers/review.ts, registered as EXIT_PLAN_MODE_GATE in scripts/resolvers/index.ts. New test in test/gen-skill-docs.test.ts strips fenced code blocks before matching `## ` headings and asserts the gate is the terminal heading in all four plan-* review SKILL.md files. Codex's SKILL.md uses toContain (mid-file by design — Step 2B/2C are not plan-touching modes). Decisions locked via /plan-eng-review + /codex outside-voice: - D1=A: 4 plan-* reviews + codex (autoplan, office-hours deferred) - D2=B → D4=A: tone preamble down to neutral forward reference - D3=A: add automated test in test/gen-skill-docs.test.ts - D5=B: keep codex gate inside Step 2A (mid-file acceptable per gate self-gating) Codex pre-merge findings folded in: line numbers obsolete (use EOF), test regex must strip fences, fresh skill list (not stale REVIEW_SKILLS constant), gate check 4 short-circuits when no plan file in context. Co-Authored-By: Claude Opus 4.7 --- SKILL.md | 4 +-- autoplan/SKILL.md | 4 +-- benchmark-models/SKILL.md | 4 +-- benchmark/SKILL.md | 4 +-- browse/SKILL.md | 4 +-- canary/SKILL.md | 4 +-- codex/SKILL.md | 29 +++++++++++++-- codex/SKILL.md.tmpl | 2 ++ context-restore/SKILL.md | 4 +-- context-save/SKILL.md | 4 +-- cso/SKILL.md | 4 +-- design-consultation/SKILL.md | 4 +-- design-html/SKILL.md | 4 +-- design-review/SKILL.md | 4 +-- design-shotgun/SKILL.md | 4 +-- devex-review/SKILL.md | 4 +-- document-generate/SKILL.md | 4 +-- document-release/SKILL.md | 4 +-- health/SKILL.md | 4 +-- investigate/SKILL.md | 4 +-- land-and-deploy/SKILL.md | 4 +-- landing-report/SKILL.md | 4 +-- learn/SKILL.md | 4 +-- make-pdf/SKILL.md | 4 +-- office-hours/SKILL.md | 4 +-- open-gstack-browser/SKILL.md | 4 +-- pair-agent/SKILL.md | 4 +-- plan-ceo-review/SKILL.md | 29 +++++++++++++-- plan-ceo-review/SKILL.md.tmpl | 2 ++ plan-design-review/SKILL.md | 29 +++++++++++++-- plan-design-review/SKILL.md.tmpl | 2 ++ plan-devex-review/SKILL.md | 29 +++++++++++++-- plan-devex-review/SKILL.md.tmpl | 2 ++ plan-eng-review/SKILL.md | 29 +++++++++++++-- plan-eng-review/SKILL.md.tmpl | 2 ++ plan-tune/SKILL.md | 4 +-- qa-only/SKILL.md | 4 +-- qa/SKILL.md | 4 +-- retro/SKILL.md | 4 +-- review/SKILL.md | 4 +-- scrape/SKILL.md | 4 +-- scripts/resolvers/index.ts | 3 +- .../preamble/generate-completion-status.ts | 4 +-- scripts/resolvers/review.ts | 27 ++++++++++++++ setup-browser-cookies/SKILL.md | 4 +-- setup-deploy/SKILL.md | 4 +-- setup-gbrain/SKILL.md | 4 +-- ship/SKILL.md | 4 +-- skillify/SKILL.md | 4 +-- sync-gbrain/SKILL.md | 4 +-- test/fixtures/golden/claude-ship-SKILL.md | 4 +-- test/fixtures/golden/codex-ship-SKILL.md | 4 +-- test/fixtures/golden/factory-ship-SKILL.md | 4 +-- test/gen-skill-docs.test.ts | 35 +++++++++++++++++-- 54 files changed, 242 insertions(+), 142 deletions(-) diff --git a/SKILL.md b/SKILL.md index 1a61ac96f41..c6441014cbb 100644 --- a/SKILL.md +++ b/SKILL.md @@ -473,9 +473,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. If `PROACTIVE` is `false`: do NOT proactively invoke or suggest other gstack skills during this session. Only run skills the user explicitly invokes. This preference persists across diff --git a/autoplan/SKILL.md b/autoplan/SKILL.md index c64e6e8bd9d..5394c16bc84 100644 --- a/autoplan/SKILL.md +++ b/autoplan/SKILL.md @@ -766,9 +766,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/benchmark-models/SKILL.md b/benchmark-models/SKILL.md index 5e5e6bd6679..47050855b0f 100644 --- a/benchmark-models/SKILL.md +++ b/benchmark-models/SKILL.md @@ -475,9 +475,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /benchmark-models — Cross-Model Skill Benchmark diff --git a/benchmark/SKILL.md b/benchmark/SKILL.md index 46934ba3df6..b6dc8137351 100644 --- a/benchmark/SKILL.md +++ b/benchmark/SKILL.md @@ -475,9 +475,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## SETUP (run this check BEFORE any browse command) diff --git a/browse/SKILL.md b/browse/SKILL.md index 1d544756c2b..6a4f5c26966 100644 --- a/browse/SKILL.md +++ b/browse/SKILL.md @@ -474,9 +474,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # browse: QA Testing & Dogfooding diff --git a/canary/SKILL.md b/canary/SKILL.md index a211c386a46..1ba6ecec715 100644 --- a/canary/SKILL.md +++ b/canary/SKILL.md @@ -740,9 +740,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## SETUP (run this check BEFORE any browse command) diff --git a/codex/SKILL.md b/codex/SKILL.md index f6b507697f8..edf4075f2d5 100644 --- a/codex/SKILL.md +++ b/codex/SKILL.md @@ -760,9 +760,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch @@ -1153,6 +1151,31 @@ prior versions to leave the report mid-file when an older report already lived there — the user then sees a plan whose review report is not at the bottom and (correctly) rejects it. +## EXIT PLAN MODE GATE (BLOCKING) + +Before calling ExitPlanMode, run this self-check. If any item fails, do the +missing work — do NOT call ExitPlanMode: + +1. Read the plan file with the Read tool (after your most recent write to it). +2. Confirm the LAST `## ` heading in the file is `## GSTACK REVIEW REPORT`. + In-body prose that mentions "outside voice", "codex findings", or similar + does NOT count — only the structured `## GSTACK REVIEW REPORT` section + satisfies this check. +3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT + line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable. +4. If a plan file is in context for this skill invocation: confirm + `gstack-review-log` was called and `gstack-review-read` was run at least + once. If no plan file is in context (e.g. `/codex consult` against a + diff with no plan), this check short-circuits — checks 1-3 already + short-circuit when no plan file exists. + +Failing this gate and calling ExitPlanMode anyway is a contract violation — +the user will see a plan whose review report is missing or stale, and will +(correctly) reject it. Self-deception failure mode to watch for: feeling +"done" after writing review prose into the plan body. The body prose is not +the report. The report is a separate, structured, table-bearing section that +must be the file's terminal heading. + --- ## Step 2B: Challenge (Adversarial) Mode diff --git a/codex/SKILL.md.tmpl b/codex/SKILL.md.tmpl index ab2a405f83b..329e93c4f5a 100644 --- a/codex/SKILL.md.tmpl +++ b/codex/SKILL.md.tmpl @@ -295,6 +295,8 @@ rm -f "$TMPERR" {{PLAN_FILE_REVIEW_REPORT}} +{{EXIT_PLAN_MODE_GATE}} + --- ## Step 2B: Challenge (Adversarial) Mode diff --git a/context-restore/SKILL.md b/context-restore/SKILL.md index 4f0cd70eb7c..92eb1cdd1d2 100644 --- a/context-restore/SKILL.md +++ b/context-restore/SKILL.md @@ -744,9 +744,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /context-restore — Restore Saved Working Context diff --git a/context-save/SKILL.md b/context-save/SKILL.md index b083b039ffa..5a7b0d60eb3 100644 --- a/context-save/SKILL.md +++ b/context-save/SKILL.md @@ -744,9 +744,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /context-save — Save Working Context diff --git a/cso/SKILL.md b/cso/SKILL.md index fe12df74e3b..70d8105e7a3 100644 --- a/cso/SKILL.md +++ b/cso/SKILL.md @@ -745,9 +745,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. diff --git a/design-consultation/SKILL.md b/design-consultation/SKILL.md index ed4d3811bc0..00a5f0f2eca 100644 --- a/design-consultation/SKILL.md +++ b/design-consultation/SKILL.md @@ -786,9 +786,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /design-consultation: Your Design System, Built Together diff --git a/design-html/SKILL.md b/design-html/SKILL.md index 2337af72100..5c92f770329 100644 --- a/design-html/SKILL.md +++ b/design-html/SKILL.md @@ -747,9 +747,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /design-html: Pretext-Native HTML Engine diff --git a/design-review/SKILL.md b/design-review/SKILL.md index d17c0767824..91603dd2e75 100644 --- a/design-review/SKILL.md +++ b/design-review/SKILL.md @@ -763,9 +763,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. diff --git a/design-shotgun/SKILL.md b/design-shotgun/SKILL.md index 2f8ac7abb0a..178416ba240 100644 --- a/design-shotgun/SKILL.md +++ b/design-shotgun/SKILL.md @@ -762,9 +762,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /design-shotgun: Visual Design Exploration diff --git a/devex-review/SKILL.md b/devex-review/SKILL.md index fd8dbf908d9..49d5ae2128e 100644 --- a/devex-review/SKILL.md +++ b/devex-review/SKILL.md @@ -763,9 +763,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/document-generate/SKILL.md b/document-generate/SKILL.md index d9e0ddeb8c4..e6cf9965d17 100644 --- a/document-generate/SKILL.md +++ b/document-generate/SKILL.md @@ -747,9 +747,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/document-release/SKILL.md b/document-release/SKILL.md index 24d48aaaaaa..b49f4e89b4f 100644 --- a/document-release/SKILL.md +++ b/document-release/SKILL.md @@ -744,9 +744,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/health/SKILL.md b/health/SKILL.md index b5471c0e8e9..396c980b2ae 100644 --- a/health/SKILL.md +++ b/health/SKILL.md @@ -742,9 +742,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /health -- Code Quality Dashboard diff --git a/investigate/SKILL.md b/investigate/SKILL.md index 9e2b23f0f78..b7780c1c41a 100644 --- a/investigate/SKILL.md +++ b/investigate/SKILL.md @@ -781,9 +781,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # Systematic Debugging diff --git a/land-and-deploy/SKILL.md b/land-and-deploy/SKILL.md index 1c19c98b05a..b58ec231640 100644 --- a/land-and-deploy/SKILL.md +++ b/land-and-deploy/SKILL.md @@ -757,9 +757,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## SETUP (run this check BEFORE any browse command) diff --git a/landing-report/SKILL.md b/landing-report/SKILL.md index e14817cfa1a..be8aed5e178 100644 --- a/landing-report/SKILL.md +++ b/landing-report/SKILL.md @@ -758,9 +758,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. --- diff --git a/learn/SKILL.md b/learn/SKILL.md index 899ad42c1af..3599115b8c4 100644 --- a/learn/SKILL.md +++ b/learn/SKILL.md @@ -742,9 +742,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # Project Learnings Manager diff --git a/make-pdf/SKILL.md b/make-pdf/SKILL.md index 927b637d946..045e31516d1 100644 --- a/make-pdf/SKILL.md +++ b/make-pdf/SKILL.md @@ -510,9 +510,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # make-pdf: publication-quality PDFs from markdown diff --git a/office-hours/SKILL.md b/office-hours/SKILL.md index 6170f0e5fb6..c4acb9ea862 100644 --- a/office-hours/SKILL.md +++ b/office-hours/SKILL.md @@ -795,9 +795,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## SETUP (run this check BEFORE any browse command) diff --git a/open-gstack-browser/SKILL.md b/open-gstack-browser/SKILL.md index b510d9d7b19..8b4b0c493ac 100644 --- a/open-gstack-browser/SKILL.md +++ b/open-gstack-browser/SKILL.md @@ -757,9 +757,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /open-gstack-browser — Launch GStack Browser diff --git a/pair-agent/SKILL.md b/pair-agent/SKILL.md index 8ddaf5e1ae1..dd7a51ecdc2 100644 --- a/pair-agent/SKILL.md +++ b/pair-agent/SKILL.md @@ -758,9 +758,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /pair-agent — Share Your Browser With Another AI Agent diff --git a/plan-ceo-review/SKILL.md b/plan-ceo-review/SKILL.md index 0f1738aecc4..fedb7564527 100644 --- a/plan-ceo-review/SKILL.md +++ b/plan-ceo-review/SKILL.md @@ -789,9 +789,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch @@ -2126,3 +2124,28 @@ already knows. A good test: would this insight save time in a future session? If │ (Sec 11) │ UI review │ detected │ detected │ │ └─────────────┴──────────────┴──────────────┴──────────────┴────────────────────┘ ``` + +## EXIT PLAN MODE GATE (BLOCKING) + +Before calling ExitPlanMode, run this self-check. If any item fails, do the +missing work — do NOT call ExitPlanMode: + +1. Read the plan file with the Read tool (after your most recent write to it). +2. Confirm the LAST `## ` heading in the file is `## GSTACK REVIEW REPORT`. + In-body prose that mentions "outside voice", "codex findings", or similar + does NOT count — only the structured `## GSTACK REVIEW REPORT` section + satisfies this check. +3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT + line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable. +4. If a plan file is in context for this skill invocation: confirm + `gstack-review-log` was called and `gstack-review-read` was run at least + once. If no plan file is in context (e.g. `/codex consult` against a + diff with no plan), this check short-circuits — checks 1-3 already + short-circuit when no plan file exists. + +Failing this gate and calling ExitPlanMode anyway is a contract violation — +the user will see a plan whose review report is missing or stale, and will +(correctly) reject it. Self-deception failure mode to watch for: feeling +"done" after writing review prose into the plan body. The body prose is not +the report. The report is a separate, structured, table-bearing section that +must be the file's terminal heading. diff --git a/plan-ceo-review/SKILL.md.tmpl b/plan-ceo-review/SKILL.md.tmpl index 7da8f576108..ef71e8c8327 100644 --- a/plan-ceo-review/SKILL.md.tmpl +++ b/plan-ceo-review/SKILL.md.tmpl @@ -890,3 +890,5 @@ If promoted, copy the CEO plan content to `docs/designs/{FEATURE}.md` (create th │ (Sec 11) │ UI review │ detected │ detected │ │ └─────────────┴──────────────┴──────────────┴──────────────┴────────────────────┘ ``` + +{{EXIT_PLAN_MODE_GATE}} diff --git a/plan-design-review/SKILL.md b/plan-design-review/SKILL.md index 699bacf69cf..10c590215ff 100644 --- a/plan-design-review/SKILL.md +++ b/plan-design-review/SKILL.md @@ -762,9 +762,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch @@ -1846,3 +1844,28 @@ Use AskUserQuestion to present the next step. Include only applicable options: * One sentence max per option. * After each pass, pause and wait for feedback. * Rate before and after each pass for scannability. + +## EXIT PLAN MODE GATE (BLOCKING) + +Before calling ExitPlanMode, run this self-check. If any item fails, do the +missing work — do NOT call ExitPlanMode: + +1. Read the plan file with the Read tool (after your most recent write to it). +2. Confirm the LAST `## ` heading in the file is `## GSTACK REVIEW REPORT`. + In-body prose that mentions "outside voice", "codex findings", or similar + does NOT count — only the structured `## GSTACK REVIEW REPORT` section + satisfies this check. +3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT + line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable. +4. If a plan file is in context for this skill invocation: confirm + `gstack-review-log` was called and `gstack-review-read` was run at least + once. If no plan file is in context (e.g. `/codex consult` against a + diff with no plan), this check short-circuits — checks 1-3 already + short-circuit when no plan file exists. + +Failing this gate and calling ExitPlanMode anyway is a contract violation — +the user will see a plan whose review report is missing or stale, and will +(correctly) reject it. Self-deception failure mode to watch for: feeling +"done" after writing review prose into the plan body. The body prose is not +the report. The report is a separate, structured, table-bearing section that +must be the file's terminal heading. diff --git a/plan-design-review/SKILL.md.tmpl b/plan-design-review/SKILL.md.tmpl index 24e89a01ec3..a64e231508c 100644 --- a/plan-design-review/SKILL.md.tmpl +++ b/plan-design-review/SKILL.md.tmpl @@ -475,3 +475,5 @@ Use AskUserQuestion to present the next step. Include only applicable options: * One sentence max per option. * After each pass, pause and wait for feedback. * Rate before and after each pass for scannability. + +{{EXIT_PLAN_MODE_GATE}} diff --git a/plan-devex-review/SKILL.md b/plan-devex-review/SKILL.md index 886964a5875..0172df6bc78 100644 --- a/plan-devex-review/SKILL.md +++ b/plan-devex-review/SKILL.md @@ -766,9 +766,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch @@ -2047,3 +2045,28 @@ Outside voice| Recommended | Recommended | Skip * One sentence max per option. * After each pass, pause and wait for feedback before moving on. * Rate before and after each pass for scannability. + +## EXIT PLAN MODE GATE (BLOCKING) + +Before calling ExitPlanMode, run this self-check. If any item fails, do the +missing work — do NOT call ExitPlanMode: + +1. Read the plan file with the Read tool (after your most recent write to it). +2. Confirm the LAST `## ` heading in the file is `## GSTACK REVIEW REPORT`. + In-body prose that mentions "outside voice", "codex findings", or similar + does NOT count — only the structured `## GSTACK REVIEW REPORT` section + satisfies this check. +3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT + line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable. +4. If a plan file is in context for this skill invocation: confirm + `gstack-review-log` was called and `gstack-review-read` was run at least + once. If no plan file is in context (e.g. `/codex consult` against a + diff with no plan), this check short-circuits — checks 1-3 already + short-circuit when no plan file exists. + +Failing this gate and calling ExitPlanMode anyway is a contract violation — +the user will see a plan whose review report is missing or stale, and will +(correctly) reject it. Self-deception failure mode to watch for: feeling +"done" after writing review prose into the plan body. The body prose is not +the report. The report is a separate, structured, table-bearing section that +must be the file's terminal heading. diff --git a/plan-devex-review/SKILL.md.tmpl b/plan-devex-review/SKILL.md.tmpl index 5b68c2ea5ea..88dd0038bcc 100644 --- a/plan-devex-review/SKILL.md.tmpl +++ b/plan-devex-review/SKILL.md.tmpl @@ -827,3 +827,5 @@ Outside voice| Recommended | Recommended | Skip * One sentence max per option. * After each pass, pause and wait for feedback before moving on. * Rate before and after each pass for scannability. + +{{EXIT_PLAN_MODE_GATE}} diff --git a/plan-eng-review/SKILL.md b/plan-eng-review/SKILL.md index 8814555509f..d47c39f5ea6 100644 --- a/plan-eng-review/SKILL.md +++ b/plan-eng-review/SKILL.md @@ -764,9 +764,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. @@ -1653,3 +1651,28 @@ Use AskUserQuestion with only the applicable options: ## Unresolved decisions If the user does not respond to an AskUserQuestion or interrupts to move on, note which decisions were left unresolved. At the end of the review, list these as "Unresolved decisions that may bite you later" — never silently default to an option. + +## EXIT PLAN MODE GATE (BLOCKING) + +Before calling ExitPlanMode, run this self-check. If any item fails, do the +missing work — do NOT call ExitPlanMode: + +1. Read the plan file with the Read tool (after your most recent write to it). +2. Confirm the LAST `## ` heading in the file is `## GSTACK REVIEW REPORT`. + In-body prose that mentions "outside voice", "codex findings", or similar + does NOT count — only the structured `## GSTACK REVIEW REPORT` section + satisfies this check. +3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT + line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable. +4. If a plan file is in context for this skill invocation: confirm + `gstack-review-log` was called and `gstack-review-read` was run at least + once. If no plan file is in context (e.g. `/codex consult` against a + diff with no plan), this check short-circuits — checks 1-3 already + short-circuit when no plan file exists. + +Failing this gate and calling ExitPlanMode anyway is a contract violation — +the user will see a plan whose review report is missing or stale, and will +(correctly) reject it. Self-deception failure mode to watch for: feeling +"done" after writing review prose into the plan body. The body prose is not +the report. The report is a separate, structured, table-bearing section that +must be the file's terminal heading. diff --git a/plan-eng-review/SKILL.md.tmpl b/plan-eng-review/SKILL.md.tmpl index a950c060d2b..8bdd3933ee2 100644 --- a/plan-eng-review/SKILL.md.tmpl +++ b/plan-eng-review/SKILL.md.tmpl @@ -338,3 +338,5 @@ Use AskUserQuestion with only the applicable options: ## Unresolved decisions If the user does not respond to an AskUserQuestion or interrupts to move on, note which decisions were left unresolved. At the end of the review, list these as "Unresolved decisions that may bite you later" — never silently default to an option. + +{{EXIT_PLAN_MODE_GATE}} diff --git a/plan-tune/SKILL.md b/plan-tune/SKILL.md index 471fbe51704..c575ef4f462 100644 --- a/plan-tune/SKILL.md +++ b/plan-tune/SKILL.md @@ -753,9 +753,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /plan-tune — Question Tuning + Developer Profile (v1 observational) diff --git a/qa-only/SKILL.md b/qa-only/SKILL.md index 77dcc4d23d3..3e95cb03242 100644 --- a/qa-only/SKILL.md +++ b/qa-only/SKILL.md @@ -759,9 +759,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /qa-only: Report-Only QA Testing diff --git a/qa/SKILL.md b/qa/SKILL.md index 0b56e53e2f6..aec716f95b1 100644 --- a/qa/SKILL.md +++ b/qa/SKILL.md @@ -765,9 +765,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/retro/SKILL.md b/retro/SKILL.md index 2d2684afebf..92d58f7b8e3 100644 --- a/retro/SKILL.md +++ b/retro/SKILL.md @@ -759,9 +759,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/review/SKILL.md b/review/SKILL.md index 4d134d17511..88378396a9c 100644 --- a/review/SKILL.md +++ b/review/SKILL.md @@ -762,9 +762,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/scrape/SKILL.md b/scrape/SKILL.md index b255abe085f..7fb04d3f6e5 100644 --- a/scrape/SKILL.md +++ b/scrape/SKILL.md @@ -758,9 +758,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /scrape — pull data from a page diff --git a/scripts/resolvers/index.ts b/scripts/resolvers/index.ts index d96b729dc8c..40342f497a3 100644 --- a/scripts/resolvers/index.ts +++ b/scripts/resolvers/index.ts @@ -11,7 +11,7 @@ import { generateTestFailureTriage } from './preamble'; import { generateCommandReference, generateSnapshotFlags, generateBrowseSetup } from './browse'; import { generateDesignMethodology, generateDesignHardRules, generateDesignOutsideVoices, generateDesignReviewLite, generateDesignSketch, generateDesignSetup, generateDesignMockup, generateDesignShotgunLoop, generateTasteProfile, generateUXPrinciples } from './design'; import { generateTestBootstrap, generateTestCoverageAuditPlan, generateTestCoverageAuditShip, generateTestCoverageAuditReview } from './testing'; -import { generateReviewDashboard, generatePlanFileReviewReport, generateAntiShortcutClause, generateSpecReviewLoop, generateBenefitsFrom, generateCodexSecondOpinion, generateAdversarialStep, generateCodexPlanReview, generatePlanCompletionAuditShip, generatePlanCompletionAuditReview, generatePlanVerificationExec, generateScopeDrift, generateCrossReviewDedup } from './review'; +import { generateReviewDashboard, generatePlanFileReviewReport, generateExitPlanModeGate, generateAntiShortcutClause, generateSpecReviewLoop, generateBenefitsFrom, generateCodexSecondOpinion, generateAdversarialStep, generateCodexPlanReview, generatePlanCompletionAuditShip, generatePlanCompletionAuditReview, generatePlanVerificationExec, generateScopeDrift, generateCrossReviewDedup } from './review'; import { generateSlugEval, generateSlugSetup, generateBaseBranchDetect, generateDeployBootstrap, generateQAMethodology, generateCoAuthorTrailer, generateChangelogWorkflow } from './utility'; import { generateLearningsSearch, generateLearningsLog } from './learnings'; import { generateConfidenceCalibration } from './confidence'; @@ -39,6 +39,7 @@ export const RESOLVERS: Record = { DESIGN_REVIEW_LITE: generateDesignReviewLite, REVIEW_DASHBOARD: generateReviewDashboard, PLAN_FILE_REVIEW_REPORT: generatePlanFileReviewReport, + EXIT_PLAN_MODE_GATE: generateExitPlanModeGate, ANTI_SHORTCUT_CLAUSE: generateAntiShortcutClause, TEST_BOOTSTRAP: generateTestBootstrap, TEST_COVERAGE_AUDIT_PLAN: generateTestCoverageAuditPlan, diff --git a/scripts/resolvers/preamble/generate-completion-status.ts b/scripts/resolvers/preamble/generate-completion-status.ts index 21c0bd5e722..0c50da1c714 100644 --- a/scripts/resolvers/preamble/generate-completion-status.ts +++ b/scripts/resolvers/preamble/generate-completion-status.ts @@ -81,7 +81,5 @@ Replace \`SKILL_NAME\`, \`OUTCOME\`, and \`USED_BROWSE\` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks \`## GSTACK REVIEW REPORT\`, run \`~/.claude/skills/gstack/bin/gstack-review-read\` and append the standard runs/status/findings table. With \`NO_REVIEWS\` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run \`/autoplan\`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file).`; +Skills that run plan reviews (\`/plan-*-review\`, \`/codex review\`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with \`## GSTACK REVIEW REPORT\` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like \`/ship\`, \`/qa\`, \`/review\`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode.`; } diff --git a/scripts/resolvers/review.ts b/scripts/resolvers/review.ts index 263767d699c..3b9e2999d94 100644 --- a/scripts/resolvers/review.ts +++ b/scripts/resolvers/review.ts @@ -158,6 +158,33 @@ there — the user then sees a plan whose review report is not at the bottom and (correctly) rejects it.`; } +export function generateExitPlanModeGate(_ctx: TemplateContext): string { + return `## EXIT PLAN MODE GATE (BLOCKING) + +Before calling ExitPlanMode, run this self-check. If any item fails, do the +missing work — do NOT call ExitPlanMode: + +1. Read the plan file with the Read tool (after your most recent write to it). +2. Confirm the LAST \`## \` heading in the file is \`## GSTACK REVIEW REPORT\`. + In-body prose that mentions "outside voice", "codex findings", or similar + does NOT count — only the structured \`## GSTACK REVIEW REPORT\` section + satisfies this check. +3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT + line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable. +4. If a plan file is in context for this skill invocation: confirm + \`gstack-review-log\` was called and \`gstack-review-read\` was run at least + once. If no plan file is in context (e.g. \`/codex consult\` against a + diff with no plan), this check short-circuits — checks 1-3 already + short-circuit when no plan file exists. + +Failing this gate and calling ExitPlanMode anyway is a contract violation — +the user will see a plan whose review report is missing or stale, and will +(correctly) reject it. Self-deception failure mode to watch for: feeling +"done" after writing review prose into the plan body. The body prose is not +the report. The report is a separate, structured, table-bearing section that +must be the file's terminal heading.`; +} + export function generateAntiShortcutClause(_ctx: TemplateContext): string { return `**Anti-shortcut clause:** The plan file is the OUTPUT of the interactive review, not a substitute for it. Writing every finding into one plan write and calling ExitPlanMode without firing AskUserQuestion is the precise failure mode of the May 2026 transcript bug — the model explored, found issues, and dumped them into a deliverable rather than walking the user through them. If you have ANY non-trivial finding in any review section, the path from finding to ExitPlanMode goes THROUGH AskUserQuestion. Zero findings in every section is the only path to ExitPlanMode that bypasses AskUserQuestion. If you find yourself wanting to write a plan with findings before asking, stop and call AskUserQuestion now — that's the bug, recognize it.`; } diff --git a/setup-browser-cookies/SKILL.md b/setup-browser-cookies/SKILL.md index 4e46c0b255c..8b80fd58bb5 100644 --- a/setup-browser-cookies/SKILL.md +++ b/setup-browser-cookies/SKILL.md @@ -471,9 +471,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # Setup Browser Cookies diff --git a/setup-deploy/SKILL.md b/setup-deploy/SKILL.md index 2731365c5ec..0e09cc491aa 100644 --- a/setup-deploy/SKILL.md +++ b/setup-deploy/SKILL.md @@ -743,9 +743,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /setup-deploy — Configure Deployment for gstack diff --git a/setup-gbrain/SKILL.md b/setup-gbrain/SKILL.md index c1abd775cc9..a31b7de7a39 100644 --- a/setup-gbrain/SKILL.md +++ b/setup-gbrain/SKILL.md @@ -744,9 +744,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /setup-gbrain — Coding-Agent Onboarding for gbrain diff --git a/ship/SKILL.md b/ship/SKILL.md index 25119fb391e..dcab2bddab2 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -763,9 +763,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/skillify/SKILL.md b/skillify/SKILL.md index 503f8262b22..afef0e3a1e5 100644 --- a/skillify/SKILL.md +++ b/skillify/SKILL.md @@ -759,9 +759,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /skillify — codify the last scrape into a permanent skill diff --git a/sync-gbrain/SKILL.md b/sync-gbrain/SKILL.md index 8dba77386bc..f7b9b523054 100644 --- a/sync-gbrain/SKILL.md +++ b/sync-gbrain/SKILL.md @@ -744,9 +744,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. # /sync-gbrain — Keep gbrain current and teach the agent to use it diff --git a/test/fixtures/golden/claude-ship-SKILL.md b/test/fixtures/golden/claude-ship-SKILL.md index 25119fb391e..dcab2bddab2 100644 --- a/test/fixtures/golden/claude-ship-SKILL.md +++ b/test/fixtures/golden/claude-ship-SKILL.md @@ -763,9 +763,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `~/.claude/skills/gstack/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/test/fixtures/golden/codex-ship-SKILL.md b/test/fixtures/golden/codex-ship-SKILL.md index 7770a8906e8..58bf20a0de4 100644 --- a/test/fixtures/golden/codex-ship-SKILL.md +++ b/test/fixtures/golden/codex-ship-SKILL.md @@ -752,9 +752,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `$GSTACK_ROOT/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/test/fixtures/golden/factory-ship-SKILL.md b/test/fixtures/golden/factory-ship-SKILL.md index baae7421d90..e71f38883b7 100644 --- a/test/fixtures/golden/factory-ship-SKILL.md +++ b/test/fixtures/golden/factory-ship-SKILL.md @@ -754,9 +754,7 @@ Replace `SKILL_NAME`, `OUTCOME`, and `USED_BROWSE` before running. ## Plan Status Footer -In plan mode before ExitPlanMode: if the plan file lacks `## GSTACK REVIEW REPORT`, run `$GSTACK_ROOT/bin/gstack-review-read` and append the standard runs/status/findings table. With `NO_REVIEWS` or empty, append a 5-row placeholder with verdict "NO REVIEWS YET — run `/autoplan`". If a richer report exists, skip. - -PLAN MODE EXCEPTION — always allowed (it's the plan file). +Skills that run plan reviews (`/plan-*-review`, `/codex review`) include the EXIT PLAN MODE GATE blocking checklist at the end of the skill, which verifies the plan file ends with `## GSTACK REVIEW REPORT` before ExitPlanMode is called. Skills that don't run plan reviews (operational skills like `/ship`, `/qa`, `/review`) typically don't operate in plan mode and have no review report to verify; this footer is a no-op for them. Writing the plan file is the one edit allowed in plan mode. ## Step 0: Detect platform and base branch diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index 4bf8abeeeb6..a270b3eb425 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -1090,14 +1090,16 @@ describe('Retro plan completion section', () => { // --- Plan status footer in preamble --- describe('Plan status footer in preamble', () => { - test('preamble contains plan status footer', () => { + test('preamble contains plan status footer as neutral forward reference to EXIT PLAN MODE GATE', () => { // Read any skill that uses PREAMBLE const content = fs.readFileSync(path.join(ROOT, 'office-hours', 'SKILL.md'), 'utf-8'); expect(content).toContain('Plan Status Footer'); expect(content).toContain('GSTACK REVIEW REPORT'); - expect(content).toContain('gstack-review-read'); expect(content).toContain('ExitPlanMode'); - expect(content).toContain('NO REVIEWS YET'); + expect(content).toContain('EXIT PLAN MODE GATE'); + // The preamble must NOT impose review-report rules on operational skills + // that have no review report. It's a forward reference, not enforcement. + expect(content).not.toContain('NO REVIEWS YET'); }); }); @@ -3095,3 +3097,30 @@ describe('LEARNINGS_SEARCH resolver: query parameter', () => { } }); }); + +describe('EXIT PLAN MODE GATE placement', () => { + // Fresh skill list — do NOT reuse REVIEW_SKILLS upstream (3 entries, missing plan-devex). + const planSkills = ['plan-eng-review', 'plan-ceo-review', 'plan-design-review', 'plan-devex-review']; + + // Strip fenced code blocks before matching headings — PLAN_FILE_REVIEW_REPORT + // already contains `## GSTACK REVIEW REPORT` inside a markdown example fence, + // and the gate text itself shows `## GSTACK REVIEW REPORT` inside a fence too. + const stripFences = (md: string) => md.replace(/```[\s\S]*?```/g, ''); + + test('gate is the terminal ## heading in every plan-* review SKILL.md', () => { + for (const skill of planSkills) { + const md = fs.readFileSync(path.join(ROOT, skill, 'SKILL.md'), 'utf-8'); + const stripped = stripFences(md); + const headings = [...stripped.matchAll(/^## .+$/gm)].map(m => m[0]); + const lastH2 = headings.at(-1); + expect(lastH2, `${skill}/SKILL.md last ## heading (fences stripped)`).toBe('## EXIT PLAN MODE GATE (BLOCKING)'); + expect(md, `${skill}/SKILL.md gate body`).toContain('Failing this gate and calling ExitPlanMode anyway is a contract violation'); + } + }); + + test('codex/SKILL.md contains gate (mid-file per D5; Step 2B/2C follow)', () => { + const codex = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8'); + expect(codex).toContain('## EXIT PLAN MODE GATE (BLOCKING)'); + expect(codex).toContain('Failing this gate and calling ExitPlanMode anyway is a contract violation'); + }); +}); From 965261a1802c2e80306448bfdbc243ed76f67788 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 14 May 2026 20:50:49 -0700 Subject: [PATCH 2/3] chore: bump version and changelog (v1.39.1.0) Co-Authored-By: Claude Opus 4.7 --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ VERSION | 2 +- package.json | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f27defa4b25..888baa29d68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +## [1.39.1.0] - 2026-05-15 + +## **Plan-mode reviews now enforce a blocking ExitPlanMode gate.** +## **The review report can no longer go missing without breaking the contract.** + +`/plan-eng-review`, `/plan-ceo-review`, `/plan-design-review`, `/plan-devex-review`, and `/codex review` now end with an EXIT PLAN MODE GATE (BLOCKING) section. Before calling ExitPlanMode, the model runs a four-item checklist: read the plan file, confirm the last `## ` heading is `## GSTACK REVIEW REPORT`, verify the report has a Runs/Status/Findings table + VERDICT line, and confirm `gstack-review-log` + `gstack-review-read` ran. Failing the checklist and exiting plan mode anyway is framed as a contract violation, not a soft permission to defer. The structural property ("review report is the file's terminal heading") is what makes the gate immune to "I wrote some review prose into the plan body" self-deception. A regression test in `test/gen-skill-docs.test.ts` strips fenced code blocks and asserts the gate is the terminal `## ` heading in all four plan-* review SKILL.md files. + +### The numbers that matter + +Source: `bun test test/gen-skill-docs.test.ts` — 389 cases, all green in ~1.5s. Manual verification via `awk` confirms the gate is the LAST `## ` heading in the regenerated SKILL.md for each plan-* review skill, and present mid-file in codex's Step 2A (where it's review-mode-scoped per design). + +| Surface | Before | After | +|---|---|---| +| ExitPlanMode discipline in plan-* reviews | Soft `## Plan Status Footer` injected at TOP of skill via preamble: "if the plan file lacks `## GSTACK REVIEW REPORT`, run `gstack-review-read` and append... PLAN MODE EXCEPTION — always allowed." Permission grant, not a precondition. Sat ~3000 lines above ExitPlanMode in the skill prompt. | Terminal `## EXIT PLAN MODE GATE (BLOCKING)` injected at EOF of every plan-* review skill: 4-item self-check with explicit "contract violation" framing for the failure mode. Last thing the model reads before ExitPlanMode. | +| Preamble footer in operational skills (`/ship`, `/qa`, `/review`, `/health`) | Same enforcement text as plan-mode skills — review-report rules bled into skills that have no review report | Neutral forward reference: "Plan-review skills include the EXIT PLAN MODE GATE at the end; this footer is a no-op for operational skills." No imposed rules where they can't apply. | +| Regression protection | None — gate placement could silently regress on any future template edit | `bun test test/gen-skill-docs.test.ts` asserts gate is terminal `## ` heading in 4 plan-* skills (with fenced-code-block stripping) and present in codex via `toContain`. | + +Cross-model review by Codex (`/codex` consult mode) caught six pre-merge factual issues the eng review missed: insertion line numbers were not terminal positions, the test regex would false-match `## ` lines inside fenced code blocks, the existing `REVIEW_SKILLS` constant in the test file was missing `plan-devex-review`, the preamble retoning bled review-report rules into operational skills, gate check 4 conflicted with `PLAN_FILE_REVIEW_REPORT`'s "skip silently if no plan file" escape clause, and the implementation sequence wasn't explicit enough to prevent bisect-broken commits. All six folded in before push. + +### What this means for plan reviews + +When the model finishes a plan-* review and is about to exit plan mode, it reads a blocking checklist that reframes ExitPlanMode as a precondition-bearing call, not a free termination. The plan ships with its review report attached as the file's terminal heading, every time. If the user has been bitten by "approved a plan only to discover the review report was never written" before, that failure mode is gone. + +### Itemized changes + +#### Added + +- `generateExitPlanModeGate` resolver in `scripts/resolvers/review.ts:161` — emits the 4-item blocking checklist with "contract violation" framing. Single source of truth for the gate text. +- `EXIT_PLAN_MODE_GATE` placeholder registered in `scripts/resolvers/index.ts:42`. Appended at EOF of `plan-eng-review/SKILL.md.tmpl`, `plan-ceo-review/SKILL.md.tmpl`, `plan-design-review/SKILL.md.tmpl`, `plan-devex-review/SKILL.md.tmpl`. Inserted into `codex/SKILL.md.tmpl` after `{{PLAN_FILE_REVIEW_REPORT}}` in Step 2A (mid-file by design — Step 2B/2C are not plan-touching modes). +- `test/gen-skill-docs.test.ts:3097` — new `EXIT PLAN MODE GATE placement` describe block. Strips fenced code blocks before matching `## ` headings (a naive regex would false-match the `## GSTACK REVIEW REPORT` example inside `PLAN_FILE_REVIEW_REPORT`'s fenced markdown block). Uses a fresh skill list — not the upstream `REVIEW_SKILLS` constant which only has 3 entries and would silently miss plan-devex-review. + +#### Changed + +- `scripts/resolvers/preamble/generate-completion-status.ts:82` — `## Plan Status Footer` retoned from enforcement language ("if the plan file lacks `## GSTACK REVIEW REPORT`, run `gstack-review-read`... PLAN MODE EXCEPTION — always allowed") to neutral forward reference ("plan-review skills include the EXIT PLAN MODE GATE at the end; this footer is a no-op for operational skills"). Avoids review-report rules bleeding into `/ship`, `/qa`, `/review`, `/health`, etc. +- `test/gen-skill-docs.test.ts:1093` — updated existing "Plan status footer in preamble" assertion to match the new neutral wording. Now also asserts the absence of "NO REVIEWS YET" to lock in the no-bleed property. +- `test/fixtures/golden/{claude,codex,factory}-ship-SKILL.md` — golden baselines updated to capture the new preamble wording. The ship skill's body did not change; only the inherited preamble footer. + +#### For contributors + +- The implementation sequence is load-bearing: resolver → index → templates → preamble → `bun run gen:skill-docs` → tests. Adding the test before regeneration fails on missing gate; regenerating before the resolver edits produces no-op output. Bisectable commits should respect this order. +- The codex gate is intentionally NOT terminal in `codex/SKILL.md`. Codex has three modes (review/challenge/consult) and only review mode writes to plan files. The gate's check-2 ("last heading is GSTACK REVIEW REPORT") short-circuits cleanly when no plan file is in context, so non-plan codex invocations are unaffected. + ## [1.37.0.0] - 2026-05-14 ## **Split-engine gbrain: remote MCP for brain, local PGLite for code.** diff --git a/VERSION b/VERSION index f24ab8298d7..57fdbd724ba 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.37.0.0 +1.39.1.0 diff --git a/package.json b/package.json index 571d1385151..2fd8e593a76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gstack", - "version": "1.37.0.0", + "version": "1.39.1.0", "description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.", "license": "MIT", "type": "module", From cf9627fdec96a05ff5c1e17900cc6690ad7132a5 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 14 May 2026 21:57:06 -0700 Subject: [PATCH 3/3] fix: package.json build script uses subshells, not brace groups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The three `{ git rev-parse HEAD 2>/dev/null || true; } > path/.version` brace groups in the build script regressed when v1.38.0.0 merged into this branch (resolved with --ours during conflict). Bun on Windows can't parse brace groups in this position; the v1.38.0.0 invariant requires `(...)` subshells. Windows CI test `package.json build scripts — POSIX shell compat` caught it. Co-Authored-By: Claude Opus 4.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2fd8e593a76..601eb963c91 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "make-pdf": "./make-pdf/dist/pdf" }, "scripts": { - "build": "bun run vendor:xterm && bun run gen:skill-docs --host all; bun build --compile browse/src/cli.ts --outfile browse/dist/browse && bun build --compile browse/src/find-browse.ts --outfile browse/dist/find-browse && bun build --compile design/src/cli.ts --outfile design/dist/design && bun build --compile make-pdf/src/cli.ts --outfile make-pdf/dist/pdf && bun build --compile bin/gstack-global-discover.ts --outfile bin/gstack-global-discover && bash browse/scripts/build-node-server.sh && { git rev-parse HEAD 2>/dev/null || true; } > browse/dist/.version && { git rev-parse HEAD 2>/dev/null || true; } > design/dist/.version && { git rev-parse HEAD 2>/dev/null || true; } > make-pdf/dist/.version && chmod +x browse/dist/browse browse/dist/find-browse design/dist/design make-pdf/dist/pdf bin/gstack-global-discover && (rm -f .*.bun-build || true)", + "build": "bun run vendor:xterm && bun run gen:skill-docs --host all; bun build --compile browse/src/cli.ts --outfile browse/dist/browse && bun build --compile browse/src/find-browse.ts --outfile browse/dist/find-browse && bun build --compile design/src/cli.ts --outfile design/dist/design && bun build --compile make-pdf/src/cli.ts --outfile make-pdf/dist/pdf && bun build --compile bin/gstack-global-discover.ts --outfile bin/gstack-global-discover && bash browse/scripts/build-node-server.sh && ( git rev-parse HEAD 2>/dev/null || true ) > browse/dist/.version && ( git rev-parse HEAD 2>/dev/null || true ) > design/dist/.version && ( git rev-parse HEAD 2>/dev/null || true ) > make-pdf/dist/.version && chmod +x browse/dist/browse browse/dist/find-browse design/dist/design make-pdf/dist/pdf bin/gstack-global-discover && (rm -f .*.bun-build || true)", "vendor:xterm": "mkdir -p extension/lib && cp node_modules/xterm/lib/xterm.js extension/lib/xterm.js && cp node_modules/xterm/css/xterm.css extension/lib/xterm.css && cp node_modules/xterm-addon-fit/lib/xterm-addon-fit.js extension/lib/xterm-addon-fit.js", "dev:make-pdf": "bun run make-pdf/src/cli.ts", "dev:design": "bun run design/src/cli.ts",