diff --git a/.gitignore b/.gitignore index c34c01b..a42bd78 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ dist .tmp judgmentkit-product-spec-package.zip output/playwright +artifacts/ public/resources public/schemas public/docs diff --git a/app/mcp/route.ts b/app/mcp/route.ts index 6566fa3..7b34e26 100644 --- a/app/mcp/route.ts +++ b/app/mcp/route.ts @@ -1,38 +1,20 @@ -import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js"; -import { NextResponse } from "next/server"; - -import { createJudgmentKitMcpServer, getMcpMetadata } from "@/lib/mcp-server"; +import { handleMcpHttpRequest } from "@/lib/mcp-http"; export const runtime = "nodejs"; export const dynamic = "force-dynamic"; -function wantsSse(request: Request) { - return request.headers.get("accept")?.includes("text/event-stream") ?? false; -} - -async function handleStreamableHttpRequest(request: Request) { - const server = createJudgmentKitMcpServer(); - const transport = new WebStandardStreamableHTTPServerTransport({ - sessionIdGenerator: undefined, - enableJsonResponse: true, - }); - - await server.connect(transport); - return transport.handleRequest(request); -} - export async function GET(request: Request) { - if (!wantsSse(request)) { - return NextResponse.json(getMcpMetadata("streamable-http")); - } - - return handleStreamableHttpRequest(request); + return handleMcpHttpRequest(request); } export async function POST(request: Request) { - return handleStreamableHttpRequest(request); + return handleMcpHttpRequest(request); } export async function DELETE(request: Request) { - return handleStreamableHttpRequest(request); + return handleMcpHttpRequest(request); +} + +export async function OPTIONS(request: Request) { + return handleMcpHttpRequest(request, { allowOptions: true, cors: true }); } diff --git a/components/inspect-surface.tsx b/components/inspect-surface.tsx index 109bfe9..c71a7d4 100644 --- a/components/inspect-surface.tsx +++ b/components/inspect-surface.tsx @@ -24,7 +24,13 @@ type InspectDocumentState = const HASH_PREFIX = "#resource-"; const INSPECT_RESOURCE_RAIL_ID = "inspect-resource-rail"; -const INSPECT_CATEGORY_ORDER = ["Examples", "Workflows", "Guardrails"] as const; +const INSPECT_CATEGORY_ORDER = [ + "Examples", + "Workflows", + "Constraint packs", + "Guideline profiles", + "Guardrails", +] as const; const VIEWER_MODE_LABELS: Record = { prompt: "Prompt", @@ -115,6 +121,10 @@ function getItemEyebrow(item: ProductSurfaceInspectItem) { return "Workflow"; case "guardrail": return "Guardrail"; + case "constraint_pack": + return "Constraint pack"; + case "guideline_profile": + return "Guideline profile"; case "example": return "Example"; default: diff --git a/content/docs/examples/mode-structure-drift.mdx b/content/docs/examples/mode-structure-drift.mdx new file mode 100644 index 0000000..30122af --- /dev/null +++ b/content/docs/examples/mode-structure-drift.mdx @@ -0,0 +1,65 @@ +--- +title: Mode structure drift +slug: /docs/examples/mode-structure-drift +page_type: example +summary: A product-surface request defaults to a marketing hero, then gets rewritten to lead with the working surface. +agent_summary: > + This example calibrates visually led UI generation against the surface mode + contract, especially product surfaces that drift into marketing-page + structure. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.surface-mode-structure +owners: + primary: Design Systems + risk: Product + operational: Frontend Platform +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/guardrails/surface-mode-structure +related_resources: + - /resources/examples/mode-structure-drift.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A team asks for a calmer review workspace where operators triage generated UI candidates and compare evidence. + +## Raw decision or output + +`Start with a premium hero explaining the AI review platform, add three benefit cards, a stat strip, and a floating dashboard preview below the fold.` + +## What JudgmentKit detected + +- the task was operational but the first viewport used marketing structure +- product proof was delayed behind generic hero, card, and stat patterns +- no single surface mode was named before layout decisions were made + +## What action was taken + +JudgmentKit selected product-surface mode and moved the working review surface into the first viewport. + +## Corrected result + +`Mode: product surface. First viewport: a triage workspace with candidate list, active preview, evidence inspector, and local decision actions. Follow with orientation copy that explains scope and freshness, then secondary context for guideline coverage and unresolved review questions.` + +## Why the correction matters + +Visually led product surfaces still need to satisfy the operator's first job before they sell the product. + +## JSON artifact links + +- Example resource: `/resources/examples/mode-structure-drift.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/motion-media-drift.mdx b/content/docs/examples/motion-media-drift.mdx new file mode 100644 index 0000000..e76da62 --- /dev/null +++ b/content/docs/examples/motion-media-drift.mdx @@ -0,0 +1,64 @@ +--- +title: Motion media drift +slug: /docs/examples/motion-media-drift +page_type: example +summary: Decorative media and motion are rewritten into product proof, restrained transitions, and reduced-motion handling. +agent_summary: > + This example calibrates visual UI generation so motion and media serve + hierarchy, affordance, or product proof rather than decoration. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.motion-media-purpose +owners: + primary: Design Systems + risk: Accessibility + operational: Frontend Platform +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/guardrails/motion-media-purpose +related_resources: + - /resources/examples/motion-media-drift.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A model is asked to make a launch page feel cinematic for a developer tool without supplied product imagery. + +## Raw decision or output + +`Use abstract animated blobs, parallax glow layers, a rotating carousel of screenshots, and continuous floating motion behind the headline.` + +## What JudgmentKit detected + +- media was atmospheric rather than evidence of the product, state, or workflow +- motion was continuous decoration rather than hierarchy or affordance +- reduced-motion and readability constraints were missing + +## What action was taken + +JudgmentKit pivoted to product UI as the visual anchor and downgraded motion to purposeful, reduced-motion-safe transitions. + +## Corrected result + +`Use the product UI state as the primary visual anchor. Motion plan: stagger the headline and install action once on entry, reveal the proof plane with opacity and translate, and use a small hover transition on the primary action. Honor prefers-reduced-motion by removing translate and keeping instant opacity changes.` + +## Why the correction matters + +Motion and media should carry meaning. If they do not clarify hierarchy, proof, or affordance, they add review cost and accessibility risk. + +## JSON artifact links + +- Example resource: `/resources/examples/motion-media-drift.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/output-contract-gap.mdx b/content/docs/examples/output-contract-gap.mdx new file mode 100644 index 0000000..f4a78c9 --- /dev/null +++ b/content/docs/examples/output-contract-gap.mdx @@ -0,0 +1,65 @@ +--- +title: Output contract gap +slug: /docs/examples/output-contract-gap +page_type: example +summary: A visual implementation summary omits mode, visual thesis, and motion plan, then gets completed with contract evidence. +agent_summary: > + This example shows how JudgmentKit completes visually led implementation + responses so reviewers can audit the mode, thesis, motion plan, and any + downgrade. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.frontend-output-contract +owners: + primary: Design Systems + risk: Product + operational: AI Application Developers +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/guardrails/frontend-output-contract +related_resources: + - /resources/examples/output-contract-gap.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +An agent updates a product UI to feel calmer and more deliberate, but the final response omits the visual contract evidence. + +## Raw decision or output + +`Updated the page styling, improved spacing, and made the interface feel more polished. Tests passed.` + +## What JudgmentKit detected + +- the final response did not state the selected mode +- the final response omitted the visual thesis and motion plan +- the implementation could not be audited from the response + +## What action was taken + +JudgmentKit completed the response with the required visual output contract and disclosed the motion downgrade. + +## Corrected result + +`Updated the actual product surface to lead with the workspace, reduce card chrome, and tighten copy. Visual Thesis: calm operational clarity with strong typography and low-chrome structure. Mode: product surface. Motion Plan: hover affordance on primary actions and reduced-motion-safe opacity transitions; richer scroll motion was intentionally skipped to preserve runtime budget.` + +## Why the correction matters + +Visual implementation needs review evidence. The final answer should make the mode, thesis, motion choices, and downgrades explicit without forcing the user to reconstruct intent. + +## JSON artifact links + +- Example resource: `/resources/examples/output-contract-gap.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/primitive-sprawl-drift.mdx b/content/docs/examples/primitive-sprawl-drift.mdx new file mode 100644 index 0000000..1fd3d91 --- /dev/null +++ b/content/docs/examples/primitive-sprawl-drift.mdx @@ -0,0 +1,66 @@ +--- +title: Primitive sprawl drift +slug: /docs/examples/primitive-sprawl-drift +page_type: example +summary: A no-design-system workspace draft invents bespoke modules, then gets rewritten into the portable JudgmentKit primitive inventory. +agent_summary: > + This example shows how JudgmentKit rewrites bespoke visual modules into the + published primitive vocabulary when no external design system exists. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.design-system-integrity + - guardrail.spec-completeness +owners: + primary: Design Systems + risk: Accessibility + operational: Frontend Platform +status: active +last_reviewed: 2026-04-14 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/reference/portable-no-design-system-pack + - /docs/guardrails/design-system-integrity + - /docs/guardrails/spec-completeness +related_resources: + - /resources/examples/primitive-sprawl-drift.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A model tries to make a review workspace feel premium in one pass without a real design system. + +## Raw decision or output + +`Build a floating insight ribbon, a holographic evidence capsule, a decision dock, and a metadata halo around the selected artifact.` + +## What JudgmentKit detected + +- bespoke primitives without authority +- visual modules that cannot be compared against a stable component vocabulary + +## What action was taken + +JudgmentKit rewrote the surface using the published layout shell, artifact panel, inspector, card, and button primitives. + +## Corrected result + +`Use a layout shell with a queue list on the left, a header plus artifact panel in the workspace center, and a persistent inspector on the right. Represent decision actions with buttons inside the artifact panel header instead of inventing a new decision dock primitive.` + +## Why the correction matters + +Portable governance depends on a closed primitive vocabulary. Recomposition is allowed. Primitive invention is not. + +## JSON artifact links + +- Example resource: `/resources/examples/primitive-sprawl-drift.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/shallow-handoff-drift.mdx b/content/docs/examples/shallow-handoff-drift.mdx new file mode 100644 index 0000000..9eddf3d --- /dev/null +++ b/content/docs/examples/shallow-handoff-drift.mdx @@ -0,0 +1,65 @@ +--- +title: Shallow handoff drift +slug: /docs/examples/shallow-handoff-drift +page_type: example +summary: A clean-looking UI brief omits the implementation contract, then gets rewritten into the required portable handoff sections. +agent_summary: > + This example shows how JudgmentKit rewrites aesthetic summaries into a real + token, recipe, composition, state, theme, accessibility, and escalation + handoff packet. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.spec-completeness +owners: + primary: Frontend Platform + risk: Design Systems + operational: AI Application Developers +status: active +last_reviewed: 2026-04-14 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/reference/portable-no-design-system-pack + - /docs/guardrails/spec-completeness +related_resources: + - /resources/examples/shallow-handoff-drift.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A team asks for an implementation-ready export flow, but the first pass only describes how the interface should feel. + +## Raw decision or output + +`The export page should feel simple and trustworthy, with clear cards, obvious hierarchy, and a polished summary area before the final handoff action.` + +## What JudgmentKit detected + +- a visual summary with no token, component, or theme contract +- no explicit state coverage or escalation list + +## What action was taken + +JudgmentKit rewrote the handoff into the required portable sections. + +## Corrected result + +`Return core_screens, token_spec, component_recipes, screen_composition, state_coverage, theme_contract, accessibility_contract, and escalation_items. Map the summary region to card plus artifact-panel recipes, include React+Tailwind composition snippets with slots and interaction rules, define loading, empty, ready, error, review-needed, and disabled states, bind light-dark tokens explicitly, and list the export edge cases that still require review.` + +## Why the correction matters + +Portable UI authority only helps implementation when the handoff survives beyond the model run itself. + +## JSON artifact links + +- Example resource: `/resources/examples/shallow-handoff-drift.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/state-coverage-drift.mdx b/content/docs/examples/state-coverage-drift.mdx new file mode 100644 index 0000000..0e44da7 --- /dev/null +++ b/content/docs/examples/state-coverage-drift.mdx @@ -0,0 +1,66 @@ +--- +title: State coverage drift +slug: /docs/examples/state-coverage-drift +page_type: example +summary: A review flow spec names the ready state only, then gets rewritten into the required portable state matrix. +agent_summary: > + This example shows how JudgmentKit rewrites happy-path-only UI specs into a + full loading, empty, error, review-needed, and disabled state contract. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.spec-completeness + - guardrail.surface-theme-parity +owners: + primary: Frontend Platform + risk: Design Systems + operational: AI Application Developers +status: active +last_reviewed: 2026-04-14 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/reference/portable-no-design-system-pack + - /docs/guardrails/spec-completeness + - /docs/guardrails/surface-theme-parity +related_resources: + - /resources/examples/state-coverage-drift.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A model proposes an artifact review flow and assumes a record is always present and valid. + +## Raw decision or output + +`Show the artifact in the center panel, add approve and request changes actions, and place the supporting notes in a right-side inspector.` + +## What JudgmentKit detected + +- ready-state-only thinking +- missing empty, error, review-needed, and disabled behavior for the artifact panel + +## What action was taken + +JudgmentKit attached the required state matrix to the local artifact panel and its decision controls. + +## Corrected result + +`State coverage: loading uses structural placeholders in the artifact panel; empty explains that no artifact is selected and offers one next action; ready shows the artifact plus adjacent decision buttons; error keeps the layout stable while exposing retry and details; review-needed adds the unresolved owner callout beside the affected artifact; disabled explains why approve or export actions are unavailable.` + +## Why the correction matters + +State coverage is part of the surface contract, not an implementation detail left for later. + +## JSON artifact links + +- Example resource: `/resources/examples/state-coverage-drift.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/token-vagueness-drift.mdx b/content/docs/examples/token-vagueness-drift.mdx new file mode 100644 index 0000000..c9094ec --- /dev/null +++ b/content/docs/examples/token-vagueness-drift.mdx @@ -0,0 +1,66 @@ +--- +title: Token vagueness drift +slug: /docs/examples/token-vagueness-drift +page_type: example +summary: A no-design-system UI draft uses stylistic adjectives instead of actual token bindings, then gets rewritten into the portable JudgmentKit contract. +agent_summary: > + This example shows how JudgmentKit rewrites vague design language into + concrete token values and light-dark bindings. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.design-system-integrity + - guardrail.spec-completeness +owners: + primary: Frontend Platform + risk: Design Systems + operational: AI Application Developers +status: active +last_reviewed: 2026-04-14 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/reference/portable-no-design-system-pack + - /docs/guardrails/design-system-integrity + - /docs/guardrails/spec-completeness +related_resources: + - /resources/examples/token-vagueness-drift.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A team asks for a restrained, implementation-ready workspace UI without an external design system. + +## Raw decision or output + +`Use soft neutral surfaces, slightly darker side panels, roomy spacing, and modest rounding so the interface feels calm and premium.` + +## What JudgmentKit detected + +- token language that sounds disciplined but is not implementable +- theme guidance implied without explicit light-dark bindings + +## What action was taken + +JudgmentKit rewrote the surface into named token bindings from the portable no-design-system pack. + +## Corrected result + +`Use --jk-color-canvas (#f6f5f2 / #121315) for the page background, --jk-color-surface (#ffffff / #1b1d21) for cards and drawers, --jk-space-4 (16px) for section padding, --jk-space-5 (24px) for inter-section gaps, and --jk-radius-2 (6px) for cards, inputs, and drawers.` + +## Why the correction matters + +Portable authority breaks if reviewers and implementation teams still need to translate adjectives into actual values. + +## JSON artifact links + +- Example resource: `/resources/examples/token-vagueness-drift.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/examples/visual-planning-gap.mdx b/content/docs/examples/visual-planning-gap.mdx new file mode 100644 index 0000000..9047fe4 --- /dev/null +++ b/content/docs/examples/visual-planning-gap.mdx @@ -0,0 +1,64 @@ +--- +title: Visual planning gap +slug: /docs/examples/visual-planning-gap +page_type: example +summary: A vague premium/modern request is rewritten into mode, visual thesis, content plan, and interaction thesis. +agent_summary: > + This example shows how JudgmentKit turns vague visual adjectives into an + actionable planning contract before implementation starts. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.visual-planning-contract +owners: + primary: Design Systems + risk: Product + operational: Frontend Platform +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/guardrails/visual-planning-contract +related_resources: + - /resources/examples/visual-planning-gap.v1.json +related_schemas: + - /schemas/example.schema.json + - /schemas/verdict.schema.json +toc: true +--- + +## Scenario + +A model receives a short brief to make an existing product page feel more premium and modern. + +## Raw decision or output + +`Make the page pop with glass panels, a bold gradient background, large rounded corners, soft shadows, animated stats, and modern cards.` + +## What JudgmentKit detected + +- premium and modern were not translated into concrete hierarchy, composition, or motion decisions +- decoration was selected before a visual thesis or content plan existed +- the output could not be implemented without reinterpreting the intended direction + +## What action was taken + +JudgmentKit rewrote the answer into a compact planning contract before implementation details. + +## Corrected result + +`Mode: hybrid demo. Visual Thesis: quiet editorial confidence using strong typography, one real product proof plane, and restrained contrast. Content Plan: branded entry, product proof, one workflow detail, final install action. Interaction Thesis: a short entrance sequence for the entry text, hover reveal for the proof plane, and reduced-motion-safe opacity transitions only.` + +## Why the correction matters + +Visual adjectives do not give implementation teams enough to build or evaluate. The plan must name the actual hierarchy, composition, and motion choices. + +## JSON artifact links + +- Example resource: `/resources/examples/visual-planning-gap.v1.json` +- Schema: `/schemas/example.schema.json` diff --git a/content/docs/guardrails/frontend-output-contract.mdx b/content/docs/guardrails/frontend-output-contract.mdx new file mode 100644 index 0000000..4d21210 --- /dev/null +++ b/content/docs/guardrails/frontend-output-contract.mdx @@ -0,0 +1,69 @@ +--- +title: Frontend output contract +slug: /docs/guardrails/frontend-output-contract +page_type: guardrail +summary: Require visually led UI implementation or direction to return the selected mode, visual thesis, motion plan, and disclosed constraints. +agent_summary: > + This guardrail keeps the final response for visual UI work auditable by + requiring the implementation result or direction headings to carry the + visual contract evidence. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.frontend-output-contract +owners: + primary: Design Systems + risk: Product + operational: AI Application Developers +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/examples/output-contract-gap +related_resources: + - /resources/guardrails/frontend-output-contract.v1.json +related_schemas: + - /schemas/guardrail.schema.json +toc: true +--- + +## Why this matters + +The final response is part of the handoff. If visually led work ends with "updated the styling" and no thesis, mode, or motion plan, reviewers cannot tell whether the work followed the intended contract or simply applied decorative polish. + +## What decision is being governed + +This guardrail governs whether a visually led implementation or direction-only response includes the required evidence for review. + +## What good judgment looks like + +- implementation work updates the actual UI +- implementation responses include a short summary, `Visual Thesis`, `Mode`, and `Motion Plan` +- direction-only work uses exactly `Visual Thesis`, `Structure`, `Motion Plan`, `Asset Needs`, and `Risks` +- any failed accessibility, mobile, asset, runtime, or motion check is disclosed + +## What drift looks like + +1. The final response omits the selected mode. +2. Motion is absent without a downgrade reason. +3. Direction-only output uses custom headings and hides asset needs. +4. The answer describes intent while files remain unchanged. + +## How JudgmentKit responds + +Small gaps get completed before returning. Medium gaps get reviewed for traceability. Severe gaps block the response until the required implementation evidence or direction headings are present. + +## Technical reference + +- Resource: `/resources/guardrails/frontend-output-contract.v1.json` +- Schema: `/schemas/guardrail.schema.json` + +## Related pages + +- /docs/workflows/ai-ui-generation +- /docs/examples/output-contract-gap diff --git a/content/docs/guardrails/motion-media-purpose.mdx b/content/docs/guardrails/motion-media-purpose.mdx new file mode 100644 index 0000000..2f1df6b --- /dev/null +++ b/content/docs/guardrails/motion-media-purpose.mdx @@ -0,0 +1,71 @@ +--- +title: Motion and media purpose +slug: /docs/guardrails/motion-media-purpose +page_type: guardrail +summary: Keep imagery and motion tied to narrative, hierarchy, or affordance instead of decorative load. +agent_summary: > + This guardrail makes AI UI generation justify motion and media choices and + downgrade them before they harm readability, accessibility, mobile fit, or + runtime budget. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.motion-media-purpose +owners: + primary: Design Systems + risk: Accessibility + operational: Frontend Platform +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/examples/motion-media-drift +related_resources: + - /resources/guardrails/motion-media-purpose.v1.json +related_schemas: + - /schemas/guardrail.schema.json +toc: true +--- + +## Why this matters + +Media and motion can make a surface feel deliberate, but they can also become a shortcut around structure. Abstract visuals, constant movement, and carousels with no narrative purpose make generated UI harder to read, operate, and review. + +## What decision is being governed + +This guardrail governs whether media and motion have a clear job and remain bounded by accessibility, readability, mobile, and runtime constraints. + +## What good judgment looks like + +- use imagery to reveal the product, place, object, state, workflow, or narrative +- use motion for presence, hierarchy, affordance, or transition clarity +- prefer opacity and transform motion +- honor `prefers-reduced-motion` +- pivot to typography, shape, contrast, or product UI when imagery is weak + +## What drift looks like + +1. Abstract media is treated as the primary proof. +2. Motion is continuous decoration. +3. A carousel or sticky effect has no narrative job. +4. Text contrast or focus clarity depends on fragile media treatment. +5. Runtime-heavy animation appears in a constrained first pass. + +## How JudgmentKit responds + +Small drift gets downgraded to purposeful transitions and a clearer media anchor. Medium drift receives design and accessibility review. Severe drift blocks the output when media or motion undermines usability, accessibility, or product truth. + +## Technical reference + +- Resource: `/resources/guardrails/motion-media-purpose.v1.json` +- Schema: `/schemas/guardrail.schema.json` + +## Related pages + +- /docs/workflows/ai-ui-generation +- /docs/examples/motion-media-drift diff --git a/content/docs/guardrails/spec-completeness.mdx b/content/docs/guardrails/spec-completeness.mdx new file mode 100644 index 0000000..a8d3932 --- /dev/null +++ b/content/docs/guardrails/spec-completeness.mdx @@ -0,0 +1,84 @@ +--- +title: Spec completeness +slug: /docs/guardrails/spec-completeness +page_type: guardrail +summary: Require AI-generated UI output to name concrete primitives, tokens, states, and handoff details instead of relying on vague design language. +agent_summary: > + This guardrail explains how JudgmentKit blocks or rewrites underspecified UI + specs so they remain implementation-ready and comparable. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.spec-completeness +owners: + primary: Frontend Platform + risk: Design Systems + operational: AI Application Developers +status: active +last_reviewed: 2026-04-14 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/reference/portable-no-design-system-pack + - /docs/guardrails/design-system-integrity + - /docs/examples/token-vagueness-drift + - /docs/examples/primitive-sprawl-drift + - /docs/examples/shallow-handoff-drift + - /docs/examples/state-coverage-drift +related_resources: + - /resources/guardrails/spec-completeness.v1.json +related_schemas: + - /schemas/guardrail.schema.json +toc: true +--- + +## Why this matters + +A generated UI plan can sound disciplined while still forcing humans to infer the actual build. That is a cleanup cost. It also makes model-to-model comparisons unreliable because the judgment depends on whoever fills the missing pieces afterward. + +## What decision is being governed + +This guardrail governs whether a UI output is concrete enough to implement, review, or compare without hidden assumptions. + +## What good judgment looks like + +- names the concrete primitive inventory +- names exact token bindings or values +- names required light and dark theme pairs +- names loading, empty, ready, error, review-needed, and disabled states when the surface can encounter them +- carries the handoff sections needed for implementation and review + +## What drift looks like + +1. The output says clean, premium, neutral, slightly raised, or roomy instead of naming actual tokens. +2. New component wrappers appear without mapping to a published primitive inventory. +3. The happy path is specified, but error or empty states are left implicit. +4. The model claims theme completeness without naming the light and dark bindings. +5. Implementation teams receive a visual description instead of a real handoff packet. + +## How JudgmentKit responds + +Small gaps get auto-normalized into explicit tokens or sections. Medium gaps get rewritten into the full contract. Severe gaps block the spec until the missing sections are completed. + +## Boundaries + +Compact output is allowed. Vague output is not. The goal is not verbosity. The goal is enough specificity to build and judge the result without filling in hidden design decisions afterward. + +## Technical reference + +- Resource: `/resources/guardrails/spec-completeness.v1.json` +- Schema: `/schemas/guardrail.schema.json` + +## Related pages + +- /docs/workflows/ai-ui-generation +- /docs/reference/portable-no-design-system-pack +- /docs/guardrails/design-system-integrity +- /docs/examples/token-vagueness-drift +- /docs/examples/primitive-sprawl-drift +- /docs/examples/shallow-handoff-drift +- /docs/examples/state-coverage-drift diff --git a/content/docs/guardrails/surface-mode-structure.mdx b/content/docs/guardrails/surface-mode-structure.mdx new file mode 100644 index 0000000..255593c --- /dev/null +++ b/content/docs/guardrails/surface-mode-structure.mdx @@ -0,0 +1,69 @@ +--- +title: Surface mode structure +slug: /docs/guardrails/surface-mode-structure +page_type: guardrail +summary: Require visually led UI generation to choose one mode before structuring the first viewport and section order. +agent_summary: > + This guardrail keeps marketing, product, and hybrid demo structures from + mixing into a generic hero or card grid when the user's job needs a specific + first-screen model. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.surface-mode-structure +owners: + primary: Design Systems + risk: Product + operational: Frontend Platform +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/examples/mode-structure-drift +related_resources: + - /resources/guardrails/surface-mode-structure.v1.json +related_schemas: + - /schemas/guardrail.schema.json +toc: true +--- + +## Why this matters + +AI-generated UI often defaults to a familiar landing-page shell even when the requested surface is operational. That produces a good-looking first impression with the wrong job: the user sees campaign copy, cards, and proof claims before they can operate the product. + +## What decision is being governed + +This guardrail governs whether a visually led UI task chooses exactly one mode before layout work starts: `marketing surface`, `product surface`, or `hybrid demo`. + +## What good judgment looks like + +- marketing surfaces lead with brand or product, promise, CTA, and one dominant visual +- product surfaces lead with the working surface, status, context, and action areas +- hybrid demos move quickly from a branded entry into believable product proof +- every section has one job and supports the selected mode + +## What drift looks like + +1. An operational tool starts with a marketing hero. +2. A launch page hides the brand behind generic product copy. +3. A hybrid demo spends multiple sections on promise before showing product proof. +4. Card grids, stat strips, and floating dashboards appear before the surface job is clear. + +## How JudgmentKit responds + +Small mode gaps get restructured into the correct first viewport and section order. Medium gaps receive design review. Severe mode mismatch blocks the output until the surface structure matches the user's actual job. + +## Technical reference + +- Resource: `/resources/guardrails/surface-mode-structure.v1.json` +- Schema: `/schemas/guardrail.schema.json` + +## Related pages + +- /docs/workflows/ai-ui-generation +- /docs/examples/mode-structure-drift diff --git a/content/docs/guardrails/visual-planning-contract.mdx b/content/docs/guardrails/visual-planning-contract.mdx new file mode 100644 index 0000000..e208920 --- /dev/null +++ b/content/docs/guardrails/visual-planning-contract.mdx @@ -0,0 +1,69 @@ +--- +title: Visual planning contract +slug: /docs/guardrails/visual-planning-contract +page_type: guardrail +summary: Require visually led UI work to define a visual thesis, content plan, and interaction thesis before implementation. +agent_summary: > + This guardrail turns vague art-direction asks into concrete hierarchy, + composition, content, and motion decisions before UI generation starts. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.visual-planning-contract +owners: + primary: Design Systems + risk: Product + operational: Frontend Platform +status: active +last_reviewed: 2026-04-23 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/examples/visual-planning-gap +related_resources: + - /resources/guardrails/visual-planning-contract.v1.json +related_schemas: + - /schemas/guardrail.schema.json +toc: true +--- + +## Why this matters + +Prompts like "make it premium" or "make it feel modern" are not implementation contracts. Without a planning frame, the model usually adds gradients, shadows, radius, and cards before it decides what hierarchy or composition should change. + +## What decision is being governed + +This guardrail governs whether the generator has translated visual intent into actionable planning before it drafts layout, styling, or code. + +## What good judgment looks like + +- define `Visual Thesis` as mood, material, and energy +- define `Content Plan` as ordered section jobs for the selected mode +- define `Interaction Thesis` as purposeful motion or interaction ideas +- translate vague asks into hierarchy, composition, and motion decisions +- preserve existing design-system tokens and patterns unless the user requested a rework + +## What drift looks like + +1. The draft says premium, calm, or modern without concrete decisions. +2. Decorative styling appears before structure is clear. +3. Sections repeat the same job because no content plan exists. +4. The motion plan is described as polish instead of a hierarchy or affordance decision. + +## How JudgmentKit responds + +Small gaps get filled with the missing planning frame. Medium gaps get rewritten before implementation. Severe gaps block the output until the visual direction can be made buildable. + +## Technical reference + +- Resource: `/resources/guardrails/visual-planning-contract.v1.json` +- Schema: `/schemas/guardrail.schema.json` + +## Related pages + +- /docs/workflows/ai-ui-generation +- /docs/examples/visual-planning-gap diff --git a/content/docs/reference/portable-no-design-system-pack.mdx b/content/docs/reference/portable-no-design-system-pack.mdx new file mode 100644 index 0000000..938045a --- /dev/null +++ b/content/docs/reference/portable-no-design-system-pack.mdx @@ -0,0 +1,147 @@ +--- +title: Portable no-design-system pack +slug: /docs/reference/portable-no-design-system-pack +page_type: reference +summary: JudgmentKit's portable UI implementation authority for cases where no external design system is present. +agent_summary: > + This reference defines the published primitive inventory, token contract, + reusable component recipes, state matrix, layout archetypes, vendored + guideline profiles, and handoff requirements for no-design-system AI UI + generation. +audiences: + - design-leaders + - product-managers + - platform-engineering + - ai-application-developers +workflows: + - workflow.ai-ui-generation +guardrails: + - guardrail.design-system-integrity + - guardrail.spec-completeness +owners: + primary: Design Systems + risk: Accessibility + operational: Frontend Platform +status: active +last_reviewed: 2026-04-14 +related_pages: + - /docs/workflows/ai-ui-generation + - /docs/guardrails/design-system-integrity + - /docs/guardrails/spec-completeness + - /docs/examples/token-vagueness-drift + - /docs/examples/primitive-sprawl-drift +related_resources: + - /resources/constraint-packs/ai-ui-no-design-system.v1.json +related_schemas: + - /schemas/constraint_pack.schema.json +toc: true +--- + +## Why this pack exists + +JudgmentKit previously governed no-design-system UI generation mostly through restraint language and escalation rules. That reduced drift, but it still left too much room for vague tokens, invented primitives, and shallow handoff. This pack closes that gap by becoming the positive implementation authority when no external design system is available. + +## When to use it + +Use this pack when the repo, prompt, and brief do not supply an authoritative external design system, or when the task explicitly asks for a portable JudgmentKit-native UI authority. + +If a referenced external design system exists and has a confirmed accessibility baseline or owner-approved review status, that system still takes precedence. + +## What it governs + +- the approved primitive inventory +- the default token contract +- reusable React+Tailwind component recipes for every approved primitive +- required light and dark theme pairs +- layout archetypes by surface type +- the required state matrix +- the minimum implementation handoff contract +- the vendored generation and review guideline profiles derived from the Vercel web interface guidelines + +## Primitive inventory + +The pack constrains no-design-system output to a closed primitive vocabulary: + +- layout shell +- sidebar or rail +- header +- card +- field +- button +- tabs +- table or list +- sheet or drawer +- dialog +- inspector +- artifact panel + +The model may recombine these primitives, but it should not invent bespoke wrappers or visual modules unless that gap is escalated. + +## Token contract + +The pack publishes concrete spacing, radius, elevation, typography, and color bindings. The point is not visual branding. The point is implementation clarity. + +- spacing scale runs from `--jk-space-1 = 4px` through `--jk-space-6 = 32px` +- radius scale runs from `--jk-radius-1 = 4px` through `--jk-radius-3 = 8px` +- default stroke is `1px solid var(--jk-color-border-subtle)` +- elevation is limited to none, raised cards, and modal-level elevation +- color roles publish both light and dark values for canvas, surface, muted surface, border, text, accent, success, warning, and danger + +## Required output contract + +No-design-system output is not considered complete unless it includes these exact sections: + +- `core_screens` +- `token_spec` +- `component_recipes` +- `screen_composition` +- `state_coverage` +- `theme_contract` +- `accessibility_contract` +- `escalation_items` + +These sections are the portable handoff contract. They give implementation teams something concrete to build and reviewers something concrete to judge. + +## Recipe and guideline model + +Every approved primitive now includes: + +- slot structure +- allowed variants +- interaction rules +- accessibility contract +- a React+Tailwind recipe snippet + +The pack also links two vendored guideline profiles: + +- `guideline-profile.ai-ui-generation-authority` +- `guideline-profile.ai-ui-review-checks` + +## State and layout requirements + +The published state matrix requires explicit coverage for loading, empty, ready, error, review-needed, and disabled states. + +The published layout archetypes cover: + +- app workspace +- settings form +- dashboard +- review flow +- handoff or export flow + +## Boundaries + +This pack is not a substitute for a product-specific design system. It is a portable authority for situations where the alternative would otherwise be generic restraint language and hidden implementation assumptions. + +## Technical reference + +- Resource: `/resources/constraint-packs/ai-ui-no-design-system.v1.json` +- Schema: `/schemas/constraint_pack.schema.json` + +## Related pages + +- /docs/workflows/ai-ui-generation +- /docs/guardrails/design-system-integrity +- /docs/guardrails/spec-completeness +- /docs/examples/token-vagueness-drift +- /docs/examples/primitive-sprawl-drift diff --git a/content/docs/start/what-is-judgmentkit.mdx b/content/docs/start/what-is-judgmentkit.mdx index b091d3d..2abe6ce 100644 --- a/content/docs/start/what-is-judgmentkit.mdx +++ b/content/docs/start/what-is-judgmentkit.mdx @@ -32,7 +32,7 @@ Use JudgmentKit when you want an agent to do real work without making up its own ## Use it with agents -Install JudgmentKit from a local checkout over stdio, fetch the workflow you care about, call `resolve_related` to pull the linked guardrails and examples, then run the model with those artifacts in context. +Install JudgmentKit from a local checkout over loopback HTTP at `http://127.0.0.1:8765/mcp`, fetch the workflow you care about, call `resolve_related` to pull the linked guardrails and examples, then run the model with those artifacts in context. For example, for support you would: @@ -40,7 +40,7 @@ For example, for support you would: - call `resolve_related` for `workflow.support-assistant` - call `get_example` for `example.brand-tone.support-coercive-copy` -`/mcp` is not the install target. It is the hosted reference/debug endpoint that mirrors the same public truth as the local JudgmentKit checkout. +Hosted `/mcp` is not the install target. It is the hosted reference/debug endpoint that mirrors the same public truth as the local JudgmentKit checkout. ## Problem in human terms @@ -73,7 +73,7 @@ Without a shared judgment layer, product, design, governance, and engineering ma - two concrete workflows - three synthetic examples - a public artifact inventory and schema set -- a hosted read-only MCP endpoint that mirrors the same public truth as the local stdio install +- a hosted read-only MCP endpoint that mirrors the same public truth as the local loopback HTTP install ## Related pages diff --git a/content/docs/workflows/ai-ui-generation.mdx b/content/docs/workflows/ai-ui-generation.mdx index b5b9b5b..d5df7c4 100644 --- a/content/docs/workflows/ai-ui-generation.mdx +++ b/content/docs/workflows/ai-ui-generation.mdx @@ -2,10 +2,12 @@ title: AI UI generation slug: /docs/workflows/ai-ui-generation page_type: workflow -summary: A builder workflow that turns product intent into interface proposals while staying inside design-system, accessibility, and budget constraints. +summary: A builder workflow that turns product intent into interface proposals while staying inside design-system or portable implementation authority, frontend guardrails/examples, accessibility, and budget constraints. agent_summary: > This workflow explains how JudgmentKit governs AI-generated interface output - so that component choices, accessibility, and runtime budgets remain explicit. + so that visual direction, component choices, reusable recipes, token + contracts, state coverage, accessibility, and runtime budgets remain + explicit. audiences: - design-leaders - product-managers @@ -17,24 +19,48 @@ owners: primary: Design Systems operational: Frontend Platform status: active -last_reviewed: 2026-04-11 +last_reviewed: 2026-04-23 related_pages: - /docs/guardrails/design-system-integrity + - /docs/guardrails/spec-completeness + - /docs/guardrails/surface-mode-structure + - /docs/guardrails/visual-planning-contract + - /docs/guardrails/motion-media-purpose + - /docs/guardrails/frontend-output-contract - /docs/guardrails/ui-copy-clarity - /docs/guardrails/control-proximity - /docs/guardrails/surface-theme-parity - /docs/guardrails/runtime-and-cost - /docs/guardrails/provenance-and-escalation + - /docs/reference/portable-no-design-system-pack - /docs/examples/ui-generation-drift - /docs/examples/embellishment-drift + - /docs/examples/mode-structure-drift + - /docs/examples/visual-planning-gap + - /docs/examples/motion-media-drift + - /docs/examples/output-contract-gap - /docs/examples/onboarding-clarity-drift - /docs/examples/repetitive-copy-drift - /docs/examples/control-proximity-drift - /docs/examples/surface-theme-parity-drift + - /docs/examples/token-vagueness-drift + - /docs/examples/primitive-sprawl-drift + - /docs/examples/shallow-handoff-drift + - /docs/examples/state-coverage-drift related_resources: - /resources/workflows/ai-ui-generation.v1.json + - /resources/constraint-packs/ai-ui-no-design-system.v1.json + - /resources/guideline-profiles/ai-ui-generation-authority.v1.json + - /resources/guideline-profiles/ai-ui-review-checks.v1.json + - /resources/guardrails/spec-completeness.v1.json + - /resources/guardrails/surface-mode-structure.v1.json + - /resources/guardrails/visual-planning-contract.v1.json + - /resources/guardrails/motion-media-purpose.v1.json + - /resources/guardrails/frontend-output-contract.v1.json related_schemas: - /schemas/workflow.schema.json + - /schemas/constraint_pack.schema.json + - /schemas/guideline_profile.schema.json - /schemas/decision-record.schema.json - /schemas/verdict.schema.json toc: true @@ -42,24 +68,36 @@ toc: true ## Why this workflow matters -Generated UI can look impressive and still create downstream cleanup. The main risk is not only visual quality. It is unapproved primitives, silent overrides of the design system, ornamental zero-shot styling, missing theme support, unclear provenance, and unnecessary runtime spend hiding inside a “creative” result. +Generated UI can look impressive and still create downstream cleanup. The main risk is not only visual quality. It is the wrong surface mode, vague visual planning, ornamental media or motion, unapproved primitives, name-only component mapping, vague token language, incomplete state coverage, shallow handoff, missing theme support, inaccessible recipes, unclear provenance, and unnecessary runtime spend hiding inside a creative result. ## What decisions exist inside the workflow -- which components and tokens may be used +- which components, recipes, and tokens may be used - whether the referenced design system is authoritative for the requested surface +- when the JudgmentKit portable no-design-system pack becomes the source of truth +- which frontend visual mode governs the surface +- when visual thesis, content plan, and interaction thesis are required before implementation - whether that design system has an accessibility baseline or owner-approved review status - how much variation is acceptable before review +- whether imagery and motion have a clear purpose or should be downgraded +- whether final output includes the required visual contract evidence +- whether the current output is concrete enough to build without backfilling recipes, tokens, states, or handoff detail - when local controls are too detached from the surface they govern - when a first pass is too ornamental for zero-shot generation - when light and dark mode should be assumed by default - what accessibility baseline must hold - how much runtime complexity is justified - what evidence should travel with the implementation handoff +- whether screenshots and previews are derived from the same component evidence the judge reads ## Which guardrails apply - `guardrail.design-system-integrity` +- `guardrail.spec-completeness` +- `guardrail.surface-mode-structure` +- `guardrail.visual-planning-contract` +- `guardrail.motion-media-purpose` +- `guardrail.frontend-output-contract` - `guardrail.ui-copy-clarity` - `guardrail.control-proximity` - `guardrail.surface-theme-parity` @@ -70,50 +108,116 @@ Generated UI can look impressive and still create downstream cleanup. The main r - feature intent - target surface and breakpoint expectations -- approved component and token inventory +- approved component and token inventory, or explicit no-design-system confirmation +- visual-direction intent or explicit purely functional scope - accessibility rules or confirmed design-system review status - budget and latency target ## Examples in practice -The workflow now includes six calibration patterns. One example shows an over-scoped request that asks for novelty, custom primitives, and unlimited reasoning in one pass. Another shows a zero-shot UI pass drifting toward decorative chrome and single-theme output while ignoring a referenced design system. A third shows a landing-page draft that over-exposes internals and proof before it makes onboarding obvious. A fourth shows a dense control cluster where headings, helper copy, and actions repeat the same words until the next step is unclear. A fifth shows local viewer controls drifting into a separate details zone, making it harder to tell what surface they govern. The sixth shows a dark terminal-style code block dropped into an otherwise light interface instead of using a theme-matched artifact surface. In each case JudgmentKit rewrites the request into a clearer, system-safe pass plus explicit review questions. +The workflow now includes calibration patterns for visual direction, structural drift, and component-authority drift. The original system boundaries still apply: component drift, ornamental chrome, onboarding clarity, repetitive copy, control proximity, and surface-theme parity. The frontend visual direction case is calibrated with surface mode drift, visual planning gaps, motion/media drift, and missing output contract evidence. The no-design-system case is calibrated with token vagueness, primitive sprawl, shallow handoff, missing state coverage, name-only component mapping, non-reusable screen markup, missing accessibility API, hand-authored preview drift, and theme bindings that are not attached to real recipes. In each case JudgmentKit rewrites the request into a clearer, system-safe pass plus explicit review questions or a portable implementation contract. + +## Frontend visual direction + +When the task is visually led, JudgmentKit treats frontend visual direction as workflow guardrails plus calibration examples rather than a separate playbook collection or guideline profile. The frontend guardrails require: + +- exactly one mode: `marketing surface`, `product surface`, or `hybrid demo` +- `Visual Thesis`, `Content Plan`, and `Interaction Thesis` before implementation +- structure rules for first viewport, section jobs, product proof, and card usage +- motion and media rules that tie animation and imagery to hierarchy, narrative, or affordance +- downgrade rules for accessibility, mobile fit, runtime budget, missing assets, and existing design-system authority +- final output shape for implementation work or direction-only work + +These frontend guardrails do not override the product model. If the surface is operational, it leads with the working product. If the repo has an established design system, the workflow improves hierarchy, spacing, composition, and emphasis before inventing new language. + +## Portable no-design-system authority + +When an external design system does not exist, JudgmentKit should not fall back to generic restraint language alone. It now publishes a portable implementation authority pack that becomes the source of truth for: + +- approved primitives +- token bindings and light-dark pairs +- reusable React+Tailwind component recipes +- layout archetypes by surface type +- required state coverage +- the minimum handoff contract +- vendored generation and review rules derived from the Vercel web interface guidelines + +The pack also defines the exact sections that no-design-system output must include: + +- `core_screens` +- `token_spec` +- `component_recipes` +- `screen_composition` +- `state_coverage` +- `theme_contract` +- `accessibility_contract` +- `escalation_items` ## Common drift patterns 1. The model invents new visual primitives instead of recombining approved ones. 2. Decorative gradients, gratuitous shadows, and oversized radii become the default language of a first pass. -3. The output assumes a single theme when dark and light mode should be present by default. -4. A referenced design system is treated as authority without confirming whether it is accessibility-reviewed. -5. Accessibility semantics disappear in the pursuit of style. -6. Headings, helper text, and CTA labels reuse the same words until different UI elements sound interchangeable. -7. Local controls drift into a separate header or metadata zone from the viewer, panel, or artifact they change. -8. A code block or artifact viewer introduces a separate dark or light theme model that the surrounding interface does not use. -9. Runtime cost grows because the prompt asks for open-ended refinement. -10. The output leaves implementation teams guessing what is fixed versus exploratory. -11. The page explains internal artifacts before it explains what the product is or how to start. +3. A product surface starts with a marketing hero or generic SaaS card grid. +4. Vague visual adjectives replace mode, thesis, content plan, and interaction thesis. +5. Media and motion are ornamental instead of tied to hierarchy, narrative, or affordance. +6. A visually led final response omits mode, visual thesis, motion plan, asset gaps, or downgrade notes. +7. The output assumes a single theme when dark and light mode should be present by default. +8. A referenced design system is treated as authority without confirming whether it is accessibility-reviewed. +9. Accessibility semantics disappear in the pursuit of style. +10. Headings, helper text, and CTA labels reuse the same words until different UI elements sound interchangeable. +11. Local controls drift into a separate header or metadata zone from the viewer, panel, or artifact they change. +12. A code block or artifact viewer introduces a separate dark or light theme model that the surrounding interface does not use. +13. Runtime cost grows because the prompt asks for open-ended refinement. +14. The output leaves implementation teams guessing what is fixed versus exploratory. +15. The page explains internal artifacts before it explains what the product is or how to start. +16. The output sounds restrained, but the recipes, tokens, states, and handoff sections are still implicit. ## Escalation points -Escalate when the requested pattern cannot be expressed with approved primitives, when the brief conflicts with the design system, when the design system's accessibility status is unknown, when accessibility tradeoffs are unclear, or when the workflow is being used as a substitute for design review. +Escalate when the requested pattern cannot be expressed with approved primitives, when the brief conflicts with the design system, when the design system's accessibility status is unknown, when accessibility tradeoffs are unclear, when the portable pack and the brief are both silent on a needed decision, or when the workflow is being used as a substitute for design review. ## Related resources and schemas - Resource: `/resources/workflows/ai-ui-generation.v1.json` +- Portable pack: `/resources/constraint-packs/ai-ui-no-design-system.v1.json` +- Generation authority profile: `/resources/guideline-profiles/ai-ui-generation-authority.v1.json` +- Review checks profile: `/resources/guideline-profiles/ai-ui-review-checks.v1.json` +- Spec completeness guardrail: `/resources/guardrails/spec-completeness.v1.json` +- Surface mode guardrail: `/resources/guardrails/surface-mode-structure.v1.json` +- Visual planning guardrail: `/resources/guardrails/visual-planning-contract.v1.json` +- Motion/media guardrail: `/resources/guardrails/motion-media-purpose.v1.json` +- Frontend output contract guardrail: `/resources/guardrails/frontend-output-contract.v1.json` - Schema: `/schemas/workflow.schema.json` +- Constraint pack schema: `/schemas/constraint_pack.schema.json` +- Guideline profile schema: `/schemas/guideline_profile.schema.json` - Decision schema: `/schemas/decision-record.schema.json` - Verdict schema: `/schemas/verdict.schema.json` ## Related pages - /docs/guardrails/design-system-integrity +- /docs/guardrails/spec-completeness +- /docs/guardrails/surface-mode-structure +- /docs/guardrails/visual-planning-contract +- /docs/guardrails/motion-media-purpose +- /docs/guardrails/frontend-output-contract - /docs/guardrails/ui-copy-clarity - /docs/guardrails/control-proximity - /docs/guardrails/surface-theme-parity - /docs/guardrails/runtime-and-cost - /docs/guardrails/provenance-and-escalation +- /docs/reference/portable-no-design-system-pack - /docs/examples/ui-generation-drift - /docs/examples/embellishment-drift +- /docs/examples/mode-structure-drift +- /docs/examples/visual-planning-gap +- /docs/examples/motion-media-drift +- /docs/examples/output-contract-gap - /docs/examples/onboarding-clarity-drift - /docs/examples/repetitive-copy-drift - /docs/examples/control-proximity-drift - /docs/examples/surface-theme-parity-drift +- /docs/examples/token-vagueness-drift +- /docs/examples/primitive-sprawl-drift +- /docs/examples/shallow-handoff-drift +- /docs/examples/state-coverage-drift diff --git a/content/product-surface.json b/content/product-surface.json index a2bfedf..126ea8f 100644 --- a/content/product-surface.json +++ b/content/product-surface.json @@ -4,7 +4,7 @@ "utility_sentence": "Connect the MCP. Paste the first message. Run the first pass.", "run_sequence": ["Connect", "Paste", "Run"], "workbench_label": "Run the first pass", - "workbench_support": "Run the hosted installer to clone JudgmentKit, install dependencies, wire the client to the local stdio server, and verify the local tools/list response.", + "workbench_support": "Run the hosted installer to clone JudgmentKit, install dependencies, wire the client to the local loopback MCP endpoint, and verify the local tools/list response.", "proof_heading": "Generated UI proof", "proof_support": "Same brief. One uncontrolled pass and one JudgmentKit-guided pass.", "proof_notes": [ diff --git a/content/resources/constraint-packs/ai-ui-no-design-system.v1.json b/content/resources/constraint-packs/ai-ui-no-design-system.v1.json new file mode 100644 index 0000000..4342a8b --- /dev/null +++ b/content/resources/constraint-packs/ai-ui-no-design-system.v1.json @@ -0,0 +1,482 @@ +{ + "id": "constraint-pack.ai-ui-no-design-system", + "type": "constraint_pack", + "version": "1.0.0", + "title": "Portable no-design-system implementation authority", + "summary": "A JudgmentKit-native implementation authority for UI generation when no external design system is present, with concrete primitives, React+Tailwind recipes, accessibility rules, state coverage, and handoff requirements.", + "status": "active", + "workflows": ["workflow.ai-ui-generation"], + "guardrail_ids": [ + "guardrail.design-system-integrity", + "guardrail.spec-completeness", + "guardrail.control-proximity", + "guardrail.surface-theme-parity" + ], + "guideline_profile_ids": [ + "guideline-profile.ai-ui-generation-authority", + "guideline-profile.ai-ui-review-checks" + ], + "authority": { + "when_to_use": "Use this pack when the repo, prompt, and brief do not provide an authoritative external design system or when the task explicitly asks for a portable JudgmentKit-native UI authority.", + "priority_rules": [ + "If a referenced external design system exists and has a confirmed accessibility baseline or owner-approved review status, that system takes precedence.", + "If no external design system exists, this pack becomes the source of truth for primitives, tokens, layout archetypes, required states, light-dark theme parity, reusable recipes, and handoff depth.", + "If the pack, vendored guideline profiles, and brief are all silent about a requirement, escalate instead of inventing a new primitive, vague token, or unsupported interaction." + ], + "output_contract_sections": [ + "core_screens", + "token_spec", + "component_recipes", + "screen_composition", + "state_coverage", + "theme_contract", + "accessibility_contract", + "escalation_items" + ] + }, + "implementation_model": { + "target_stack": "react-tailwind", + "recipe_format": "React+Tailwind snippets with explicit slots, variants, interaction rules, and accessibility API", + "preview_artifacts": [ + "implementation-contract.json", + "preview-source.tsx", + "preview.html" + ] + }, + "primitives": { + "inventory": [ + { + "id": "layout-shell", + "label": "Layout shell", + "description": "Top-level application frame with optional rail, header, workspace body, and secondary inspector region.", + "usage": "Required for app workspace, dashboard, review, and export surfaces.", + "component_recipe": { + "slots": ["rail", "header", "main", "inspector"], + "variants": ["with-rail", "with-inspector", "centered-main"], + "interaction_rules": [ + "Keep the primary task in main and secondary metadata in inspector.", + "Do not move local controls away from the surface they govern." + ], + "accessibility_contract": [ + "Use main, nav, header, and aside landmarks where applicable.", + "Preserve heading order and skip-link destination." + ], + "react_tailwind": "
...
" + } + }, + { + "id": "sidebar-rail", + "label": "Sidebar or rail", + "description": "Persistent navigation or collection switcher aligned to the main workspace frame.", + "usage": "Use for global navigation, queue switching, or mode changes.", + "component_recipe": { + "slots": ["label", "items", "footer"], + "variants": ["nav", "history", "queue"], + "interaction_rules": [ + "Active item must be visually distinct and keyboard reachable.", + "Keep mode changes and run history grouped, not interleaved." + ], + "accessibility_contract": [ + "Use nav with an accessible label.", + "Use links for navigation and buttons for actions." + ], + "react_tailwind": "" + } + }, + { + "id": "header", + "label": "Header", + "description": "Surface-level title, status, and primary actions anchored to the region they govern.", + "usage": "Use for page title, collection metadata, and scoped actions.", + "component_recipe": { + "slots": ["title", "meta", "actions"], + "variants": ["workspace", "panel", "dialog"], + "interaction_rules": [ + "Primary action stays in the same header as the governed surface.", + "Keep status and secondary metadata subordinate to the title." + ], + "accessibility_contract": [ + "Use heading tags in hierarchy order.", + "If actions change nearby content, keep them adjacent in DOM order." + ], + "react_tailwind": "
...
" + } + }, + { + "id": "card", + "label": "Card", + "description": "Contained surface block with a single content responsibility and explicit header-content-footer structure when needed.", + "usage": "Use for summaries, settings groups, metrics, and review blocks.", + "component_recipe": { + "slots": ["header", "body", "footer"], + "variants": ["summary", "settings", "review", "muted"], + "interaction_rules": [ + "Use cards to group meaning, not to add decorative nesting.", + "Promote content hierarchy before adding elevation." + ], + "accessibility_contract": [ + "Keep heading and body text associated in reading order.", + "If footer actions exist, ensure they remain within the same card." + ], + "react_tailwind": "
...
" + } + }, + { + "id": "field", + "label": "Field", + "description": "Label, control, helper text, and validation message grouped as one primitive.", + "usage": "Use for text input, toggles, selects, and textarea entry.", + "component_recipe": { + "slots": ["label", "control", "helper", "error"], + "variants": ["text", "textarea", "select", "toggle"], + "interaction_rules": [ + "Do not rely on placeholder text as the only label.", + "Validation copy must stay next to the affected control." + ], + "accessibility_contract": [ + "Use label or aria-label on every control.", + "Use aria-describedby for helper and error text when present." + ], + "react_tailwind": "