oneie 3.4.2 → 3.6.0

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 (143) hide show
  1. package/.claude/agents/agent-director.md +902 -22
  2. package/.claude/agents/agent-onboard-example-output.md +600 -0
  3. package/.claude/agents/agent-onboard.md +576 -0
  4. package/.claude/commands/ONBOARDING_ENHANCEMENT_SUMMARY.md +266 -0
  5. package/.claude/commands/one.md +411 -10
  6. package/.claude/commands/release.md +64 -3
  7. package/CLAUDE.md +55 -69
  8. package/dist/commands/init.d.ts +5 -6
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +101 -101
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/index.js +6 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/utils/installation-setup.d.ts +24 -1
  15. package/dist/utils/installation-setup.d.ts.map +1 -1
  16. package/dist/utils/installation-setup.js +85 -1
  17. package/dist/utils/installation-setup.js.map +1 -1
  18. package/dist/utils/launch-claude.d.ts +6 -0
  19. package/dist/utils/launch-claude.d.ts.map +1 -0
  20. package/dist/utils/launch-claude.js +51 -0
  21. package/dist/utils/launch-claude.js.map +1 -0
  22. package/dist/utils/validation.d.ts +48 -0
  23. package/dist/utils/validation.d.ts.map +1 -0
  24. package/dist/utils/validation.js +73 -0
  25. package/dist/utils/validation.js.map +1 -0
  26. package/folders.yaml +1 -1
  27. package/one/.obsidian/app.json +8 -0
  28. package/one/.obsidian/appearance.json +1 -0
  29. package/one/.obsidian/community-plugins.json +3 -0
  30. package/one/.obsidian/core-plugins.json +33 -0
  31. package/one/.obsidian/plugins/easy-bake/main.js +361 -0
  32. package/one/.obsidian/plugins/easy-bake/manifest.json +11 -0
  33. package/one/.obsidian/plugins/easy-bake/styles.css +10 -0
  34. package/one/.obsidian/workspace.json +240 -0
  35. package/one/connections/workflow-onboarding.md +683 -0
  36. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +354 -0
  37. package/one/events/CRITICAL-FIXES-COMPLETE.md +504 -0
  38. package/one/events/DEPLOYMENT.md +178 -0
  39. package/one/events/ECOMMERCE-DEMO-PLAN.md +225 -0
  40. package/one/events/ECOMMERCE-LIVE-DEMO.md +363 -0
  41. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +735 -0
  42. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +923 -0
  43. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +223 -0
  44. package/one/events/HANDOFF.md +313 -0
  45. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +503 -0
  46. package/one/events/IMPLEMENTATION_SUMMARY.md +529 -0
  47. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +666 -0
  48. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +642 -0
  49. package/one/events/LANDING-PAGE-QUICKSTART.md +407 -0
  50. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +1627 -0
  51. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +573 -0
  52. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +398 -0
  53. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +525 -0
  54. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +455 -0
  55. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +486 -0
  56. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +203 -0
  57. package/one/events/SECURITY-AUDIT-FIXES.md +376 -0
  58. package/one/events/SECURITY-SCAN-COMPLETE.md +281 -0
  59. package/one/events/SHOP-BUILD-STATUS.md +114 -0
  60. package/one/events/SHOP-PREMIUM-UPDATE.md +149 -0
  61. package/one/events/SITE-WIDE-GRADIENT-FIX.md +299 -0
  62. package/one/events/STORE-PRODUCTION-READY-STATUS.md +359 -0
  63. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +429 -0
  64. package/one/events/agent-director-enhancement-summary.md +386 -0
  65. package/one/events/agent-onboard-implementation-summary.md +457 -0
  66. package/one/events/clean-agent-ontology-cleanup-report.md +353 -0
  67. package/one/events/landing-page-generator.md +458 -0
  68. package/one/events/onboarding-implementation-complete.md +505 -0
  69. package/one/events/release.md +254 -0
  70. package/one/events/separate-implementation-status.md +537 -0
  71. package/one/groups/nine-padle-contents.baked.md +1252 -0
  72. package/one/groups/nine-padle-contents.md +6 -0
  73. package/one/knowledge/100-inference-quick-reference.md +431 -0
  74. package/one/knowledge/agent-onboard-usage.md +612 -0
  75. package/one/knowledge/cli-claude-handoff.md +718 -0
  76. package/one/knowledge/installation-folders.md +45 -1
  77. package/one/knowledge/ontology-blog.yaml +31 -0
  78. package/one/knowledge/ontology-cheatsheet.md +591 -0
  79. package/one/knowledge/ontology-community.yaml +42 -0
  80. package/one/knowledge/ontology-core-universal.md +722 -0
  81. package/one/knowledge/ontology-core.yaml +50 -0
  82. package/one/knowledge/ontology-courses.yaml +53 -0
  83. package/one/knowledge/ontology-creator.md +376 -0
  84. package/one/knowledge/ontology-developer-guide.md +789 -0
  85. package/one/knowledge/ontology-education.md +920 -0
  86. package/one/knowledge/ontology-index.md +354 -0
  87. package/one/knowledge/ontology-migration-guide.md +811 -0
  88. package/one/knowledge/ontology-minimal.yaml +1 -1
  89. package/one/knowledge/ontology-portfolio.yaml +31 -0
  90. package/one/knowledge/ontology-quickstart.md +576 -0
  91. package/one/knowledge/ontology-shop.yaml +121 -0
  92. package/one/knowledge/ontology-tokens.yaml +32 -0
  93. package/one/knowledge/ontology-tutorial.md +434 -0
  94. package/one/knowledge/ontology-video-script.md +890 -0
  95. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +467 -0
  96. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +408 -0
  97. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +369 -0
  98. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +396 -0
  99. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +468 -0
  100. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +582 -0
  101. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +449 -0
  102. package/one/things/docs/ecommerce/QUICK-START.md +368 -0
  103. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +498 -0
  104. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +237 -0
  105. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +171 -0
  106. package/one/things/docs/ecommerce/demo.astro +309 -0
  107. package/one/things/plans/agent-director-100-inference-plans.md +410 -0
  108. package/one/things/plans/dual-website-strategy.md +612 -0
  109. package/one/things/plans/feature-based-sites.md +821 -0
  110. package/one/things/plans/multi-ontology-architecture.md +836 -0
  111. package/one/things/plans/onboarding.md +32 -0
  112. package/one/things/plans/separate.md +15 -17
  113. package/one/things/plans/start-new.md +738 -0
  114. package/one/things/templates.md +254 -0
  115. package/one/things/todo.md +23 -5
  116. package/package.json +2 -2
  117. package/one/things/claude/hooks/agent-hook-manager.js +0 -525
  118. package/one/things/claude/hooks/agent-load-balancer.js +0 -271
  119. package/one/things/claude/hooks/agent-request-interceptor.js +0 -70
  120. package/one/things/claude/hooks/cascade-feedback.js +0 -297
  121. package/one/things/claude/hooks/cascade-integration-hooks.js +0 -648
  122. package/one/things/claude/hooks/continuous-improvement-monitor.js +0 -510
  123. package/one/things/claude/hooks/file-organization-engine.js +0 -427
  124. package/one/things/claude/hooks/file-organization-monitor.js +0 -269
  125. package/one/things/claude/hooks/hook-config-manager.js +0 -202
  126. package/one/things/claude/hooks/hook-orchestrator.js +0 -662
  127. package/one/things/claude/hooks/hook-performance-report.js +0 -120
  128. package/one/things/claude/hooks/mcp-cascade-integration.js +0 -816
  129. package/one/things/claude/hooks/memory-optimizer.js +0 -510
  130. package/one/things/claude/hooks/ontology-compliance.js +0 -394
  131. package/one/things/claude/hooks/ontology-hook-manager.js +0 -316
  132. package/one/things/claude/hooks/ontology-validation-engine.js +0 -317
  133. package/one/things/claude/hooks/performance-monitoring-hook.js +0 -422
  134. package/one/things/claude/hooks/quality-scoring-engine.js +0 -834
  135. package/one/things/claude/hooks/simple-load-balancer.js +0 -238
  136. package/one/things/claude/hooks/startup-optimizer.js +0 -625
  137. package/one/things/claude/hooks/story-scoring-system.js +0 -445
  138. package/one/things/claude/hooks/story-validation-engine.js +0 -473
  139. package/one/things/claude/hooks/structure-synchronizer.js +0 -194
  140. package/one/things/claude/hooks/sub-agent-output-validator.js +0 -647
  141. package/one/things/claude/hooks/sub-agent-validation-hook.js +0 -343
  142. package/one/things/claude/hooks/trinity-validation-system.js +0 -392
  143. package/one/things/plans/organizations-to-groups.md +0 -705
@@ -1,705 +0,0 @@
1
- # Organizations → Groups: Parallel Migration Plan
2
-
3
- **Status:** Planning
4
- **Version:** 2.0.0
5
- **Complexity:** High (Breaking change to Dimension 1)
6
- **Execution:** Parallel tracks after schema update
7
-
8
- ---
9
-
10
- ## Core Concept: Organizations ARE Groups
11
-
12
- **Key Insight:** "Organizations" don't disappear—they become a **type** of group.
13
-
14
- ```typescript
15
- // Organizations as Groups
16
- {
17
- slug: "acme-corp",
18
- name: "Acme Corporation",
19
- type: "organization", // ← Organizations are just a group type!
20
- settings: {
21
- plan: "enterprise",
22
- limits: { users: 100, storage: 1000, apiCalls: 1000000 }
23
- }
24
- }
25
- ```
26
-
27
- **The Evolution:**
28
-
29
- | Dimension | Old Name | New Name | Change |
30
- |-----------|----------|----------|--------|
31
- | 1 | Organizations | Groups | Generalized + hierarchical |
32
- | 2 | People | People | No change |
33
- | 3 | Things | Things | No change |
34
- | 4 | Connections | Connections | No change |
35
- | 5 | Events | Events | No change |
36
- | 6 | Knowledge | Knowledge | No change |
37
-
38
- **Multi-tenancy preserved:** Every group (including "organization" type) maintains perfect data isolation.
39
-
40
- ---
41
-
42
- ## The 6 Group Types
43
-
44
- ```typescript
45
- type GroupType =
46
- | "friend_circle" // Emma's Friends
47
- | "business" // Acme Corp
48
- | "community" // Crypto Community
49
- | "dao" // CoolDAO
50
- | "government" // City Council
51
- | "organization"; // Legacy - maps to old "organizations"
52
- ```
53
-
54
- **All types share:**
55
- - Multi-tenant isolation (groupId scopes all data)
56
- - Hierarchical nesting (parentGroupId enables subgroups)
57
- - URL-based creation (one.ie/group/slug)
58
- - Role-based access (org_owner, org_user, customer)
59
-
60
- **Type-specific differences:**
61
- - Default visibility (friend_circle → private, dao → public)
62
- - Default join policy (business → invite_only, dao → open)
63
- - UI terminology (business → "company", dao → "DAO")
64
- - Discovery settings (public types appear in /explore)
65
-
66
- ---
67
-
68
- ## Parallel Execution Strategy
69
-
70
- ### Sequential Foundation (Must Complete First)
71
-
72
- **Track 0: Schema Update** (1 inference)
73
- ```typescript
74
- // backend/convex/schema.ts
75
- // BEFORE: organizations table
76
- // AFTER: groups table with slug, type, parentGroupId, settings
77
- ```
78
-
79
- **Dependencies:** None
80
- **Blocks:** Everything else
81
- **Duration:** 1 inference
82
-
83
- ---
84
-
85
- ### Parallel Track 1: Backend Mutations (Run in Parallel)
86
-
87
- **All mutations can be updated simultaneously** after schema is ready.
88
-
89
- ```typescript
90
- // Each file is independent - update in parallel!
91
-
92
- // File 1: mutations/entities.ts
93
- export const create = mutation({
94
- handler: async (ctx, args) => {
95
- - organizationId: args.organizationId,
96
- + groupId: args.groupId,
97
- }
98
- });
99
-
100
- // File 2: mutations/connections.ts
101
- export const create = mutation({
102
- handler: async (ctx, args) => {
103
- - organizationId: args.organizationId,
104
- + groupId: args.groupId,
105
- }
106
- });
107
-
108
- // File 3: mutations/events.ts
109
- // ... same pattern
110
-
111
- // File 4: mutations/knowledge.ts
112
- // ... same pattern
113
- ```
114
-
115
- **Files to update (parallel):**
116
- - `mutations/entities.ts` (Infer 11)
117
- - `mutations/connections.ts` (Infer 12)
118
- - `mutations/events.ts` (Infer 13)
119
- - `mutations/knowledge.ts` (Infer 14)
120
- - `mutations/groups.ts` (new file) (Infer 15)
121
-
122
- **Pattern:** Simple find/replace: `organizationId` → `groupId`
123
-
124
- **Dependencies:** Schema update (Track 0)
125
- **Duration:** 5 inferences (parallel) = 1 inference elapsed
126
-
127
- ---
128
-
129
- ### Parallel Track 2: Backend Queries (Run in Parallel)
130
-
131
- **All queries can be updated simultaneously** after schema is ready.
132
-
133
- ```typescript
134
- // Each query file is independent - update in parallel!
135
-
136
- // File 1: queries/entities.ts
137
- export const list = query({
138
- handler: async (ctx, args) => {
139
- return await ctx.db
140
- .query("entities")
141
- - .withIndex("by_org", (q) => q.eq("organizationId", args.organizationId))
142
- + .withIndex("by_group", (q) => q.eq("groupId", args.groupId))
143
- .collect();
144
- }
145
- });
146
-
147
- // File 2: queries/connections.ts
148
- // ... same pattern (parallel!)
149
-
150
- // File 3: queries/events.ts
151
- // ... same pattern (parallel!)
152
- ```
153
-
154
- **Files to update (parallel):**
155
- - `queries/entities.ts` (Infer 16)
156
- - `queries/connections.ts` (Infer 17)
157
- - `queries/events.ts` (Infer 18)
158
- - `queries/knowledge.ts` (Infer 19)
159
- - `queries/groups.ts` (new file with hierarchy queries) (Infer 20)
160
-
161
- **New hierarchical queries:**
162
- ```typescript
163
- // queries/groups.ts (NEW)
164
- export const getSubgroups = query({
165
- args: { parentGroupId: v.id("groups") },
166
- handler: async (ctx, args) => {
167
- return await ctx.db
168
- .query("groups")
169
- .withIndex("by_parent", (q) => q.eq("parentGroupId", args.parentGroupId))
170
- .collect();
171
- }
172
- });
173
-
174
- export const getGroupHierarchy = query({
175
- args: { rootGroupId: v.id("groups") },
176
- handler: async (ctx, args) => {
177
- // Recursive query to get all subgroups
178
- const allSubgroups = [];
179
- const queue = [args.rootGroupId];
180
-
181
- while (queue.length > 0) {
182
- const current = queue.shift();
183
- const subgroups = await ctx.db
184
- .query("groups")
185
- .withIndex("by_parent", (q) => q.eq("parentGroupId", current))
186
- .collect();
187
-
188
- allSubgroups.push(...subgroups);
189
- queue.push(...subgroups.map(g => g._id));
190
- }
191
-
192
- return allSubgroups;
193
- }
194
- });
195
- ```
196
-
197
- **Dependencies:** Schema update (Track 0)
198
- **Duration:** 5 inferences (parallel) = 1 inference elapsed
199
-
200
- ---
201
-
202
- ### Parallel Track 3: Frontend Components (Run in Parallel)
203
-
204
- **All components can be updated simultaneously** after backend is ready.
205
-
206
- ```typescript
207
- // Each component is independent - update in parallel!
208
-
209
- // Component 1: EntityList.tsx
210
- export function EntityList() {
211
- - const entities = useQuery(api.queries.entities.list, { organizationId });
212
- + const entities = useQuery(api.queries.entities.list, { groupId });
213
- }
214
-
215
- // Component 2: ConnectionGraph.tsx (parallel!)
216
- export function ConnectionGraph() {
217
- - const connections = useQuery(api.queries.connections.list, { organizationId });
218
- + const connections = useQuery(api.queries.connections.list, { groupId });
219
- }
220
-
221
- // Component 3: EventTimeline.tsx (parallel!)
222
- // ... same pattern
223
- ```
224
-
225
- **Files to update (parallel):**
226
- - `src/components/features/EntityList.tsx` (Infer 21)
227
- - `src/components/features/ConnectionGraph.tsx` (Infer 22)
228
- - `src/components/features/EventTimeline.tsx` (Infer 23)
229
- - `src/components/features/KnowledgeSearch.tsx` (Infer 24)
230
- - All other components using `organizationId` (Infer 25-30)
231
-
232
- **Dependencies:** Backend queries (Track 2)
233
- **Duration:** 10 inferences (parallel) = 1 inference elapsed
234
-
235
- ---
236
-
237
- ### Parallel Track 4: Frontend Routes & UI (Sequential within track)
238
-
239
- **New group-specific UI** (sequential within track, parallel with Track 5 & 6).
240
-
241
- ```typescript
242
- // 1. Add /group/:slug routing (Infer 31)
243
- // src/pages/group/[slug].astro
244
- ---
245
- import { ConvexHttpClient } from "convex/browser";
246
- import { api } from "@/convex/_generated/api";
247
-
248
- const { slug } = Astro.params;
249
- const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
250
-
251
- const group = await convex.query(api.queries.groups.getBySlug, { slug });
252
-
253
- if (!group) {
254
- return Astro.redirect(`/group/${slug}/create`);
255
- }
256
- ---
257
-
258
- <Layout>
259
- <GroupPage group={group} />
260
- </Layout>
261
-
262
- // 2. Create group creation flow (Infer 32)
263
- // src/pages/group/[slug]/create.astro
264
-
265
- // 3. Create group hierarchy navigation (Infer 33)
266
- // src/components/features/GroupHierarchy.tsx
267
-
268
- // 4. Create group type selector (Infer 34)
269
- // src/components/features/GroupTypeSelector.tsx
270
- ```
271
-
272
- **Dependencies:** Backend queries (Track 2)
273
- **Duration:** 4 inferences (sequential)
274
-
275
- ---
276
-
277
- ### Parallel Track 5: Documentation (Run in Parallel)
278
-
279
- **All documentation updates are independent** - can run fully in parallel!
280
-
281
- ```bash
282
- # Each doc file is independent - update in parallel!
283
-
284
- # File 1: CLAUDE.md (Infer 41)
285
- - 1. **Organizations** – Who owns what (multi-tenant isolation)
286
- + 1. **Groups** – Who owns what (multi-tenant isolation, hierarchical)
287
-
288
- # File 2: README.md (Infer 42)
289
- - const myStand = await createOrganization({ name: "Emma's Lemonade Stand" });
290
- + const myStand = await createGroup({ slug: "emmas-lemonade", name: "Emma's Lemonade Stand", type: "business" });
291
-
292
- # File 3: one/knowledge/ontology.md (Infer 43)
293
- # Version 2.0.0
294
- - ## Dimension 1: Organizations
295
- + ## Dimension 1: Groups (with 6 types)
296
-
297
- # Files 4-41: All other docs in one/ (Infer 44-81)
298
- # Simple find/replace: "organizations" → "groups"
299
- # Can be done completely in parallel!
300
- ```
301
-
302
- **Files to update (all parallel):**
303
- - `CLAUDE.md` (Infer 41)
304
- - `README.md` (Infer 42)
305
- - `one/knowledge/ontology.md` (Infer 43)
306
- - All 41 files in `one/` directory (Infer 44-84)
307
-
308
- **Pattern:** Global find/replace: `organizations` → `groups`, `organizationId` → `groupId`
309
-
310
- **Dependencies:** None (can start immediately!)
311
- **Duration:** 44 inferences (parallel) = 1 inference elapsed
312
-
313
- ---
314
-
315
- ### Parallel Track 6: Data Migration (Parallel with Track 5)
316
-
317
- **Migration script** (can develop in parallel with docs).
318
-
319
- ```typescript
320
- // migrations/orgsToGroups.ts (Infer 85)
321
-
322
- import { mutation } from "./_generated/server";
323
-
324
- function slugify(name: string): string {
325
- return name
326
- .toLowerCase()
327
- .replace(/[^a-z0-9]+/g, "-")
328
- .replace(/(^-|-$)/g, "");
329
- }
330
-
331
- export const migrateOrgsToGroups = mutation({
332
- handler: async (ctx) => {
333
- console.log("Starting migration: organizations → groups");
334
-
335
- // 1. Get all organizations
336
- const orgs = await ctx.db.query("organizations").collect();
337
- console.log(`Found ${orgs.length} organizations to migrate`);
338
-
339
- const mapping = new Map(); // orgId → groupId
340
-
341
- // 2. Create groups from organizations
342
- for (const org of orgs) {
343
- const groupId = await ctx.db.insert("groups", {
344
- slug: slugify(org.name),
345
- name: org.name,
346
- type: "organization", // Legacy type
347
- description: undefined,
348
- parentGroupId: undefined, // Top-level
349
- metadata: {},
350
- settings: {
351
- visibility: "private",
352
- joinPolicy: "invite_only",
353
- plan: org.plan,
354
- limits: org.limits
355
- },
356
- status: org.status === "active" ? "active" : "archived",
357
- createdAt: org.createdAt,
358
- updatedAt: org.updatedAt
359
- });
360
-
361
- mapping.set(org._id, groupId);
362
- console.log(`Migrated: ${org.name} → ${groupId}`);
363
- }
364
-
365
- // 3. Update entities
366
- const entities = await ctx.db.query("entities").collect();
367
- for (const entity of entities) {
368
- const groupId = mapping.get(entity.organizationId);
369
- if (groupId) {
370
- await ctx.db.patch(entity._id, {
371
- groupId,
372
- organizationId: undefined // Remove old field
373
- });
374
- }
375
- }
376
- console.log(`Updated ${entities.length} entities`);
377
-
378
- // 4. Update connections
379
- const connections = await ctx.db.query("connections").collect();
380
- for (const conn of connections) {
381
- const groupId = mapping.get(conn.organizationId);
382
- if (groupId) {
383
- await ctx.db.patch(conn._id, {
384
- groupId,
385
- organizationId: undefined
386
- });
387
- }
388
- }
389
- console.log(`Updated ${connections.length} connections`);
390
-
391
- // 5. Update events
392
- const events = await ctx.db.query("events").collect();
393
- for (const event of events) {
394
- const groupId = mapping.get(event.organizationId);
395
- if (groupId) {
396
- await ctx.db.patch(event._id, {
397
- groupId,
398
- organizationId: undefined
399
- });
400
- }
401
- }
402
- console.log(`Updated ${events.length} events`);
403
-
404
- // 6. Update knowledge
405
- const knowledge = await ctx.db.query("knowledge").collect();
406
- for (const k of knowledge) {
407
- const groupId = mapping.get(k.organizationId);
408
- if (groupId) {
409
- await ctx.db.patch(k._id, {
410
- groupId,
411
- organizationId: undefined
412
- });
413
- }
414
- }
415
- console.log(`Updated ${knowledge.length} knowledge entries`);
416
-
417
- console.log("Migration complete!");
418
- return {
419
- organizations: orgs.length,
420
- entities: entities.length,
421
- connections: connections.length,
422
- events: events.length,
423
- knowledge: knowledge.length
424
- };
425
- }
426
- });
427
- ```
428
-
429
- **Dependencies:** Schema update (Track 0)
430
- **Duration:** 1 inference
431
-
432
- ---
433
-
434
- ## Execution Timeline (Inference-Based)
435
-
436
- ### Phase 1: Foundation (Sequential)
437
-
438
- **Infer 0:** Update schema (Track 0) ← BLOCKS EVERYTHING
439
-
440
- **Duration:** 1 inference
441
-
442
- ---
443
-
444
- ### Phase 2: Backend Updates (Parallel)
445
-
446
- Run **Tracks 1 & 2** in parallel after schema is ready:
447
-
448
- **Track 1:** Update mutations (Infer 11-15) - 5 parallel
449
- **Track 2:** Update queries (Infer 16-20) - 5 parallel
450
-
451
- **Duration:** 1 inference elapsed (10 inferences running in parallel)
452
-
453
- ---
454
-
455
- ### Phase 3: Frontend + Docs + Migration (Parallel)
456
-
457
- Run **Tracks 3, 4, 5, 6** in parallel after backend is ready:
458
-
459
- **Track 3:** Update components (Infer 21-30) - 10 parallel
460
- **Track 4:** New group UI (Infer 31-34) - 4 sequential
461
- **Track 5:** Update docs (Infer 41-84) - 44 parallel
462
- **Track 6:** Migration script (Infer 85) - 1 parallel
463
-
464
- **Duration:** 4 inferences elapsed (longest track is Track 4 with 4 sequential inferences)
465
-
466
- ---
467
-
468
- ### Phase 4: Testing (Parallel)
469
-
470
- **Infer 86:** Test nested group queries
471
- **Infer 87:** Test URL-based creation
472
- **Infer 88:** Test data migration on dev
473
- **Infer 89:** Integration tests
474
- **Infer 90:** E2E tests
475
-
476
- **Duration:** 1 inference elapsed (5 tests running in parallel)
477
-
478
- ---
479
-
480
- ### Phase 5: Deployment (Sequential)
481
-
482
- **Infer 91:** Run migration on staging
483
- **Infer 92:** Verify staging data
484
- **Infer 93:** Deploy backend to production
485
- **Infer 94:** Run migration on production
486
- **Infer 95:** Deploy frontend to production
487
- **Infer 96:** Verify production
488
- **Infer 97:** Monitor for 24 hours
489
- **Infer 98:** Archive old organizations table
490
- **Infer 99:** Update external docs
491
- **Infer 100:** Announce migration complete
492
-
493
- **Duration:** 10 inferences (sequential for safety)
494
-
495
- ---
496
-
497
- ## Total Duration: ~17 Inferences (Instead of 100!)
498
-
499
- **Traditional sequential approach:** 100 inferences (if each step was sequential)
500
-
501
- **Parallel approach:**
502
- - Phase 1: 1 inference (schema)
503
- - Phase 2: 1 inference (backend parallel)
504
- - Phase 3: 4 inferences (frontend + docs + migration parallel)
505
- - Phase 4: 1 inference (testing parallel)
506
- - Phase 5: 10 inferences (deployment sequential)
507
- - **Total: 17 inferences**
508
-
509
- **Speed increase: 5.9x faster** (100 → 17 inferences)
510
-
511
- ---
512
-
513
- ## Parallelization Strategy
514
-
515
- ### Rule 1: Dependencies First
516
-
517
- Schema must complete before anything else. This is the foundation.
518
-
519
- ### Rule 2: Independent Files = Parallel
520
-
521
- - All mutation files can update in parallel (no dependencies between them)
522
- - All query files can update in parallel
523
- - All component files can update in parallel
524
- - All doc files can update in parallel
525
-
526
- ### Rule 3: Use Multiple Agents
527
-
528
- ```typescript
529
- // Launch 5 backend mutation agents in parallel
530
- await Promise.all([
531
- agent1.update("mutations/entities.ts"),
532
- agent2.update("mutations/connections.ts"),
533
- agent3.update("mutations/events.ts"),
534
- agent4.update("mutations/knowledge.ts"),
535
- agent5.create("mutations/groups.ts")
536
- ]);
537
-
538
- // Launch 5 backend query agents in parallel
539
- await Promise.all([
540
- agent1.update("queries/entities.ts"),
541
- agent2.update("queries/connections.ts"),
542
- agent3.update("queries/events.ts"),
543
- agent4.update("queries/knowledge.ts"),
544
- agent5.create("queries/groups.ts")
545
- ]);
546
-
547
- // Launch 44 documentation agents in parallel (!)
548
- const docAgents = docFiles.map(file =>
549
- agent.update(file, { replace: "organizations → groups" })
550
- );
551
- await Promise.all(docAgents);
552
- ```
553
-
554
- ### Rule 4: Monitor Progress
555
-
556
- ```typescript
557
- // Track parallel execution
558
- const progress = {
559
- phase: "Backend Updates",
560
- tracks: {
561
- mutations: "5/5 complete",
562
- queries: "5/5 complete"
563
- },
564
- elapsed: "1 inference",
565
- remaining: "16 inferences"
566
- };
567
- ```
568
-
569
- ---
570
-
571
- ## Risk Mitigation
572
-
573
- ### Risk 1: Breaking Changes
574
-
575
- **Mitigation:** Create backward-compatible wrapper for 1 version:
576
-
577
- ```typescript
578
- // Temporary: Support both organizationId and groupId
579
- export const create = mutation({
580
- args: {
581
- organizationId: v.optional(v.id("organizations")), // Deprecated
582
- groupId: v.optional(v.id("groups")),
583
- // ... other args
584
- },
585
- handler: async (ctx, args) => {
586
- const actualGroupId = args.groupId || args.organizationId; // Fallback
587
- // ... rest of implementation
588
- }
589
- });
590
- ```
591
-
592
- ### Risk 2: Data Loss During Migration
593
-
594
- **Mitigation:**
595
- 1. Backup database before migration
596
- 2. Test migration on staging first
597
- 3. Verify data counts match (orgs → groups)
598
- 4. Keep organizations table for 1 week after migration
599
-
600
- ### Risk 3: Frontend Breaks Before Backend Ready
601
-
602
- **Mitigation:**
603
- 1. Deploy backend changes first
604
- 2. Keep old organizationId field for 1 version
605
- 3. Deploy frontend after backend is stable
606
- 4. Use feature flags for new group features
607
-
608
- ### Risk 4: Parallel Agents Conflict
609
-
610
- **Mitigation:**
611
- 1. Each agent works on separate files (no conflicts)
612
- 2. Use git branches per track
613
- 3. Merge tracks sequentially: backend → frontend → docs
614
- 4. Run tests after each track merge
615
-
616
- ---
617
-
618
- ## Example: Parallel Execution in Practice
619
-
620
- ### Scenario: Update All Backend Mutations
621
-
622
- **Sequential (old way):**
623
- ```bash
624
- Infer 11: Update mutations/entities.ts (10 min)
625
- Infer 12: Update mutations/connections.ts (10 min)
626
- Infer 13: Update mutations/events.ts (10 min)
627
- Infer 14: Update mutations/knowledge.ts (10 min)
628
- Infer 15: Create mutations/groups.ts (15 min)
629
- Total: 55 minutes
630
- ```
631
-
632
- **Parallel (new way):**
633
- ```bash
634
- # Launch 5 agents simultaneously
635
- Infer 11-15: [All 5 agents working in parallel]
636
- - Agent 1: mutations/entities.ts (10 min)
637
- - Agent 2: mutations/connections.ts (10 min)
638
- - Agent 3: mutations/events.ts (10 min)
639
- - Agent 4: mutations/knowledge.ts (10 min)
640
- - Agent 5: mutations/groups.ts (15 min) ← longest
641
- Total: 15 minutes (limited by slowest agent)
642
- ```
643
-
644
- **Speed increase:** 55 min → 15 min = **3.7x faster**
645
-
646
- ---
647
-
648
- ## Validation Checklist
649
-
650
- After each parallel track completes:
651
-
652
- **Track 1 (Mutations):**
653
- - [ ] All mutations compile without errors
654
- - [ ] organizationId references removed
655
- - [ ] groupId added to all mutations
656
- - [ ] Events logged with groupId
657
-
658
- **Track 2 (Queries):**
659
- - [ ] All queries compile without errors
660
- - [ ] organizationId references removed
661
- - [ ] groupId used in all indexes
662
- - [ ] Hierarchical queries work
663
-
664
- **Track 3 (Components):**
665
- - [ ] All components compile without errors
666
- - [ ] useQuery calls use groupId
667
- - [ ] UI displays group terminology
668
- - [ ] No organizationId in props
669
-
670
- **Track 4 (Routes):**
671
- - [ ] /group/:slug route works
672
- - [ ] Group creation flow works
673
- - [ ] Group hierarchy navigation works
674
- - [ ] URL-based join works
675
-
676
- **Track 5 (Docs):**
677
- - [ ] All 41 files updated
678
- - [ ] No "organizations" references
679
- - [ ] Examples use "groups"
680
- - [ ] Version updated to 2.0.0
681
-
682
- **Track 6 (Migration):**
683
- - [ ] Migration script tested on dev
684
- - [ ] All data migrated correctly
685
- - [ ] Counts match (orgs = groups)
686
- - [ ] Old data archived
687
-
688
- ---
689
-
690
- ## Summary
691
-
692
- **The Big Idea:** Organizations don't disappear—they become a **type** of group.
693
-
694
- **The Architecture:** 6 group types (friend_circle, business, community, dao, government, organization) with hierarchical nesting.
695
-
696
- **The Strategy:** Maximize parallelization after schema update. Instead of 100 sequential inferences, we execute ~17 inferences with massive parallelization.
697
-
698
- **The Result:**
699
- - 5.9x faster execution (100 → 17 inferences)
700
- - Same multi-tenancy guarantees
701
- - Hierarchical groups enabled
702
- - URL-based creation unlocked
703
- - Universal applicability achieved
704
-
705
- **Organizations → Groups = Clarity + Scale + Speed**