craft + codex: explicit user gates before code (Codex test fix)

A live Codex test against v3.1.0 caught the model skipping both
shape questions (when PRODUCT.md was present) and image generation
entirely, going straight to implementation after the compact shape
brief. The loophole: "confirm or override" at the end of compact
shape reads as the final gate, even though codex.md adds four more
gates before code.

Three tightenings:

- craft.md: new "Gates: do not compress" section at the top that
  names the four gates explicitly (shape brief, direction questions,
  palette, mock approval). Compact shape's closing line now says it
  advances to Step 3 and codex.md, not Step 4. New precondition at
  the top of Step 4 forbids mentioning implementation, file paths,
  or patch plans until codex.md Steps A-D are complete.

- codex.md: new "Four stop points before code" intro listing the
  user-facing gates as a numbered checklist. Step A now says it's
  required even when shape just produced a confirmed brief; the
  shape and Step-A questions cover different ground. Explicit STOP
  markers added to Steps A, B, and D.

- Changelog: v3.1.0 "Shape gates restored" bullet rewritten as
  "Shape and craft gates strengthened" to cover the additional
  craft.md sequencing.

Retagging v3.1.0 to include this fix rather than cutting a 3.1.1
since the original tag is minutes old, no marketing went out, and
the gate work is what the asset-producer story needs to actually
work in Codex.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-05-13 00:42:08 -07:00
co-authored by Claude Opus 4.7
parent 23b6b9cc0e
commit dc715c7359
29 changed files with 463 additions and 43 deletions
+16 -3
View File
@@ -4,16 +4,29 @@ This file is loaded by `/impeccable craft` when the harness has native image gen
Read this *before* generating any images. The order matters, and the per-step user pauses are what keep generated imagery from drifting away from the brief.
### Four stop points before code
Steps A through D each end with the user. Do not advance past any of them on your own read of the situation.
1. **STOP after Step A questions.** Wait for answers.
2. **STOP after Step B palette generation.** Wait for "confirm palette."
3. **STOP after Step C mocks.** Wait for direction approval or delegation.
4. **Only after Step D approves a direction** do you return to craft.md Step 4 and write code.
Prior shape approval does **not** satisfy any of these. Shape's "confirm or override" advances you into Step A; it is not a substitute for it.
## Step A: Explore Directions with the User
Before generating anything, run a brief direction conversation grounded in the shape brief.
**Step A is required even when shape just produced a confirmed brief.** The shape questions and Step A questions cover different ground: shape pins purpose, content, scope; Step A pins palette, atmosphere, and named visual references for the comps you're about to generate. The only time you can skip Step A is when the user has already answered these exact palette/atmosphere/reference questions in the same session.
Ask **2-3 targeted questions** about visual lane, color strategy, atmosphere, and named anchor references. Don't enumerate generic menus; tie each question to the shape brief's answers. Example shape-grounded questions:
- "Brief says 'editorial restraint, Klim-adjacent.' Are we closer to a quiet specimen page or a magazine-spread feel with hero imagery?"
- "Palette strategy from shape was 'Committed.' Want it warm-grounded (deep oxblood + cream) or cool-grounded (slate + paper white)?"
Stop and wait for answers. These pin the palette before any pixel gets generated.
**STOP and wait for answers.** These pin the palette before any pixel gets generated. Do not proceed to Step B until the user has responded.
## Step B: Generate the Brand Palette First
@@ -23,7 +36,7 @@ Why palette first: mocks generated against a vague color sense produce noise tha
Show the palette to the user. Ask one question: "This is the palette I'm locking in for the mocks. Confirm, or call out what to shift?"
Wait for confirmation. Do not generate mocks against an unconfirmed palette.
**STOP and wait for confirmation.** Do not generate mocks against an unconfirmed palette. "Probably good enough" is the wrong call here; the palette is the contract for everything downstream.
## Step C: Generate 1-3 Visual Mocks Against the Palette
@@ -39,7 +52,7 @@ Use the `image_gen` tool directly (or via the imagegen skill when available). Do
Show the comps. Ask what carries forward. Iterate until **one direction is approved** or the user explicitly delegates.
If the user delegates, pick the strongest direction and explain it from the brief, not personal taste.
**STOP and wait for the approval or the delegation.** Do not begin Step E or return to craft.md Step 4 until a single direction is named. If the user delegates, pick the strongest direction and explain it from the brief, not personal taste.
Before moving to assets, summarize what to carry into code and what *not* to literalize from the mock. This is the handoff between visual exploration and semantic implementation.
@@ -6,6 +6,19 @@ Before writing code, you need: PRODUCT.md loaded, register identified and the ma
Treat any approved visual direction (generated mock or stated reference) as a concrete contract for composition, hierarchy, density, atmosphere, signature motifs, and distinctive visual moves. Don't let mocks replace structure, copy, accessibility, or state design. But if the live result lacks the approved direction's major ingredients, the implementation is wrong.
### Gates: do not compress
Craft has **multiple user gates**, not one. When the harness has native image generation (Codex via `image_gen`), the gate sequence before code is:
1. **Shape brief confirmed** (Step 1)
2. **Direction questions answered** (codex.md Step A)
3. **Palette confirmed** (codex.md Step B)
4. **One mock direction approved or delegated** (codex.md Step D)
You must stop at every gate. **Shape confirmation alone is NOT a green light to start coding.** It is the green light to begin codex.md Step A. Compressing gates 2 through 4 because the shape brief felt complete is the dominant failure mode of this flow.
When the harness lacks native image generation, gates 2-4 collapse into the brief itself, and shape confirmation does advance straight to code.
## Step 0: Project Foundation
Before shape, before code: figure out what kind of project you're working in.
@@ -37,6 +50,8 @@ If the user already supplied a confirmed brief or ran shape separately, use it a
When the original prompt + PRODUCT.md already answer scope, content, and visual direction with no real ambiguity, the shape output can be **compact** (3-5 bullets stating what you're building and the visual lane, ending with one or two specific questions or "confirm or override"). The full 10-section structured brief is reserved for genuinely ambiguous, multi-screen, or stakeholder-heavy tasks. Don't pad a clear brief into a long one to look thorough; equally, don't skip the pause to look efficient.
If the harness has native image generation (Codex), a compact shape's "confirm or override" advances to **Step 3 and the codex.md flow**, not to Step 4. Phrase the closing line accordingly: "Confirm or override; once we lock direction, I'll run a couple of palette and reference questions before generating any mocks." This stops the model from reading shape confirmation as code-green.
## Step 2: Load References
Based on the design brief's "Recommended References" section, consult the relevant impeccable reference files. At minimum, always consult:
@@ -61,6 +76,8 @@ Whether you generated mocks or not: don't replace required imagery with generic
## Step 4: Build to Production Quality
**Precondition.** If Step 3 routed you to codex.md (native image generation available), Steps A through D in that file must be complete before any code: questions answered, palette confirmed, mocks generated, one direction approved or delegated. **Do not mention implementation, file paths, or patch plans until that's done.** A confirmed shape brief is not enough; the model that compressed those gates is the model that already failed this flow.
Implement the feature following the design brief. Build in passes so structure, visual system, states, motion/media, and responsive behavior each get deliberate attention. The list below is the definition of done, not inspiration.
### Production bar