@bastani/atomic 0.8.20 → 0.8.21-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/agents/code-simplifier.md +78 -22
  5. package/dist/builtin/subagents/agents/debugger.md +4 -3
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/builtin/workflows/CHANGELOG.md +19 -0
  9. package/dist/builtin/workflows/package.json +1 -1
  10. package/dist/builtin/workflows/skills/create-spec/SKILL.md +169 -125
  11. package/dist/builtin/workflows/skills/impeccable/SKILL.md +89 -80
  12. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +92 -0
  13. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +95 -0
  14. package/dist/builtin/workflows/skills/impeccable/agents/openai.yaml +4 -0
  15. package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +122 -1
  16. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +38 -12
  17. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +5 -5
  18. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +7 -7
  19. package/dist/builtin/workflows/skills/impeccable/reference/brand.md +4 -14
  20. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +115 -1
  21. package/dist/builtin/workflows/skills/impeccable/reference/codex.md +3 -3
  22. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +109 -6
  23. package/dist/builtin/workflows/skills/impeccable/reference/craft.md +7 -7
  24. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +623 -94
  25. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +2 -2
  26. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  27. package/dist/builtin/workflows/skills/impeccable/reference/document.md +16 -14
  28. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  29. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -1
  30. package/dist/builtin/workflows/skills/impeccable/reference/init.md +172 -0
  31. package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -6
  32. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +33 -13
  33. package/dist/builtin/workflows/skills/impeccable/reference/live.md +96 -19
  34. package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +1 -1
  35. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +1 -1
  36. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  37. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +3 -4
  38. package/dist/builtin/workflows/skills/impeccable/reference/product.md +1 -3
  39. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +2 -2
  40. package/dist/builtin/workflows/skills/impeccable/reference/shape.md +5 -5
  41. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +158 -3
  42. package/dist/builtin/workflows/skills/impeccable/scripts/cleanup-deprecated.mjs +1 -1
  43. package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +2 -2
  44. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +225 -0
  45. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +266 -0
  46. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +17 -1
  47. package/dist/builtin/workflows/skills/impeccable/scripts/design-parser.mjs +16 -1
  48. package/dist/builtin/workflows/skills/impeccable/scripts/detect.mjs +21 -0
  49. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +1725 -0
  50. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +244 -0
  51. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +4543 -0
  52. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
  53. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
  54. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +535 -0
  55. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +986 -0
  56. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
  57. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
  58. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +12 -0
  59. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
  60. package/dist/builtin/workflows/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
  61. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
  62. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2316 -0
  63. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
  64. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
  65. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
  66. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable-paths.mjs +17 -1
  67. package/dist/builtin/workflows/skills/impeccable/scripts/is-generated.mjs +2 -2
  68. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +139 -96
  69. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +4491 -526
  70. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
  71. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
  72. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
  73. package/dist/builtin/workflows/skills/impeccable/scripts/live-event-validation.mjs +136 -0
  74. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +22 -9
  75. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert-ui.mjs +458 -0
  76. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +232 -0
  77. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
  78. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edits-buffer.mjs +152 -0
  79. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +288 -110
  80. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +47 -1
  81. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +1443 -100
  82. package/dist/builtin/workflows/skills/impeccable/scripts/live-session-store.mjs +17 -0
  83. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +17 -3
  84. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +216 -6
  85. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +2 -3
  86. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +633 -0
  87. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +1 -1
  88. package/dist/builtin/workflows/src/extension/index.ts +67 -3
  89. package/dist/builtin/workflows/src/extension/render-result.ts +26 -1
  90. package/dist/builtin/workflows/src/runs/foreground/executor.ts +227 -3
  91. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +94 -7
  92. package/dist/builtin/workflows/src/shared/stage-prompt.ts +326 -0
  93. package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +62 -7
  94. package/dist/builtin/workflows/src/shared/store-types.ts +43 -0
  95. package/dist/builtin/workflows/src/shared/store.ts +37 -0
  96. package/dist/builtin/workflows/src/tui/chat-surface-message.ts +22 -4
  97. package/dist/builtin/workflows/src/tui/graph-view.ts +47 -0
  98. package/dist/builtin/workflows/src/tui/overlay-adapter.ts +43 -1
  99. package/dist/builtin/workflows/src/tui/run-detail.ts +10 -4
  100. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +117 -15
  101. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +9 -0
  102. package/dist/core/skills.d.ts.map +1 -1
  103. package/dist/core/skills.js +2 -5
  104. package/dist/core/skills.js.map +1 -1
  105. package/dist/core/system-prompt.d.ts.map +1 -1
  106. package/dist/core/system-prompt.js +11 -29
  107. package/dist/core/system-prompt.js.map +1 -1
  108. package/dist/index.d.ts +1 -0
  109. package/dist/index.d.ts.map +1 -1
  110. package/dist/index.js +3 -0
  111. package/dist/index.js.map +1 -1
  112. package/docs/quickstart.md +1 -2
  113. package/package.json +4 -4
  114. package/dist/builtin/workflows/skills/impeccable/reference/cognitive-load.md +0 -106
  115. package/dist/builtin/workflows/skills/impeccable/reference/color-and-contrast.md +0 -105
  116. package/dist/builtin/workflows/skills/impeccable/reference/heuristics-scoring.md +0 -234
  117. package/dist/builtin/workflows/skills/impeccable/reference/motion-design.md +0 -109
  118. package/dist/builtin/workflows/skills/impeccable/reference/personas.md +0 -179
  119. package/dist/builtin/workflows/skills/impeccable/reference/responsive-design.md +0 -114
  120. package/dist/builtin/workflows/skills/impeccable/reference/spatial-design.md +0 -100
  121. package/dist/builtin/workflows/skills/impeccable/reference/teach.md +0 -156
  122. package/dist/builtin/workflows/skills/impeccable/reference/typography.md +0 -159
  123. package/dist/builtin/workflows/skills/impeccable/reference/ux-writing.md +0 -107
  124. package/dist/builtin/workflows/skills/impeccable/scripts/load-context.mjs +0 -141
@@ -37,7 +37,7 @@ Identify where delight would enhance (not distract from) the experience:
37
37
  - **Helpful surprises**: Anticipating needs before users ask (productivity tools)
38
38
  - **Sensory richness**: Satisfying sounds, smooth animations (creative tools)
39
39
 
40
- If any of these are unclear from the codebase, STOP and call the AskUserQuestion tool to clarify.
40
+ If any of these are unclear from the codebase, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer.
41
41
 
42
42
  **CRITICAL**: Delight should enhance usability, never obscure it. If users notice the delight more than accomplishing their goal, you've gone too far.
43
43
 
@@ -299,4 +299,4 @@ Test that delight actually delights:
299
299
  - **Appropriate**: Matches brand and context
300
300
  - **Accessible**: Works with reduced motion, screen readers
301
301
 
302
- When the moments feel earned, hand off to `/impeccable polish` for the final pass.
302
+ When the moments feel earned, hand off to `$impeccable polish` for the final pass.
@@ -21,7 +21,7 @@ Analyze what makes the design feel complex or cluttered:
21
21
  - What can be removed, hidden, or combined?
22
22
  - What's the 20% that delivers 80% of value?
23
23
 
24
- If any of these are unclear from the codebase, STOP and call the AskUserQuestion tool to clarify.
24
+ If any of these are unclear from the codebase, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer.
25
25
 
26
26
  **CRITICAL**: Simplicity is not about removing features. It's about removing obstacles between users and their goals. Every element should justify its existence.
27
27
 
@@ -108,4 +108,4 @@ If you removed features or options:
108
108
  - Consider if they need alternative access points
109
109
  - Note any user feedback to monitor
110
110
 
111
- When the cuts feel right, hand off to `/impeccable polish` for the final pass. As Antoine de Saint-Exupéry put it: "Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away."
111
+ When the cuts feel right, hand off to `$impeccable polish` for the final pass. As Antoine de Saint-Exupéry put it: "Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away."
@@ -45,7 +45,7 @@ Rules that matter:
45
45
  - **Token refs** use `{path.to.token}` (e.g. `{colors.primary}`, `{rounded.md}`). Components may reference primitives; primitives may not reference each other.
46
46
  - **Stitch validates colors as hex sRGB only** (`#RGB` / `#RGBA` / `#RRGGBB` / `#RRGGBBAA`); OKLCH/HSL/P3 trigger a linter warning, not a hard error. YAML accepts the string either way and our own parser is format-agnostic. Choose based on project posture: (a) if the project has an "OKLCH-only" doctrine or uses Display-P3 values that don't round-trip through sRGB, put OKLCH directly in the frontmatter and accept the Stitch linter warning; (b) if the project wants strict Stitch compliance or plans to use their Tailwind/DTCG export pipeline, put hex in the frontmatter and keep OKLCH in prose as the canonical reference. Never split the source of truth without explicit reason.
47
47
  - **Component sub-tokens** are limited to 8 props: `backgroundColor`, `textColor`, `typography`, `rounded`, `padding`, `size`, `height`, `width`. Shadows, motion, focus rings, backdrop-filter: none of those fit. Carry them in the sidecar (Step 4b).
48
- - **Scale keys are open-ended.** Use whatever names the project already uses (`warm-ash-cream`, `surface-container-low`). Don't rename to Material defaults.
48
+ - **Scale keys are open-ended.** Use whatever names the project already uses (`oxblood-deep`, `surface-container-low`). Don't rename to Material defaults.
49
49
  - **Variants are naming convention, not schema.** `button-primary` / `button-primary-hover` / `button-primary-active` as sibling keys.
50
50
 
51
51
  ## The markdown body: six sections (exact order)
@@ -61,19 +61,19 @@ Optional evocative subtitles are allowed in the form `## 2. Colors: The [Name] P
61
61
 
62
62
  ## When to run
63
63
 
64
- - The user just ran `/impeccable teach` and needs the visual side documented.
64
+ - The user just ran `$impeccable init` and needs the visual side documented.
65
65
  - The skill noticed no `DESIGN.md` exists and nudged the user to create one.
66
66
  - An existing `DESIGN.md` is stale (the design has drifted).
67
67
  - Before a large redesign, to capture the current state as a reference.
68
68
 
69
- If a `DESIGN.md` already exists, **do not silently overwrite it**. Show the user the existing file and STOP and call the AskUserQuestion tool to clarify. whether to refresh, overwrite, or merge.
69
+ If a `DESIGN.md` already exists, **do not silently overwrite it**. Show the user the existing file and STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. whether to refresh, overwrite, or merge.
70
70
 
71
71
  ## Two paths
72
72
 
73
73
  - **Scan mode** (default): the project has design tokens, components, or rendered output. Extract, then confirm descriptive language. Use when there's code to analyze.
74
- - **Seed mode**: the project is pre-implementation (fresh teach, nothing built yet). Interview for five high-level answers, write a minimal DESIGN.md marked `<!-- SEED -->`. Re-run in scan mode once there's code.
74
+ - **Seed mode**: the project is pre-implementation (fresh init, nothing built yet). Interview for five high-level answers, write a minimal DESIGN.md marked `<!-- SEED -->`. Re-run in scan mode once there's code.
75
75
 
76
- Decide by scanning first (Scan mode Step 1). If the scan finds no tokens, no component files, and no rendered site, offer seed mode; don't silently switch. `/impeccable document --seed` forces seed mode regardless of code presence.
76
+ Decide by scanning first (Scan mode Step 1). If the scan finds no tokens, no component files, and no rendered site, offer seed mode; don't silently switch. `$impeccable document --seed` forces seed mode regardless of code presence.
77
77
 
78
78
  ## Scan mode (approach C: auto-extract, then confirm descriptive language)
79
79
 
@@ -103,7 +103,7 @@ Build a structured draft from the discovered tokens. For each token class:
103
103
 
104
104
  From the auto-extracted tokens, draft the YAML frontmatter now (you'll write it at the top of DESIGN.md in Step 4). This is the machine-readable layer: what the live panel and Stitch's linter consume.
105
105
 
106
- - **Colors**: one entry per extracted color. Key = descriptive slug (`warm-ash-cream`, `editorial-magenta`, not `blue-800`). Value = whichever format the project treats as canonical (OKLCH or hex; see the frontmatter rules above). Don't split the source of truth: one format in the frontmatter, don't redefine the same token in prose with a different value.
106
+ - **Colors**: one entry per extracted color. Key = descriptive slug (`oxblood-deep`, `editorial-magenta`, not `blue-800`). Value = whichever format the project treats as canonical (OKLCH or hex; see the frontmatter rules above). Don't split the source of truth: one format in the frontmatter, don't redefine the same token in prose with a different value.
107
107
  - **Typography**: one entry per role (`display`, `headline`, `title`, `body`, `label`). Typography is an object; include only the props that are real for the project (`fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`, `fontFeature`, `fontVariation`).
108
108
  - **Rounded / Spacing**: whatever scale steps the project actually uses, keyed by whatever scale name the project uses (`sm` / `md` / `lg`, or `surface-sm`, or numeric steps).
109
109
  - **Components**: one entry per variant (`button-primary`, `button-primary-hover`, `button-ghost`). Reference primitives via `{colors.X}`, `{rounded.Y}`. If a variant needs a property Stitch's 8-prop set doesn't cover (shadow, focus ring, backdrop-filter), carry the full snippet in the sidecar instead.
@@ -253,7 +253,7 @@ Regenerate the sidecar whenever you regenerate root `DESIGN.md`. If the user onl
253
253
  "extensions": {
254
254
  "colorMeta": {
255
255
  "primary": { "role": "primary", "displayName": "Editorial Magenta", "canonical": "oklch(60% 0.25 350)", "tonalRamp": ["...", "...", "..."] },
256
- "warm-ash-cream": { "role": "neutral", "displayName": "Warm Ash Cream", "canonical": "oklch(96% 0.005 350)", "tonalRamp": ["...", "...", "..."] }
256
+ "cool-paper": { "role": "neutral", "displayName": "Cool Paper", "canonical": "oklch(96% 0.005 230)", "tonalRamp": ["...", "...", "..."] }
257
257
  },
258
258
  "typographyMeta": {
259
259
  "display": { "displayName": "Display", "purpose": "Hero headlines only." }
@@ -328,12 +328,13 @@ Pull directly from the DESIGN.md you just wrote:
328
328
 
329
329
  Do not reword. The panel shows these as secondary collapsible context; the same voice that's in the Markdown carries through.
330
330
 
331
- ### Step 5: Confirm, refine, and refresh session cache
331
+ ### Step 5: Confirm and refine
332
332
 
333
333
  1. Show the user the full DESIGN.md you wrote. Briefly highlight the non-obvious creative choices (descriptive color names, atmosphere language, named rules).
334
334
  2. Mention that `.impeccable/design.json` was also written alongside; the live panel will now render this project's actual button/input/nav primitives instead of generic approximations.
335
335
  3. Offer to refine any section: "Want me to revise a section, add component patterns I missed, or adjust the atmosphere language?"
336
- 4. **Refresh the session cache.** Run `node .claude/skills/impeccable/scripts/load-context.mjs` one final time so the newly-written DESIGN.md lands in conversation. Subsequent commands in this session will use the fresh version automatically without re-reading.
336
+
337
+ Your own write is the freshest source; subsequent commands in this session don't need a reload.
337
338
 
338
339
  ## Seed mode
339
340
 
@@ -341,7 +342,7 @@ For projects with no visual system to extract yet. Produces a minimal scaffold,
341
342
 
342
343
  ### Step 1: Confirm seed mode
343
344
 
344
- Before interviewing: "There's no existing visual system to scan. I'll ask five quick questions to seed a starter DESIGN.md. You can re-run `/impeccable document` once there's code, to capture the real tokens and components. OK?"
345
+ Before interviewing: "There's no existing visual system to scan. I'll ask five quick questions to seed a starter DESIGN.md. You can re-run `$impeccable document` once there's code, to capture the real tokens and components. OK?"
345
346
 
346
347
  If the user prefers to skip, stop. No file.
347
348
 
@@ -380,7 +381,7 @@ Use the six-section spec from Scan mode. Populate what the interview answers; le
380
381
  Lead the file with:
381
382
 
382
383
  ```markdown
383
- <!-- SEED: re-run /impeccable document once there's code to capture the actual tokens and components. -->
384
+ <!-- SEED: re-run $impeccable document once there's code to capture the actual tokens and components. -->
384
385
  ```
385
386
 
386
387
  Per-section guidance in seed mode:
@@ -394,11 +395,12 @@ Per-section guidance in seed mode:
394
395
 
395
396
  Seed mode writes a minimal frontmatter with `name` and `description` only; no colors, typography, rounded, spacing, or components yet. Real tokens land on the next Scan-mode run. Skip the `.impeccable/design.json` sidecar in seed mode for the same reason: nothing to render.
396
397
 
397
- ### Step 4: Confirm and refresh session cache
398
+ ### Step 4: Confirm
398
399
 
399
400
  1. Show the seed DESIGN.md. Call out that it is a seed (the marker is the literal commitment).
400
- 2. Tell the user: "Re-run `/impeccable document` once you have some code. That pass will extract real tokens and generate the sidecar."
401
- 3. Run `node .claude/skills/impeccable/scripts/load-context.mjs` once so the seed lands in conversation for the rest of the session.
401
+ 2. Tell the user: "Re-run `$impeccable document` once you have some code. That pass will extract real tokens and generate the sidecar."
402
+
403
+ Your own write is the freshest source; no reload needed.
402
404
 
403
405
  ## Style guidelines
404
406
 
@@ -6,7 +6,7 @@ Identify reusable patterns, components, and design tokens, then extract and cons
6
6
 
7
7
  Find the design system, component library, or shared UI directory. Understand its structure: component organization, naming conventions, design token structure, import/export conventions.
8
8
 
9
- **CRITICAL**: If no design system exists, STOP and call the AskUserQuestion tool to clarify. before creating one. Understand the preferred location and structure first.
9
+ **CRITICAL**: If no design system exists, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. before creating one. Understand the preferred location and structure first.
10
10
 
11
11
  ## Step 2: Identify Patterns
12
12
 
@@ -344,4 +344,4 @@ Test thoroughly with edge cases:
344
344
  - **Errors**: Force API errors, test all error states
345
345
  - **Empty**: Remove all data, test empty states
346
346
 
347
- When edge cases are covered, hand off to `/impeccable polish` for the final pass.
347
+ When edge cases are covered, hand off to `$impeccable polish` for the final pass.
@@ -0,0 +1,172 @@
1
+ # Init Flow
2
+
3
+ The setup command for a project. One codebase crawl feeds everything it writes:
4
+
5
+ - **PRODUCT.md** (strategic): root project file for register, target users, product purpose, brand personality, anti-references, strategic design principles. Answers "who/what/why".
6
+ - **DESIGN.md** (visual): root project file for visual theme, color palette, typography, components, layout. Follows the [Google Stitch DESIGN.md format](https://stitch.withgoogle.com/docs/design-md/format/). Answers "how it looks".
7
+ - **`.impeccable/live/config.json`** (live mode): pre-configured so `$impeccable live` boots straight into variant mode with no first-time detour.
8
+
9
+ It closes by pointing the user at the best command to run next. Every other impeccable command reads PRODUCT.md and DESIGN.md before doing any work.
10
+
11
+ ## Step 1: Load current state
12
+
13
+ Check what already exists. PRODUCT.md and DESIGN.md live at the project root, or under `.agents/context/` or `docs/` (case-insensitive). Read whichever are present with your native file tool. Also note whether `.impeccable/live/config.json` already exists (Step 6 leaves it untouched if so).
14
+
15
+ Decision tree:
16
+ - **Neither file exists (empty project or no context yet)**: do Steps 2-4 (write PRODUCT.md), then decide on DESIGN.md based on whether there's code to analyze.
17
+ - **PRODUCT.md exists, DESIGN.md missing**: skip to Step 5 and offer to run `$impeccable document` for DESIGN.md.
18
+ - **PRODUCT.md exists but has no `## Register` section (legacy)**: add it. Infer a hypothesis from the codebase (see Step 2), confirm with the user, write the field.
19
+ - **Both exist**: STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. Ask which file to refresh. Skip the one the user doesn't want changed.
20
+ - **Just DESIGN.md exists (unusual)**: do Steps 2-4 to produce PRODUCT.md.
21
+
22
+ Never silently overwrite an existing file. Always confirm first.
23
+
24
+ If init was invoked as a setup blocker by another command, such as `$impeccable craft landing page`, pause that command here. Complete init, then resume the original command. Your own writes are the freshest source; no reload needed. For craft, resume into shape next; init creates project context, but it is not a substitute for the task-specific shape interview and confirmed design brief.
25
+
26
+ ## Step 2: Explore the codebase
27
+
28
+ Before asking questions, thoroughly scan the project to discover what you can. This single crawl feeds PRODUCT.md, DESIGN.md, **and** the live-mode framework detection in Step 6, so be thorough once rather than re-scanning later:
29
+
30
+ - **README and docs**: Project purpose, target audience, any stated goals
31
+ - **Package.json / config files**: Tech stack, dependencies, existing design libraries, **and the framework** (Vite/SPA, Next.js, Nuxt, SvelteKit, Astro, multi-page static) plus the HTML entry the browser actually loads
32
+ - **Existing components**: Current design patterns, spacing, typography in use
33
+ - **Brand assets**: Logos, favicons, color values already defined
34
+ - **Design tokens / CSS variables**: Existing color palettes, font stacks, spacing scales
35
+ - **Any style guides or brand documentation**
36
+
37
+ Also form a **register hypothesis** from what you find:
38
+
39
+ - Brand signals: `/`, `/about`, `/pricing`, `/blog/*`, `/docs/*`, hero sections, big typography, scroll-driven sections, landing-page-shaped content.
40
+ - Product signals: `/app/*`, `/dashboard`, `/settings`, `/(auth)`, forms, data tables, side/top nav, app-shell components.
41
+
42
+ Register is a hypothesis at this point, not a decision; Step 3 confirms it.
43
+
44
+ Note what you've learned and what remains unclear. Also note any rough edges worth a follow-up command (thin hierarchy, flat or gray palette, missing error/empty states, dull copy); Step 7 turns these into concrete recommendations without re-analyzing.
45
+
46
+ ## Step 3: Ask strategic questions (for PRODUCT.md)
47
+
48
+ STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. Ask only about what you couldn't infer from the codebase.
49
+
50
+ ### Interview mode, not confirmation mode
51
+
52
+ If the repo is empty or the user's brief is sparse, run a short interview before proposing PRODUCT.md. Do **not** turn a one-sentence request into a complete inferred PRODUCT.md and ask for blanket confirmation.
53
+
54
+ - Use the harness's structured question tool when one exists. Otherwise, ask directly in chat and stop.
55
+ - Ask **2-3 questions per round**, then wait for answers.
56
+ - Use inferred answers as hypotheses or options, not as finished facts.
57
+ - Complete at least one real user-answer round before drafting PRODUCT.md, unless every required answer is directly discoverable from repo docs.
58
+ - Round 1 should establish register, users/purpose, and desired outcome.
59
+ - Round 2 should establish brand personality or references, anti-references, and accessibility needs.
60
+
61
+ ### Minimum viable interview
62
+
63
+ Ask enough to complete PRODUCT.md. At minimum, cover register confirmation, users and purpose, brand personality, anti-references, and accessibility needs unless each answer is directly discoverable from repo context. After at least one interview round, you may propose inferred answers, but the user must confirm them before you write PRODUCT.md. Never synthesize PRODUCT.md from the original task prompt alone.
64
+
65
+ ### Register (ask first; it shapes everything below)
66
+
67
+ Every design task is either **brand** (marketing, landing, campaign, long-form content, portfolio: design IS the product) or **product** (app UI, admin, dashboards, tools: design SERVES the product).
68
+
69
+ If Step 2 produced a clear hypothesis, lead with it: *"From the codebase, this looks like a [brand / product] surface. Does that match your intent, or should we treat it differently?"*
70
+
71
+ If the signal is genuinely split (e.g. a product with a big marketing landing), STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. Ask which register describes the **primary** surface. The register can be overridden per task later, but PRODUCT.md carries one default.
72
+
73
+ ### Users & Purpose
74
+ - Who uses this? What's their context when using it?
75
+ - What job are they trying to get done?
76
+ - For brand: what emotions should the interface evoke? (confidence, delight, calm, urgency)
77
+ - For product: what workflow are they in? What's the primary task on any given screen?
78
+
79
+ ### Brand & Personality
80
+ - How would you describe the brand personality in 3 words?
81
+ - Reference sites or apps that capture the right feel? What specifically about them?
82
+ - Push for specific named references with the *specific* thing about them that fits this brand, not generic "modern" adjectives or category-bucket lanes.
83
+ - What should this explicitly NOT look like? Any anti-references?
84
+
85
+ ### Accessibility & Inclusion
86
+ - Specific accessibility requirements? (WCAG level, known user needs)
87
+ - Considerations for reduced motion, color blindness, or other accommodations?
88
+
89
+ Skip questions where the answer is already clear. **Do NOT ask about colors, fonts, radii, or visual styling here.** Those belong in DESIGN.md, not PRODUCT.md.
90
+
91
+ ## Step 4: Write PRODUCT.md
92
+
93
+ Write PRODUCT.md only after the user has confirmed the strategic answers from Step 3. If an inferred answer is uncertain or unconfirmed, ask before writing.
94
+
95
+ Synthesize into a strategic document:
96
+
97
+ ```markdown
98
+ # Product
99
+
100
+ ## Register
101
+
102
+ product
103
+
104
+ ## Users
105
+ [Who they are, their context, the job to be done]
106
+
107
+ ## Product Purpose
108
+ [What this product does, why it exists, what success looks like]
109
+
110
+ ## Brand Personality
111
+ [Voice, tone, 3-word personality, emotional goals]
112
+
113
+ ## Anti-references
114
+ [What this should NOT look like. Specific bad-example sites or patterns to avoid.]
115
+
116
+ ## Design Principles
117
+ [3-5 strategic principles derived from the conversation. Principles like "practice what you preach", "show, don't tell", "expert confidence". NOT visual rules like "use OKLCH" or "magenta accent".]
118
+
119
+ ## Accessibility & Inclusion
120
+ [WCAG level, known user needs, considerations]
121
+ ```
122
+
123
+ Register is either `brand` or `product` as a bare value. No prose, no commentary.
124
+
125
+ Write to `PROJECT_ROOT/PRODUCT.md`. If `.impeccable.md` existed, the loader already renamed it; merge into that content rather than starting from scratch.
126
+
127
+ ## Step 5: Decide on DESIGN.md
128
+
129
+ Offer `$impeccable document` either way. Two paths:
130
+
131
+ - **Code exists** (CSS tokens, components, a running site): "I can generate a DESIGN.md that captures your visual system (colors, typography, components) so variants stay on-brand. Want to do that now?"
132
+ - **Pre-implementation** (empty project): "I can seed a starter DESIGN.md from five quick questions about color strategy, type direction, motion energy, and references. You can re-run once there's code, to capture the real tokens. Want to do that now?"
133
+
134
+ If the user agrees, delegate to `$impeccable document` (it auto-detects scan vs seed). Load its reference and follow that flow.
135
+
136
+ If the user prefers to skip, mention they can run `$impeccable document` any time later.
137
+
138
+ ## Step 6: Configure live mode (when code exists)
139
+
140
+ If the project has code with HTML entries and a dev server (the same "code exists" condition that puts `$impeccable document` in scan mode), pre-configure live mode now. You already identified the framework and the served HTML entry in Step 2, so this is nearly free, and it spares the user the first-time setup detour when they later run `$impeccable live`.
141
+
142
+ **Skip this step for empty / pre-implementation projects** (nothing to inject into yet). Tell the user live mode will configure itself the first time they run it once there's code.
143
+
144
+ **If `.impeccable/live/config.json` already exists, leave it untouched** and note that live mode is already configured.
145
+
146
+ Otherwise:
147
+
148
+ 1. Write `.impeccable/live/config.json`. Choose `files` (the HTML entries the browser actually loads), `insertBefore`, and `commentSyntax` from the framework table in [live.md](live.md)'s **First-time setup** section, using the framework you found in Step 2. That table is canonical; do not restate it here. For multi-page static sites, prefer a glob (`["public/**/*.html"]`) over a literal list.
149
+ 2. Run `node .agents/skills/impeccable/scripts/detect-csp.mjs`. If it reports a patchable shape (`append-arrays` / `append-string`), use the **consent prompt template** from live.md before editing any source file. On decline, skip the patch. For `middleware` / `meta-tag` shapes, surface the detected files and ask the user to add `http://localhost:8400` to `script-src` and `connect-src` manually. For `null`, there's nothing to do.
150
+ 3. Set `cspChecked: true` in the config once CSP is handled (patched, declined, manual, or not needed). The schema and per-shape patch details live in live.md's First-time setup; follow it rather than duplicating.
151
+
152
+ Writing the config file is harmless and needs no consent; only the CSP **source-file patch** requires a yes.
153
+
154
+ ## Step 7: Recommend starting points, then wrap up
155
+
156
+ Summarize tersely:
157
+ - Register captured (brand / product)
158
+ - What was written (PRODUCT.md, DESIGN.md, live config, or a subset)
159
+ - The 3-5 strategic principles from PRODUCT.md that will guide future work
160
+ - If DESIGN.md or live config is pending, one line on how to set it up later
161
+
162
+ Then recommend the **best commands to run next**, drawn from what your Step 2 crawl already surfaced. Do not run a fresh analysis here; surface observations you already have. Tailor to register and to what you saw, offer the 2-4 most relevant (not a menu dump), and give the exact command to type. Group by intent:
163
+
164
+ - **Build something new**: `$impeccable craft <feature>` (shape, then build end-to-end) or `$impeccable shape <feature>` (plan first). Lead with this for empty or early-stage projects.
165
+ - **Improve what's there**: name the specific surface. `$impeccable critique <page>` for a scored UX review; `$impeccable audit <area>` for a11y / perf / responsive checks; `$impeccable polish <component>` for a pre-ship pass. When the crawl flagged a specific weakness, point the matching command at it: thin hierarchy or spacing → `layout`, flat or gray palette → `colorize`, missing error / empty states → `harden` or `onboard`, dull or unclear copy → `clarify`.
166
+ - **Iterate visually**: `$impeccable live` (configured in Step 6) to pick elements in the browser and generate variants in place.
167
+
168
+ The full command menu is one bare `$impeccable` away; keep this list short and pointed.
169
+
170
+ If init was invoked as a blocker by another impeccable command (e.g. the user ran `$impeccable polish` with no PRODUCT.md), resume that original task now. Your own writes are the freshest source; no reload needed.
171
+
172
+ Optionally STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. Ask whether they'd like a brief summary of PRODUCT.md appended to AGENTS.md for easier agent reference. If yes, append a short **Design Context** pointer section there.
@@ -150,12 +150,6 @@ For browsers without anchor positioning support, `position: fixed` with manual c
150
150
 
151
151
  Check viewport boundaries before rendering. If the dropdown would overflow the bottom edge, flip it above the trigger. If it would overflow the right edge, align it to the trigger's right side instead.
152
152
 
153
- ### Anti-Patterns
154
-
155
- - **`position: absolute` inside `overflow: hidden`** - The dropdown will be clipped. Use `position: fixed` or the top layer instead.
156
- - **Arbitrary z-index values** like `z-index: 9999` - Use a semantic z-index scale: `dropdown (100) -> sticky (200) -> modal-backdrop (300) -> modal (400) -> toast (500) -> tooltip (600)`.
157
- - **Rendering dropdown markup inline** without an escape hatch from the parent's stacking context. Either use `popover` (top layer), a portal, or `position: fixed`.
158
-
159
153
  ## Destructive Actions: Undo > Confirm
160
154
 
161
155
  **Undo is better than confirmation dialogs.** Users click through confirmations mindlessly. Remove from UI immediately, show undo toast, actually delete after toast expires. Use confirmation only for truly irreversible actions (account deletion), high-cost actions, or batch operations.
@@ -1,4 +1,4 @@
1
- Space is the most underused design tool. Find the layout's actual problem (monotone spacing, weak hierarchy, identical card grids, the centered-stack default) and fix the structure, not the surface.
1
+ Space is the most underused design tool. Find the layout's actual problem (monotone spacing, weak hierarchy, identical card grids) and fix the structure, not the surface.
2
2
 
3
3
  ---
4
4
 
@@ -27,7 +27,6 @@ Analyze what's weak about the current spatial design:
27
27
  3. **Grid & structure**:
28
28
  - Is there a clear underlying structure, or does the layout feel random?
29
29
  - Are identical card grids used everywhere? (Icon + heading + text, repeated endlessly)
30
- - Is everything centered? (Left-aligned with asymmetric layouts feels more designed, but not a hard and fast rule)
31
30
 
32
31
  4. **Rhythm & variety**:
33
32
  - Does the layout have visual rhythm? (Alternating tight/generous spacing)
@@ -43,8 +42,6 @@ Analyze what's weak about the current spatial design:
43
42
 
44
43
  ## Plan Layout Improvements
45
44
 
46
- Consult the [spatial design reference](spatial-design.md) for detailed guidance on grids, rhythm, and container queries.
47
-
48
45
  Create a systematic plan:
49
46
 
50
47
  - **Spacing system**: Use a consistent scale (a framework's built-in scale like Tailwind's, rem-based tokens, or a custom system). The specific values matter less than consistency.
@@ -57,6 +54,7 @@ Create a systematic plan:
57
54
  ### Establish a Spacing System
58
55
 
59
56
  - Use a consistent spacing scale (framework scales like Tailwind, rem-based tokens, or a custom scale all work). What matters is that values come from a defined set, not arbitrary numbers.
57
+ - Prefer a 4pt base scale (4, 8, 12, 16, 24, 32, 48, 64, 96px) over 8pt; 8pt is too coarse and you'll frequently need 12px between 8 and 16.
60
58
  - Name tokens semantically if using custom properties: `--space-xs` through `--space-xl`, not `--spacing-8`
61
59
  - Use `gap` for sibling spacing instead of margins; eliminates margin collapse hacks
62
60
  - Apply `clamp()` for fluid spacing that breathes on larger screens
@@ -66,15 +64,22 @@ Create a systematic plan:
66
64
  - **Tight grouping** for related elements (8-12px between siblings)
67
65
  - **Generous separation** between distinct sections (48-96px)
68
66
  - **Varied spacing** within sections (not every row needs the same gap)
69
- - **Asymmetric compositions**: break the predictable centered-content pattern when it makes sense
67
+ - **Asymmetric compositions**: a deliberate choice when the content invites it (not a default to chase).
70
68
 
71
69
  ### Choose the Right Layout Tool
72
70
 
73
- - **Use Flexbox for 1D layouts**: Rows of items, nav bars, button groups, card contents, most component internals. Flex is simpler and more appropriate for the majority of layout tasks.
71
+ - **Use Flexbox for 1D layouts**: Rows of items, nav bars, button groups, card contents, most component internals.
74
72
  - **Use Grid for 2D layouts**: Page-level structure, dashboards, data-dense interfaces, anything where rows AND columns need coordinated control.
75
- - **Don't default to Grid** when Flexbox with `flex-wrap` would be simpler and more flexible.
76
- - Use `repeat(auto-fit, minmax(280px, 1fr))` for responsive grids without breakpoints.
77
73
  - Use named grid areas (`grid-template-areas`) for complex page layouts; redefine at breakpoints.
74
+ - Use **container queries** for components, viewport queries for page layouts. A card in a narrow sidebar can stay compact while the same card in a main content area expands automatically:
75
+
76
+ ```css
77
+ .card-container { container-type: inline-size; }
78
+ .card { display: grid; gap: var(--space-md); }
79
+ @container (min-width: 400px) {
80
+ .card { grid-template-columns: 120px 1fr; }
81
+ }
82
+ ```
78
83
 
79
84
  ### Break Card Grid Monotony
80
85
 
@@ -85,18 +90,36 @@ Create a systematic plan:
85
90
  ### Strengthen Visual Hierarchy
86
91
 
87
92
  - Use the fewest dimensions needed for clear hierarchy. Space alone can be enough; generous whitespace around an element draws the eye. Some of the most polished designs achieve rhythm with just space and weight. Add color or size contrast only when simpler means aren't sufficient.
93
+ - The best hierarchy combines 2–3 dimensions at once. A heading that's larger, bolder, AND has more space above it reads as primary without trying:
94
+
95
+ | Tool | Strong Hierarchy | Weak Hierarchy |
96
+ |------|------------------|----------------|
97
+ | **Size** | 3:1 ratio or more | <2:1 ratio |
98
+ | **Weight** | Bold vs Regular | Medium vs Regular |
99
+ | **Color** | High contrast | Similar tones |
100
+ | **Position** | Top/left (primary) | Bottom/right |
101
+ | **Space** | Surrounded by white space | Crowded |
102
+
88
103
  - Be aware of reading flow: in LTR languages, the eye naturally scans top-left to bottom-right, but primary action placement depends on context (e.g., bottom-right in dialogs, top in navigation).
89
104
  - Create clear content groupings through proximity and separation.
90
105
 
91
106
  ### Manage Depth & Elevation
92
107
 
93
- - Create a semantic z-index scale (dropdown → sticky → modal-backdrop → modal → toast → tooltip)
94
108
  - Build a consistent shadow scale (sm → md → lg → xl); shadows should be subtle
95
109
  - Use elevation to reinforce hierarchy, not as decoration
96
110
 
97
111
  ### Optical Adjustments
98
112
 
99
113
  - If an icon looks visually off-center despite being geometrically centered, nudge it. But only if you're confident it actually looks wrong. Don't adjust speculatively.
114
+ - Text at `margin-left: 0` looks slightly indented because of letterform whitespace; a negative margin (`-0.05em`) optically aligns it. Geometrically centered glyphs often look off-center (play icons need to shift right, arrows shift toward their direction).
115
+ - Touch targets must be 44×44px minimum even when the visual element is smaller. Expand the hit area with padding or a pseudo-element:
116
+
117
+ ```css
118
+ .icon-button { width: 24px; height: 24px; position: relative; }
119
+ .icon-button::before {
120
+ content: ''; position: absolute; inset: -10px;
121
+ }
122
+ ```
100
123
 
101
124
  **NEVER**:
102
125
  - Use arbitrary spacing values outside your scale
@@ -104,10 +127,7 @@ Create a systematic plan:
104
127
  - Wrap everything in cards (not everything needs a container)
105
128
  - Nest cards inside cards (use spacing and dividers for hierarchy within)
106
129
  - Use identical card grids everywhere (icon + heading + text, repeated)
107
- - Center everything (left-aligned with asymmetry feels more designed)
108
130
  - Default to the hero metric layout (big number, small label, stats, gradient) as a template. If showing real user data, a prominent metric can work, but it should display actual data, not decorative numbers.
109
- - Default to CSS Grid when Flexbox would be simpler; use the simplest tool for the job
110
- - Use arbitrary z-index values (999, 9999); build a semantic scale
111
131
 
112
132
  ## Verify Layout Improvements
113
133
 
@@ -118,7 +138,7 @@ Create a systematic plan:
118
138
  - **Consistency**: Is the spacing system applied uniformly?
119
139
  - **Responsiveness**: Does the layout adapt gracefully across screen sizes?
120
140
 
121
- When the rhythm and hierarchy land, hand off to `/impeccable polish` for the final pass.
141
+ When the rhythm and hierarchy land, hand off to `$impeccable polish` for the final pass.
122
142
 
123
143
  ## Live-mode signature params
124
144