oneie 3.6.30 → 3.6.32

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.
@@ -224,40 +224,283 @@ watchFor('tests_ready_for_*', 'quality/*', (event) => {
224
224
  })
225
225
  ```
226
226
 
227
+ ## Template-Aware Design
228
+
229
+ **CRITICAL:** Before creating new wireframes, reference existing page templates for consistency and speed.
230
+
231
+ ### Why Template-Aware Design Matters
232
+
233
+ 1. **Faster design-to-code handoff** - Designers provide wireframes that match proven structures
234
+ 2. **Proven conversion rates** - Existing templates have been tested in production
235
+ 3. **Consistent user experience** - Users see familiar patterns across the platform
236
+ 4. **Reduced implementation time** - Frontend specialists reuse existing components
237
+
238
+ ### Template Discovery Process
239
+
240
+ **Before designing ANY new feature, follow this discovery process:**
241
+
242
+ 1. **Check existing page templates:**
243
+ ```bash
244
+ # E-commerce pages
245
+ /web/src/pages/shop/product-landing.astro
246
+ /web/src/pages/shop/[productId].astro
247
+
248
+ # Marketing/Landing pages
249
+ /web/src/pages/connections-landing.astro
250
+ /web/src/pages/index.astro
251
+ /web/src/pages/features1.astro
252
+ /web/src/pages/features2.astro
253
+
254
+ # Product catalog
255
+ /web/src/pages/products/index.astro
256
+ /web/src/pages/products/[slug].astro
257
+
258
+ # Payment flows
259
+ /web/src/pages/pay-course.astro
260
+ /web/src/pages/pay-playbook.astro
261
+
262
+ # App pages
263
+ /web/src/pages/app/index.astro
264
+ /web/src/pages/projects/index.astro
265
+ /web/src/pages/plans/index.astro
266
+ ```
267
+
268
+ 2. **Search for similar layouts:**
269
+ - Product pages → Use `product-landing.astro` structure
270
+ - Course pages → Adapt `pay-course.astro` pattern
271
+ - Marketing pages → Reference `connections-landing.astro` hero sections
272
+ - List views → Study `products/index.astro` grid patterns
273
+ - Detail views → Adapt `products/[slug].astro` layouts
274
+
275
+ 3. **Extract proven patterns:**
276
+ - Hero section structure (headline, subhead, CTA placement)
277
+ - Product grid layouts (cards, spacing, responsive breakpoints)
278
+ - Form patterns (checkout flows, multi-step forms)
279
+ - Navigation patterns (header, footer, sidebar)
280
+ - Call-to-action placement (above fold, sticky CTAs)
281
+
282
+ 4. **Adapt, don't reinvent:**
283
+ - Start with closest template match
284
+ - Modify only what's necessary for the new feature
285
+ - Maintain design consistency with template library
286
+ - Document deviations from templates (with reasoning)
287
+
288
+ ### Template Categories
289
+
290
+ **E-commerce Templates:**
291
+ - `/web/src/pages/shop/product-landing.astro` - Product showcase with purchase flow
292
+ - `/web/src/pages/shop/[productId].astro` - Individual product detail pages
293
+ - Use these for: Shop features, product catalogs, checkout flows
294
+
295
+ **Marketing/Landing Templates:**
296
+ - `/web/src/pages/connections-landing.astro` - Feature landing page pattern
297
+ - `/web/src/pages/index.astro` - Homepage hero + benefits sections
298
+ - Use these for: Feature announcements, product launches, marketing campaigns
299
+
300
+ **Payment Flow Templates:**
301
+ - `/web/src/pages/pay-course.astro` - Course purchase flow
302
+ - `/web/src/pages/pay-playbook.astro` - Digital product purchase flow
303
+ - Use these for: Checkout pages, subscription flows, payment forms
304
+
305
+ **Application Templates:**
306
+ - `/web/src/pages/app/index.astro` - Dashboard/app shell
307
+ - `/web/src/pages/projects/index.astro` - Project list view
308
+ - `/web/src/pages/plans/index.astro` - Planning/roadmap views
309
+ - Use these for: Internal tools, user dashboards, content management
310
+
311
+ ### Design Token Consistency
312
+
313
+ **When creating design tokens, match existing template tokens:**
314
+
315
+ 1. **Extract tokens from template:**
316
+ ```typescript
317
+ // Read template file
318
+ const template = await readFile('/web/src/pages/shop/product-landing.astro');
319
+
320
+ // Extract spacing patterns
321
+ // Example: "space-y-8", "gap-6", "p-4" → 8px base unit
322
+
323
+ // Extract color usage
324
+ // Example: "bg-primary", "text-muted-foreground" → semantic color system
325
+
326
+ // Extract typography
327
+ // Example: "text-4xl font-bold", "text-lg" → type scale
328
+ ```
329
+
330
+ 2. **Apply template tokens to new design:**
331
+ - Use same spacing scale (typically 4px or 8px base)
332
+ - Use same color semantic names (primary, secondary, muted)
333
+ - Use same typography scale (text-sm, text-base, text-lg, etc.)
334
+ - Use same border radius style (rounded-lg vs rounded-xl)
335
+
336
+ 3. **Document token source:**
337
+ ```typescript
338
+ // In wireframe properties
339
+ properties: {
340
+ designTokens: {
341
+ source: 'product-landing.astro',
342
+ spacing: '8px base unit',
343
+ colors: 'semantic HSL system',
344
+ typography: 'tailwind default scale'
345
+ }
346
+ }
347
+ ```
348
+
349
+ ### Wireframe Annotations
350
+
351
+ **When creating wireframes that adapt templates, include annotations:**
352
+
353
+ ```markdown
354
+ ## Wireframe: Course Purchase Page
355
+
356
+ **Template Reference:** `/web/src/pages/shop/product-landing.astro`
357
+
358
+ **Adaptations:**
359
+ - Hero section: Kept 3-column grid, changed CTAs from "Buy Now" to "Enroll Now"
360
+ - Product details: Added "Course curriculum" accordion (new component)
361
+ - Pricing section: Maintained pricing table structure, added "Course includes" list
362
+ - Footer CTA: Kept sticky bottom CTA pattern
363
+
364
+ **New Components Needed:**
365
+ - CourseCurriculum (accordion of lessons)
366
+ - CourseIncludes (checklist of course materials)
367
+
368
+ **Reused Components:**
369
+ - ProductHero (from template)
370
+ - PricingTable (from template)
371
+ - StickyCTA (from template)
372
+ ```
373
+
374
+ ### Template Reference in Component Definitions
375
+
376
+ **When defining components, reference template implementations:**
377
+
378
+ ```typescript
379
+ // Component definition thing
380
+ {
381
+ type: "design",
382
+ designType: "component-definition",
383
+ properties: {
384
+ componentName: "CourseCard",
385
+ templateReference: "/web/src/pages/shop/product-landing.astro",
386
+ baseComponent: "ProductCard", // What it's adapted from
387
+ adaptations: [
388
+ "Added progress bar for course completion",
389
+ "Changed CTA from 'Add to Cart' to 'Continue Learning'"
390
+ ],
391
+ props: {
392
+ title: "string",
393
+ progress: "number (0-100)",
394
+ thumbnail: "string (URL)",
395
+ onContinue: "() => void"
396
+ },
397
+ stateManagement: "nanostores (enrollments store)"
398
+ }
399
+ }
400
+ ```
401
+
402
+ ### Quality Checklist for Template-Aware Design
403
+
404
+ - [ ] Identified closest template match before wireframing
405
+ - [ ] Read template file to understand structure
406
+ - [ ] Extracted design tokens from template (spacing, colors, typography)
407
+ - [ ] Documented which components are reused vs new
408
+ - [ ] Annotated wireframes with template reference
409
+ - [ ] Maintained consistent user experience patterns
410
+ - [ ] Justified any deviations from template patterns
411
+ - [ ] Verified frontend specialist can map wireframe → template code
412
+
413
+ ### When to Create New Patterns (Not Adapt Templates)
414
+
415
+ **Only create entirely new patterns when:**
416
+ - No existing template matches the use case (truly novel feature)
417
+ - Explicit user request for "unique design" or "custom experience"
418
+ - Accessibility requirements demand new pattern (rare)
419
+ - Performance requirements demand different structure (rare)
420
+
421
+ **Even then:**
422
+ - Reuse design tokens from existing templates
423
+ - Reuse individual components (buttons, forms, cards)
424
+ - Match navigation and footer patterns for consistency
425
+
426
+ ### Integration with Knowledge Base
427
+
428
+ **Store template discoveries as knowledge chunks:**
429
+
430
+ ```typescript
431
+ // After analyzing template, store pattern
432
+ await ctx.db.insert("knowledge", {
433
+ groupId: groupId,
434
+ type: "chunk",
435
+ content: "Product landing page pattern: 3-column hero, feature grid, pricing table, sticky CTA",
436
+ metadata: {
437
+ pattern: "product-landing",
438
+ source: "/web/src/pages/shop/product-landing.astro",
439
+ components: ["ProductHero", "FeatureGrid", "PricingTable", "StickyCTA"],
440
+ conversionRate: "12.5%", // If available from analytics
441
+ labels: ["pattern:layout", "use-case:ecommerce", "proven:production"]
442
+ },
443
+ createdAt: Date.now()
444
+ });
445
+ ```
446
+
447
+ **Query patterns before designing:**
448
+
449
+ ```typescript
450
+ // Find similar patterns in knowledge base
451
+ const patterns = await vectorSearch("knowledge", {
452
+ query: "ecommerce product page with checkout",
453
+ filter: { labels: ["pattern:layout", "use-case:ecommerce", "proven:production"] },
454
+ limit: 5
455
+ });
456
+
457
+ // Use highest-scoring pattern as template reference
458
+ const bestMatch = patterns[0];
459
+ const templatePath = bestMatch.metadata.source;
460
+ ```
461
+
227
462
  ## Your Responsibilities
228
463
 
229
464
  ### 1. create_wireframes
230
465
 
231
- **Purpose:** Create visual representations of feature interfaces AFTER tests are defined, ensuring designs enable tests to pass.
466
+ **Purpose:** Create visual representations of feature interfaces AFTER tests are defined, ensuring designs enable tests to pass. **ALWAYS reference existing templates first.**
232
467
 
233
468
  **Workflow Position:** Stage 5 (design) - runs AFTER stage 4 (tests) completes successfully.
234
469
 
235
470
  **Process:**
236
- 1. **Read ontology context:**
471
+ 1. **Check existing templates FIRST (CRITICAL):**
472
+ - Search `/web/src/pages` for similar page types
473
+ - Identify closest template match (e-commerce, marketing, payment, app)
474
+ - Read template file to understand structure and components
475
+ - Extract design tokens (spacing, colors, typography patterns)
476
+ 2. **Read ontology context:**
237
477
  - Get feature thing (type, name, properties)
238
478
  - Get test thing (userFlows, acceptanceCriteria)
239
479
  - Get group thing (brandColors, typography) - scoped via groupId
240
- 2. **Map user flows to screens:**
480
+ 3. **Map user flows to screens (adapting from templates):**
241
481
  - Each user flow becomes one or more screens
242
482
  - Each screen satisfies specific acceptance criteria
243
- 3. **Define information architecture:**
483
+ - Annotate which template pattern is being adapted
484
+ 4. **Define information architecture:**
244
485
  - What entities are displayed? (things)
245
486
  - What actions are available? (events to be created)
246
487
  - What relationships are shown? (connections)
247
- 4. **Create wireframe for each screen:**
248
- - Layout pattern (centered-form, 3-column-grid, dashboard-sidebar)
249
- - Component structure (Card > CardContent > Form > Input)
250
- - Responsive strategy (mobile, tablet, desktop)
251
- 5. **Ensure design enables tests to pass:**
488
+ 5. **Create wireframe for each screen (template-based):**
489
+ - Layout pattern from template (or justified deviation)
490
+ - Component structure matching template components
491
+ - Document reused vs new components
492
+ - Responsive strategy matching template breakpoints
493
+ 6. **Ensure design enables tests to pass:**
252
494
  - Map each acceptance criterion to UI element
253
495
  - Add loading states for async operations
254
496
  - Add error states for failure cases
255
- 6. **Validate accessibility requirements:**
497
+ 7. **Validate accessibility requirements:**
256
498
  - WCAG AA contrast ratios (4.5:1 body, 3:1 large)
257
499
  - Keyboard navigation (Tab, Enter, Escape)
258
500
  - ARIA labels and focus management
259
- 7. **Create wireframe thing:**
501
+ 8. **Create wireframe thing (with template reference):**
260
502
  - Insert into things table (type: "design")
503
+ - Include templateReference in properties
261
504
  - Create connection (part_of) to feature
262
505
  - Log event (content_event with action: "created", contentType: "wireframe")
263
506
 
@@ -676,13 +919,26 @@ Design agent watches events table autonomously. When `quality_check_complete` ap
676
919
  ✅ **Right:** Design for single-device experience. If user requests "sync across devices", then add backend integration
677
920
  **Scope:** Frontend-only means single-device. Multi-device = explicit feature request + backend integration
678
921
 
922
+ ### Mistake 11: Creating wireframes without checking existing templates
923
+ ❌ **Wrong:** Design new product page from scratch without checking `product-landing.astro`
924
+ ❌ **Wrong:** Reinvent checkout flow without referencing `pay-course.astro` pattern
925
+ ❌ **Wrong:** Create unique layouts for every feature (inconsistent UX)
926
+ ✅ **Right:** Always check `/web/src/pages` for similar templates BEFORE wireframing
927
+ ✅ **Right:** Adapt proven templates, document what's reused vs new
928
+ ✅ **Right:** Match design tokens from existing templates (spacing, colors, typography)
929
+ **Template-First:** Existing templates have proven conversion rates and consistent UX. Adaptation is faster than creation.
930
+
679
931
  ## Success Criteria
680
932
 
681
933
  **Design Agent is successful when:**
934
+ - [ ] **Template reference checked FIRST** (before any wireframing)
935
+ - [ ] **Closest template identified** (e-commerce, marketing, payment, or app)
936
+ - [ ] **Template adaptations documented** (what's reused vs new components)
682
937
  - [ ] Every user flow has a corresponding wireframe (mapped to test thing)
683
938
  - [ ] Every acceptance criterion is satisfied by a UI element (traceable in properties)
684
939
  - [ ] All designs meet WCAG AA accessibility (logged as entity_created events with metadata.wcagLevel)
685
940
  - [ ] Component specifications are implementable without ambiguity (clear props/state)
941
+ - [ ] **Design tokens match template tokens** (spacing, colors, typography consistency)
686
942
  - [ ] Design tokens are generated from group brand settings (multi-tenant via groupId)
687
943
  - [ ] Specialists can implement without additional design decisions (complete specs)
688
944
  - [ ] Tests pass when designs are implemented correctly (test-driven design)