@adia-ai/adia-ui-forge 0.1.3 → 0.8.1

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 (259) hide show
  1. package/.claude-plugin/plugin.json +4 -7
  2. package/CHANGELOG.md +35 -34
  3. package/README.md +35 -40
  4. package/agents/a2ui-engineer.md +22 -53
  5. package/agents/component-author.md +29 -0
  6. package/agents/framework-verifier.md +26 -0
  7. package/agents/release-engineer.md +21 -81
  8. package/agents/routing-corpus.json +293 -64
  9. package/bin/demo-postwrite-pattern-gate +94 -0
  10. package/bin/forge-lint +17 -2
  11. package/bin/sidecar-prewrite-guard +104 -0
  12. package/commands/deploy.md +9 -0
  13. package/commands/dogfood.md +10 -0
  14. package/commands/gen-review.md +9 -0
  15. package/commands/release.md +10 -0
  16. package/hooks/hooks.json +15 -0
  17. package/package.json +3 -6
  18. package/references/contracts/a2ui-mcp-surface.md +35 -0
  19. package/references/contracts/migration-guide-format.md +34 -0
  20. package/references/shared/content-trust.md +19 -74
  21. package/skills/adia-a2ui/SKILL.md +99 -0
  22. package/skills/{adia-ui-a2ui → adia-a2ui}/evals/routing-corpus.json +10 -10
  23. package/skills/adia-a2ui/references/anti-patterns.md +27 -0
  24. package/skills/adia-a2ui/references/chunk-authoring.md +71 -0
  25. package/skills/adia-a2ui/references/corpus-discipline.md +68 -0
  26. package/skills/adia-a2ui/references/eval-diagnostics.md +86 -0
  27. package/skills/adia-a2ui/references/format-extension-decisions.md +66 -0
  28. package/skills/adia-a2ui/references/leverage-rules.md +52 -0
  29. package/skills/adia-a2ui/references/mcp-pipeline-ops.md +83 -0
  30. package/skills/adia-a2ui/references/mcp-tool-reference.md +59 -0
  31. package/skills/adia-a2ui/references/pipeline-overview.md +115 -0
  32. package/skills/adia-a2ui/references/semantic-fail-lifting.md +74 -0
  33. package/skills/adia-a2ui/references/strategy-engines.md +109 -0
  34. package/skills/adia-a2ui/references/zettel-calibration.md +104 -0
  35. package/skills/adia-author/SKILL.md +112 -0
  36. package/skills/adia-author/evals/routing-corpus.json +222 -0
  37. package/skills/{adia-ui-authoring → adia-author}/references/anti-patterns.md +33 -4
  38. package/skills/{adia-ui-authoring → adia-author}/references/authoring-cycle.md +9 -11
  39. package/skills/adia-author/references/canonical-pattern-index.md +243 -0
  40. package/skills/{adia-ui-authoring → adia-author}/references/code-style.md +19 -21
  41. package/skills/adia-author/references/common-gotchas.md +129 -0
  42. package/skills/adia-author/references/composite-demo-protocol.md +271 -0
  43. package/skills/{adia-ui-authoring → adia-author}/references/css-patterns.md +19 -6
  44. package/skills/{adia-ui-authoring → adia-author}/references/lifecycle-patterns.md +1 -0
  45. package/skills/{adia-ui-authoring → adia-author}/references/llm-bridge.md +3 -5
  46. package/skills/{adia-ui-authoring → adia-author}/references/module-promotion.md +20 -38
  47. package/skills/{adia-ui-authoring → adia-author}/references/primitive-audit.md +2 -4
  48. package/skills/{adia-ui-authoring → adia-author}/references/shell-patterns.md +12 -18
  49. package/skills/{adia-ui-authoring → adia-author}/references/token-contract.md +5 -7
  50. package/skills/{adia-ui-authoring → adia-author}/references/worked-example.md +3 -3
  51. package/skills/{adia-ui-authoring → adia-author}/references/yaml-contract.md +3 -3
  52. package/skills/{adia-ui-authoring → adia-author}/scripts/build-canonical-pattern-index.mjs +3 -3
  53. package/skills/adia-deploy/SKILL.md +128 -0
  54. package/skills/{adia-ui-ops → adia-deploy}/references/deploy-playbooks.md +47 -30
  55. package/skills/adia-dogfood/SKILL.md +124 -0
  56. package/skills/adia-dogfood/references/admin-shell-anatomy.md +77 -0
  57. package/skills/adia-dogfood/references/app-shell-pitfalls.md +66 -0
  58. package/skills/adia-dogfood/references/card-anatomy-sweep.md +66 -0
  59. package/skills/adia-dogfood/references/html-attr-sweep.md +63 -0
  60. package/skills/adia-dogfood/references/native-leak-annotations.md +73 -0
  61. package/skills/adia-dogfood/references/visual-probe-triage.md +80 -0
  62. package/skills/{adia-ui-dogfood → adia-dogfood}/scripts/analyze.mjs +30 -14
  63. package/skills/adia-gen-review/SKILL.md +127 -0
  64. package/skills/adia-gen-review/references/corpus-html-patterns.md +279 -0
  65. package/skills/adia-gen-review/references/loop-protocol.md +216 -0
  66. package/skills/adia-gen-review/references/rubric-cosmetic.md +100 -0
  67. package/skills/adia-gen-review/references/rubric-decompose.md +101 -0
  68. package/skills/adia-gen-review/references/rubric-score.md +214 -0
  69. package/skills/{adia-ui-gen-review → adia-gen-review}/references/scores.schema.json +2 -2
  70. package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-coverage-audit.mjs +4 -4
  71. package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-decompose.mjs +10 -6
  72. package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-status.mjs +5 -5
  73. package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/validate-cycle-scores.mjs +5 -5
  74. package/skills/adia-llm-internals/SKILL.md +77 -0
  75. package/skills/{adia-ui-llm → adia-llm-internals}/references/adapter-contract.md +4 -2
  76. package/skills/{adia-ui-llm → adia-llm-internals}/references/add-a-provider.md +4 -5
  77. package/skills/{adia-ui-llm → adia-llm-internals}/references/bridge-facade.md +10 -3
  78. package/skills/{adia-ui-llm → adia-llm-internals}/references/browser-proxy-boundary.md +1 -1
  79. package/skills/{adia-ui-llm → adia-llm-internals}/references/model-registry.md +5 -3
  80. package/skills/{adia-ui-llm → adia-llm-internals}/references/streaming-sse.md +2 -2
  81. package/skills/adia-release/SKILL.md +72 -0
  82. package/skills/adia-release/references/changelog-discipline.md +119 -0
  83. package/skills/adia-release/references/cut-procedure.md +247 -0
  84. package/skills/adia-release/references/gates-catalog.md +222 -0
  85. package/skills/adia-release/references/independent-package-release.md +52 -0
  86. package/skills/adia-release/references/migration-guide-authoring.md +86 -0
  87. package/skills/adia-release/references/notes-authoring.md +90 -0
  88. package/skills/adia-release/references/recovery-paths.md +106 -0
  89. package/skills/{adia-ui-release → adia-release}/scripts/bump.mjs +28 -3
  90. package/skills/{adia-ui-release → adia-release}/scripts/dispatch-publish.mjs +10 -7
  91. package/skills/{adia-ui-release → adia-release}/scripts/insert-stub.mjs +1 -1
  92. package/skills/{adia-ui-release → adia-release}/scripts/package-paths.mjs +6 -0
  93. package/skills/{adia-ui-release → adia-release}/scripts/promote-unreleased.mjs +1 -1
  94. package/skills/{adia-ui-release → adia-release}/scripts/release-pack.mjs +38 -31
  95. package/skills/{adia-ui-release → adia-release}/scripts/tag-lockstep.mjs +7 -3
  96. package/skills/adia-site-docs/SKILL.md +68 -0
  97. package/skills/adia-site-docs/evals/audit-report.md +30 -0
  98. package/skills/adia-site-docs/evals/routing-corpus.json +176 -0
  99. package/skills/adia-site-docs/intent.md +72 -0
  100. package/agents/README.md +0 -209
  101. package/agents/author.md +0 -56
  102. package/agents/repo-steward.md +0 -56
  103. package/agents/spec-architect.md +0 -53
  104. package/agents/tech-lead.md +0 -57
  105. package/agents/verifier.md +0 -55
  106. package/bin/lib/audit-axes.mjs +0 -555
  107. package/bin/lib/dry-run-irreversible.mjs +0 -236
  108. package/bin/lib/run-skill-evals.mjs +0 -487
  109. package/bin/lib/teach-router.mjs +0 -250
  110. package/commands/adia-forge-a2ui.md +0 -10
  111. package/commands/adia-forge-author.md +0 -10
  112. package/commands/adia-forge-dogfood.md +0 -8
  113. package/commands/adia-forge-llm.md +0 -8
  114. package/commands/adia-forge-orient.md +0 -10
  115. package/commands/adia-forge-release.md +0 -8
  116. package/commands/adia-forge-review.md +0 -10
  117. package/references/shared/pev-rationale.md +0 -64
  118. package/references/shared/skill-conventions.md +0 -133
  119. package/skills/adia-ui-a2ui/CHANGELOG.md +0 -32
  120. package/skills/adia-ui-a2ui/SKILL.md +0 -243
  121. package/skills/adia-ui-a2ui/evals/adversarial-corpus.json +0 -75
  122. package/skills/adia-ui-a2ui/evals/teach-routing-cases.json +0 -100
  123. package/skills/adia-ui-a2ui/references/anti-patterns.md +0 -24
  124. package/skills/adia-ui-a2ui/references/chunk-authoring.md +0 -88
  125. package/skills/adia-ui-a2ui/references/corpus-discipline.md +0 -56
  126. package/skills/adia-ui-a2ui/references/eval-diagnostics.md +0 -127
  127. package/skills/adia-ui-a2ui/references/fragment-graph.md +0 -91
  128. package/skills/adia-ui-a2ui/references/mcp-pipeline-ops.md +0 -106
  129. package/skills/adia-ui-a2ui/references/mcp-tool-reference.md +0 -398
  130. package/skills/adia-ui-a2ui/references/pipeline-overview.md +0 -175
  131. package/skills/adia-ui-a2ui/references/semantic-fail-lifting.md +0 -120
  132. package/skills/adia-ui-a2ui/references/strategy-engines.md +0 -111
  133. package/skills/adia-ui-a2ui/references/teach-protocol.md +0 -220
  134. package/skills/adia-ui-a2ui/references/zettel-calibration.md +0 -93
  135. package/skills/adia-ui-a2ui/scripts/audit-a2ui-roster.mjs +0 -96
  136. package/skills/adia-ui-a2ui/scripts/teach-route.mjs +0 -157
  137. package/skills/adia-ui-a2ui/skill.json +0 -38
  138. package/skills/adia-ui-authoring/CHANGELOG.md +0 -32
  139. package/skills/adia-ui-authoring/SKILL.md +0 -256
  140. package/skills/adia-ui-authoring/assets/case-studies/admin-shell-decomposition.md +0 -101
  141. package/skills/adia-ui-authoring/assets/case-studies/maxtokens-32768-discovery.md +0 -109
  142. package/skills/adia-ui-authoring/assets/case-studies/theme-panel-promotion.md +0 -113
  143. package/skills/adia-ui-authoring/evals/adversarial-design-plan-gates.json +0 -138
  144. package/skills/adia-ui-authoring/evals/routing-corpus.json +0 -245
  145. package/skills/adia-ui-authoring/references/canonical-pattern-index.md +0 -179
  146. package/skills/adia-ui-authoring/references/common-gotchas.md +0 -93
  147. package/skills/adia-ui-authoring/references/composite-demo-protocol.md +0 -1084
  148. package/skills/adia-ui-authoring/references/teach-protocol.md +0 -428
  149. package/skills/adia-ui-authoring/scripts/audit-authoring-roster.mjs +0 -148
  150. package/skills/adia-ui-authoring/skill.json +0 -45
  151. package/skills/adia-ui-dogfood/CHANGELOG.md +0 -17
  152. package/skills/adia-ui-dogfood/README.md +0 -62
  153. package/skills/adia-ui-dogfood/SKILL.md +0 -866
  154. package/skills/adia-ui-dogfood/skill.json +0 -40
  155. package/skills/adia-ui-forge/SKILL.md +0 -88
  156. package/skills/adia-ui-forge/evals/routing-corpus.json +0 -30
  157. package/skills/adia-ui-gen-review/CHANGELOG.md +0 -108
  158. package/skills/adia-ui-gen-review/SKILL.md +0 -266
  159. package/skills/adia-ui-gen-review/references/loop-protocol.md +0 -712
  160. package/skills/adia-ui-gen-review/references/rubric-cosmetic.md +0 -144
  161. package/skills/adia-ui-gen-review/references/rubric-decompose.md +0 -117
  162. package/skills/adia-ui-gen-review/references/rubric-score.md +0 -249
  163. package/skills/adia-ui-gen-review/references/teach-protocol.md +0 -214
  164. package/skills/adia-ui-gen-review/skill.json +0 -23
  165. package/skills/adia-ui-llm/CHANGELOG.md +0 -25
  166. package/skills/adia-ui-llm/SKILL.md +0 -165
  167. package/skills/adia-ui-llm/evals/adversarial-corpus.json +0 -75
  168. package/skills/adia-ui-llm/evals/routing-corpus.json +0 -30
  169. package/skills/adia-ui-llm/evals/teach-routing-cases.json +0 -73
  170. package/skills/adia-ui-llm/references/teach-protocol.md +0 -78
  171. package/skills/adia-ui-llm/scripts/audit-llm-roster.mjs +0 -93
  172. package/skills/adia-ui-llm/scripts/teach-route.mjs +0 -119
  173. package/skills/adia-ui-llm/skill.json +0 -33
  174. package/skills/adia-ui-ops/CHANGELOG.md +0 -291
  175. package/skills/adia-ui-ops/SKILL.md +0 -401
  176. package/skills/adia-ui-ops/references/INDEX.md +0 -158
  177. package/skills/adia-ui-ops/references/audit-cadence.md +0 -263
  178. package/skills/adia-ui-ops/references/audit-patterns/archive-link-sweep.md +0 -96
  179. package/skills/adia-ui-ops/references/audit-patterns/audit-history-ledger.md +0 -162
  180. package/skills/adia-ui-ops/references/audit-patterns/browser-bundle-node-imports.md +0 -154
  181. package/skills/adia-ui-ops/references/audit-patterns/changelog-unreleased-bloat.md +0 -75
  182. package/skills/adia-ui-ops/references/audit-patterns/coverage-gaps.md +0 -187
  183. package/skills/adia-ui-ops/references/audit-patterns/entry-file-coverage.md +0 -122
  184. package/skills/adia-ui-ops/references/audit-patterns/format-hygiene.md +0 -217
  185. package/skills/adia-ui-ops/references/audit-patterns/lockstep-versioning.md +0 -113
  186. package/skills/adia-ui-ops/references/audit-patterns/memory-fragmentation.md +0 -180
  187. package/skills/adia-ui-ops/references/audit-patterns/orphan-detection.md +0 -202
  188. package/skills/adia-ui-ops/references/audit-patterns/pointer-validation.md +0 -180
  189. package/skills/adia-ui-ops/references/audit-patterns/redundancy-detection.md +0 -210
  190. package/skills/adia-ui-ops/references/audit-patterns/spec-dating-sweep.md +0 -91
  191. package/skills/adia-ui-ops/references/audit-patterns/stale-content.md +0 -182
  192. package/skills/adia-ui-ops/references/audit-patterns/staleness-tooling.md +0 -156
  193. package/skills/adia-ui-ops/references/audit-patterns/token-waste-detection.md +0 -196
  194. package/skills/adia-ui-ops/references/doc-types/adr-pattern.md +0 -210
  195. package/skills/adia-ui-ops/references/doc-types/architecture-md.md +0 -190
  196. package/skills/adia-ui-ops/references/doc-types/changelog.md +0 -183
  197. package/skills/adia-ui-ops/references/doc-types/decisions-log.md +0 -146
  198. package/skills/adia-ui-ops/references/doc-types/plan-roadmap.md +0 -182
  199. package/skills/adia-ui-ops/references/doc-types/postmortem-pattern.md +0 -206
  200. package/skills/adia-ui-ops/references/genres/prose-and-writing.md +0 -149
  201. package/skills/adia-ui-ops/references/guidance/context-budget.md +0 -137
  202. package/skills/adia-ui-ops/references/guidance/llm-doc-writing.md +0 -116
  203. package/skills/adia-ui-ops/references/guidance/reliability-dial.md +0 -186
  204. package/skills/adia-ui-ops/references/recipes/adr-introduction.md +0 -211
  205. package/skills/adia-ui-ops/references/recipes/audit-existing-repo.md +0 -234
  206. package/skills/adia-ui-ops/references/recipes/cold-start-harvest.md +0 -263
  207. package/skills/adia-ui-ops/references/recipes/concurrent-learnings-merge.md +0 -158
  208. package/skills/adia-ui-ops/references/recipes/continuous-learning-loop.md +0 -169
  209. package/skills/adia-ui-ops/references/recipes/external-reference-verification.md +0 -158
  210. package/skills/adia-ui-ops/references/recipes/findings-index-readout.md +0 -126
  211. package/skills/adia-ui-ops/references/recipes/greenfield-setup.md +0 -252
  212. package/skills/adia-ui-ops/references/recipes/harvest-repo-brain.md +0 -169
  213. package/skills/adia-ui-ops/references/recipes/import-repo-brain-harvest.md +0 -153
  214. package/skills/adia-ui-ops/references/recipes/memory-organization.md +0 -182
  215. package/skills/adia-ui-ops/references/recipes/recommend-then-validate.md +0 -199
  216. package/skills/adia-ui-ops/references/recipes/self-healing-hooks.md +0 -366
  217. package/skills/adia-ui-ops/references/recipes/skill-stewardship-loop.md +0 -113
  218. package/skills/adia-ui-ops/references/standards/agents-md-spec.md +0 -138
  219. package/skills/adia-ui-ops/references/standards/claude-md-convention.md +0 -123
  220. package/skills/adia-ui-ops/references/standards/cross-tool-matrix.md +0 -85
  221. package/skills/adia-ui-ops/references/standards/readme-conventions.md +0 -232
  222. package/skills/adia-ui-ops/references/teach-protocol.md +0 -215
  223. package/skills/adia-ui-ops/scripts/audit-ops-roster.mjs +0 -104
  224. package/skills/adia-ui-ops/skill.json +0 -65
  225. package/skills/adia-ui-release/CHANGELOG.md +0 -66
  226. package/skills/adia-ui-release/SKILL.md +0 -323
  227. package/skills/adia-ui-release/assets/case-studies/2026-05-20-batch-push-v0.6.14-v0.6.15.md +0 -144
  228. package/skills/adia-ui-release/assets/case-studies/2026-05-20-corpus-drift-remediation-v0.6.15.md +0 -155
  229. package/skills/adia-ui-release/assets/case-studies/2026-05-20-version-skip-correction-v0.6.12.md +0 -114
  230. package/skills/adia-ui-release/assets/case-studies/2026-05-21-author-from-scratch-v0.6.18.md +0 -139
  231. package/skills/adia-ui-release/assets/case-studies/2026-05-21-feedback37-retraction-v0.6.21.md +0 -124
  232. package/skills/adia-ui-release/assets/case-studies/2026-05-21-fn1-enrichment-pass-v0.6.19.md +0 -125
  233. package/skills/adia-ui-release/assets/case-studies/2026-05-21-stale-test-detection-v0.6.20.md +0 -142
  234. package/skills/adia-ui-release/assets/case-studies/2026-05-23-freshness-gate-recovery-v0.6.32.md +0 -97
  235. package/skills/adia-ui-release/assets/case-studies/2026-05-26-catalog-drift-recurring-v0.6.40.md +0 -147
  236. package/skills/adia-ui-release/assets/templates/stub-changelog.template.md +0 -22
  237. package/skills/adia-ui-release/evals/evals.json +0 -164
  238. package/skills/adia-ui-release/references/changelog-discipline.md +0 -250
  239. package/skills/adia-ui-release/references/cycle-happy-path.md +0 -520
  240. package/skills/adia-ui-release/references/exe-deploy.md +0 -149
  241. package/skills/adia-ui-release/references/gates-catalog.md +0 -778
  242. package/skills/adia-ui-release/references/independent-package-release.md +0 -129
  243. package/skills/adia-ui-release/references/ledger-discipline.md +0 -232
  244. package/skills/adia-ui-release/references/migration-guide-authoring.md +0 -174
  245. package/skills/adia-ui-release/references/multi-agent-baseline.md +0 -207
  246. package/skills/adia-ui-release/references/notes-authoring.md +0 -212
  247. package/skills/adia-ui-release/references/recovery-paths.md +0 -262
  248. package/skills/adia-ui-release/references/rollup-notes.md +0 -208
  249. package/skills/adia-ui-release/references/teach-protocol.md +0 -468
  250. package/skills/adia-ui-release/scripts/audit-gate-roster.mjs +0 -196
  251. package/skills/adia-ui-release/scripts/make-ledger.mjs +0 -200
  252. package/skills/adia-ui-release/skill.json +0 -77
  253. package/skills/dogfood-sweep/CHANGELOG.md +0 -37
  254. package/skills/dogfood-sweep/README.md +0 -105
  255. package/skills/dogfood-sweep/SKILL.md +0 -1000
  256. package/skills/dogfood-sweep/analyze.mjs +0 -600
  257. package/skills/dogfood-sweep/skill.json +0 -31
  258. /package/skills/{adia-ui-authoring → adia-author}/references/api-contract.md +0 -0
  259. /package/skills/{adia-ui-release → adia-release}/scripts/assert-monorepo-root.mjs +0 -0
@@ -1,120 +0,0 @@
1
- # Reference: Semantic fail lifting — sub-60 fail triage procedure
2
-
3
- **Source:** Absorbed from the former `zettel-internals` skill (§Semantic Fail Lifting) — Phase 3 rollup. **Used by:** mode 5 of `adia-ui-a2ui` (lift semantic fails). **Companion:** `strategy-engines.md`, `zettel-calibration.md`, `eval-diagnostics.md`.
4
-
5
- ---
6
-
7
- ## Semantic Fail Lifting
8
-
9
- Use when `npm run eval:diff -- --engine zettel --semantic` reports any intent with `semanticScore < 60` or `< 70`. These are rows where the judge says the UI emitted for an intent doesn't actually match what was asked for.
10
-
11
- ## What a sem fail looks like
12
-
13
- The judge scores on 3 axes:
14
-
15
- - **dominantPattern** (weight 0.5) — does the root/primary component match the intent type? (chat, form, calendar, data-display, nav…)
16
- - **requiredCapabilities** (weight 0.35) — are the specific controls the intent requires actually present?
17
- - **forbiddenNoise** (weight 0.15) — are off-topic components prominent?
18
-
19
- A sub-60 score almost always means dominantPattern scored < 40.
20
-
21
- ## Triage procedure
22
-
23
- 1. Read the latest eval run's `zettel.json` — find rows with `semanticScore < 70`, sorted ascending.
24
- 2. For each row, read `row.semanticAxes.dominantPattern.{expected, observed}` and `row.semanticAxes.requiredCapabilities.missing`.
25
- 3. Group failures into three buckets:
26
- - **Thin composition** — retrieved comp exists but is too sparse (e.g., calendar-month-view had nav + weekday labels only, no grid).
27
- - **Wrong composition winning** — retrieval collision; a different comp steals the intent via keyword overlap (e.g., empty-state won "error state with retry" because its keywords included both).
28
- - **No matching composition exists** — need to author a new one (e.g., no accordion-settings composition existed; drawer-panel won instead).
29
-
30
- ## Fix strategies (in order of preference)
31
-
32
- ### Strategy A — Use a domain-specific primitive as the root
33
-
34
- The judge weights root component identity and component counts heavily. A Card wrapping 38 Badges
35
-
36
- - 43 Texts reads as "data-display" even if a 7-column Grid is inside. Swapping to a semantically-correct primitive fixes this instantly.
37
-
38
- Examples that worked:
39
-
40
- - calendar: `CalendarPicker` (not Grid of Text) → 32→65
41
- - chat: `Chat` > `Text[role=user|assistant]` (not Row+Text bubbles) → 52→70+
42
- - command palette: `Command` > `ActionItem` (not Command > Text) → 42→70+
43
-
44
- Check the registry (75+ components) before authoring children. **These do NOT exist**: `ChatMessage`, `CommandItem`, `TimelineItem`. Use:
45
-
46
- - Chat children → `Text` with `role="user"|"assistant"`
47
- - Command children → `ActionItem`
48
- - Timeline children → freeform (e.g., Row + Icon + Text + Badge)
49
-
50
- Inspect `packages/web-components/components/<name>/<name>.a2ui.json` for the component's props/slots/examples before writing the composition.
51
-
52
- ### Strategy B — Resolve retrieval collisions by keyword surgery
53
-
54
- When an unrelated comp wins retrieval, don't just enrich the correct comp — also **strip overlapping keywords from the losing comp**.
55
-
56
- Worked example: `empty-state.json` had keywords `["empty", "empty state", "no results", "illustration", "error state", "retry", "nothing"]`. Added new `error-state-retry` composition BUT empty-state still won for "error state with retry" (sem=32) until its keywords dropped `"error state"` and `"retry"`. Then error-state-retry won at sem=91.
57
-
58
- ### Strategy C — Author a new composition when none exists
59
-
60
- Indicators:
61
-
62
- - Multiple intents fail pointing at the same wrong candidate
63
- - Candidate's `dominantPattern.expected` ≠ any existing comp's purpose
64
-
65
- When authoring:
66
-
67
- - Use `card-header-with-description` fragment for the top (top-leverage fragment at 36+ uses)
68
- - Use `labeled-toggle` / `labeled-input` fragments for form controls — boosts reuse ratio
69
- - Put the pattern's signature affordance as the dominant child (Timeline[mode=steps] for a wizard, Textarea+Richtext for an editor, Accordion for settings, etc.)
70
- - Rich keyword set (15-20 terms) with exact intent phrases and domain synonyms ("import wizard", "csv import", "multi-step form")
71
-
72
- ## Build + verify loop
73
-
74
- After each change:
75
-
76
- node scripts/build/components.mjs # rebuild
77
- node scripts/build/components.mjs --verify # confirm clean
78
-
79
- Then run the semantic eval (cached, so only changed intents re-judge):
80
-
81
- node packages/a2ui/mcp/scripts/eval-diff.mjs --engine zettel --semantic
82
-
83
- Compare `avgSem` and the sub-60 list row by row. Cache is content-hashed on (rubricVersion, intent, a2ui-messages) — only changed generations re-judge.
84
-
85
- ## Don't regress reuse ratio
86
-
87
- Adding new compositions without fragments lowers corpus reuse. Threshold is 29.9% (`fragment_refs / composition_nodes`). Watch the post-build line:
88
-
89
- fragment refs: 197 across 664 composition nodes (reuse 29.7%)
90
-
91
- Fixes that lift reuse while keeping sem gains:
92
-
93
- - Use existing fragments (card-header-with-description, labeled-toggle, labeled-input, footer-cancel-save, icon-title-description) in every new composition
94
- - Extract an intra-composition fragment if a subtree repeats 10+ times (see `fragment-graph.md` — leverage rule exception #2)
95
-
96
- ## Verification before done
97
-
98
- Full gate sweep:
99
-
100
- node scripts/build/components.mjs --verify \
101
- && npm run smoke:engines \
102
- && npm run smoke:register-engine \
103
- && npm run test:a2ui \
104
- && node packages/a2ui/mcp/scripts/eval-diff.mjs --engine zettel --semantic
105
-
106
- Thresholds to hold:
107
-
108
- - coverage = 100
109
- - avgScore ≥ 88 (structural)
110
- - avgSem > baseline
111
- - reuse ratio ≥ 29.9%
112
- - test:a2ui green (+ 1 skipped OK)
113
-
114
- ## Session outcomes cheat sheet
115
-
116
- A representative lift cycle — all lifts came from Strategy A + B + C combinations:
117
-
118
- calendar-month-view 32 → 65 (A: CalendarPicker root) event-calendar-details 32 → 72 (A: same comp rewrite) error-state-retry 32 → 91 (C: new comp + B: strip empty-state kwds) accordion-settings 32 → 92 (C: new comp, Accordion root) chat-interface 52 → 70+ (A: Chat > Text[role]) command-palette 42 → 70+ (A: Command > ActionItem + shortcuts) data-import-wizard 38 → 70+ (C: new, Timeline[mode=steps] + Upload) markdown-editor-preview 42 → 70+ (C: new, Textarea + Richtext split) notification-preferences 62 → 70+ (C: new, labeled-toggle fragments)
119
-
120
- avgSem 83 → 87. Reuse 26.4 → 33.5 (peak) → 29.7 (final).
@@ -1,111 +0,0 @@
1
- # Reference: Strategy engines — file map + 5 strategy labels + parallel pipelines
2
-
3
- **Source:** Absorbed from the former `zettel-internals` skill (Phase 3 rollup). **Used by:** mode 5 of `adia-ui-a2ui` (debug zettel composition). **Companion:** `zettel-calibration.md`, `semantic-fail-lifting.md`, `fragment-graph.md`.
4
-
5
- ---
6
-
7
- ## File map (~2,936 LOC across 12 files)
8
-
9
- ```text
10
- packages/a2ui/compose/strategies/zettel/
11
- ├── generator-adapter.js 202 ← entry point + 5-strategy dispatch
12
- ├── generate.js 15 ← thin wrapper for direct invocation
13
- ├── _smoke.js 37 ← in-tree smoke test
14
-
15
- ├── fragment-library.js 209 ← loader: corpus/{fragments,compositions}/*.json
16
- ├── composer.js 146 ← resolves $fragment refs, prefixes IDs, applies bindings
17
- ├── synthesizer.js 343 ← LLM-driven composition (fragment-graph)
18
- ├── session-store.js 121 ← multi-turn artifact tracking (in-memory)
19
-
20
- ├── chunk-synthesizer.js 417 ← page-shell + slot-binding (chunk-corpus)
21
- ├── chunk-composer.js 182 ← resolves chunk plan into A2UI messages
22
- ├── chunk-refiner.js 514 ← multi-turn refinement (locator → modifier)
23
- ├── state-cache.js 153 ← bounded LRU keyed by state_id
24
- └── issue-reporter.js 597 ← telemetry → .brain/audit-history/issues/
25
- ```
26
-
27
- ## Two parallel pipelines under one strategy
28
-
29
- ```text
30
- ┌─ retrieval (always tried first)
31
- │ from corpus/fragments + corpus/compositions OR corpus/chunks
32
-
33
- generator │
34
- -adapter.js ─┼─ session iteration (turn > 1 + LLM)
35
- │ reads session-store, hydrates priorTurns into prompt
36
-
37
- └─ synthesis fallback (retrieval < threshold + LLM)
38
- ├─ synthesizer.js (fragment-graph)
39
- └─ chunk-synthesizer (chunk-corpus)
40
- ```
41
-
42
- **These are NOT a hierarchy** — they're two parallel reasoning loops. `zettel` engine = fragment-graph; `chunk-zettel` engine = chunk-corpus. Both register independently in the engine registry.
43
-
44
- ## The 5 strategy labels (emitted to eval harness)
45
-
46
- | Strategy | Trigger | Hot path? |
47
- | --- | --- | --- |
48
- | `composition-match` | Fresh retrieval, score ≥ `STRONG_MATCH_THRESHOLD` | Yes — no LLM call |
49
- | `composition-synthesized` | Fresh LLM composition (no prior turns) | No — LLM call |
50
- | `composition-iterated` | LLM modified prior turn's template | No — LLM call w/ history |
51
- | `fragment-candidates` | Retrieval weak + no LLM available → atoms only | Yes — no LLM call |
52
- | `synthesis-failed` | LLM tried + failed validation | Cold — failure path |
53
-
54
- For chunk-zettel, mirror set: `chunk-match`, `chunk-synthesized`, `chunk-iterated`, `chunk-failed`.
55
-
56
- ## Issue reporter — three call paths
57
-
58
- | Path | Trigger | `ctx.reporter` | Suppression |
59
- | --- | --- | --- | --- |
60
- | LLM self-fire | `report_issue` MCP tool | `'llm'` | None |
61
- | Consumer-fire | Human requests bug ticket | `'user'` | None |
62
- | Engine auto-fire | Internal failure (e.g., scope-drift, synthesis-failed) | `'auto'` | When `ctx.evalMode = true` (avoid eval-run noise) |
63
-
64
- **Storage**: `.brain/audit-history/issues/<id>.json` (immutable). Traces > 200KB spill to sidecar `.trace.json`.
65
-
66
- **Type taxonomy**:
67
-
68
- - `bug` (code defect)
69
- - `training-gap` (corpus missing a pattern)
70
- - `protocol-gap` (MCP / engine contract issue)
71
- - `ux-feedback` (output quality complaint)
72
-
73
- **Severity ranks**: `nit` (0) < `drift` (1) < `blocker` (2)
74
-
75
- **Owner taxonomy**: `synthesis | retrieval | validator | chunk-corpus | mcp-protocol | unknown`
76
-
77
- **Distinct from `.tickets/`** — those are human-authored work items. Issues are runtime telemetry, promoted to tickets during weekly triage when patterns emerge (spec §11.5).
78
-
79
- ## Session iteration — the priority flag
80
-
81
- ```js
82
- if (hasHistory && llmAdapter) {
83
- // ALWAYS goes to synthesis with history context.
84
- // NEVER picks a fresh retrieved composition on follow-up turns.
85
- }
86
- ```
87
-
88
- This is what makes "add a button" / "hydrate with real images" work — follow-ups modify the existing canvas instead of regenerating.
89
-
90
- ## Pitfalls
91
-
92
- - **`STRONG_MATCH_THRESHOLD` was raised post-incident**. Lowering it back to 22 reverts to repetitive output. If you suspect retrieval is too cold, profile the score distribution first via `searchAll()` debugging, don't just lower the threshold.
93
- - **`PRE_SEARCH_LIMIT = 30` may be over-permissive at small corpus sizes.** It was calibrated for a much larger corpus. Worth re-tuning post-corpus-migration.
94
- - **`state-cache` is per-process** — multi-turn breaks across MCP restarts. Anything that needs durable state should write to `.brain/audit-history/` or `.tickets/`, not state-cache.
95
- - **`issueAccumulator` must be passed via `opts`** to refinement engines — if you wire a new engine, propagate it or auto-fire issues are lost.
96
- - **Strategy labels are public contract.** The eval harness, MCP tools, and dialog-recorder all pattern-match on the 5 strategy strings. Don't rename without a coordinated migration.
97
-
98
- ## Verification
99
-
100
- ```bash
101
- # Smoke tests (fast, no LLM)
102
- npm run zettel:smoke
103
- npm run smoke:engines
104
-
105
- # Full eval (slow, real LLM)
106
- npm run eval:diff -- --engine zettel
107
- npm run eval:diff -- --engine chunk-zettel
108
-
109
- # Issue store sanity (after auto-fire test)
110
- ls .brain/audit-history/issues/ | head
111
- ```
@@ -1,220 +0,0 @@
1
- # Reference: Teach Protocol — Absorbing new knowledge into the adia-ui-a2ui skill
2
-
3
- **Why authored:** As the A2UI pipeline absorbs new strategies, anti-patterns, calibration constants, MCP tools, and chunk-corpus shapes, each absorption was previously a one-off improvisation. This protocol gives every future "make sure `adia-ui-a2ui` knows about [pattern]" request a deterministic landing path.
4
-
5
- **Decision tree is mechanized.** The branch routing below is authoritative in `scripts/teach-route.mjs` (run `node scripts/teach-route.mjs "<payload>"`). The prose here is for human readers — worked examples, anti-patterns, rationale. The script is the routing.
6
-
7
- **Used by:** the `adia-ui-a2ui` skill, when an agent receives one of these triggers:
8
-
9
- - "make sure `adia-ui-a2ui` knows about [the new strategy / calibration / anti-pattern]"
10
- - "train `adia-ui-a2ui` on [the new MCP tool / fragment shape / eval finding]"
11
- - "the skill should know about [the new pattern]"
12
- - "absorb this lesson into adia-ui-a2ui"
13
- - "teach the skill about [the new chunk metadata field]"
14
-
15
- **Companion:** `eval-diagnostics.md` (run after any pipeline change), `strategy-engines.md` (when the new knowledge is engine-level), and `scripts/audit-a2ui-roster.mjs` (run after any §Teach landing).
16
-
17
- **Anti-companion:** `docs/journal/` (arc-specific stories belong in the journal, not the skill — see decision tree Branch H).
18
-
19
- ---
20
-
21
- ## When to Use
22
-
23
- Trigger phrases (from the §Teach section in SKILL.md):
24
-
25
- - "make sure `adia-ui-a2ui` knows about X"
26
- - "train the skill on X"
27
- - "teach the skill about Y"
28
- - "the skill should be aware of Z"
29
- - "absorb [pattern/lesson/feedback] into adia-ui-a2ui"
30
- - "update the skill to reflect [the new strategy / the new threshold / the new tool]"
31
-
32
- The phrases are universal across all extensible skills; the **landing target** is what's specific to this skill.
33
-
34
- ## Core Principles
35
-
36
- ### 1. The skill is a CITATION layer, not a KNOWLEDGE layer
37
-
38
- Per-strategy facts live in `packages/a2ui/compose/strategies/*/`. Chunk authoring rules live in `packages/a2ui/corpus/CHUNK-AUTHORING.md`. MCP tool schemas live in `packages/a2ui/mcp/server.js`. The skill cites by path; it does NOT duplicate code or schema in prose.
39
-
40
- **Rule of thumb:** if you catch yourself writing "the zettel composer does X" in a SKILL.md file, stop. Is that fact in the strategy code already? If yes, cite the path + function name + line range. If no, the fact should land in the substrate first, THEN the skill cites it.
41
-
42
- ### 2. Trigger surface is universal; landing targets are skill-specific
43
-
44
- The activation phrases — "train X on Y", "make sure X knows about Z", "absorb this into X" — are the same regardless of which skill X is. The **landing targets** vary per this skill's references/ topology.
45
-
46
- ### 3. The negative case (Branch H) is load-bearing
47
-
48
- Arc-specific stories ("how I debugged this eval regression last month") belong in `docs/journal/`, not in the skill. The skill is procedural knowledge that will be true tomorrow; arc stories are history that's already finished.
49
-
50
- ### 4. Eval is the source of truth
51
-
52
- When a §Teach landing introduces a calibration tweak or new strategy, the eval gate must agree. If the eval gate disagrees with the landing's intuition, the eval gate wins. Rebaseline if the eval threshold itself is wrong; document in CHANGELOG.
53
-
54
- ### 5. The 5-step landing procedure generalizes
55
-
56
- Step 2 (author) is skill-specific. The other four steps are universal across all extensible skills.
57
-
58
- ### 6. Anti-patterns are universal
59
-
60
- The seven anti-patterns generalize across every roll-up: append-only landing, substrate duplication, orphan triggers, capability menu lies, MINOR + PATCH bundling, hygiene-debt deferral, one-way thinking.
61
-
62
- ---
63
-
64
- ## The Decision Tree — where does new knowledge land?
65
-
66
- Eight branches, each with a worked example. Branch A is the most common landing for substrate-author work; branch H is the negative case (do NOT land in the skill).
67
-
68
- ### Branch A — New chunk metadata field
69
-
70
- **When**: someone adds a new field to chunk JSON (`provenance`, `last_harvested`, etc.) or extends `_index.json` shape.
71
-
72
- **Lands at**: `packages/a2ui/corpus/chunks/_index.json` schema documentation in `chunk-authoring.md`. NOT in the skill itself unless the field changes the authoring procedure.
73
-
74
- **Worked example**: a `derivation` field was added to chunks recording which HTML demo a chunk was harvested from. Landing: `chunk-authoring.md` got a new section under "Chunk schema" documenting `derivation`. The skill's SKILL.md didn't change.
75
-
76
- ### Branch B — New MCP tool
77
-
78
- **When**: a new tool is exported from `packages/a2ui/mcp/server.js` (e.g., a new `inspect_chunk_keywords` tool joining `search_chunks` + `validate_schema` + `generate_ui`).
79
-
80
- **Lands at**: `packages/a2ui/mcp/server.js` (tool implementation) + `mcp-tool-reference.md` (schema doc) + `mcp-pipeline-ops.md` (workflow integration). SKILL.md gets a one-line mention in mode 1's trigger phrases if the tool is operator-facing.
81
-
82
- **Worked example**: the `report_issue` MCP tool was added for evolution-engine feedback. Landing was three-fold: server.js implementation + tool-reference schema + pipeline-workflows feedback-loop section.
83
-
84
- ### Branch C — New strategy / engine
85
-
86
- **When**: a new composition strategy is added (e.g., a future `template-match` engine joining `zettel` + `free-form` + `monolithic` + `dogfood`).
87
-
88
- **Lands at**: `packages/a2ui/compose/strategies/<name>/` (engine code) + `packages/a2ui/compose/strategies/registry.js` (registration) + `strategy-engines.md` (engine map updated to include the new label). SKILL.md mode 5's trigger phrases may need to mention the new strategy by name.
89
-
90
- **Worked example**: the free-form engine was added in a major arc. Landing: new directory under strategies/ + registry.js update + strategy-engines.md got a new section + eval gate added a new threshold row (`cov≥90, avg≥83, F1≥55`).
91
-
92
- ### Branch D — New anti-pattern rule
93
-
94
- **When**: a new anti-pattern is discovered (e.g., "popover-ui without trigger-element rule" joining the existing catalogue).
95
-
96
- **Lands at**: `anti-patterns.md` (catalogue entry) + possibly `packages/a2ui/validator/checks/<name>.js` (mechanized check). SKILL.md may need mode 8's trigger phrases extended.
97
-
98
- **Worked example**: a "chart-legend-without-tokens" anti-pattern was added during a cross-surface QA arc. Landing: anti-patterns.md got a new rule + validator gained a new check + the sibling `adia-ui-dogfood` skill cross-referenced it.
99
-
100
- ### Branch E — New calibration constant / threshold
101
-
102
- **When**: someone tunes `STRONG_MATCH_THRESHOLD`, `STRONG_RETRIEVAL_SCORE`, the locator weights, or any of the constants in the calibration history.
103
-
104
- **Lands at**: `packages/a2ui/compose/strategies/zettel/composer.js` (constant value) + `zettel-calibration.md` (history table — append, never overwrite). SKILL.md doesn't change.
105
-
106
- **Worked example**: `STRONG_MATCH_THRESHOLD` was tuned across several arcs. Each tune left a row in `zettel-calibration.md`'s history table with rationale + eval delta. The history is the audit trail.
107
-
108
- ### Branch F — Methodology / pipeline-design posture
109
-
110
- **When**: a new principle / posture emerges that shifts how the pipeline is approached (e.g., "always re-harvest chunks after @bp changes" became a posture during a responsive arc).
111
-
112
- **Lands at**: inline in SKILL.md (§Posture or §FirstPrinciples). This is the only branch that touches SKILL.md directly. MINOR version bump.
113
-
114
- **Worked example**: the "HTML-first chunk authoring" principle (don't hand-author JSON) was added to §Posture during a training-signal arc.
115
-
116
- ### Branch G — New fragment-graph node type
117
-
118
- **When**: someone extends the fragment graph with a new node type (e.g., adding a `partial` node alongside `fragment` + `composition`).
119
-
120
- **Lands at**: `packages/a2ui/compose/strategies/zettel/composer.js` (`$fragment` ref resolution) + `fragment-graph.md` (extended node-type table) + `strategy-engines.md` (how the engine consumes the new type).
121
-
122
- **Worked example**: no new node types have been added since the initial fragment-graph design. When one is, the landing pattern follows the existing `$fragment` documentation in fragment-graph.md.
123
-
124
- ### Branch H (NEGATIVE) — One-off eval debugging arc
125
-
126
- **When**: someone debugged a specific eval regression on a specific date. The story has a beginning
127
-
128
- - middle + end and won't repeat.
129
-
130
- **Lands at**: `docs/journal/` as a dated section. **NOT IN THE SKILL.**
131
-
132
- **Worked example**: a chunk-corpus expansion arc (28 → 64 annotated chunks) is documented in the journal. The skill's references mention the eval-floor result (`cov≥90`) but don't reproduce the debugging narrative.
133
-
134
- **Why this branch matters**: without it, every §Teach landing risks polluting the skill with arc history. The skill becomes unmaintainable as the journal sections pile up.
135
-
136
- ---
137
-
138
- ## The Five-Step Landing Procedure
139
-
140
- Universal across all extensible skills:
141
-
142
- ### 1. Audit before patching
143
-
144
- - Read the target reference file in full
145
- - Check working-tree state (`git status`)
146
- - Grep for existing coverage of the same topic
147
- - Re-confirm the landing-target choice via the decision tree above (or `scripts/teach-route.mjs`)
148
-
149
- ### 2. Author the patch (skill-specific)
150
-
151
- Where does the new content go in this skill's references/? How is it formatted? What surrounding sections does it impact? Map each branch to its primary reference file (see Decision Tree above).
152
-
153
- ### 3. Wire the activation surface
154
-
155
- - Trigger keywords in SKILL.md frontmatter `trigger:` block (if the new knowledge has new trigger phrases)
156
- - Capability menu entry (only for new modes — usually not needed for §Teach landings)
157
- - Binding-procedure line in §Posture or §FirstPrinciples (only for Branch F)
158
-
159
- ### 4. Version + CHANGELOG
160
-
161
- - PATCH for citation strengthening / fact additions
162
- - MINOR for new procedural sections / new modes
163
- - MAJOR for renames / removed modes
164
-
165
- ### 5. Verify with audit-a2ui-roster
166
-
167
- ```bash
168
- node scripts/audit-a2ui-roster.mjs --strict
169
- # expect: all axes green
170
- ```
171
-
172
- Plus the eval gate if the landing was strategy/calibration-related:
173
-
174
- ```bash
175
- npm run eval:diff -- --engine zettel
176
- npm run eval:diff -- --engine free-form
177
- ```
178
-
179
- ---
180
-
181
- ## The 7 Anti-Patterns
182
-
183
- Universal across all extensible skills. Each one breaks the skill in a specific way:
184
-
185
- | # | Anti-pattern | What breaks |
186
- | --- | --- | --- |
187
- | 1 | **Append-only landing** | Content piles at end of section; semantic structure decays |
188
- | 2 | **Substrate duplication** | Strategy code or chunk schema copied into skill prose; drift on next strategy change |
189
- | 3 | **Orphan triggers** | Keywords added to frontmatter but no binding section in body |
190
- | 4 | **Capability menu lies** | Menu item points to non-existent section or stub |
191
- | 5 | **MINOR + PATCH bundling** | New procedural content cut alongside polish; muddied changelog |
192
- | 6 | **Hygiene-debt deferral** | Audit regression noticed during landing, deferred to "next cut" |
193
- | 7 | **One-way thinking** | Lands here without asking "should this be in a sibling skill?" (e.g., a chunk authoring rule might belong in `adia-ui-authoring`'s shell-patterns reference instead of here) |
194
-
195
- ---
196
-
197
- ## Quick-Reference Card
198
-
199
- | Branch | Trigger | Lands at | SKILL.md change? |
200
- | --- | --- | --- | --- |
201
- | A | new chunk metadata field | chunk-authoring.md | no |
202
- | B | new MCP tool | mcp/server.js + mcp-tool-reference.md | minor (mode 1 triggers) |
203
- | C | new strategy / engine | strategies/ + strategy-engines.md | minor (mode 5 triggers + eval gate row) |
204
- | D | new anti-pattern rule | anti-patterns.md + validator/checks/ | minor (mode 8 triggers) |
205
- | E | calibration tune | composer.js + zettel-calibration.md | no |
206
- | F | methodology / posture | inline SKILL.md (§Posture / §FirstPrinciples) | MINOR bump |
207
- | G | new fragment-graph node type | composer.js + fragment-graph.md | no |
208
- | H | arc-specific story | docs/journal/ | **NEVER** |
209
-
210
- When in doubt, **prefer Branch H** (journal) over a skill landing. Arc stories that age out are easy to ignore; orphan rules that linger in the skill are hard to remove.
211
-
212
- ---
213
-
214
- ## Cross-references
215
-
216
- - `${CLAUDE_PLUGIN_ROOT}/references/shared/pev-rationale.md` — the Plan-Execute-Verify rationale this §Teach inherits (every landing closes the PEV loop).
217
- - `scripts/teach-route.mjs` — the authoritative mechanized branch router.
218
- - `adia-ui-authoring` / `adia-ui-release` — sibling skills; route content there when Branch 7 (one-way thinking) applies.
219
- - `eval-diagnostics.md` — run after any Branch C / E landing.
220
- - `strategy-engines.md` + `zettel-calibration.md` — the engine-side substrate.
@@ -1,93 +0,0 @@
1
- # Reference: Zettel calibration — constants + history + locator/modifier two-pass
2
-
3
- **Source:** Absorbed from the former `zettel-internals` skill (§Calibration constants + §The locator → modifier two-pass pattern) — Phase 3 rollup. **Used by:** mode 5 of `adia-ui-a2ui` (tune calibration; lift fails). **Companion:** `strategy-engines.md`, `semantic-fail-lifting.md`.
4
-
5
- > **Calibration history is the substrate.** Each tweak leaves a row. Read history before retuning — the same value may have been tried and rejected before.
6
-
7
- ---
8
-
9
- ## Calibration constants — values + history
10
-
11
- **Don't change these without running the eval-diff suite first.** Each is calibrated against the held-out 100-intent set or production telemetry.
12
-
13
- ### `STRONG_MATCH_THRESHOLD = 40`
14
-
15
- - **File**: `generator-adapter.js`
16
- - **Raised**: 22 → 40 post-incident
17
- - **Reason**: At 22, login-form / signup-form played verbatim too often → repetitive output. At 40, only near-perfect retrievals (chart-dashboard=48, pricing-tiers=54) match; merely-good fall through to LLM for compositional variety.
18
- - **Scale**: **Absolute**, not relative. Score is a weighted sum of `semantic_role` (12) + `tags` (5 each) + `keywords` (3 each) matches between query tokens and fragment metadata. Adding/removing fragments from the corpus does not shift any specific (query, fragment) score — it's deterministic per pair. **Don't recalibrate as a function of corpus size** — that would be a misdiagnosis.
19
- - **Tradeoff**: More LLM calls (slower, costlier) ↔ compositional variety
20
- - **Re-eval before changing**: `npm run eval:diff -- --engine zettel`
21
-
22
- ### `STRONG_RETRIEVAL_SCORE = 8`
23
-
24
- - **File**: `chunk-synthesizer.js`
25
- - **Scale**: corpus-size-**independent** absolute keyword score from `chunk-library.js#keywordScore()`. Adding 1k chunks doesn't shift any individual (chunk, query) score. Don't propose recalibration as a function of corpus size — that's a misdiagnosis.
26
- - **What 8 means**: at least one whole-word overlap between query and chunk name (10), OR full-query substring (5) + ≥1 whole-word token (3). Anything less is a "retrieval too weak — synthesize" signal.
27
- - **Async path**: `searchChunksAsync` blends `kw + cos*5`. Cosine ranges 0..1 so embeddings contribute 0..5 — pure-cosine matches max out at 5 and won't pass the 8 threshold. **Embeddings are a tie-breaker**, not the primary signal. This is intentional.
28
- - **Different scale** than fragment-graph `STRONG_MATCH_THRESHOLD=40` (which scores semantic_role + tags + keywords). Don't normalize the two scales — they measure different things.
29
- - **WONTFIX rationale** documented in the corpus audit reports under `docs/reports/`.
30
-
31
- ### `PRE_SEARCH_LIMIT = 30`
32
-
33
- - **Files**: `chunk-synthesizer.js`, `chunk-refiner.js`
34
- - **Reason**: Token-budget mitigation — pre-filter catalog before LLM sees it. Sending the full catalog every prompt would burn tens of thousands of input tokens.
35
- - **Synthesizer** (`chunk-synthesizer.js`): kind-aware allocation — `limit: PRE_SEARCH_LIMIT - pageChunks.length - panelChunks.length`. All pages and panels included unconditionally; blocks fill the remaining budget. **Self-tuning by structure.**
36
- - **Refiner** (`chunk-refiner.js`): block-only allocation — `limit: PRE_SEARCH_LIMIT` for blocks alone, plus all pages/panels on top. Intentionally more generous because refinement is doing targeted edits and the LLM needs more options.
37
- - **Don't naively divide PRE_SEARCH_LIMIT by corpus size** to assess over-permissiveness. The kind-aware allocation makes the math non-linear. See the pre-search-limit audit under `docs/reports/` for the full analysis.
38
-
39
- ### `SCOPE_DRIFT_RATIO = 1.5`
40
-
41
- - **File**: `chunk-synthesizer.js`
42
- - **Trigger**: Composed envelope's component count > 1.5× sum of bound chunks' component counts → auto-fires `scope-drift` issue
43
- - **Catches**: LLM creative expansion that hallucinates extra components beyond what's in the bound chunks
44
-
45
- ### `SCOPE_DRIFT_MIN_ACTUAL = 20`
46
-
47
- - **File**: `chunk-synthesizer.js`
48
- - **Floor against false positives** on small UIs where slot-wrapper noise dominates. UIs with < 20 components don't trip the gate even if the ratio exceeds 1.5×.
49
-
50
- ### `DEFAULT_MAX_ATTEMPTS = 2`
51
-
52
- - **Files**: `chunk-refiner.js`, `chunk-synthesizer.js`
53
- - **Validator-driven retry budget**. After 2 failed validations, emit `synthesis-failed` strategy.
54
-
55
- ### `DEFAULT_MAX_SIZE = 64` (state-cache)
56
-
57
- - **File**: `state-cache.js`
58
- - **Override**: `A2UI_STATE_CACHE_SIZE` env var
59
- - **Per-process, in-memory.** Survives only as long as the MCP server. Multi-turn refinement breaks across server restarts.
60
- - **Eviction**: LRU on `set` when at capacity; `get` and overwriting `set` touch recency; `peek` reads without touching.
61
-
62
- ### `TRACE_INLINE_THRESHOLD_BYTES = 200 * 1024` (issue-reporter)
63
-
64
- - **File**: `issue-reporter.js`
65
- - Above this, traces spill to sidecar `.trace.json` next to the issue JSON to keep the issue file readable.
66
-
67
- ## The locator → modifier two-pass pattern (chunk-refiner.js)
68
-
69
- Multi-turn refinements use **two LLM passes**:
70
-
71
- ### Pass 1 — Locator
72
-
73
- LLM is given:
74
-
75
- - The intent ("change the title", "remove the funnel", "add a country list")
76
- - A component map listing slots in the prior UI + their bound chunks
77
-
78
- LLM classifies the intent as:
79
-
80
- - **`targeted`** — specific slot/element named, OR verb implies localized change
81
- - **`untargeted`** — broad changes touching many slots ("more compact", "use teal")
82
-
83
- ### Pass 2 — Modifier
84
-
85
- LLM emits ops from a fixed vocabulary:
86
-
87
- ```text
88
- VALID_OP_TYPES = { rebindSlot, appendToSlot, removeFromSlot, replacePage }
89
- ```
90
-
91
- Ops translate to A2UI `updateComponents` messages via `opsToA2UI()`.
92
-
93
- **Phase A simplification**: refinements operate on the chunk binding plan only. A later phase may introduce component-tree refinements; current code honors the wire format while keeping engine code chunk-focused.
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env node
2
- // audit-a2ui-roster.mjs — §SelfAudit enforcement for adia-ui-a2ui.
3
- // Universal axes via the shared audit-axes lib; plus a skill-specific axis:
4
- // absorbed-skill roster currency (the three absorbed standalones and their
5
- // predecessors must stay absorbed — not resurrected as live skill dirs).
6
- //
7
- // Shared lib resolution: ${CLAUDE_PLUGIN_ROOT}/bin/lib/audit-axes.mjs, with a
8
- // fallback relative to this script (per the plugin path convention).
9
- //
10
- // Usage (from the plugin/repo root):
11
- // node skills/adia-ui-a2ui/scripts/audit-a2ui-roster.mjs
12
- // node skills/adia-ui-a2ui/scripts/audit-a2ui-roster.mjs --json
13
- // node skills/adia-ui-a2ui/scripts/audit-a2ui-roster.mjs --strict
14
-
15
- import fs from 'node:fs';
16
- import path from 'node:path';
17
- import process from 'node:process';
18
- import { fileURLToPath, pathToFileURL } from 'node:url';
19
-
20
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
21
-
22
- // Plugin root: ${CLAUDE_PLUGIN_ROOT} if set, else 3 dirs up from this script
23
- // (skills/adia-ui-a2ui/scripts/ → plugin root).
24
- const PLUGIN_ROOT = process.env.CLAUDE_PLUGIN_ROOT
25
- ? path.resolve(process.env.CLAUDE_PLUGIN_ROOT)
26
- : path.resolve(__dirname, '..', '..', '..');
27
-
28
- const LIB_URL = pathToFileURL(path.join(PLUGIN_ROOT, 'bin', 'lib', 'audit-axes.mjs')).href;
29
- const { runUniversalAxes, formatResults } = await import(LIB_URL);
30
-
31
- // Skill layout: skills/<name>/ under the plugin root (matches run-skill-evals.mjs).
32
- const SKILL_DIR = path.join(PLUGIN_ROOT, 'skills', 'adia-ui-a2ui');
33
- const SKILL_MD = path.join(SKILL_DIR, 'SKILL.md');
34
- const SKILL_JSON = path.join(SKILL_DIR, 'skill.json');
35
- const SKILLS_ROOT = path.join(PLUGIN_ROOT, 'skills');
36
-
37
- // Absorbed skills + predecessors — must NOT exist as live skill directories.
38
- const ABSORBED = [
39
- 'a2ui-pipeline',
40
- 'adia-ui-training',
41
- 'zettel-internals',
42
- 'fragment-extraction',
43
- 'training-data-flow',
44
- 'eval-gap-diagnosis',
45
- 'semantic-fail-lifting',
46
- ];
47
-
48
- function parseArgs(argv) {
49
- return { json: argv.includes('--json'), strict: argv.includes('--strict') };
50
- }
51
-
52
- function axisAbsorbedRosterCurrency() {
53
- const findings = [];
54
- for (const name of ABSORBED) {
55
- const dir = path.join(SKILLS_ROOT, name);
56
- if (fs.existsSync(dir)) {
57
- findings.push({
58
- type: 'unexpected-directory',
59
- message: `${name}/ exists but was absorbed into adia-ui-a2ui — should not be a live skill dir`,
60
- name,
61
- });
62
- } else {
63
- findings.push({ type: 'absorbed-clean', message: `${name}: absorbed, no live dir — correct`, name });
64
- }
65
- }
66
- const driftCount = findings.filter(f => f.type !== 'absorbed-clean').length;
67
- return {
68
- axis: 'absorbedRosterCurrency',
69
- axis_num: 9,
70
- status: driftCount > 0 ? 'drift' : 'ok',
71
- findings,
72
- summary: driftCount > 0 ? `${driftCount} absorbed-skill issue(s)` : 'all absorbed-skill entries clean',
73
- };
74
- }
75
-
76
- function main() {
77
- const args = parseArgs(process.argv.slice(2));
78
- const ctx = { skillDir: SKILL_DIR, skillMd: SKILL_MD, skillJson: SKILL_JSON, repoRoot: PLUGIN_ROOT };
79
- const { results: universal } = runUniversalAxes(ctx);
80
- const axis9 = axisAbsorbedRosterCurrency();
81
- const allResults = [...universal, axis9];
82
- const driftCount = allResults.filter(r => r.status === 'drift').length;
83
-
84
- if (args.json) {
85
- console.log(JSON.stringify({ results: allResults, driftCount }, null, 2));
86
- if (args.strict && driftCount > 0) process.exit(1);
87
- return;
88
- }
89
-
90
- console.log(`[audit-a2ui-roster] adia-ui-a2ui §SelfAudit — ${driftCount} drifting axis/axes`);
91
- console.log(formatResults(allResults));
92
- if (driftCount === 0) console.log('\n✓ All clean.');
93
- if (args.strict && driftCount > 0) process.exit(1);
94
- }
95
-
96
- main();