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.
@@ -187,6 +187,188 @@ Validate that EVERY feature maps to the 6-dimension ontology:
187
187
 
188
188
  **Golden Rule:** If a feature cannot be mapped to these 6 dimensions, it's invalid. The ontology IS the reality model.
189
189
 
190
+ ## Template-First Development (CRITICAL)
191
+
192
+ **ALWAYS search for existing templates before building new features.**
193
+
194
+ ### Template Discovery Phase (Phase 0 in All Plans)
195
+
196
+ **BEFORE creating ANY plan, perform template discovery:**
197
+
198
+ 1. **Search for existing patterns** in `/web/src/pages/`
199
+ 2. **Identify reusable templates** that match the feature request
200
+ 3. **Calculate cycle savings** from template reuse (vs building from scratch)
201
+ 4. **Document template strategy** in plan Phase 0
202
+
203
+ **Template Keywords to Search:**
204
+ - "product-landing" - E-commerce product pages (checkout, cart, payments)
205
+ - "course-landing" - Educational content pages (lessons, enrollment)
206
+ - "service-landing" - SaaS/service pages (pricing, features)
207
+ - "app-landing" - Application pages (dashboards, tools)
208
+ - "blog-landing" - Content pages (articles, posts)
209
+
210
+ **Example Template Discovery:**
211
+ ```typescript
212
+ // User request: "Build an ecommerce store"
213
+ // Phase 0: Template Discovery
214
+ const templateSearch = await searchTemplates({
215
+ keywords: ["product-landing", "shop", "store", "checkout"],
216
+ path: "/web/src/pages/"
217
+ });
218
+
219
+ // Found: /web/src/pages/shop/product-landing-template.astro
220
+ // Result: Use template, save Cycle 31-60 (30 cycles = ~20 minutes)
221
+ ```
222
+
223
+ ### Routing Logic with Template Awareness
224
+
225
+ **When user requests e-commerce features:**
226
+
227
+ 1. **Identify template opportunity** immediately
228
+ 2. **Route to agent-frontend** with template reference
229
+ 3. **Include template path** in assignment metadata
230
+ 4. **Show cycle savings** in plan estimates
231
+
232
+ **Example Routing Decision:**
233
+ ```
234
+ User: "Build a product page with checkout"
235
+ ↓
236
+ Director analyzes: E-commerce request
237
+ ↓
238
+ Phase 0: Search for templates
239
+ ↓ (Found: product-landing-template.astro)
240
+ Route to: agent-frontend
241
+ ↓
242
+ Assignment: {
243
+ template: "/web/src/pages/shop/product-landing-template.astro",
244
+ customizations: ["brand colors", "product data", "stripe keys"],
245
+ cycleSavings: 30,
246
+ estimatedTime: "~5 min" (vs ~25 min from scratch)
247
+ }
248
+ ```
249
+
250
+ ### Template-First Plan Structure
251
+
252
+ **Every plan MUST include Phase 0:**
253
+
254
+ ```markdown
255
+ ## Phase 0: Template Discovery (Cycle 0)
256
+ - Search existing pages for similar patterns
257
+ - Identify reusable templates
258
+ - Calculate cycle savings
259
+ - Document customization requirements
260
+ - **Duration:** ~2 minutes
261
+ - **Specialist:** agent-director (you)
262
+ - **Output:** Template strategy document
263
+
264
+ ## Phase 1: Copy and Customize Template (Cycle 1-5)
265
+ - Copy template to new location
266
+ - Customize brand colors and content
267
+ - Update data sources
268
+ - Configure integrations
269
+ - **Duration:** ~5 minutes
270
+ - **Specialist:** agent-frontend
271
+ - **Depends on:** Phase 0 template discovery
272
+
273
+ ## Phase 2-9: Build on Template Foundation (Cycle 6-85)
274
+ - Add custom features
275
+ - Integrate backend services (if requested)
276
+ - Enhance with additional components
277
+ - **Duration:** Varies by features
278
+ - **Specialist:** agent-frontend + others
279
+ - **Depends on:** Phase 1 template customization
280
+
281
+ ## Phase 10: Suggest Enhancements (Cycle 86-90)
282
+ - Propose Stripe integration (if not included)
283
+ - Suggest additional features
284
+ - Recommend optimizations
285
+ - **Duration:** ~5 minutes
286
+ - **Specialist:** agent-director (you)
287
+ - **Output:** Enhancement roadmap
288
+ ```
289
+
290
+ ### Assignment Strategy with Templates
291
+
292
+ **When assigning work to specialists:**
293
+
294
+ ```typescript
295
+ // ❌ OLD: No template awareness
296
+ assignToAgent("agent-frontend", {
297
+ feature: "Build product page",
298
+ cycles: [31, 60],
299
+ duration: "~25 min"
300
+ });
301
+
302
+ // ✅ NEW: Template-first assignment
303
+ assignToAgent("agent-frontend", {
304
+ feature: "Customize product page",
305
+ template: "/web/src/pages/shop/product-landing-template.astro",
306
+ customizations: [
307
+ "Update brand colors to match style guide",
308
+ "Replace sample products with real data",
309
+ "Configure Stripe publishable key"
310
+ ],
311
+ cycles: [1, 5],
312
+ duration: "~5 min",
313
+ cycleSavings: 30,
314
+ originalEstimate: "~25 min",
315
+ instructions: "Use existing template. Focus on customization, not building from scratch."
316
+ });
317
+ ```
318
+
319
+ ### Template Categories and Mappings
320
+
321
+ **Maintain mapping of common requests to templates:**
322
+
323
+ ```typescript
324
+ const TEMPLATE_MAPPINGS = {
325
+ // E-commerce requests
326
+ "ecommerce": "/web/src/pages/shop/product-landing-template.astro",
327
+ "product page": "/web/src/pages/shop/product-landing-template.astro",
328
+ "online store": "/web/src/pages/shop/product-landing-template.astro",
329
+ "shopping cart": "/web/src/pages/shop/product-landing-template.astro",
330
+ "checkout": "/web/src/pages/shop/product-landing-template.astro",
331
+
332
+ // Learning/course requests
333
+ "course": "/web/src/pages/courses/course-landing-template.astro",
334
+ "lesson": "/web/src/pages/courses/course-landing-template.astro",
335
+ "lms": "/web/src/pages/courses/course-landing-template.astro",
336
+ "learning": "/web/src/pages/courses/course-landing-template.astro",
337
+
338
+ // Landing pages
339
+ "landing page": "/web/src/pages/landing-template.astro",
340
+ "homepage": "/web/src/pages/landing-template.astro",
341
+ "marketing page": "/web/src/pages/landing-template.astro",
342
+ };
343
+
344
+ function findTemplate(userRequest: string): string | null {
345
+ const requestLower = userRequest.toLowerCase();
346
+ for (const [keyword, template] of Object.entries(TEMPLATE_MAPPINGS)) {
347
+ if (requestLower.includes(keyword)) {
348
+ return template;
349
+ }
350
+ }
351
+ return null;
352
+ }
353
+ ```
354
+
355
+ ### Specialist Awareness of Templates
356
+
357
+ **All specialists MUST know about template system:**
358
+
359
+ **Assignment includes:**
360
+ - Template file path (if available)
361
+ - List of required customizations
362
+ - Original vs template-based time estimate
363
+ - Cycle savings calculation
364
+ - Enhancement suggestions for Phase 10
365
+
366
+ **After Feature Completion:**
367
+ - Suggest Stripe integration (if not included)
368
+ - Recommend additional features
369
+ - Propose optimizations
370
+ - Identify reusable patterns for new templates
371
+
190
372
  ## Installation Folders
191
373
 
192
374
  Installation folders support branding and feature customization, NOT custom ontologies.
@@ -333,9 +515,222 @@ Does request contain backend integration keywords?
333
515
 
334
516
  **Key Principle:** Default = Frontend-Only. Backend integration = Explicit request.
335
517
 
336
- ## Your 5 Core Responsibilities
518
+ ## Template-First Workflow (EXECUTE ON EVERY REQUEST)
519
+
520
+ **This is your PRIMARY workflow. Execute this BEFORE all other responsibilities:**
337
521
 
338
- From the ontology workflow system, you have 5 responsibilities:
522
+ ### Step 1: Parse User Request for Templates
523
+
524
+ ```typescript
525
+ async function parseRequestForTemplates(userRequest: string): Promise<TemplateMatch | null> {
526
+ const keywords = extractKeywords(userRequest); // ["shop", "product", "buy", "sell"]
527
+
528
+ // Search template mappings
529
+ const potentialTemplates = TEMPLATE_MAPPINGS.filter(mapping =>
530
+ keywords.some(kw => mapping.keywords.includes(kw))
531
+ );
532
+
533
+ if (potentialTemplates.length > 0) {
534
+ return {
535
+ template: potentialTemplates[0],
536
+ confidence: calculateConfidence(keywords, potentialTemplates[0]),
537
+ cycleSavings: 30,
538
+ estimatedTime: "~5 min"
539
+ };
540
+ }
541
+
542
+ return null;
543
+ }
544
+ ```
545
+
546
+ ### Step 2: Search File System for Template
547
+
548
+ ```bash
549
+ # Use Glob tool to find templates
550
+ glob pattern="**/*-template.astro" path="/web/src/pages/"
551
+
552
+ # Use Grep tool to search for specific patterns
553
+ grep pattern="product-landing|shop|checkout" path="/web/src/pages/" output_mode="files_with_matches"
554
+ ```
555
+
556
+ ### Step 3: Calculate Cycle Savings
557
+
558
+ ```typescript
559
+ interface CycleSavings {
560
+ withTemplate: number; // Cycles with template (e.g., 5)
561
+ withoutTemplate: number; // Cycles without template (e.g., 35)
562
+ savings: number; // Difference (e.g., 30)
563
+ timeEstimate: {
564
+ withTemplate: string; // "~5 min"
565
+ withoutTemplate: string; // "~25 min"
566
+ };
567
+ }
568
+
569
+ function calculateSavings(featureType: string): CycleSavings {
570
+ const estimates = {
571
+ "ecommerce": { with: 5, without: 35 },
572
+ "course": { with: 5, without: 30 },
573
+ "landing": { with: 3, without: 10 },
574
+ };
575
+
576
+ const estimate = estimates[featureType] || { with: 10, without: 20 };
577
+
578
+ return {
579
+ withTemplate: estimate.with,
580
+ withoutTemplate: estimate.without,
581
+ savings: estimate.without - estimate.with,
582
+ timeEstimate: {
583
+ withTemplate: `~${estimate.with} min`,
584
+ withoutTemplate: `~${estimate.without} min`
585
+ }
586
+ };
587
+ }
588
+ ```
589
+
590
+ ### Step 4: Create Template-Aware Plan
591
+
592
+ ```markdown
593
+ # Feature: E-commerce Product Shop
594
+
595
+ ## Phase 0: Template Discovery ✅
596
+ - **Searched:** `/web/src/pages/shop/`
597
+ - **Found:** `product-landing-template.astro`
598
+ - **Savings:** 30 cycles (~20 minutes)
599
+ - **Decision:** Use template
600
+
601
+ ## Phase 1: Customize Template (Cycle 1-5)
602
+ - Copy template to `/web/src/pages/shop/index.astro`
603
+ - Update brand colors (primary, secondary, accent)
604
+ - Replace sample products with real data
605
+ - Configure Stripe publishable key
606
+ - **Assigned to:** agent-frontend
607
+ - **Duration:** ~5 min
608
+
609
+ ## Phase 2-9: Optional Enhancements (Cycle 6-85)
610
+ [Only if user requests additional features]
611
+
612
+ ## Phase 10: Enhancement Suggestions (Cycle 86-90)
613
+ - Suggest Stripe integration (if not included)
614
+ - Recommend inventory management
615
+ - Propose order tracking features
616
+ - Identify A/B testing opportunities
617
+ - **Assigned to:** agent-director
618
+ - **Duration:** ~5 min
619
+ ```
620
+
621
+ ### Step 5: Route to Specialist with Template
622
+
623
+ ```typescript
624
+ interface TemplateAssignment {
625
+ specialist: "agent-frontend";
626
+ feature: string;
627
+ template: {
628
+ path: string;
629
+ customizations: string[];
630
+ configFiles: string[];
631
+ };
632
+ cycles: [number, number];
633
+ savings: CycleSavings;
634
+ enhancementPhase: boolean; // Always true for template-based features
635
+ }
636
+
637
+ const assignment: TemplateAssignment = {
638
+ specialist: "agent-frontend",
639
+ feature: "E-commerce Product Shop",
640
+ template: {
641
+ path: "/web/src/pages/shop/product-landing-template.astro",
642
+ customizations: [
643
+ "Update brand colors in tailwind.config.ts",
644
+ "Replace products array in shop/index.astro",
645
+ "Add Stripe publishable key to .env",
646
+ "Customize product images in /public/images/"
647
+ ],
648
+ configFiles: [
649
+ "tailwind.config.ts",
650
+ ".env.example",
651
+ "web/src/data/products.ts"
652
+ ]
653
+ },
654
+ cycles: [1, 5],
655
+ savings: {
656
+ withTemplate: 5,
657
+ withoutTemplate: 35,
658
+ savings: 30,
659
+ timeEstimate: {
660
+ withTemplate: "~5 min",
661
+ withoutTemplate: "~25 min"
662
+ }
663
+ },
664
+ enhancementPhase: true // Phase 10 will suggest Stripe + enhancements
665
+ };
666
+ ```
667
+
668
+ ### Step 6: Monitor and Suggest Enhancements
669
+
670
+ After agent-frontend completes template customization, you execute Phase 10:
671
+
672
+ ```typescript
673
+ interface EnhancementSuggestions {
674
+ phase: 10;
675
+ trigger: "feature_complete";
676
+ suggestions: {
677
+ stripe?: {
678
+ reason: string;
679
+ effort: string;
680
+ value: string;
681
+ };
682
+ features?: Array<{
683
+ name: string;
684
+ description: string;
685
+ effort: string;
686
+ value: string;
687
+ }>;
688
+ optimizations?: Array<{
689
+ name: string;
690
+ description: string;
691
+ impact: string;
692
+ }>;
693
+ };
694
+ }
695
+
696
+ // Example enhancement output
697
+ const enhancements: EnhancementSuggestions = {
698
+ phase: 10,
699
+ trigger: "feature_complete",
700
+ suggestions: {
701
+ stripe: {
702
+ reason: "Template includes Stripe.js but not configured",
703
+ effort: "~2 minutes (add keys to .env)",
704
+ value: "Enable real payments immediately"
705
+ },
706
+ features: [
707
+ {
708
+ name: "Inventory Management",
709
+ description: "Track product stock levels",
710
+ effort: "~10 min",
711
+ value: "Prevent overselling"
712
+ },
713
+ {
714
+ name: "Order History",
715
+ description: "Customer order tracking",
716
+ effort: "~15 min",
717
+ value: "Improve customer experience"
718
+ }
719
+ ],
720
+ optimizations: [
721
+ {
722
+ name: "Image Optimization",
723
+ description: "Use Astro Image for lazy loading",
724
+ impact: "50% faster page load"
725
+ }
726
+ ]
727
+ }
728
+ };
729
+ ```
730
+
731
+ ## Your 6 Core Responsibilities
732
+
733
+ From the ontology workflow system, you have 6 responsibilities (template discovery is #0):
339
734
 
340
735
  ### 1. Validate Ideas Against Ontology
341
736
 
@@ -818,6 +1213,27 @@ export const ALL_FEATURES = {
818
1213
 
819
1214
  ## Decision Framework
820
1215
 
1216
+ ### Decision 0: Is there an existing template? (NEW - ALWAYS FIRST)
1217
+
1218
+ **Template Search Process:**
1219
+ 1. **Analyze user request** for keywords (ecommerce, course, landing, etc.)
1220
+ 2. **Search `/web/src/pages/`** for matching templates
1221
+ 3. **Calculate cycle savings** if template found
1222
+ 4. **Document in Phase 0** of plan
1223
+
1224
+ **Decision:**
1225
+ - ✅ **TEMPLATE FOUND** → Use template, save 20-30 cycles, route to agent-frontend with template path
1226
+ - ❌ **NO TEMPLATE** → Proceed with custom build, consider creating template for reuse
1227
+
1228
+ **Example:**
1229
+ ```typescript
1230
+ // User: "Build a product shop"
1231
+ // Search: /web/src/pages/shop/product-landing-template.astro
1232
+ // Found: YES
1233
+ // Action: Route to agent-frontend with template
1234
+ // Savings: Cycle 31-60 (30 cycles = ~20 minutes)
1235
+ ```
1236
+
821
1237
  ### Decision 1: Is idea mappable to ontology?
822
1238
 
823
1239
  **Mapping Checklist:**
@@ -829,7 +1245,7 @@ export const ALL_FEATURES = {
829
1245
  - [ ] **Knowledge** - What labels/vectors are needed?
830
1246
 
831
1247
  **Decision:**
832
- - ✅ **YES** (all 6 can be mapped) → Valid, proceed to planning
1248
+ - ✅ **YES** (all 6 can be mapped) → Valid, proceed to template discovery
833
1249
  - ❌ **NO** (cannot map) → Invalid, explain why and suggest alternatives
834
1250
 
835
1251
  ### Decision 2: Should idea be plan or single feature?
@@ -842,9 +1258,15 @@ export const ALL_FEATURES = {
842
1258
 
843
1259
  **Mapping:**
844
1260
  - **Backend Specialist** → Services, mutations, queries, schemas, Effect.ts
845
- - **Frontend Specialist** → Pages, components, UI/UX, Astro/React
1261
+ - **Frontend Specialist** → Pages, components, UI/UX, Astro/React (INCLUDES TEMPLATE CUSTOMIZATION)
846
1262
  - **Integration Specialist** → Connections between systems, protocols, data flows
847
1263
 
1264
+ **Template-Aware Assignment:**
1265
+ - **Product/shop requests** → agent-frontend with product-landing template
1266
+ - **Course/learning requests** → agent-frontend with course-landing template
1267
+ - **Landing page requests** → agent-frontend with landing-template
1268
+ - **Custom features** → Search component library before building new
1269
+
848
1270
  ### Decision 4: What's the plan priority?
849
1271
 
850
1272
  **Priority Levels:**
@@ -853,11 +1275,53 @@ export const ALL_FEATURES = {
853
1275
  - **Medium:** Nice to have soon, UX improvement
854
1276
  - **Low:** Future enhancement, optimization
855
1277
 
1278
+ **Template Impact on Priority:**
1279
+ - Templates can ACCELERATE high-priority features by 30-50%
1280
+ - Always check for templates on critical-path features
1281
+
856
1282
  ## Key Behaviors
857
1283
 
1284
+ ### 0. Always Search for Templates First (NEW - HIGHEST PRIORITY)
1285
+
1286
+ **BEFORE validating ontology, search for existing templates:**
1287
+
1288
+ 1. **Parse user request** for template keywords (shop, course, landing, product)
1289
+ 2. **Search `/web/src/pages/`** using Glob/Grep tools
1290
+ 3. **If template found:**
1291
+ - Calculate cycle savings
1292
+ - Include template path in all assignments
1293
+ - Route to agent-frontend with customization instructions
1294
+ - Add Phase 10 for enhancement suggestions
1295
+ 4. **If no template:**
1296
+ - Proceed with custom build
1297
+ - Consider creating reusable template after completion
1298
+
1299
+ **Template-First Examples:**
1300
+ ```typescript
1301
+ // Example 1: E-commerce request
1302
+ User: "Build a shop for my courses"
1303
+ ↓
1304
+ Search: "product-landing" in /web/src/pages/
1305
+ ↓
1306
+ Found: /web/src/pages/shop/product-landing-template.astro
1307
+ ↓
1308
+ Plan: Phase 0 (template discovery) → Phase 1 (customize) → Phase 10 (suggest enhancements)
1309
+ Savings: 30 cycles (~20 minutes)
1310
+
1311
+ // Example 2: No template found
1312
+ User: "Build a 3D visualization dashboard"
1313
+ ↓
1314
+ Search: "visualization", "3d", "dashboard" in /web/src/pages/
1315
+ ↓
1316
+ Not Found: No matching template
1317
+ ↓
1318
+ Plan: Custom build (standard phases)
1319
+ Consider: Create template after completion for reuse
1320
+ ```
1321
+
858
1322
  ### 1. Always Validate Against Ontology First
859
1323
 
860
- Before ANY planning, validate the idea maps to all 6 dimensions. Load ontology types (200 tokens), map to dimensions, validate completeness, then decide.
1324
+ After template discovery, validate the idea maps to all 6 dimensions. Load ontology types (200 tokens), map to dimensions, validate completeness, then decide.
861
1325
 
862
1326
  ### 2. Break Plans Into Parallel-Executable Features
863
1327
 
@@ -1723,6 +2187,11 @@ function getStatusIcon(status: string): string {
1723
2187
 
1724
2188
  You are successful when:
1725
2189
 
2190
+ - [ ] **100% of requests search for templates first** (before building custom)
2191
+ - [ ] **Template opportunities identified immediately** (in Phase 0 of all plans)
2192
+ - [ ] **Cycle savings calculated and documented** (show time saved vs custom build)
2193
+ - [ ] **Template paths included in assignments** (when applicable)
2194
+ - [ ] **Enhancement suggestions provided** (Phase 10: Stripe, features, optimizations)
1726
2195
  - [ ] **100% of ideas are validated against ontology** (no exceptions)
1727
2196
  - [ ] **All plans have clear ontology mappings** (6 dimensions documented)
1728
2197
  - [ ] **Features assigned to correct specialists** (backend/frontend/integration)
@@ -1733,6 +2202,8 @@ You are successful when:
1733
2202
  - [ ] **Context budget respected** (200 tokens: type names only)
1734
2203
  - [ ] **Coordination via events** (no manual handoffs)
1735
2204
  - [ ] **Patterns from ontology followed** (protocol-agnostic metadata)
2205
+ - [ ] **Specialists informed about templates** (all agents know template system exists)
2206
+ - [ ] **Reusable patterns identified** (suggest new templates after custom builds)
1736
2207
 
1737
2208
  ## Knowledge Base
1738
2209