Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA
TypeScript
v1.57.2.0 feat: AskUserQuestion prose fallback when the tool fails at runtime (#1908)
Garry Tan4dfdb7cdc262
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bdf89641a..86954ca4f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,73 @@# Changelog+## [1.57.2.0] - 2026-06-08++## **When the question picker breaks mid-skill, gstack asks in plain text instead of stalling.**+## **Every skill detects a dead AskUserQuestion and falls back to a full decision brief you answer by typing a letter.**++AskUserQuestion is how every gstack skill asks you to decide. When the host's question+tool fails at runtime, which Conductor's MCP integration currently does intermittently,+skills used to stall or hard-block. Now each skill detects the failure, works out+whether a human is actually present, and if so re-renders the exact same decision as a+text message: a plain-English explanation of the issue, a completeness score on each+choice, and a recommendation with its reason, one paragraph per choice. You answer by+typing a single letter. Headless eval runs still block cleanly (no human to answer);+orchestrator sessions keep auto-choosing. This whole release was built and reviewed+through that fallback, because the Conductor tool was down the entire session.++### The numbers that matter++No production benchmark for a reliability path like this. These are the behavior and+coverage facts, verifiable with `bun test test/gstack-session-kind.test.ts+test/resolver-ask-user-format.test.ts test/auq-error-fallback-hook.test.ts`.++| When AskUserQuestion fails | Before | After |+|---|---|---|+| Interactive session (human present) | stall / hard BLOCK | full prose decision brief, answer by letter |+| Headless eval / CI | BLOCK | BLOCK (unchanged, correct) |+| Orchestrator (OpenClaw) session | undefined | auto-choose recommended (contract kept) |+| Session kinds detected | 0 | 3 (interactive / headless / spawned) |+| New tests guarding the path | 0 | 34 |++The text brief is not a degraded stub. It carries the same three things the picker+shows: a clear explanation of what is being decided, a `Completeness: X/10` on every+choice, and a recommendation with the reason it wins.++### What this means for you++If your host's question tool flakes out, a skill no longer dies on you. You get the+same decision to make, in text, and you reply with a letter. Nothing changes when the+tool works normally. If you run gstack headless, those sessions still block on a needed+question exactly as before, so eval determinism is intact.++### Itemized changes++#### Added+- `gstack-session-kind` classifies each session as interactive, headless, or spawned,+ echoed as `SESSION_KIND` at skill start so any skill can branch on it.+- Plain-text fallback for AskUserQuestion: on a tool failure in an interactive session,+ the skill renders the full decision brief (issue ELI10 + per-choice completeness ++ recommendation) as markdown you answer by typing a letter, then stops and waits.+- A defensive hook that, when an AskUserQuestion call errors, reminds the agent to run+ the fallback for the current session kind.++#### Changed+- AskUserQuestion is still sent as a normal tool call; the prose path applies only when+ the tool is unavailable or erroring, and never on a `[plan-tune auto-decide]` result.++#### Fixed+- Section-loading tests use the canonical kebab test names, so the test-coverage gate+ matches them.+- External-host doc-freshness checks are deterministic, no longer dependent on a prior+ full regeneration.++#### For contributors+- The eval/E2E runners set `GSTACK_HEADLESS=1` so headless runs classify correctly;+ interactive-path suites opt out per-run.+- Per-skill `maxSizeRatio` override in the carve-guards registry; `document-release`+ gets 1.08 headroom for the cross-cutting preamble addition while every other skill+ keeps the 1.05 ceiling.+## [1.57.0.0] - 2026-06-07## **Three more heavyweight skills load lighter, and every carved skill finally has a test that proves it loads.**diff --git a/SKILL.md b/SKILL.mdindex 60405f27d..24c498292 100644--- a/SKILL.md+++ b/SKILL.md@@ -45,6 +45,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -124,7 +127,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"diff --git a/VERSION b/VERSIONindex a17d4bbc0..b2235f08b 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-1.57.0.0+1.57.2.0diff --git a/autoplan/SKILL.md b/autoplan/SKILL.mdindex 5d5f6334c..fd6bb8a21 100644--- a/autoplan/SKILL.md+++ b/autoplan/SKILL.md@@ -54,6 +54,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -133,7 +136,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -305,11 +308,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -389,7 +412,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/benchmark-models/SKILL.md b/benchmark-models/SKILL.mdindex c7b011d02..44b2adcb0 100644--- a/benchmark-models/SKILL.md+++ b/benchmark-models/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"diff --git a/benchmark/SKILL.md b/benchmark/SKILL.mdindex 099b3bc61..8846142d6 100644--- a/benchmark/SKILL.md+++ b/benchmark/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"diff --git a/bin/gstack-session-kind b/bin/gstack-session-kindnew file mode 100755index 000000000..8e9bc4e41--- /dev/null+++ b/bin/gstack-session-kind@@ -0,0 +1,53 @@+#!/usr/bin/env bash+# gstack-session-kind — classify the current agent session so skills know whether+# a human can answer an interactive prompt (AskUserQuestion).+#+# Usage: gstack-session-kind → prints one of: spawned | headless | interactive+#+# Used by the preamble (generate-preamble-bash.ts) which echoes+# SESSION_KIND: <value>+# so the AskUserQuestion-failure fallback rule can branch without a shell-out at+# failure time:+# spawned → orchestrator session (OpenClaw). Auto-choose recommended option+# per the skill's SPAWNED_SESSION block. Never prose, never BLOCKED.+# headless → no human present (claude -p evals / CI). BLOCK on AUQ failure.+# interactive → a human is present. Prose-fallback on AUQ failure.+#+# Detection is best-effort. On ANY ambiguity it prints `interactive` — BLOCK only on+# a positive headless signal, since a stray prose message in an unmarked one-shot+# `-p` run just ends the turn (harmless), whereas wrongly BLOCKING a real human is not.+#+# Why env vars and not TTY/entrypoint: an interactive Conductor session reports+# CLAUDE_CODE_ENTRYPOINT=sdk-ts with no TTY — identical to a headless SDK eval. The+# signals that actually discriminate are the host/orchestrator/CI env markers below.+set -euo pipefail++# 1. Orchestrator-spawned session (OpenClaw). Authoritative block lives in the skill;+# we only surface the classification.+if [ -n "${OPENCLAW_SESSION:-}" ]; then+ echo "spawned"+ exit 0+fi++# 2. Explicit headless override (set by the eval/E2E harness for determinism).+if [ -n "${GSTACK_HEADLESS:-}" ]; then+ echo "headless"+ exit 0+fi++# 3. Positive interactive-host signals: a human-driven host is present.+# - Conductor app sets CONDUCTOR_* workspace vars.+# - Plain interactive `claude` CLI sets CLAUDE_CODE_ENTRYPOINT=cli.+if [ -n "${CONDUCTOR_WORKSPACE_PATH:-}" ] || [ -n "${CONDUCTOR_PORT:-}" ] || [ "${CLAUDE_CODE_ENTRYPOINT:-}" = "cli" ]; then+ echo "interactive"+ exit 0+fi++# 4. CI / automation markers with no interactive host → headless.+if [ -n "${CI:-}" ] || [ -n "${GITHUB_ACTIONS:-}" ]; then+ echo "headless"+ exit 0+fi++# 5. No positive headless signal → assume a human is present (degrade-safe default).+echo "interactive"diff --git a/browse/SKILL.md b/browse/SKILL.mdindex ef562d6c1..a94e1b9a4 100644--- a/browse/SKILL.md+++ b/browse/SKILL.md@@ -46,6 +46,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -125,7 +128,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"diff --git a/canary/SKILL.md b/canary/SKILL.mdindex 1a47571a1..60261c3d7 100644--- a/canary/SKILL.md+++ b/canary/SKILL.md@@ -46,6 +46,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -125,7 +128,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -297,11 +300,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -381,7 +404,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/codex/SKILL.md b/codex/SKILL.mdindex 7f602147d..39a14cb66 100644--- a/codex/SKILL.md+++ b/codex/SKILL.md@@ -49,6 +49,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -128,7 +131,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -300,11 +303,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -384,7 +407,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/context-restore/SKILL.md b/context-restore/SKILL.mdindex d9bf73a72..3a0a80e26 100644--- a/context-restore/SKILL.md+++ b/context-restore/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/context-save/SKILL.md b/context-save/SKILL.mdindex 05f06724e..7138a7fd7 100644--- a/context-save/SKILL.md+++ b/context-save/SKILL.md@@ -49,6 +49,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -128,7 +131,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -300,11 +303,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -384,7 +407,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/cso/SKILL.md b/cso/SKILL.mdindex 63ced7aaf..abe189b53 100644--- a/cso/SKILL.md+++ b/cso/SKILL.md@@ -52,6 +52,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -131,7 +134,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -303,11 +306,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -387,7 +410,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/design-consultation/SKILL.md b/design-consultation/SKILL.mdindex fbbd2cef4..c6ea2eff2 100644--- a/design-consultation/SKILL.md+++ b/design-consultation/SKILL.md@@ -72,6 +72,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -151,7 +154,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -323,11 +326,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -407,7 +430,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/design-html/SKILL.md b/design-html/SKILL.mdindex 95c9703b0..f06aafcd6 100644--- a/design-html/SKILL.md+++ b/design-html/SKILL.md@@ -53,6 +53,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -132,7 +135,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -304,11 +307,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -388,7 +411,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/design-review/SKILL.md b/design-review/SKILL.mdindex ff95aeef3..0eb63d823 100644--- a/design-review/SKILL.md+++ b/design-review/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/design-shotgun/SKILL.md b/design-shotgun/SKILL.mdindex 65997dd44..c5b6246b4 100644--- a/design-shotgun/SKILL.md+++ b/design-shotgun/SKILL.md@@ -67,6 +67,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -146,7 +149,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -318,11 +321,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -402,7 +425,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/devex-review/SKILL.md b/devex-review/SKILL.mdindex 00ad9eba9..3020267b1 100644--- a/devex-review/SKILL.md+++ b/devex-review/SKILL.md@@ -52,6 +52,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -131,7 +134,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -303,11 +306,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -387,7 +410,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/docs/spikes/claude-code-hook-mutation.md b/docs/spikes/claude-code-hook-mutation.mdindex 70a4ae18a..9d91e16cd 100644--- a/docs/spikes/claude-code-hook-mutation.md+++ b/docs/spikes/claude-code-hook-mutation.md@@ -127,6 +127,38 @@ required for our hook to fire there.(PostToolUse hooks can also set `additionalContext` to append to the toolresult; we don't need this for v1 capture.)+## PostToolUse on tool error (AUQ-failure fallback, OV3:B) — UNVERIFIED++The AUQ-failure prose fallback adds a defensive PostToolUse hook+(`hosts/claude/hooks/auq-error-fallback-hook.ts`) that, when an AskUserQuestion+call returns an error / missing result, injects `additionalContext` reminding the+model to run the prose fallback per `SESSION_KIND`. It uses the same+`additionalContext` mechanism documented above.++**Open question we could NOT settle in a harness:** does Claude Code invoke+PostToolUse hooks when an MCP tool call returns a transport/missing-result error+(the Conductor bug surfaces `[Tool result missing due to internal error]`)? The+docs above cover PostToolUse on *success*. We could not force the Conductor+internal MCP failure on demand to observe it.++**Decision (OV3:B = A):** build the hook defensively anyway.+- It is **inert on success** (only fires when `isErrorResponse(tool_response)` is+ true) and **inert if the platform never invokes it** on the error path.+- The prompt-level fallback in `generate-ask-user-format.ts` covers the case+ regardless — the hook is a reliability *layer*, not the mechanism.+- Its decision logic is unit-tested deterministically+ (`test/auq-error-fallback-hook.test.ts`): given a synthetic error `tool_response`+ + each `SESSION_KIND`, it emits the correct directive; given a real answer it+ defers.++**Recommended manual / partial spike (to close the gap later):** register a+throwaway PostToolUse hook that logs on fire, then (a) trigger a normal tool+error (e.g. a failing `Bash` call) to confirm PostToolUse fires on tool errors at+all, and (b) reproduce the Conductor MCP AUQ failure and check the log. If (b)+confirms a fire, promote the hook from "defensive/inert" to "verified". Until+then, treat the runtime layer as best-effort and the prompt-level fallback as the+guaranteed path.+## Settings.json snippet for T8 hook installer```jsondiff --git a/document-generate/SKILL.md b/document-generate/SKILL.mdindex 2d6c97a35..22c8053dc 100644--- a/document-generate/SKILL.md+++ b/document-generate/SKILL.md@@ -52,6 +52,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -131,7 +134,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -303,11 +306,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -387,7 +410,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/document-release/SKILL.md b/document-release/SKILL.mdindex 6a25bbe82..f878b53da 100644--- a/document-release/SKILL.md+++ b/document-release/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/health/SKILL.md b/health/SKILL.mdindex 02696dafb..815ff5227 100644--- a/health/SKILL.md+++ b/health/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -299,11 +302,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -383,7 +406,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/hosts/claude/hooks/auq-error-fallback-hook b/hosts/claude/hooks/auq-error-fallback-hooknew file mode 100755index 000000000..063d7fce9--- /dev/null+++ b/hosts/claude/hooks/auq-error-fallback-hook@@ -0,0 +1,7 @@+#!/usr/bin/env bash+# Bash shim — Claude Code hooks run `command` strings via /bin/sh, so this+# wrapper makes the TypeScript hook executable via bun. Settings.json+# references this file directly.+set -e+HERE="$(cd "$(dirname "$0")" && pwd)"+exec bun "$HERE/auq-error-fallback-hook.ts"diff --git a/hosts/claude/hooks/auq-error-fallback-hook.ts b/hosts/claude/hooks/auq-error-fallback-hook.tsnew file mode 100755index 000000000..502c9d486--- /dev/null+++ b/hosts/claude/hooks/auq-error-fallback-hook.ts@@ -0,0 +1,202 @@+#!/usr/bin/env bun+/**+ * PostToolUse hook for AskUserQuestion — runtime reliability layer for the+ * AUQ-failure prose fallback (OV3:B).+ *+ * When an AskUserQuestion call comes back as an ERROR / missing result (the+ * Conductor MCP bug returns `[Tool result missing due to internal error]`), this+ * hook injects `additionalContext` reminding the model of the failure-fallback+ * rule, tailored to the session kind. It does NOT render the prose itself — the+ * model still emits it. The hook only guarantees the reminder fires at the moment+ * of failure, instead of relying on the model noticing the error result and+ * recalling the echoed SESSION_KIND.+ *+ * DEFENSIVE / INERT-IF-UNSUPPORTED: it is unverified whether Claude Code invokes+ * PostToolUse hooks when an MCP tool returns a transport/missing-result error (we+ * could not force that Conductor-internal failure in a harness — see+ * docs/spikes/claude-code-hook-mutation.md §"PostToolUse on tool error"). If the+ * platform does NOT fire the hook on that path, this is simply never invoked — no+ * harm; the prompt-level fallback in generate-ask-user-format.ts still covers it.+ * On a SUCCESSFUL AskUserQuestion (a real answer), the hook defers (no output).+ *+ * Triggered by ~/.claude/settings.json (registered by `setup` next to+ * question-log-hook):+ * PostToolUse matcher "(AskUserQuestion|mcp__.*__AskUserQuestion)"+ *+ * Invariants:+ * - Always exits 0. A failing hook MUST NOT block the user's session.+ * - Never triggers on a successful answer (would corrupt a normal AUQ).+ * - Errors land in ~/.gstack/hook-errors.log.+ */+import * as fs from 'fs';+import * as path from 'path';+import * as os from 'os';+import { spawnSync } from 'child_process';++interface HookStdin {+ tool_name?: string;+ tool_response?: unknown;+ cwd?: string;+}++function stateRoot(): string {+ return (+ process.env.GSTACK_STATE_ROOT ||+ process.env.GSTACK_HOME ||+ path.join(os.homedir(), '.gstack')+ );+}++function logHookError(msg: string): void {+ try {+ const sr = stateRoot();+ fs.mkdirSync(sr, { recursive: true });+ fs.appendFileSync(+ path.join(sr, 'hook-errors.log'),+ `${new Date().toISOString()} auq-error-fallback-hook: ${msg}\n`,+ );+ } catch {+ // last-resort swallow+ }+}++function readStdin(): Promise<string> {+ return new Promise((resolve) => {+ let buf = '';+ process.stdin.setEncoding('utf-8');+ process.stdin.on('data', (chunk) => (buf += chunk));+ process.stdin.on('end', () => resolve(buf));+ process.stdin.on('error', () => resolve(buf));+ setTimeout(() => resolve(buf), 2000);+ });+}++/** No-op output — let the tool result stand untouched. */+function defer(): void {+ process.stdout.write(+ JSON.stringify({ hookSpecificOutput: { hookEventName: 'PostToolUse' } }),+ );+ process.exit(0);+}++function inject(additionalContext: string): void {+ process.stdout.write(+ JSON.stringify({+ hookSpecificOutput: { hookEventName: 'PostToolUse', additionalContext },+ }),+ );+ process.exit(0);+}++/**+ * Decide whether the tool_response is an ERROR / missing result rather than a+ * real answer. Conservative: only flag clear failure shapes, so a successful+ * AskUserQuestion (which carries the user's choice) is never misread as failure.+ */+export function isErrorResponse(response: unknown): boolean {+ if (response === null || response === undefined) return true;+ if (typeof response === 'string') {+ const s = response.trim();+ if (s === '') return true;+ // Match ONLY the specific missing-result sentinel phrase, not any string that+ // merely contains "error" — a real answer like "Investigate the internal error"+ // must NOT trigger the fallback. (Codex review finding.)+ return /tool result missing/i.test(s);+ }+ if (typeof response === 'object') {+ const rec = response as Record<string, unknown>;+ // Structured flag must be the boolean true — not the substring "is_error" inside+ // a serialized success payload like '{"is_error": false}'.+ if (rec.is_error === true || rec.isError === true) return true;+ if (typeof rec.error === 'string' && rec.error.trim() !== '') return true;+ // Some hosts wrap the payload as { content: "..." } or { content: [{text}] }.+ const content = rec.content;+ if (typeof content === 'string') return /tool result missing/i.test(content);+ if (Array.isArray(content)) {+ const text = content+ .map((c) => (typeof c === 'string' ? c : (c as Record<string, unknown>)?.text ?? ''))+ .join(' ');+ return /tool result missing/i.test(text);+ }+ }+ return false;+}++/** Resolve SESSION_KIND via the shared helper (same classification the preamble+ * echoes). Falls back to 'interactive' (degrade-safe) on any failure. */+export function sessionKind(cwd?: string): 'spawned' | 'headless' | 'interactive' {+ try {+ const here = path.dirname(new URL(import.meta.url).pathname);+ const bin = path.resolve(here, '..', '..', '..', 'bin', 'gstack-session-kind');+ const res = spawnSync(bin, [], {+ encoding: 'utf-8',+ timeout: 3000,+ cwd: cwd && fs.existsSync(cwd) ? cwd : undefined,+ });+ const out = (res.stdout || '').trim();+ if (out === 'spawned' || out === 'headless' || out === 'interactive') return out;+ } catch (e) {+ logHookError(`sessionKind failed: ${(e as Error).message}`);+ }+ return 'interactive';+}++/** The directive injected per session kind. Exported for unit testing. */+export function directiveFor(kind: 'spawned' | 'headless' | 'interactive'): string {+ const lead =+ 'The AskUserQuestion call did not return a usable answer (error / missing result). ' ++ 'Per the AskUserQuestion failure-fallback rule: ';+ switch (kind) {+ case 'spawned':+ return (+ lead ++ 'SESSION_KIND=spawned — auto-choose the recommended option per the Spawned session block. ' ++ 'Do not emit prose, do not BLOCK.'+ );+ case 'headless':+ return (+ lead ++ 'SESSION_KIND=headless — report `BLOCKED — AskUserQuestion unavailable` and stop; no human can answer.'+ );+ case 'interactive':+ default:+ return (+ lead ++ 'SESSION_KIND=interactive — render the decision as a PROSE message now: a clear ELI10 of the issue, ' ++ 'then a Recommendation line, then ONE paragraph per choice carrying its `(recommended)` marker, its ' ++ '`Completeness: X/10`, and 2-4 sentences of reasoning. Tell the user to reply with a letter, then STOP. ' ++ '(Retry the call once first only if no answer could have surfaced.)'+ );+ }+}++async function main(): Promise<void> {+ const raw = await readStdin();+ if (!raw.trim()) return defer();++ let stdin: HookStdin;+ try {+ stdin = JSON.parse(raw);+ } catch (e) {+ logHookError(`stdin parse failed: ${(e as Error).message}`);+ return defer();+ }++ const toolName = stdin.tool_name || '';+ if (toolName !== 'AskUserQuestion' && !/^mcp__.+__AskUserQuestion$/.test(toolName)) {+ return defer();+ }++ if (!isErrorResponse(stdin.tool_response)) return defer();++ inject(directiveFor(sessionKind(stdin.cwd)));+}++// Only run the stdin→stdout pipeline when executed as a hook, not when imported+// by the unit test (which exercises the exported pure functions).+if (import.meta.main) {+ main().catch((e) => {+ logHookError(`main crash: ${(e as Error).message}`);+ defer();+ });+}diff --git a/investigate/SKILL.md b/investigate/SKILL.mdindex 9431b58f6..098c356c0 100644--- a/investigate/SKILL.md+++ b/investigate/SKILL.md@@ -87,6 +87,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -166,7 +169,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -338,11 +341,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -422,7 +445,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/ios-clean/SKILL.md b/ios-clean/SKILL.mdindex 68edf2242..7ec9829b8 100644--- a/ios-clean/SKILL.md+++ b/ios-clean/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/ios-design-review/SKILL.md b/ios-design-review/SKILL.mdindex e542306e4..ff5303e8a 100644--- a/ios-design-review/SKILL.md+++ b/ios-design-review/SKILL.md@@ -52,6 +52,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -131,7 +134,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -303,11 +306,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -387,7 +410,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/ios-fix/SKILL.md b/ios-fix/SKILL.mdindex 57f36de3b..63378e2e2 100644--- a/ios-fix/SKILL.md+++ b/ios-fix/SKILL.md@@ -53,6 +53,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -132,7 +135,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -304,11 +307,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -388,7 +411,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/ios-qa/SKILL.md b/ios-qa/SKILL.mdindex 8bd7d1c84..dd221c92c 100644--- a/ios-qa/SKILL.md+++ b/ios-qa/SKILL.md@@ -56,6 +56,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -135,7 +138,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -307,11 +310,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -391,7 +414,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/ios-sync/SKILL.md b/ios-sync/SKILL.mdindex 2a07dc080..a2f2ea794 100644--- a/ios-sync/SKILL.md+++ b/ios-sync/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/land-and-deploy/SKILL.md b/land-and-deploy/SKILL.mdindex e576fdf7a..159673b2f 100644--- a/land-and-deploy/SKILL.md+++ b/land-and-deploy/SKILL.md@@ -45,6 +45,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -124,7 +127,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -296,11 +299,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -380,7 +403,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/landing-report/SKILL.md b/landing-report/SKILL.mdindex e9c1c23e2..c270ecc07 100644--- a/landing-report/SKILL.md+++ b/landing-report/SKILL.md@@ -46,6 +46,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -125,7 +128,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -297,11 +300,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -381,7 +404,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/learn/SKILL.md b/learn/SKILL.mdindex 6b336b470..29541f543 100644--- a/learn/SKILL.md+++ b/learn/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -299,11 +302,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -383,7 +406,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/make-pdf/SKILL.md b/make-pdf/SKILL.mdindex d231010b3..d5cdc43e5 100644--- a/make-pdf/SKILL.md+++ b/make-pdf/SKILL.md@@ -47,6 +47,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -162,7 +165,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"diff --git a/office-hours/SKILL.md b/office-hours/SKILL.mdindex cbf335326..71dfc250e 100644--- a/office-hours/SKILL.md+++ b/office-hours/SKILL.md@@ -83,6 +83,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -162,7 +165,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -334,11 +337,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -418,7 +441,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/open-gstack-browser/SKILL.md b/open-gstack-browser/SKILL.mdindex 5845c425a..3570838b1 100644--- a/open-gstack-browser/SKILL.md+++ b/open-gstack-browser/SKILL.md@@ -45,6 +45,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -124,7 +127,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -296,11 +299,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -380,7 +403,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/package.json b/package.jsonindex a9440ba15..e1fb1cf70 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "gstack",- "version": "1.57.0.0",+ "version": "1.57.2.0","description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.","license": "MIT","type": "module",@@ -20,16 +20,16 @@"test": "bun test browse/test/ test/ make-pdf/test/ --ignore 'test/skill-e2e-*.test.ts' --ignore test/skill-llm-eval.test.ts --ignore test/skill-routing-e2e.test.ts --ignore test/codex-e2e.test.ts --ignore test/gemini-e2e.test.ts && (bun run slop:diff 2>/dev/null || true)","test:free": "bun run scripts/test-free-shards.ts","test:windows": "bun run scripts/test-free-shards.ts --windows-only",- "test:evals": "EVALS=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",- "test:evals:all": "EVALS=1 EVALS_ALL=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",- "test:e2e": "EVALS=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",- "test:e2e:all": "EVALS=1 EVALS_ALL=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",- "test:gate": "EVALS=1 EVALS_TIER=gate bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",- "test:periodic": "EVALS=1 EVALS_TIER=periodic EVALS_ALL=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",- "test:codex": "EVALS=1 bun test test/codex-e2e.test.ts",- "test:codex:all": "EVALS=1 EVALS_ALL=1 bun test test/codex-e2e.test.ts",- "test:gemini": "EVALS=1 bun test test/gemini-e2e.test.ts",- "test:gemini:all": "EVALS=1 EVALS_ALL=1 bun test test/gemini-e2e.test.ts",+ "test:evals": "EVALS=1 GSTACK_HEADLESS=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",+ "test:evals:all": "EVALS=1 GSTACK_HEADLESS=1 EVALS_ALL=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",+ "test:e2e": "EVALS=1 GSTACK_HEADLESS=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",+ "test:e2e:all": "EVALS=1 GSTACK_HEADLESS=1 EVALS_ALL=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",+ "test:gate": "EVALS=1 GSTACK_HEADLESS=1 EVALS_TIER=gate bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-llm-eval.test.ts test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",+ "test:periodic": "EVALS=1 GSTACK_HEADLESS=1 EVALS_TIER=periodic EVALS_ALL=1 bun test --retry 2 --concurrent --max-concurrency ${EVALS_CONCURRENCY:-15} test/skill-e2e-*.test.ts test/skill-routing-e2e.test.ts test/codex-e2e.test.ts test/gemini-e2e.test.ts",+ "test:codex": "EVALS=1 GSTACK_HEADLESS=1 bun test test/codex-e2e.test.ts",+ "test:codex:all": "EVALS=1 GSTACK_HEADLESS=1 EVALS_ALL=1 bun test test/codex-e2e.test.ts",+ "test:gemini": "EVALS=1 GSTACK_HEADLESS=1 bun test test/gemini-e2e.test.ts",+ "test:gemini:all": "EVALS=1 GSTACK_HEADLESS=1 EVALS_ALL=1 bun test test/gemini-e2e.test.ts","skill:check": "bun run scripts/skill-check.ts","dev:skill": "bun run scripts/dev-skill.ts","start": "bun run browse/src/server.ts",diff --git a/pair-agent/SKILL.md b/pair-agent/SKILL.mdindex 475c814d3..89c9d895e 100644--- a/pair-agent/SKILL.md+++ b/pair-agent/SKILL.md@@ -47,6 +47,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -126,7 +129,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -298,11 +301,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -382,7 +405,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/plan-ceo-review/SKILL.md b/plan-ceo-review/SKILL.mdindex e7d4bf68d..95034f66a 100644--- a/plan-ceo-review/SKILL.md+++ b/plan-ceo-review/SKILL.md@@ -77,6 +77,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -156,7 +159,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -328,11 +331,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -412,7 +435,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/plan-design-review/SKILL.md b/plan-design-review/SKILL.mdindex 502b13ae9..e395819db 100644--- a/plan-design-review/SKILL.md+++ b/plan-design-review/SKILL.md@@ -49,6 +49,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -128,7 +131,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -300,11 +303,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -384,7 +407,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/plan-devex-review/SKILL.md b/plan-devex-review/SKILL.mdindex af3a3eeec..436082af2 100644--- a/plan-devex-review/SKILL.md+++ b/plan-devex-review/SKILL.md@@ -55,6 +55,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -134,7 +137,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -306,11 +309,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -390,7 +413,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/plan-eng-review/SKILL.md b/plan-eng-review/SKILL.mdindex 1b5b3d90d..ae89c95ff 100644--- a/plan-eng-review/SKILL.md+++ b/plan-eng-review/SKILL.md@@ -53,6 +53,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -132,7 +135,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -304,11 +307,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -388,7 +411,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/plan-tune/SKILL.md b/plan-tune/SKILL.mdindex 41fecf447..1d9a1e1fd 100644--- a/plan-tune/SKILL.md+++ b/plan-tune/SKILL.md@@ -58,6 +58,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -137,7 +140,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -309,11 +312,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -393,7 +416,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/qa-only/SKILL.md b/qa-only/SKILL.mdindex 74a1fed92..0ded985d0 100644--- a/qa-only/SKILL.md+++ b/qa-only/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -299,11 +302,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -383,7 +406,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/qa/SKILL.md b/qa/SKILL.mdindex 053b707a5..8ba0b9334 100644--- a/qa/SKILL.md+++ b/qa/SKILL.md@@ -54,6 +54,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -133,7 +136,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -305,11 +308,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -389,7 +412,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/retro/SKILL.md b/retro/SKILL.mdindex 50967af3e..c94005978 100644--- a/retro/SKILL.md+++ b/retro/SKILL.md@@ -65,6 +65,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -144,7 +147,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -316,11 +319,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -400,7 +423,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/review/SKILL.md b/review/SKILL.mdindex 6e92b22d8..f96ab183d 100644--- a/review/SKILL.md+++ b/review/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/scrape/SKILL.md b/scrape/SKILL.mdindex 91a93f9c1..418ce2f1f 100644--- a/scrape/SKILL.md+++ b/scrape/SKILL.md@@ -46,6 +46,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -125,7 +128,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -297,11 +300,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -381,7 +404,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/scripts/resolvers/preamble/generate-ask-user-format.ts b/scripts/resolvers/preamble/generate-ask-user-format.tsindex ab24eb507..12090dc2c 100644--- a/scripts/resolvers/preamble/generate-ask-user-format.ts+++ b/scripts/resolvers/preamble/generate-ask-user-format.ts@@ -9,11 +9,31 @@ export function generateAskUserFormat(_ctx: TemplateContext): string {**Rule:** if any \`mcp__*__AskUserQuestion\` variant is in your tool list, prefer it. Hosts may disable native AUQ via \`--disallowedTools AskUserQuestion\` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report \`BLOCKED — AskUserQuestion unavailable\`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only \`/plan-tune\` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains \`[plan-tune auto-decide] <id> → <option>\` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns \`[Tool result missing due to internal error]\`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on \`SESSION_KIND\` (echoed by the preamble; empty/absent ⇒ \`interactive\`):+ - \`spawned\` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - \`headless\` → \`BLOCKED — AskUserQuestion unavailable\`; stop and wait (no human can answer).+ - \`interactive\` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit \`Completeness: X/10\` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a \`Recommendation: <choice> because <reason>\` line plus the \`(recommended)\` marker on that choice.++Layout: a \`D<N>\` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its \`(recommended)\` marker, its \`Completeness: X/10\`, and 2-4 sentences of reasoning — never a bare bullet list; a closing \`Net:\` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.\`\`\`D<N> — <one-line question title>@@ -93,7 +113,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + \`(recommended)\` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \\u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/scripts/resolvers/preamble/generate-completion-status.ts b/scripts/resolvers/preamble/generate-completion-status.tsindex 0c50da1c7..dc72a42ec 100644--- a/scripts/resolvers/preamble/generate-completion-status.ts+++ b/scripts/resolvers/preamble/generate-completion-status.ts@@ -26,7 +26,7 @@ In plan mode, allowed because they inform the plan: \`$B\`, \`$D\`, \`codex exec## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — \`mcp__*__AskUserQuestion\` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report \`BLOCKED — AskUserQuestion unavailable\` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.`;+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — \`mcp__*__AskUserQuestion\` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: \`headless\` → BLOCKED; \`interactive\` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.`;}export function generateCompletionStatus(ctx: TemplateContext): string {diff --git a/scripts/resolvers/preamble/generate-preamble-bash.ts b/scripts/resolvers/preamble/generate-preamble-bash.tsindex d8552421a..ecc30cef7 100644--- a/scripts/resolvers/preamble/generate-preamble-bash.ts+++ b/scripts/resolvers/preamble/generate-preamble-bash.ts@@ -33,6 +33,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(${ctx.paths.binDir}/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=\${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(${ctx.paths.binDir}/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(${ctx.paths.binDir}/gstack-config get telemetry 2>/dev/null || true)diff --git a/setup b/setupindex 37991eda7..0c180f7bf 100755--- a/setup+++ b/setup@@ -1317,6 +1317,7 @@ fi# already registered under that tag, the install is a no-op (no prompt).PLAN_TUNE_LOG_HOOK="$SOURCE_GSTACK_DIR/hosts/claude/hooks/question-log-hook"PLAN_TUNE_PREF_HOOK="$SOURCE_GSTACK_DIR/hosts/claude/hooks/question-preference-hook"+AUQ_ERROR_FALLBACK_HOOK="$SOURCE_GSTACK_DIR/hosts/claude/hooks/auq-error-fallback-hook"PLAN_TUNE_INSTALL_MARKER="$HOME/.gstack/.plan-tune-hooks-prompted"if [ "$NO_TEAM_MODE" -ne 1 ] \@@ -1324,9 +1325,13 @@ if [ "$NO_TEAM_MODE" -ne 1 ] \&& [ -x "$PLAN_TUNE_LOG_HOOK" ] \&& [ -x "$PLAN_TUNE_PREF_HOOK" ]; then- # Already installed? Check the settings.json for our source tag.+ # Already installed? Require BOTH the plan-tune source AND the AUQ-error-fallback+ # source — so an existing install that predates the fallback hook re-runs the+ # install (which is idempotent for the plan-tune hooks) and picks up the new one.ALREADY_INSTALLED=0- if "$SETTINGS_HOOK" list-sources 2>/dev/null | grep -q "plan-tune-cathedral"; then+ _HOOK_SOURCES=$("$SETTINGS_HOOK" list-sources 2>/dev/null || true)+ if printf '%s' "$_HOOK_SOURCES" | grep -q "plan-tune-cathedral" \+ && printf '%s' "$_HOOK_SOURCES" | grep -q "auq-error-fallback"; thenALREADY_INSTALLED=1fi@@ -1364,6 +1369,21 @@ if [ "$NO_TEAM_MODE" -ne 1 ] \--command "$PLAN_TUNE_PREF_HOOK" \--source plan-tune-cathedral \--timeout 5+ # AskUserQuestion-failure prose-fallback reliability hook (OV3:B). Fires only when+ # an AskUserQuestion call returns an error/missing result; inert on success and+ # inert if the platform doesn't invoke PostToolUse on tool errors. MUST use its+ # OWN source tag: gstack-settings-hook dedupes by (event, matcher, source) and+ # REPLACES the entry's hooks, so sharing 'plan-tune-cathedral' would overwrite the+ # question-log capture hook (same event+matcher). A distinct source = a second+ # PostToolUse entry; both run in parallel.+ if [ -x "$AUQ_ERROR_FALLBACK_HOOK" ]; then+ "$SETTINGS_HOOK" add-event \+ --event PostToolUse \+ --matcher '(AskUserQuestion|mcp__.*__AskUserQuestion)' \+ --command "$AUQ_ERROR_FALLBACK_HOOK" \+ --source auq-error-fallback \+ --timeout 5+ fi}if [ "$ALREADY_INSTALLED" -eq 1 ]; thendiff --git a/setup-browser-cookies/SKILL.md b/setup-browser-cookies/SKILL.mdindex f1e7cb0fa..f86466df9 100644--- a/setup-browser-cookies/SKILL.md+++ b/setup-browser-cookies/SKILL.md@@ -42,6 +42,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -121,7 +124,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"diff --git a/setup-deploy/SKILL.md b/setup-deploy/SKILL.mdindex f036b47c9..173f93c63 100644--- a/setup-deploy/SKILL.md+++ b/setup-deploy/SKILL.md@@ -49,6 +49,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -128,7 +131,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -300,11 +303,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -384,7 +407,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/setup-gbrain/SKILL.md b/setup-gbrain/SKILL.mdindex 7342899eb..b26a94ce5 100644--- a/setup-gbrain/SKILL.md+++ b/setup-gbrain/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -299,11 +302,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -383,7 +406,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/ship/SKILL.md b/ship/SKILL.mdindex 755f5ab98..8fd3e61b7 100644--- a/ship/SKILL.md+++ b/ship/SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/skillify/SKILL.md b/skillify/SKILL.mdindex 18cee55b5..6d88103fc 100644--- a/skillify/SKILL.md+++ b/skillify/SKILL.md@@ -46,6 +46,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -125,7 +128,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -297,11 +300,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -381,7 +404,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/spec/SKILL.md b/spec/SKILL.mdindex d45bbec5a..dec8ef3a4 100644--- a/spec/SKILL.md+++ b/spec/SKILL.md@@ -47,6 +47,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -126,7 +129,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -298,11 +301,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -382,7 +405,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chain@@ -1045,6 +1068,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -1124,7 +1150,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -1296,11 +1322,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -1380,7 +1426,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/sync-gbrain/SKILL.md b/sync-gbrain/SKILL.mdindex c48530bbf..09f05e84d 100644--- a/sync-gbrain/SKILL.md+++ b/sync-gbrain/SKILL.md@@ -48,6 +48,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -127,7 +130,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -299,11 +302,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -383,7 +406,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/test/auq-error-fallback-hook.test.ts b/test/auq-error-fallback-hook.test.tsnew file mode 100644index 000000000..ee6d317f5--- /dev/null+++ b/test/auq-error-fallback-hook.test.ts@@ -0,0 +1,131 @@+/**+ * auq-error-fallback-hook — the OV3:B runtime reliability layer.+ *+ * Two layers of testing:+ * - PURE functions (isErrorResponse, directiveFor): deterministic, the core logic.+ * - INTEGRATION: spawn the hook as a PostToolUse process with synthetic stdin and+ * a controlled env, assert it injects the right directive on an error result and+ * stays inert on a real answer.+ *+ * NOTE: whether the Claude Code PLATFORM invokes PostToolUse on an MCP+ * transport/missing-result error is unverified (could not force the Conductor+ * bug in a harness — see docs/spikes/claude-code-hook-mutation.md). These tests+ * pin the hook's BEHAVIOR given it is invoked; the platform trigger is the+ * documented residual risk. The hook is inert if never invoked.+ */+import { describe, test, expect } from 'bun:test';+import { spawnSync } from 'child_process';+import * as path from 'path';+import { isErrorResponse, directiveFor } from '../hosts/claude/hooks/auq-error-fallback-hook.ts';++const HOOK = path.resolve(__dirname, '..', 'hosts', 'claude', 'hooks', 'auq-error-fallback-hook.ts');++describe('isErrorResponse — only clear failures, never a real answer', () => {+ test('null / undefined / empty string are failures', () => {+ expect(isErrorResponse(null)).toBe(true);+ expect(isErrorResponse(undefined)).toBe(true);+ expect(isErrorResponse('')).toBe(true);+ expect(isErrorResponse(' ')).toBe(true);+ });++ test('the Conductor missing-result string is a failure', () => {+ expect(isErrorResponse('[Tool result missing due to internal error]')).toBe(true);+ });++ test('is_error: true / error-field / sentinel-in-content are failures', () => {+ expect(isErrorResponse({ is_error: true })).toBe(true);+ expect(isErrorResponse({ isError: true })).toBe(true);+ expect(isErrorResponse({ error: 'boom' })).toBe(true);+ expect(isErrorResponse({ content: 'Tool result missing due to internal error' })).toBe(true);+ });++ test('a real answer is NOT a failure (no false trigger)', () => {+ expect(isErrorResponse({ answers: [{ option_label: 'A' }] })).toBe(false);+ expect(isErrorResponse('A')).toBe(false);+ // a choice that coincidentally contains "error" must not trip it+ expect(isErrorResponse({ answers: [{ option_label: 'Fix the error' }] })).toBe(false);+ expect(isErrorResponse('Investigate the login error')).toBe(false);+ });++ test('Codex review: narrow detection — generic "error"/"is_error" substrings do NOT trigger', () => {+ // A real answer mentioning "internal error" must not be read as a failure.+ expect(isErrorResponse('Investigate the internal error')).toBe(false);+ // A serialized success payload containing the substring is_error:false must not trigger.+ expect(isErrorResponse('{"is_error": false, "answer": "A"}')).toBe(false);+ expect(isErrorResponse({ is_error: false })).toBe(false);+ expect(isErrorResponse({ content: 'The page had an internal error we fixed' })).toBe(false);+ });+});++describe('directiveFor — per-session-kind instruction', () => {+ test('interactive directive demands the prose triad', () => {+ const d = directiveFor('interactive');+ expect(d).toMatch(/ELI10/);+ expect(d).toMatch(/Completeness: X\/10/);+ expect(d).toMatch(/\(recommended\)/);+ expect(d).toMatch(/reply with a letter/i);+ expect(d).toMatch(/STOP/);+ });++ test('headless directive BLOCKs', () => {+ expect(directiveFor('headless')).toMatch(/BLOCKED — AskUserQuestion unavailable/);+ });++ test('spawned directive auto-chooses', () => {+ expect(directiveFor('spawned')).toMatch(/auto-choose/i);+ });+});++/** Spawn the hook with synthetic stdin + controlled env; parse its JSON stdout. */+function runHook(stdin: object, env: Record<string, string>): { additionalContext?: string } {+ const res = spawnSync('bun', [HOOK], {+ input: JSON.stringify(stdin),+ encoding: 'utf-8',+ env: { PATH: process.env.PATH ?? '/usr/bin:/bin', ...env },+ });+ const parsed = JSON.parse(res.stdout || '{}');+ return parsed.hookSpecificOutput ?? {};+}++describe('hook integration — invoked as PostToolUse', () => {+ test('error result + headless env → injects BLOCK directive', () => {+ const out = runHook(+ { tool_name: 'mcp__conductor__AskUserQuestion', tool_response: '[Tool result missing due to internal error]' },+ { GSTACK_HEADLESS: '1' },+ );+ expect(out.additionalContext).toMatch(/BLOCKED — AskUserQuestion unavailable/);+ });++ test('error result + interactive env → injects prose-triad directive', () => {+ const out = runHook(+ { tool_name: 'AskUserQuestion', tool_response: null },+ { CONDUCTOR_PORT: '55010' },+ );+ expect(out.additionalContext).toMatch(/render the decision as a PROSE message/i);+ expect(out.additionalContext).toMatch(/Completeness: X\/10/);+ });++ test('error result + spawned env → injects auto-choose directive', () => {+ const out = runHook(+ { tool_name: 'AskUserQuestion', tool_response: { is_error: true } },+ { OPENCLAW_SESSION: '1' },+ );+ expect(out.additionalContext).toMatch(/auto-choose/i);+ });++ test('SUCCESSFUL answer → no injection (inert on real answers)', () => {+ const out = runHook(+ { tool_name: 'AskUserQuestion', tool_response: { answers: [{ option_label: 'A' }] } },+ { GSTACK_HEADLESS: '1' },+ );+ expect(out.additionalContext).toBeUndefined();+ });++ test('non-AUQ tool → defers (no injection)', () => {+ const out = runHook(+ { tool_name: 'Bash', tool_response: null },+ { GSTACK_HEADLESS: '1' },+ );+ expect(out.additionalContext).toBeUndefined();+ });+});diff --git a/test/auq-format-always-loaded.test.ts b/test/auq-format-always-loaded.test.tsindex 00f374497..e6094cd8a 100644--- a/test/auq-format-always-loaded.test.ts+++ b/test/auq-format-always-loaded.test.ts@@ -47,6 +47,11 @@ const MANDATORY: Array<{ name: string; re: RegExp }> = [{ name: 'Completeness coverage rule', re: /Completeness\s*:/i },{ name: 'kind-vs-coverage rule', re: /options differ in kind/i },{ name: 'Self-check checklist', re: /Self-check before emitting/i },+ // The runtime-failure fallback must be ALWAYS-LOADED too: when an AUQ call errors+ // mid-skill, the model needs the prose-fallback rule in context that instant, not+ // stranded in an on-demand section. Same guarantee as the format spec above.+ { name: 'AUQ-failure fallback subsection', re: /When AskUserQuestion is unavailable or a call fails/i },+ { name: 'fallback SESSION_KIND branch', re: /SESSION_KIND/ },];/** Per-skill AUQ rules that govern review-finding cadence. A carve may movediff --git a/test/fixtures/golden/claude-ship-SKILL.md b/test/fixtures/golden/claude-ship-SKILL.mdindex 755f5ab98..8fd3e61b7 100644--- a/test/fixtures/golden/claude-ship-SKILL.md+++ b/test/fixtures/golden/claude-ship-SKILL.md@@ -50,6 +50,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <(~/.claude/skills/gstack/bin/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$(~/.claude/skills/gstack/bin/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || true)@@ -129,7 +132,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -301,11 +304,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -385,7 +408,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/test/fixtures/golden/codex-ship-SKILL.md b/test/fixtures/golden/codex-ship-SKILL.mdindex 17354b3ff..6cba6eabf 100644--- a/test/fixtures/golden/codex-ship-SKILL.md+++ b/test/fixtures/golden/codex-ship-SKILL.md@@ -36,6 +36,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <($GSTACK_BIN/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$($GSTACK_BIN/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$($GSTACK_BIN/gstack-config get telemetry 2>/dev/null || true)@@ -115,7 +118,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -287,11 +290,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -371,7 +394,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/test/fixtures/golden/factory-ship-SKILL.md b/test/fixtures/golden/factory-ship-SKILL.mdindex 9e5facd7d..8eb0aabdd 100644--- a/test/fixtures/golden/factory-ship-SKILL.md+++ b/test/fixtures/golden/factory-ship-SKILL.md@@ -38,6 +38,9 @@ echo "SKILL_PREFIX: $_SKILL_PREFIX"source <($GSTACK_BIN/gstack-repo-mode 2>/dev/null) || trueREPO_MODE=${REPO_MODE:-unknown}echo "REPO_MODE: $REPO_MODE"+_SESSION_KIND=$($GSTACK_BIN/gstack-session-kind 2>/dev/null || echo "interactive")+case "$_SESSION_KIND" in spawned|headless|interactive) ;; *) _SESSION_KIND="interactive" ;; esac+echo "SESSION_KIND: $_SESSION_KIND"_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")echo "LAKE_INTRO: $_LAKE_SEEN"_TEL=$($GSTACK_BIN/gstack-config get telemetry 2>/dev/null || true)@@ -117,7 +120,7 @@ In plan mode, allowed because they inform the plan: `$B`, `$D`, `codex exec`/`co## Skill Invocation During Plan Mode-If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If no variant is callable, the skill is BLOCKED — stop and report `BLOCKED — AskUserQuestion unavailable` per the AskUserQuestion Format rule. At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.+If the user invokes a skill in plan mode, the skill takes precedence over generic plan mode behavior. **Treat the skill file as executable instructions, not reference.** Follow it step by step starting from Step 0; the first AskUserQuestion is the workflow entering plan mode, not a violation of it. AskUserQuestion (any variant — `mcp__*__AskUserQuestion` or native; see "AskUserQuestion Format → Tool resolution") satisfies plan mode's end-of-turn requirement. If AskUserQuestion is unavailable or a call fails, follow the AskUserQuestion Format failure fallback: `headless` → BLOCKED; `interactive` → the prose fallback (also satisfies end-of-turn). At a STOP point, stop immediately. Do not continue the workflow or call ExitPlanMode there. Commands marked "PLAN MODE EXCEPTION — ALWAYS RUN" execute. Call ExitPlanMode only after the skill workflow completes, or if the user tells you to cancel the skill or leave plan mode.If `PROACTIVE` is `"false"`, do not auto-invoke or proactively suggest skills. If a skill seems useful, ask: "I think /skillname might help here — want me to run it?"@@ -289,11 +292,31 @@ AI orchestrator (e.g., OpenClaw). In spawned sessions:**Rule:** if any `mcp__*__AskUserQuestion` variant is in your tool list, prefer it. Hosts may disable native AUQ via `--disallowedTools AskUserQuestion` (Conductor does, by default) and route through their MCP variant; calling native there silently fails. Same questions/options shape; same decision-brief format applies.-**If no AskUserQuestion variant appears in your tool list, this skill is BLOCKED.** Stop, report `BLOCKED — AskUserQuestion unavailable`, and wait for the user. Do not write decisions to the plan file as a substitute, do not emit them as prose and stop, and do not silently auto-decide (only `/plan-tune` AUTO_DECIDE opt-ins authorize auto-picking).+If AskUserQuestion is unavailable (no variant in your tool list) OR a call to it fails, do NOT silently auto-decide or write the decision to the plan file as a substitute. Follow the **failure fallback** below.++### When AskUserQuestion is unavailable or a call fails++Tell three outcomes apart:++1. **Auto-decide denial (NOT a failure).** The result contains `[plan-tune auto-decide] <id> → <option>` — the preference hook working as designed. Proceed with that option. Do NOT retry, do NOT fall back to prose.+2. **Genuine failure** — no variant in your tool list, OR the variant is present but the call returns an error / missing result (MCP transport error, empty result, host bug — e.g. Conductor's MCP AskUserQuestion is flaky and returns `[Tool result missing due to internal error]`).+ - If it was present and **errored** (not absent), retry the SAME call **once** — but only if no answer could have surfaced (a missing-result error can arrive after the user already saw the question; retrying would double-prompt, so if it may have reached them, treat as pending, don't retry).+ - Then branch on `SESSION_KIND` (echoed by the preamble; empty/absent ⇒ `interactive`):+ - `spawned` → defer to the **Spawned session** block: auto-choose the recommended option. Never prose, never BLOCKED.+ - `headless` → `BLOCKED — AskUserQuestion unavailable`; stop and wait (no human can answer).+ - `interactive` → **prose fallback** (below).++**Prose fallback — render the decision brief as a markdown message, not a tool call.** Same information as the tool format below, different structure (paragraphs, not ✅/❌ bullets). It MUST surface this triad:++1. **A clear ELI10 of the issue itself** — plain English on what's being decided and why it matters (the question, not per-choice), naming the stakes. Lead with it.+2. **Completeness scores per choice** — explicit `Completeness: X/10` on EACH choice (10 complete, 7 happy-path, 3 shortcut); use the kind-note when options differ in kind not coverage, but never silently drop the score.+3. **The recommendation and why** — a `Recommendation: <choice> because <reason>` line plus the `(recommended)` marker on that choice.++Layout: a `D<N>` title + a one-line note that AskUserQuestion failed and to reply with a letter; the issue ELI10; the Recommendation line; then ONE paragraph per choice carrying its `(recommended)` marker, its `Completeness: X/10`, and 2-4 sentences of reasoning — never a bare bullet list; a closing `Net:` line. Split chains / 5+ options: one prose block per per-option call, in sequence. Then STOP and wait — the user's typed answer is the decision. In plan mode this satisfies end-of-turn like a tool call.### Format-Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose.+Every AskUserQuestion is a decision brief and must be sent as tool_use, not prose — unless the documented failure fallback above applies (interactive session + the call is unavailable/erroring), in which case the prose fallback is the correct output.```D<N> — <one-line question title>@@ -373,7 +396,7 @@ Before calling AskUserQuestion, verify:- [ ] (recommended) label on one option (even for neutral-posture)- [ ] Dual-scale effort labels on effort-bearing options (human / CC)- [ ] Net line closes the decision-- [ ] You are calling the tool, not writing prose+- [ ] You are calling the tool, not writing prose — unless the documented failure fallback applies (then: prose with the mandatory triad — issue ELI10, per-choice Completeness, Recommendation + `(recommended)` — and a "reply with a letter" instruction, then STOP)- [ ] Non-ASCII characters (CJK / accents) written directly, NOT \u-escaped- [ ] If you had 5+ options, you split (or batched into ≤4-groups) — did NOT drop any- [ ] If you split, you checked dependencies between options before firing the chaindiff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.tsindex 3554094ca..24f337f3d 100644--- a/test/gen-skill-docs.test.ts+++ b/test/gen-skill-docs.test.ts@@ -1,4 +1,4 @@-import { describe, test, expect } from 'bun:test';+import { describe, test, expect, beforeAll } from 'bun:test';import { COMMAND_DESCRIPTIONS } from '../browse/src/commands';import { SNAPSHOT_FLAGS } from '../browse/src/snapshot';import * as fs from 'fs';@@ -2125,6 +2125,21 @@ describe('Factory generation (--host factory)', () => {import { ALL_HOST_CONFIGS, getExternalHosts } from '../hosts/index';describe('Parameterized host smoke tests', () => {+ // Regenerate every external host up front so the per-host `--dry-run` freshness+ // checks are deterministic. These host dirs (.agents/.factory/.cursor/...) are+ // gitignored regenerated artifacts, so the freshness check is really an+ // idempotency/determinism check — it still catches non-deterministic gen, but no+ // longer flakes on stale-on-disk state left by a missing `gen --host all` prestep+ // (the canonical `bun test` does not run one). The tracked-claude freshness test+ // (`generated files are fresh`) runs earlier and is unaffected.+ beforeAll(() => {+ for (const h of getExternalHosts()) {+ Bun.spawnSync(['bun', 'run', 'scripts/gen-skill-docs.ts', '--host', h.name], {+ cwd: ROOT, stdout: 'pipe', stderr: 'pipe',+ });+ }+ });+for (const hostConfig of getExternalHosts()) {describe(`${hostConfig.displayName} (--host ${hostConfig.name})`, () => {const hostDir = path.join(ROOT, hostConfig.hostSubdir, 'skills');@@ -2208,6 +2223,16 @@ describe('Parameterized host smoke tests', () => {// ─── --host all tests ────────────────────────────────────────describe('--host all', () => {+ // Same determinism guard as the parameterized block: make external hosts fresh on+ // disk so `--host all --dry-run` reports FRESH regardless of prior state.+ beforeAll(() => {+ for (const h of getExternalHosts()) {+ Bun.spawnSync(['bun', 'run', 'scripts/gen-skill-docs.ts', '--host', h.name], {+ cwd: ROOT, stdout: 'pipe', stderr: 'pipe',+ });+ }+ });+test('--host all generates for all registered hosts', () => {const result = Bun.spawnSync(['bun', 'run', 'scripts/gen-skill-docs.ts', '--host', 'all', '--dry-run'], {cwd: ROOT, stdout: 'pipe', stderr: 'pipe',diff --git a/test/gstack-session-kind.test.ts b/test/gstack-session-kind.test.tsnew file mode 100644index 000000000..67a047a1b--- /dev/null+++ b/test/gstack-session-kind.test.ts@@ -0,0 +1,70 @@+/**+ * gstack-session-kind — classifies the session so skills know whether a human can+ * answer an AskUserQuestion. Drives the AUQ-failure fallback branch:+ * spawned → auto-choose (orchestrator)+ * headless → BLOCK on AUQ failure+ * interactive → prose fallback on AUQ failure+ *+ * These permutations are the contract the resolver rule depends on. Run with a+ * SCRUBBED env (the test process itself runs inside Conductor, so CONDUCTOR_* /+ * CLAUDE_CODE_* would leak in and contaminate the classification).+ *+ * Free, deterministic, gate-tier.+ */+import { describe, test, expect } from 'bun:test';+import { execFileSync } from 'child_process';+import * as path from 'path';++const BIN = path.resolve(__dirname, '..', 'bin', 'gstack-session-kind');++/** Run the helper with ONLY the supplied env (plus PATH so bash resolves). */+function kind(env: Record<string, string>): string {+ return execFileSync(BIN, [], {+ env: { PATH: process.env.PATH ?? '/usr/bin:/bin', ...env },+ encoding: 'utf-8',+ }).trim();+}++describe('gstack-session-kind', () => {+ test('OPENCLAW_SESSION → spawned (highest precedence)', () => {+ expect(kind({ OPENCLAW_SESSION: '1' })).toBe('spawned');+ // spawned wins even when other markers are also present+ expect(kind({ OPENCLAW_SESSION: '1', GSTACK_HEADLESS: '1', CONDUCTOR_PORT: '5' })).toBe('spawned');+ });++ test('GSTACK_HEADLESS → headless', () => {+ expect(kind({ GSTACK_HEADLESS: '1' })).toBe('headless');+ });++ test('CONDUCTOR_* → interactive (a human host is present)', () => {+ expect(kind({ CONDUCTOR_WORKSPACE_PATH: '/tmp/ws' })).toBe('interactive');+ expect(kind({ CONDUCTOR_PORT: '55010' })).toBe('interactive');+ });++ test('CLAUDE_CODE_ENTRYPOINT=cli → interactive', () => {+ expect(kind({ CLAUDE_CODE_ENTRYPOINT: 'cli' })).toBe('interactive');+ });++ test('interactive host beats CI markers', () => {+ expect(kind({ CONDUCTOR_PORT: '5', CI: '1' })).toBe('interactive');+ });++ test('CI / GITHUB_ACTIONS with no host → headless', () => {+ expect(kind({ CI: '1' })).toBe('headless');+ expect(kind({ GITHUB_ACTIONS: 'true' })).toBe('headless');+ });++ test('GSTACK_HEADLESS beats CONDUCTOR (explicit override wins)', () => {+ expect(kind({ GSTACK_HEADLESS: '1', CONDUCTOR_PORT: '5' })).toBe('headless');+ });++ test('bare env → interactive (degrade-safe default)', () => {+ expect(kind({})).toBe('interactive');+ });++ test('empty GSTACK_HEADLESS is treated as unset (interactive)', () => {+ // The resolver/helper guard on -n, so an empty string must NOT mean headless —+ // this is the opt-out path harness suites use to exercise the interactive branch.+ expect(kind({ GSTACK_HEADLESS: '' })).toBe('interactive');+ });+});diff --git a/test/helpers/agent-sdk-runner.ts b/test/helpers/agent-sdk-runner.tsindex ce4512bfe..fc50f7884 100644--- a/test/helpers/agent-sdk-runner.ts+++ b/test/helpers/agent-sdk-runner.ts@@ -300,6 +300,13 @@ export async function runAgentSdkTest(const queryImpl: QueryProvider = opts.queryProvider ?? query;const model = opts.model ?? 'claude-opus-4-7';+ // NOTE on GSTACK_HEADLESS: the SDK child inherits process.env, so headless+ // classification for eval/E2E runs is set by the `test:gate` / `test:evals`+ // package.json scripts (scoped to that invocation), NOT mutated here. We must not+ // pass sdkOpts.env (it breaks the SDK auth pipeline — see CLAUDE.md) and must not+ // mutate process.env ambiently (it would leak headless into later interactive-path+ // tests in the same Bun process — Codex review finding).+let attempt = 0;let lastErr: unknown = null;diff --git a/test/helpers/carve-guards.ts b/test/helpers/carve-guards.tsindex a56ef9a07..e0ce5ec25 100644--- a/test/helpers/carve-guards.ts+++ b/test/helpers/carve-guards.ts@@ -87,6 +87,12 @@ export interface CarveGuard {minUnionBytes: number;/** Parity: content phrases the union must preserve. */mustContain: string[];+ /**+ * Parity: optional per-skill override for the union size-growth ceiling vs the+ * v1.53.0.0 baseline (default 1.05). Bumped only when a deliberate cross-cutting+ * preamble feature legitimately grows a smaller carved skeleton past 5%.+ */+ maxSizeRatio?: number;}export const CARVE_GUARDS: Record<string, CarveGuard> = {@@ -216,6 +222,11 @@ export const CARVE_GUARDS: Record<string, CarveGuard> = {maxSkeletonBytes: 50_000,minUnionBytes: 55_000,mustContain: ['CHANGELOG', 'Diataxis', 'coverage'],+ // The AUQ-failure prose fallback (v1.57.2.0) adds ~2KB to every skill's+ // always-loaded preamble; on this small carved skeleton that lands at ~5.9%+ // over the pre-carve/pre-AUQ v1.53.0.0 baseline. Headroom for the+ // cross-cutting addition; all other skills keep the strict 1.05 ceiling.+ maxSizeRatio: 1.08,},'design-consultation': {skill: 'design-consultation',diff --git a/test/helpers/parity-harness.ts b/test/helpers/parity-harness.tsindex 9d43a8142..186f4833d 100644--- a/test/helpers/parity-harness.ts+++ b/test/helpers/parity-harness.ts@@ -252,7 +252,7 @@ const CARVED_INVARIANTS: ParityInvariant[] = Object.values(CARVE_GUARDS).map((g)minBytes: g.minUnionBytes,mustContain: g.mustContain,mustHaveHeadings: ['## Preamble', '## When to invoke'],- maxSizeRatio: 1.05,+ maxSizeRatio: g.maxSizeRatio ?? 1.05,}));export const PARITY_INVARIANTS: ParityInvariant[] = [diff --git a/test/helpers/providers/claude.ts b/test/helpers/providers/claude.tsindex 5e3c1acb1..ce77767c2 100644--- a/test/helpers/providers/claude.ts+++ b/test/helpers/providers/claude.ts@@ -52,6 +52,9 @@ export class ClaudeAdapter implements ProviderAdapter {timeout: opts.timeoutMs,encoding: 'utf-8',maxBuffer: 32 * 1024 * 1024,+ // Default GSTACK_HEADLESS=1 so a benchmark run classifies as headless (an+ // AskUserQuestion failure BLOCKs rather than emitting unanswerable prose).+ env: { ...process.env, GSTACK_HEADLESS: '1' },});const parsed = this.parseOutput(out);return {diff --git a/test/helpers/session-runner.ts b/test/helpers/session-runner.tsindex ae0454335..675255cf2 100644--- a/test/helpers/session-runner.ts+++ b/test/helpers/session-runner.ts@@ -176,7 +176,11 @@ export async function runSkillTest(options: {const proc = Bun.spawn(['sh', '-c', `cat "${promptFile}" | claude ${args.map(a => `"${a}"`).join(' ')}`], {cwd: workingDirectory,- env: extraEnv ? { ...process.env, ...extraEnv } : undefined,+ // Default GSTACK_HEADLESS=1 so eval/E2E runs classify as headless (BLOCK on an+ // AskUserQuestion failure rather than emit a prose question no human reads). A+ // suite exercising the INTERACTIVE prose-fallback path opts out by passing+ // `env: { GSTACK_HEADLESS: '' }` — extraEnv wins because it spreads last.+ env: { ...process.env, GSTACK_HEADLESS: '1', ...extraEnv },stdout: 'pipe',stderr: 'pipe',});diff --git a/test/resolver-ask-user-format.test.ts b/test/resolver-ask-user-format.test.tsindex 629780c4f..69e66a055 100644--- a/test/resolver-ask-user-format.test.ts+++ b/test/resolver-ask-user-format.test.ts@@ -16,6 +16,8 @@* for the weekly periodic eval to notice.*/import { describe, test, expect } from 'bun:test';+import * as fs from 'fs';+import * as path from 'path';import type { TemplateContext } from '../scripts/resolvers/types';import { HOST_PATHS } from '../scripts/resolvers/types';import { generateAskUserFormat } from '../scripts/resolvers/preamble/generate-ask-user-format';@@ -161,3 +163,88 @@ describe('generateAskUserFormat — 5+ option split rule (slim inline + docs poiexpect(out).toContain('**Non-ASCII characters');});});++describe('generateAskUserFormat — runtime-failure prose fallback', () => {+ const out = generateAskUserFormat(makeCtx());++ test('documents the unavailable/failed subsection', () => {+ expect(out).toMatch(/When AskUserQuestion is unavailable or a call fails/i);+ });++ test('carves out the auto-decide denial as NOT a failure', () => {+ expect(out).toContain('[plan-tune auto-decide]');+ expect(out).toMatch(/NOT a failure/i);+ // and explicitly: do not fall back to prose on an auto-decide denial+ expect(out).toMatch(/Do NOT[\s\S]{0,40}fall back to prose|never prose/i);+ });++ test('retries the errored call exactly once before degrading', () => {+ expect(out).toMatch(/retry the SAME call \*\*once\*\*|retry the same call.*once/i);+ // idempotency guard against double-prompting+ expect(out).toMatch(/double-prompt|no answer could have surfaced/i);+ });++ test('branches on SESSION_KIND: spawned / headless / interactive', () => {+ expect(out).toContain('SESSION_KIND');+ expect(out).toMatch(/`spawned`[\s\S]*auto-choose/);+ expect(out).toMatch(/`headless`[\s\S]*BLOCKED/);+ expect(out).toMatch(/`interactive`[\s\S]*prose fallback/);+ // empty/absent SESSION_KIND degrades to interactive+ expect(out).toMatch(/empty\/absent[\s\S]{0,40}interactive/i);+ });++ // The mandatory triad the user explicitly required for the plain-text output.+ test('prose fallback mandates the triad: issue ELI10', () => {+ expect(out).toMatch(/ELI10 of the issue itself/i);+ });++ test('prose fallback mandates the triad: per-choice Completeness score', () => {+ expect(out).toMatch(/Completeness scores per choice/i);+ expect(out).toMatch(/Completeness: X\/10.*EACH choice|on EACH choice/i);+ });++ test('prose fallback mandates the triad: recommendation + (recommended) marker', () => {+ expect(out).toMatch(/Recommendation: <choice> because/);+ expect(out).toMatch(/\(recommended\)`? marker on that choice/);+ });++ test('prose fallback is one paragraph per choice, not a bare bullet list', () => {+ expect(out).toMatch(/ONE paragraph per choice/i);+ expect(out).toMatch(/never a bare bullet list/i);+ });++ test('prose fallback tells the user to reply with a letter, then STOP', () => {+ expect(out).toMatch(/reply with a letter/i);+ expect(out).toMatch(/STOP and wait/i);+ });++ // OV2: the former "tool_use, not prose" assertions must carry the qualifier so the+ // fallback is not self-contradicting. Guards against the instruction collision+ // silently returning on a future edit.+ test('OV2: the Format line qualifies "not prose" with the fallback exception', () => {+ expect(out).toMatch(/must be sent as tool_use, not prose — unless the documented failure fallback/);+ });++ test('OV2: the self-check "not writing prose" line carries the fallback qualifier', () => {+ expect(out).toMatch(/not writing prose — unless the documented failure fallback applies/);+ });+});++describe('CQ2 — cross-file invariant: auto-decide prefix matches the hook', () => {+ const out = generateAskUserFormat(makeCtx());+ const hookSrc = fs.readFileSync(+ path.resolve(__dirname, '..', 'hosts', 'claude', 'hooks', 'question-preference-hook.ts'),+ 'utf-8',+ );++ test('the hook actually emits the [plan-tune auto-decide] prefix', () => {+ expect(hookSrc).toContain('[plan-tune auto-decide]');+ });++ test('the resolver references the exact same prefix the hook emits', () => {+ // If a future edit reworded the hook reason, this catches the drift: the prose+ // fallback would stop recognizing the auto-decide denial as not-a-failure.+ const PREFIX = '[plan-tune auto-decide]';+ expect(hookSrc.includes(PREFIX) && out.includes(PREFIX)).toBe(true);+ });+});