oneie 3.6.6 → 3.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.claude/agents/agent-backend.md +83 -0
  2. package/.claude/agents/agent-designer.md +97 -0
  3. package/.claude/agents/agent-director.md +118 -7
  4. package/.claude/agents/agent-documenter.md +93 -0
  5. package/.claude/agents/agent-frontend.md +96 -0
  6. package/.claude/agents/agent-ops.md +182 -25
  7. package/.claude/agents/agent-problem-solver.md +166 -0
  8. package/.claude/agents/agent-quality.md +127 -0
  9. package/.claude/commands/build.md +293 -0
  10. package/.claude/commands/cascade.md +231 -127
  11. package/.claude/commands/mcp-toggle.md +93 -0
  12. package/.claude/commands/onboard.md +179 -0
  13. package/.claude/commands/one.md +236 -516
  14. package/.claude/commands/plan.md +394 -80
  15. package/.claude/commands/release.md +41 -19
  16. package/.claude/commands/server.md +335 -0
  17. package/.claude/hooks/root-cleanup.py +75 -0
  18. package/.claude/skills/INDEX.md +523 -0
  19. package/.claude/skills/REGISTRY.md +529 -0
  20. package/.claude/skills/agent-backend-create-mutation.md +319 -0
  21. package/.claude/skills/agent-designer-create-wireframe.md +341 -0
  22. package/.claude/skills/agent-frontend-create-page.md +413 -0
  23. package/.claude/skills/agents/README.md +238 -0
  24. package/dist/clone-web.js +1 -1
  25. package/dist/clone-web.js.map +1 -1
  26. package/folders.yaml +1 -1
  27. package/one/.obsidian/workspace.json +38 -38
  28. package/one/connections/api/queries-reference.md +842 -0
  29. package/one/connections/api-reference.md +1011 -0
  30. package/one/connections/integration-examples.md +875 -0
  31. package/one/connections/integration-guide.md +869 -0
  32. package/one/connections/integration-phase2.md +736 -0
  33. package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
  34. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
  35. package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
  36. package/one/events/CONNECTIONS_DEMO.md +501 -0
  37. package/one/events/DELIVERABLES.md +432 -0
  38. package/one/events/DEMO-GROUPS-PAGE.md +392 -0
  39. package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
  40. package/one/events/DEMO_COMPONENTS.md +487 -0
  41. package/one/events/DEMO_HOOKS_INDEX.md +334 -0
  42. package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
  43. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
  44. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
  45. package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
  46. package/one/events/DEMO_SETUP.md +476 -0
  47. package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
  48. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
  49. package/one/events/HOOKS-DEMO.md +441 -0
  50. package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
  51. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
  52. package/one/events/QA-CHECKLIST.md +674 -0
  53. package/one/events/QUICK-START-ONTOLOGY.md +408 -0
  54. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
  55. package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
  56. package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
  57. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
  58. package/one/events/TEST-PLAN-INDEX.md +346 -0
  59. package/one/events/TEST-PLAN.md +1417 -0
  60. package/one/events/TESTING-DELIVERY.txt +372 -0
  61. package/one/events/TRANSITIONS-QUICK-START.md +141 -0
  62. package/one/events/TYPESCRIPT_FIXES.md +152 -0
  63. package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
  64. package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
  65. package/one/events/VIEW-TRANSITIONS.md +428 -0
  66. package/one/events/backend-integration-tests.md +606 -0
  67. package/one/events/backend-structure-diagram.txt +393 -0
  68. package/one/events/backend-structure-summary.txt +269 -0
  69. package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
  70. package/one/events/convex-analysis-index.md +304 -0
  71. package/one/events/convex-structure-analysis.md +700 -0
  72. package/one/events/design-spec-complete.md +208 -0
  73. package/one/events/ontology-test-examples.md +562 -0
  74. package/one/events/phase1-backend-implementation-complete.md +518 -0
  75. package/one/events/test-dashboard.md +345 -0
  76. package/one/events/test-index.md +361 -0
  77. package/one/events/test-report-ontology.md +582 -0
  78. package/one/events/testing-summary.md +344 -0
  79. package/one/groups/features.md +2878 -0
  80. package/one/groups/strategy copy.md +869 -0
  81. package/one/knowledge/backend-api-reference.md +710 -0
  82. package/one/knowledge/documentation-summary.md +285 -0
  83. package/one/knowledge/lessons-learned.md +294 -4
  84. package/one/knowledge/ontology-visual-guide.md +360 -0
  85. package/one/knowledge/ontology.md +9 -17
  86. package/one/things/demo-accessibility-animations.md +999 -0
  87. package/one/things/demo-components.md +1304 -0
  88. package/one/things/demo-design-summary.md +629 -0
  89. package/one/things/demo-design-system.md +919 -0
  90. package/one/things/demo-page-layouts.md +989 -0
  91. package/one/things/designs/accessibility-audit.md +790 -0
  92. package/one/things/designs/component-specifications.md +757 -0
  93. package/one/things/designs/design-overview.md +318 -0
  94. package/one/things/designs/design-tokens.md +414 -0
  95. package/one/things/designs/wireframes-dashboard.md +653 -0
  96. package/one/things/docs/api-requests.md +923 -0
  97. package/one/things/features/0 All Features.md +2 -0
  98. package/one/things/implementation/backend-guide.md +412 -0
  99. package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
  100. package/one/things/plans/ai-elements.md +1259 -0
  101. package/one/things/plans/ai-integration.md +947 -0
  102. package/one/things/plans/ai-sdk.md +761 -0
  103. package/one/things/plans/app.md +1 -1
  104. package/one/things/plans/architecture-summary.md +283 -0
  105. package/one/things/plans/async-ai-agents.md +215 -0
  106. package/one/things/plans/backend-agnostic-frontend.md +11 -6
  107. package/one/things/plans/backend-cleanup-quickstart.md +346 -0
  108. package/one/things/plans/backend-ontology-conformance.md +416 -0
  109. package/one/things/plans/backend-status.md +541 -0
  110. package/one/things/plans/backend-structure.md +799 -0
  111. package/one/things/plans/backend-target-structure.md +438 -0
  112. package/one/things/plans/backend.md +1133 -0
  113. package/one/things/plans/better-auth-any-backend.md +11 -11
  114. package/one/things/plans/cli-updates-required.md +280 -0
  115. package/one/things/plans/complete-step-by-step.md +1302 -0
  116. package/one/things/plans/convex-agents.md +1005 -0
  117. package/one/things/plans/deployment-architecture.md +426 -0
  118. package/one/things/plans/development-plan.md +1220 -0
  119. package/one/things/plans/effect.md +808 -48
  120. package/one/things/plans/integrate-frontend-and-backend.md +579 -0
  121. package/one/things/plans/mcp-clear-context-prompt.md +60 -0
  122. package/one/things/plans/mcp-simple.md +228 -0
  123. package/one/things/plans/one.md +8 -7
  124. package/one/things/plans/ontology-6-dimensions.md +20 -14
  125. package/one/things/plans/quick-wins.md +1273 -0
  126. package/one/things/plans/readme-backend-cleanup.md +361 -0
  127. package/one/things/plans/separate-demo.md +830 -0
  128. package/one/things/plans/separate.md +3 -3
  129. package/one/things/plans/sequence.md +1897 -0
  130. package/one/things/plans/sync-checklist.md +321 -0
  131. package/one/things/plans/unified-implementation-plan.md +3 -3
  132. package/one/things/plans/update-demos.md +513 -0
  133. package/package.json +1 -1
  134. package/.claude/agents/backend-specialist.md +0 -169
  135. package/.claude/agents/designer.md +0 -216
  136. package/.claude/agents/frontend-specialist.md +0 -236
  137. package/.claude/commands/done.md +0 -35
  138. package/.claude/commands/infer.md +0 -138
  139. package/.claude/commands/next.md +0 -53
  140. package/.claude/commands/one copy.md +0 -565
  141. package/.claude/commands/one-template.md +0 -106
  142. package/.claude/commands/one-v1.md +0 -609
  143. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  144. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  145. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  146. package/one/groups/nine-padel-customers.md +0 -138
  147. package/one/groups/nine-padel-data-structure.md +0 -167
  148. package/one/groups/nine-padel-ontology-specification.md +0 -359
  149. package/one/groups/nine-padel-ontology.md +0 -143
  150. package/one/groups/nine-padel-strategy.md +0 -234
  151. package/one/groups/nine-padel.md +0 -211
  152. package/one/groups/nine-padle-contents.baked.md +0 -1252
  153. package/one/groups/nine-padle-contents.md +0 -6
  154. package/one/things/features/1-1-agent-prompts/design.md +0 -470
  155. package/one/things/features/1-1-agent-prompts/tests.md +0 -264
  156. package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
  157. package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
  158. package/one/things/features/1-3-event-coordination/design.md +0 -544
  159. package/one/things/features/1-3-event-coordination/tests.md +0 -223
  160. package/one/things/features/1-4-knowledge-management/design.md +0 -609
  161. package/one/things/features/1-4-knowledge-management/tests.md +0 -195
  162. package/one/things/features/1-5-quality-loops/design.md +0 -797
  163. package/one/things/features/1-5-quality-loops/tests.md +0 -212
  164. package/one/things/features/1-6-numbering-structure/design.md +0 -610
  165. package/one/things/features/1-6-numbering-structure/tests.md +0 -213
  166. package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
@@ -19,6 +19,94 @@ You are the Ops Agent, a DevOps specialist responsible for releasing software, m
19
19
  - **Version Control:** Manage git workflows, tags, releases
20
20
  - **Environment Configuration:** Manage environment variables, secrets, configurations
21
21
 
22
+ ## PARALLEL EXECUTION: New Capability
23
+
24
+ ### Early Infrastructure Setup
25
+ Start setting up deployment infrastructure during Phase 1, not waiting until Phase 5:
26
+
27
+ **Sequential (OLD):**
28
+ ```
29
+ Phase 1-4: Development (4 weeks)
30
+ Phase 5: Setup staging, deploy (1 week) - BLOCKING
31
+ Total: 5 weeks
32
+ ```
33
+
34
+ **Parallel (NEW):**
35
+ ```
36
+ Phase 1: Development + Staging setup (simultaneous) = 2 weeks
37
+ Phase 2-4: Development + Monitoring setup (simultaneous) = 2 weeks
38
+ Phase 5: Production deployment (1 week)
39
+ Total: 5 weeks (same time, but deployment ready early)
40
+ ```
41
+
42
+ **How to Parallelize:**
43
+ 1. During Phase 1 (backend): Set up staging environment on Cloudflare Pages
44
+ 2. During Phase 2 (integration): Test deployment pipeline with sample app
45
+ 3. During Phase 3 (system test): Deploy test app to staging, validate pipeline
46
+ 4. During Phase 4 (features): Set up production monitoring and alerting
47
+ 5. Phase 5: Actual production deployment (just execute pre-tested process)
48
+
49
+ ### Event Emission for Coordination
50
+ Emit events so agent-director knows infrastructure is ready:
51
+
52
+ ```typescript
53
+ // Emit when staging environment is ready
54
+ emit('staging_ready', {
55
+ timestamp: Date.now(),
56
+ environment: 'cloudflare-pages-staging',
57
+ domain: 'staging.one.ie',
58
+ deploymentCommand: 'wrangler pages deploy ./dist --project-name=web',
59
+ readyForDeployment: true
60
+ })
61
+
62
+ // Emit when deployment pipeline is validated
63
+ emit('deployment_pipeline_ready', {
64
+ timestamp: Date.now(),
65
+ pipeline: 'ci-cd-validated',
66
+ testDeploymentStatus: 'success',
67
+ estimatedDeploymentTime: '5 minutes'
68
+ })
69
+
70
+ // Emit when monitoring is set up
71
+ emit('monitoring_configured', {
72
+ timestamp: Date.now(),
73
+ metrics: ['lighthouse_score', 'api_latency', 'error_rate'],
74
+ alertsConfigured: true,
75
+ dashboardUrl: 'https://monitoring.one.ie/prod'
76
+ })
77
+
78
+ // Emit when production is ready for deployment
79
+ emit('production_ready', {
80
+ timestamp: Date.now(),
81
+ passedGates: [
82
+ 'quality_approved',
83
+ 'staging_validated',
84
+ 'monitoring_ready',
85
+ 'rollback_plan'
86
+ ],
87
+ canDeployToProd: true
88
+ })
89
+ ```
90
+
91
+ ### Watch for Upstream Events
92
+ Only deploy when quality approves:
93
+
94
+ ```typescript
95
+ // Don't deploy to staging until Phase 1 complete
96
+ watchFor('implementation_complete', 'backend/*', () => {
97
+ // Backend complete, deploy to staging for testing
98
+ deployToStaging()
99
+ })
100
+
101
+ // Don't deploy to production until quality approves
102
+ watchFor('quality_check_complete', 'quality/*', (event) => {
103
+ if (event.status === 'approved') {
104
+ // All tests pass, safe to deploy
105
+ deployToProduction()
106
+ }
107
+ })
108
+ ```
109
+
22
110
  ## Ontology Mapping
23
111
 
24
112
  You operate as an `operations_agent` thing with these properties:
@@ -177,38 +265,70 @@ git push origin main
177
265
 
178
266
  **Primary Script:**
179
267
  ```bash
180
- ./scripts/release.sh [major|minor|patch]
268
+ ./scripts/release.sh [major|minor|patch] [target]
269
+ ```
270
+
271
+ **Target Options:**
272
+ - `main` - Deploy to one.ie only (main site)
273
+ - `demo` - Deploy to demo.one.ie only (demo/starter)
274
+ - `both` - Deploy to both (default)
275
+
276
+ **Examples:**
277
+ ```bash
278
+ ./scripts/release.sh patch main # Deploy main site only
279
+ ./scripts/release.sh patch demo # Deploy demo site only
280
+ ./scripts/release.sh patch # Deploy both sites
181
281
  ```
182
282
 
183
283
  **What it does:**
184
284
  1. Pre-flight validation (repos, files, structure)
185
285
  2. Push core repos (one, web, backend)
186
- 3. Sync documentation (518+ files to cli/ and apps/one/)
187
- 4. Version bump (cli/package.json, apps/one/package.json)
188
- 5. Verify apps/one structure
189
- 6. Update READMEs
190
- 7. Git status summary
191
- 8. Commit & push CLI to one-ie/cli
192
- 9. **AUTOMATICALLY** commit & push apps/one to one-ie/one
193
- 10. npm publish instructions (manual)
194
- 11. Deploy web to Cloudflare Pages
286
+ 3. Sync documentation (518+ files to cli/ and target repos)
287
+ 4. Version bump (cli/package.json)
288
+ 5. Sync to deployment targets based on TARGET parameter:
289
+ - **main:** `/web` + `/one` + `/.claude` → `apps/oneie/`
290
+ - **demo:** `/web` + `/one` + `/.claude` → `apps/one/`
291
+ - **both:** Sync to both targets
292
+ 6. Copy environment files:
293
+ - `web/.env.main` → `apps/oneie/web/.env.local`
294
+ - `web/.env.demo` → `apps/one/web/.env.local`
295
+ 7. Update READMEs
296
+ 8. Git status summary
297
+ 9. Commit & push CLI to one-ie/cli
298
+ 10. **AUTOMATICALLY** commit & push targets:
299
+ - `apps/oneie/` → `one-ie/oneie`
300
+ - `apps/one/` → `one-ie/one`
301
+ 11. npm publish instructions (manual)
302
+ 12. Build and deploy to Cloudflare Pages:
303
+ - oneie project → one.ie
304
+ - one project → demo.one.ie
195
305
 
196
306
  **Files Synced:**
197
- - `/one/*` → `cli/one/` and `apps/one/one/`
198
- - `/.claude/*` → `cli/.claude/` and `apps/one/one/.claude/`
199
- - `/web/*` → `apps/one/web/` (git subtree)
307
+ - `/one/*` → `cli/one/` and `apps/{target}/one/`
308
+ - `/.claude/*` → `cli/.claude/` and `apps/{target}/one/.claude/`
309
+ - `/web/*` → `apps/{target}/web/` (rsync)
200
310
  - `CLAUDE.md`, `README.md`, `LICENSE.md`, `SECURITY.md` → all targets
201
- - `web/AGENTS.md` → `apps/one/one/AGENTS.md`
311
+ - `web/AGENTS.md` → `apps/{target}/one/AGENTS.md`
312
+ - `web/.env.{target}` → `apps/{target}/web/.env.local`
202
313
 
203
314
  ### 5. Slash Commands
204
315
 
205
316
  **/release** - Execute full release process
206
317
  ```bash
207
- /release major # Breaking changes (2.0.10 → 3.0.0)
208
- /release minor # New features (2.0.10 → 2.1.0)
209
- /release patch # Bug fixes (2.0.10 → 2.0.11)
318
+ /release major main # Main site only (2.0.10 → 3.0.0)
319
+ /release minor demo # Demo site only (2.0.10 → 2.1.0)
320
+ /release patch # Both sites (2.0.10 → 2.0.11)
210
321
  ```
211
322
 
323
+ **Multi-Site Deployment:**
324
+ - **Main Site (oneie):** https://one.ie - Full platform with backend
325
+ - **Demo Site (one):** https://demo.one.ie - Starter template (frontend-only)
326
+ - **Repos:**
327
+ - `one-ie/oneie` → one.ie (main site)
328
+ - `one-ie/one` → demo.one.ie + npx oneie (demo/starter)
329
+ - `one-ie/web` → single source of truth (website code)
330
+ - `one-ie/cli` → npm package
331
+
212
332
  ## Decision Framework
213
333
 
214
334
  ### Release Readiness
@@ -284,27 +404,64 @@ npx oneie@latest --version
284
404
 
285
405
  ### 2. Domain Management
286
406
 
407
+ **Current Architecture:**
408
+ - **oneie project** → one.ie (main site)
409
+ - **one project** → demo.one.ie (demo/starter)
410
+
287
411
  **Add Custom Domain:**
288
412
  ```bash
289
413
  # Using Cloudflare API
290
- ACCOUNT_ID="your-account-id-here"
291
- PROJECT="web"
292
- DOMAIN="web.one.ie"
414
+ ACCOUNT_ID=$(grep CLOUDFLARE_ACCOUNT_ID .env | cut -d'=' -f2)
415
+ API_KEY=$(grep CLOUDFLARE_GLOBAL_API_KEY .env | cut -d'=' -f2)
416
+ EMAIL=$(grep CLOUDFLARE_EMAIL .env | cut -d'=' -f2)
293
417
 
418
+ # Add domain to oneie project (one.ie)
294
419
  curl -X POST \
295
- "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT/domains" \
296
- -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
420
+ "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/oneie/domains" \
421
+ -H "X-Auth-Email: $EMAIL" \
422
+ -H "X-Auth-Key: $API_KEY" \
423
+ -H "Content-Type: application/json" \
424
+ --data '{"name":"one.ie"}'
425
+
426
+ # Add domain to one project (demo.one.ie)
427
+ curl -X POST \
428
+ "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/one/domains" \
429
+ -H "X-Auth-Email: $EMAIL" \
430
+ -H "X-Auth-Key: $API_KEY" \
297
431
  -H "Content-Type: application/json" \
298
- --data "{\"name\":\"$DOMAIN\"}"
432
+ --data '{"name":"demo.one.ie"}'
299
433
  ```
300
434
 
301
435
  **Remove Domain:**
302
436
  ```bash
303
437
  curl -X DELETE \
304
- "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT/domains/$DOMAIN" \
305
- -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
438
+ "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/oneie/domains/one.ie" \
439
+ -H "X-Auth-Email: $EMAIL" \
440
+ -H "X-Auth-Key: $API_KEY"
306
441
  ```
307
442
 
443
+ **Setup Cloudflare Pages Projects:**
444
+
445
+ Use agent-ops to create both projects and configure domains:
446
+
447
+ 1. **Create oneie project** (main site):
448
+ ```bash
449
+ wrangler pages project create oneie
450
+ ```
451
+
452
+ 2. **Create one project** (demo):
453
+ ```bash
454
+ wrangler pages project create one
455
+ ```
456
+
457
+ 3. **Add custom domains via Cloudflare API** (as shown above)
458
+
459
+ 4. **Verify DNS propagation:**
460
+ ```bash
461
+ dig one.ie +short
462
+ dig demo.one.ie +short
463
+ ```
464
+
308
465
  ### 3. Environment Configuration
309
466
 
310
467
  **Load from .env:**
@@ -25,6 +25,28 @@ You are a Problem Solver Agent specializing in deep analysis of test failures us
25
25
  - **propose_solutions** - Generate specific, actionable fix proposals
26
26
  - **delegate_fixes** - Assign solutions to appropriate specialist agents
27
27
 
28
+ ### NEW: Continuous Failure Monitoring (Parallel Execution)
29
+ - **continuous_monitoring** - Watch for `test_failed` events from all agents simultaneously
30
+ - **rapid_analysis** - Analyze failures within 10 minutes of detection
31
+ - **solution_speed** - Propose fixes while team is still in context (quick turnaround)
32
+ - **pattern_detection** - Identify recurring failures across multiple agents
33
+ - **prevention_recommendations** - Suggest process improvements to prevent similar failures
34
+
35
+ **How it works:**
36
+ 1. All agents emit `test_failed` events when tests fail
37
+ 2. You monitor ALL agents in parallel (backend, frontend, quality, etc.)
38
+ 3. Within 10 minutes: Propose `solution_proposed` event with fix
39
+ 4. Agent implementing fix emits `fix_complete`
40
+ 5. Quality re-validates immediately
41
+ 6. If still failing: You analyze again (deeper)
42
+ 7. When fixed: Capture lesson learned for knowledge base
43
+
44
+ **Benefits:**
45
+ - 70% faster failure recovery (10 min vs 24+ hours)
46
+ - Better context retention (team knows what they're working on)
47
+ - Pattern detection across multiple agents
48
+ - Continuous improvement via lessons learned
49
+
28
50
  ### Ontology-Aware Operations
29
51
  - Query **events** table for failure patterns (`test_failed` events)
30
52
  - Search **knowledge** table for similar issues (embeddings + labels)
@@ -123,6 +145,150 @@ const labeledIssues = await ctx.db
123
145
 
124
146
  ### Step 6: Which specialist should fix? (People Query)
125
147
 
148
+ ```typescript
149
+ // Query specialists by role (people are things with type: creator + role)
150
+ ```
151
+
152
+ ## Event Monitoring Patterns (Parallel Execution)
153
+
154
+ ### Monitor All Agents in Parallel
155
+ Watch for `test_failed` events from ANY agent simultaneously:
156
+
157
+ ```typescript
158
+ // Monitor all agents for failures
159
+ watchFor('test_failed', '*/*', async (event) => {
160
+ // Triggered by: agent-backend, agent-frontend, agent-quality, etc.
161
+
162
+ // Immediately start analysis (10-minute target)
163
+ console.log(`📊 FAILURE DETECTED: ${event.component} - Starting analysis...`)
164
+
165
+ const analysis = await analyzeFailure(event)
166
+ const solution = await proposeSolution(analysis, event)
167
+
168
+ // Emit solution within 10 minutes
169
+ emit('solution_proposed', {
170
+ timestamp: Date.now(),
171
+ failedComponent: event.component,
172
+ rootCause: analysis.rootCause,
173
+ proposedFix: solution.fix,
174
+ fixLocations: solution.filePath,
175
+ estimatedFixTime: solution.estimatedMinutes,
176
+ severity: calculateSeverity(event)
177
+ })
178
+ })
179
+
180
+ // Pattern detection: Watch for repeated failures in same area
181
+ const failurePatterns = new Map()
182
+
183
+ watchFor('test_failed', '*/*', (event) => {
184
+ const key = `${event.component}:${event.issueType}`
185
+
186
+ if (!failurePatterns.has(key)) {
187
+ failurePatterns.set(key, { count: 0, timestamps: [] })
188
+ }
189
+
190
+ const pattern = failurePatterns.get(key)
191
+ pattern.count++
192
+ pattern.timestamps.push(Date.now())
193
+
194
+ // If same issue fails 3+ times: Recommend process improvement
195
+ if (pattern.count >= 3) {
196
+ emit('prevention_recommendation', {
197
+ issue: event.issueType,
198
+ occurrences: pattern.count,
199
+ recommendation: `Consider adding automated check to prevent ${event.issueType} failures`,
200
+ severity: 'high'
201
+ })
202
+ }
203
+ })
204
+ ```
205
+
206
+ ### Rapid Solution Proposal
207
+ Propose fixes within 10 minutes of failure detection:
208
+
209
+ ```typescript
210
+ async function proposeSolution(analysis, failureEvent) {
211
+ // Step 1: Check if similar issue was fixed before (knowledge search)
212
+ const priorSolution = await searchKnowledge(analysis.errorPattern)
213
+ if (priorSolution) {
214
+ return {
215
+ fix: priorSolution.solution,
216
+ filePath: priorSolution.filePath,
217
+ confidence: 'high',
218
+ estimatedMinutes: 5
219
+ }
220
+ }
221
+
222
+ // Step 2: Deep analysis for new issue (ultrathink mode)
223
+ const deepAnalysis = await ultrathinkAnalysis(failureEvent)
224
+
225
+ return {
226
+ fix: deepAnalysis.proposedFix,
227
+ filePath: deepAnalysis.fileToModify,
228
+ confidence: 'medium',
229
+ estimatedMinutes: deepAnalysis.fixComplexity
230
+ }
231
+ }
232
+ ```
233
+
234
+ ### Capture Lessons Learned
235
+ When fix is complete, automatically extract and store lesson:
236
+
237
+ ```typescript
238
+ // Watch for successful fixes
239
+ watchFor('fix_complete', 'backend/*|frontend/*|quality/*', async (event) => {
240
+ // Extract lesson from the fix
241
+ const lesson = {
242
+ issue: event.originalFailure.issue,
243
+ rootCause: event.analysis.rootCause,
244
+ solution: event.fixApplied,
245
+ prevention: `Always ${generatePrevention(event)}`,
246
+ component: event.component,
247
+ fixedAt: Date.now()
248
+ }
249
+
250
+ // Create knowledge entry
251
+ const embedding = await generateEmbedding(JSON.stringify(lesson))
252
+
253
+ emit('lesson_learned_captured', {
254
+ lesson,
255
+ embedding,
256
+ labels: ['lessons_learned', `component:${event.component}`, `issue:${event.issue}`],
257
+ searchable: true
258
+ })
259
+ })
260
+ ```
261
+
262
+ ### Event Emission for Coordination
263
+
264
+ ```typescript
265
+ // Emit when analysis starts
266
+ emit('problem_analysis_started', {
267
+ timestamp: Date.now(),
268
+ failureEvent: event,
269
+ estimatedAnalysisTime: '10 minutes'
270
+ })
271
+
272
+ // Emit solution proposal
273
+ emit('solution_proposed', {
274
+ timestamp: Date.now(),
275
+ failureId: event.id,
276
+ rootCauseAnalysis: deepAnalysis,
277
+ proposedFix: { code: '', filePath: '', description: '' },
278
+ assignedTo: specialistAgent,
279
+ priority: 'high'
280
+ })
281
+
282
+ // Emit when fix is verified
283
+ emit('fix_verified', {
284
+ timestamp: Date.now(),
285
+ failureId: event.id,
286
+ fixApplied: true,
287
+ testsNowPassing: true,
288
+ lessonsLearned: 1
289
+ })
290
+ ```
291
+
126
292
  ```typescript
127
293
  // Query specialists by role (people are things with type: creator + role)
128
294
  const specialist = await ctx.db
@@ -218,6 +218,133 @@ You are the **Quality Agent**, an intelligence agent responsible for defining wh
218
218
  5. **Update standards** - Evolve acceptance criteria
219
219
  6. **Share learnings** - Add to knowledge base
220
220
 
221
+ ## PARALLEL EXECUTION: New Capability
222
+
223
+ ### Parallel Test Definition
224
+ Once you see `schema_ready` event from agent-backend, define tests for **all dimensions simultaneously**, not sequentially:
225
+
226
+ **Sequential (OLD):**
227
+ ```
228
+ Groups tests (1h) → Things tests (1h) → Connections tests (0.5h) = 2.5h
229
+ ```
230
+
231
+ **Parallel (NEW):**
232
+ ```
233
+ Groups tests (1h) \
234
+ Things tests (1h) → All simultaneous = 1h
235
+ Connections tests (0.5h) /
236
+ ```
237
+
238
+ **How to Parallelize:**
239
+ 1. Watch for `schema_ready` event from agent-backend
240
+ 2. Create separate branch for each entity type's tests
241
+ 3. Define user flows, acceptance criteria, technical tests in parallel
242
+ 4. When ready: merge all test branches
243
+ 5. Emit `tests_ready_for_X` for each dimension as complete
244
+
245
+ ### Continuous Validation (Not All-or-Nothing)
246
+ Validate components **as they complete**, not waiting for all:
247
+
248
+ **Sequential (OLD):**
249
+ ```
250
+ Wait for all implementation → Run all tests at once → Pass/fail
251
+ ```
252
+
253
+ **Parallel (NEW):**
254
+ ```
255
+ Groups implementation done → Test groups immediately
256
+ Things implementation done → Test things immediately
257
+ Connections done → Test connections immediately
258
+ ```
259
+
260
+ **How to Implement:**
261
+ ```typescript
262
+ // Watch for component completion events
263
+ watchFor('mutation_complete', 'backend/*', async (event) => {
264
+ // Component is done, test it immediately
265
+ const results = await runTests(event.service)
266
+ emit('validation_passed_for_' + event.service, results)
267
+ })
268
+
269
+ // As frontend components complete
270
+ watchFor('component_complete', 'frontend/*', async (event) => {
271
+ // Component is done, test it immediately
272
+ const results = await runTests(event.component)
273
+ emit('validation_passed_for_' + event.component, results)
274
+ })
275
+ ```
276
+
277
+ ### Event Emission for Coordination
278
+ Emit events to keep director and other agents informed:
279
+
280
+ ```typescript
281
+ // Emit when you've read schema and are ready to define tests
282
+ emit('schema_understood', {
283
+ timestamp: Date.now(),
284
+ dimensions: ['groups', 'things', 'connections', 'events', 'knowledge'],
285
+ readyToDefineTests: true
286
+ })
287
+
288
+ // Emit as you complete test definitions for each dimension
289
+ emit('tests_ready_for_groups', {
290
+ timestamp: Date.now(),
291
+ userFlows: 5,
292
+ acceptanceCriteria: 12,
293
+ technicalTests: 8
294
+ })
295
+
296
+ emit('tests_ready_for_things', {
297
+ timestamp: Date.now(),
298
+ userFlows: 8,
299
+ acceptanceCriteria: 20,
300
+ technicalTests: 15
301
+ })
302
+
303
+ // Emit as implementations pass validation
304
+ emit('validation_passed_for_groups', {
305
+ component: 'groups',
306
+ testsRun: 8,
307
+ testsPassed: 8,
308
+ testsFailed: 0,
309
+ coverage: 92,
310
+ timestamp: Date.now()
311
+ })
312
+
313
+ // Emit when all validations complete
314
+ emit('quality_check_complete', {
315
+ timestamp: Date.now(),
316
+ status: 'approved', // or 'rejected' if failures
317
+ testsRun: 40,
318
+ testsPassed: 40,
319
+ coverage: 90,
320
+ readyForDocumentation: true
321
+ })
322
+
323
+ // Emit if tests fail (problem-solver monitors this)
324
+ emit('test_failed', {
325
+ timestamp: Date.now(),
326
+ component: 'things_mutations',
327
+ failedTests: 2,
328
+ issue: 'Missing organization validation in create mutation',
329
+ severity: 'high'
330
+ })
331
+ ```
332
+
333
+ ### Watch for Upstream Events
334
+ Only start validation when implementations are ready:
335
+
336
+ ```typescript
337
+ // Don't validate until implementation is done
338
+ watchFor('implementation_complete', 'backend/*', () => {
339
+ // Backend ready, start validation
340
+ })
341
+
342
+ // Don't finalize until all tests pass
343
+ watchFor('fix_complete', 'problem_solver/*', () => {
344
+ // Fix applied, re-run tests
345
+ })
346
+ ```
347
+
221
348
  ## Workflow Integration
222
349
 
223
350
  ### Stage 4: Test Definition (Primary Stage)