@ryuenn3123/agentic-senior-core 3.0.23 → 3.0.26

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.
@@ -27,17 +27,21 @@ The agent must summarize what it used from that research, discard what does not
27
27
 
28
28
  User-supplied research may influence the candidate set for motion, scroll, UI primitives, canvas/3D, charts, icons, typography, and interaction patterns, but the final choice must still be project-fit, accessible, performant, and maintainable.
29
29
 
30
- ## Advanced Conceptual Anchor
30
+ ## Dynamic Avant-Garde Anchor Engine
31
31
 
32
- If the user requests UI work but provides no external research, design reference, screenshot study, or library note, do not start coding immediately. First synthesize one advanced conceptual anchor that will unify the interface.
32
+ If the user requests UI work but provides no user-supplied research, design reference, screenshot study, or library note, do not start coding immediately. This is not permission to fall back to the scaffold, prior UI, or generic software metaphors. First synthesize one advanced conceptual anchor that will unify the interface.
33
33
 
34
- Do not use basic software UI labels as the final anchor, including "dashboard", "portal", "cards", "admin panel", "SaaS shell", or "minimalist interface".
34
+ User-supplied research means current-task evidence from the user. The scaffold seed, this repo's offline examples, old design docs, and prior UI do not count as research. If live research is available, perform agent-led research into current official docs for any technology choices and current premium interaction/design patterns before selecting the anchor. If live research is unavailable, state that limitation in the design docs and synthesize from product context plus broad design knowledge without pretending the seed was research.
35
35
 
36
- The agent must consider at least three substantially different candidate anchors internally, discard predictable or generic candidates, and record only the surviving anchor and concise rationale. Do not expose hidden deliberation or the rejected candidate list.
36
+ Do not use basic software UI labels as the final anchor, including "dashboard", "portal", "cards", "admin panel", "SaaS shell", "web app shell", or "minimalist interface".
37
37
 
38
- The final anchor must come from broad non-template domains such as complex physical engineering, high-end industrial design, experimental editorial structure, advanced architecture, scientific instrumentation, or spatial information systems. These are search domains, not style presets.
38
+ The agent must internally consider at least three substantially different, high-variance candidate anchors, discard the two most obvious, safest, or easiest-to-predict options, and record only the surviving anchor and concise rationale. Do not expose hidden deliberation or the rejected candidate list.
39
39
 
40
- Write the chosen anchor into `docs/design-intent.json` as `conceptualAnchor`, then derive typography, spacing, density, color behavior, morphology, motion, and responsive composition from that single anchor. If a later design choice does not logically follow from the anchor, revise the contract before coding.
40
+ The final anchor must come from broad non-template domains such as complex physical engineering, high-end industrial design, cinematic spatial interfaces, experimental editorial structure, advanced architecture, scientific instrumentation, advanced data visualization, exhibition/wayfinding systems, or premium interactive web experiences. These are search domains, not style presets.
41
+
42
+ Write the chosen anchor into `docs/design-intent.json` as `conceptualAnchor`, including agentResearchMode, sourceDomain, rationale, derivedTokenLogic, visualRiskBudget, motionRiskBudget, and cohesionChecks. Typography, spacing, density, color behavior, morphology, motion, and responsive composition must logically derive from that single anchor. If a later design choice does not follow from the anchor, revise the contract before coding.
43
+
44
+ Motion is not a garnish. Default to a rich motion plan: fluid transitions, spatial reveals, scroll choreography, micro-interactions, and modern motion libraries are expected when they strengthen the anchor and product experience. Keep reduced-motion fallbacks instead of suppressing motion, and solve performance deliberately instead of using safety language as a reason to stay static.
41
45
 
42
46
  ## Zero-Based Redesign Protocol
43
47
 
@@ -58,7 +62,7 @@ The UI must feel authored by a strong UI/UX designer, not assembled from default
58
62
  Do:
59
63
  - Synthesize a visual direction from the project context and explain why it fits.
60
64
  - Choose color, typography, spacing, motion, density, and component morphology dynamically from the product and audience.
61
- - Use modern, expressive interaction when it improves hierarchy, feedback, delight, confidence, or memorability.
65
+ - Use modern, expressive interaction and motion as part of the core design language, especially when it improves hierarchy, feedback, delight, confidence, or memorability.
62
66
  - Keep frontend code clean, componentized, accessible, and easy to maintain.
63
67
  - Use tokens and semantic aliases so future changes do not require rewriting components.
64
68
  - Make design decisions explicit before coding, then implement consistently.
@@ -65,7 +65,7 @@ Run this before declaring a task done. Apply only the sections relevant to the c
65
65
  - [ ] Visual direction is project-specific and not a template/default component-kit habit.
66
66
  - [ ] Responsive behavior recomposes content and priority, not only shrinking desktop layout.
67
67
  - [ ] Accessibility hard requirements are preserved: keyboard access, focus visibility, contrast, target size, status feedback, and no color-only meaning.
68
- - [ ] Motion is purposeful, reduced-motion-safe, and justified by product value.
68
+ - [ ] Motion is treated as part of the design language for modern UI work, with reduced-motion and performance safeguards instead of defaulting to static screens.
69
69
 
70
70
  ## 8. Dependencies And Runtime
71
71
 
@@ -52,6 +52,14 @@ Do not use this file to teach generic frontend basics the model already knows.
52
52
  - Do not let heading, body, and data/meta roles collapse into one safe typographic family without explicit rationale.
53
53
  - At least one visual, interaction, content, motion, or state behavior must read as project-specific at a glance.
54
54
 
55
+ ## Dynamic Avant-Garde Anchor Boundary
56
+
57
+ - If the user gives no current-task visual research or reference, the scaffold, old UI, and existing design docs do not count as research.
58
+ - Before UI code, choose one agent-synthesized conceptual anchor from high-variance non-software domains and record only the final anchor in `docs/design-intent.json`.
59
+ - Internally reject the safest dashboard, portal, card-grid, admin-shell, or minimalist-web-app mental model before writing CSS.
60
+ - Typography, spacing, morphology, motion, and responsive recomposition must derive from the chosen anchor, not from framework defaults.
61
+ - Default to an expressive motion plan derived from the anchor. Use spatial transitions, micro-interactions, scroll choreography, and modern animation libraries when they improve the experience; include reduced-motion and performance safeguards without using them as an excuse for a static UI.
62
+
55
63
  ## Responsive Mutation Requirements
56
64
 
57
65
  - Responsive quality is not allowed to be scale-only. At least one surface must materially change position, grouping, priority, or disclosure strategy between mobile and desktop.
@@ -64,7 +72,7 @@ Do not use this file to teach generic frontend basics the model already knows.
64
72
  - Define the primary user task or reading path from current evidence before arranging surfaces.
65
73
  - Supporting surfaces must earn their placement through role, priority, or behavior. They must not feel like cloned modules.
66
74
  - Component states must preserve identity under hover, focus, loading, success, empty, and error. Do not let everything collapse into anonymous rounded panels.
67
- - Motion may be expressive, but it must strengthen hierarchy, feedback, or memorability while staying reduced-motion-safe and performant.
75
+ - Motion should be expressive by default for modern UI work. Make it strengthen hierarchy, feedback, or memorability, then keep it reduced-motion-safe and performant.
68
76
 
69
77
  ## Implementation Boundaries
70
78
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-04-24T15:04:58.174Z",
2
+ "generatedAt": "2026-04-25T03:25:49.150Z",
3
3
  "reportName": "memory-continuity-benchmark",
4
4
  "schemaVersion": "1.0.0",
5
5
  "passed": true,
package/.cursorrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v3.0.23
3
+ Generated by Agentic-Senior-Core CLI v3.0.26
4
4
  Timestamp: 2026-04-24T06:02:48.303Z
5
5
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
6
6
 
package/.windsurfrules CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTIC-SENIOR-CORE DYNAMIC GOVERNANCE RULESET
2
2
 
3
- Generated by Agentic-Senior-Core CLI v3.0.23
3
+ Generated by Agentic-Senior-Core CLI v3.0.26
4
4
  Timestamp: 2026-04-24T06:02:48.303Z
5
5
  Selected policy file: .agent-context/policies/llm-judge-threshold.json
6
6
 
package/README.md CHANGED
@@ -10,12 +10,14 @@
10
10
  **Production-grade Rules Engine (Governance Engine) for AI coding agents.**
11
11
  Works with Cursor, Windsurf, GitHub Copilot, Claude Code, Gemini, and other LLM-powered IDE workflows.
12
12
 
13
- Latest release: 3.0.9 (2026-04-20).
13
+ Latest release: 3.0.26 (2026-04-25).
14
14
 
15
- Highlights in 3.0.9:
16
- - Design bootstrap prompts now rely on shipped project evidence instead of assuming extra docs exist in every initialized repository.
17
- - Dynamic UI design guidance now emphasizes structure, rationale, and anti-generic constraints without anchoring to brand systems.
18
- - Init prompts now point agents at the active onboarding and compiled-rule context that actually exists in target projects.
15
+ Highlights in 3.0.26:
16
+ - Memory continuity now seeds `.agent-context/state/active-memory.json` once, so new sessions have a compact project-focus snapshot without overwriting active work during upgrade.
17
+ - Token optimization now exposes an output folding strategy that preserves failures, file/line details, and actionable warnings while folding repetitive shell noise.
18
+ - UI design guidance now treats expressive motion as a first-class default for modern interfaces instead of letting safety wording become an excuse for static screens.
19
+ - Agents must use live/current-year research for ecosystem, framework, dependency, Docker, and modern UI/library claims instead of offline repository guesses.
20
+ - Frontend guidance rejects safe dashboard/admin-panel defaults and requires responsive recomposition.
19
21
 
20
22
  </div>
21
23
 
@@ -37,6 +39,20 @@ One command to initialize rules, checklists, and strict AI coding guidelines con
37
39
 
38
40
  ---
39
41
 
42
+ ## Design Direction
43
+
44
+ For UI, UX, layout, screen, Tailwind, frontend, or redesign work, the pack routes agents through the design bootstrap and frontend architecture rules before code changes.
45
+
46
+ The intended behavior is agent-led, not offline-template-led:
47
+
48
+ - Existing projects: read the real repository, docs, UI surface, and current user brief before changing design.
49
+ - Fresh projects: ask the LLM agent to recommend the stack and design approach from current evidence instead of silently choosing a hardcoded framework.
50
+ - No visual reference provided: synthesize one modern conceptual anchor first, then derive typography, spacing, morphology, motion, and responsive behavior from that anchor.
51
+ - Modern UI claims: research current-year libraries and patterns when relevant; 2026 work should use 2026 evidence, and future years should update automatically through agent research.
52
+ - Anti-generic rule: avoid safe dashboard shells, admin panels, card grids, scale-only mobile layouts, and static no-motion interfaces unless the product context explicitly justifies them.
53
+
54
+ ---
55
+
40
56
  ## MCP Quick Setup (VS Code)
41
57
 
42
58
  1. Generate workspace MCP config:
@@ -67,6 +67,7 @@ import {
67
67
  } from '../token-optimization.mjs';
68
68
  import {
69
69
  createMemoryContinuityState,
70
+ ensureActiveMemorySnapshot,
70
71
  writeMemoryContinuityState,
71
72
  } from '../memory-continuity.mjs';
72
73
 
@@ -603,6 +604,9 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
603
604
  });
604
605
 
605
606
  await writeMemoryContinuityState(resolvedTargetDirectoryPath, memoryContinuityState);
607
+ await ensureActiveMemorySnapshot(resolvedTargetDirectoryPath, {
608
+ projectName: path.basename(resolvedTargetDirectoryPath),
609
+ });
606
610
  console.log(`Project memory continuity metadata enabled (${memoryContinuityState.hydrationMode}, host-supported).`);
607
611
  }
608
612
 
@@ -748,6 +752,7 @@ export async function runInitCommand(targetDirectoryArgument, initOptions = {})
748
752
  hydrationMode: memoryContinuityState?.hydrationMode || null,
749
753
  adapters: memoryContinuityState?.adapters || [],
750
754
  stateFile: isMemoryContinuityEnabled ? '.agent-context/state/memory-continuity.json' : null,
755
+ activeSnapshotFile: isMemoryContinuityEnabled ? '.agent-context/state/active-memory.json' : null,
751
756
  },
752
757
  detectionTransparency,
753
758
  uiScopeSignals: existingProjectUiScopeSignals,
@@ -47,6 +47,7 @@ import {
47
47
  detectProjectDocTemplateStaleness,
48
48
  buildDesignIntentSeedFromSignals,
49
49
  } from '../project-scaffolder.mjs';
50
+ import { ensureActiveMemorySnapshot } from '../memory-continuity.mjs';
50
51
 
51
52
  export function parseUpgradeArguments(commandArguments) {
52
53
  const parsedUpgradeOptions = {
@@ -401,6 +402,7 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
401
402
  managedSurfacePlan,
402
403
  });
403
404
  const supplementalCreatedFileNames = [];
405
+ const shouldEnsureActiveMemorySnapshot = existingOnboardingReport?.memoryContinuity?.enabled !== false;
404
406
 
405
407
  if (shouldSeedDesignIntentOnApply && designIntentSeedContent) {
406
408
  const docsDirectoryPath = path.join(resolvedTargetDirectoryPath, 'docs');
@@ -410,6 +412,16 @@ export async function runUpgradeCommand(targetDirectoryArgument, upgradeOptions
410
412
  supplementalCreatedFileNames.push('docs/design-intent.json');
411
413
  }
412
414
 
415
+ if (shouldEnsureActiveMemorySnapshot) {
416
+ const activeMemoryResult = await ensureActiveMemorySnapshot(resolvedTargetDirectoryPath, {
417
+ projectName: packageManifest?.name || path.basename(resolvedTargetDirectoryPath),
418
+ });
419
+
420
+ if (activeMemoryResult.created) {
421
+ supplementalCreatedFileNames.push('.agent-context/state/active-memory.json');
422
+ }
423
+ }
424
+
413
425
  await compileDynamicContext({
414
426
  targetDirectoryPath: resolvedTargetDirectoryPath,
415
427
  selectedStackFileName,
@@ -36,8 +36,10 @@ const INLINE_SENSITIVE_PATTERNS = [
36
36
 
37
37
  export const MEMORY_SCHEMA_VERSION = '1.0.0';
38
38
  export const MEMORY_CONTINUITY_STATE_FILE_NAME = 'memory-continuity.json';
39
+ export const ACTIVE_MEMORY_STATE_FILE_NAME = 'active-memory.json';
39
40
 
40
41
  const MEMORY_CONTINUITY_STATE_SCHEMA_VERSION = 'memory-continuity-v1';
42
+ const ACTIVE_MEMORY_STATE_SCHEMA_VERSION = 'active-memory-v1';
41
43
 
42
44
  export const SUPPORTED_MEMORY_ADAPTER_IDS = Object.freeze([
43
45
  'claude-code',
@@ -359,6 +361,138 @@ export async function writeMemoryContinuityState(targetDirectoryPath, memoryCont
359
361
  await fs.writeFile(stateFilePath, JSON.stringify(memoryContinuityState, null, 2) + '\n', 'utf8');
360
362
  }
361
363
 
364
+ export function createActiveMemorySnapshot(options = {}) {
365
+ return {
366
+ schemaVersion: ACTIVE_MEMORY_STATE_SCHEMA_VERSION,
367
+ snapshotPurpose: 'compact-cross-session-continuity',
368
+ updatePolicy: {
369
+ writeWhen: 'natural-task-boundary',
370
+ overwriteOnlyWithCurrentRepoEvidence: true,
371
+ preserveUserOwnedContent: true,
372
+ },
373
+ project: {
374
+ name: toNonEmptyString(options.projectName, ''),
375
+ currentFocus: '',
376
+ durableFacts: [],
377
+ },
378
+ progress: {
379
+ lastAchievements: [],
380
+ pendingIssues: [],
381
+ nextBestActions: [],
382
+ validationState: [],
383
+ },
384
+ designContinuity: {
385
+ visualLanguageContinuity: 'opt-in-only',
386
+ currentConceptualAnchor: '',
387
+ forbiddenCarryover: [
388
+ 'prior-project-style-memory',
389
+ 'old-ui-visual-dna-without-user-approval',
390
+ 'generic-dashboard-defaults',
391
+ ],
392
+ },
393
+ privacy: {
394
+ storeSecrets: false,
395
+ storeRawChatLogs: false,
396
+ redactSensitiveTextBeforeWriting: true,
397
+ },
398
+ generatedAt: new Date().toISOString(),
399
+ lastUpdatedAt: null,
400
+ };
401
+ }
402
+
403
+ export function validateActiveMemorySnapshot(activeMemorySnapshot) {
404
+ const validationErrors = [];
405
+
406
+ if (!activeMemorySnapshot || typeof activeMemorySnapshot !== 'object') {
407
+ return ['active-memory snapshot must be an object.'];
408
+ }
409
+
410
+ if (activeMemorySnapshot.schemaVersion !== ACTIVE_MEMORY_STATE_SCHEMA_VERSION) {
411
+ validationErrors.push(`active-memory.schemaVersion must equal "${ACTIVE_MEMORY_STATE_SCHEMA_VERSION}".`);
412
+ }
413
+
414
+ if (activeMemorySnapshot.snapshotPurpose !== 'compact-cross-session-continuity') {
415
+ validationErrors.push('active-memory.snapshotPurpose must equal "compact-cross-session-continuity".');
416
+ }
417
+
418
+ const serializedSnapshot = JSON.stringify(activeMemorySnapshot);
419
+ if (estimateTokenUsage(serializedSnapshot) > 3000) {
420
+ validationErrors.push('active-memory snapshot must stay compact enough for session-start hydration.');
421
+ }
422
+
423
+ const redactionProbe = redactSensitiveMemoryText(serializedSnapshot);
424
+ if (redactionProbe.wasRedacted) {
425
+ validationErrors.push('active-memory snapshot must not contain secret-like fields, bearer tokens, or private blocks.');
426
+ }
427
+
428
+ if (activeMemorySnapshot.privacy?.storeSecrets !== false) {
429
+ validationErrors.push('active-memory.privacy.storeSecrets must equal false.');
430
+ }
431
+
432
+ if (activeMemorySnapshot.privacy?.storeRawChatLogs !== false) {
433
+ validationErrors.push('active-memory.privacy.storeRawChatLogs must equal false.');
434
+ }
435
+
436
+ if (activeMemorySnapshot.privacy?.redactSensitiveTextBeforeWriting !== true) {
437
+ validationErrors.push('active-memory.privacy.redactSensitiveTextBeforeWriting must equal true.');
438
+ }
439
+
440
+ for (const arrayPath of [
441
+ ['project', 'durableFacts'],
442
+ ['progress', 'lastAchievements'],
443
+ ['progress', 'pendingIssues'],
444
+ ['progress', 'nextBestActions'],
445
+ ['progress', 'validationState'],
446
+ ]) {
447
+ const arrayValue = arrayPath.reduce((currentValue, pathSegment) => currentValue?.[pathSegment], activeMemorySnapshot);
448
+ const pathLabel = `active-memory.${arrayPath.join('.')}`;
449
+ if (!Array.isArray(arrayValue)) {
450
+ validationErrors.push(`${pathLabel} must be an array.`);
451
+ continue;
452
+ }
453
+
454
+ if (arrayValue.length > 12) {
455
+ validationErrors.push(`${pathLabel} must stay compact and contain at most 12 entries.`);
456
+ }
457
+ }
458
+
459
+ if (activeMemorySnapshot.designContinuity?.visualLanguageContinuity !== 'opt-in-only') {
460
+ validationErrors.push('active-memory.designContinuity.visualLanguageContinuity must equal "opt-in-only".');
461
+ }
462
+
463
+ return validationErrors;
464
+ }
465
+
466
+ export async function ensureActiveMemorySnapshot(targetDirectoryPath, options = {}) {
467
+ const stateDirectoryPath = path.join(targetDirectoryPath, '.agent-context', 'state');
468
+ const stateFilePath = path.join(stateDirectoryPath, ACTIVE_MEMORY_STATE_FILE_NAME);
469
+
470
+ if (await pathExists(stateFilePath)) {
471
+ return {
472
+ created: false,
473
+ filePath: stateFilePath,
474
+ };
475
+ }
476
+
477
+ await fs.mkdir(stateDirectoryPath, { recursive: true });
478
+ const activeMemorySnapshot = createActiveMemorySnapshot(options);
479
+ const validationErrors = validateActiveMemorySnapshot(activeMemorySnapshot);
480
+ if (validationErrors.length > 0) {
481
+ throw new Error(`Invalid active memory snapshot seed: ${validationErrors.join(' ')}`);
482
+ }
483
+
484
+ await fs.writeFile(
485
+ stateFilePath,
486
+ JSON.stringify(activeMemorySnapshot, null, 2) + '\n',
487
+ 'utf8'
488
+ );
489
+
490
+ return {
491
+ created: true,
492
+ filePath: stateFilePath,
493
+ };
494
+ }
495
+
362
496
  export function buildMemoryContinuityGuidanceBlock(memoryContinuityState) {
363
497
  if (!memoryContinuityState?.enabled) {
364
498
  return [
@@ -384,9 +518,12 @@ export function buildMemoryContinuityGuidanceBlock(memoryContinuityState) {
384
518
  adapterGuidanceLine,
385
519
  '',
386
520
  'Session-start retrieval policy:',
521
+ '- Read `.agent-context/state/active-memory.json` first when it exists; it is the compact project-focus snapshot.',
387
522
  `- Load compact index first (limit: ${sessionStartIndexLimit} entries).`,
388
523
  `- Hydrate full detail only for highest-value entries (limit: ${fullHydrationLimit}).`,
389
524
  '- Always redact sensitive text before persistence (<private> blocks and inline secret-like fields).',
525
+ '- Refresh `active-memory.json` at natural task boundaries, but never store secrets, raw chat logs, or stale visual taste.',
526
+ '- Current repo evidence, current user brief, and live research override active-memory when they conflict.',
390
527
  '',
391
528
  'Host compatibility scope:',
392
529
  '- This memory layer does not replace reading bootstrap instruction files at the start of a session.',
@@ -51,8 +51,6 @@ function buildStructureFirstSeedSignals({
51
51
 
52
52
  return {
53
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
54
  typographyScaleRatio: 'agent-calibrated-from-content-platform-and-readability',
57
55
  baseGridUnit: 'agent-calibrated-from-platform-density-and-implementation-stack',
58
56
  spacingPattern: 'agent-defined-from-task-flow-and-viewport-needs',
@@ -60,16 +58,9 @@ function buildStructureFirstSeedSignals({
60
58
  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
59
  paletteRoles: ['agent-defined-semantic-roles'],
62
60
  distinctiveMoves: [
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.',
61
+ 'Choose one recognizable design move from product task, audience, content, repo evidence, and current docs; do not inherit a scaffold preset.',
66
62
  ],
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.',
69
- motionDurations: {
70
- desktop: 'agent-calibrated',
71
- mobile: 'agent-calibrated',
72
- },
63
+ motionPurpose: 'Default to a modern motion plan for UI work: use expressive transitions, spatial choreography, micro-interactions, and motion libraries when they strengthen 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.',
73
64
  componentMorphology: {
74
65
  mobile: 'Recompose the experience for touch, task priority, and constrained attention. Mobile should be a deliberate mobile design, not a shrunken desktop.',
75
66
  tablet: 'Regroup surfaces for medium-width use, preserving task clarity without cloning either desktop or mobile blindly.',
@@ -121,8 +112,6 @@ function buildDesignIntentContractObject({
121
112
  : toTitleCase(initContext.blueprintFileName),
122
113
  },
123
114
  designPhilosophy: inferredKeywords.designPhilosophy,
124
- brandAdjectives: inferredKeywords.brandAdjectives,
125
- antiAdjectives: inferredKeywords.antiAdjectives,
126
115
  visualDirection: {
127
116
  seedMode: 'scaffold-only',
128
117
  requiresProjectSpecificSynthesis: true,
@@ -139,11 +128,8 @@ function buildDesignIntentContractObject({
139
128
  candidateDomains: [
140
129
  'visual-direction',
141
130
  'motion-and-scroll',
142
- 'ui-primitives',
143
- 'canvas-3d-or-rich-media',
144
- 'charts-and-data-visualization',
145
- 'icons-and-illustration',
146
- 'typography-and-interaction-patterns',
131
+ 'ui-primitives-or-rich-media',
132
+ 'typography-and-interaction',
147
133
  ],
148
134
  finalDecisionAuthority: 'agent-llm-from-project-fit-accessibility-performance-maintainability-and-current-official-docs',
149
135
  },
@@ -151,33 +137,44 @@ function buildDesignIntentContractObject({
151
137
  mode: 'required-when-no-external-research',
152
138
  seedMode: 'selection-policy-only',
153
139
  requiresAgentSelectionBeforeUiImplementation: true,
140
+ userResearchAbsencePolicy: {
141
+ userSuppliedResearchOnly: true,
142
+ scaffoldSeedDoesNotCountAsResearch: true,
143
+ priorUiDoesNotCountAsResearch: true,
144
+ requireAgentLedResearchWhenAvailable: true,
145
+ },
154
146
  candidateSelectionPolicy: {
155
147
  considerAtLeast: 3,
148
+ discardObviousCandidateCount: 2,
149
+ minimumCandidateDistance: 'high',
156
150
  discardPredictableCandidates: true,
151
+ preferDistinctiveOverSafe: true,
157
152
  doNotRevealHiddenCandidateList: true,
158
153
  outputOnlyChosenAnchor: true,
159
154
  },
160
155
  forbiddenFinalAnchorTerms: [
161
156
  'dashboard',
162
- 'portal',
163
157
  'cards',
164
158
  'admin-panel',
165
159
  'saas-shell',
166
160
  'minimalist-interface',
161
+ 'safe-admin-layout',
167
162
  ],
168
163
  sourceDomains: [
169
164
  'complex-physical-engineering',
170
- 'high-end-industrial-design',
165
+ 'cinematic-spatial-interface',
171
166
  'experimental-editorial-structure',
172
- 'advanced-architecture',
173
167
  'scientific-instrumentation',
174
- 'spatial-information-systems',
168
+ 'premium-interactive-web-experiences',
175
169
  ],
170
+ visualRiskBudget: {
171
+ mode: 'high-distinctiveness-with-accessibility-and-performance-guardrails',
172
+ allowRichMotionAndMicroInteraction: true,
173
+ rejectTimidDefaultWhenAnchorSupportsExpressiveUi: true,
174
+ requireReducedMotionFallback: true,
175
+ },
176
176
  requiredDerivedAxes: [
177
177
  'typography',
178
- 'spacing',
179
- 'density',
180
- 'color-behavior',
181
178
  'morphology',
182
179
  'motion',
183
180
  'responsive-composition',
@@ -185,19 +182,21 @@ function buildDesignIntentContractObject({
185
182
  finalAnchorContract: {
186
183
  requiredFields: [
187
184
  'name',
185
+ 'agentResearchMode',
188
186
  'sourceDomain',
189
187
  'rationale',
190
188
  'derivedTokenLogic',
189
+ 'visualRiskBudget',
190
+ 'motionRiskBudget',
191
191
  'cohesionChecks',
192
192
  ],
193
193
  derivedTokenLogicAxes: [
194
- 'typography',
195
- 'spacing',
196
- 'density',
197
- 'color-behavior',
198
194
  'morphology',
199
195
  'motion',
200
- 'responsive-composition',
196
+ ],
197
+ cohesionChecks: [
198
+ 'no-dashboard-mental-model',
199
+ 'motion-derived-from-anchor',
201
200
  ],
202
201
  },
203
202
  },
@@ -217,7 +216,6 @@ function buildDesignIntentContractObject({
217
216
  componentTokensConsumeSemantic: true,
218
217
  forbidDirectComponentPrimitiveBypass: true,
219
218
  aliasReferenceStyle: 'brace-reference',
220
- aliasingStrategy: 'Primitive tokens hold raw values, semantic tokens carry intent, and component tokens consume semantic aliases instead of raw values.',
221
219
  fallbackPolicy: {
222
220
  forbidRawHexOutsidePrimitives: true,
223
221
  forbidRawSpacingOutsidePrimitives: true,
@@ -228,12 +226,6 @@ function buildDesignIntentContractObject({
228
226
  forbidDotsInNames: true,
229
227
  forbidSquareBracketsInNames: true,
230
228
  },
231
- tokenLayerRoles: {
232
- primitive: 'Raw values such as colors, spacing, radius, typography, and motion primitives.',
233
- semantic: 'Contextual intent tokens such as primary action, muted surface, emphasis text, or critical state.',
234
- component: 'Component-scoped tokens that consume semantic aliases and preserve local consistency without redefining the system.',
235
- },
236
- platformOutputs: ['json-contract', 'css-variables'],
237
229
  },
238
230
  colorTruth: {
239
231
  format: 'OKLCH',
@@ -253,19 +245,14 @@ function buildDesignIntentContractObject({
253
245
  motionSystem: {
254
246
  allowMeaningfulMotion: true,
255
247
  purpose: inferredKeywords.motionPurpose,
256
- choreography: inferredKeywords.motionChoreography,
257
- desktopDurationMs: inferredKeywords.motionDurations.desktop,
258
- mobileDurationMs: inferredKeywords.motionDurations.mobile,
259
248
  seedToneLocked: false,
260
249
  respectReducedMotion: true,
261
- preferTransformAndOpacity: true,
262
- avoidDecorativeMotionForItsOwnSake: true,
263
250
  },
264
251
  componentMorphology: {
265
252
  requireStateBehaviorMatrix: true,
266
253
  preserveIdentityAcrossViewports: true,
267
254
  seedBehaviorsRequireRefinement: true,
268
- stateKeys: ['default', 'hover', 'focus', 'active', 'disabled', 'loading', 'error'],
255
+ stateKeys: ['default', 'focus', 'loading', 'error'],
269
256
  viewportBehavior: inferredKeywords.componentMorphology,
270
257
  },
271
258
  accessibilityPolicy: {
@@ -322,45 +309,33 @@ function buildDesignIntentContractObject({
322
309
  status: 'seed-needs-refinement',
323
310
  seedMode: 'structure-first-scaffold',
324
311
  requiresTaskSpecificRefinement: true,
325
- 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.`,
312
+ primaryExperienceGoal: `Define the main ${String(primaryDomain || 'product').toLowerCase()} journey for ${projectName} from repo evidence, the brief, and current docs. The seed must not prescribe final layout.`,
326
313
  surfacePlan: [
327
314
  {
328
315
  surfaceId: 'agent-defined-primary-experience',
329
- role: 'llm-synthesized-from-current-context',
330
- goal: `Define the primary UI experience for ${projectName} from the actual product task, audience, data, and repo evidence before coding.`,
331
- primaryAction: 'The LLM must choose the first decisive action or reading path and explain why it fits the project.',
332
- supportingModules: ['agent-defined-from-current-context'],
333
- layoutAntiPatternToAvoid: 'template-default-without-product-rationale',
334
- signatureMoveHint: 'Choose and document one project-specific visual, interaction, or content move. Do not inherit it from this scaffold.',
335
- },
336
- {
337
- surfaceId: 'agent-defined-supporting-experience',
338
- role: 'llm-synthesized-supporting-context',
339
- goal: 'Define supporting, proof, utility, or recovery surfaces from actual user needs instead of cloning generic cards or rails.',
340
- primaryAction: 'The LLM must decide what belongs beside, below, hidden behind disclosure, or removed based on task priority.',
341
- supportingModules: ['agent-defined-from-current-context'],
342
- layoutAntiPatternToAvoid: 'scale-only-responsive-layout',
343
- signatureMoveHint: 'Explain how supporting content changes across viewports and why the change improves the experience.',
316
+ role: 'primary-context-synthesized-by-agent',
317
+ goal: 'Choose the first task or reading path from product evidence and reject template shells.',
318
+ antiPatterns: ['dashboard-default', 'scale-only-responsive-layout'],
344
319
  },
345
320
  ],
346
321
  componentGraph: {
347
322
  nodes: [
348
323
  {
349
- id: 'agent-defined-primary-experience',
350
- role: 'primary-experience-after-synthesis',
324
+ id: 'primary-experience',
325
+ role: 'agent-defined-primary',
351
326
  priority: 'high',
352
327
  },
353
328
  {
354
- id: 'agent-defined-supporting-experience',
355
- role: 'supporting-experience-after-synthesis',
329
+ id: 'supporting-context',
330
+ role: 'agent-defined-support',
356
331
  priority: 'medium',
357
332
  },
358
333
  ],
359
334
  edges: [
360
335
  {
361
- from: 'agent-defined-primary-experience',
362
- to: 'agent-defined-supporting-experience',
363
- relationship: 'agent-defined-from-task-priority',
336
+ from: 'primary-experience',
337
+ to: 'supporting-context',
338
+ relationship: 'task-priority-support',
364
339
  },
365
340
  ],
366
341
  },
@@ -379,25 +354,21 @@ function buildDesignIntentContractObject({
379
354
  mobile: {
380
355
  primaryOperation: 'agent-defined-mobile-recomposition',
381
356
  requiredSurfaceActions: [
382
- 'choose-mobile-specific-task-order',
383
- 'merge-disclose-or-remove-low-priority-content',
384
- 'adapt-interaction-model-for-touch',
357
+ 'choose-mobile-task-order',
358
+ 'disclose-or-remove-low-priority-content',
385
359
  ],
386
360
  forbiddenPatterns: [
387
361
  'scale-only-shrink',
388
- 'desktop-order-preserved-without-priority-shift',
389
362
  ],
390
363
  rationale: inferredKeywords.mutationRules.mobile,
391
364
  },
392
365
  tablet: {
393
366
  primaryOperation: 'agent-defined-tablet-regrouping',
394
367
  requiredSurfaceActions: [
395
- 'define-medium-width-information-architecture',
396
- 'avoid-cloning-desktop-by-width-only',
368
+ 'define-medium-width-grouping',
397
369
  'preserve-task-clarity',
398
370
  ],
399
371
  forbiddenPatterns: [
400
- 'desktop-layout-reduced-by-width-only',
401
372
  'uniform-module-grid-without-role-change',
402
373
  ],
403
374
  rationale: inferredKeywords.mutationRules.tablet,
@@ -406,11 +377,9 @@ function buildDesignIntentContractObject({
406
377
  primaryOperation: 'agent-defined-desktop-composition',
407
378
  requiredSurfaceActions: [
408
379
  'use-space-to-improve-hierarchy',
409
- 'define-scan-pattern-and-action-priority',
410
380
  'avoid-equalizing-unrelated-content',
411
381
  ],
412
382
  forbiddenPatterns: [
413
- 'template-shell-without-product-rationale',
414
383
  'interchangeable-dashboard-or-landing-chrome',
415
384
  ],
416
385
  rationale: inferredKeywords.mutationRules.desktop,
@@ -418,33 +387,25 @@ function buildDesignIntentContractObject({
418
387
  },
419
388
  interactionStateMatrix: [
420
389
  {
421
- componentId: 'primary-action-control',
422
- states: ['default', 'hover', 'focus', 'loading', 'success', 'error'],
423
- notes: 'Refine these states with project-specific feedback language and visual treatment, but keep them legible, decisive, and consistent across all supported viewports.',
424
- },
425
- {
426
- componentId: 'primary-content-module',
427
- states: ['default', 'focus', 'expanded', 'loading', 'error'],
428
- notes: 'Refine this module so it preserves hierarchy and progressive disclosure without collapsing into anonymous cards or safe default dashboard panels.',
390
+ componentId: 'primary-interaction',
391
+ states: ['default', 'hover', 'focus', 'loading', 'error'],
392
+ notes: 'Refine states from project language and the conceptual anchor; do not use anonymous default panels.',
429
393
  },
430
394
  ],
431
395
  taskFlowNarrative: [
432
- `Entry: the LLM must define how ${projectName} starts the user journey from real product evidence instead of a generic opening pattern.`,
433
- 'Decision: the LLM must define hierarchy, proof, state language, and interaction behavior from the actual task.',
434
- 'Resolution: the LLM must define feedback, recovery, and next-useful-action behavior without defaulting to leftover template chrome.',
396
+ `Entry: define how ${projectName} starts the journey from real evidence, not a generic opener.`,
397
+ 'Resolution: define proof, feedback, recovery, and next action without leftover template chrome.',
435
398
  ],
436
399
  visualResetStrategy: {
437
400
  activatesWhenUserRequests: [
438
401
  'redesign from zero',
439
402
  'redesain dari 0',
440
- 'ulang dari 0',
441
- 'research ulang',
442
403
  ],
443
- existingUiAllowedAs: ['content-evidence', 'behavior-evidence', 'accessibility-evidence', 'asset-source-evidence'],
444
- existingUiForbiddenAs: ['palette-source', 'typography-source', 'layout-source', 'motion-source', 'component-morphology-source'],
445
- requiredResetAxes: ['composition', 'hierarchy', 'palette-and-typography', 'motion-or-interaction', 'responsive-information-architecture'],
404
+ existingUiAllowedAs: ['content-evidence', 'behavior-evidence', 'asset-source-evidence'],
405
+ existingUiForbiddenAs: ['palette-source', 'layout-source', 'motion-source'],
406
+ requiredResetAxes: ['composition', 'hierarchy', 'motion-or-interaction', 'responsive-information-architecture'],
446
407
  },
447
- 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.',
408
+ signatureMoveRationale: 'Agent must choose one project-specific visual, motion, typographic, or interaction move and explain why generic fallback weakens it.',
448
409
  implementationGuardrails: {
449
410
  requireBuildFromHandoff: true,
450
411
  requireGapNotesBeforeFallback: true,
@@ -478,7 +439,7 @@ function buildDesignIntentContractObject({
478
439
  {
479
440
  key: 'motionDiscipline',
480
441
  blockingByDefault: false,
481
- question: 'If motion is present, does it stay purposeful, performant, reduced-motion-safe, and consistent with the product tone?',
442
+ question: 'Does motion act as part of the design language while staying purposeful, performant, reduced-motion-safe, and consistent with the product tone?',
482
443
  },
483
444
  ],
484
445
  genericitySignals: [
@@ -486,21 +447,18 @@ function buildDesignIntentContractObject({
486
447
  'unresearched-library-or-framework-choice',
487
448
  'missing-conceptual-anchor-without-external-research',
488
449
  'visual-decisions-not-derived-from-conceptual-anchor',
489
- 'default-component-kit-treatment-without-product-rationale',
450
+ 'timid-anchor-that-renames-dashboard-or-admin-shell',
451
+ 'motion-suppressed-without-accessibility-or-performance-reason',
490
452
  'scale-only-responsive-layout',
491
- 'template-shell-without-product-rationale',
492
453
  'zero-based-redesign-kept-prior-visual-dna',
493
454
  'restyle-instead-of-recomposition',
494
- 'inaccessible-or-decorative-motion',
495
455
  ],
496
456
  validBoldSignals: [
497
457
  'single-cohesive-conceptual-anchor',
458
+ 'high-variance-candidate-selection',
498
459
  'context-derived-visual-direction',
499
- 'official-docs-backed-library-choice',
500
460
  'responsive-recomposition-by-task-priority',
501
461
  'purposeful-motion-with-reduced-motion-path',
502
- 'documented-design-rationale-before-code',
503
- 'clean-component-and-token-architecture',
504
462
  ],
505
463
  reportingRules: {
506
464
  mustExplainGenericity: true,
@@ -528,10 +486,7 @@ function buildDesignIntentContractObject({
528
486
  approvedExternalConstraintUsage: 'Convert explicit user-supplied external constraints into current-project rules without comparing against or imitating the source surface.',
529
487
  driftSignals: [
530
488
  'palette-reused-without-brief-support',
531
- 'motion-signature-reused-without-approval',
532
- 'layout-shape-matches-unrelated-project-memory',
533
489
  'prior-ui-visual-dna-carried-into-reset-request',
534
- 'existing-design-doc-treated-as-style-continuity-during-zero-based-redesign',
535
490
  ],
536
491
  },
537
492
  experiencePrinciples: [
@@ -539,20 +494,17 @@ function buildDesignIntentContractObject({
539
494
  'Major interface decisions must be explainable in product and user terms.',
540
495
  'Accessibility, responsiveness, and implementation realism are non-negotiable.',
541
496
  'Cross-viewport behavior must reorganize tasks and navigation, not just scale the desktop layout down.',
542
- 'Modern libraries and interaction patterns may be used when the LLM verifies they fit the project and current official docs.',
543
- 'Motion may be rich and memorable when it improves the product experience, but it must stay purposeful, performant, and optional for reduced-motion users.',
544
- 'At least one visual, interaction, content, or motion decision must be recognizable at a glance and justified from context.',
545
- 'When no external design research is provided, a single advanced conceptual anchor must unify typography, spacing, morphology, motion, and responsive composition.',
497
+ 'A single agent-chosen conceptual anchor must unify typography, spacing, morphology, motion, and responsive composition when user research is absent.',
498
+ 'Expressive motion and spatial interaction are expected for modern UI work when they support the anchor; keep them accessible and performant instead of suppressing them by default.',
546
499
  '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.',
547
500
  ],
548
501
  forbiddenPatterns: [
549
502
  'offline-prescribed-style-used-as-final-direction',
550
- 'unresearched-library-or-framework-choice',
551
503
  'missing-conceptual-anchor-without-external-research',
552
504
  'visual-decisions-not-derived-from-conceptual-anchor',
553
- 'default-component-kit-treatment-without-product-rationale',
505
+ 'timid-anchor-that-renames-dashboard-or-admin-shell',
506
+ 'motion-suppressed-without-accessibility-or-performance-reason',
554
507
  'scale-only-responsive-layout',
555
- 'template-shell-without-product-rationale',
556
508
  'zero-based-redesign-kept-prior-visual-dna',
557
509
  'restyle-instead-of-recomposition',
558
510
  'single-safe-typographic-family-without-role-contrast-or-rationale',
@@ -572,6 +524,8 @@ function buildDesignIntentContractObject({
572
524
  requireStructuredDesignHandoff: true,
573
525
  requireVisualResetStrategyWhenZeroBasedRedesignRequested: true,
574
526
  requireConceptualAnchorWhenNoExternalResearch: true,
527
+ requireAgentLedAnchorResearchWhenUserResearchMissing: true,
528
+ rejectTimidDashboardAnchor: true,
575
529
  requireReviewRubric: true,
576
530
  requireGenericityExplanation: true,
577
531
  genericityAutoFail: true,
@@ -652,6 +606,23 @@ export function validateDesignIntentContract(designIntentContract) {
652
606
  if (conceptualAnchor.requiresAgentSelectionBeforeUiImplementation !== true) {
653
607
  validationErrors.push('designIntent.conceptualAnchor.requiresAgentSelectionBeforeUiImplementation must equal true.');
654
608
  }
609
+ const userResearchAbsencePolicy = conceptualAnchor.userResearchAbsencePolicy;
610
+ if (!userResearchAbsencePolicy || typeof userResearchAbsencePolicy !== 'object') {
611
+ validationErrors.push('designIntent.conceptualAnchor.userResearchAbsencePolicy must exist.');
612
+ } else {
613
+ if (userResearchAbsencePolicy.userSuppliedResearchOnly !== true) {
614
+ validationErrors.push('designIntent.conceptualAnchor.userResearchAbsencePolicy.userSuppliedResearchOnly must equal true.');
615
+ }
616
+ if (userResearchAbsencePolicy.scaffoldSeedDoesNotCountAsResearch !== true) {
617
+ validationErrors.push('designIntent.conceptualAnchor.userResearchAbsencePolicy.scaffoldSeedDoesNotCountAsResearch must equal true.');
618
+ }
619
+ if (userResearchAbsencePolicy.priorUiDoesNotCountAsResearch !== true) {
620
+ validationErrors.push('designIntent.conceptualAnchor.userResearchAbsencePolicy.priorUiDoesNotCountAsResearch must equal true.');
621
+ }
622
+ if (userResearchAbsencePolicy.requireAgentLedResearchWhenAvailable !== true) {
623
+ validationErrors.push('designIntent.conceptualAnchor.userResearchAbsencePolicy.requireAgentLedResearchWhenAvailable must equal true.');
624
+ }
625
+ }
655
626
  const candidateSelectionPolicy = conceptualAnchor.candidateSelectionPolicy;
656
627
  if (!candidateSelectionPolicy || typeof candidateSelectionPolicy !== 'object') {
657
628
  validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy must exist.');
@@ -659,9 +630,18 @@ export function validateDesignIntentContract(designIntentContract) {
659
630
  if (candidateSelectionPolicy.considerAtLeast < 3) {
660
631
  validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy.considerAtLeast must be at least 3.');
661
632
  }
633
+ if (candidateSelectionPolicy.discardObviousCandidateCount < 2) {
634
+ validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy.discardObviousCandidateCount must be at least 2.');
635
+ }
636
+ if (candidateSelectionPolicy.minimumCandidateDistance !== 'high') {
637
+ validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy.minimumCandidateDistance must equal "high".');
638
+ }
662
639
  if (candidateSelectionPolicy.discardPredictableCandidates !== true) {
663
640
  validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy.discardPredictableCandidates must equal true.');
664
641
  }
642
+ if (candidateSelectionPolicy.preferDistinctiveOverSafe !== true) {
643
+ validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy.preferDistinctiveOverSafe must equal true.');
644
+ }
665
645
  if (candidateSelectionPolicy.doNotRevealHiddenCandidateList !== true) {
666
646
  validationErrors.push('designIntent.conceptualAnchor.candidateSelectionPolicy.doNotRevealHiddenCandidateList must equal true.');
667
647
  }
@@ -673,6 +653,7 @@ export function validateDesignIntentContract(designIntentContract) {
673
653
  !Array.isArray(conceptualAnchor.forbiddenFinalAnchorTerms)
674
654
  || !conceptualAnchor.forbiddenFinalAnchorTerms.includes('dashboard')
675
655
  || !conceptualAnchor.forbiddenFinalAnchorTerms.includes('cards')
656
+ || !conceptualAnchor.forbiddenFinalAnchorTerms.includes('safe-admin-layout')
676
657
  ) {
677
658
  validationErrors.push('designIntent.conceptualAnchor.forbiddenFinalAnchorTerms must reject basic UI labels.');
678
659
  }
@@ -680,9 +661,28 @@ export function validateDesignIntentContract(designIntentContract) {
680
661
  !Array.isArray(conceptualAnchor.sourceDomains)
681
662
  || conceptualAnchor.sourceDomains.length < 4
682
663
  || !conceptualAnchor.sourceDomains.includes('complex-physical-engineering')
664
+ || !conceptualAnchor.sourceDomains.includes('cinematic-spatial-interface')
665
+ || !conceptualAnchor.sourceDomains.includes('premium-interactive-web-experiences')
683
666
  ) {
684
667
  validationErrors.push('designIntent.conceptualAnchor.sourceDomains must list broad non-template anchor domains.');
685
668
  }
669
+ const visualRiskBudget = conceptualAnchor.visualRiskBudget;
670
+ if (!visualRiskBudget || typeof visualRiskBudget !== 'object') {
671
+ validationErrors.push('designIntent.conceptualAnchor.visualRiskBudget must exist.');
672
+ } else {
673
+ if (visualRiskBudget.mode !== 'high-distinctiveness-with-accessibility-and-performance-guardrails') {
674
+ validationErrors.push('designIntent.conceptualAnchor.visualRiskBudget.mode must preserve high-distinctiveness guardrails.');
675
+ }
676
+ if (visualRiskBudget.allowRichMotionAndMicroInteraction !== true) {
677
+ validationErrors.push('designIntent.conceptualAnchor.visualRiskBudget.allowRichMotionAndMicroInteraction must equal true.');
678
+ }
679
+ if (visualRiskBudget.rejectTimidDefaultWhenAnchorSupportsExpressiveUi !== true) {
680
+ validationErrors.push('designIntent.conceptualAnchor.visualRiskBudget.rejectTimidDefaultWhenAnchorSupportsExpressiveUi must equal true.');
681
+ }
682
+ if (visualRiskBudget.requireReducedMotionFallback !== true) {
683
+ validationErrors.push('designIntent.conceptualAnchor.visualRiskBudget.requireReducedMotionFallback must equal true.');
684
+ }
685
+ }
686
686
  if (
687
687
  !Array.isArray(conceptualAnchor.requiredDerivedAxes)
688
688
  || !conceptualAnchor.requiredDerivedAxes.includes('typography')
@@ -696,10 +696,13 @@ export function validateDesignIntentContract(designIntentContract) {
696
696
  } else {
697
697
  if (
698
698
  !Array.isArray(finalAnchorContract.requiredFields)
699
+ || !finalAnchorContract.requiredFields.includes('agentResearchMode')
699
700
  || !finalAnchorContract.requiredFields.includes('derivedTokenLogic')
701
+ || !finalAnchorContract.requiredFields.includes('visualRiskBudget')
702
+ || !finalAnchorContract.requiredFields.includes('motionRiskBudget')
700
703
  || !finalAnchorContract.requiredFields.includes('cohesionChecks')
701
704
  ) {
702
- validationErrors.push('designIntent.conceptualAnchor.finalAnchorContract.requiredFields must require derivedTokenLogic and cohesionChecks.');
705
+ validationErrors.push('designIntent.conceptualAnchor.finalAnchorContract.requiredFields must require agentResearchMode, derivedTokenLogic, visualRiskBudget, motionRiskBudget, and cohesionChecks.');
703
706
  }
704
707
  if (
705
708
  !Array.isArray(finalAnchorContract.derivedTokenLogicAxes)
@@ -708,6 +711,13 @@ export function validateDesignIntentContract(designIntentContract) {
708
711
  ) {
709
712
  validationErrors.push('designIntent.conceptualAnchor.finalAnchorContract.derivedTokenLogicAxes must include motion and morphology.');
710
713
  }
714
+ if (
715
+ !Array.isArray(finalAnchorContract.cohesionChecks)
716
+ || !finalAnchorContract.cohesionChecks.includes('no-dashboard-mental-model')
717
+ || !finalAnchorContract.cohesionChecks.includes('motion-derived-from-anchor')
718
+ ) {
719
+ validationErrors.push('designIntent.conceptualAnchor.finalAnchorContract.cohesionChecks must reject dashboard mental models and require motion derivation.');
720
+ }
711
721
  }
712
722
  }
713
723
 
@@ -156,7 +156,7 @@ export function buildDesignBootstrapPrompt({
156
156
  '10. Do not let repeated surfaces, component-kit defaults, or safe typography become the final direction without explicit product rationale.',
157
157
  '11. The LLM must choose color, type, spacing, density, morphology, and motion dynamically from the active project context instead of copying this seed.',
158
158
  '12. Viewport mutation must be operation-based. For each viewport, define the primary mutation operation, required surface actions, and forbidden responsive fallback patterns.',
159
- '13. Motion can be bold, cinematic, or highly expressive when it improves memorability, hierarchy, feedback, or product confidence. If a motion library is needed, research current official docs and select the latest stable compatible option instead of using an offline default. Only reject motion when it harms clarity, accessibility, or runtime performance.',
159
+ '13. Default to a rich motion plan for modern UI work. Motion can be bold, cinematic, spatial, scroll-linked, or highly expressive when it improves memorability, hierarchy, feedback, or product confidence. If a motion library is useful, research current official docs and select the latest stable compatible option instead of using an offline default. Solve clarity, accessibility, and runtime risks without falling back to a static interface by habit.',
160
160
  '14. Define component morphology across interaction states and viewports so cards, forms, nav, and feedback surfaces adapt coherently instead of only resizing.',
161
161
  '15. Keep UI-only requests context-isolated. Load frontend design rules first and do not eagerly load backend-only or workflow-only rules unless the task explicitly crosses those boundaries.',
162
162
  '16. Treat WCAG 2.2 AA as the hard accessibility floor. Use APCA only as advisory perceptual tuning, never as a reason to waive a WCAG failure.',
@@ -176,7 +176,9 @@ export function buildDesignBootstrapPrompt({
176
176
  '30. In zero-based redesign mode, the new contract must name the discarded prior visual DNA and materially reset composition, hierarchy, palette/typography, motion or interaction, and responsive information architecture.',
177
177
  '31. If modern UI, animation, scroll, 3D, canvas, chart, or icon libraries are useful, choose them from current official docs and record source URL, fetched date, reason, risk, and accessibility fallback.',
178
178
  '32. If the user supplies research files, library lists, screenshots, articles, or benchmark notes, read them as candidate evidence, summarize the useful signals, filter by project fit, and verify technology claims against current official docs before implementation.',
179
- '33. If no external research or reference is supplied for UI work, choose one advanced conceptual anchor before coding. Consider multiple candidate anchors internally, discard predictable ones, output only the chosen anchor and rationale, and derive typography, spacing, morphology, motion, and responsive composition from that anchor.',
179
+ '33. If no user-supplied research or reference is supplied for UI work, activate the Dynamic Avant-Garde Anchor Engine before coding. User-supplied research means current-task evidence from the user; this scaffold, prior UI, and old design docs do not count as research.',
180
+ '34. In Dynamic Avant-Garde mode, perform agent-led research when available, then internally consider at least three high-variance conceptual anchors, discard the two safest or most predictable options, output only the chosen anchor and rationale, and forbid final anchors named dashboard, portal, cards, admin panel, SaaS shell, web app shell, or minimalist interface.',
181
+ '35. The chosen anchor must drive typography, spacing, density, color behavior, morphology, motion, and responsive composition. Treat expressive motion, spatial transitions, micro-interactions, and modern animation libraries as first-class options; include performance notes and reduced-motion fallbacks instead of suppressing motion to look safe.',
180
182
  '',
181
183
  '## Project Inputs',
182
184
  `- Project name: ${discoveryAnswers.projectName}`,
@@ -207,7 +209,8 @@ export function buildDesignBootstrapPrompt({
207
209
  '12. Keep visualResetStrategy in the machine-readable handoff so reset-language tasks cannot quietly become restyles of the previous UI.',
208
210
  '13. Preserve externalResearchIntake so user-provided research becomes reviewed evidence without turning into an offline style or dependency preset.',
209
211
  '14. Preserve conceptualAnchor so prompt-only UI work has one cohesive non-template concept instead of a mixed collection of bold but unrelated visual decisions.',
210
- '15. After the contract exists, use it as a first-class source for future UI tasks.',
212
+ '15. Record conceptualAnchor.agentResearchMode, visualRiskBudget, motionRiskBudget, and cohesionChecks so the final UI cannot quietly fall back to a timid dashboard/admin mental model.',
213
+ '16. After the contract exists, use it as a first-class source for future UI tasks.',
211
214
  '',
212
215
  ].join('\n');
213
216
  }
@@ -89,6 +89,43 @@ const COMMAND_REWRITE_MAPPINGS = [
89
89
  },
90
90
  ];
91
91
 
92
+ const OUTPUT_FOLDING_STRATEGY = {
93
+ mode: 'compact-high-signal-output',
94
+ appliesTo: [
95
+ 'shell-command-output',
96
+ 'test-output',
97
+ 'build-output',
98
+ 'diff-output',
99
+ 'log-output',
100
+ ],
101
+ preserveAlways: [
102
+ 'exit-code',
103
+ 'failing-command',
104
+ 'file-and-line',
105
+ 'error-message',
106
+ 'actionable-warning',
107
+ ],
108
+ foldByDefault: [
109
+ 'repeated-success-lines',
110
+ 'large-unchanged-diff-context',
111
+ 'verbose-install-progress',
112
+ 'duplicated-stack-frames',
113
+ 'low-signal-directory-noise',
114
+ ],
115
+ nativeFallback: [
116
+ 'prefer --stat or --name-only before full diff',
117
+ 'prefer focused rg queries before broad file dumps',
118
+ 'prefer failure-focused test reporters when available',
119
+ 'summarize long logs before hydrating full detail',
120
+ ],
121
+ safetyBoundary: [
122
+ 'never hide failing checks',
123
+ 'never drop the command that produced output',
124
+ 'never persist secrets into summaries',
125
+ 'hydrate full output only when the compact summary is insufficient',
126
+ ],
127
+ };
128
+
92
129
  function parseRtkVersion(versionOutput) {
93
130
  const versionMatch = versionOutput.match(/\d+\.\d+\.\d+/);
94
131
  return versionMatch ? versionMatch[0] : null;
@@ -204,6 +241,14 @@ export function createTokenOptimizationState({
204
241
  detectionError: rtkDetection.detectionError,
205
242
  },
206
243
  commandRewriteMappings: COMMAND_REWRITE_MAPPINGS.map((mapping) => ({ ...mapping })),
244
+ outputFoldingStrategy: {
245
+ ...OUTPUT_FOLDING_STRATEGY,
246
+ appliesTo: [...OUTPUT_FOLDING_STRATEGY.appliesTo],
247
+ preserveAlways: [...OUTPUT_FOLDING_STRATEGY.preserveAlways],
248
+ foldByDefault: [...OUTPUT_FOLDING_STRATEGY.foldByDefault],
249
+ nativeFallback: [...OUTPUT_FOLDING_STRATEGY.nativeFallback],
250
+ safetyBoundary: [...OUTPUT_FOLDING_STRATEGY.safetyBoundary],
251
+ },
207
252
  generatedAt: new Date().toISOString(),
208
253
  };
209
254
  }
@@ -258,6 +303,14 @@ export function buildTokenOptimizationGuidanceBlock(tokenOptimizationState) {
258
303
  '- If shell output is still large, summarize and continue iteratively instead of dumping full logs.',
259
304
  ];
260
305
 
306
+ const outputFoldingStrategy = tokenOptimizationState.outputFoldingStrategy || OUTPUT_FOLDING_STRATEGY;
307
+ const outputFoldingLines = [
308
+ `- Mode: ${outputFoldingStrategy.mode || OUTPUT_FOLDING_STRATEGY.mode}.`,
309
+ `- Preserve always: ${(outputFoldingStrategy.preserveAlways || OUTPUT_FOLDING_STRATEGY.preserveAlways).join(', ')}.`,
310
+ `- Fold by default: ${(outputFoldingStrategy.foldByDefault || OUTPUT_FOLDING_STRATEGY.foldByDefault).join(', ')}.`,
311
+ `- Safety boundary: ${(outputFoldingStrategy.safetyBoundary || OUTPUT_FOLDING_STRATEGY.safetyBoundary).join(', ')}.`,
312
+ ];
313
+
261
314
  return [
262
315
  `Token optimization mode is enabled for agent: ${tokenOptimizationState.selectedAgent}.`,
263
316
  `Preferred shell proxy: ${tokenOptimizationState.preferredShellProxy}.`,
@@ -269,6 +322,9 @@ export function buildTokenOptimizationGuidanceBlock(tokenOptimizationState) {
269
322
  '- Shell rewrite hooks affect shell tool calls only.',
270
323
  '- Built-in read/grep/glob style tools may bypass shell rewrites, so explicit compact shell commands should be preferred in high-volume sessions.',
271
324
  '',
325
+ 'Output folding policy:',
326
+ ...outputFoldingLines,
327
+ '',
272
328
  'Fallback behavior when external proxy is unavailable:',
273
329
  ...fallbackGuidance,
274
330
  ].join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryuenn3123/agentic-senior-core",
3
- "version": "3.0.23",
3
+ "version": "3.0.26",
4
4
  "type": "module",
5
5
  "description": "Force your AI Agent to code like a Staff Engineer, not a Junior.",
6
6
  "bin": {
@@ -14,7 +14,7 @@ export function buildSystemPrompt() {
14
14
  'Use repoEvidence.designEvidenceSummary as implementation evidence when deciding whether the diff follows the intended system.',
15
15
  'Do not reward generic SaaS defaults or popular template patterns.',
16
16
  'Do not penalize originality when the implementation still aligns with the contract.',
17
- 'Purposeful motion is allowed and can improve quality. Only flag motion when it drifts from the contract, ignores reduced-motion expectations, or adds avoidable performance/accessibility risk.',
17
+ 'Treat purposeful motion as a first-class quality signal for modern UI work. Flag missing or timid motion when the contract calls for expressive interaction, and only flag motion itself when it drifts from the contract, ignores reduced-motion expectations, or adds avoidable performance/accessibility risk.',
18
18
  'Only flag drift when there is a clear mismatch with the contract, accessibility non-negotiables, or cross-viewport adaptation rules.',
19
19
  'Treat WCAG 2.2 AA failures as hard accessibility drift.',
20
20
  'Treat APCA as advisory perceptual tuning only. Do not set blocking solely because APCA indicates a stronger readability adjustment when WCAG hard requirements still pass.',