fix: promote consent to own Step 0.5 with structural enforcement (PRI-974)

Drill benchmark showed 0/4 consent compliance across both Claude Code
and Codex. Root cause: consent was buried inline in Step 0's conditional
branch. Agents anchor on the next bash command and skip prose.

Fix: promote consent to its own numbered section with imperative framing
("REQUIRED STOP", "Do NOT proceed without an answer") and exact output
template. Also adds explicit "no" path — users who want to work directly
on their current branch skip to Step 3 with no worktree creation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Drew Ritter
2026-04-07 16:48:51 -07:00
parent b1e9711034
commit 100a56871c

View File

@@ -36,13 +36,20 @@ Report with branch state:
- On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
- Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout. Proceed to Step 0.5.
If the user has not already made their preferences about worktree isolation clear — check global and project agent instruction files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursorrules`, or equivalent) — ask for consent before creating a worktree:
## Step 0.5: Consent — REQUIRED STOP
> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
**You MUST ask the user before creating any workspace. Do NOT proceed to Step 1 without an answer.**
Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 3.
Output exactly this, then STOP and wait for a response:
> "I can set up an isolated worktree for this work, or work directly on your current branch. Which do you prefer?"
- **User wants a worktree** → proceed to Step 1
- **User wants to work in place** → skip to Step 3 (no worktree, no directory change)
Do NOT interpret silence or an unrelated reply as consent. If unclear, ask once more.
## Step 1: Create Isolated Workspace