The design language that makes your AI harness better at design.
JavaScript
chore(skill): harden post-accept carbonize cleanup so the agent can't skip it
Paul Bakausf38a8d40ee32
diff --git a/.agents/skills/impeccable/reference/live.md b/.agents/skills/impeccable/reference/live.mdindex 957ea2f0e..0cf0ab53a 100644--- a/.agents/skills/impeccable/reference/live.md+++ b/.agents/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.agents/skills/impeccable/scripts/live-accept.mjs b/.agents/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.agents/skills/impeccable/scripts/live-accept.mjs+++ b/.agents/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.agents/skills/impeccable/scripts/live-poll.mjs b/.agents/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.agents/skills/impeccable/scripts/live-poll.mjs+++ b/.agents/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.claude/skills/impeccable/reference/live.md b/.claude/skills/impeccable/reference/live.mdindex bee92fbf4..e0de59d27 100644--- a/.claude/skills/impeccable/reference/live.md+++ b/.claude/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.claude/skills/impeccable/scripts/live-accept.mjs b/.claude/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.claude/skills/impeccable/scripts/live-accept.mjs+++ b/.claude/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.claude/skills/impeccable/scripts/live-poll.mjs b/.claude/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.claude/skills/impeccable/scripts/live-poll.mjs+++ b/.claude/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.cursor/skills/impeccable/reference/live.md b/.cursor/skills/impeccable/reference/live.mdindex 7aaab09fb..c9ed2bacc 100644--- a/.cursor/skills/impeccable/reference/live.md+++ b/.cursor/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.cursor/skills/impeccable/scripts/live-accept.mjs b/.cursor/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.cursor/skills/impeccable/scripts/live-accept.mjs+++ b/.cursor/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.cursor/skills/impeccable/scripts/live-poll.mjs b/.cursor/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.cursor/skills/impeccable/scripts/live-poll.mjs+++ b/.cursor/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.gemini/skills/impeccable/reference/live.md b/.gemini/skills/impeccable/reference/live.mdindex 9e371813f..7fdaac105 100644--- a/.gemini/skills/impeccable/reference/live.md+++ b/.gemini/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.gemini/skills/impeccable/scripts/live-accept.mjs b/.gemini/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.gemini/skills/impeccable/scripts/live-accept.mjs+++ b/.gemini/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.gemini/skills/impeccable/scripts/live-poll.mjs b/.gemini/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.gemini/skills/impeccable/scripts/live-poll.mjs+++ b/.gemini/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.github/skills/impeccable/reference/live.md b/.github/skills/impeccable/reference/live.mdindex 800b3bdff..b7e4f968a 100644--- a/.github/skills/impeccable/reference/live.md+++ b/.github/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.github/skills/impeccable/scripts/live-accept.mjs b/.github/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.github/skills/impeccable/scripts/live-accept.mjs+++ b/.github/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.github/skills/impeccable/scripts/live-poll.mjs b/.github/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.github/skills/impeccable/scripts/live-poll.mjs+++ b/.github/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.kiro/skills/impeccable/reference/live.md b/.kiro/skills/impeccable/reference/live.mdindex 71127201c..55db8aa14 100644--- a/.kiro/skills/impeccable/reference/live.md+++ b/.kiro/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.kiro/skills/impeccable/scripts/live-accept.mjs b/.kiro/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.kiro/skills/impeccable/scripts/live-accept.mjs+++ b/.kiro/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.kiro/skills/impeccable/scripts/live-poll.mjs b/.kiro/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.kiro/skills/impeccable/scripts/live-poll.mjs+++ b/.kiro/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.opencode/skills/impeccable/reference/live.md b/.opencode/skills/impeccable/reference/live.mdindex 8573a128f..0ad537c2d 100644--- a/.opencode/skills/impeccable/reference/live.md+++ b/.opencode/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.opencode/skills/impeccable/scripts/live-accept.mjs b/.opencode/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.opencode/skills/impeccable/scripts/live-accept.mjs+++ b/.opencode/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.opencode/skills/impeccable/scripts/live-poll.mjs b/.opencode/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.opencode/skills/impeccable/scripts/live-poll.mjs+++ b/.opencode/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.pi/skills/impeccable/reference/live.md b/.pi/skills/impeccable/reference/live.mdindex 2d83fcdbc..9a5d417db 100644--- a/.pi/skills/impeccable/reference/live.md+++ b/.pi/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.pi/skills/impeccable/scripts/live-accept.mjs b/.pi/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.pi/skills/impeccable/scripts/live-accept.mjs+++ b/.pi/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.pi/skills/impeccable/scripts/live-poll.mjs b/.pi/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.pi/skills/impeccable/scripts/live-poll.mjs+++ b/.pi/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.rovodev/skills/impeccable/reference/live.md b/.rovodev/skills/impeccable/reference/live.mdindex b84bf390d..b77547437 100644--- a/.rovodev/skills/impeccable/reference/live.md+++ b/.rovodev/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.rovodev/skills/impeccable/scripts/live-accept.mjs b/.rovodev/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.rovodev/skills/impeccable/scripts/live-accept.mjs+++ b/.rovodev/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.rovodev/skills/impeccable/scripts/live-poll.mjs b/.rovodev/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.rovodev/skills/impeccable/scripts/live-poll.mjs+++ b/.rovodev/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.trae-cn/skills/impeccable/reference/live.md b/.trae-cn/skills/impeccable/reference/live.mdindex 501f878bd..0f2c3ec8a 100644--- a/.trae-cn/skills/impeccable/reference/live.md+++ b/.trae-cn/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.trae-cn/skills/impeccable/scripts/live-accept.mjs b/.trae-cn/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.trae-cn/skills/impeccable/scripts/live-accept.mjs+++ b/.trae-cn/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.trae-cn/skills/impeccable/scripts/live-poll.mjs b/.trae-cn/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.trae-cn/skills/impeccable/scripts/live-poll.mjs+++ b/.trae-cn/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/.trae/skills/impeccable/reference/live.md b/.trae/skills/impeccable/reference/live.mdindex 3fcb44a6d..ef359d84b 100644--- a/.trae/skills/impeccable/reference/live.md+++ b/.trae/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/.trae/skills/impeccable/scripts/live-accept.mjs b/.trae/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/.trae/skills/impeccable/scripts/live-accept.mjs+++ b/.trae/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/.trae/skills/impeccable/scripts/live-poll.mjs b/.trae/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/.trae/skills/impeccable/scripts/live-poll.mjs+++ b/.trae/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {diff --git a/source/skills/impeccable/reference/live.md b/source/skills/impeccable/reference/live.mdindex 89d633161..1f4438679 100644--- a/source/skills/impeccable/reference/live.md+++ b/source/skills/impeccable/reference/live.md@@ -233,16 +233,26 @@ Remove the wrapper you inserted in Step 2. Nothing else to do.Event: `{id, variantId, _acceptResult}`. The poll script already ran `live-accept.mjs` to handle the file operation deterministically; the browser DOM is already updated.- `_acceptResult.handled: true` and `carbonize: false` — nothing to do. Poll again.-- `_acceptResult.handled: true` and `carbonize: true` — the accepted variant has an inline `<style>` block marked with `impeccable-carbonize-start` / `impeccable-carbonize-end` comments. The accepted content itself is wrapped in a `<div data-impeccable-variant="N" style="display: contents">` so the existing `@scope ([data-impeccable-variant="N"])` rules keep rendering correctly until carbonize runs — the user sees the accepted design immediately, no visual gap. Spawn a **background agent** to:- 1. Find the carbonize markers in the file.- 2. Move the CSS rules into the project's proper stylesheet(s).- 3. Rewrite `@scope` selectors to use the element's real classes instead of `[data-impeccable-variant]`.- 4. Remove the `<div data-impeccable-variant="N">` wrapper and any helper classes/attributes from the accepted HTML.- 5. Delete the carbonize markers and inline `<style>` block.- Poll again immediately; don't wait for the background agent.+- `_acceptResult.handled: true` and `carbonize: true` — **post-accept cleanup is required before the next poll.** See the "Required after accept (carbonize)" section below. The `event._acceptResult.todo` field and a stderr banner both list the steps explicitly; neither is decorative.- `_acceptResult.handled: false, mode: "fallback"` — the session lived in a generated file and the script refused to persist there. You've already written the accepted variant into true source during Handle fallback Step 3; just clean up the temporary wrapper in the served file if any, and poll again.- `_acceptResult.handled: false` without `mode` — manual cleanup: read file, find markers, edit.+### Required after accept (carbonize)++When `_acceptResult.carbonize === true`, the accepted variant was stitched into source with helper markers and inline CSS so the browser can render it immediately with no visual gap. That stitch-in is **temporary**. The agent must rewrite it into permanent form before doing anything else. Skipping this leaves dead `@scope` rules for unaccepted variants, a pointless `data-impeccable-variant` wrapper, and `impeccable-carbonize-start/end` comment noise in the source file — all of which accumulate across sessions.++Do these five steps in the current thread, synchronously, before the next poll. Do not poll again until the file is clean.++1. **Locate the carbonize block** in the source file (`_acceptResult.file`). It's bracketed by `<!-- impeccable-carbonize-start SESSION_ID -->` and `<!-- impeccable-carbonize-end SESSION_ID -->` and contains a `<style data-impeccable-css="SESSION_ID">` element.+2. **Move the CSS rules** into the project's real stylesheet. Which stylesheet depends on the project (e.g. `public/css/workflow.css` for this repo, or the component's co-located CSS file for a Vite/Next project — pick whichever already owns styling for the surrounding element).+3. **Rewrite `@scope ([data-impeccable-variant="N"])` selectors** to target real, semantic classes on the accepted HTML. Example: `@scope ([data-impeccable-variant="2"]) { .v2-label { … } }` becomes `.why-visual--v2 .v2-label { … }` if the accepted element already carries `.why-visual--v2`, or pick/add a suitable class if it doesn't.+4. **Unwrap the accepted content.** Delete the `<div data-impeccable-variant="N" style="display: contents">` that wraps it.+5. **Delete the inline `<style>` block and both `<!-- impeccable-carbonize-start/end -->` markers.** Also drop any `@scope` rules for variants other than the accepted one — those are dead code now.++Then poll again.++A background agent may be used for the rewrite, but the current thread is responsible for verifying the five steps are complete before issuing the next poll. In practice, inline is usually faster and less error-prone.+## Handle `discard`Event: `{id, _acceptResult}`. The poll script already restored the original and removed all variant markers. Nothing to do. Poll again.diff --git a/source/skills/impeccable/scripts/live-accept.mjs b/source/skills/impeccable/scripts/live-accept.mjsindex af22180aa..484b5cb5b 100644--- a/source/skills/impeccable/scripts/live-accept.mjs+++ b/source/skills/impeccable/scripts/live-accept.mjs@@ -79,6 +79,21 @@ Output (JSON):console.log(JSON.stringify({ handled: true, file: relFile, carbonize: false, ...result }));} else {const result = handleAccept(id, variantNum, lines, targetFile);+ // When carbonize is needed, emit an explicit todo in the payload so the+ // agent can't miss it. The five steps are mirrored from reference/live.md+ // "Required after accept" and are intentionally verbose: past runs skipped+ // cleanup when the instruction was a single bullet.+ if (result.carbonize) {+ result.todo = [+ 'REQUIRED before next poll: post-accept carbonize cleanup.',+ '1. Move the inline <style data-impeccable-css="' + id + '"> rules into the project stylesheet.',+ '2. Rewrite @scope ([data-impeccable-variant="N"]) selectors to use the element\'s real classes.',+ '3. Drop the <div data-impeccable-variant="N" style="display: contents"> wrapper around the accepted content.',+ '4. Delete the <!-- impeccable-carbonize-start/end --> marker comments and the inline <style> block.',+ '5. Remove any @scope blocks for variants other than the accepted one (dead code).',+ 'See reference/live.md "Required after accept" for the full checklist.',+ ];+ }console.log(JSON.stringify({ handled: true, file: relFile, ...result }));}}diff --git a/source/skills/impeccable/scripts/live-poll.mjs b/source/skills/impeccable/scripts/live-poll.mjsindex 03d05baec..1fcc6ceb6 100644--- a/source/skills/impeccable/scripts/live-poll.mjs+++ b/source/skills/impeccable/scripts/live-poll.mjs@@ -156,6 +156,26 @@ Options:}}+ // Loud stderr banner so the agent sees the cleanup requirement even if+ // it parses stdout JSON and ignores nested fields. carbonize: true means+ // the accepted variant was stitched in with helper markers + inline CSS+ // that must be cleaned up before the next poll — see reference/live.md+ // "Required after accept".+ if (event._acceptResult?.carbonize === true) {+ process.stderr.write(+ '\n' ++ '========================================================================\n' ++ ' REQUIRED: post-accept carbonize cleanup before the next poll.\n' ++ ' 1. Move inline <style> rules into the project stylesheet.\n' ++ ' 2. Rewrite @scope ([data-impeccable-variant]) to real classes.\n' ++ ' 3. Drop the <div data-impeccable-variant> wrapper.\n' ++ ' 4. Delete impeccable-carbonize-start/end marker comments.\n' ++ ' 5. Drop @scope blocks for unaccepted variants.\n' ++ ' Full checklist: reference/live.md, "Required after accept".\n' ++ '========================================================================\n\n'+ );+ }+// Print the event as JSON — the agent reads this from stdoutconsole.log(JSON.stringify(event));} catch (err) {