mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-21 12:18:24 +08:00
feat: plan-mode handshake for interactive review skills
Add a preamble-level STOP-Ask handshake that fires when the user invokes any of the 4 interactive review skills (plan-ceo-review, plan-eng-review, plan-design-review, plan-devex-review) while their Claude Code session is in plan mode. Without this gate, plan mode's "this supercedes any other instructions" system-reminder outranked the skills' interactive STOP gates and the skills silently wrote plan files without any per-finding AskUserQuestion. The handshake offers 2 options (exit-and-rerun, cancel) — the original third "stay and batch" option was dropped after two independent reviewers flagged it as a silent bypass of the skills' anti-skip rule. Architecture decisions (CEO+Eng review): - Preamble-level resolver, not per-template injection (Codex finding #2) - Position 1 in preamble composition: after bash block (_SESSION_ID live), before onboarding AskUserQuestion gates (so fresh-install users see the handshake first, not drowned in telemetry/proactive/routing prompts) - Generator-only `interactive: true` frontmatter flag, following the `preamble-tier` precedent (no host-config frontmatter allowlist edits) - Host-scoped to Claude via `ctx.host === 'claude'` check inside the resolver (simpler than `suppressedResolvers` which only gates `{{}}` placeholders) - One-way-door classification in scripts/question-registry.ts for all 4 skills so question-tuning `never-ask` preferences can't suppress the gate - Synchronous telemetry write to ~/.gstack/analytics/skill-usage.jsonl on handshake fire (captures A-exit and C-cancel outcomes that terminate the skill before end-of-run telemetry runs) Also adds an explicit STOP block to plan-ceo-review Step 0C-bis so the approach-selection question can't silently skip to mode selection. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import { generateQuestionTuning } from './question-tuning';
|
||||
|
||||
// Core bootstrap
|
||||
import { generatePreambleBash } from './preamble/generate-preamble-bash';
|
||||
import { generatePlanModeHandshake } from './preamble/generate-plan-mode-handshake';
|
||||
import { generateUpgradeCheck } from './preamble/generate-upgrade-check';
|
||||
import { generateCompletionStatus } from './preamble/generate-completion-status';
|
||||
|
||||
@@ -78,6 +79,13 @@ export function generatePreamble(ctx: TemplateContext): string {
|
||||
}
|
||||
const sections = [
|
||||
generatePreambleBash(ctx),
|
||||
// Plan-mode handshake at position 1: after bash (so _SESSION_ID / _BRANCH /
|
||||
// _TEL env vars are live for the synchronous telemetry write) and before
|
||||
// all onboarding AskUserQuestion gates (so fresh-install users in plan mode
|
||||
// see the handshake first, not drowned in telemetry / proactive / routing
|
||||
// prompts). Host-scoped to Claude + interactive-frontmatter-scoped inside
|
||||
// the resolver — no-op for every other skill/host combination.
|
||||
generatePlanModeHandshake(ctx),
|
||||
generateUpgradeCheck(ctx),
|
||||
generateWritingStyleMigration(ctx),
|
||||
generateLakeIntro(),
|
||||
|
||||
Reference in New Issue
Block a user