Spaces:
Sleeping
Sleeping
File size: 13,775 Bytes
58eca4e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# =============================================================================
# DESIGN SYSTEM EXTRACTOR v2 - AGENT CONFIGURATIONS
# =============================================================================
#
# This file defines the personas and configurations for each agent in the
# design system extraction pipeline.
#
# Model Provider Options (via HuggingFace Inference Providers):
# - novita (default, good balance of cost/quality)
# - groq (fastest, good for Llama/Qwen)
# - cerebras (ultra-fast)
# - sambanova (good for Llama)
# - together (wide model selection)
# - fireworks-ai (good for code models)
#
# =============================================================================
# =============================================================================
# INFERENCE PROVIDER CONFIGURATION
# =============================================================================
inference:
# Default provider for all LLM calls
default_provider: "novita"
# Fallback chain if primary fails
fallback_providers:
- "together"
- "sambanova"
- "groq"
# HuggingFace account tiers
billing:
free_tier_credits: 0.10 # USD per month
pro_tier_credits: 2.00 # USD per month ($9/mo subscription)
warning_threshold: 0.80 # Warn at 80% usage
# Show cost tracking in logs
show_cost_tracking: true
# =============================================================================
# STAGE 1: EXTRACTION (No LLM needed)
# =============================================================================
agent1_crawler:
name: "Website Crawler"
persona: "Meticulous Design Archaeologist"
description: |
Discovers and crawls website pages to extract design tokens.
Uses Playwright for browser automation.
model: null # Rule-based, no LLM needed
agent1_extractor:
name: "Token Extractor"
persona: "Meticulous Design Archaeologist"
description: |
Extracts colors, typography, spacing, radius, and shadows from pages.
Pure CSS/computed style extraction.
model: null # Rule-based, no LLM needed
# =============================================================================
# STAGE 1: NORMALIZATION
# =============================================================================
agent2_normalizer:
name: "Token Normalizer"
persona: "Design System Librarian"
description: |
Cleans, deduplicates, and structures extracted tokens.
Infers naming patterns and semantic roles.
model: "microsoft/Phi-3.5-mini-instruct"
provider: "novita"
max_tokens: 1000
temperature: 0.3
tasks:
- Clean noisy extraction data
- Deduplicate similar tokens
- Infer semantic naming (primary, secondary, etc.)
- Tag confidence levels
# =============================================================================
# STAGE 2: MULTI-AGENT ANALYSIS (LangGraph Parallel)
# =============================================================================
#
# Architecture:
# LLM 1 ββ
# βββ> HEAD ββ> Final Recommendations
# LLM 2 ββ
#
# LLM 1 and LLM 2 run in PARALLEL via LangGraph
# HEAD compiles results and resolves conflicts
#
# =============================================================================
stage2_llm1:
name: "Design Analyst 1"
persona: "Senior Design Systems Architect (Global Perspective)"
description: |
Analyzes design tokens against industry best practices.
Focuses on global/Asian design systems (Ant Design, etc.)
model: "Qwen/Qwen2.5-72B-Instruct"
provider: "novita"
max_tokens: 1500
temperature: 0.4
# Cost tracking (per million tokens)
cost_per_million_input: 0.29
cost_per_million_output: 0.59
tasks:
- Analyze typography patterns and scale consistency
- Evaluate color system and semantic usage
- Check AA/WCAG accessibility compliance
- Assess spacing consistency and grid alignment
- Compare against competitor design systems
expertise:
- Typography best practices and type scales
- Color theory and accessibility standards
- Spacing systems (4px, 8px grids)
- International design standards
- Ant Design, Chakra UI patterns
stage2_llm2:
name: "Design Analyst 2"
persona: "Senior Design Systems Architect (Western Perspective)"
description: |
Analyzes design tokens against industry best practices.
Focuses on Western/US design systems (Material, Apple, etc.)
model: "meta-llama/Llama-3.3-70B-Instruct"
provider: "novita"
max_tokens: 1500
temperature: 0.4
# Cost tracking (per million tokens)
cost_per_million_input: 0.59
cost_per_million_output: 0.79
tasks:
- Analyze typography patterns and scale consistency
- Evaluate color system and semantic usage
- Check AA/WCAG accessibility compliance
- Assess spacing consistency and grid alignment
- Compare against competitor design systems
expertise:
- Material Design 3 patterns
- Apple Human Interface Guidelines
- Shopify Polaris conventions
- IBM Carbon design standards
- Atlassian Design System
stage2_head:
name: "Head Compiler"
persona: "Principal Design Systems Architect"
description: |
Compiles analyses from both LLM analysts.
Resolves conflicts and synthesizes final recommendations.
model: "meta-llama/Llama-3.3-70B-Instruct"
provider: "novita"
max_tokens: 2000
temperature: 0.3
# Cost tracking (per million tokens)
cost_per_million_input: 0.59
cost_per_million_output: 0.79
tasks:
- Compare both analyst perspectives
- Identify agreements and disagreements
- Resolve conflicts with clear reasoning
- Synthesize final recommendations
- Provide confidence scores
expertise:
- Cross-cultural design synthesis
- Conflict resolution and arbitration
- Best practice prioritization
stage2_rules:
name: "Rule Engine"
persona: "Calculation Engine"
description: |
Performs deterministic calculations.
No LLM needed - pure math/logic.
model: null # No LLM - FREE
tasks:
- Generate type scale options (1.2, 1.25, 1.333)
- Calculate spacing grid alignments (4px, 8px)
- Generate color ramps (50-950 shades)
- Compute contrast ratios for accessibility
# =============================================================================
# STAGE 3: GENERATION
# =============================================================================
agent4_generator:
name: "JSON Generator"
persona: "Automation Engineer"
description: |
Converts finalized tokens to production-ready JSON.
Generates Figma-compatible token files.
model: "mistralai/Codestral-22B-v0.1"
provider: "novita"
max_tokens: 2000
temperature: 0.2
tasks:
- Generate final JSON structure
- Apply selected upgrades
- Format for Figma Tokens Studio
- Include metadata and versioning
# =============================================================================
# COMPETITOR DESIGN SYSTEMS
# =============================================================================
competitors:
# Default list (shown in UI, user can edit)
default:
- "Material Design 3"
- "Apple Human Interface Guidelines"
- "Shopify Polaris"
- "IBM Carbon"
- "Atlassian Design System"
# Suggestions for user to add
suggestions:
- "Ant Design"
- "Chakra UI"
- "Tailwind CSS"
- "Bootstrap"
- "Salesforce Lightning"
- "Adobe Spectrum"
- "GitHub Primer"
- "Microsoft Fluent"
- "Radix UI"
- "MUI (Material UI)"
# =============================================================================
# LLM PROMPT TEMPLATES
# =============================================================================
prompts:
# Prompt for LLM 1 and LLM 2 (same structure, different perspective)
analyst: |
You are a {persona}.
## YOUR TASK
Analyze these design tokens extracted from a website and compare against industry best practices.
## EXTRACTED TOKENS
{tokens_summary}
## COMPETITOR DESIGN SYSTEMS TO RESEARCH
{competitors}
## ANALYZE THE FOLLOWING:
### 1. Typography
- Is the type scale consistent? Does it follow a mathematical ratio?
- What is the detected base size?
- Compare to competitors: what ratios do they use?
- Score (1-10) and specific recommendations
### 2. Colors
- Is the color palette cohesive?
- Are semantic colors properly defined (primary, secondary, etc.)?
- Compare to competitors: how do they structure colors?
- Score (1-10) and specific recommendations
### 3. Accessibility (AA Compliance)
- What contrast issues exist?
- Which color combinations fail WCAG AA (4.5:1 for text)?
- Specific fixes needed
- Score (1-10)
### 4. Spacing
- Is spacing consistent? Does it follow a grid (4px, 8px)?
- What base unit is detected?
- Compare to competitors: what spacing systems do they use?
- Score (1-10) and specific recommendations
### 5. Overall Assessment
- Top 3 priorities for improvement
- What works well (keep these)
- What needs immediate attention
## RESPOND IN JSON FORMAT:
```json
{{
"typography": {{
"analysis": "...",
"detected_ratio": 1.2,
"detected_base": 16,
"score": 7,
"recommendations": ["...", "..."]
}},
"colors": {{
"analysis": "...",
"score": 6,
"recommendations": ["...", "..."]
}},
"accessibility": {{
"issues": ["...", "..."],
"score": 5,
"fixes": ["...", "..."]
}},
"spacing": {{
"analysis": "...",
"detected_base": 8,
"score": 7,
"recommendations": ["...", "..."]
}},
"overall_assessment": "...",
"top_3_priorities": ["...", "...", "..."],
"confidence": 85
}}
```
# Prompt for HEAD compiler
head_compiler: |
You are a Principal Design Systems Architect compiling analyses from two expert analysts.
## ANALYST 1 (Global/Asian Perspective) FINDINGS:
{llm1_analysis}
## ANALYST 2 (Western/US Perspective) FINDINGS:
{llm2_analysis}
## RULE-BASED CALCULATIONS:
{rule_calculations}
## YOUR TASK:
1. Compare both analyst perspectives
2. Identify where they AGREE (high confidence)
3. Identify where they DISAGREE (need resolution)
4. Resolve disagreements with clear reasoning
5. Synthesize final recommendations
## RESPOND IN JSON FORMAT:
```json
{{
"agreements": [
{{"topic": "typography", "finding": "...", "confidence": 95}},
...
],
"disagreements": [
{{"topic": "spacing", "llm1_view": "...", "llm2_view": "...", "resolution": "...", "reasoning": "..."}}
],
"final_recommendations": {{
"type_scale": "1.25",
"type_scale_rationale": "Both analysts agree 1.25 (Major Third) balances readability and hierarchy",
"spacing_base": "8px",
"spacing_rationale": "8px grid provides better alignment with industry standards",
"color_improvements": ["Generate full ramps", "Fix contrast on secondary"],
"accessibility_fixes": ["Increase body text contrast to 4.5:1"]
}},
"overall_confidence": 88,
"summary": "The extracted design system shows strong typography foundations but needs spacing normalization and color accessibility improvements."
}}
```
# =============================================================================
# EXTRACTION SETTINGS
# =============================================================================
extraction:
viewports:
desktop:
width: 1440
height: 900
name: "Desktop"
mobile:
width: 375
height: 812
name: "Mobile"
crawling:
max_pages: 20
min_pages: 10
scroll_behavior: "smooth"
wait_for_network_idle: true
network_idle_timeout_ms: 5000
skip_infinite_scroll: true
# =============================================================================
# TYPE SCALE OPTIONS
# =============================================================================
type_scales:
minor_second:
ratio: 1.067
name: "Minor Second"
description: "Very subtle, good for dense data UIs"
major_second:
ratio: 1.125
name: "Major Second"
description: "Subtle progression"
minor_third:
ratio: 1.2
name: "Minor Third"
description: "Balanced, widely used"
major_third:
ratio: 1.25
name: "Major Third"
description: "Classic, recommended for most UIs"
recommended: true
perfect_fourth:
ratio: 1.333
name: "Perfect Fourth"
description: "Strong hierarchy, good for marketing"
golden_ratio:
ratio: 1.618
name: "Golden Ratio"
description: "Dramatic, use sparingly"
# =============================================================================
# SPACING SYSTEMS
# =============================================================================
spacing_systems:
4px_grid:
base: 4
name: "4px Grid"
description: "Fine-grained control, good for dense UIs"
scale: [0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64]
8px_grid:
base: 8
name: "8px Grid"
description: "Industry standard, recommended"
recommended: true
scale: [0, 8, 16, 24, 32, 48, 64, 80, 96, 128]
# =============================================================================
# COLOR RAMP GENERATION
# =============================================================================
color_ramps:
shades: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
method: "oklch" # Modern perceptually uniform
accessibility:
aa_minimum: 4.5
aaa_minimum: 7.0
large_text_aa: 3.0
|