@adia-ai/adia-ui-forge 0.1.3 → 0.8.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.
- package/.claude-plugin/plugin.json +3 -6
- package/CHANGELOG.md +27 -34
- package/README.md +35 -40
- package/agents/a2ui-engineer.md +22 -53
- package/agents/component-author.md +29 -0
- package/agents/framework-verifier.md +26 -0
- package/agents/release-engineer.md +21 -81
- package/agents/routing-corpus.json +293 -64
- package/bin/demo-postwrite-pattern-gate +94 -0
- package/bin/forge-lint +17 -2
- package/bin/sidecar-prewrite-guard +104 -0
- package/commands/deploy.md +9 -0
- package/commands/dogfood.md +10 -0
- package/commands/gen-review.md +9 -0
- package/commands/release.md +10 -0
- package/hooks/hooks.json +15 -0
- package/package.json +3 -6
- package/references/contracts/a2ui-mcp-surface.md +35 -0
- package/references/contracts/migration-guide-format.md +34 -0
- package/references/shared/content-trust.md +19 -74
- package/skills/adia-a2ui/SKILL.md +99 -0
- package/skills/{adia-ui-a2ui → adia-a2ui}/evals/routing-corpus.json +10 -10
- package/skills/adia-a2ui/references/anti-patterns.md +27 -0
- package/skills/adia-a2ui/references/chunk-authoring.md +71 -0
- package/skills/adia-a2ui/references/corpus-discipline.md +68 -0
- package/skills/adia-a2ui/references/eval-diagnostics.md +86 -0
- package/skills/adia-a2ui/references/format-extension-decisions.md +66 -0
- package/skills/adia-a2ui/references/leverage-rules.md +52 -0
- package/skills/adia-a2ui/references/mcp-pipeline-ops.md +83 -0
- package/skills/adia-a2ui/references/mcp-tool-reference.md +59 -0
- package/skills/adia-a2ui/references/pipeline-overview.md +115 -0
- package/skills/adia-a2ui/references/semantic-fail-lifting.md +74 -0
- package/skills/adia-a2ui/references/strategy-engines.md +109 -0
- package/skills/adia-a2ui/references/zettel-calibration.md +104 -0
- package/skills/adia-author/SKILL.md +112 -0
- package/skills/adia-author/evals/routing-corpus.json +222 -0
- package/skills/{adia-ui-authoring → adia-author}/references/anti-patterns.md +33 -4
- package/skills/{adia-ui-authoring → adia-author}/references/authoring-cycle.md +9 -11
- package/skills/adia-author/references/canonical-pattern-index.md +243 -0
- package/skills/{adia-ui-authoring → adia-author}/references/code-style.md +19 -21
- package/skills/adia-author/references/common-gotchas.md +129 -0
- package/skills/adia-author/references/composite-demo-protocol.md +271 -0
- package/skills/{adia-ui-authoring → adia-author}/references/css-patterns.md +19 -6
- package/skills/{adia-ui-authoring → adia-author}/references/lifecycle-patterns.md +1 -0
- package/skills/{adia-ui-authoring → adia-author}/references/llm-bridge.md +3 -5
- package/skills/{adia-ui-authoring → adia-author}/references/module-promotion.md +20 -38
- package/skills/{adia-ui-authoring → adia-author}/references/primitive-audit.md +2 -4
- package/skills/{adia-ui-authoring → adia-author}/references/shell-patterns.md +12 -18
- package/skills/{adia-ui-authoring → adia-author}/references/token-contract.md +5 -7
- package/skills/{adia-ui-authoring → adia-author}/references/worked-example.md +3 -3
- package/skills/{adia-ui-authoring → adia-author}/references/yaml-contract.md +3 -3
- package/skills/{adia-ui-authoring → adia-author}/scripts/build-canonical-pattern-index.mjs +3 -3
- package/skills/adia-deploy/SKILL.md +128 -0
- package/skills/{adia-ui-ops → adia-deploy}/references/deploy-playbooks.md +47 -30
- package/skills/adia-dogfood/SKILL.md +124 -0
- package/skills/adia-dogfood/references/admin-shell-anatomy.md +77 -0
- package/skills/adia-dogfood/references/app-shell-pitfalls.md +66 -0
- package/skills/adia-dogfood/references/card-anatomy-sweep.md +66 -0
- package/skills/adia-dogfood/references/html-attr-sweep.md +63 -0
- package/skills/adia-dogfood/references/native-leak-annotations.md +73 -0
- package/skills/adia-dogfood/references/visual-probe-triage.md +80 -0
- package/skills/{adia-ui-dogfood → adia-dogfood}/scripts/analyze.mjs +30 -14
- package/skills/adia-gen-review/SKILL.md +127 -0
- package/skills/adia-gen-review/references/corpus-html-patterns.md +279 -0
- package/skills/adia-gen-review/references/loop-protocol.md +216 -0
- package/skills/adia-gen-review/references/rubric-cosmetic.md +100 -0
- package/skills/adia-gen-review/references/rubric-decompose.md +101 -0
- package/skills/adia-gen-review/references/rubric-score.md +214 -0
- package/skills/{adia-ui-gen-review → adia-gen-review}/references/scores.schema.json +2 -2
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-coverage-audit.mjs +4 -4
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-decompose.mjs +10 -6
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/gen-review-status.mjs +5 -5
- package/skills/{adia-ui-gen-review → adia-gen-review}/scripts/validate-cycle-scores.mjs +5 -5
- package/skills/adia-llm-internals/SKILL.md +77 -0
- package/skills/{adia-ui-llm → adia-llm-internals}/references/adapter-contract.md +4 -2
- package/skills/{adia-ui-llm → adia-llm-internals}/references/add-a-provider.md +4 -5
- package/skills/{adia-ui-llm → adia-llm-internals}/references/bridge-facade.md +10 -3
- package/skills/{adia-ui-llm → adia-llm-internals}/references/browser-proxy-boundary.md +1 -1
- package/skills/{adia-ui-llm → adia-llm-internals}/references/model-registry.md +5 -3
- package/skills/{adia-ui-llm → adia-llm-internals}/references/streaming-sse.md +2 -2
- package/skills/adia-release/SKILL.md +72 -0
- package/skills/adia-release/references/changelog-discipline.md +119 -0
- package/skills/adia-release/references/cut-procedure.md +247 -0
- package/skills/adia-release/references/gates-catalog.md +222 -0
- package/skills/adia-release/references/independent-package-release.md +52 -0
- package/skills/adia-release/references/migration-guide-authoring.md +86 -0
- package/skills/adia-release/references/notes-authoring.md +90 -0
- package/skills/adia-release/references/recovery-paths.md +106 -0
- package/skills/{adia-ui-release → adia-release}/scripts/bump.mjs +27 -2
- package/skills/{adia-ui-release → adia-release}/scripts/dispatch-publish.mjs +4 -1
- package/skills/{adia-ui-release → adia-release}/scripts/insert-stub.mjs +1 -1
- package/skills/{adia-ui-release → adia-release}/scripts/package-paths.mjs +6 -0
- package/skills/{adia-ui-release → adia-release}/scripts/promote-unreleased.mjs +1 -1
- package/skills/{adia-ui-release → adia-release}/scripts/release-pack.mjs +13 -21
- package/skills/{adia-ui-release → adia-release}/scripts/tag-lockstep.mjs +5 -1
- package/skills/adia-site-docs/SKILL.md +68 -0
- package/skills/adia-site-docs/evals/audit-report.md +30 -0
- package/skills/adia-site-docs/evals/routing-corpus.json +176 -0
- package/skills/adia-site-docs/intent.md +72 -0
- package/agents/README.md +0 -209
- package/agents/author.md +0 -56
- package/agents/repo-steward.md +0 -56
- package/agents/spec-architect.md +0 -53
- package/agents/tech-lead.md +0 -57
- package/agents/verifier.md +0 -55
- package/bin/lib/audit-axes.mjs +0 -555
- package/bin/lib/dry-run-irreversible.mjs +0 -236
- package/bin/lib/run-skill-evals.mjs +0 -487
- package/bin/lib/teach-router.mjs +0 -250
- package/commands/adia-forge-a2ui.md +0 -10
- package/commands/adia-forge-author.md +0 -10
- package/commands/adia-forge-dogfood.md +0 -8
- package/commands/adia-forge-llm.md +0 -8
- package/commands/adia-forge-orient.md +0 -10
- package/commands/adia-forge-release.md +0 -8
- package/commands/adia-forge-review.md +0 -10
- package/references/shared/pev-rationale.md +0 -64
- package/references/shared/skill-conventions.md +0 -133
- package/skills/adia-ui-a2ui/CHANGELOG.md +0 -32
- package/skills/adia-ui-a2ui/SKILL.md +0 -243
- package/skills/adia-ui-a2ui/evals/adversarial-corpus.json +0 -75
- package/skills/adia-ui-a2ui/evals/teach-routing-cases.json +0 -100
- package/skills/adia-ui-a2ui/references/anti-patterns.md +0 -24
- package/skills/adia-ui-a2ui/references/chunk-authoring.md +0 -88
- package/skills/adia-ui-a2ui/references/corpus-discipline.md +0 -56
- package/skills/adia-ui-a2ui/references/eval-diagnostics.md +0 -127
- package/skills/adia-ui-a2ui/references/fragment-graph.md +0 -91
- package/skills/adia-ui-a2ui/references/mcp-pipeline-ops.md +0 -106
- package/skills/adia-ui-a2ui/references/mcp-tool-reference.md +0 -398
- package/skills/adia-ui-a2ui/references/pipeline-overview.md +0 -175
- package/skills/adia-ui-a2ui/references/semantic-fail-lifting.md +0 -120
- package/skills/adia-ui-a2ui/references/strategy-engines.md +0 -111
- package/skills/adia-ui-a2ui/references/teach-protocol.md +0 -220
- package/skills/adia-ui-a2ui/references/zettel-calibration.md +0 -93
- package/skills/adia-ui-a2ui/scripts/audit-a2ui-roster.mjs +0 -96
- package/skills/adia-ui-a2ui/scripts/teach-route.mjs +0 -157
- package/skills/adia-ui-a2ui/skill.json +0 -38
- package/skills/adia-ui-authoring/CHANGELOG.md +0 -32
- package/skills/adia-ui-authoring/SKILL.md +0 -256
- package/skills/adia-ui-authoring/assets/case-studies/admin-shell-decomposition.md +0 -101
- package/skills/adia-ui-authoring/assets/case-studies/maxtokens-32768-discovery.md +0 -109
- package/skills/adia-ui-authoring/assets/case-studies/theme-panel-promotion.md +0 -113
- package/skills/adia-ui-authoring/evals/adversarial-design-plan-gates.json +0 -138
- package/skills/adia-ui-authoring/evals/routing-corpus.json +0 -245
- package/skills/adia-ui-authoring/references/canonical-pattern-index.md +0 -179
- package/skills/adia-ui-authoring/references/common-gotchas.md +0 -93
- package/skills/adia-ui-authoring/references/composite-demo-protocol.md +0 -1084
- package/skills/adia-ui-authoring/references/teach-protocol.md +0 -428
- package/skills/adia-ui-authoring/scripts/audit-authoring-roster.mjs +0 -148
- package/skills/adia-ui-authoring/skill.json +0 -45
- package/skills/adia-ui-dogfood/CHANGELOG.md +0 -17
- package/skills/adia-ui-dogfood/README.md +0 -62
- package/skills/adia-ui-dogfood/SKILL.md +0 -866
- package/skills/adia-ui-dogfood/skill.json +0 -40
- package/skills/adia-ui-forge/SKILL.md +0 -88
- package/skills/adia-ui-forge/evals/routing-corpus.json +0 -30
- package/skills/adia-ui-gen-review/CHANGELOG.md +0 -108
- package/skills/adia-ui-gen-review/SKILL.md +0 -266
- package/skills/adia-ui-gen-review/references/loop-protocol.md +0 -712
- package/skills/adia-ui-gen-review/references/rubric-cosmetic.md +0 -144
- package/skills/adia-ui-gen-review/references/rubric-decompose.md +0 -117
- package/skills/adia-ui-gen-review/references/rubric-score.md +0 -249
- package/skills/adia-ui-gen-review/references/teach-protocol.md +0 -214
- package/skills/adia-ui-gen-review/skill.json +0 -23
- package/skills/adia-ui-llm/CHANGELOG.md +0 -25
- package/skills/adia-ui-llm/SKILL.md +0 -165
- package/skills/adia-ui-llm/evals/adversarial-corpus.json +0 -75
- package/skills/adia-ui-llm/evals/routing-corpus.json +0 -30
- package/skills/adia-ui-llm/evals/teach-routing-cases.json +0 -73
- package/skills/adia-ui-llm/references/teach-protocol.md +0 -78
- package/skills/adia-ui-llm/scripts/audit-llm-roster.mjs +0 -93
- package/skills/adia-ui-llm/scripts/teach-route.mjs +0 -119
- package/skills/adia-ui-llm/skill.json +0 -33
- package/skills/adia-ui-ops/CHANGELOG.md +0 -291
- package/skills/adia-ui-ops/SKILL.md +0 -401
- package/skills/adia-ui-ops/references/INDEX.md +0 -158
- package/skills/adia-ui-ops/references/audit-cadence.md +0 -263
- package/skills/adia-ui-ops/references/audit-patterns/archive-link-sweep.md +0 -96
- package/skills/adia-ui-ops/references/audit-patterns/audit-history-ledger.md +0 -162
- package/skills/adia-ui-ops/references/audit-patterns/browser-bundle-node-imports.md +0 -154
- package/skills/adia-ui-ops/references/audit-patterns/changelog-unreleased-bloat.md +0 -75
- package/skills/adia-ui-ops/references/audit-patterns/coverage-gaps.md +0 -187
- package/skills/adia-ui-ops/references/audit-patterns/entry-file-coverage.md +0 -122
- package/skills/adia-ui-ops/references/audit-patterns/format-hygiene.md +0 -217
- package/skills/adia-ui-ops/references/audit-patterns/lockstep-versioning.md +0 -113
- package/skills/adia-ui-ops/references/audit-patterns/memory-fragmentation.md +0 -180
- package/skills/adia-ui-ops/references/audit-patterns/orphan-detection.md +0 -202
- package/skills/adia-ui-ops/references/audit-patterns/pointer-validation.md +0 -180
- package/skills/adia-ui-ops/references/audit-patterns/redundancy-detection.md +0 -210
- package/skills/adia-ui-ops/references/audit-patterns/spec-dating-sweep.md +0 -91
- package/skills/adia-ui-ops/references/audit-patterns/stale-content.md +0 -182
- package/skills/adia-ui-ops/references/audit-patterns/staleness-tooling.md +0 -156
- package/skills/adia-ui-ops/references/audit-patterns/token-waste-detection.md +0 -196
- package/skills/adia-ui-ops/references/doc-types/adr-pattern.md +0 -210
- package/skills/adia-ui-ops/references/doc-types/architecture-md.md +0 -190
- package/skills/adia-ui-ops/references/doc-types/changelog.md +0 -183
- package/skills/adia-ui-ops/references/doc-types/decisions-log.md +0 -146
- package/skills/adia-ui-ops/references/doc-types/plan-roadmap.md +0 -182
- package/skills/adia-ui-ops/references/doc-types/postmortem-pattern.md +0 -206
- package/skills/adia-ui-ops/references/genres/prose-and-writing.md +0 -149
- package/skills/adia-ui-ops/references/guidance/context-budget.md +0 -137
- package/skills/adia-ui-ops/references/guidance/llm-doc-writing.md +0 -116
- package/skills/adia-ui-ops/references/guidance/reliability-dial.md +0 -186
- package/skills/adia-ui-ops/references/recipes/adr-introduction.md +0 -211
- package/skills/adia-ui-ops/references/recipes/audit-existing-repo.md +0 -234
- package/skills/adia-ui-ops/references/recipes/cold-start-harvest.md +0 -263
- package/skills/adia-ui-ops/references/recipes/concurrent-learnings-merge.md +0 -158
- package/skills/adia-ui-ops/references/recipes/continuous-learning-loop.md +0 -169
- package/skills/adia-ui-ops/references/recipes/external-reference-verification.md +0 -158
- package/skills/adia-ui-ops/references/recipes/findings-index-readout.md +0 -126
- package/skills/adia-ui-ops/references/recipes/greenfield-setup.md +0 -252
- package/skills/adia-ui-ops/references/recipes/harvest-repo-brain.md +0 -169
- package/skills/adia-ui-ops/references/recipes/import-repo-brain-harvest.md +0 -153
- package/skills/adia-ui-ops/references/recipes/memory-organization.md +0 -182
- package/skills/adia-ui-ops/references/recipes/recommend-then-validate.md +0 -199
- package/skills/adia-ui-ops/references/recipes/self-healing-hooks.md +0 -366
- package/skills/adia-ui-ops/references/recipes/skill-stewardship-loop.md +0 -113
- package/skills/adia-ui-ops/references/standards/agents-md-spec.md +0 -138
- package/skills/adia-ui-ops/references/standards/claude-md-convention.md +0 -123
- package/skills/adia-ui-ops/references/standards/cross-tool-matrix.md +0 -85
- package/skills/adia-ui-ops/references/standards/readme-conventions.md +0 -232
- package/skills/adia-ui-ops/references/teach-protocol.md +0 -215
- package/skills/adia-ui-ops/scripts/audit-ops-roster.mjs +0 -104
- package/skills/adia-ui-ops/skill.json +0 -65
- package/skills/adia-ui-release/CHANGELOG.md +0 -66
- package/skills/adia-ui-release/SKILL.md +0 -323
- package/skills/adia-ui-release/assets/case-studies/2026-05-20-batch-push-v0.6.14-v0.6.15.md +0 -144
- package/skills/adia-ui-release/assets/case-studies/2026-05-20-corpus-drift-remediation-v0.6.15.md +0 -155
- package/skills/adia-ui-release/assets/case-studies/2026-05-20-version-skip-correction-v0.6.12.md +0 -114
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-author-from-scratch-v0.6.18.md +0 -139
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-feedback37-retraction-v0.6.21.md +0 -124
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-fn1-enrichment-pass-v0.6.19.md +0 -125
- package/skills/adia-ui-release/assets/case-studies/2026-05-21-stale-test-detection-v0.6.20.md +0 -142
- package/skills/adia-ui-release/assets/case-studies/2026-05-23-freshness-gate-recovery-v0.6.32.md +0 -97
- package/skills/adia-ui-release/assets/case-studies/2026-05-26-catalog-drift-recurring-v0.6.40.md +0 -147
- package/skills/adia-ui-release/assets/templates/stub-changelog.template.md +0 -22
- package/skills/adia-ui-release/evals/evals.json +0 -164
- package/skills/adia-ui-release/references/changelog-discipline.md +0 -250
- package/skills/adia-ui-release/references/cycle-happy-path.md +0 -520
- package/skills/adia-ui-release/references/exe-deploy.md +0 -149
- package/skills/adia-ui-release/references/gates-catalog.md +0 -778
- package/skills/adia-ui-release/references/independent-package-release.md +0 -129
- package/skills/adia-ui-release/references/ledger-discipline.md +0 -232
- package/skills/adia-ui-release/references/migration-guide-authoring.md +0 -174
- package/skills/adia-ui-release/references/multi-agent-baseline.md +0 -207
- package/skills/adia-ui-release/references/notes-authoring.md +0 -212
- package/skills/adia-ui-release/references/recovery-paths.md +0 -262
- package/skills/adia-ui-release/references/rollup-notes.md +0 -208
- package/skills/adia-ui-release/references/teach-protocol.md +0 -468
- package/skills/adia-ui-release/scripts/audit-gate-roster.mjs +0 -196
- package/skills/adia-ui-release/scripts/make-ledger.mjs +0 -200
- package/skills/adia-ui-release/skill.json +0 -77
- package/skills/dogfood-sweep/CHANGELOG.md +0 -37
- package/skills/dogfood-sweep/README.md +0 -105
- package/skills/dogfood-sweep/SKILL.md +0 -1000
- package/skills/dogfood-sweep/analyze.mjs +0 -600
- package/skills/dogfood-sweep/skill.json +0 -31
- /package/skills/{adia-ui-authoring → adia-author}/references/api-contract.md +0 -0
- /package/skills/{adia-ui-release → adia-release}/scripts/assert-monorepo-root.mjs +0 -0
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# Reference: Eval diagnostics — gap diagnosis + regression triage
|
|
2
|
-
|
|
3
|
-
**Source:** Absorbed from the former `a2ui-pipeline` skill (§Eval Gap Diagnosis + §Eval Suite + §Verification) — Phase 3 rollup. **Used by:** mode 6 of `adia-ui-a2ui` (diagnose eval gap or regression). **Companion:** `strategy-engines.md`, `zettel-calibration.md`.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Eval Gap Diagnosis
|
|
8
|
-
|
|
9
|
-
**Mandatory first step — run diagnostics before touching code.**
|
|
10
|
-
|
|
11
|
-
The #1 anti-pattern: "tweak and hope" — changing a prompt or adding a chunk without knowing why the current score is low. This wastes eval runs (real LLM cost per run).
|
|
12
|
-
|
|
13
|
-
## Phase 0: Author a diagnostic script
|
|
14
|
-
|
|
15
|
-
For each failing intent, capture:
|
|
16
|
-
|
|
17
|
-
1. **Search ranking** — what `searchChunks()` returns for the intent query
|
|
18
|
-
2. **Composition output** — what the pipeline actually emitted (HTML or plan)
|
|
19
|
-
3. **Tag inventory** — every custom-element-like tag in emitted HTML
|
|
20
|
-
4. **Coverage delta** — expected_components vs. found_components
|
|
21
|
-
|
|
22
|
-
Diagnostic must be runnable in **stub mode** (no LLM cost).
|
|
23
|
-
|
|
24
|
-
Template:
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
async function diagnose(intent) {
|
|
28
|
-
const search = searchChunks(intent.intent, { limit: 10 });
|
|
29
|
-
const comp = await composeFromIntent({ intent: intent.intent, llmAdapter: null });
|
|
30
|
-
const tags = [...comp.html.matchAll(/<([a-z]+-[a-z-]+)[\s>]/gi)]
|
|
31
|
-
.map(m => m[1]).filter((v,i,a) => a.indexOf(v)===i);
|
|
32
|
-
const found = intent.expected_components.filter(tag =>
|
|
33
|
-
new RegExp(`<${kebab(tag)}-ui[\\s>]`).test(comp.html));
|
|
34
|
-
return { search, tags, found, missing: intent.expected_components.filter(t => !found.includes(t)) };
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Phase 1: Classify failures
|
|
39
|
-
|
|
40
|
-
| Bucket | Symptom | Root cause | Speed |
|
|
41
|
-
| --- | --- | --- | --- |
|
|
42
|
-
| A. Holdout misalignment | Top-1 retrieved ≠ expected_chunk | Holdout expected_chunk drifted from corpus | Minutes |
|
|
43
|
-
| B. Coverage gap | Retrieved chunk exists but HTML lacks expected tags | Chunk HTML doesn't contain those components | Hours (new chunks) |
|
|
44
|
-
| C. Wrong shell | Retrieval OK but LLM picks wrong page shell | Prompt ambiguity or missing domain→shell mapping | Hours (prompt tuning) |
|
|
45
|
-
| D. Broken render | HTML emitted but console errors / blank | Missing component registrations or bad markup | Hours (harvester bug) |
|
|
46
|
-
| E. Measurement bug | Composition looks correct but score low | Scoring code has regex/casing/substring bug | Minutes (fix scorer) |
|
|
47
|
-
| F. Embedding drift | Async search returns different top-1 than sync | Embeddings non-deterministically boost wrong chunks | Minutes (use sync for fast path) |
|
|
48
|
-
|
|
49
|
-
**Fix order:** A → E → F → C → B → D
|
|
50
|
-
|
|
51
|
-
- Fix measurement before fixing content (otherwise you can't trust scores)
|
|
52
|
-
- Fix determinism before adding content (otherwise evals fluctuate)
|
|
53
|
-
|
|
54
|
-
## Phase 2: Specific fixes
|
|
55
|
-
|
|
56
|
-
### A. Holdout alignment
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npm run eval:diagnose
|
|
60
|
-
# Or directly: node packages/a2ui/mcp/scripts/eval-fix.mjs --verbose
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Map each intent's `expected_chunk` to the actual top-1 retrieved chunk. Update `holdout-compose-from-chunks.jsonl`.
|
|
64
|
-
|
|
65
|
-
### E. Measurement bugs (common traps)
|
|
66
|
-
|
|
67
|
-
1. **PascalCase → kebab-case** — `AgentTrace` must become `agent-trace` (not `agenttrace`)
|
|
68
|
-
2. **Substring match** — `pane` matching `panel` gives false positives
|
|
69
|
-
3. **Regex escaping** — `textarea-ui` contains `text-ui` as substring; need word boundaries
|
|
70
|
-
4. **Case sensitivity** — HTML may be uppercase; regex needs `/i` flag
|
|
71
|
-
|
|
72
|
-
### F. Embedding drift
|
|
73
|
-
|
|
74
|
-
Symptom: `searchChunksAsync` returns different top-1 than `searchChunks`. Root cause: small cosine boosts (0.1–0.3) flip rankings unpredictably. Fix: prefer sync keyword search for deterministic paths (fast-retrieval tier). Keep async for synthesis-tier only (where creativity is desired).
|
|
75
|
-
|
|
76
|
-
### B. Coverage gap (adding block chunks)
|
|
77
|
-
|
|
78
|
-
When the LLM needs components not in corpus:
|
|
79
|
-
|
|
80
|
-
1. Create `catalog/ui-patterns/app/<name>/<name>.contents.html`
|
|
81
|
-
2. Use `data-chunk="<name>"` + `data-chunk-kind="block"` markers
|
|
82
|
-
3. Include actual component tags (`<input-ui>`, `<button-ui>`, etc.) so coverage scoring matches
|
|
83
|
-
4. Re-harvest: `npm run harvest:chunks`
|
|
84
|
-
|
|
85
|
-
### C. Wrong shell (prompt tuning)
|
|
86
|
-
|
|
87
|
-
When the LLM consistently picks the wrong page shell:
|
|
88
|
-
|
|
89
|
-
1. Check `SYSTEM_PROMPT` domain→shell mapping table
|
|
90
|
-
2. Add explicit examples for the failing domain
|
|
91
|
-
3. Add negative constraint: "NEVER default to dashboard-admin-page for non-dashboard intents"
|
|
92
|
-
|
|
93
|
-
### D. Broken render
|
|
94
|
-
|
|
95
|
-
When HTML is structurally valid but render score is low:
|
|
96
|
-
|
|
97
|
-
1. Check `render-fidelity.mjs` output: console errors, blank viewport, undefined custom elements
|
|
98
|
-
2. Verify component registrations in `packages/web-components/index.js`
|
|
99
|
-
3. Check harvester didn't strip `data-chunk-slot` from page shells
|
|
100
|
-
|
|
101
|
-
## Verification
|
|
102
|
-
|
|
103
|
-
After all fixes, run:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
# Stub first (fast, free)
|
|
107
|
-
npm run eval:compose-from-chunks
|
|
108
|
-
|
|
109
|
-
# Then real-LLM if stub improved
|
|
110
|
-
npm run eval:compose-from-chunks -- --real-llm --report-file
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Stop only when all intents pass and avg is stable across 3 runs.
|
|
114
|
-
|
|
115
|
-
## Eval Suite
|
|
116
|
-
|
|
117
|
-
`packages/a2ui/mcp/scripts/test-evals.mjs` scores generated output on 5 weighted dimensions:
|
|
118
|
-
|
|
119
|
-
- structural_validity (30%): schema validation score
|
|
120
|
-
- intent_alignment (25%): F1 of required vs present components
|
|
121
|
-
- component_coverage (20%): absence of forbidden patterns
|
|
122
|
-
- card_model_compliance (15%): header/section/footer structure
|
|
123
|
-
- anti_pattern_count (10%): text without variant, header children without slot
|
|
124
|
-
|
|
125
|
-
Baseline regression: `--save-baseline` stores scores, subsequent runs flag any dimension dropping
|
|
126
|
-
|
|
127
|
-
> 5 points or aggregate dropping >3 points. Exit code 2 = regression.
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Reference: Fragment graph — leverage rule, extraction, $fragment refs
|
|
2
|
-
|
|
3
|
-
**Source:** Absorbed from the former `a2ui-pipeline` skill (§Fragment Extraction) and `zettel-internals` (§How fragment-graph composer resolves `$fragment` refs) — Phase 3 rollup. **Used by:** mode 4 of `adia-ui-a2ui` (extract a fragment). **Companion:** `strategy-engines.md`, `chunk-authoring.md`.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Fragment Extraction
|
|
8
|
-
|
|
9
|
-
Use when converting a monolithic pattern into a composition that references one or more zettel fragments, OR when authoring a new fragment from shared substructure across multiple patterns.
|
|
10
|
-
|
|
11
|
-
## The leverage rule
|
|
12
|
-
|
|
13
|
-
**Do not extract a fragment unless it has leverage ≥ 3** — i.e., at least 3 compositions would use it. Two exceptions:
|
|
14
|
-
|
|
15
|
-
1. Singleton fragment that closes a well-defined semantic gap (e.g., `kbd-shortcut-row` even at leverage 1, because "a keyboard shortcut row" is a distinct domain primitive).
|
|
16
|
-
|
|
17
|
-
2. **Intra-composition multi-use.** A single composition that instantiates the same fragment N times (N ≥ ~10) also justifies extraction — reuse ratio is `fragment_refs / composition_nodes`, not `fragments / comps`. Example: `calendar-day-cell` is used 35× inside one composition (`calendar-month-view`), and this alone lifted corpus reuse from 26.4% → 33.5%. Treat a repeating subtree of 10+ instances as a fragment even if no other composition references it yet.
|
|
18
|
-
|
|
19
|
-
Sub-leverage fragments bloat the library, slow retrieval, and make maintenance harder without improving reuse.
|
|
20
|
-
|
|
21
|
-
## Steps
|
|
22
|
-
|
|
23
|
-
1. **Candidate identification**
|
|
24
|
-
- Look for repeated subtrees across ≥ 3 patterns
|
|
25
|
-
- Common candidates: card headers, key-value rows, icon+text rows, labeled progress bars, stat displays, notification rows
|
|
26
|
-
- Check for existing fragment first: `ls packages/a2ui/compose/fragments/` or call the `zettel_stats` MCP tool to see the current corpus
|
|
27
|
-
|
|
28
|
-
2. **Fragment authoring**
|
|
29
|
-
- File: `packages/a2ui/compose/fragments/<name>.json`
|
|
30
|
-
- Schema: `{ name, description, keywords, slots, template }`
|
|
31
|
-
- Keywords should be rich — retrieval depends on them
|
|
32
|
-
- Slots use `{ $slot: 'name' }` placeholders in the template
|
|
33
|
-
|
|
34
|
-
3. **Composition refactor**
|
|
35
|
-
- Replace the inlined subtree with `{ $fragment: 'name', bindings: {...} }`
|
|
36
|
-
- Composer at `packages/a2ui/compose/strategies/zettel/composer.js` handles namespaced id rewriting and slot expansion
|
|
37
|
-
|
|
38
|
-
4. **KEYWORD PRESERVATION (critical)**
|
|
39
|
-
- Extraction SHRINKS the composition's own keyword surface
|
|
40
|
-
- Before: the composition contained all the subtree's text
|
|
41
|
-
- After: the composition only references the fragment
|
|
42
|
-
- **Fix:** enrich the composition's `keywords` field with the semantic tokens that left with the fragment
|
|
43
|
-
- Without this, retrieval degrades silently
|
|
44
|
-
|
|
45
|
-
5. **Rebuild + verify**
|
|
46
|
-
- `node scripts/build/components.mjs`
|
|
47
|
-
- Run the full structural-gate sweep (see SKILL.md §Plan-Execute-Verify)
|
|
48
|
-
- Specifically check `eval:diff --engine zettel` for coverage + avgScore regressions
|
|
49
|
-
|
|
50
|
-
## The extraction drift lesson
|
|
51
|
-
|
|
52
|
-
During the zettel migration, extracting `card-header-with-description` from the `login-form` pattern dropped its retrieval score from 28 → 24. The cause: the composition lost all the "login", "sign in", "email password" tokens because those moved into the fragment slot bindings.
|
|
53
|
-
|
|
54
|
-
Fix applied: added `keywords: ["login", "sign in", "email", "password", "authenticate"]` explicitly to the composition. Retrieval rebounded to 28.
|
|
55
|
-
|
|
56
|
-
**Lesson:** every fragment-using composition must have richer keywords than its inlined predecessor.
|
|
57
|
-
|
|
58
|
-
## Threshold calibration
|
|
59
|
-
|
|
60
|
-
If a known-good intent starts scoring below the retrieval threshold after extraction, DO NOT lower the threshold first. First:
|
|
61
|
-
|
|
62
|
-
1. Verify the composition's keywords were preserved
|
|
63
|
-
2. Check the fragment's description doesn't cannibalize the composition's semantic space
|
|
64
|
-
3. Only then consider threshold adjustment (current: 22; lowering below 20 starts producing false matches)
|
|
65
|
-
|
|
66
|
-
## Current corpus state
|
|
67
|
-
|
|
68
|
-
For the live fragment count, reuse ratio, and top-leverage fragments, run the `zettel_stats` MCP tool or `npm run pipeline:stats` — these are runtime-derived, not pinned in this reference (the numbers drift as the corpus grows).
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## How fragment-graph composer resolves `$fragment` refs
|
|
73
|
-
|
|
74
|
-
`composer.js` algorithm (memorize before modifying):
|
|
75
|
-
|
|
76
|
-
```text
|
|
77
|
-
For each node in the composition template:
|
|
78
|
-
If node.$fragment:
|
|
79
|
-
1. Clone the fragment's template
|
|
80
|
-
2. Prefix every internal id with the composition-node id (avoid collisions)
|
|
81
|
-
e.g. fragment node "fi-in" under composition node "email" → "email--fi-in"
|
|
82
|
-
3. Apply slot bindings (set the attribute on the slot's targetId)
|
|
83
|
-
slots: [{ name: "label", targetId: "fi-field", attribute: "label", required: true }]
|
|
84
|
-
bindings: { label: "Email" } → cloned[0].label = "Email"
|
|
85
|
-
4. If node.children was provided, append those ids to the fragment root's children
|
|
86
|
-
5. Emit the fragment root under node.id, then the rest of the fragment nodes
|
|
87
|
-
Else:
|
|
88
|
-
Emit the node as-is
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Don't change ID prefixing without a corpus-wide search** — fragments that compose nest IDs predictably; consumers may pattern-match on the `{compNode}--{fragNode}` shape.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Reference: MCP pipeline operations — generate → validate → render → feedback
|
|
2
|
-
|
|
3
|
-
**Source:** Absorbed from the former `adia-ui-training` skill (§Workflows + §Validation checks + §Feedback loop) — Phase 3 rollup. **Used by:** mode 1 of `adia-ui-a2ui` (operator-side MCP runs). **Companion:** `mcp-tool-reference.md`, `anti-patterns.md`, `eval-diagnostics.md`.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Workflows
|
|
8
|
-
|
|
9
|
-
### Full pipeline — one command
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
node scripts/mcp-pipeline.cjs "dashboard with 4 stat cards and a revenue chart"
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Pipes `intent → generate_ui → validate_schema → a2ui-to-html → check_anti_patterns` and prints the scores. Fastest way to confirm the whole stack is working after a change.
|
|
16
|
-
|
|
17
|
-
### Step-by-step (when you need to inspect intermediates)
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# 1. Generate
|
|
21
|
-
node scripts/mcp-call.cjs generate_ui \
|
|
22
|
-
'{"intent":"dashboard with 4 stat cards","mode":"instant"}'
|
|
23
|
-
|
|
24
|
-
# 2. Validate — paste the messages array from step 1
|
|
25
|
-
node scripts/mcp-call.cjs validate_schema \
|
|
26
|
-
'{"messages":"<paste-messages-json>"}'
|
|
27
|
-
|
|
28
|
-
# 3. Render — inspect the HTML before anti-pattern scanning
|
|
29
|
-
echo '<paste-messages-json>' | node scripts/a2ui-to-html.cjs
|
|
30
|
-
|
|
31
|
-
# 4. Anti-pattern check
|
|
32
|
-
node scripts/mcp-call.cjs check_anti_patterns \
|
|
33
|
-
'{"html":"<paste-rendered-html>"}'
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Validation-only (existing A2UI doc)
|
|
37
|
-
|
|
38
|
-
Useful for auditing training corpus entries. `validate_schema` is fast and deterministic — batch it over `packages/a2ui/corpus/patterns/**/*.json` to surface drift without re-running the generator.
|
|
39
|
-
|
|
40
|
-
### Multi-turn generation (legacy executionId chain)
|
|
41
|
-
|
|
42
|
-
Every `generate_ui` response includes an `executionId`. Pass it back on subsequent calls to keep the pattern-library context and the feedback record coherent — so a score submitted against that id attributes correctly to the original run.
|
|
43
|
-
|
|
44
|
-
### Compose from the chunk corpus
|
|
45
|
-
|
|
46
|
-
When the intent matches a known page-shape (auth flow, dashboard layout, error shell), prefer `compose_from_chunks` over `generate_ui`:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
node scripts/mcp-call.cjs compose_from_chunks \
|
|
50
|
-
'{"intent":"sign-in card with email + password + OAuth"}'
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
The synthesizer first checks for a strong retrieval match (score ≥ 8); if no chunk dominates, it picks a `{page, slot_bindings}` plan from a pre-filtered ~30 catalog and materializes via the chunk composer. Validator enforces slot-name + chunk-kind contracts before HTML emission. Returns `{state_id, html, plan, candidates}` — pass `state_id` to `refine_composition` to mutate this surface in subsequent turns.
|
|
54
|
-
|
|
55
|
-
### Multi-turn refinement (state_id chain)
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
# Turn 1: create the surface
|
|
59
|
-
node scripts/mcp-call.cjs compose_from_chunks \
|
|
60
|
-
'{"intent":"sign-in card with email + password"}'
|
|
61
|
-
# → returns state_id "abc123"
|
|
62
|
-
|
|
63
|
-
# Turn 2: mutate by intent
|
|
64
|
-
node scripts/mcp-call.cjs refine_composition \
|
|
65
|
-
'{"state_id":"abc123","intent":"add OAuth row with Google + GitHub"}'
|
|
66
|
-
# → returns updateComponents A2UI messages + new state_id "def456"
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The refiner runs two-pass synthesis:
|
|
70
|
-
|
|
71
|
-
1. **Locator** — identifies which slots are affected by the intent
|
|
72
|
-
2. **Modifier** — picks the op (`rebindSlot`/`appendToSlot`/`removeFromSlot`/`replacePage`) and target chunk
|
|
73
|
-
|
|
74
|
-
Validator-driven retry loop (default `maxAttempts=2`). Each refinement chains through `parent_state_id` so you can `get_state` and walk back through the conversation history.
|
|
75
|
-
|
|
76
|
-
### Reporting issues from the LLM side
|
|
77
|
-
|
|
78
|
-
If you (the agent) determine that the engine produced something that breaks expectations, fire `report_issue`:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
node scripts/mcp-call.cjs report_issue \
|
|
82
|
-
'{"state_id":"abc123","reporter":"llm","reason":"slot-binding produced empty section","trace":{...}}'
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Lands as immutable JSON under `.brain/audit-history/issues/`. These become weekly-triage candidates for promotion to curated tickets when patterns emerge.
|
|
86
|
-
|
|
87
|
-
## Validation checks
|
|
88
|
-
|
|
89
|
-
`validate_schema` runs a weighted checklist (target aggregate ≥ 80). Common failures when training data drifts:
|
|
90
|
-
|
|
91
|
-
- `hasRootComponent` — missing `id: "root"` on the surface root.
|
|
92
|
-
- `cardContentModel` — section without `col-ui` wrapper, or heading inside section instead of header.
|
|
93
|
-
- `headingHierarchy` — skipped levels (h1 → h3).
|
|
94
|
-
- `flatAdjacency` — nested components instead of sibling id references.
|
|
95
|
-
|
|
96
|
-
Full list + weights: `mcp-tool-reference.md`.
|
|
97
|
-
|
|
98
|
-
## Feedback loop
|
|
99
|
-
|
|
100
|
-
After a run, score the output with `submit_feedback` keyed on the `executionId`. The feedback analyzer (`packages/a2ui/retrieval/feedback/feedback-analyzer.js`) aggregates these into:
|
|
101
|
-
|
|
102
|
-
- Per-intent quality trends.
|
|
103
|
-
- Promotion candidates (runs scoring ≥ 95 with ≥ 4 rating across 3+ runs become named patterns via `npm run feedback:promote --apply`).
|
|
104
|
-
- Gap registry — intents with no pattern match AND low scores land in `packages/a2ui/corpus/gaps/registry.json`.
|
|
105
|
-
|
|
106
|
-
Running `npm run feedback:report` surfaces the current state.
|