From 1130d00ebc75017ec449242e56d2017709fb7156 Mon Sep 17 00:00:00 2001 From: Morgan Date: Tue, 1 Sep 2026 06:07:44 +0700 Subject: [PATCH] Fix: keep direction contracts out of production output (#673) Store direction contracts in development-only surface briefs and guard against browser-delivered leakage with regression coverage. AI-assisted merge: reviewed and executed by Codex under maintainer direction. --- README.md | 5 +++-- skill/reference/new-work.md | 8 ++++++-- tests/skill-reference.test.mjs | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d37472fba..15e4f6194 100644 --- a/README.md +++ b/README.md @@ -336,7 +336,7 @@ As you run commands, Impeccable writes working files under `.impeccable/`: criti # Unanchored: .impeccable may sit at the repo root or under a nested # workspace (apps/web/.impeccable/...); anchored patterns would miss it. # Shared artifacts stay tracked: config.json, live/config.json, -# design.json, critique/*.md. +# design.json, surfaces/*.md, critique/*.md. .impeccable/config.local.json .impeccable/hook.cache.json .impeccable/hook.pending.json @@ -364,6 +364,7 @@ The block is wrapped in `# impeccable-ignore-start` / `# impeccable-ignore-end` - `.impeccable/config.json` (unified shared config) - `.impeccable/live/config.json` (live-mode framework wiring) - `.impeccable/design.json` (shared design spec) +- `.impeccable/surfaces/*.md` (route- or artifact-specific strategy and direction contracts) - `.impeccable/critique/*.md` (review reports) If an ephemeral file (a screenshot, `config.local.json`) was committed before you added the block, `.gitignore` will not untrack it automatically. Run `git rm --cached ` to stop tracking it without deleting your local copy. @@ -388,7 +389,7 @@ For debugging, set `hook.auditLog` in `.impeccable/config.json` to a path (or th ## Build path: comp-first or code-first -When a new surface gets designed, Impeccable either generates a full-fidelity comp first and builds to match it, or builds straight in code with the ambition written into the direction contract and checked at the finish. Comp-first composes bolder and takes longer; code-first is leaner and faster. `/impeccable init` asks once and records the answer as `buildPath` in `.impeccable/config.json`: +When a new surface gets designed, Impeccable either generates a full-fidelity comp first and builds to match it, or builds straight in code with the ambition written into a development-only direction contract in the surface brief and checked at the finish. Comp-first composes bolder and takes longer; code-first is leaner and faster. `/impeccable init` asks once and records the answer as `buildPath` in `.impeccable/config.json`: ```json { "buildPath": "comp" } diff --git a/skill/reference/new-work.md b/skill/reference/new-work.md index 619d17f97..9b325f745 100644 --- a/skill/reference/new-work.md +++ b/skill/reference/new-work.md @@ -72,16 +72,20 @@ Your measured rendition prior: warm, bookish, family, and child-facing subjects ## 5. Record the decision -Before code, state the chosen direction as a contract in the artifact's opening comment, five short blocks, 150 words at most, in a form that survives the production build: an HTML comment in the emitted markup, never only a templating-frontmatter comment, placed as the first child of the document's body in the root layout, never inside a slotted or child component (some compilers, Astro among them, strip a slot's leading comment while keeping deeper ones). After the first production build, grep the built output for the seed key; a contract the build erased is a contract nobody can audit. THESIS: the one idea this surface owns and the category-default arrangement it refuses. OWN-WORLD: the palette and component language, specific enough to be recognizable with all content removed. STORY: what the visitor understands, believes, and does. FIRST VIEWPORT: the exact composition, what is where and at what scale, and where the primary action sits. FORM: the chosen form, its position on your ordered list, and the seed key the script printed. Close with one more line, FINISH: the run's exit condition, verbatim "unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance". The comment tops the artifact you re-open on every edit, the one reminder that survives a long build: a page that looks complete with the FINISH line undischarged is not done, it is abandoned at the finish line. If a block reads like a mood, the direction is not decided yet; the finishing review audits the render against this contract. +Before code, record the chosen direction as a development-only contract under `## Direction contract` in the relevant surface brief. A direction contract is durable route or artifact strategy, so create or update the brief even when no other surface strategy needs persistence. Keep the contract to six short blocks and 150 words at most. THESIS: the one idea this surface owns and the category-default arrangement it refuses. OWN-WORLD: the palette and component language, specific enough to be recognizable with all content removed. STORY: what the visitor understands, believes, and does. FIRST VIEWPORT: the exact composition, what is where and at what scale, and where the primary action sits. FORM: the chosen form, its position on your ordered list, and the seed key the script printed. Close with one more line, FINISH: the run's exit condition, verbatim "unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance". The surface brief is the reminder later agents reload across edits and sessions: a page that looks complete with the FINISH line undischarged is not done, it is abandoned at the finish line. If a block reads like a mood, the direction is not decided yet; the finishing review audits the render against this contract. + +Never copy the direction contract into implementation source or any browser-delivered artifact. This includes HTML or framework comments, hidden DOM, `