@ryuenn3123/agentic-senior-core 3.0.19 → 3.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +96 -103
  2. package/.agent-context/prompts/init-project.md +32 -100
  3. package/.agent-context/prompts/refactor.md +22 -44
  4. package/.agent-context/prompts/review-code.md +28 -52
  5. package/.agent-context/review-checklists/architecture-review.md +31 -62
  6. package/.agent-context/review-checklists/pr-checklist.md +74 -108
  7. package/.agent-context/rules/api-docs.md +18 -206
  8. package/.agent-context/rules/architecture.md +40 -207
  9. package/.agent-context/rules/database-design.md +10 -199
  10. package/.agent-context/rules/docker-runtime.md +5 -5
  11. package/.agent-context/rules/efficiency-vs-hype.md +11 -149
  12. package/.agent-context/rules/error-handling.md +9 -231
  13. package/.agent-context/rules/event-driven.md +17 -221
  14. package/.agent-context/rules/frontend-architecture.md +74 -119
  15. package/.agent-context/rules/git-workflow.md +1 -1
  16. package/.agent-context/rules/microservices.md +28 -161
  17. package/.agent-context/rules/naming-conv.md +8 -138
  18. package/.agent-context/rules/performance.md +9 -175
  19. package/.agent-context/rules/realtime.md +11 -44
  20. package/.agent-context/rules/security.md +11 -295
  21. package/.agent-context/rules/testing.md +9 -174
  22. package/.agent-context/state/benchmark-analysis.json +3 -3
  23. package/.agent-context/state/memory-continuity-benchmark.json +1 -1
  24. package/.agent-context/state/onboarding-report.json +71 -11
  25. package/.agents/workflows/init-project.md +7 -24
  26. package/.agents/workflows/refactor.md +7 -24
  27. package/.agents/workflows/review-code.md +7 -24
  28. package/.cursorrules +22 -21
  29. package/.gemini/instructions.md +2 -2
  30. package/.github/copilot-instructions.md +2 -2
  31. package/.instructions.md +112 -213
  32. package/.windsurfrules +22 -21
  33. package/AGENTS.md +4 -4
  34. package/CONTRIBUTING.md +13 -22
  35. package/README.md +6 -20
  36. package/lib/cli/commands/init.mjs +102 -148
  37. package/lib/cli/commands/launch.mjs +3 -3
  38. package/lib/cli/commands/optimize.mjs +14 -4
  39. package/lib/cli/commands/upgrade.mjs +25 -23
  40. package/lib/cli/compiler.mjs +96 -62
  41. package/lib/cli/constants.mjs +28 -136
  42. package/lib/cli/detector/design-evidence.mjs +189 -6
  43. package/lib/cli/detector.mjs +6 -7
  44. package/lib/cli/init-detection-flow.mjs +10 -93
  45. package/lib/cli/init-selection.mjs +2 -68
  46. package/lib/cli/project-scaffolder/constants.mjs +1 -1
  47. package/lib/cli/project-scaffolder/design-contract.mjs +183 -108
  48. package/lib/cli/project-scaffolder/discovery.mjs +36 -82
  49. package/lib/cli/project-scaffolder/prompt-builders.mjs +45 -55
  50. package/lib/cli/project-scaffolder/storage.mjs +0 -2
  51. package/lib/cli/token-optimization.mjs +1 -1
  52. package/lib/cli/utils.mjs +75 -9
  53. package/package.json +2 -2
  54. package/scripts/detection-benchmark.mjs +4 -15
  55. package/scripts/documentation-boundary-audit.mjs +9 -9
  56. package/scripts/explain-on-demand-audit.mjs +11 -11
  57. package/scripts/forbidden-content-check.mjs +9 -9
  58. package/scripts/frontend-usability-audit.mjs +45 -35
  59. package/scripts/llm-judge.mjs +1 -1
  60. package/scripts/mcp-server/constants.mjs +2 -2
  61. package/scripts/mcp-server/tool-registry.mjs +1 -1
  62. package/scripts/release-gate/audit-checks.mjs +22 -7
  63. package/scripts/release-gate/static-checks.mjs +5 -5
  64. package/scripts/release-gate.mjs +1 -1
  65. package/scripts/rules-guardian-audit.mjs +14 -13
  66. package/scripts/single-source-lazy-loading-audit.mjs +3 -3
  67. package/scripts/sync-thin-adapters.mjs +5 -5
  68. package/scripts/ui-design-judge/design-execution-summary.mjs +27 -1
  69. package/scripts/ui-design-judge/prompting.mjs +5 -5
  70. package/scripts/ui-design-judge/reporting.mjs +3 -1
  71. package/scripts/ui-design-judge/rubric-calibration.mjs +8 -5
  72. package/scripts/ui-design-judge/rubric-goldset.json +2 -2
  73. package/scripts/ui-design-judge.mjs +75 -7
  74. package/scripts/validate/config.mjs +138 -48
  75. package/scripts/validate/coverage-checks.mjs +32 -7
  76. package/scripts/validate.mjs +8 -4
  77. package/lib/cli/architect.mjs +0 -431
@@ -36,7 +36,6 @@ function buildStructureFirstSeedSignals({
36
36
  supplementalFields = {},
37
37
  }) {
38
38
  const normalizedDescription = String(projectDescription || '').trim();
39
- const normalizedDomain = String(primaryDomain || '').trim().toLowerCase();
40
39
  const repoEvidenceSummary = supplementalFields?.repoEvidence?.designEvidenceSummary || null;
41
40
  const hasRepoEvidence = Boolean(
42
41
  repoEvidenceSummary
@@ -49,38 +48,37 @@ function buildStructureFirstSeedSignals({
49
48
  const projectContextLabel = normalizedDescription
50
49
  ? `the product context "${normalizedDescription}"`
51
50
  : 'the current product context';
52
- const isMobileLikeSurface = normalizedDomain.includes('mobile');
53
51
 
54
52
  return {
55
- designPhilosophy: `Use ${evidenceSourceLabel} to synthesize a project-specific design system for ${projectName || 'this project'}. Treat this seed as structural scaffolding that must be refined before UI implementation, not as final art direction.`,
56
- brandAdjectives: ['project-specific', 'intentional', 'evidence-led'],
57
- antiAdjectives: ['template-neutral', 'copycat', 'unjustified-defaults'],
58
- typographyScaleRatio: '1.200',
59
- baseGridUnit: 8,
60
- spacingPattern: isMobileLikeSurface ? 'mobile-first-single-axis' : 'adaptive-task-priority',
61
- densityMode: isMobileLikeSurface ? 'touch-priority' : 'adaptive-task-priority',
62
- colorIntent: `Define palette roles from ${projectContextLabel} and refine them with repo evidence. Treat the listed palette roles as minimum semantic categories, not final visual choices.`,
63
- paletteRoles: ['base', 'surface', 'text', 'muted', 'accent', 'border', 'focus', 'success', 'warning', 'danger'],
53
+ designPhilosophy: `Use ${evidenceSourceLabel} to synthesize the design system for ${projectName || 'this project'}. This seed is only a decision scaffold: the LLM must choose the visual language, libraries, color system, typography, spacing, and interaction model from ${projectContextLabel}, current repo evidence, and live official documentation when a technology claim is needed.`,
54
+ brandAdjectives: ['agent-synthesized-from-current-context'],
55
+ antiAdjectives: ['offline-prescribed-style', 'template-by-default', 'scale-only-responsive', 'unresearched-library-choice'],
56
+ typographyScaleRatio: 'agent-calibrated-from-content-platform-and-readability',
57
+ baseGridUnit: 'agent-calibrated-from-platform-density-and-implementation-stack',
58
+ spacingPattern: 'agent-defined-from-task-flow-and-viewport-needs',
59
+ densityMode: 'agent-defined-from-user-task-device-and-content-pressure',
60
+ colorIntent: `Choose semantic palette roles from ${projectContextLabel}, current repo evidence, and accessibility needs. Do not inherit fixed palettes or generic SaaS color defaults from this scaffold.`,
61
+ paletteRoles: ['agent-defined-semantic-roles'],
64
62
  distinctiveMoves: [
65
- 'Derive one memorable signature move from the product task, current repo evidence, and the active brief before locking the layout language.',
66
- 'Use task priority, hierarchy, and surface relationships to replace template-neutral hero or card-grid defaults.',
67
- 'Document why the final visual move belongs to this project and what generic fallback it intentionally avoids.',
63
+ 'Research and choose a current, project-fit visual direction instead of inheriting any offline preset from this scaffold.',
64
+ 'Define at least one recognizable design move from the product task, audience, content, and repo evidence before implementation.',
65
+ 'Document why the chosen move belongs to this project and which common LLM bad habit it intentionally avoids.',
68
66
  ],
69
- motionPurpose: 'Use motion to clarify causality, hierarchy, state feedback, and perceived product quality. The final motion tone must be refined from repo evidence and the active brief, not inherited from this seed alone.',
70
- motionChoreography: 'Keep motion purposeful, reduced-motion-safe, and tied to state or surface changes. Any signature choreography must be justified in docs/DESIGN.md before it becomes part of the system.',
67
+ motionPurpose: 'Use modern motion when it improves hierarchy, continuity, feedback, memorability, or perceived product quality. If implementation needs a motion library, the LLM must choose a current compatible option from official docs instead of relying on an offline default.',
68
+ motionChoreography: 'Define choreography from the product experience and implementation stack. Keep it performant and reduced-motion-safe; do not suppress rich interaction by default.',
71
69
  motionDurations: {
72
- desktop: 180,
73
- mobile: 240,
70
+ desktop: 'agent-calibrated',
71
+ mobile: 'agent-calibrated',
74
72
  },
75
73
  componentMorphology: {
76
- mobile: 'Simplify the primary task surface, keep decisive actions in easy reach, and move supporting context behind explicit disclosure when space gets tight.',
77
- tablet: 'Preserve task continuity while compressing tertiary chrome and keeping priority boundaries obvious across shared surfaces.',
78
- desktop: 'Expose the richest version of the task flow and supporting context without defaulting to symmetrical template composition.',
74
+ mobile: 'Recompose the experience for touch, task priority, and constrained attention. Mobile should be a deliberate mobile design, not a shrunken desktop.',
75
+ tablet: 'Regroup surfaces for medium-width use, preserving task clarity without cloning either desktop or mobile blindly.',
76
+ desktop: 'Use the available space to improve hierarchy, scanability, and interaction quality without defaulting to template grids or generic dashboard chrome.',
79
77
  },
80
78
  mutationRules: {
81
- mobile: 'Recompose the flow around the first decisive action, collapse secondary navigation into explicit overlays or sheets, and re-rank supporting context below the primary task.',
82
- tablet: 'Preserve task continuity with fewer simultaneous surfaces, condensed chrome, and explicit boundaries between primary, supporting, and deferred content.',
83
- desktop: 'Expose the fullest version of the task flow, supporting context, and navigation system without falling back to interchangeable dashboard or hero defaults.',
79
+ mobile: 'Define a mobile-specific composition with reordered, merged, or disclosed content where appropriate. Scale-only shrink behavior is failure.',
80
+ tablet: 'Define a tablet-specific regrouping strategy rather than a width-only reduction of desktop.',
81
+ desktop: 'Define a desktop composition that uses space intentionally and avoids generic equal-weight modules unless the project evidence justifies them.',
84
82
  },
85
83
  };
86
84
  }
@@ -115,8 +113,12 @@ function buildDesignIntentContractObject({
115
113
  name: projectName,
116
114
  context: projectDescription,
117
115
  domain: primaryDomain,
118
- stack: toTitleCase(initContext.stackFileName),
119
- blueprint: toTitleCase(initContext.blueprintFileName),
116
+ runtimeConstraint: initContext.stackFileName === 'agent-decision-runtime.md'
117
+ ? 'agent-recommendation-required'
118
+ : toTitleCase(initContext.stackFileName),
119
+ architectureConstraint: initContext.blueprintFileName === 'agent-decision-architecture.md'
120
+ ? 'agent-recommendation-required'
121
+ : toTitleCase(initContext.blueprintFileName),
120
122
  },
121
123
  designPhilosophy: inferredKeywords.designPhilosophy,
122
124
  brandAdjectives: inferredKeywords.brandAdjectives,
@@ -124,7 +126,8 @@ function buildDesignIntentContractObject({
124
126
  visualDirection: {
125
127
  seedMode: 'scaffold-only',
126
128
  requiresProjectSpecificSynthesis: true,
127
- trendStance: 'trend-aware-not-trend-chasing',
129
+ selectionAuthority: 'agent-llm-after-current-context-repo-evidence-and-live-official-docs',
130
+ trendStance: 'current-context-first-not-offline-preset-first',
128
131
  distinctiveMoves: inferredKeywords.distinctiveMoves,
129
132
  copiedReferenceAllowed: false,
130
133
  },
@@ -169,6 +172,7 @@ function buildDesignIntentContractObject({
169
172
  paletteRoles: inferredKeywords.paletteRoles,
170
173
  rolePolicy: 'minimum-semantic-scaffold',
171
174
  rolesAreMinimumScaffold: true,
175
+ rolesMustBeAgentDefined: true,
172
176
  intent: inferredKeywords.colorIntent,
173
177
  },
174
178
  crossViewportAdaptation: {
@@ -231,6 +235,9 @@ function buildDesignIntentContractObject({
231
235
  requireRepoEvidenceAlignment: true,
232
236
  forbidScreenshotDependency: true,
233
237
  handoffFormatVersion: 'ui-handoff-v1',
238
+ requirePerSurfaceMutationOps: true,
239
+ forbidUniformSiblingSurfaceTreatment: true,
240
+ zeroBasedRedesignResetsPriorVisualsWhenRequested: true,
234
241
  semanticReviewFocus: [
235
242
  'distinctiveness-vs-genericity',
236
243
  'contract-fidelity',
@@ -245,77 +252,99 @@ function buildDesignIntentContractObject({
245
252
  status: 'seed-needs-refinement',
246
253
  seedMode: 'structure-first-scaffold',
247
254
  requiresTaskSpecificRefinement: true,
248
- primaryExperienceGoal: `Refine the main ${String(primaryDomain || 'product').toLowerCase()} journey in ${projectName} so the first decisive action, supporting context, and signature move come from repo evidence and the active brief rather than scaffold defaults.`,
255
+ primaryExperienceGoal: `Ask the LLM to define the main ${String(primaryDomain || 'product').toLowerCase()} journey in ${projectName} from repo evidence, product context, user goals, and current official documentation where technology choices matter. This scaffold must not prescribe the final visual layout.`,
249
256
  surfacePlan: [
250
257
  {
251
- surfaceId: 'primary-entry-surface',
252
- role: 'primary-task-entry',
253
- goal: `Map the first meaningful task in ${projectName} and replace generic hero filler with task-first hierarchy justified by repo evidence and the active brief.`,
254
- primaryAction: 'Define the first decisive action or decision point explicitly during refinement instead of inheriting placeholder CTA language.',
255
- supportingModules: ['context', 'proof', 'navigation'],
256
- signatureMoveHint: 'Document one project-specific signature move for the primary surface and explain which generic fallback it intentionally rejects.',
258
+ surfaceId: 'agent-defined-primary-experience',
259
+ role: 'llm-synthesized-from-current-context',
260
+ goal: `Define the primary UI experience for ${projectName} from the actual product task, audience, data, and repo evidence before coding.`,
261
+ primaryAction: 'The LLM must choose the first decisive action or reading path and explain why it fits the project.',
262
+ supportingModules: ['agent-defined-from-current-context'],
263
+ layoutAntiPatternToAvoid: 'template-default-without-product-rationale',
264
+ signatureMoveHint: 'Choose and document one project-specific visual, interaction, or content move. Do not inherit it from this scaffold.',
257
265
  },
258
266
  {
259
- surfaceId: 'supporting-proof-surface',
260
- role: 'trust-and-context',
261
- goal: 'Define how proof, explanation, or operational context supports the main task without turning the layout into a template-neutral secondary rail.',
262
- primaryAction: 'Clarify what supporting proof or status belongs near the main task once the product-specific flow is confirmed.',
263
- supportingModules: ['status', 'metadata', 'secondary-actions'],
264
- signatureMoveHint: 'Explain how this supporting surface reinforces the primary task without competing for dominance or collapsing into generic chrome.',
267
+ surfaceId: 'agent-defined-supporting-experience',
268
+ role: 'llm-synthesized-supporting-context',
269
+ goal: 'Define supporting, proof, utility, or recovery surfaces from actual user needs instead of cloning generic cards or rails.',
270
+ primaryAction: 'The LLM must decide what belongs beside, below, hidden behind disclosure, or removed based on task priority.',
271
+ supportingModules: ['agent-defined-from-current-context'],
272
+ layoutAntiPatternToAvoid: 'scale-only-responsive-layout',
273
+ signatureMoveHint: 'Explain how supporting content changes across viewports and why the change improves the experience.',
265
274
  },
266
275
  ],
267
276
  componentGraph: {
268
277
  nodes: [
269
278
  {
270
- id: 'primary-action-surface',
271
- role: 'task-driver',
279
+ id: 'agent-defined-primary-experience',
280
+ role: 'primary-experience-after-synthesis',
272
281
  priority: 'high',
273
282
  },
274
283
  {
275
- id: 'supporting-context-rail',
276
- role: 'context-support',
277
- priority: 'medium',
278
- },
279
- {
280
- id: 'feedback-status-module',
281
- role: 'feedback-and-proof',
284
+ id: 'agent-defined-supporting-experience',
285
+ role: 'supporting-experience-after-synthesis',
282
286
  priority: 'medium',
283
287
  },
284
288
  ],
285
289
  edges: [
286
290
  {
287
- from: 'primary-action-surface',
288
- to: 'supporting-context-rail',
289
- relationship: 'context-support',
290
- },
291
- {
292
- from: 'primary-action-surface',
293
- to: 'feedback-status-module',
294
- relationship: 'state-feedback',
291
+ from: 'agent-defined-primary-experience',
292
+ to: 'agent-defined-supporting-experience',
293
+ relationship: 'agent-defined-from-task-priority',
295
294
  },
296
295
  ],
297
296
  },
298
297
  contentPriorityMap: {
299
298
  primary: [
300
- 'core-task-entry',
301
- 'primary-status-or-value-message',
302
- 'decisive-action-labeling',
299
+ 'agent-defined-core-task-or-reading-path',
303
300
  ],
304
301
  secondary: [
305
- 'supporting-proof',
306
- 'navigation-context',
307
- 'secondary-actions',
302
+ 'agent-defined-supporting-context',
308
303
  ],
309
304
  deferred: [
310
- 'deep-explanation',
311
- 'tertiary-metadata',
312
- 'low-priority-decoration',
305
+ 'agent-defined-deferred-or-hidden-content',
313
306
  ],
314
307
  },
315
308
  viewportMutationPlan: {
316
- mobile: inferredKeywords.mutationRules.mobile,
317
- tablet: inferredKeywords.mutationRules.tablet,
318
- desktop: inferredKeywords.mutationRules.desktop,
309
+ mobile: {
310
+ primaryOperation: 'agent-defined-mobile-recomposition',
311
+ requiredSurfaceActions: [
312
+ 'choose-mobile-specific-task-order',
313
+ 'merge-disclose-or-remove-low-priority-content',
314
+ 'adapt-interaction-model-for-touch',
315
+ ],
316
+ forbiddenPatterns: [
317
+ 'scale-only-shrink',
318
+ 'desktop-order-preserved-without-priority-shift',
319
+ ],
320
+ rationale: inferredKeywords.mutationRules.mobile,
321
+ },
322
+ tablet: {
323
+ primaryOperation: 'agent-defined-tablet-regrouping',
324
+ requiredSurfaceActions: [
325
+ 'define-medium-width-information-architecture',
326
+ 'avoid-cloning-desktop-by-width-only',
327
+ 'preserve-task-clarity',
328
+ ],
329
+ forbiddenPatterns: [
330
+ 'desktop-layout-reduced-by-width-only',
331
+ 'uniform-module-grid-without-role-change',
332
+ ],
333
+ rationale: inferredKeywords.mutationRules.tablet,
334
+ },
335
+ desktop: {
336
+ primaryOperation: 'agent-defined-desktop-composition',
337
+ requiredSurfaceActions: [
338
+ 'use-space-to-improve-hierarchy',
339
+ 'define-scan-pattern-and-action-priority',
340
+ 'avoid-equalizing-unrelated-content',
341
+ ],
342
+ forbiddenPatterns: [
343
+ 'template-shell-without-product-rationale',
344
+ 'interchangeable-dashboard-or-landing-chrome',
345
+ ],
346
+ rationale: inferredKeywords.mutationRules.desktop,
347
+ },
319
348
  },
320
349
  interactionStateMatrix: [
321
350
  {
@@ -330,11 +359,22 @@ function buildDesignIntentContractObject({
330
359
  },
331
360
  ],
332
361
  taskFlowNarrative: [
333
- `Entry: refine how ${projectName} establishes the first meaningful action using current task evidence instead of generic product-marketing framing.`,
334
- 'Decision: define the hierarchy, proof, and state language that help the user choose the next step without defaulting to generic card-grid or hero habits.',
335
- 'Resolution: specify the feedback, recovery path, and next useful action so progress remains visible without hiding behind decorative confirmation states.',
362
+ `Entry: the LLM must define how ${projectName} starts the user journey from real product evidence instead of a generic opening pattern.`,
363
+ 'Decision: the LLM must define hierarchy, proof, state language, and interaction behavior from the actual task.',
364
+ 'Resolution: the LLM must define feedback, recovery, and next-useful-action behavior without defaulting to leftover template chrome.',
336
365
  ],
337
- signatureMoveRationale: 'Explain which project-specific surface, motion, typographic, or compositional move anchors the system and why a generic fallback would weaken the product.',
366
+ visualResetStrategy: {
367
+ activatesWhenUserRequests: [
368
+ 'redesign from zero',
369
+ 'redesain dari 0',
370
+ 'ulang dari 0',
371
+ 'research ulang',
372
+ ],
373
+ existingUiAllowedAs: ['content-evidence', 'behavior-evidence', 'accessibility-evidence', 'asset-source-evidence'],
374
+ existingUiForbiddenAs: ['palette-source', 'typography-source', 'layout-source', 'motion-source', 'component-morphology-source'],
375
+ requiredResetAxes: ['composition', 'hierarchy', 'palette-and-typography', 'motion-or-interaction', 'responsive-information-architecture'],
376
+ },
377
+ signatureMoveRationale: 'The LLM must choose the project-specific visual, motion, typographic, compositional, or interaction move after reading current context and explain why a generic fallback would weaken the product.',
338
378
  implementationGuardrails: {
339
379
  requireBuildFromHandoff: true,
340
380
  requireGapNotesBeforeFallback: true,
@@ -343,10 +383,11 @@ function buildDesignIntentContractObject({
343
383
  },
344
384
  reviewRubric: {
345
385
  version: 'ui-rubric-v1',
386
+ genericityAutoFail: true,
346
387
  dimensions: [
347
388
  {
348
389
  key: 'distinctiveness',
349
- blockingByDefault: false,
390
+ blockingByDefault: true,
350
391
  question: 'Does the UI feel authored and project-specific rather than like a default framework or template kit?',
351
392
  },
352
393
  {
@@ -371,18 +412,22 @@ function buildDesignIntentContractObject({
371
412
  },
372
413
  ],
373
414
  genericitySignals: [
374
- 'safe-centered-hero-without-product-rationale',
375
- 'balanced-card-grid-without-priority-shift',
376
- 'default-framework-button-and-input-treatment',
377
- 'trend-gradient-without-structural-role',
378
- 'interchangeable-dashboard-chrome',
415
+ 'offline-prescribed-style-used-as-final-direction',
416
+ 'unresearched-library-or-framework-choice',
417
+ 'default-component-kit-treatment-without-product-rationale',
418
+ 'scale-only-responsive-layout',
419
+ 'template-shell-without-product-rationale',
420
+ 'zero-based-redesign-kept-prior-visual-dna',
421
+ 'restyle-instead-of-recomposition',
422
+ 'inaccessible-or-decorative-motion',
379
423
  ],
380
424
  validBoldSignals: [
381
- 'one-clear-signature-move',
382
- 'project-specific-layout-tension',
383
- 'purposeful-motion-as-identity',
384
- 'distinct-typographic-hierarchy',
385
- 'non-template-task-priority',
425
+ 'context-derived-visual-direction',
426
+ 'official-docs-backed-library-choice',
427
+ 'responsive-recomposition-by-task-priority',
428
+ 'purposeful-motion-with-reduced-motion-path',
429
+ 'documented-design-rationale-before-code',
430
+ 'clean-component-and-token-architecture',
386
431
  ],
387
432
  reportingRules: {
388
433
  mustExplainGenericity: true,
@@ -396,7 +441,7 @@ function buildDesignIntentContractObject({
396
441
  'current-repo-evidence',
397
442
  'current-user-brief',
398
443
  'current-project-docs',
399
- 'explicitly-approved-reference-systems',
444
+ 'explicitly-approved-current-task-constraints',
400
445
  ],
401
446
  taintedSources: [
402
447
  'prior-chat-visual-memory',
@@ -407,11 +452,13 @@ function buildDesignIntentContractObject({
407
452
  repoEvidenceOverridesMemory: true,
408
453
  requireExplicitContinuityApproval: true,
409
454
  forbidCarryoverWhenUnapproved: true,
410
- approvedReferenceUsage: 'Adapt reasoning and constraints from approved references without copying the surface 1:1.',
455
+ approvedExternalConstraintUsage: 'Convert explicit user-supplied external constraints into current-project rules without comparing against or imitating the source surface.',
411
456
  driftSignals: [
412
457
  'palette-reused-without-brief-support',
413
458
  'motion-signature-reused-without-approval',
414
459
  'layout-shape-matches-unrelated-project-memory',
460
+ 'prior-ui-visual-dna-carried-into-reset-request',
461
+ 'existing-design-doc-treated-as-style-continuity-during-zero-based-redesign',
415
462
  ],
416
463
  },
417
464
  experiencePrinciples: [
@@ -419,15 +466,20 @@ function buildDesignIntentContractObject({
419
466
  'Major interface decisions must be explainable in product and user terms.',
420
467
  'Accessibility, responsiveness, and implementation realism are non-negotiable.',
421
468
  'Cross-viewport behavior must reorganize tasks and navigation, not just scale the desktop layout down.',
422
- 'Motion may add character, memorability, and continuity when it improves the product experience, but it must stay purposeful, performant, and optional for reduced-motion users.',
423
- 'At least one surface, compositional move, typographic decision, or motion motif should be recognizable at a glance.',
469
+ 'Modern libraries and interaction patterns may be used when the LLM verifies they fit the project and current official docs.',
470
+ 'Motion may be rich and memorable when it improves the product experience, but it must stay purposeful, performant, and optional for reduced-motion users.',
471
+ 'At least one visual, interaction, content, or motion decision must be recognizable at a glance and justified from context.',
472
+ 'When the user asks for a zero-based redesign, existing UI becomes content and behavior evidence only; prior visual DNA must be discarded unless explicitly approved.',
424
473
  ],
425
474
  forbiddenPatterns: [
426
- 'generic-saas-hero',
427
- 'copycat-brand-system',
428
- 'unjustified-default-gradients',
429
- 'placeholder-design-language',
475
+ 'offline-prescribed-style-used-as-final-direction',
476
+ 'unresearched-library-or-framework-choice',
477
+ 'default-component-kit-treatment-without-product-rationale',
430
478
  'scale-only-responsive-layout',
479
+ 'template-shell-without-product-rationale',
480
+ 'zero-based-redesign-kept-prior-visual-dna',
481
+ 'restyle-instead-of-recomposition',
482
+ 'single-safe-typographic-family-without-role-contrast-or-rationale',
431
483
  ],
432
484
  validationHints: {
433
485
  rejectArbitraryHexOnlyPalette: true,
@@ -442,8 +494,10 @@ function buildDesignIntentContractObject({
442
494
  requireWcagHardFloor: true,
443
495
  requireStructuredDesignExecutionPolicy: true,
444
496
  requireStructuredDesignHandoff: true,
497
+ requireVisualResetStrategyWhenZeroBasedRedesignRequested: true,
445
498
  requireReviewRubric: true,
446
499
  requireGenericityExplanation: true,
500
+ genericityAutoFail: true,
447
501
  requireSignatureMove: true,
448
502
  rejectTemplateNeutralLayout: true,
449
503
  },
@@ -493,11 +547,11 @@ export function validateDesignIntentContract(designIntentContract) {
493
547
  if (!designIntentContract.mathSystems || typeof designIntentContract.mathSystems !== 'object') {
494
548
  validationErrors.push('designIntent.mathSystems must exist.');
495
549
  } else {
496
- if (!/^\d+(\.\d+)?$/.test(String(designIntentContract.mathSystems.typographyScaleRatio || '').trim())) {
497
- validationErrors.push('designIntent.mathSystems.typographyScaleRatio must be numeric text.');
550
+ if (!String(designIntentContract.mathSystems.typographyScaleRatio || '').trim()) {
551
+ validationErrors.push('designIntent.mathSystems.typographyScaleRatio must describe the chosen or pending type scale decision.');
498
552
  }
499
- if (!Number.isInteger(designIntentContract.mathSystems.baseGridUnit) || designIntentContract.mathSystems.baseGridUnit <= 0) {
500
- validationErrors.push('designIntent.mathSystems.baseGridUnit must be a positive integer.');
553
+ if (!String(designIntentContract.mathSystems.baseGridUnit || '').trim()) {
554
+ validationErrors.push('designIntent.mathSystems.baseGridUnit must describe the chosen or pending spacing grid decision.');
501
555
  }
502
556
  }
503
557
 
@@ -563,14 +617,11 @@ export function validateDesignIntentContract(designIntentContract) {
563
617
  validationErrors.push('designIntent.colorTruth.intent must be a non-empty string.');
564
618
  }
565
619
  const paletteRoles = designIntentContract.colorTruth.paletteRoles;
566
- if (!Array.isArray(paletteRoles) || paletteRoles.length < 4) {
567
- validationErrors.push('designIntent.colorTruth.paletteRoles must define the minimum semantic palette roles.');
568
- } else {
569
- for (const requiredPaletteRole of ['base', 'surface', 'text', 'accent']) {
570
- if (!paletteRoles.includes(requiredPaletteRole)) {
571
- validationErrors.push(`designIntent.colorTruth.paletteRoles is missing "${requiredPaletteRole}".`);
572
- }
573
- }
620
+ if (!Array.isArray(paletteRoles) || paletteRoles.length < 1) {
621
+ validationErrors.push('designIntent.colorTruth.paletteRoles must define or request agent-defined semantic palette roles.');
622
+ }
623
+ if (designIntentContract.colorTruth.rolesMustBeAgentDefined !== true) {
624
+ validationErrors.push('designIntent.colorTruth.rolesMustBeAgentDefined must equal true.');
574
625
  }
575
626
  }
576
627
 
@@ -697,8 +748,8 @@ export function validateDesignIntentContract(designIntentContract) {
697
748
  if (!Array.isArray(designIntentContract.contextHygiene.taintedSources) || designIntentContract.contextHygiene.taintedSources.length < 3) {
698
749
  validationErrors.push('designIntent.contextHygiene.taintedSources must list tainted carryover sources.');
699
750
  }
700
- if (!String(designIntentContract.contextHygiene.approvedReferenceUsage || '').trim()) {
701
- validationErrors.push('designIntent.contextHygiene.approvedReferenceUsage must be a non-empty string.');
751
+ if (!String(designIntentContract.contextHygiene.approvedExternalConstraintUsage || '').trim()) {
752
+ validationErrors.push('designIntent.contextHygiene.approvedExternalConstraintUsage must be a non-empty string.');
702
753
  }
703
754
  }
704
755
 
@@ -719,6 +770,9 @@ export function validateDesignIntentContract(designIntentContract) {
719
770
  'requireStructuredHandoff',
720
771
  'requireRepoEvidenceAlignment',
721
772
  'forbidScreenshotDependency',
773
+ 'requirePerSurfaceMutationOps',
774
+ 'forbidUniformSiblingSurfaceTreatment',
775
+ 'zeroBasedRedesignResetsPriorVisualsWhenRequested',
722
776
  ]) {
723
777
  if (designIntentContract.designExecutionPolicy[requiredFlagName] !== true) {
724
778
  validationErrors.push(`designIntent.designExecutionPolicy.${requiredFlagName} must equal true.`);
@@ -779,8 +833,22 @@ export function validateDesignIntentContract(designIntentContract) {
779
833
  validationErrors.push('designIntent.designExecutionHandoff.viewportMutationPlan must exist.');
780
834
  } else {
781
835
  for (const viewportKey of ['mobile', 'tablet', 'desktop']) {
782
- if (!String(viewportMutationPlan[viewportKey] || '').trim()) {
783
- validationErrors.push(`designIntent.designExecutionHandoff.viewportMutationPlan.${viewportKey} must be a non-empty string.`);
836
+ const viewportPlan = viewportMutationPlan[viewportKey];
837
+ if (!viewportPlan || typeof viewportPlan !== 'object') {
838
+ validationErrors.push(`designIntent.designExecutionHandoff.viewportMutationPlan.${viewportKey} must be an object.`);
839
+ continue;
840
+ }
841
+ if (!String(viewportPlan.primaryOperation || '').trim()) {
842
+ validationErrors.push(`designIntent.designExecutionHandoff.viewportMutationPlan.${viewportKey}.primaryOperation must be a non-empty string.`);
843
+ }
844
+ if (!Array.isArray(viewportPlan.requiredSurfaceActions) || viewportPlan.requiredSurfaceActions.length < 2) {
845
+ validationErrors.push(`designIntent.designExecutionHandoff.viewportMutationPlan.${viewportKey}.requiredSurfaceActions must contain at least two actions.`);
846
+ }
847
+ if (!Array.isArray(viewportPlan.forbiddenPatterns) || viewportPlan.forbiddenPatterns.length < 1) {
848
+ validationErrors.push(`designIntent.designExecutionHandoff.viewportMutationPlan.${viewportKey}.forbiddenPatterns must contain at least one anti-pattern.`);
849
+ }
850
+ if (!String(viewportPlan.rationale || '').trim()) {
851
+ validationErrors.push(`designIntent.designExecutionHandoff.viewportMutationPlan.${viewportKey}.rationale must be a non-empty string.`);
784
852
  }
785
853
  }
786
854
  }
@@ -815,6 +883,9 @@ export function validateDesignIntentContract(designIntentContract) {
815
883
  if (designIntentContract.reviewRubric.version !== 'ui-rubric-v1') {
816
884
  validationErrors.push('designIntent.reviewRubric.version must equal "ui-rubric-v1".');
817
885
  }
886
+ if (designIntentContract.reviewRubric.genericityAutoFail !== true) {
887
+ validationErrors.push('designIntent.reviewRubric.genericityAutoFail must equal true.');
888
+ }
818
889
  if (!Array.isArray(designIntentContract.reviewRubric.dimensions) || designIntentContract.reviewRubric.dimensions.length < 5) {
819
890
  validationErrors.push('designIntent.reviewRubric.dimensions must define the required rubric dimensions.');
820
891
  } else {
@@ -861,6 +932,10 @@ export function validateDesignIntentContract(designIntentContract) {
861
932
  }
862
933
  }
863
934
 
935
+ if (!Array.isArray(designIntentContract.forbiddenPatterns) || designIntentContract.forbiddenPatterns.length < 4) {
936
+ validationErrors.push('designIntent.forbiddenPatterns must list concrete anti-generic patterns.');
937
+ }
938
+
864
939
  return validationErrors;
865
940
  }
866
941