oneie 2.0.2 → 2.0.5

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 (459) hide show
  1. package/AGENTS.md +245 -0
  2. package/CLAUDE.md +725 -0
  3. package/LICENSE.md +84 -0
  4. package/README.md +489 -931
  5. package/folders.yaml +78 -17
  6. package/one/.obsidian/app.json +1 -0
  7. package/one/.obsidian/appearance.json +1 -0
  8. package/one/.obsidian/core-plugins.json +33 -0
  9. package/one/.obsidian/workspace.json +211 -0
  10. package/one/connections/a2a.md +551 -0
  11. package/one/connections/acp.md +761 -0
  12. package/one/connections/acps.md +731 -0
  13. package/one/connections/agentkit.md +349 -0
  14. package/one/connections/agui.md +767 -0
  15. package/one/connections/any-backend.md +1702 -0
  16. package/one/connections/ap2.md +998 -0
  17. package/one/connections/api-docs.md +1891 -0
  18. package/one/connections/api.md +2190 -0
  19. package/one/connections/architecture-diagram.md +94 -0
  20. package/one/connections/communications.md +449 -0
  21. package/one/connections/connections.md +339 -0
  22. package/one/connections/copilotkit.md +1559 -0
  23. package/one/connections/cryptonetworks.md +781 -0
  24. package/one/connections/documentation.md +1120 -0
  25. package/one/connections/effect.md +279 -0
  26. package/one/connections/elizaos.md +1290 -0
  27. package/one/connections/inference.md +58 -0
  28. package/one/connections/kyc.md +632 -0
  29. package/one/connections/mcp.md +842 -0
  30. package/one/connections/membership.md +1152 -0
  31. package/one/connections/middleware.md +1067 -0
  32. package/one/connections/multitenant.md +1341 -0
  33. package/one/connections/n8n.md +1015 -0
  34. package/one/connections/patterns.md +89 -0
  35. package/one/connections/protocols.md +279 -0
  36. package/one/connections/relationships.md +107 -0
  37. package/one/connections/schema.md +587 -0
  38. package/one/connections/service-layer.md +550 -0
  39. package/one/connections/structure.md +0 -0
  40. package/one/connections/vectors.md +207 -0
  41. package/one/connections/wordpress.md +1302 -0
  42. package/one/connections/workflow-copy.md +905 -0
  43. package/one/connections/workflow-examples.md +741 -0
  44. package/one/connections/workflow.md +905 -0
  45. package/one/connections/workflows/delegation.md +885 -0
  46. package/one/connections/workflows/frontend.md +1037 -0
  47. package/one/connections/workflows/strategy.md +903 -0
  48. package/one/connections/workflows/tasks.md +698 -0
  49. package/one/connections/x402.md +1249 -0
  50. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +412 -0
  51. package/one/events/FEATURE-2-4-COMPLETE.md +302 -0
  52. package/one/events/FEATURE_2_3_COMPLETE.md +575 -0
  53. package/one/events/GROUPS-MIGRATION.md +625 -0
  54. package/one/events/INSTALL-TESTS.md +293 -0
  55. package/one/events/INTEGRATION-ARCHITECTURE.md +561 -0
  56. package/one/events/INTEGRATION-CHECKLIST.md +1234 -0
  57. package/one/events/INTEGRATION-ORCHESTRATION.md +2623 -0
  58. package/one/events/INTEGRATION-SUMMARY.md +653 -0
  59. package/one/events/MIGRATION-REPORT.md +435 -0
  60. package/one/events/MIGRATION.md +69 -0
  61. package/one/events/README-archived.md +519 -0
  62. package/one/events/TEST-SUMMARY.md +393 -0
  63. package/one/events/TESTS-QUICK-REF.md +262 -0
  64. package/one/events/events.md +545 -0
  65. package/one/groups/groups.md +543 -0
  66. package/one/groups/one.md +599 -0
  67. package/one/groups/revenue.md +673 -0
  68. package/one/groups/strategy.md +869 -0
  69. package/one/groups/vision.md +98 -0
  70. package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +49 -0
  71. package/one/knowledge/ai-platform.md +305 -0
  72. package/one/knowledge/architecture-any-backend.md +1366 -0
  73. package/one/knowledge/architecture-diagram.md +94 -0
  74. package/one/knowledge/architecture-frontend.md +930 -0
  75. package/one/knowledge/architecture.md +2077 -0
  76. package/one/knowledge/crypto.md +960 -0
  77. package/one/knowledge/docs/flow.md +0 -0
  78. package/one/knowledge/dsl.md +1660 -0
  79. package/one/knowledge/files.md +2471 -0
  80. package/one/knowledge/frontend.md +1038 -0
  81. package/one/knowledge/hono.md +2109 -0
  82. package/one/knowledge/implementation-examples.md +2536 -0
  83. package/one/knowledge/inference-score.md +159 -0
  84. package/one/knowledge/knowledge.md +642 -0
  85. package/one/knowledge/language.md +980 -0
  86. package/one/knowledge/lessons-learned.md +70 -0
  87. package/one/knowledge/ontology-6-dimensions.md +0 -0
  88. package/one/knowledge/ontology-documentation.md +356 -0
  89. package/one/knowledge/ontology-engineering-specification.md +1292 -0
  90. package/one/knowledge/ontology-engineering.md +1652 -0
  91. package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
  92. package/one/knowledge/ontology-frontend-copy.md +753 -0
  93. package/one/knowledge/ontology-frontend-specifications.md +2188 -0
  94. package/one/knowledge/ontology-frontend.md +2427 -0
  95. package/one/knowledge/ontology-minimal.yaml +299 -0
  96. package/one/knowledge/ontology.md +2830 -0
  97. package/one/knowledge/ontology.md.backup +2822 -0
  98. package/one/knowledge/ontology.yaml +1165 -0
  99. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
  100. package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
  101. package/one/knowledge/patterns/backend/mutation-template.md +231 -0
  102. package/one/knowledge/patterns/backend/query-template.md +267 -0
  103. package/one/knowledge/patterns/backend/service-template.md +237 -0
  104. package/one/knowledge/patterns/design/component-architecture.md +399 -0
  105. package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
  106. package/one/knowledge/patterns/design/wireframe-template.md +216 -0
  107. package/one/knowledge/patterns/frontend/component-template.md +195 -0
  108. package/one/knowledge/patterns/frontend/form-template.md +276 -0
  109. package/one/knowledge/patterns/frontend/page-template.md +178 -0
  110. package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
  111. package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
  112. package/one/knowledge/patterns/test/technical-test-template.md +544 -0
  113. package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
  114. package/one/knowledge/patterns/test/user-flow-template.md +254 -0
  115. package/one/knowledge/provider-creation-guide.md +1064 -0
  116. package/one/knowledge/quality-loop.md +401 -0
  117. package/one/knowledge/readme.md +131 -0
  118. package/one/knowledge/rules.md +626 -0
  119. package/one/knowledge/score.md +67 -0
  120. package/one/knowledge/specifications.md +855 -0
  121. package/one/knowledge/tags.md +130 -0
  122. package/one/knowledge/todo.md +251 -0
  123. package/one/license.md +84 -0
  124. package/one/people/anthony-o-connell.md +440 -0
  125. package/one/people/people.md +567 -0
  126. package/one/things/CHECKLIST.md +356 -0
  127. package/one/things/ONE.md +510 -0
  128. package/one/things/agents/agent-backend.md +1401 -0
  129. package/one/things/agents/agent-builder.md +955 -0
  130. package/one/things/agents/agent-clean.md +709 -0
  131. package/one/things/agents/agent-clone.md +1341 -0
  132. package/one/things/agents/agent-designer.md +2177 -0
  133. package/one/things/agents/agent-director.md +1508 -0
  134. package/one/things/agents/agent-documenter.md +1049 -0
  135. package/one/things/agents/agent-frontend.md +1119 -0
  136. package/one/things/agents/agent-integrator.md +1192 -0
  137. package/one/things/agents/agent-problem-solver.md +1379 -0
  138. package/one/things/agents/agent-quality.md +1353 -0
  139. package/one/things/agents/agent-sales.md +986 -0
  140. package/one/things/cascade/cascade.yaml +464 -0
  141. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
  142. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
  143. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
  144. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
  145. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
  146. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
  147. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
  148. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
  149. package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
  150. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
  151. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
  152. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
  153. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
  154. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
  155. package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
  156. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
  157. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
  158. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
  159. package/one/things/cascade/docs/examples/readme.md +222 -0
  160. package/one/things/cascade/docs/getting-started.md +515 -0
  161. package/one/things/cascade/docs/workflow.md +1372 -0
  162. package/one/things/cascade/readme.md +336 -0
  163. package/one/things/cascade/templates/feature-template.md +267 -0
  164. package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
  165. package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
  166. package/one/things/claude/agents/analyst.md +483 -0
  167. package/one/things/claude/agents/architect.md +480 -0
  168. package/one/things/claude/agents/brand-identity-specialist.md +513 -0
  169. package/one/things/claude/agents/bstp-token-strategist.md +667 -0
  170. package/one/things/claude/agents/builder-repo.md +489 -0
  171. package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
  172. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
  173. package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
  174. package/one/things/claude/agents/company-bullstamp-character.md +587 -0
  175. package/one/things/claude/agents/company-bullstamp-community.md +292 -0
  176. package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
  177. package/one/things/claude/agents/company-bullstamp-token.md +292 -0
  178. package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
  179. package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
  180. package/one/things/claude/agents/content-calendar-planner.md +448 -0
  181. package/one/things/claude/agents/content-chapter-formatter.md +488 -0
  182. package/one/things/claude/agents/content-formatter.md +546 -0
  183. package/one/things/claude/agents/content-hook-specialist.md +462 -0
  184. package/one/things/claude/agents/content-image-formatter.md +535 -0
  185. package/one/things/claude/agents/content-introduction-formatter.md +485 -0
  186. package/one/things/claude/agents/content-multiplication-engine.md +556 -0
  187. package/one/things/claude/agents/content-playbook-writer.md +448 -0
  188. package/one/things/claude/agents/content-team-manager.md +622 -0
  189. package/one/things/claude/agents/content-toc-formatter.md +522 -0
  190. package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
  191. package/one/things/claude/agents/core-manager.md +582 -0
  192. package/one/things/claude/agents/core-master.md +403 -0
  193. package/one/things/claude/agents/cross-functional-manager.md +471 -0
  194. package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
  195. package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
  196. package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
  197. package/one/things/claude/agents/crypto-community-analyst.md +298 -0
  198. package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
  199. package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
  200. package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
  201. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
  202. package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
  203. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
  204. package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
  205. package/one/things/claude/agents/crypto-market-researcher.md +292 -0
  206. package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
  207. package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
  208. package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
  209. package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
  210. package/one/things/claude/agents/crypto-team-manager.md +387 -0
  211. package/one/things/claude/agents/crypto-token-analyst.md +278 -0
  212. package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
  213. package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
  214. package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
  215. package/one/things/claude/agents/customer-journey-designer.md +481 -0
  216. package/one/things/claude/agents/customer-success-manager.md +581 -0
  217. package/one/things/claude/agents/dev.md +413 -0
  218. package/one/things/claude/agents/documenter.md +546 -0
  219. package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
  220. package/one/things/claude/agents/engagement-specialist.md +509 -0
  221. package/one/things/claude/agents/engineering-architect.md +387 -0
  222. package/one/things/claude/agents/engineering-business-analyst.md +537 -0
  223. package/one/things/claude/agents/engineering-developer.md +387 -0
  224. package/one/things/claude/agents/engineering-director.md +282 -0
  225. package/one/things/claude/agents/engineering-ingestor.md +649 -0
  226. package/one/things/claude/agents/engineering-product-manager.md +537 -0
  227. package/one/things/claude/agents/engineering-product-owner.md +537 -0
  228. package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
  229. package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
  230. package/one/things/claude/agents/engineering-team-manager.md +512 -0
  231. package/one/things/claude/agents/engineering-user-experience.md +387 -0
  232. package/one/things/claude/agents/framework-elevate-manager.md +294 -0
  233. package/one/things/claude/agents/improver.md +763 -0
  234. package/one/things/claude/agents/intelligence-team-manager.md +385 -0
  235. package/one/things/claude/agents/lead-capture-expert.md +466 -0
  236. package/one/things/claude/agents/lead-magnet-creator.md +453 -0
  237. package/one/things/claude/agents/market-research-analyst.md +412 -0
  238. package/one/things/claude/agents/marketing-brand-identity.md +314 -0
  239. package/one/things/claude/agents/marketing-content-hooks.md +450 -0
  240. package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
  241. package/one/things/claude/agents/marketing-content-poster.md +361 -0
  242. package/one/things/claude/agents/marketing-customer-journey.md +326 -0
  243. package/one/things/claude/agents/marketing-director.md +397 -0
  244. package/one/things/claude/agents/marketing-engagement.md +326 -0
  245. package/one/things/claude/agents/marketing-lead-capture.md +326 -0
  246. package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
  247. package/one/things/claude/agents/marketing-network-effects.md +326 -0
  248. package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
  249. package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
  250. package/one/things/claude/agents/marketing-team-manager.md +446 -0
  251. package/one/things/claude/agents/marketing-viral-growth.md +201 -0
  252. package/one/things/claude/agents/mission-commander.md +373 -0
  253. package/one/things/claude/agents/network-effect-analyst.md +587 -0
  254. package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
  255. package/one/things/claude/agents/npx.md +890 -0
  256. package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
  257. package/one/things/claude/agents/one-master.md +355 -0
  258. package/one/things/claude/agents/one-orchestrator.md +315 -0
  259. package/one/things/claude/agents/one.md +601 -0
  260. package/one/things/claude/agents/playbook-generator.md +503 -0
  261. package/one/things/claude/agents/pm.md +326 -0
  262. package/one/things/claude/agents/po.md +345 -0
  263. package/one/things/claude/agents/qa.md +336 -0
  264. package/one/things/claude/agents/research-foundation-analyst.md +307 -0
  265. package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
  266. package/one/things/claude/agents/research-market-analyst.md +307 -0
  267. package/one/things/claude/agents/research-team-manager.md +482 -0
  268. package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
  269. package/one/things/claude/agents/sales-team-manager.md +400 -0
  270. package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
  271. package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
  272. package/one/things/claude/agents/service-advocacy-manager.md +307 -0
  273. package/one/things/claude/agents/service-success-manager.md +307 -0
  274. package/one/things/claude/agents/service-team-manager.md +400 -0
  275. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
  276. package/one/things/claude/agents/share-optimization-specialist.md +551 -0
  277. package/one/things/claude/agents/sm.md +327 -0
  278. package/one/things/claude/agents/story-teller.md +473 -0
  279. package/one/things/claude/agents/task-master.md +596 -0
  280. package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
  281. package/one/things/claude/agents/tester.md +556 -0
  282. package/one/things/claude/agents/the-bull-character-manager.md +580 -0
  283. package/one/things/claude/agents/tools-playbook-generator.md +489 -0
  284. package/one/things/claude/agents/turbo-repo-builder.md +316 -0
  285. package/one/things/claude/agents/upsell-strategist.md +480 -0
  286. package/one/things/claude/agents/ux-expert.md +335 -0
  287. package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
  288. package/one/things/claude/claude-code-hooks-development.json +21 -0
  289. package/one/things/claude/claude-code-hooks-production.json +21 -0
  290. package/one/things/claude/claude-code-hooks.json +25 -0
  291. package/one/things/claude/commands/agent.md +104 -0
  292. package/one/things/claude/commands/cascade-status.md +128 -0
  293. package/one/things/claude/commands/ingest.md +290 -0
  294. package/one/things/claude/commands/ingestor.md +136 -0
  295. package/one/things/claude/commands/mission.md +83 -0
  296. package/one/things/claude/commands/npx.md +133 -0
  297. package/one/things/claude/commands/one.md +440 -0
  298. package/one/things/claude/commands/quality-check.md +204 -0
  299. package/one/things/claude/commands/smart-route.md +220 -0
  300. package/one/things/claude/commands/start.md +121 -0
  301. package/one/things/claude/commands/story.md +83 -0
  302. package/one/things/claude/commands/task.md +173 -0
  303. package/one/things/claude/hook-bypass.json +32 -0
  304. package/one/things/claude/hooks/agent-hook-config.json +427 -0
  305. package/one/things/claude/hooks/agent-hook-manager.js +525 -0
  306. package/one/things/claude/hooks/agent-load-balancer.js +271 -0
  307. package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
  308. package/one/things/claude/hooks/build-hook.sh +156 -0
  309. package/one/things/claude/hooks/cascade-feedback.js +297 -0
  310. package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
  311. package/one/things/claude/hooks/cleanup-hook.sh +201 -0
  312. package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
  313. package/one/things/claude/hooks/file-organization-engine.js +427 -0
  314. package/one/things/claude/hooks/file-organization-hook.sh +80 -0
  315. package/one/things/claude/hooks/file-organization-monitor.js +269 -0
  316. package/one/things/claude/hooks/format-hook.sh +43 -0
  317. package/one/things/claude/hooks/hook-bypass.sh +293 -0
  318. package/one/things/claude/hooks/hook-config-manager.js +202 -0
  319. package/one/things/claude/hooks/hook-debouncer.sh +62 -0
  320. package/one/things/claude/hooks/hook-logger.sh +89 -0
  321. package/one/things/claude/hooks/hook-orchestrator.js +662 -0
  322. package/one/things/claude/hooks/hook-performance-report.js +120 -0
  323. package/one/things/claude/hooks/lint-hook.sh +140 -0
  324. package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
  325. package/one/things/claude/hooks/memory-optimizer.js +510 -0
  326. package/one/things/claude/hooks/notification-hook.sh +204 -0
  327. package/one/things/claude/hooks/ontology-compliance.js +394 -0
  328. package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
  329. package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
  330. package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
  331. package/one/things/claude/hooks/performance-metrics.json +25 -0
  332. package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
  333. package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
  334. package/one/things/claude/hooks/security-hook.sh +256 -0
  335. package/one/things/claude/hooks/simple-load-balancer.js +238 -0
  336. package/one/things/claude/hooks/startup-optimizer.js +625 -0
  337. package/one/things/claude/hooks/story-scoring-system.js +445 -0
  338. package/one/things/claude/hooks/story-validation-engine.js +473 -0
  339. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
  340. package/one/things/claude/hooks/story-validation-hook.sh +145 -0
  341. package/one/things/claude/hooks/structure-synchronizer.js +194 -0
  342. package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
  343. package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
  344. package/one/things/claude/hooks/test-hook.sh +145 -0
  345. package/one/things/claude/hooks/test-story-validation.sh +170 -0
  346. package/one/things/claude/hooks/trinity-validation-system.js +392 -0
  347. package/one/things/claude/settings-local.json +86 -0
  348. package/one/things/cli/cli-code.md +652 -0
  349. package/one/things/cli/cli-compiler-code.md +652 -0
  350. package/one/things/cli/cli.md +1068 -0
  351. package/one/things/components/card-shadcn.md +929 -0
  352. package/one/things/components/card.md +1050 -0
  353. package/one/things/components.md +1669 -0
  354. package/one/things/componets.md +4 -0
  355. package/one/things/creator-diagram.md +166 -0
  356. package/one/things/examples/children/lemonade-stand.md +366 -0
  357. package/one/things/examples/enterprise/crm-saas.md +1429 -0
  358. package/one/things/features/1-1-agent-prompts/design.md +470 -0
  359. package/one/things/features/1-1-agent-prompts/tests.md +264 -0
  360. package/one/things/features/1-1-agent-prompts.md +486 -0
  361. package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
  362. package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
  363. package/one/things/features/1-2-yaml-orchestrator.md +516 -0
  364. package/one/things/features/1-3-event-coordination/design.md +544 -0
  365. package/one/things/features/1-3-event-coordination/tests.md +223 -0
  366. package/one/things/features/1-3-event-coordination.md +508 -0
  367. package/one/things/features/1-4-knowledge-management/design.md +609 -0
  368. package/one/things/features/1-4-knowledge-management/tests.md +195 -0
  369. package/one/things/features/1-4-knowledge-management.md +577 -0
  370. package/one/things/features/1-5-quality-loops/design.md +797 -0
  371. package/one/things/features/1-5-quality-loops/tests.md +212 -0
  372. package/one/things/features/1-5-quality-loops.md +641 -0
  373. package/one/things/features/1-6-numbering-structure/design.md +610 -0
  374. package/one/things/features/1-6-numbering-structure/tests.md +213 -0
  375. package/one/things/features/1-6-numbering-structure.md +575 -0
  376. package/one/things/features/2-1-dataprovider-interface.md +2358 -0
  377. package/one/things/features/2-2-config-system.md +3075 -0
  378. package/one/things/features/2-3-effectts-services.md +1498 -0
  379. package/one/things/features/2-4-react-hooks.md +2120 -0
  380. package/one/things/features/2-5-auth-migration.md +2046 -0
  381. package/one/things/features/2-6-dashboard-migration.md +1985 -0
  382. package/one/things/features/2-7-alternative-providers.md +2505 -0
  383. package/one/things/features/2-7-implementation-report.md +680 -0
  384. package/one/things/features/2-cli.md +1235 -0
  385. package/one/things/features/2-design.md +1738 -0
  386. package/one/things/features/2-tests.md +520 -0
  387. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +521 -0
  388. package/one/things/features/DECOUPLING.md +272 -0
  389. package/one/things/features/DEPLOYMENT.md +452 -0
  390. package/one/things/features/IMPLEMENTATION_SUMMARY.md +316 -0
  391. package/one/things/features/dataprovider-interface/1-tests.md +1522 -0
  392. package/one/things/features/improve.md +843 -0
  393. package/one/things/features/remove-convex-deps.md +45 -0
  394. package/one/things/features/top-features.md +79 -0
  395. package/one/things/features/use-one-backend.md +1180 -0
  396. package/one/things/ideas/1-create-workflow.md +189 -0
  397. package/one/things/ideas/2-backend-agnostic-frontend.md +384 -0
  398. package/one/things/plans/1-create-workflow-status.md +555 -0
  399. package/one/things/plans/1-create-workflow.md +713 -0
  400. package/one/things/plans/2-backend-agnostic-frontend.md +543 -0
  401. package/one/things/plans/3-groups.md +502 -0
  402. package/one/things/plans/app.md +761 -0
  403. package/one/things/plans/backend-agnostic-frontend.md +323 -0
  404. package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
  405. package/one/things/plans/better-auth-any-backend.md +1852 -0
  406. package/one/things/plans/better-auth-available-features.md +235 -0
  407. package/one/things/plans/big-plan.md +38 -0
  408. package/one/things/plans/convex-better-auth.md +1109 -0
  409. package/one/things/plans/convex-on-off.md +389 -0
  410. package/one/things/plans/deploy-to-cloudflare.md +581 -0
  411. package/one/things/plans/desktop.md +1121 -0
  412. package/one/things/plans/effect-components.md +1669 -0
  413. package/one/things/plans/effect.md +973 -0
  414. package/one/things/plans/email.md +953 -0
  415. package/one/things/plans/enhance-auth.md +1669 -0
  416. package/one/things/plans/install-components.md +198 -0
  417. package/one/things/plans/landing.md +728 -0
  418. package/one/things/plans/layout.md +205 -0
  419. package/one/things/plans/mail-backend.md +1308 -0
  420. package/one/things/plans/mail.md +2624 -0
  421. package/one/things/plans/next-features.md +83 -0
  422. package/one/things/plans/one.md +658 -0
  423. package/one/things/plans/ontology-6-dimensions.md +2216 -0
  424. package/one/things/plans/ontology-driven-strategy.md +866 -0
  425. package/one/things/plans/ontology-ui-approach.md +357 -0
  426. package/one/things/plans/open-agent.md +785 -0
  427. package/one/things/plans/organizations-to-groups.md +705 -0
  428. package/one/things/plans/performace.md +90 -0
  429. package/one/things/plans/release.md +432 -0
  430. package/one/things/plans/releases.md +809 -0
  431. package/one/things/plans/repos.md +76 -0
  432. package/one/things/plans/separate-copy-2.md +1293 -0
  433. package/one/things/plans/separate-copy-3.md +2458 -0
  434. package/one/things/plans/separate-copy.md +1293 -0
  435. package/one/things/plans/separate.md +1983 -0
  436. package/one/things/plans/shadcn-integration-summary.md +450 -0
  437. package/one/things/plans/sidebar.md +172 -0
  438. package/one/things/plans/small-fixes.md +5 -0
  439. package/one/things/plans/test-backend-connection.md +476 -0
  440. package/one/things/plans/workflow-files.md +1196 -0
  441. package/one/things/plans/workflow.md +1372 -0
  442. package/one/things/products/cascade-landing-page.md +737 -0
  443. package/one/things/products/cascade.md +1518 -0
  444. package/one/things/products/context-engineering.md +1427 -0
  445. package/one/things/products/onthology.md +0 -0
  446. package/one/things/products/ontology-ui-shadcn.md +1280 -0
  447. package/one/things/products/ontology-ui.md +1387 -0
  448. package/one/things/products/ontology.md +717 -0
  449. package/one/things/products/sdk.md +557 -0
  450. package/one/things/promptkit.md +903 -0
  451. package/one/things/service-providers-new.md +982 -0
  452. package/one/things/service-providers.md +1092 -0
  453. package/one/things/system.md +600 -0
  454. package/one/things/tests/2-1-dataprovider-interface.md +1144 -0
  455. package/one/things/tests/2-1-test-analysis.md +496 -0
  456. package/one/things/things.md +349 -0
  457. package/one/things/todo.md +1248 -0
  458. package/one/things/vision/elegant-interface.md +214 -0
  459. package/package.json +5 -2
@@ -0,0 +1,1652 @@
1
+ # ONE Ontology Engineering
2
+
3
+ **Version:** 1.0.0
4
+ **Purpose:** Complete Platform Generation from 6-Dimension Ontology
5
+ **Philosophy:** 66 Things + 25 Connections + 67 Events + Knowledge = Infinite Platforms
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ 1. [The Complete Ontology](#the-complete-ontology)
12
+ 2. [Context Engineering Strategy](#context-engineering-strategy)
13
+ 3. [Platform Generation Matrix](#platform-generation-matrix)
14
+ 4. [Specialist AI Agent Architecture](#specialist-ai-agent-architecture)
15
+ 5. [Frontend Generation Patterns](#frontend-generation-patterns)
16
+ 6. [Backend Generation Patterns](#backend-generation-patterns)
17
+ 7. [Website Generation Engine](#website-generation-engine)
18
+ 8. [Complete Examples](#complete-examples)
19
+
20
+ ---
21
+
22
+ ## The Complete Ontology
23
+
24
+ ### The 6 Dimensions
25
+
26
+ ```typescript
27
+ // Organizations: Multi-tenant isolation (1 table)
28
+ organizations: {
29
+ _id, name, slug, domain, status, plan, limits, usage, billing, settings
30
+ }
31
+
32
+ // People: Authorization & governance (1 table)
33
+ people: {
34
+ _id, email, username, role, organizationId, organizations[], permissions[]
35
+ // Roles: platform_owner, org_owner, org_user, customer
36
+ }
37
+
38
+ // Things: All entities (1 table, 66 types)
39
+ things: {
40
+ _id, type, name, properties, status, createdAt, updatedAt
41
+ }
42
+
43
+ // Connections: All relationships (1 table, 25 types)
44
+ connections: {
45
+ _id, fromThingId, toThingId, relationshipType, metadata, createdAt
46
+ }
47
+
48
+ // Events: All actions (1 table, 67 types)
49
+ events: {
50
+ _id, type, actorId, targetId, timestamp, metadata
51
+ }
52
+
53
+ // Knowledge: Labels + vectors (1 table, 4 types: label, document, chunk, vector_only)
54
+ knowledge: {
55
+ _id, knowledgeType, text, embedding, embeddingModel, sourceThingId, labels, metadata
56
+ }
57
+
58
+ // ThingKnowledge: Many-to-many junction
59
+ thingKnowledge: {
60
+ _id, thingId, knowledgeId, role, metadata
61
+ }
62
+ ```
63
+
64
+ ### The 66 Thing Types
65
+
66
+ ```typescript
67
+ type ThingType =
68
+ // CORE (4)
69
+ | 'creator' // Human creator (platform/org owners, users, customers)
70
+ | 'ai_clone' // Digital twin with voice + appearance
71
+ | 'audience_member' // Fan/customer consuming content
72
+ | 'organization' // Multi-tenant org container
73
+
74
+ // BUSINESS AGENTS (10) - The AI workforce
75
+ | 'strategy_agent' // Vision, planning, OKRs
76
+ | 'research_agent' // Market research, trends
77
+ | 'marketing_agent' // Content strategy, SEO
78
+ | 'sales_agent' // Funnels, conversion
79
+ | 'service_agent' // Support, success
80
+ | 'design_agent' // Brand, UI/UX
81
+ | 'engineering_agent' // Tech, automation
82
+ | 'finance_agent' // Revenue, costs
83
+ | 'legal_agent' // Compliance, contracts
84
+ | 'intelligence_agent' // Analytics, predictions
85
+
86
+ // CONTENT (7)
87
+ | 'blog_post' | 'video' | 'podcast' | 'social_post'
88
+ | 'email' | 'course' | 'lesson'
89
+
90
+ // PRODUCTS (4)
91
+ | 'digital_product' // Templates, tools
92
+ | 'membership' // Tiered access
93
+ | 'consultation' // 1-on-1 sessions
94
+ | 'nft' // Collectibles
95
+
96
+ // COMMUNITY (3)
97
+ | 'community' | 'conversation' | 'message'
98
+
99
+ // TOKEN (2)
100
+ | 'token' // Token instance
101
+ | 'token_contract' // Smart contract
102
+
103
+ // KNOWLEDGE (2)
104
+ | 'knowledge_item' // Creator knowledge
105
+ | 'embedding' // Vector embedding
106
+
107
+ // PLATFORM (6)
108
+ | 'website' // Auto-generated sites
109
+ | 'landing_page' // Custom pages
110
+ | 'template' // Design templates
111
+ | 'livestream' // Live broadcasts
112
+ | 'recording' // Saved streams
113
+ | 'media_asset' // Images, videos
114
+
115
+ // BUSINESS (7)
116
+ | 'payment' | 'subscription' | 'invoice' | 'metric'
117
+ | 'insight' | 'prediction' | 'report'
118
+
119
+ // AUTHENTICATION & SESSION (5)
120
+ | 'session' // User sessions
121
+ | 'oauth_account' // OAuth connections
122
+ | 'verification_token' // Email/2FA verification
123
+ | 'password_reset_token' // Password resets
124
+ | 'ui_preferences' // User UI settings
125
+
126
+ // MARKETING (6)
127
+ | 'notification' | 'email_campaign' | 'announcement'
128
+ | 'referral' | 'campaign' | 'lead'
129
+
130
+ // EXTERNAL INTEGRATIONS (3)
131
+ | 'external_agent' // ElizaOS, AutoGen, etc.
132
+ | 'external_workflow' // n8n, Zapier, Make
133
+ | 'external_connection' // API connections
134
+
135
+ // PROTOCOL ENTITIES (2)
136
+ | 'mandate' // AP2 intent/cart mandates
137
+ | 'product' // ACP marketplace products
138
+ ```
139
+
140
+ ### The 25 Connection Types
141
+
142
+ ```typescript
143
+ type ConnectionType =
144
+ // OWNERSHIP (2)
145
+ | 'owns' // Creator owns course, org owns content
146
+ | 'created_by' // Course created by creator
147
+
148
+ // AI RELATIONSHIPS (3)
149
+ | 'clone_of' // AI clone of creator
150
+ | 'trained_on' // Clone trained on knowledge
151
+ | 'powers' // Agent powers feature
152
+
153
+ // CONTENT RELATIONSHIPS (5)
154
+ | 'authored' // Creator authored post
155
+ | 'generated_by' // Content generated by agent
156
+ | 'published_to' // Post published to platform
157
+ | 'part_of' // Lesson part of course
158
+ | 'references' // Post references another post
159
+
160
+ // COMMUNITY RELATIONSHIPS (4)
161
+ | 'member_of' // User member of community/org
162
+ | 'following' // User following creator
163
+ | 'moderates' // User moderates community
164
+ | 'participated_in' // User participated in conversation
165
+
166
+ // BUSINESS RELATIONSHIPS (3)
167
+ | 'manages' // Manager manages team
168
+ | 'reports_to' // User reports to manager
169
+ | 'collaborates_with' // Creators collaborate
170
+
171
+ // TOKEN RELATIONSHIPS (3)
172
+ | 'holds_tokens' // User holds N tokens
173
+ | 'staked_in' // Tokens staked in pool
174
+ | 'earned_from' // Tokens earned from action
175
+
176
+ // PRODUCT RELATIONSHIPS (4)
177
+ | 'purchased' // User purchased product
178
+ | 'enrolled_in' // User enrolled in course
179
+ | 'completed' // User completed course
180
+ | 'teaching' // Clone teaching course
181
+
182
+ // CONSOLIDATED (use metadata for variants)
183
+ | 'transacted' // Payment/subscription (metadata.transactionType)
184
+ | 'notified' // Notifications (metadata.channel)
185
+ | 'referred' // Referrals (metadata.referralType)
186
+ | 'communicated' // Agent communication (metadata.protocol)
187
+ | 'delegated' // Task delegation (metadata.taskType)
188
+ | 'approved' // Approvals (metadata.approvalType)
189
+ | 'fulfilled' // Fulfillment (metadata.fulfillmentType)
190
+ ```
191
+
192
+ ### The 67 Event Types
193
+
194
+ ```typescript
195
+ type EventType =
196
+ // ENTITY LIFECYCLE (4)
197
+ | 'entity_created' | 'entity_updated' | 'entity_deleted' | 'entity_archived'
198
+
199
+ // USER EVENTS (5)
200
+ | 'user_registered' | 'user_verified' | 'user_login' | 'user_logout' | 'profile_updated'
201
+
202
+ // AUTHENTICATION (6)
203
+ | 'password_reset_requested' | 'password_reset_completed'
204
+ | 'email_verification_sent' | 'email_verified'
205
+ | 'two_factor_enabled' | 'two_factor_disabled'
206
+
207
+ // ORGANIZATION (5)
208
+ | 'organization_created' | 'organization_updated'
209
+ | 'user_invited_to_org' | 'user_joined_org' | 'user_removed_from_org'
210
+
211
+ // DASHBOARD & UI (4)
212
+ | 'dashboard_viewed' | 'settings_updated' | 'theme_changed' | 'preferences_updated'
213
+
214
+ // AI/CLONE (4)
215
+ | 'clone_created' | 'clone_updated' | 'voice_cloned' | 'appearance_cloned'
216
+
217
+ // AGENT (4)
218
+ | 'agent_created' | 'agent_executed' | 'agent_completed' | 'agent_failed'
219
+
220
+ // TOKEN (7)
221
+ | 'token_created' | 'token_minted' | 'token_burned'
222
+ | 'tokens_purchased' | 'tokens_staked' | 'tokens_unstaked' | 'tokens_transferred'
223
+
224
+ // COURSE (5)
225
+ | 'course_created' | 'course_enrolled' | 'lesson_completed'
226
+ | 'course_completed' | 'certificate_earned'
227
+
228
+ // ANALYTICS (5)
229
+ | 'metric_calculated' | 'insight_generated' | 'prediction_made'
230
+ | 'optimization_applied' | 'report_generated'
231
+
232
+ // INFERENCE (7) - Revenue tracking
233
+ | 'inference_request' | 'inference_completed' | 'inference_failed'
234
+ | 'inference_quota_exceeded' | 'inference_revenue_collected'
235
+ | 'org_revenue_generated' | 'revenue_share_distributed'
236
+
237
+ // BLOCKCHAIN (5)
238
+ | 'nft_minted' | 'nft_transferred' | 'tokens_bridged'
239
+ | 'contract_deployed' | 'treasury_withdrawal'
240
+
241
+ // CONSOLIDATED (use metadata for variants)
242
+ | 'content_event' // action: created|updated|deleted|viewed|shared|liked
243
+ | 'payment_event' // status: requested|verified|processed
244
+ | 'subscription_event' // action: started|renewed|cancelled
245
+ | 'commerce_event' // ACP/AP2 commerce
246
+ | 'livestream_event' // status/action: started|ended|joined|left
247
+ | 'notification_event' // channel + deliveryStatus
248
+ | 'referral_event' // action: created|completed|rewarded
249
+ | 'communication_event' // protocol: a2a|acp|ap2|x402|agui
250
+ | 'task_event' // action: delegated|completed|failed
251
+ | 'mandate_event' // mandateType: intent|cart
252
+ | 'price_event' // action: checked|changed
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Context Engineering Strategy
258
+
259
+ ### The Problem
260
+
261
+ **Traditional AI:**
262
+ ```
263
+ Load entire codebase → 100k tokens
264
+ Load full documentation → 50k tokens
265
+ Load all examples → 30k tokens
266
+ Total: 180k tokens per request = $$$$ + slow + hallucinations
267
+ ```
268
+
269
+ **ONE Solution:**
270
+ ```
271
+ Query ontology types → 500 tokens
272
+ Retrieve relevant chunks → 800 tokens
273
+ Load focused examples → 400 tokens
274
+ Total: 1,700 tokens per request = $ + fast + accurate
275
+ ```
276
+
277
+ ### Strategy 1: Ontology as Schema
278
+
279
+ **The ontology IS the context.**
280
+
281
+ Instead of explaining "how to create a course", we say:
282
+ ```typescript
283
+ // Context (50 tokens):
284
+ {
285
+ thingType: 'course',
286
+ properties: ['title', 'description', 'price', 'modules'],
287
+ connections: ['owns', 'part_of', 'teaching'],
288
+ events: ['course_created', 'course_enrolled']
289
+ }
290
+
291
+ // Agent generates full CRUD from this schema
292
+ ```
293
+
294
+ ### Strategy 2: Type-Driven Generation
295
+
296
+ **Every thing type = Complete feature stack**
297
+
298
+ ```typescript
299
+ // Input: Thing type 'course'
300
+ const courseType = ontology.things.course
301
+
302
+ // Generated automatically:
303
+ 1. Database schema (Convex table definition)
304
+ 2. TypeScript types (course properties interface)
305
+ 3. CRUD mutations (create, update, delete)
306
+ 4. Query functions (list, get, search)
307
+ 5. Frontend components (CourseCard, CourseList, CourseDetail)
308
+ 6. Forms (CreateCourseForm, EditCourseForm)
309
+ 7. Pages (courses/index, courses/[id])
310
+ 8. API routes (/api/courses)
311
+ 9. Event logging (course_created, course_updated)
312
+ 10. Analytics (course metrics dashboard)
313
+
314
+ // Context used: 2k tokens
315
+ // Features generated: 10+ complete features
316
+ ```
317
+
318
+ ### Strategy 3: Connection-Driven UI
319
+
320
+ **Every connection type = Relationship UI**
321
+
322
+ ```typescript
323
+ // Input: Connection 'enrolled_in'
324
+ const enrolledInConnection = ontology.connections.enrolled_in
325
+
326
+ // Generated automatically:
327
+ 1. "Enroll" button component
328
+ 2. Enrollment modal/form
329
+ 3. "My Enrollments" list page
330
+ 4. Progress tracker (via metadata.progress)
331
+ 5. Query: getUserEnrollments(userId)
332
+ 6. Mutation: enrollInCourse(userId, courseId)
333
+ 7. Event: course_enrolled
334
+ 8. Analytics: enrollment metrics
335
+
336
+ // Context used: 800 tokens
337
+ // UI components generated: 8
338
+ ```
339
+
340
+ ### Strategy 4: Event-Driven Analytics
341
+
342
+ **Every event type = Analytics dashboard**
343
+
344
+ ```typescript
345
+ // Input: Org's event types
346
+ const orgEvents = [
347
+ 'course_created',
348
+ 'course_enrolled',
349
+ 'lesson_completed',
350
+ 'tokens_purchased'
351
+ ]
352
+
353
+ // Generated automatically:
354
+ 1. Metrics for each event (count, trend, change %)
355
+ 2. Time-series charts
356
+ 3. Comparison views (this month vs last month)
357
+ 4. Event log viewer
358
+ 5. Export functionality
359
+ 6. Real-time subscriptions
360
+
361
+ // Context used: 1k tokens
362
+ // Dashboard generated: Complete analytics platform
363
+ ```
364
+
365
+ ---
366
+
367
+ ## Platform Generation Matrix
368
+
369
+ ### How 66 Things Generate the Platform
370
+
371
+ | Thing Type | Generates | Example |
372
+ |------------|-----------|---------|
373
+ | `creator` | User management system | Registration, profiles, auth |
374
+ | `ai_clone` | AI assistant platform | Voice synthesis, chat, training |
375
+ | `course` | Learning management system | Courses, lessons, enrollments |
376
+ | `token` | Token economy | Wallet, transactions, staking |
377
+ | `organization` | Multi-tenant system | Org dashboard, member management |
378
+ | `strategy_agent` | Business planning tools | OKR tracking, vision boards |
379
+ | `blog_post` | Content management system | Post editor, publishing workflow |
380
+ | `livestream` | Streaming platform | RTMP ingestion, chat, recording |
381
+ | `payment` | Payment processing | Checkout, invoicing, refunds |
382
+ | `community` | Social network | Forums, discussions, messaging |
383
+
384
+ **Result:** 66 thing types × average 10 features each = **660+ platform features**
385
+
386
+ ### How 25 Connections Generate Relationships
387
+
388
+ | Connection Type | Generates | Example |
389
+ |-----------------|-----------|---------|
390
+ | `owns` | Ownership system | Asset management, permissions |
391
+ | `member_of` | Membership system | Org roles, access control |
392
+ | `enrolled_in` | Enrollment system | Course access, progress tracking |
393
+ | `following` | Social graph | Follow/unfollow, feed generation |
394
+ | `holds_tokens` | Token holdings | Wallet balance, transaction history |
395
+ | `teaching` | Teaching system | Instructor assignment, schedules |
396
+ | `transacted` | Transaction system | Payment history, receipts |
397
+ | `communicated` | Messaging system | Chat, notifications, email |
398
+
399
+ **Result:** 25 connection types × average 8 features each = **200+ relationship features**
400
+
401
+ ### How 67 Events Generate Intelligence
402
+
403
+ | Event Type | Generates | Example |
404
+ |------------|-----------|---------|
405
+ | `user_login` | Login analytics | Active users, sessions, retention |
406
+ | `course_enrolled` | Enrollment analytics | Conversion rates, popular courses |
407
+ | `tokens_purchased` | Revenue analytics | Sales, MRR, LTV |
408
+ | `inference_request` | Usage analytics | API calls, costs, quotas |
409
+ | `content_event` | Content analytics | Views, engagement, virality |
410
+ | `agent_executed` | Agent analytics | Task success rate, performance |
411
+
412
+ **Result:** 67 event types × average 5 metrics each = **335+ analytics metrics**
413
+
414
+ ---
415
+
416
+ ## Specialist AI Agent Architecture
417
+
418
+ ### 10 Agents × Focused Context = Complete Platform
419
+
420
+ #### Agent 1: **Schema Generator** (Context: 2k tokens)
421
+
422
+ **Input:** Thing types from ontology
423
+ **Output:** Complete Convex schema
424
+
425
+ ```typescript
426
+ // Reads ontology (cached, 500 tokens)
427
+ const thingTypes = ontology.things // 66 types
428
+
429
+ // Generates schema
430
+ export default defineSchema({
431
+ things: defineTable({
432
+ type: v.union(
433
+ v.literal('creator'),
434
+ v.literal('ai_clone'),
435
+ // ... all 66 types
436
+ ),
437
+ name: v.string(),
438
+ properties: v.any(),
439
+ status: v.string(),
440
+ createdAt: v.number(),
441
+ updatedAt: v.number()
442
+ })
443
+ .index('by_type', ['type'])
444
+ .index('by_status', ['status'])
445
+ .index('by_created', ['createdAt'])
446
+ .searchIndex('search_things', {
447
+ searchField: 'name',
448
+ filterFields: ['type', 'status']
449
+ }),
450
+
451
+ connections: defineTable({
452
+ fromThingId: v.id('things'),
453
+ toThingId: v.id('things'),
454
+ relationshipType: v.union(
455
+ v.literal('owns'),
456
+ v.literal('member_of'),
457
+ // ... all 25 types
458
+ ),
459
+ metadata: v.optional(v.any()),
460
+ createdAt: v.number()
461
+ })
462
+ .index('from_type', ['fromThingId', 'relationshipType'])
463
+ .index('to_type', ['toThingId', 'relationshipType']),
464
+
465
+ events: defineTable({
466
+ type: v.union(
467
+ v.literal('entity_created'),
468
+ v.literal('user_login'),
469
+ // ... all 67 types
470
+ ),
471
+ actorId: v.id('things'),
472
+ targetId: v.optional(v.id('things')),
473
+ timestamp: v.number(),
474
+ metadata: v.any()
475
+ })
476
+ .index('type_time', ['type', 'timestamp'])
477
+ .index('actor_time', ['actorId', 'timestamp']),
478
+
479
+ knowledge: defineTable({
480
+ knowledgeType: v.union(
481
+ v.literal('label'),
482
+ v.literal('document'),
483
+ v.literal('chunk'),
484
+ v.literal('vector_only')
485
+ ),
486
+ text: v.optional(v.string()),
487
+ embedding: v.optional(v.array(v.float64())),
488
+ sourceThingId: v.optional(v.id('things')),
489
+ labels: v.optional(v.array(v.string())),
490
+ metadata: v.optional(v.any()),
491
+ createdAt: v.number()
492
+ })
493
+ .index('by_type', ['knowledgeType'])
494
+ .index('by_source', ['sourceThingId'])
495
+ .vectorIndex('by_embedding', {
496
+ vectorField: 'embedding',
497
+ dimensions: 1536,
498
+ filterFields: ['sourceThingId', 'knowledgeType']
499
+ })
500
+ })
501
+
502
+ // Context used: 2k tokens
503
+ // Schema generated: Complete database
504
+ ```
505
+
506
+ #### Agent 2: **CRUD Generator** (Context: 3k tokens)
507
+
508
+ **Input:** Thing type definition
509
+ **Output:** Complete CRUD operations
510
+
511
+ ```typescript
512
+ // For each of 66 thing types, generates:
513
+
514
+ // queries/[thingType].ts
515
+ export const list = query({
516
+ args: {
517
+ organizationId: v.optional(v.id('things')),
518
+ limit: v.optional(v.number())
519
+ },
520
+ handler: async (ctx, { organizationId, limit = 20 }) => {
521
+ let q = ctx.db.query('things').withIndex('by_type', q =>
522
+ q.eq('type', 'course') // Example: course
523
+ )
524
+
525
+ if (organizationId) {
526
+ q = q.filter(q => q.eq(q.field('properties.organizationId'), organizationId))
527
+ }
528
+
529
+ return await q.take(limit)
530
+ }
531
+ })
532
+
533
+ export const get = query({
534
+ args: { id: v.id('things') },
535
+ handler: async (ctx, { id }) => {
536
+ return await ctx.db.get(id)
537
+ }
538
+ })
539
+
540
+ // mutations/[thingType].ts
541
+ export const create = mutation({
542
+ args: {
543
+ name: v.string(),
544
+ properties: v.any(),
545
+ organizationId: v.optional(v.id('things'))
546
+ },
547
+ handler: async (ctx, args) => {
548
+ // Validate user permission
549
+ const user = await getCurrentUser(ctx)
550
+ if (!user) throw new Error('Unauthorized')
551
+
552
+ // Create thing
553
+ const id = await ctx.db.insert('things', {
554
+ type: 'course', // Example: course
555
+ name: args.name,
556
+ properties: {
557
+ ...args.properties,
558
+ organizationId: args.organizationId,
559
+ createdBy: user._id
560
+ },
561
+ status: 'active',
562
+ createdAt: Date.now(),
563
+ updatedAt: Date.now()
564
+ })
565
+
566
+ // Create ownership connection
567
+ if (args.organizationId) {
568
+ await ctx.db.insert('connections', {
569
+ fromThingId: args.organizationId,
570
+ toThingId: id,
571
+ relationshipType: 'owns',
572
+ createdAt: Date.now()
573
+ })
574
+ }
575
+
576
+ // Log event
577
+ await ctx.db.insert('events', {
578
+ type: 'entity_created',
579
+ actorId: user._id,
580
+ targetId: id,
581
+ timestamp: Date.now(),
582
+ metadata: { thingType: 'course' }
583
+ })
584
+
585
+ return id
586
+ }
587
+ })
588
+
589
+ // Repeat for all 66 thing types
590
+ // Context per type: 3k tokens
591
+ // Total generated: 66 × 4 operations = 264 database operations
592
+ ```
593
+
594
+ #### Agent 3: **Component Generator** (Context: 4k tokens)
595
+
596
+ **Input:** Thing type + display fields
597
+ **Output:** React/Astro components
598
+
599
+ ```typescript
600
+ // For 'course' thing type, generates:
601
+
602
+ // components/cards/CourseCard.tsx
603
+ interface CourseCardProps {
604
+ courseId: Id<'things'>
605
+ }
606
+
607
+ export function CourseCard({ courseId }: CourseCardProps) {
608
+ const course = useQuery(api.queries.course.get, { id: courseId })
609
+ const creator = useQuery(api.queries.connections.getCreator, { courseId })
610
+
611
+ if (!course) return <Skeleton />
612
+
613
+ return (
614
+ <div className="card">
615
+ <img
616
+ src={course.properties.thumbnail || '/placeholder.jpg'}
617
+ alt={course.name}
618
+ className="w-full h-48 object-cover"
619
+ />
620
+ <div className="p-4">
621
+ <h3 className="text-xl font-bold">{course.name}</h3>
622
+ <p className="text-gray-600">{course.properties.description}</p>
623
+
624
+ {creator && (
625
+ <div className="flex items-center mt-2">
626
+ <img src={creator.properties.avatar} className="w-8 h-8 rounded-full" />
627
+ <span className="ml-2 text-sm">{creator.name}</span>
628
+ </div>
629
+ )}
630
+
631
+ <div className="flex items-center justify-between mt-4">
632
+ <span className="text-2xl font-bold">${course.properties.price}</span>
633
+ <EnrollButton courseId={courseId} />
634
+ </div>
635
+
636
+ <div className="flex gap-2 mt-2">
637
+ <Badge>{course.properties.modules} modules</Badge>
638
+ <Badge>{course.properties.lessons} lessons</Badge>
639
+ <Badge>{course.properties.enrollments} students</Badge>
640
+ </div>
641
+ </div>
642
+ </div>
643
+ )
644
+ }
645
+
646
+ // components/lists/CourseList.tsx
647
+ export function CourseList({ organizationId }: { organizationId?: Id<'things'> }) {
648
+ const courses = useQuery(api.queries.course.list, { organizationId, limit: 20 })
649
+
650
+ return (
651
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
652
+ {courses?.map(course => (
653
+ <CourseCard key={course._id} courseId={course._id} />
654
+ ))}
655
+ </div>
656
+ )
657
+ }
658
+
659
+ // pages/courses/[id].astro
660
+ ---
661
+ import { ConvexHttpClient } from 'convex/browser'
662
+ import Layout from '@/layouts/Layout.astro'
663
+ import CourseDetail from '@/components/CourseDetail.tsx'
664
+
665
+ const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL)
666
+ const course = await convex.query(api.queries.course.get, {
667
+ id: Astro.params.id
668
+ })
669
+ ---
670
+
671
+ <Layout title={course.name}>
672
+ <CourseDetail client:load courseId={course._id} />
673
+ </Layout>
674
+
675
+ // Repeat for all 66 thing types
676
+ // Context per type: 4k tokens
677
+ // Total generated: 66 × 3 components = 198 UI components
678
+ ```
679
+
680
+ #### Agent 4: **Connection Manager** (Context: 2k tokens)
681
+
682
+ **Input:** Connection type
683
+ **Output:** Relationship management UI
684
+
685
+ ```typescript
686
+ // For 'enrolled_in' connection, generates:
687
+
688
+ // components/EnrollButton.tsx
689
+ export function EnrollButton({ courseId }: { courseId: Id<'things'> }) {
690
+ const user = useCurrentUser()
691
+ const enroll = useMutation(api.mutations.enrollment.create)
692
+
693
+ // Check if already enrolled
694
+ const enrollment = useQuery(api.queries.connections.checkEnrollment, {
695
+ userId: user?._id,
696
+ courseId
697
+ })
698
+
699
+ if (enrollment) {
700
+ return (
701
+ <Link href={`/courses/${courseId}/learn`}>
702
+ <Button>Continue Learning</Button>
703
+ </Link>
704
+ )
705
+ }
706
+
707
+ return (
708
+ <Button onClick={() => enroll({ userId: user._id, courseId })}>
709
+ Enroll Now
710
+ </Button>
711
+ )
712
+ }
713
+
714
+ // queries/connections/enrollment.ts
715
+ export const checkEnrollment = query({
716
+ args: { userId: v.id('things'), courseId: v.id('things') },
717
+ handler: async (ctx, { userId, courseId }) => {
718
+ return await ctx.db
719
+ .query('connections')
720
+ .withIndex('from_type', q =>
721
+ q.eq('fromThingId', userId)
722
+ .eq('toThingId', courseId)
723
+ .eq('relationshipType', 'enrolled_in')
724
+ )
725
+ .first()
726
+ }
727
+ })
728
+
729
+ // mutations/enrollment.ts
730
+ export const create = mutation({
731
+ args: { userId: v.id('things'), courseId: v.id('things') },
732
+ handler: async (ctx, { userId, courseId }) => {
733
+ // Create connection
734
+ const connId = await ctx.db.insert('connections', {
735
+ fromThingId: userId,
736
+ toThingId: courseId,
737
+ relationshipType: 'enrolled_in',
738
+ metadata: { progress: 0, enrolledAt: Date.now() },
739
+ createdAt: Date.now()
740
+ })
741
+
742
+ // Log event
743
+ await ctx.db.insert('events', {
744
+ type: 'course_enrolled',
745
+ actorId: userId,
746
+ targetId: courseId,
747
+ timestamp: Date.now(),
748
+ metadata: { connectionId: connId }
749
+ })
750
+
751
+ return connId
752
+ }
753
+ })
754
+
755
+ // Repeat for all 25 connection types
756
+ // Context per type: 2k tokens
757
+ // Total generated: 25 × 3 operations = 75 relationship features
758
+ ```
759
+
760
+ #### Agent 5: **Analytics Generator** (Context: 3k tokens)
761
+
762
+ **Input:** Event types for org
763
+ **Output:** Complete analytics dashboard
764
+
765
+ ```typescript
766
+ // Analyzes events for organization and generates:
767
+
768
+ // queries/analytics/courseMetrics.ts
769
+ export const getCourseMetrics = query({
770
+ args: {
771
+ organizationId: v.id('things'),
772
+ period: v.union(v.literal('7d'), v.literal('30d'), v.literal('90d'))
773
+ },
774
+ handler: async (ctx, { organizationId, period }) => {
775
+ const since = Date.now() - getPeriodMs(period)
776
+
777
+ // Count course creations
778
+ const coursesCreated = await ctx.db
779
+ .query('events')
780
+ .withIndex('type_time', q =>
781
+ q.eq('type', 'course_created').gte('timestamp', since)
782
+ )
783
+ .filter(q => q.eq(q.field('metadata.organizationId'), organizationId))
784
+ .collect()
785
+ .then(events => events.length)
786
+
787
+ // Count enrollments
788
+ const enrollments = await ctx.db
789
+ .query('events')
790
+ .withIndex('type_time', q =>
791
+ q.eq('type', 'course_enrolled').gte('timestamp', since)
792
+ )
793
+ .filter(q => q.eq(q.field('metadata.organizationId'), organizationId))
794
+ .collect()
795
+ .then(events => events.length)
796
+
797
+ // Count completions
798
+ const completions = await ctx.db
799
+ .query('events')
800
+ .withIndex('type_time', q =>
801
+ q.eq('type', 'course_completed').gte('timestamp', since)
802
+ )
803
+ .filter(q => q.eq(q.field('metadata.organizationId'), organizationId))
804
+ .collect()
805
+ .then(events => events.length)
806
+
807
+ // Calculate completion rate
808
+ const completionRate = enrollments > 0
809
+ ? (completions / enrollments) * 100
810
+ : 0
811
+
812
+ return {
813
+ coursesCreated,
814
+ enrollments,
815
+ completions,
816
+ completionRate,
817
+ period
818
+ }
819
+ }
820
+ })
821
+
822
+ // components/analytics/CourseMetricsDashboard.tsx
823
+ export function CourseMetricsDashboard({ orgId }: { orgId: Id<'things'> }) {
824
+ const metrics = useQuery(api.queries.analytics.getCourseMetrics, {
825
+ organizationId: orgId,
826
+ period: '30d'
827
+ })
828
+
829
+ if (!metrics) return <Skeleton />
830
+
831
+ return (
832
+ <div className="grid grid-cols-4 gap-4">
833
+ <MetricCard
834
+ title="Courses Created"
835
+ value={metrics.coursesCreated}
836
+ icon={<BookIcon />}
837
+ />
838
+ <MetricCard
839
+ title="Total Enrollments"
840
+ value={metrics.enrollments}
841
+ icon={<UsersIcon />}
842
+ />
843
+ <MetricCard
844
+ title="Completions"
845
+ value={metrics.completions}
846
+ icon={<CheckIcon />}
847
+ />
848
+ <MetricCard
849
+ title="Completion Rate"
850
+ value={`${metrics.completionRate.toFixed(1)}%`}
851
+ icon={<TrendingUpIcon />}
852
+ />
853
+ </div>
854
+ )
855
+ }
856
+
857
+ // Repeat for all relevant event types
858
+ // Context: 3k tokens
859
+ // Total generated: Complete analytics platform
860
+ ```
861
+
862
+ #### Agent 6: **Knowledge Manager** (Context: 3k tokens)
863
+
864
+ **Input:** Thing with text content
865
+ **Output:** Embeddings + semantic search
866
+
867
+ ```typescript
868
+ // actions/knowledge/embed.ts
869
+ export const embedThing = internalAction({
870
+ args: { thingId: v.id('things'), fields: v.array(v.string()) },
871
+ handler: async (ctx, { thingId, fields }) => {
872
+ // Get thing
873
+ const thing = await ctx.runQuery(internal.queries.things.get, { id: thingId })
874
+ if (!thing) return
875
+
876
+ // Extract text from specified fields
877
+ const texts = fields.map(field => thing.properties[field]).filter(Boolean)
878
+ const fullText = texts.join('\n\n')
879
+
880
+ // Chunk text (800 tokens per chunk, 200 overlap)
881
+ const chunks = chunkText(fullText, { size: 800, overlap: 200 })
882
+
883
+ // Embed each chunk
884
+ for (const [index, chunk] of chunks.entries()) {
885
+ // Generate embedding
886
+ const embedding = await embed(chunk.text) // OpenAI API call
887
+
888
+ // Create knowledge chunk
889
+ const knowledgeId = await ctx.runMutation(internal.mutations.knowledge.create, {
890
+ knowledgeType: 'chunk',
891
+ text: chunk.text,
892
+ embedding,
893
+ embeddingModel: 'text-embedding-3-large',
894
+ embeddingDim: 1536,
895
+ sourceThingId: thingId,
896
+ sourceField: fields.join(','),
897
+ chunk: { index, tokenCount: chunk.tokens, overlap: 200 },
898
+ labels: extractLabels(thing), // e.g., ['skill:fitness', 'format:video']
899
+ createdAt: Date.now()
900
+ })
901
+
902
+ // Link thing to knowledge
903
+ await ctx.runMutation(internal.mutations.thingKnowledge.create, {
904
+ thingId,
905
+ knowledgeId,
906
+ role: 'chunk_of',
907
+ createdAt: Date.now()
908
+ })
909
+ }
910
+ }
911
+ })
912
+
913
+ // queries/knowledge/search.ts
914
+ export const semanticSearch = query({
915
+ args: {
916
+ query: v.string(),
917
+ organizationId: v.optional(v.id('things')),
918
+ thingType: v.optional(v.string()),
919
+ limit: v.optional(v.number())
920
+ },
921
+ handler: async (ctx, { query, organizationId, thingType, limit = 10 }) => {
922
+ // Generate query embedding
923
+ const queryEmbedding = await embed(query)
924
+
925
+ // Vector search
926
+ const results = await ctx.vectorSearch('knowledge', 'by_embedding', {
927
+ vector: queryEmbedding,
928
+ limit,
929
+ filter: q => {
930
+ let filter = q.eq(q.field('knowledgeType'), 'chunk')
931
+
932
+ if (organizationId) {
933
+ filter = filter.eq(q.field('sourceThingId.properties.organizationId'), organizationId)
934
+ }
935
+
936
+ if (thingType) {
937
+ filter = filter.eq(q.field('sourceThingId.type'), thingType)
938
+ }
939
+
940
+ return filter
941
+ }
942
+ })
943
+
944
+ // Hydrate with source things
945
+ const chunks = await Promise.all(
946
+ results.map(async result => ({
947
+ knowledge: result,
948
+ thing: await ctx.db.get(result.sourceThingId),
949
+ score: result._score
950
+ }))
951
+ )
952
+
953
+ return chunks
954
+ }
955
+ })
956
+
957
+ // Auto-embed on content creation
958
+ export const onThingCreated = internalMutation({
959
+ args: { thingId: v.id('things') },
960
+ handler: async (ctx, { thingId }) => {
961
+ const thing = await ctx.db.get(thingId)
962
+
963
+ // Determine fields to embed based on thing type
964
+ const fieldsToEmbed = {
965
+ 'course': ['title', 'description', 'content'],
966
+ 'blog_post': ['title', 'content'],
967
+ 'video': ['title', 'description', 'transcript'],
968
+ 'lesson': ['title', 'content'],
969
+ // ... etc for all content types
970
+ }
971
+
972
+ const fields = fieldsToEmbed[thing.type]
973
+ if (fields) {
974
+ await ctx.scheduler.runAfter(0, internal.actions.knowledge.embed, {
975
+ thingId,
976
+ fields
977
+ })
978
+ }
979
+ }
980
+ })
981
+
982
+ // Context: 3k tokens
983
+ // Generated: Complete RAG pipeline
984
+ ```
985
+
986
+ #### Agent 7: **Website Generator** (Context: 4k tokens)
987
+
988
+ **Input:** Organization + template choice
989
+ **Output:** Complete website
990
+
991
+ ```typescript
992
+ // actions/website/generate.ts
993
+ export const generateWebsite = internalAction({
994
+ args: {
995
+ organizationId: v.id('things'),
996
+ template: v.union(v.literal('minimal'), v.literal('showcase'), v.literal('portfolio'))
997
+ },
998
+ handler: async (ctx, { organizationId, template }) => {
999
+ // Get organization
1000
+ const org = await ctx.runQuery(internal.queries.orgs.get, { id: organizationId })
1001
+
1002
+ // Get org's creators
1003
+ const creators = await ctx.runQuery(internal.queries.things.list, {
1004
+ type: 'creator',
1005
+ organizationId,
1006
+ limit: 100
1007
+ })
1008
+
1009
+ // Get org's content (courses, posts, etc.)
1010
+ const courses = await ctx.runQuery(internal.queries.things.list, {
1011
+ type: 'course',
1012
+ organizationId,
1013
+ limit: 50
1014
+ })
1015
+
1016
+ const posts = await ctx.runQuery(internal.queries.things.list, {
1017
+ type: 'blog_post',
1018
+ organizationId,
1019
+ limit: 50
1020
+ })
1021
+
1022
+ // Generate pages based on template
1023
+ const pages = []
1024
+
1025
+ // 1. Homepage
1026
+ pages.push({
1027
+ path: '/index.astro',
1028
+ content: generateHomepage(org, creators, { template })
1029
+ })
1030
+
1031
+ // 2. About page
1032
+ pages.push({
1033
+ path: '/about.astro',
1034
+ content: generateAboutPage(org, creators)
1035
+ })
1036
+
1037
+ // 3. Courses page + individual course pages
1038
+ pages.push({
1039
+ path: '/courses/index.astro',
1040
+ content: generateCoursesPage(courses)
1041
+ })
1042
+
1043
+ for (const course of courses) {
1044
+ pages.push({
1045
+ path: `/courses/${course._id}.astro`,
1046
+ content: generateCoursePage(course)
1047
+ })
1048
+ }
1049
+
1050
+ // 4. Blog page + individual post pages
1051
+ pages.push({
1052
+ path: '/blog/index.astro',
1053
+ content: generateBlogPage(posts)
1054
+ })
1055
+
1056
+ for (const post of posts) {
1057
+ pages.push({
1058
+ path: `/blog/${post._id}.astro`,
1059
+ content: generatePostPage(post)
1060
+ })
1061
+ }
1062
+
1063
+ // 5. Creator pages
1064
+ for (const creator of creators) {
1065
+ pages.push({
1066
+ path: `/creators/${creator._id}.astro`,
1067
+ content: generateCreatorPage(creator)
1068
+ })
1069
+ }
1070
+
1071
+ // Deploy to Cloudflare Pages
1072
+ await deployToCloudflare(pages, {
1073
+ domain: `${org.properties.slug}.one.ie`,
1074
+ orgId: organizationId
1075
+ })
1076
+
1077
+ // Update org website status
1078
+ await ctx.runMutation(internal.mutations.orgs.update, {
1079
+ id: organizationId,
1080
+ properties: {
1081
+ ...org.properties,
1082
+ websiteUrl: `https://${org.properties.slug}.one.ie`,
1083
+ websiteLastDeployed: Date.now()
1084
+ }
1085
+ })
1086
+
1087
+ return {
1088
+ success: true,
1089
+ url: `https://${org.properties.slug}.one.ie`,
1090
+ pagesGenerated: pages.length
1091
+ }
1092
+ }
1093
+ })
1094
+
1095
+ function generateHomepage(org, creators, { template }) {
1096
+ // Template-specific homepage generation
1097
+ const templates = {
1098
+ minimal: `
1099
+ ---
1100
+ import Layout from '@/layouts/Layout.astro'
1101
+ import Hero from '@/components/Hero.astro'
1102
+ import CreatorGrid from '@/components/CreatorGrid.tsx'
1103
+
1104
+ const creators = ${JSON.stringify(creators)}
1105
+ ---
1106
+
1107
+ <Layout title="${org.name}">
1108
+ <Hero
1109
+ title="${org.name}"
1110
+ subtitle="${org.properties.description}"
1111
+ cta="Get Started"
1112
+ ctaLink="/courses"
1113
+ />
1114
+
1115
+ <section class="py-16">
1116
+ <h2 class="text-3xl font-bold mb-8">Our Creators</h2>
1117
+ <CreatorGrid client:load creators={creators} />
1118
+ </section>
1119
+ </Layout>
1120
+ `,
1121
+ showcase: `
1122
+ // ... full showcase template with more sections
1123
+ `,
1124
+ portfolio: `
1125
+ // ... portfolio template with projects
1126
+ `
1127
+ }
1128
+
1129
+ return templates[template] || templates.minimal
1130
+ }
1131
+
1132
+ // Context: 4k tokens
1133
+ // Generated: Complete multi-page website
1134
+ ```
1135
+
1136
+ #### Agent 8: **Protocol Handler** (Context: 4k tokens)
1137
+
1138
+ **Input:** External protocol message
1139
+ **Output:** Ontology translation + execution
1140
+
1141
+ ```typescript
1142
+ // A2A Protocol: Agent-to-Agent communication
1143
+ export const handleA2AMessage = internalAction({
1144
+ args: { message: v.any() },
1145
+ handler: async (ctx, { message }) => {
1146
+ // Detect protocol
1147
+ if (message.protocol !== 'a2a') return
1148
+
1149
+ // Parse task delegation
1150
+ const task = message.task // e.g., "research_market_trends"
1151
+ const params = message.parameters // e.g., { industry: 'fitness' }
1152
+
1153
+ // Find appropriate internal agent
1154
+ const agent = await ctx.runQuery(internal.queries.things.findAgent, {
1155
+ agentType: 'research_agent'
1156
+ })
1157
+
1158
+ // Execute agent
1159
+ const result = await ctx.runAction(internal.actions.agents.execute, {
1160
+ agentId: agent._id,
1161
+ task,
1162
+ params
1163
+ })
1164
+
1165
+ // Log communication event
1166
+ await ctx.runMutation(internal.mutations.events.create, {
1167
+ type: 'communication_event',
1168
+ actorId: message.fromAgentId,
1169
+ targetId: agent._id,
1170
+ timestamp: Date.now(),
1171
+ metadata: {
1172
+ protocol: 'a2a',
1173
+ messageType: 'task_delegation',
1174
+ task,
1175
+ result
1176
+ }
1177
+ })
1178
+
1179
+ return result
1180
+ }
1181
+ })
1182
+
1183
+ // ACP Protocol: Agentic Commerce
1184
+ export const handleACPPurchase = internalAction({
1185
+ args: { purchase: v.any() },
1186
+ handler: async (ctx, { purchase }) => {
1187
+ // Translate ACP purchase to ontology
1188
+
1189
+ // 1. Create payment thing
1190
+ const paymentId = await ctx.runMutation(internal.mutations.things.create, {
1191
+ type: 'payment',
1192
+ name: `Payment for ${purchase.productName}`,
1193
+ properties: {
1194
+ amount: purchase.amount,
1195
+ currency: purchase.currency,
1196
+ protocol: 'acp',
1197
+ agentPlatform: purchase.agentPlatform, // e.g., 'chatgpt'
1198
+ status: 'pending'
1199
+ }
1200
+ })
1201
+
1202
+ // 2. Create connection (user transacted with product)
1203
+ await ctx.runMutation(internal.mutations.connections.create, {
1204
+ fromThingId: purchase.userId,
1205
+ toThingId: purchase.productId,
1206
+ relationshipType: 'transacted',
1207
+ metadata: {
1208
+ protocol: 'acp',
1209
+ transactionType: 'purchase',
1210
+ amount: purchase.amount,
1211
+ paymentId
1212
+ }
1213
+ })
1214
+
1215
+ // 3. Log commerce event
1216
+ await ctx.runMutation(internal.mutations.events.create, {
1217
+ type: 'commerce_event',
1218
+ actorId: purchase.userId,
1219
+ targetId: paymentId,
1220
+ timestamp: Date.now(),
1221
+ metadata: {
1222
+ protocol: 'acp',
1223
+ eventType: 'purchase_initiated',
1224
+ agentPlatform: purchase.agentPlatform,
1225
+ productId: purchase.productId
1226
+ }
1227
+ })
1228
+
1229
+ return { success: true, paymentId }
1230
+ }
1231
+ })
1232
+
1233
+ // AP2 Protocol: Agent Payments (Intent/Cart Mandates)
1234
+ export const handleAP2Mandate = internalAction({
1235
+ args: { mandate: v.any() },
1236
+ handler: async (ctx, { mandate }) => {
1237
+ // Create mandate thing
1238
+ const mandateId = await ctx.runMutation(internal.mutations.things.create, {
1239
+ type: 'mandate',
1240
+ name: `${mandate.mandateType} mandate`,
1241
+ properties: {
1242
+ mandateType: mandate.type, // 'intent' or 'cart'
1243
+ intent: mandate.intent, // Intent description
1244
+ items: mandate.items, // Cart items
1245
+ subtotal: mandate.subtotal,
1246
+ total: mandate.total,
1247
+ status: 'pending',
1248
+ protocol: 'ap2',
1249
+ autoExecute: mandate.autoExecute
1250
+ }
1251
+ })
1252
+
1253
+ // Log mandate event
1254
+ await ctx.runMutation(internal.mutations.events.create, {
1255
+ type: 'mandate_event',
1256
+ actorId: mandate.userId,
1257
+ targetId: mandateId,
1258
+ timestamp: Date.now(),
1259
+ metadata: {
1260
+ protocol: 'ap2',
1261
+ mandateType: mandate.type
1262
+ }
1263
+ })
1264
+
1265
+ // If auto-execute intent, trigger price checking
1266
+ if (mandate.autoExecute && mandate.type === 'intent') {
1267
+ await ctx.scheduler.runAfter(0, internal.actions.ap2.checkPrices, {
1268
+ mandateId
1269
+ })
1270
+ }
1271
+
1272
+ return { success: true, mandateId }
1273
+ }
1274
+ })
1275
+
1276
+ // X402 Protocol: HTTP Micropayments
1277
+ export const handleX402Payment = internalAction({
1278
+ args: { payment: v.any() },
1279
+ handler: async (ctx, { payment }) => {
1280
+ // Verify blockchain transaction
1281
+ const verified = await verifyBlockchainTx(
1282
+ payment.txHash,
1283
+ payment.network // 'base', 'sui', 'solana'
1284
+ )
1285
+
1286
+ if (!verified) {
1287
+ throw new Error('Payment verification failed')
1288
+ }
1289
+
1290
+ // Create payment thing
1291
+ const paymentId = await ctx.runMutation(internal.mutations.things.create, {
1292
+ type: 'payment',
1293
+ name: `X402 payment`,
1294
+ properties: {
1295
+ amount: payment.amount,
1296
+ protocol: 'x402',
1297
+ network: payment.network,
1298
+ txHash: payment.txHash,
1299
+ status: 'completed'
1300
+ }
1301
+ })
1302
+
1303
+ // Log payment event
1304
+ await ctx.runMutation(internal.mutations.events.create, {
1305
+ type: 'payment_event',
1306
+ actorId: payment.userId,
1307
+ targetId: paymentId,
1308
+ timestamp: Date.now(),
1309
+ metadata: {
1310
+ protocol: 'x402',
1311
+ status: 'verified',
1312
+ network: payment.network,
1313
+ txHash: payment.txHash
1314
+ }
1315
+ })
1316
+
1317
+ // Grant access to resource
1318
+ await ctx.runMutation(internal.mutations.connections.create, {
1319
+ fromThingId: payment.userId,
1320
+ toThingId: payment.resourceId,
1321
+ relationshipType: 'purchased',
1322
+ metadata: {
1323
+ protocol: 'x402',
1324
+ paymentId
1325
+ }
1326
+ })
1327
+
1328
+ return { success: true, paymentId }
1329
+ }
1330
+ })
1331
+
1332
+ // Context: 4k tokens
1333
+ // Generated: Complete protocol integration layer
1334
+ ```
1335
+
1336
+ ---
1337
+
1338
+ ## Complete Examples
1339
+
1340
+ ### Example 1: Building a Learning Platform from Scratch
1341
+
1342
+ **Input:** "Build a learning platform for fitness creators"
1343
+
1344
+ **Agent Orchestration:**
1345
+
1346
+ ```typescript
1347
+ // Step 1: Ontology Agent parses intent
1348
+ const intent = {
1349
+ platform: 'learning',
1350
+ niche: 'fitness',
1351
+ thingTypes: ['creator', 'course', 'lesson', 'ai_clone', 'membership'],
1352
+ connections: ['owns', 'enrolled_in', 'teaching', 'completed'],
1353
+ events: ['course_created', 'course_enrolled', 'lesson_completed', 'course_completed']
1354
+ }
1355
+
1356
+ // Step 2: Schema Agent generates database
1357
+ await schemaAgent.generate({
1358
+ things: ['creator', 'course', 'lesson', 'ai_clone', 'membership'],
1359
+ connections: ['owns', 'enrolled_in', 'teaching', 'completed'],
1360
+ events: ['course_created', 'course_enrolled', 'lesson_completed', 'course_completed']
1361
+ })
1362
+ // Output: Complete Convex schema with indexes
1363
+
1364
+ // Step 3: CRUD Agent generates operations
1365
+ for (const type of intent.thingTypes) {
1366
+ await crudAgent.generate(type)
1367
+ }
1368
+ // Output: 5 types × 4 operations = 20 database functions
1369
+
1370
+ // Step 4: Component Agent generates UI
1371
+ for (const type of intent.thingTypes) {
1372
+ await componentAgent.generate({
1373
+ thingType: type,
1374
+ variants: ['card', 'list', 'detail', 'form']
1375
+ })
1376
+ }
1377
+ // Output: 5 types × 4 variants = 20 React components
1378
+
1379
+ // Step 5: Connection Agent generates relationships
1380
+ for (const conn of intent.connections) {
1381
+ await connectionAgent.generate(conn)
1382
+ }
1383
+ // Output: 4 connection types × 3 features = 12 relationship features
1384
+
1385
+ // Step 6: Analytics Agent generates dashboards
1386
+ await analyticsAgent.generate({
1387
+ eventTypes: intent.events,
1388
+ organizationId: org._id
1389
+ })
1390
+ // Output: Complete analytics dashboard with 4 metrics
1391
+
1392
+ // Step 7: Website Agent generates marketing site
1393
+ await websiteAgent.generate({
1394
+ organizationId: org._id,
1395
+ template: 'showcase',
1396
+ features: intent.thingTypes
1397
+ })
1398
+ // Output: Complete website at fitness.one.ie
1399
+
1400
+ // Total context used: 2k + 2k + 15k + 20k + 8k + 12k + 16k = 75k tokens
1401
+ // vs Monolithic AI: 500k+ tokens
1402
+
1403
+ // Total features generated:
1404
+ // - 20 database operations
1405
+ // - 20 UI components
1406
+ // - 12 relationship features
1407
+ // - 4 analytics metrics
1408
+ // - 1 complete website
1409
+ // = 57 features from 5 thing types
1410
+ ```
1411
+
1412
+ ### Example 2: Adding Token Economy
1413
+
1414
+ **Input:** "Add token rewards to the learning platform"
1415
+
1416
+ **Agent Orchestration:**
1417
+
1418
+ ```typescript
1419
+ // Step 1: Ontology Agent identifies additions
1420
+ const additions = {
1421
+ thingTypes: ['token', 'token_contract'],
1422
+ connections: ['holds_tokens', 'earned_from'],
1423
+ events: ['tokens_purchased', 'tokens_earned', 'tokens_transferred']
1424
+ }
1425
+
1426
+ // Step 2: Schema Agent updates schema
1427
+ await schemaAgent.update({
1428
+ addThingTypes: ['token', 'token_contract'],
1429
+ addConnectionTypes: ['holds_tokens', 'earned_from'],
1430
+ addEventTypes: ['tokens_purchased', 'tokens_earned', 'tokens_transferred']
1431
+ })
1432
+ // Output: Schema migration (non-breaking, additive)
1433
+
1434
+ // Step 3: CRUD Agent generates token operations
1435
+ await crudAgent.generate('token')
1436
+ await crudAgent.generate('token_contract')
1437
+ // Output: 8 new database functions
1438
+
1439
+ // Step 4: Component Agent generates token UI
1440
+ await componentAgent.generate({
1441
+ thingType: 'token',
1442
+ variants: ['wallet', 'transaction-history', 'buy-tokens']
1443
+ })
1444
+ // Output: Wallet component, transaction list, purchase flow
1445
+
1446
+ // Step 5: Connection Agent generates token relationships
1447
+ await connectionAgent.generate('holds_tokens')
1448
+ await connectionAgent.generate('earned_from')
1449
+ // Output: Token balance tracking, earning history
1450
+
1451
+ // Step 6: Add reward logic to existing events
1452
+ await mutationAgent.enhance('course_completed', {
1453
+ afterCreate: async (ctx, { userId, courseId }) => {
1454
+ // Award tokens on completion
1455
+ const rewardAmount = 100
1456
+
1457
+ // Update user's token balance
1458
+ const holdingConn = await ctx.db
1459
+ .query('connections')
1460
+ .withIndex('from_type', q =>
1461
+ q.eq('fromThingId', userId)
1462
+ .eq('relationshipType', 'holds_tokens')
1463
+ )
1464
+ .first()
1465
+
1466
+ if (holdingConn) {
1467
+ await ctx.db.patch(holdingConn._id, {
1468
+ metadata: {
1469
+ ...holdingConn.metadata,
1470
+ balance: (holdingConn.metadata.balance || 0) + rewardAmount
1471
+ }
1472
+ })
1473
+ }
1474
+
1475
+ // Log token earned event
1476
+ await ctx.db.insert('events', {
1477
+ type: 'tokens_earned',
1478
+ actorId: userId,
1479
+ targetId: courseId,
1480
+ timestamp: Date.now(),
1481
+ metadata: {
1482
+ amount: rewardAmount,
1483
+ reason: 'course_completed'
1484
+ }
1485
+ })
1486
+ }
1487
+ })
1488
+
1489
+ // Step 7: Analytics Agent adds token metrics
1490
+ await analyticsAgent.addMetrics({
1491
+ 'tokens_earned': 'Total tokens earned',
1492
+ 'tokens_purchased': 'Total tokens purchased',
1493
+ 'token_holders': 'Unique token holders'
1494
+ })
1495
+
1496
+ // Total context used: 2k + 2k + 6k + 12k + 6k + 4k + 3k = 35k tokens
1497
+ // Features added: Complete token economy
1498
+ // Changes to existing code: Minimal (event enhancement only)
1499
+ ```
1500
+
1501
+ ### Example 3: Generating Custom Org Website
1502
+
1503
+ **Input:** Organization "FitnessPro" wants website
1504
+
1505
+ **Execution:**
1506
+
1507
+ ```typescript
1508
+ // Organization data:
1509
+ const org = {
1510
+ _id: 'org_123',
1511
+ name: 'FitnessPro',
1512
+ slug: 'fitnesspro',
1513
+ properties: {
1514
+ description: 'Elite fitness coaching and courses',
1515
+ template: 'showcase',
1516
+ logo: 'https://...',
1517
+ colors: {
1518
+ primary: '#10b981',
1519
+ secondary: '#059669',
1520
+ accent: '#34d399'
1521
+ }
1522
+ }
1523
+ }
1524
+
1525
+ // Step 1: Query org's content
1526
+ const creators = await db.query('things')
1527
+ .withIndex('by_type', q => q.eq('type', 'creator'))
1528
+ .filter(q => q.eq(q.field('properties.organizationId'), org._id))
1529
+ .collect()
1530
+ // Result: 3 fitness coaches
1531
+
1532
+ const courses = await db.query('things')
1533
+ .withIndex('by_type', q => q.eq('type', 'course'))
1534
+ .filter(q => q.eq(q.field('properties.organizationId'), org._id))
1535
+ .collect()
1536
+ // Result: 12 fitness courses
1537
+
1538
+ const posts = await db.query('things')
1539
+ .withIndex('by_type', q => q.eq('type', 'blog_post'))
1540
+ .filter(q => q.eq(q.field('properties.organizationId'), org._id))
1541
+ .collect()
1542
+ // Result: 24 blog posts
1543
+
1544
+ // Step 2: Website Agent generates pages
1545
+ const website = await websiteAgent.generate({
1546
+ org,
1547
+ creators, // 3 coaches
1548
+ courses, // 12 courses
1549
+ posts, // 24 posts
1550
+ template: 'showcase'
1551
+ })
1552
+
1553
+ // Generated pages:
1554
+ // - /index.astro (homepage with hero + features)
1555
+ // - /about.astro (about FitnessPro)
1556
+ // - /coaches/index.astro (coach directory)
1557
+ // - /coaches/[coach1].astro
1558
+ // - /coaches/[coach2].astro
1559
+ // - /coaches/[coach3].astro
1560
+ // - /courses/index.astro (course catalog)
1561
+ // - /courses/[course1].astro (12 course pages)
1562
+ // - ...
1563
+ // - /blog/index.astro (blog listing)
1564
+ // - /blog/[post1].astro (24 post pages)
1565
+ // - ...
1566
+ // Total: 44 pages generated
1567
+
1568
+ // Step 3: Deploy to Cloudflare
1569
+ await deployToCloudflare(website.pages, {
1570
+ domain: 'fitnesspro.one.ie',
1571
+ orgId: org._id,
1572
+ env: {
1573
+ PUBLIC_CONVEX_URL: process.env.CONVEX_URL,
1574
+ PUBLIC_ORG_ID: org._id
1575
+ }
1576
+ })
1577
+
1578
+ // Result: https://fitnesspro.one.ie is live
1579
+ // - Real-time data from Convex
1580
+ // - Components auto-update when content changes
1581
+ // - Multi-page website from 39 things (3 creators + 12 courses + 24 posts)
1582
+ // - Context used: 16k tokens
1583
+ // - Time: <30 seconds
1584
+ ```
1585
+
1586
+ ---
1587
+
1588
+ ## Summary: The Complete Generation System
1589
+
1590
+ ### Input → Output Matrix
1591
+
1592
+ | Input | Context | Output | Example |
1593
+ |-------|---------|--------|---------|
1594
+ | 1 thing type | 3k tokens | 4 CRUD ops + 4 components + analytics | `course` → full course management |
1595
+ | 1 connection type | 2k tokens | 3 relationship features + UI | `enrolled_in` → enrollment system |
1596
+ | 1 event type | 1k tokens | 1 metric + logging + history | `course_enrolled` → enrollment tracking |
1597
+ | 1 organization | 16k tokens | Complete website | FitnessPro → fitnesspro.one.ie |
1598
+
1599
+ ### Platform Generation Formula
1600
+
1601
+ ```typescript
1602
+ Platform Features =
1603
+ (66 thing types × 10 features/type) + // 660 features
1604
+ (25 connection types × 8 features/type) + // 200 features
1605
+ (67 event types × 5 metrics/type) + // 335 metrics
1606
+ (Organizations × 1 website each) // Infinite sites
1607
+
1608
+ Total = 1,195+ base features + infinite customization
1609
+ ```
1610
+
1611
+ ### Context Efficiency
1612
+
1613
+ ```
1614
+ Traditional Monolithic AI:
1615
+ - Load full codebase: 200k tokens
1616
+ - Load docs: 50k tokens
1617
+ - Load examples: 30k tokens
1618
+ - Total per request: 280k tokens
1619
+ - Cost per request: ~$2.80
1620
+ - Speed: 30-60 seconds
1621
+
1622
+ ONE Specialist Agents:
1623
+ - Query ontology types: 500 tokens
1624
+ - Retrieve focused chunks: 800 tokens
1625
+ - Load agent context: 2k tokens
1626
+ - Total per request: 3.3k tokens
1627
+ - Cost per request: ~$0.03
1628
+ - Speed: 2-5 seconds
1629
+
1630
+ Efficiency gain: 98.8% context reduction, 93x cost reduction, 10x faster
1631
+ ```
1632
+
1633
+ ### The Ontology Advantage
1634
+
1635
+ **Why this works:**
1636
+
1637
+ 1. **Stable Foundation:** 6 dimensions never change
1638
+ 2. **Finite Primitives:** 66 + 25 + 67 = 158 types (not infinite)
1639
+ 3. **Infinite Combinations:** 158 types compose into infinite features
1640
+ 4. **Type-Driven:** Everything generates from type definitions
1641
+ 5. **Protocol-Agnostic:** Metadata handles variance, not new types
1642
+ 6. **Context-Efficient:** Query slices, not full ontology
1643
+ 7. **Agent-Friendly:** Each agent masters <10 types
1644
+ 8. **Human-Readable:** "It's a course" → everyone understands
1645
+
1646
+ **Result:** A complete ontology that generates platforms from scratch while using 98% less context than traditional AI approaches.
1647
+
1648
+ ---
1649
+
1650
+ **END OF ONTOLOGY ENGINEERING**
1651
+
1652
+ The ontology is complete. The generation system is complete. Build anything.