@adia-ai/adia-ui-factory 0.2.2 → 0.2.3

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 (94) hide show
  1. package/.claude-plugin/plugin.json +12 -3
  2. package/CHANGELOG.md +8 -0
  3. package/README.md +24 -1
  4. package/bin/adia-scaffold +93 -13
  5. package/package.json +2 -2
  6. package/references/shell-embed.md +10 -0
  7. package/references/spa-architecture.md +7 -0
  8. package/skills/adia-ui-kit/CHANGELOG.md +41 -0
  9. package/skills/adia-ui-kit/SKILL.md +442 -0
  10. package/skills/adia-ui-kit/assets/figma-make/guidelines/Guidelines.md +87 -0
  11. package/skills/adia-ui-kit/assets/figma-make/guidelines/components.md +142 -0
  12. package/skills/adia-ui-kit/assets/figma-make/guidelines/styles.md +118 -0
  13. package/skills/adia-ui-kit/assets/figma-make/guidelines/tokens.md +120 -0
  14. package/skills/adia-ui-kit/assets/team-scaffold/archive-README.md +30 -0
  15. package/skills/adia-ui-kit/assets/team-scaffold/drafts-README.md +57 -0
  16. package/skills/adia-ui-kit/assets/team-scaffold/inbox-README.md +76 -0
  17. package/skills/adia-ui-kit/assets/team-scaffold/outbox-README.md +46 -0
  18. package/skills/adia-ui-kit/assets/team-scaffold/team-root.README.md +51 -0
  19. package/skills/adia-ui-kit/assets/team-scaffold/tickets-README.md +208 -0
  20. package/skills/adia-ui-kit/assets/team-scaffold/tickets-REGISTRY.md +81 -0
  21. package/skills/adia-ui-kit/assets/templates/AGENTS.template.md +128 -0
  22. package/skills/adia-ui-kit/assets/templates/CLAUDE.template.md +1 -0
  23. package/skills/adia-ui-kit/assets/templates/FEEDBACK-OMISSIONS-DEFENSE.template.md +150 -0
  24. package/skills/adia-ui-kit/assets/templates/FEEDBACK.template.md +213 -0
  25. package/skills/adia-ui-kit/assets/templates/RESPONSE.template.md +114 -0
  26. package/skills/adia-ui-kit/assets/templates/figma-make-guidelines.md +90 -0
  27. package/skills/adia-ui-kit/evals/adversarial-content-trust.json +83 -0
  28. package/skills/adia-ui-kit/evals/evals.json +55 -0
  29. package/skills/adia-ui-kit/evals/routing-corpus.json +121 -0
  30. package/skills/adia-ui-kit/evals/teach-routing-cases.json +92 -0
  31. package/skills/adia-ui-kit/references/capabilities.md +245 -0
  32. package/skills/adia-ui-kit/references/catalog-lookup.md +186 -0
  33. package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v1.md +8 -0
  34. package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v2.md +3585 -0
  35. package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v3.md +1899 -0
  36. package/skills/adia-ui-kit/references/common-gotchas-consumer.md +522 -0
  37. package/skills/adia-ui-kit/references/component-literacy.md +291 -0
  38. package/skills/adia-ui-kit/references/composition.md +245 -0
  39. package/skills/adia-ui-kit/references/correction-loop.md +462 -0
  40. package/skills/adia-ui-kit/references/css-policy.md +343 -0
  41. package/skills/adia-ui-kit/references/decision-model.md +158 -0
  42. package/skills/adia-ui-kit/references/diagnostic-output.md +57 -0
  43. package/skills/adia-ui-kit/references/docs-catalog.md +239 -0
  44. package/skills/adia-ui-kit/references/exclusions.md +225 -0
  45. package/skills/adia-ui-kit/references/feedback-authoring.md +466 -0
  46. package/skills/adia-ui-kit/references/figma-make.md +244 -0
  47. package/skills/adia-ui-kit/references/flows-auth.md +307 -0
  48. package/skills/adia-ui-kit/references/flows-content.md +206 -0
  49. package/skills/adia-ui-kit/references/flows-data.md +348 -0
  50. package/skills/adia-ui-kit/references/flows-interaction.md +181 -0
  51. package/skills/adia-ui-kit/references/flows-shells.md +336 -0
  52. package/skills/adia-ui-kit/references/gap-detection.md +266 -0
  53. package/skills/adia-ui-kit/references/harness.md +284 -0
  54. package/skills/adia-ui-kit/references/loading-protocol.md +406 -0
  55. package/skills/adia-ui-kit/references/local-link.md +198 -0
  56. package/skills/adia-ui-kit/references/mcp.md +401 -0
  57. package/skills/adia-ui-kit/references/migration.md +116 -0
  58. package/skills/adia-ui-kit/references/mission.md +194 -0
  59. package/skills/adia-ui-kit/references/mode-routing.md +298 -0
  60. package/skills/adia-ui-kit/references/patterns-agent.md +223 -0
  61. package/skills/adia-ui-kit/references/patterns-data.md +1066 -0
  62. package/skills/adia-ui-kit/references/patterns-forms.md +223 -0
  63. package/skills/adia-ui-kit/references/patterns-layout.md +326 -0
  64. package/skills/adia-ui-kit/references/patterns-recipes.md +1416 -0
  65. package/skills/adia-ui-kit/references/patterns-shells.md +1097 -0
  66. package/skills/adia-ui-kit/references/patterns-traits.md +259 -0
  67. package/skills/adia-ui-kit/references/patterns-wiring.md +339 -0
  68. package/skills/adia-ui-kit/references/pev-rationale.md +137 -0
  69. package/skills/adia-ui-kit/references/reasoning-gate.md +146 -0
  70. package/skills/adia-ui-kit/references/reasoning-methodologies.md +112 -0
  71. package/skills/adia-ui-kit/references/recon.md +192 -0
  72. package/skills/adia-ui-kit/references/rendering-model.md +431 -0
  73. package/skills/adia-ui-kit/references/response-authoring.md +398 -0
  74. package/skills/adia-ui-kit/references/session-log-schema.md +203 -0
  75. package/skills/adia-ui-kit/references/session-log-template.md +118 -0
  76. package/skills/adia-ui-kit/references/setup.md +652 -0
  77. package/skills/adia-ui-kit/references/skill-hygiene.md +135 -0
  78. package/skills/adia-ui-kit/references/spec-to-ui-reasoning.md +394 -0
  79. package/skills/adia-ui-kit/references/state.md +229 -0
  80. package/skills/adia-ui-kit/references/teach-protocol.md +421 -0
  81. package/skills/adia-ui-kit/references/theme.md +142 -0
  82. package/skills/adia-ui-kit/references/version-check.md +69 -0
  83. package/skills/adia-ui-kit/scripts/audit-decision-trace.mjs +198 -0
  84. package/skills/adia-ui-kit/scripts/audit-kit-roster.mjs +366 -0
  85. package/skills/adia-ui-kit/scripts/changelog-archive.mjs +126 -0
  86. package/skills/adia-ui-kit/scripts/check-adia-versions.py +404 -0
  87. package/skills/adia-ui-kit/scripts/run-skill-evals.mjs +358 -0
  88. package/skills/adia-ui-kit/scripts/validate-session-log.mjs +242 -0
  89. package/skills/adia-ui-kit/skill.json +102 -0
  90. package/skills/adia-ui-migration/CHANGELOG.md +47 -0
  91. package/skills/adia-ui-migration/SKILL.md +381 -0
  92. package/skills/adia-ui-migration/skill.json +29 -0
  93. package/skills/adia-ui-spa/SKILL.md +1 -1
  94. package/skills/adia-ui-verify/SKILL.md +2 -2
@@ -0,0 +1,343 @@
1
+ ---
2
+ name: css-policy
3
+ load-when: Before §Setup — when an agent needs the explicit-import CSS policy (why side-effect CSS imports are forbidden, the CDN-bundle table, the /with-css opt-in, reserved layout attribute names, the v0.6.32 CDN bundle correctness milestone)
4
+ load-size-tokens: ~4,400
5
+ required-for:
6
+ - CDN consumers (mode 7)
7
+ - bundler consumers (mode 6)
8
+ - admin-shell layout work
9
+ - icon-loader troubleshooting
10
+ ---
11
+
12
+ # §CSSPolicy — Explicit-import CSS policy (read before §Setup confuses you)
13
+
14
+ **Normative policy decision** for `@adia-ai/*` packages: **no component
15
+ JS module self-imports its CSS.** This applies uniformly across
16
+ `@adia-ai/web-components` primitives AND `@adia-ai/web-modules` shells.
17
+ Consumers are responsible for explicitly importing every CSS file they
18
+ need.
19
+
20
+ Confirmed and re-affirmed 2026-05-20 in response to claims-ui F-006
21
+ (`admin-shell.js` produces an unstyled stacked-divs layout when its CSS
22
+ isn't imported). The policy is the design — F-006 is a documentation gap,
23
+ not a code bug. The cold-start cost is intentional.
24
+
25
+ ### Why explicit-import (the reasoning)
26
+
27
+ 1. **Light-DOM cascade control.** Components render into the light DOM
28
+ (no shadow root). Consumer styles + AdiaUI styles share one cascade.
29
+ If component CSS auto-loaded, it would arrive in whatever order JS
30
+ resolves modules — sometimes after the consumer's overrides, sometimes
31
+ before. Explicit imports let the consumer place AdiaUI CSS at a
32
+ deterministic point in their entry file (typically *before* their
33
+ own brand overrides).
34
+
35
+ 2. **Tree-shake honesty.** A self-importing component pulls its CSS
36
+ even when the consumer never instantiates it. The barrel import
37
+ `@adia-ai/web-components` registers ~95 custom elements; if each
38
+ shipped a side-effect CSS import, every consumer would pay the
39
+ full-catalog CSS cost regardless of which primitives they actually
40
+ render. Today: `@adia-ai/web-components/css` is the explicit
41
+ single-line opt-in for the full catalog — predictable, removable.
42
+
43
+ 3. **Density / theme layering.** Consumers commonly want
44
+ `<base-tokens> → <brand-overrides> → <component-CSS> → <density-overrides>`.
45
+ Explicit imports make this trivial. Side-effect imports embedded in
46
+ JS make it hard.
47
+
48
+ 4. **Light-DOM means CSS is data, not implementation.** Treating CSS
49
+ as an artifact the consumer schedules (not the framework's side
50
+ effect) keeps the consumer in control of layout, color, and
51
+ density decisions.
52
+
53
+ ### What this policy means for consumers (the cold-start contract)
54
+
55
+ Every AdiaUI surface needs THREE explicit CSS imports at minimum:
56
+
57
+ ```ts
58
+ // 1. Design tokens — must arrive first
59
+ import '@adia-ai/web-components/css';
60
+
61
+ // 2. Brand overrides — your tokens replacing theirs (optional)
62
+ import './my-brand-tokens.css';
63
+
64
+ // 3. Shell CSS — REQUIRED for every shell tag you use
65
+ import '@adia-ai/web-modules/shell/admin-shell.css';
66
+ // import '@adia-ai/web-modules/chat/chat-shell.css';
67
+ // import '@adia-ai/web-modules/editor/editor-shell.css';
68
+ // import '@adia-ai/web-modules/simple/simple-shell.css';
69
+ ```
70
+
71
+ **The first time a consumer renders a shell without (3), they get an
72
+ unstyled stacked-divs layout. That's the policy operating as intended.**
73
+
74
+ ### What this policy does NOT mean
75
+
76
+ - ❌ It does NOT mean per-primitive CSS imports are required.
77
+ `@adia-ai/web-components/css` is the catalog barrel — one import
78
+ covers all 100+ primitives. Per-primitive imports
79
+ (`@adia-ai/web-components/components/button.css`) exist for
80
+ tree-shaking, not as the default expectation.
81
+ - ❌ It does NOT forbid future opt-in side-effect bundles. A
82
+ `/with-css` subpath variant (e.g.
83
+ `@adia-ai/web-modules/shell/admin-shell/with-css`) that re-exports the
84
+ JS + side-effect-imports the CSS would be acceptable. Such variants
85
+ are **opt-in**; the default subpath (without `/with-css`) must
86
+ preserve the explicit-import contract.
87
+ - ❌ It does NOT mean every primitive needs its own CSS file. CSS
88
+ organization within `@adia-ai/web-components` is a maintainer
89
+ concern; the policy governs the consumer-facing API.
90
+
91
+ ### Opt-in `/with-css` variants (since v0.6.10)
92
+
93
+ The policy ships an explicit carve-out: a `/with-css` companion subpath
94
+ that opts INTO side-effect CSS imports. The default subpath remains
95
+ explicit-import (policy intact); the `/with-css` companion is the
96
+ single canonical exception. Available for the 4 shells:
97
+
98
+ ```js
99
+ // Default subpath — explicit-import contract (works in every Vite version,
100
+ // gives you tree-shake + cascade control + theme-layering)
101
+ import '@adia-ai/web-modules/shell/admin-shell';
102
+ import '@adia-ai/web-modules/shell/admin-shell.css'; // explicit
103
+
104
+ // Opt-in /with-css — single import, side-effect CSS included
105
+ import '@adia-ai/web-modules/shell/admin-shell/with-css';
106
+ // ^^^^^^^^ subpath companion
107
+ ```
108
+
109
+ The same pair exists for `chat-shell`, `editor-shell`, `simple-shell`.
110
+
111
+ **When to use the opt-in form:**
112
+
113
+ - Cold-start onboarding (one fewer line to remember; one fewer way to
114
+ forget the CSS)
115
+ - Quick prototypes / demos where tree-shake doesn't matter
116
+ - Documentation / tutorial examples where the goal is "render
117
+ something fast"
118
+
119
+ **When to STAY on the default form:**
120
+
121
+ - Production builds where bundle size matters
122
+ - Applications with custom theme layering (the explicit form lets you
123
+ insert your theme CSS between the tokens import and the shell CSS)
124
+ - Applications composing multiple shells (the explicit form lets you
125
+ cherry-pick which shells' CSS load when)
126
+
127
+ **Why this is policy-safe:**
128
+
129
+ The carve-out is **explicit by name**: a consumer who writes
130
+ `/with-css` has knowingly opted into side-effect CSS imports for THAT
131
+ import statement. The default subpath (`@adia-ai/web-modules/shell/admin-shell`)
132
+ preserves the original explicit-import contract for everyone else. No
133
+ silent behavior change; no breakage for existing consumers; no policy
134
+ fork.
135
+
136
+ **Future scope (v0.7.0+):**
137
+
138
+ Primitive-level `/with-css` variants (e.g. `@adia-ai/web-components/components/button-ui/with-css`)
139
+ are NOT shipping in v0.6.x. The 56 primitives × build cost don't fit
140
+ the patch slice. If consumer demand materializes, evaluate for v0.7.0.
141
+ Until then, primitives stay on the explicit-import contract uniformly.
142
+
143
+ ### CDN-bundle path (since v0.6.29 for CSS, v0.6.30 for JS)
144
+
145
+ A third consumption tier alongside explicit-import (default) and
146
+ `/with-css` (opt-in npm form): the **CDN-bundle path** ships
147
+ pre-flattened + minified CSS + JS via jsdelivr/unpkg. Consumers link
148
+ directly from HTML — no bundler, no npm install, no build step.
149
+
150
+ **The contract** — three tags get you a working page:
151
+
152
+ ```html
153
+ <link rel="stylesheet"
154
+ href="https://cdn.jsdelivr.net/npm/@adia-ai/web-components@0.7/dist/web-components.min.css">
155
+ <link rel="stylesheet"
156
+ href="https://cdn.jsdelivr.net/npm/@adia-ai/web-modules@0.7/dist/shell/admin-shell.min.css">
157
+ <script type="module"
158
+ src="https://cdn.jsdelivr.net/npm/@adia-ai/web-modules@0.7/dist/everything.min.js"></script>
159
+ ```
160
+
161
+ **The 4-tier policy taxonomy now**:
162
+
163
+ | Tier | Path shape | Tree-shake? | Theme layering? | When to use |
164
+ |------|-----------|-------------|-----------------|-------------|
165
+ | **Explicit-import** (default) | `import '@adia-ai/web-components/css'` + per-shell `*.css` | ✓ (with bundler) | ✓ (insert overrides between imports) | Production apps; brand-overrides; cherry-picked shells |
166
+ | **`/with-css`** (opt-in npm) | `import '@adia-ai/web-modules/shell/admin-shell/with-css'` | ✗ (kitchen sink) | ✗ (CSS is side-effect) | Cold-start; prototypes; tutorial code |
167
+ | **CDN-bundle** (HTML-first) | `<link rel="stylesheet" href="cdn.jsdelivr.net/.../dist/*.min.css">` + `<script type="module" src=".../dist/everything.min.js">` | ✗ (kitchen sink, ~1 MB raw / ~330 KB Brotli) | ✗ (one bundle, no insertion points) | HTML-only; CodePen; marketing; agent-in-fresh-repo |
168
+ | **`<theme-provider>`** (adopt-from-anywhere · v0.7.12 · experimental) | `import '@adia-ai/web-components/components/theme-provider'` then `<theme-provider theme="ocean" scale="prose">…</theme-provider>` | ✗ (adopts the whole foundation once into `document.adoptedStyleSheets`) | ✓ (`theme=` preset + `scale=` register, adopted on demand) | SPA roots / embedded apps / dynamic mounts with **no `<head>` access**; coexists with the `<link>` path |
169
+
170
+ > **`<theme-provider>` — adopt the foundation from anywhere (v0.7.12, experimental).**
171
+ > A `display: contents` wrapper (own no box) that, at module-eval, adopts the
172
+ > constructable-stylesheet twin of `web-components.min.css` (the `./css/sheet`
173
+ > export — `import '@adia-ai/web-components/css/sheet'` for the raw sheet) into
174
+ > `document.adoptedStyleSheets` once, deduped. So a SPA root / embedded app / dynamic
175
+ > mount renders fully-styled **without a hand-wired `<link>` in `<head>`**. Opt-in
176
+ > `theme="ocean|forest|sunset|lavender|rose|slate|midnight"` and `scale="verse|prose"`
177
+ > adopt their layer twin on demand. **Deliberately NOT in the all-primitives barrel**
178
+ > (it carries the whole foundation) — import the `components/theme-provider` subpath
179
+ > explicitly. Use the `<link>`/CDN path for multi-page top-level surfaces (cacheable,
180
+ > no flash); the provider for no-`<head>` contexts.
181
+
182
+ **Why this is still policy-safe**: the CDN bundles are pre-built
183
+ artifacts in `dist/` — they don't violate the **no JS module
184
+ self-imports CSS** rule because they're explicit `<link>` tags in the
185
+ HTML head (no JS module imports), AND they don't violate the **carve-out
186
+ is explicit by name** rule because the consumer is explicitly choosing
187
+ the CDN URL rather than an npm import path.
188
+
189
+ **Pick ONE JS bundle path within CDN mode.** Mixing
190
+ `@adia-ai/web-modules/.../everything.min.js` with
191
+ `@adia-ai/web-components/.../web-components.min.js` causes
192
+ `customElements.define` to throw "name already defined". Choices:
193
+
194
+ | Bundle | Use case |
195
+ |--------|----------|
196
+ | `web-modules/.../everything.min.js` | CodePen / kitchen-sink / "just make it work" (registers all 100+ primitives + a2ui-runtime + 17 module-tier shells/parts via `defineIfFree`; v0.6.32 bundle ships with `icons-manifest.js` baked in) |
197
+ | `web-components/.../web-components.min.js` + per-shell `*.min.js` | Primitives + one specific shell |
198
+ | `web-components/.../web-components.min.js` alone | Primitives only, no shells |
199
+
200
+ > ⚠️ **`everything.min.js` ≤ v0.6.31 was shells-only (751 KB) — broken
201
+ > in published tarballs at v0.6.29/0.6.30/0.6.31.** The bundle did NOT
202
+ > register primitives (`search-ui`, `select-ui`, `field-ui`,
203
+ > `stat-ui`, `row-ui`, etc.) — consumers following the CDN-first
204
+ > guidance hit a hard `TypeError: Cannot read properties of undefined
205
+ > (reading 'toLowerCase')` on any code that touched a primitive
206
+ > element's `.value`. Root cause: `bundle-js.mjs` used
207
+ > `packages/web-modules/index.js` as the entry, which only re-exports
208
+ > shell clusters — no primitives registration.
209
+ >
210
+ > **Fix landed in v0.6.32+**: new `packages/web-modules/everything.js`
211
+ > entry file imports `@adia-ai/web-components` (registering all
212
+ > primitives) BEFORE re-exporting `./index.js` (shells).
213
+ > `everything.min.js` is now ~1 MB raw / ~330 KB Brotli wire, with
214
+ > 100+ primitives + 17 shells registered.
215
+ >
216
+ > **If pinned to ≤0.6.31**, EITHER (a) upgrade to ≥0.6.32, OR (b) load
217
+ > `web-components.min.js` BEFORE `everything.min.js` (defineIfFree on
218
+ > primitive registrations + direct define on shells; verify no
219
+ > "already defined" throws for the overlapping elements: tab-ui,
220
+ > stat-ui, a2ui-root, canvas-ui).
221
+
222
+ > ⚠️ **`web-components.min.js` icon support depends on
223
+ > `icons-manifest.js` co-distribution (v0.6.32+).** The primitives
224
+ > bundle does `import("./icons-manifest.js")` at runtime to load icon
225
+ > SVG data. In versions ≤0.6.31 the manifest was NOT shipped in the
226
+ > tarball — CDN consumers got a silent 404 and all `icon=` attributes
227
+ > failed to render SVGs (non-fatal but visually broken).
228
+ >
229
+ > **Fix landed in v0.6.32+**: `packages/web-components/dist/icons-manifest.js`
230
+ > is now a tracked dist artifact (256 KB, 9,072 icon names) generated
231
+ > by `scripts/build/bundle-js.mjs`. The manifest includes a `cdn` key
232
+ > pointing to `@phosphor-icons/core@2.1.1/assets/` so SVGs fetch from
233
+ > jsdelivr (not `/node_modules/...`). CDN icons now work end-to-end
234
+ > without consumer-side setup.
235
+ >
236
+ > **If pinned to ≤0.6.31** and using `web-components.min.js`: any
237
+ > `icon=` attribute silently fails. Upgrade to ≥0.6.32 OR use
238
+ > `everything.min.js` (which inlines icon data directly — but see the
239
+ > previous callout: `everything.min.js` ≤0.6.31 also has the
240
+ > shells-only bug, so the only working pre-0.6.32 path is the
241
+ > dual-bundle workaround).
242
+
243
+ **Authoritative reference**: `references/setup.md` Step 0.5 (peer authored
244
+ in the v0.6.30 cycle); full CDN docs at
245
+ [`ui-kit.exe.xyz/site/getting-started/cdn-usage`](https://ui-kit.exe.xyz/site/getting-started/cdn-usage);
246
+ working CodePen template at
247
+ [`examples/codepen.html`](https://github.com/adiahealth/gen-ui-kit/blob/main/examples/codepen.html).
248
+
249
+ ### Reserved layout-helper attribute names (admin-shell scoping)
250
+
251
+ `admin-shell.helpers.css` ships 5 layout-utility attribute selectors
252
+ intended for use INSIDE `<admin-shell>`:
253
+
254
+ ```css
255
+ admin-shell [data-col] { display: flex; flex-direction: column; … }
256
+ admin-shell [data-row] { display: flex; align-items: center; … }
257
+ admin-shell [data-grid] { display: grid; grid-template-columns: 1fr 1fr; … }
258
+ admin-shell [data-actions]{ display: flex; align-items: center; … }
259
+ admin-shell [data-spacer] { flex: 1; }
260
+ ```
261
+
262
+ > ⚠️ **`[data-col]`, `[data-row]`, `[data-grid]`, `[data-actions]`,
263
+ > `[data-spacer]` are reserved layout-helper attribute names.**
264
+ > Loading `admin-shell.min.css` on a page that uses any of these
265
+ > attribute names on non-admin-shell elements (or on `<admin-shell>`
266
+ > descendants where the application of `display: flex/grid` is
267
+ > unintended) WILL apply layout to those elements. **In Safari/WebKit
268
+ > this silently breaks `<table>` layout** when `<th data-col="N">` or
269
+ > similar matches the bare `[data-col]` selector — the table renders
270
+ > with `<thead>` as a vertical left column and `<tbody>` shifted right.
271
+ >
272
+ > **Mitigation already shipped (v0.6.31 source, v0.6.32+ dist)**: all 5
273
+ > selectors prefixed with `admin-shell` ancestor. Versions ≤ v0.6.30
274
+ > shipped bare global selectors and remain broken for CDN consumers
275
+ > pinned to those versions.
276
+ >
277
+ > **Defense for new authoring**: do NOT use `data-col` / `data-row` /
278
+ > `data-grid` / `data-actions` / `data-spacer` for arbitrary table
279
+ > headers, sortable columns, or any non-admin-shell layout marker.
280
+ > Namespaced names (`data-page-col`, `data-my-actions`, `data-sort-col`)
281
+ > sidestep the collision entirely. Even after the v0.6.32 scoping fix,
282
+ > the names remain reserved within admin-shell descendants — using
283
+ > `data-col` on a `<th>` that happens to live inside an
284
+ > `<admin-page-body>` table will still apply `display: flex`.
285
+
286
+ **Why `admin-shell` ancestor and not `@scope`**: the admin-shell build
287
+ pipeline emits 0 `@scope` blocks in its dist CSS (LightningCSS strips
288
+ them or the source never authored them). The parent-tag selector is
289
+ the only reliable CDN-safe scoping mechanism for these helpers.
290
+
291
+ ### Operational rules — CDN-bundle path lead-with
292
+ - When the user's intent is "quick prototype" / "static HTML" / "CodePen demo" /
293
+ "no bundler" — **lead with CDN, not bundler**. The setup discussion is
294
+ one paragraph instead of an 8-step procedure.
295
+ - When the user's intent is "production app" / "we use Vite" / "tree-shake matters" —
296
+ **stay on the explicit-import tier**. The CDN bundle's kitchen-sink
297
+ payload is over-fetched compared to a tree-shaken Vite build.
298
+ - When the user lands in a repo with NO `package.json` (per §Recon
299
+ Gap class 0 detection) — **mention both paths**: (1) `npm init` +
300
+ bundler + explicit-import, OR (2) zero-install CDN. Let the operator
301
+ choose. Historically the gate was "ship deps with `npm install`"; CDN
302
+ removes that as the only option.
303
+
304
+ ### Operational rules (for skill, docs, and tooling)
305
+
306
+ - **Skill examples** (this skill, README files in `@adia-ai/*` packages,
307
+ USAGE.md): every shell-using code example MUST show the matching CSS
308
+ import. Pattern callouts MUST flag missing CSS imports as the most
309
+ common cold-start failure mode (see §Patterns → Admin shell anatomy).
310
+ - **CI gate** (recommended; not yet implemented): a release-time audit
311
+ that grep-greps every `*-shell.js` and `*-ui.js` for `import .*\\.css`
312
+ and fails if any are found. This catches accidental policy drift.
313
+ - **Migration path**: if the policy ever changes (e.g. a new ADR adopts
314
+ side-effect CSS), it MUST be a coordinated MAJOR-version cut across
315
+ all 9 `@adia-ai/*` packages, accompanied by a MIGRATION GUIDE entry.
316
+
317
+ ### Consumer-side migration helpers
318
+
319
+ For consumers who hit the unstyled-stacked-divs failure mode:
320
+
321
+ 1. **Run a Playwright probe** that takes a screenshot of the rendered
322
+ shell. If it visually matches "unstyled stacked divs", the diagnosis
323
+ is "missing shell CSS import".
324
+ 2. **Check your entry file** for `import '@adia-ai/web-modules/shell/<name>.css'`.
325
+ If missing, add it.
326
+ 3. **Verify the path shape**: `./shell/<name>.css` (the export-map
327
+ wildcard resolves this to `./shell/<name>/<name>.css` on disk).
328
+ Pre-v0.6.7 docs incorrectly showed the disk shape; v2.4.1 of this
329
+ skill corrected it.
330
+
331
+ ### Cross-references
332
+
333
+ - `claims-ui/.agent/team/tickets/README.md` §F-006 (the cold-start
334
+ failure that surfaced the policy ambiguity).
335
+ - `.brain/notes/2026-05-20-claims-ui-feedback-followup.md` §F-006
336
+ (peer-agent synthesis + the user-direction quote that pinned the
337
+ policy).
338
+ - `§Patterns → Admin shell anatomy` (the pitfall callout that warns
339
+ consumers about the missing-CSS failure mode).
340
+ - `§Setup` step 3 (the actual import lines, now with all 4 shell variants).
341
+
342
+
343
+ ---
@@ -0,0 +1,158 @@
1
+ # DecisionModel — Orphan-Component Audit Contract (advisory in v3.1.0)
2
+
3
+ **Status.**
4
+ - v3.1.0: **ADVISORY** — `scripts/audit-decision-trace.mjs` runs in `--advisory` mode by default (reports findings; never fails CI). Goal: collect ≥3 weeks of real-world traces to calibrate the orphan-component definition.
5
+ - v3.2.0+ (planned): **HARD-FAIL** — same script with `--strict`. Promotion gate: zero false-positive findings observed across ≥3 weeks of advisory-mode traces, AND the orphan definition stable for ≥2 minor releases.
6
+
7
+ Per REFACTOR-SPEC P5(b). Counter-proposal accepted by user 2026-05-22 (Phase 4 advisory rollout — split P5 into P5(a) session-log + P5(b) DecisionModel; ship both in v3.1.0; advisory-only for P5(b) until 2026-08-22 BORIS §B3 checkpoint at the earliest).
8
+
9
+ ---
10
+
11
+ ## The Contract
12
+
13
+ A **decision** is a named choice between two or more **possible actions**, resolved by a **required signal**. Every component the agent names in a composition output (modes 1-4) should trace to ≥1 decision's `possible_actions` array.
14
+
15
+ The shape:
16
+
17
+ ```json
18
+ {
19
+ "decision": "string — what was being decided (≤ 120 chars, in English)",
20
+ "required_signal": "string — what input the decision depended on",
21
+ "possible_actions": ["action-a", "action-b", "action-c"],
22
+ "chosen_action": "string — must be one of possible_actions",
23
+ "rationale": "string — why this signal mapped to this action"
24
+ }
25
+ ```
26
+
27
+ Each entry in `possible_actions` is either:
28
+ - a **component tag** (e.g. `button-ui`, `simple-shell`, `editor-canvas`), or
29
+ - a **higher-level intent label** that itself decomposes into named components later (e.g. `none (raw)`, `marketing-hero-recipe`, `chat-shell-anatomy`).
30
+
31
+ The audit traces forward: every component tag named in the agent's output must appear in some decision's `possible_actions` or `chosen_action`.
32
+
33
+ ---
34
+
35
+ ## What it catches (the jagged-edge problem)
36
+
37
+ **Jagged-edge composition** = the agent names a component that wasn't connected to any tracked decision. Either:
38
+ - (a) the component is genuinely a good idea but the agent skipped surfacing the decision (loss of audit trail, hard to retro why later), OR
39
+ - (b) the component is hallucinated / wrong-fit (the agent named it without a decision because there wasn't a real reason).
40
+
41
+ Both are bugs in different ways. (a) is a discipline gap — the decision happened in the agent's head but didn't get logged. (b) is a correctness bug — the component appeared from nowhere.
42
+
43
+ The audit doesn't distinguish (a) from (b); it surfaces both as "orphan-component" findings and lets the operator decide.
44
+
45
+ ---
46
+
47
+ ## Worked Example — login page composition
48
+
49
+ ### DecisionModel (3 decisions)
50
+
51
+ ```json
52
+ [
53
+ {
54
+ "decision": "which shell wraps the login page",
55
+ "required_signal": "page chrome needs",
56
+ "possible_actions": ["admin-shell", "simple-shell", "editor-shell", "none (raw)"],
57
+ "chosen_action": "simple-shell",
58
+ "rationale": "login pages are standalone marketing-style pages without admin chrome"
59
+ },
60
+ {
61
+ "decision": "input control for the email field",
62
+ "required_signal": "is the value type email + does the form need validation",
63
+ "possible_actions": ["input-ui type=email", "form-field with input-ui", "email-input-ui"],
64
+ "chosen_action": "form-field with input-ui",
65
+ "rationale": "form-field wraps label + validation + error display; we need all three"
66
+ },
67
+ {
68
+ "decision": "submit affordance for the form",
69
+ "required_signal": "is this a primary form action with potential loading state",
70
+ "possible_actions": ["button-ui variant=primary", "submit-button-ui", "form-actions slot"],
71
+ "chosen_action": "button-ui variant=primary [type=submit] [loading]",
72
+ "rationale": "single primary action; button-ui supports the loading state for in-flight submit"
73
+ }
74
+ ]
75
+ ```
76
+
77
+ ### Generated composition
78
+
79
+ ```html
80
+ <simple-shell>
81
+ <simple-hero>
82
+ <h1>Sign in</h1>
83
+ </simple-hero>
84
+ <form>
85
+ <field-ui label="Email">
86
+ <input-ui type="email" required></input-ui>
87
+ </field-ui>
88
+ <field-ui label="Password">
89
+ <input-ui type="password" required></input-ui>
90
+ </field-ui>
91
+ <button-ui variant="primary" type="submit">Sign in</button-ui>
92
+ </form>
93
+ </simple-shell>
94
+ ```
95
+
96
+ ### Audit walk
97
+
98
+ | Tag | Decision matched | Status |
99
+ |---|---|---|
100
+ | `simple-shell` | Decision 1 (`chosen_action`) | ✓ traced |
101
+ | `simple-hero` | — | ✗ **ORPHAN** (no decision named it) |
102
+ | `form-field` | Decision 2 (`chosen_action`) | ✓ traced |
103
+ | `input-ui` | Decision 2 (inside chosen_action) | ✓ traced (partial — second use for password is implicit) |
104
+ | `button-ui` | Decision 3 (`chosen_action`) | ✓ traced |
105
+
106
+ → 1 orphan finding: `simple-hero` was named without a decision. The agent should either (a) retroactively add Decision 4 ("which heading affordance — `simple-hero` vs raw `h1` vs `page-header-ui`?"), or (b) accept it as an obvious idiom and add it to the project-specific allowlist.
107
+
108
+ ---
109
+
110
+ ## Allowlist mechanism (escape hatch)
111
+
112
+ Some idioms are universal enough that surfacing a decision is overkill (e.g. `<h1>` inside `<simple-hero>`, `<p>` inside any text container). Per-project allowlist at `.agents/skills/adia-ui-kit/.decision-trace-allowlist.json`:
113
+
114
+ ```json
115
+ {
116
+ "version": "1",
117
+ "allowed_orphans": [
118
+ {
119
+ "tag": "h1",
120
+ "rationale": "raw heading — universal idiom, no decision needed"
121
+ },
122
+ {
123
+ "tag": "h2",
124
+ "rationale": "raw heading — universal idiom"
125
+ },
126
+ {
127
+ "tag": "p",
128
+ "rationale": "raw paragraph — universal idiom"
129
+ }
130
+ ]
131
+ }
132
+ ```
133
+
134
+ The audit subtracts allowlist entries from findings. Allowlist additions should themselves be justified (the `rationale` field is required).
135
+
136
+ ---
137
+
138
+ ## What v3.1.0 ships
139
+
140
+ - `scripts/audit-decision-trace.mjs` — runs in advisory mode by default. Reads a JSONL session log (per `session-log-schema.md`), extracts `decision_made` and `component_named` events, walks the trace, reports orphan-component findings.
141
+ - `references/decision-model.md` — this document.
142
+ - **No SKILL.md hard requirement** that agents emit DecisionModel events in v3.1.0 — emission is opt-in / advisory.
143
+
144
+ ## What v3.2.0+ may add
145
+
146
+ - Hard-fail mode in `audit-decision-trace.mjs --strict` wired into `check:skills:strict`.
147
+ - Agents in modes 1-4 emit `decision_made` events before every component_named (per BORIS §Plan-Execute-Verify discipline).
148
+ - Promotion gate: ≥3 weeks of advisory-mode traces with manual review confirming 0 false-positive orphans, OR a stable definition of orphan-vs-allowed.
149
+
150
+ ---
151
+
152
+ ## Cross-references
153
+
154
+ - `scripts/audit-decision-trace.mjs` — the runtime audit
155
+ - `references/session-log-schema.md` — the JSONL event format that this audit consumes
156
+ - `references/teach-protocol.md` — branch-D decisions about NEW methodologies land here
157
+ - REFACTOR-SPEC P5(b) — origin of this contract
158
+ - AGENTS.md Plan-Execute-Verify rule (§14) — the discipline that DecisionModel mechanizes
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: diagnostic-output
3
+ load-when: When authoring a §DiagnosticOutput repo-health report — the 7-section template that pairs with §Recon + §GapDetection
4
+ load-size-tokens: ~700
5
+ required-for:
6
+ - mode 5 (consultant) audit-output authoring
7
+ ---
8
+
9
+ # 7. Overall posture assessment
10
+
11
+ One-paragraph bottom-line summary the report-reader can carry into a
12
+ hallway conversation. The shape:
13
+
14
+ > `<Repo>` is in **<strong | moderate | weak> adoption state** — ~N%
15
+ > canonical, with M consumer-side gaps (X spec-drift, Y hygiene, Z
16
+ > upstream-deferred). The biggest leverage finding is `<Gap N>`. Roughly
17
+ > `<the best | a representative | a struggling>` consumer the substrate
18
+ > currently has. **Recommended next action:** `<Sweep K>` (`<effort>`).
19
+ > Defer the rest until `<trigger condition>`.
20
+
21
+ This section is mandatory; skipping it leaves the report consumer with
22
+ a ranked gap list but no narrative. Sections 1–6 are exhaustive; §7 is
23
+ the tl;dr.
24
+ ````
25
+
26
+ ### Discipline rules for the diagnostic report
27
+
28
+ 1. **Evidence is mandatory.** Every gap must cite at least one
29
+ `<file:line>` or grep output. Findings without evidence get rejected.
30
+ 2. **Mechanism before remediation.** State *why* the gap exists before
31
+ *how* to fix it. A remediation without a mechanism is a workaround.
32
+ 3. **Leverage ranking is explicit.** Gaps with no leverage estimate
33
+ don't appear in the report — they go in §5 (out-of-scope) with the
34
+ deliberate-exclusion rationale.
35
+ 4. **PATCH-scoped sweeps only.** Each remediation must fit a single
36
+ PATCH cut (additive, non-breaking). Bigger sweeps decompose into N
37
+ PATCH cuts ranked by leverage.
38
+ 5. **Hand off; do not author.** The report ends. The user reads it and
39
+ either confirms, scopes, or rejects each sweep. Authoring proceeds
40
+ from a *confirmed* plan — never from an inferred one.
41
+
42
+ ### Anti-patterns
43
+
44
+ - **Dumping recon output as "the report."** Recon is raw inventory;
45
+ the report is a *synthesis* of inventory + gaps + plan. A grep dump
46
+ is not a report.
47
+ - **Ranking gaps by personal interest instead of leverage.** "I want
48
+ to refactor the shells" is not leverage; "8 shells × 12 LOC each
49
+ replaceable with 4 LOC each = -64 LOC net" is.
50
+ - **Proposing remediation without verification.** Every sweep needs a
51
+ gate that confirms it landed. If no gate exists, propose one as
52
+ part of the sweep.
53
+ - **Skipping out-of-scope.** §5 is load-bearing — it shows the user
54
+ what you *considered and rejected*, which builds trust faster than
55
+ any other section.
56
+
57
+ ---