oneie 3.6.12 → 3.6.14

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 (775) hide show
  1. package/.claude/agents/AUDIT-agent-ops-alignment.md +379 -0
  2. package/.claude/agents/NEWS-QUICKSTART.md +321 -0
  3. package/.claude/agents/NEWS-README.md +353 -0
  4. package/.claude/agents/agent-backend.md +1 -1
  5. package/.claude/agents/agent-builder.md +220 -151
  6. package/.claude/agents/agent-clean.md +39 -31
  7. package/.claude/agents/agent-clone.md +107 -54
  8. package/.claude/agents/agent-designer.md +76 -71
  9. package/.claude/agents/agent-director.md +164 -1
  10. package/.claude/agents/agent-documenter.md +169 -132
  11. package/.claude/agents/agent-frontend.md +442 -446
  12. package/.claude/agents/agent-integrator.md +30 -23
  13. package/.claude/agents/agent-lawyer.md +145 -98
  14. package/.claude/agents/agent-news.md +363 -0
  15. package/.claude/agents/agent-onboard.md +99 -69
  16. package/.claude/agents/agent-ontology.md +585 -0
  17. package/.claude/agents/agent-ops.md +178 -171
  18. package/.claude/agents/agent-problem-solver.md +132 -115
  19. package/.claude/agents/agent-quality.md +94 -77
  20. package/.claude/agents/agent-sales.md +89 -67
  21. package/.claude/commands/release.md +3 -1
  22. package/.claude/commands/server.md +64 -5
  23. package/.claude/hooks/README-knowledge-hooks.md +266 -80
  24. package/.claude/hooks/README-root-cleanup.md +200 -0
  25. package/.claude/hooks/README.md +284 -0
  26. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  27. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  28. package/.claude/hooks/check-filenames.py +169 -32
  29. package/.claude/hooks/clean-post.py +195 -28
  30. package/.claude/hooks/clean-pre.py +96 -11
  31. package/.claude/hooks/done.py +74 -13
  32. package/.claude/hooks/format-hook.sh +105 -17
  33. package/.claude/hooks/hook-logger.sh +121 -7
  34. package/.claude/hooks/knowledge-post.py +136 -32
  35. package/.claude/hooks/knowledge-pre.py +129 -34
  36. package/.claude/hooks/notification-hook.sh +184 -17
  37. package/.claude/hooks/root-cleanup.py +181 -39
  38. package/.claude/hooks/security-hook.sh +248 -8
  39. package/.claude/hooks/tag-all-docs.py +175 -49
  40. package/.claude/hooks/test-validate-ontology.sh +170 -0
  41. package/.claude/hooks/todo.py +92 -22
  42. package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
  43. package/.claude/hooks/validate-ontology-structure.py +83 -20
  44. package/AGENTS.md +60 -245
  45. package/CLAUDE.md +70 -1
  46. package/README.md +25 -0
  47. package/folders.yaml +1 -1
  48. package/one/.claude/settings.local.json +11 -0
  49. package/one/.obsidian/community-plugins.json +3 -1
  50. package/one/.obsidian/plugins/editing-toolbar/data.json +328 -0
  51. package/one/.obsidian/plugins/editing-toolbar/main.js +12 -0
  52. package/one/.obsidian/plugins/editing-toolbar/manifest.json +10 -0
  53. package/one/.obsidian/plugins/editing-toolbar/styles.css +1338 -0
  54. package/one/.obsidian/plugins/terminal/data.json +154 -0
  55. package/one/.obsidian/plugins/terminal/main.js +197 -0
  56. package/one/.obsidian/plugins/terminal/manifest.json +14 -0
  57. package/one/.obsidian/plugins/terminal/styles.css +32 -0
  58. package/one/.obsidian/workspace.json +71 -45
  59. package/one/README.md +18 -0
  60. package/one/connections/a2a.md +49 -0
  61. package/one/connections/acp.md +47 -0
  62. package/one/connections/acps.md +18 -0
  63. package/one/connections/agentkit.md +18 -0
  64. package/one/connections/agui.md +18 -0
  65. package/one/connections/any-backend.md +39 -21
  66. package/one/connections/ap2.md +74 -0
  67. package/one/connections/api/queries-reference.md +18 -0
  68. package/one/connections/api-docs.md +18 -0
  69. package/one/connections/api-reference.md +18 -0
  70. package/one/connections/api.md +18 -0
  71. package/one/connections/architecture-diagram.md +18 -0
  72. package/one/connections/communications.md +18 -0
  73. package/one/connections/connections.md +18 -0
  74. package/one/connections/copilotkit.md +18 -0
  75. package/one/connections/cryptonetworks.md +18 -0
  76. package/one/connections/documentation.md +18 -0
  77. package/one/connections/effect.md +18 -0
  78. package/one/connections/elizaos.md +18 -0
  79. package/one/connections/groups.md +814 -0
  80. package/one/connections/inference.md +18 -0
  81. package/one/connections/integration-examples.md +18 -0
  82. package/one/connections/integration-guide.md +18 -0
  83. package/one/connections/integration-phase2.md +32 -14
  84. package/one/connections/kyc.md +18 -0
  85. package/one/connections/mcp.md +18 -0
  86. package/one/connections/membership.md +18 -0
  87. package/one/connections/middleware.md +18 -0
  88. package/one/connections/multitenant.md +18 -0
  89. package/one/connections/n8n.md +18 -0
  90. package/one/connections/patterns.md +18 -0
  91. package/one/connections/protocols.md +20 -2
  92. package/one/connections/relationships.md +18 -0
  93. package/one/connections/schema.md +18 -0
  94. package/one/connections/service-layer.md +18 -0
  95. package/one/connections/vectors.md +18 -0
  96. package/one/connections/wordpress.md +18 -0
  97. package/one/connections/workflow-copy.md +18 -0
  98. package/one/connections/workflow-examples.md +18 -0
  99. package/one/connections/workflow-onboarding.md +18 -0
  100. package/one/connections/workflow.md +18 -0
  101. package/one/connections/workflows/delegation.md +18 -0
  102. package/one/connections/workflows/frontend.md +18 -0
  103. package/one/connections/workflows/strategy.md +18 -0
  104. package/one/connections/workflows/tasks.md +18 -0
  105. package/one/connections/x402-baazar.md +131 -0
  106. package/one/connections/x402.md +268 -164
  107. package/one/events/2024-10-14-deployment-plan.md +15 -16
  108. package/one/events/2024-10-14-deployment-success.md +15 -16
  109. package/one/events/2024-10-14-final-sync-complete.md +15 -16
  110. package/one/events/2024-10-14-release-v2.0.6.md +15 -16
  111. package/one/events/2024-10-15-agent-clean-v2-summary.md +15 -16
  112. package/one/events/2024-10-15-handoff-to-clean.md +15 -16
  113. package/one/events/2024-10-15-package-manager-tests.md +15 -16
  114. package/one/events/2024-10-15-release-command-complete.md +15 -16
  115. package/one/events/2025-10-15-private-files-secured.md +18 -0
  116. package/one/events/2025-10-15-unignore-public-group-docs.md +18 -0
  117. package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +335 -0
  118. package/one/events/ALIGNMENT_SUMMARY.md +280 -0
  119. package/one/events/API_ROUTES_FIXES_SUMMARY.md +18 -0
  120. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +18 -0
  121. package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +598 -0
  122. package/one/events/BEFORE_AFTER_COMPARISON.md +18 -0
  123. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +18 -0
  124. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +18 -0
  125. package/one/events/CLAUDE copy.md +897 -0
  126. package/one/events/CLEANUP-RELEASE-V2.0.8.md +18 -0
  127. package/one/events/CONNECTIONS_DEMO.md +18 -0
  128. package/one/events/CREATE-WEBSITE.md +18 -0
  129. package/one/events/CRITICAL-FIXES-COMPLETE.md +18 -0
  130. package/one/events/CUSTOM-DOMAIN.md +18 -0
  131. package/one/events/DELIVERABLES.md +18 -0
  132. package/one/events/DEMO-GROUPS-PAGE.md +18 -0
  133. package/one/events/DEMO-TESTING-SUMMARY.md +18 -0
  134. package/one/events/DEMO_COMPONENTS.md +18 -0
  135. package/one/events/DEMO_HOOKS_INDEX.md +18 -0
  136. package/one/events/DEMO_INFRASTRUCTURE.md +18 -0
  137. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +18 -0
  138. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +18 -0
  139. package/one/events/DEMO_QUICK_REFERENCE.md +18 -0
  140. package/one/events/DEMO_SETUP.md +18 -0
  141. package/one/events/DEPLOYMENT copy.md +18 -0
  142. package/one/events/DEPLOYMENT.md +18 -0
  143. package/one/events/ECOMMERCE-BEFORE-AFTER.md +16 -0
  144. package/one/events/ECOMMERCE-DEMO-PLAN.md +18 -0
  145. package/one/events/ECOMMERCE-ENHANCEMENTS.md +18 -0
  146. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +18 -0
  147. package/one/events/ECOMMERCE-LIVE-DEMO.md +18 -0
  148. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +18 -0
  149. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +18 -0
  150. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +18 -0
  151. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +18 -0
  152. package/one/events/EFFECT_TS_API_PATTERN.md +18 -0
  153. package/one/events/FEATURE-2-4-COMPLETE.md +18 -0
  154. package/one/events/FEATURE_2_3_COMPLETE.md +18 -0
  155. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +18 -0
  156. package/one/events/GROUPS-MIGRATION.md +18 -0
  157. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +18 -0
  158. package/one/events/HANDOFF.md +18 -0
  159. package/one/events/HOOKS-DEMO.md +18 -0
  160. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +18 -0
  161. package/one/events/IMPLEMENTATION_SUMMARY.md +18 -0
  162. package/one/events/INSTALL-TESTS.md +18 -0
  163. package/one/events/INSTALLATION_FOLDERS.md +18 -0
  164. package/one/events/INSTALLATION_FOLDERS_FILES.md +18 -0
  165. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +18 -0
  166. package/one/events/INTEGRATION-ARCHITECTURE.md +18 -0
  167. package/one/events/INTEGRATION-CHECKLIST.md +18 -0
  168. package/one/events/INTEGRATION-ORCHESTRATION.md +18 -0
  169. package/one/events/INTEGRATION-SUMMARY.md +18 -0
  170. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +18 -0
  171. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +18 -0
  172. package/one/events/LANDING-PAGE-QUICKSTART.md +18 -0
  173. package/one/events/LICENSE.md +18 -0
  174. package/one/events/MCP-CONFIGURATION.md +18 -0
  175. package/one/events/MCP-SETUP-COMPLETE.md +18 -0
  176. package/one/events/MIGRATION-REPORT.md +18 -0
  177. package/one/events/MIGRATION.md +18 -0
  178. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +18 -0
  179. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +18 -0
  180. package/one/events/NODE-UPGRADE.md +18 -0
  181. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +18 -0
  182. package/one/events/ONTOLOGY-HOOKS-README.md +18 -0
  183. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +18 -0
  184. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +18 -0
  185. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +18 -0
  186. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +18 -0
  187. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +18 -0
  188. package/one/events/PACKAGE-STRUCTURE.md +18 -0
  189. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +18 -0
  190. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +18 -0
  191. package/one/events/QA-CHECKLIST.md +18 -0
  192. package/one/events/QUICK-START-ONTOLOGY.md +18 -0
  193. package/one/events/README-archived.md +18 -0
  194. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +18 -0
  195. package/one/events/SEARCH_DEMO_DELIVERY.md +18 -0
  196. package/one/events/SEARCH_DEMO_SUMMARY.md +18 -0
  197. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +18 -0
  198. package/one/events/SECURITY-AUDIT-FIXES.md +18 -0
  199. package/one/events/SECURITY-SCAN-COMPLETE.md +18 -0
  200. package/one/events/SHOP-BUILD-STATUS.md +18 -0
  201. package/one/events/SHOP-PREMIUM-UPDATE.md +16 -0
  202. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +18 -0
  203. package/one/events/SITE-WIDE-GRADIENT-FIX.md +18 -0
  204. package/one/events/STORE-PRODUCTION-READY-STATUS.md +18 -0
  205. package/one/events/STRIPE-INTEGRATION.md +18 -0
  206. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +18 -0
  207. package/one/events/STRIPE-SETUP-GUIDE.md +18 -0
  208. package/one/events/TEST-PLAN-INDEX.md +18 -0
  209. package/one/events/TEST-PLAN.md +18 -0
  210. package/one/events/TEST-SUMMARY.md +18 -0
  211. package/one/events/TESTS-QUICK-REF.md +18 -0
  212. package/one/events/TRANSITIONS-QUICK-START.md +18 -0
  213. package/one/events/TRANSPARENCY-FIXES.md +18 -0
  214. package/one/events/TYPESCRIPT_FIXES.md +18 -0
  215. package/one/events/TYPESCRIPT_FIXES_INDEX.md +18 -0
  216. package/one/events/VIEW-TRANSITIONS.md +18 -0
  217. package/one/events/agent-director-enhancement-summary.md +18 -0
  218. package/one/events/agent-onboard-implementation-summary.md +18 -0
  219. package/one/events/agent-ontology-alignment-completion.md +263 -0
  220. package/one/events/backend-integration-tests.md +18 -0
  221. package/one/events/clean-agent-ontology-cleanup-report.md +18 -0
  222. package/one/events/clean-agent-todo-analysis-summary.md +336 -0
  223. package/one/events/cloudflare-automation-complete.md +18 -0
  224. package/one/events/cloudflare-pages-infrastructure-setup.md +18 -0
  225. package/one/events/contact-page-complete.md +18 -0
  226. package/one/events/convex-analysis-index.md +18 -0
  227. package/one/events/convex-structure-analysis.md +18 -0
  228. package/one/events/deployment-installation-folders.md +18 -0
  229. package/one/events/deployment-ops-summary.md +18 -0
  230. package/one/events/deployment-verification.md +18 -0
  231. package/one/events/design-spec-complete.md +18 -0
  232. package/one/events/documentation-audit-index.md +473 -0
  233. package/one/events/documentation-audit-summary.md +417 -0
  234. package/one/events/documentation-improvement-roadmap.md +906 -0
  235. package/one/events/documentation-standards-compliance-report.md +538 -0
  236. package/one/events/events.md +18 -0
  237. package/one/events/frontend-effects-complete.md +584 -0
  238. package/one/events/frontend-effects-orchestration.md +1356 -0
  239. package/one/events/frontend-effects-risk-register.md +1055 -0
  240. package/one/events/frontend-effects-week1-assignments.md +1594 -0
  241. package/one/events/hook-ontology-alignment-summary.md +528 -0
  242. package/one/events/installation-folders-workflow-integration.md +18 -0
  243. package/one/events/landing-page-generator.md +18 -0
  244. package/one/events/legal-assessment-2025-10-16.md +18 -0
  245. package/one/events/onboarding-implementation-complete.md +18 -0
  246. package/one/events/ontology-test-examples.md +18 -0
  247. package/one/events/phase1-backend-implementation-complete.md +18 -0
  248. package/one/events/release.md +18 -0
  249. package/one/events/root-cleanup-alignment-report.md +265 -0
  250. package/one/events/separate-implementation-status.md +18 -0
  251. package/one/events/session-summary-2025-10-18.md +18 -0
  252. package/one/events/skills-complete.md +18 -0
  253. package/one/events/skills-infer-6-10-summary.md +18 -0
  254. package/one/events/skills-phase1-complete.md +18 -0
  255. package/one/events/structural-analysis-architecture-vs-plans.md +559 -0
  256. package/one/events/test-dashboard.md +18 -0
  257. package/one/events/test-index.md +18 -0
  258. package/one/events/test-report-ontology.md +18 -0
  259. package/one/events/testing-summary.md +18 -0
  260. package/one/events/todo-refactoring-complete.md +408 -0
  261. package/one/events/wave1-backend-implementation-complete.md +698 -0
  262. package/one/groups/features.md +26 -0
  263. package/one/groups/groups.md +83 -39
  264. package/one/groups/one.md +47 -27
  265. package/one/groups/{strategy copy.md → strategy-copy.md} +23 -5
  266. package/one/knowledge/.obsidian/ecommerce-ontology.md +18 -0
  267. package/one/knowledge/100-inference-quick-reference.md +18 -0
  268. package/one/knowledge/agent-onboard-usage.md +18 -0
  269. package/one/knowledge/agentic-commerce.md +146 -0
  270. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +683 -0
  271. package/one/knowledge/ai-platform.md +18 -0
  272. package/one/knowledge/ai-token-crypto-analysis-framework.md +1191 -0
  273. package/one/knowledge/ai-token-paradigm-shift-2025.md +732 -0
  274. package/one/knowledge/altcoin-cycle-prediction-ontology.md +884 -0
  275. package/one/knowledge/altcoin-cycle-trading-strategy.md +642 -0
  276. package/one/knowledge/architecture-any-backend.md +265 -42
  277. package/one/knowledge/architecture-diagram.md +404 -94
  278. package/one/knowledge/architecture-frontend.md +130 -51
  279. package/one/knowledge/architecture.md +1496 -1831
  280. package/one/knowledge/{ontology.md.backup → archived/ontology.old.md} +18 -0
  281. package/one/knowledge/astro-effect-complete-vision.md +2148 -0
  282. package/one/knowledge/astro-effect-simple-architecture.md +717 -0
  283. package/one/knowledge/audit-agent-onboard-alignment.md +481 -0
  284. package/one/knowledge/audit-agent-sales-alignment.md +444 -0
  285. package/one/knowledge/backend-api-reference.md +18 -0
  286. package/one/knowledge/cli-claude-handoff.md +18 -0
  287. package/one/knowledge/context-engineering.md +610 -0
  288. package/one/knowledge/crypto-analysis-strategy.md +1276 -0
  289. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +44 -0
  290. package/one/knowledge/crypto.md +18 -0
  291. package/one/knowledge/docs.md +627 -0
  292. package/one/knowledge/dsl.md +18 -0
  293. package/one/knowledge/files.md +18 -0
  294. package/one/knowledge/frontend.md +18 -0
  295. package/one/knowledge/hono.md +18 -0
  296. package/one/knowledge/implementation-examples.md +18 -0
  297. package/one/knowledge/installation-folders.md +18 -0
  298. package/one/knowledge/institutional-cycle-paradigm-2025.md +555 -0
  299. package/one/knowledge/knowledge.md +18 -0
  300. package/one/knowledge/language.md +18 -0
  301. package/one/knowledge/lessons-learned.md +18 -0
  302. package/one/knowledge/lessons-website-building-focus.md +18 -0
  303. package/one/knowledge/merge-report.md +254 -0
  304. package/one/knowledge/nine-padel-playbook.md +18 -0
  305. package/one/knowledge/ontology-blog.yaml +42 -26
  306. package/one/knowledge/ontology-cheatsheet.md +18 -0
  307. package/one/knowledge/ontology-community.yaml +60 -37
  308. package/one/knowledge/ontology-core-universal.md +19 -1
  309. package/one/knowledge/ontology-core.yaml +58 -45
  310. package/one/knowledge/ontology-courses.yaml +71 -48
  311. package/one/knowledge/ontology-creator.md +30 -4
  312. package/one/knowledge/ontology-crypto.md +1603 -0
  313. package/one/knowledge/ontology-developer-guide.md +18 -0
  314. package/one/knowledge/ontology-documentation.md +46 -25
  315. package/one/knowledge/ontology-ecommerce.md +24 -6
  316. package/one/knowledge/ontology-education.md +18 -0
  317. package/one/knowledge/ontology-engineering-specification.md +22 -4
  318. package/one/knowledge/ontology-engineering.md +67 -43
  319. package/one/knowledge/ontology-files.yaml +525 -0
  320. package/one/knowledge/ontology-frontend-master.md +2898 -0
  321. package/one/knowledge/ontology-frontend-specifications.md +57 -49
  322. package/one/knowledge/ontology-frontend.md +40 -22
  323. package/one/knowledge/ontology-index.md +18 -0
  324. package/one/knowledge/ontology-minimal.yaml +18 -16
  325. package/one/knowledge/ontology-portfolio.yaml +40 -26
  326. package/one/knowledge/ontology-quickstart.md +18 -0
  327. package/one/knowledge/ontology-release.md +317 -0
  328. package/one/knowledge/ontology-shop.yaml +146 -119
  329. package/one/knowledge/ontology-tokens.yaml +46 -27
  330. package/one/knowledge/ontology-tutorial.md +18 -0
  331. package/one/knowledge/ontology-video-script.md +18 -0
  332. package/one/knowledge/ontology-visual-guide.md +20 -2
  333. package/one/knowledge/ontology.md +1329 -304
  334. package/one/knowledge/ontology.yaml +763 -275
  335. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +48 -18
  336. package/one/knowledge/patterns/backend/convex-query-pattern.md +78 -23
  337. package/one/knowledge/patterns/backend/mutation-template.md +28 -10
  338. package/one/knowledge/patterns/backend/query-template.md +44 -25
  339. package/one/knowledge/patterns/backend/service-template.md +35 -14
  340. package/one/knowledge/patterns/design/component-architecture.md +45 -9
  341. package/one/knowledge/patterns/design/test-driven-design-pattern.md +37 -3
  342. package/one/knowledge/patterns/design/wireframe-template.md +36 -2
  343. package/one/knowledge/patterns/frontend/component-template.md +91 -40
  344. package/one/knowledge/patterns/frontend/form-template.md +131 -59
  345. package/one/knowledge/patterns/frontend/page-template.md +59 -28
  346. package/one/knowledge/patterns/frontend/react-component-pattern.md +87 -27
  347. package/one/knowledge/patterns/test/acceptance-criteria-template.md +28 -10
  348. package/one/knowledge/patterns/test/technical-test-template.md +48 -26
  349. package/one/knowledge/patterns/test/test-driven-pattern.md +25 -5
  350. package/one/knowledge/patterns/test/user-flow-template.md +18 -0
  351. package/one/knowledge/provider-agnostic-content.md +995 -0
  352. package/one/knowledge/provider-creation-guide.md +18 -0
  353. package/one/knowledge/quality-loop.md +18 -0
  354. package/one/knowledge/readme-architecture.md +158 -0
  355. package/one/knowledge/readme.md +18 -0
  356. package/one/knowledge/rules.md +18 -0
  357. package/one/knowledge/score.md +18 -0
  358. package/one/knowledge/specifications.md +18 -0
  359. package/one/knowledge/tags.md +18 -0
  360. package/one/knowledge/todo-template.md +18 -0
  361. package/one/knowledge/todo.md +18 -0
  362. package/one/knowledge/typescript-patterns.md +18 -0
  363. package/one/knowledge/universal-generation-language.md +827 -0
  364. package/one/knowledge/x402-research.md +104 -0
  365. package/one/license.md +18 -0
  366. package/one/people/anthony-o-connell.md +48 -19
  367. package/one/people/people.md +54 -31
  368. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +401 -0
  369. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +588 -0
  370. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +461 -0
  371. package/one/things/CHECKLIST.md +51 -0
  372. package/one/things/IMPLEMENTATION_STATUS.md +379 -0
  373. package/one/things/ONE.md +19 -1
  374. package/one/things/agents/agent-backend.md +198 -98
  375. package/one/things/agents/agent-builder.md +267 -158
  376. package/one/things/agents/agent-clean.md +40 -15
  377. package/one/things/agents/agent-clone.md +33 -50
  378. package/one/things/agents/agent-deploy.md +59 -11
  379. package/one/things/agents/agent-designer.md +274 -146
  380. package/one/things/agents/agent-director.md +20 -2
  381. package/one/things/agents/agent-documenter.md +126 -46
  382. package/one/things/agents/agent-frontend.md +104 -22
  383. package/one/things/agents/agent-integrator.md +153 -76
  384. package/one/things/agents/agent-lawyer.md +197 -92
  385. package/one/things/agents/agent-problem-solver.md +302 -224
  386. package/one/things/agents/agent-quality.md +149 -19
  387. package/one/things/agents/agent-sales.md +95 -7
  388. package/one/things/cascade/cascade.yaml +20 -3
  389. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +53 -0
  390. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +50 -0
  391. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +76 -0
  392. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +49 -3
  393. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +45 -0
  394. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +32 -0
  395. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +45 -3
  396. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +44 -0
  397. package/one/things/cascade/docs/examples/1-3-event-coordination.md +40 -1
  398. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +81 -25
  399. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +41 -0
  400. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +91 -16
  401. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +136 -73
  402. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +43 -0
  403. package/one/things/cascade/docs/examples/1-5-quality-loops.md +88 -4
  404. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +52 -3
  405. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +44 -1
  406. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +78 -14
  407. package/one/things/cascade/docs/examples/readme.md +37 -0
  408. package/one/things/cascade/docs/getting-started.md +18 -0
  409. package/one/things/cascade/docs/workflow.md +18 -12
  410. package/one/things/cascade/readme.md +43 -0
  411. package/one/things/cascade/templates/feature-template.md +28 -6
  412. package/one/things/claude/agents/advocacy-activation-manager.md +64 -39
  413. package/one/things/claude/agents/advocacy-campaign-designer.md +64 -39
  414. package/one/things/claude/agents/analyst.md +64 -39
  415. package/one/things/claude/agents/architect.md +64 -39
  416. package/one/things/claude/agents/brand-identity-specialist.md +64 -39
  417. package/one/things/claude/agents/bstp-token-strategist.md +48 -25
  418. package/one/things/claude/agents/builder-repo.md +69 -26
  419. package/one/things/claude/agents/bullstamp-community-builder.md +48 -25
  420. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +48 -25
  421. package/one/things/claude/agents/bulltilt-platform-growth.md +48 -25
  422. package/one/things/claude/agents/company-bullstamp-character.md +45 -30
  423. package/one/things/claude/agents/company-bullstamp-community.md +45 -30
  424. package/one/things/claude/agents/company-bullstamp-marketing.md +45 -30
  425. package/one/things/claude/agents/company-bullstamp-token.md +45 -30
  426. package/one/things/claude/agents/company-bulltilt-growth.md +45 -30
  427. package/one/things/claude/agents/content-bibliography-formatter.md +48 -25
  428. package/one/things/claude/agents/content-calendar-planner.md +59 -34
  429. package/one/things/claude/agents/content-chapter-formatter.md +60 -35
  430. package/one/things/claude/agents/content-formatter.md +59 -34
  431. package/one/things/claude/agents/content-hook-specialist.md +54 -31
  432. package/one/things/claude/agents/content-image-formatter.md +59 -34
  433. package/one/things/claude/agents/content-introduction-formatter.md +59 -34
  434. package/one/things/claude/agents/content-multiplication-engine.md +54 -31
  435. package/one/things/claude/agents/content-playbook-writer.md +60 -35
  436. package/one/things/claude/agents/content-team-manager.md +59 -34
  437. package/one/things/claude/agents/content-toc-formatter.md +60 -35
  438. package/one/things/claude/agents/convex-backend-specialist.md +380 -216
  439. package/one/things/claude/agents/core-manager.md +59 -34
  440. package/one/things/claude/agents/core-master.md +55 -32
  441. package/one/things/claude/agents/cross-functional-manager.md +46 -41
  442. package/one/things/claude/agents/crypto-airdrop-strategist.md +74 -54
  443. package/one/things/claude/agents/crypto-analytics-educator.md +73 -30
  444. package/one/things/claude/agents/crypto-architecture-specialist.md +70 -39
  445. package/one/things/claude/agents/crypto-community-analyst.md +47 -31
  446. package/one/things/claude/agents/crypto-community-psychologist.md +68 -31
  447. package/one/things/claude/agents/crypto-dex-optimization-expert.md +72 -31
  448. package/one/things/claude/agents/crypto-dex-optimizer.md +45 -30
  449. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +69 -30
  450. package/one/things/claude/agents/crypto-diamond-hands.md +45 -30
  451. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +73 -30
  452. package/one/things/claude/agents/crypto-engagement-specialist.md +71 -30
  453. package/one/things/claude/agents/crypto-market-researcher.md +45 -30
  454. package/one/things/claude/agents/crypto-marketing-orchestrator.md +74 -34
  455. package/one/things/claude/agents/crypto-network-effect-amplifier.md +75 -30
  456. package/one/things/claude/agents/crypto-optimization-analyst.md +73 -30
  457. package/one/things/claude/agents/crypto-strategic-synthesizer.md +69 -30
  458. package/one/things/claude/agents/crypto-team-manager.md +45 -40
  459. package/one/things/claude/agents/crypto-token-analyst.md +66 -25
  460. package/one/things/claude/agents/crypto-viral-content-creator.md +64 -61
  461. package/one/things/claude/agents/crypto-wallet-identification-expert.md +61 -51
  462. package/one/things/claude/agents/crypto-wallet-identifier.md +45 -30
  463. package/one/things/claude/agents/customer-journey-designer.md +51 -58
  464. package/one/things/claude/agents/customer-success-manager.md +51 -58
  465. package/one/things/claude/agents/dev.md +51 -58
  466. package/one/things/claude/agents/documenter.md +71 -69
  467. package/one/things/claude/agents/elevate-marketing-orchestrator.md +45 -52
  468. package/one/things/claude/agents/engagement-specialist.md +45 -52
  469. package/one/things/claude/agents/engineering-architect.md +54 -54
  470. package/one/things/claude/agents/engineering-business-analyst.md +46 -56
  471. package/one/things/claude/agents/engineering-developer.md +51 -52
  472. package/one/things/claude/agents/engineering-director.md +65 -25
  473. package/one/things/claude/agents/engineering-ingestor.md +110 -100
  474. package/one/things/claude/agents/engineering-product-manager.md +43 -55
  475. package/one/things/claude/agents/engineering-product-owner.md +46 -56
  476. package/one/things/claude/agents/engineering-project-coordinator.md +44 -56
  477. package/one/things/claude/agents/engineering-quality-assurance.md +53 -54
  478. package/one/things/claude/agents/engineering-team-manager.md +46 -43
  479. package/one/things/claude/agents/engineering-user-experience.md +51 -52
  480. package/one/things/claude/agents/framework-elevate-manager.md +45 -30
  481. package/one/things/claude/agents/improver.md +120 -78
  482. package/one/things/claude/agents/intelligence-team-manager.md +45 -40
  483. package/one/things/claude/agents/lead-capture-expert.md +45 -52
  484. package/one/things/claude/agents/lead-magnet-creator.md +45 -52
  485. package/one/things/claude/agents/market-research-analyst.md +48 -25
  486. package/one/things/claude/agents/marketing-brand-identity.md +57 -27
  487. package/one/things/claude/agents/marketing-content-hooks.md +45 -40
  488. package/one/things/claude/agents/marketing-content-multiplier.md +45 -40
  489. package/one/things/claude/agents/marketing-content-poster.md +71 -60
  490. package/one/things/claude/agents/marketing-customer-journey.md +45 -40
  491. package/one/things/claude/agents/marketing-director.md +46 -41
  492. package/one/things/claude/agents/marketing-engagement.md +45 -40
  493. package/one/things/claude/agents/marketing-lead-capture.md +45 -40
  494. package/one/things/claude/agents/marketing-lead-magnet.md +45 -40
  495. package/one/things/claude/agents/marketing-network-effects.md +45 -40
  496. package/one/things/claude/agents/marketing-nurture-campaigns.md +45 -40
  497. package/one/things/claude/agents/marketing-share-optimizer.md +45 -40
  498. package/one/things/claude/agents/marketing-team-manager.md +45 -40
  499. package/one/things/claude/agents/marketing-viral-growth.md +49 -18
  500. package/one/things/claude/agents/mission-commander.md +45 -40
  501. package/one/things/claude/agents/network-effect-analyst.md +48 -31
  502. package/one/things/claude/agents/nextjs-15-specialist.md +209 -122
  503. package/one/things/claude/agents/npx.md +126 -70
  504. package/one/things/claude/agents/nurture-campaign-manager.md +48 -25
  505. package/one/things/claude/agents/one-master.md +48 -25
  506. package/one/things/claude/agents/one-orchestrator.md +57 -27
  507. package/one/things/claude/agents/one.md +88 -31
  508. package/one/things/claude/agents/playbook-generator.md +48 -25
  509. package/one/things/claude/agents/pm.md +48 -25
  510. package/one/things/claude/agents/po.md +51 -26
  511. package/one/things/claude/agents/qa.md +50 -25
  512. package/one/things/claude/agents/research-foundation-analyst.md +48 -31
  513. package/one/things/claude/agents/research-intelligence-gatherer.md +59 -32
  514. package/one/things/claude/agents/research-market-analyst.md +47 -30
  515. package/one/things/claude/agents/research-team-manager.md +47 -40
  516. package/one/things/claude/agents/sales-environment-optimizer.md +50 -25
  517. package/one/things/claude/agents/sales-team-manager.md +47 -40
  518. package/one/things/claude/agents/sales-upsell-strategist.md +47 -30
  519. package/one/things/claude/agents/service-advocacy-campaigns.md +47 -30
  520. package/one/things/claude/agents/service-advocacy-manager.md +47 -30
  521. package/one/things/claude/agents/service-success-manager.md +47 -30
  522. package/one/things/claude/agents/service-team-manager.md +45 -40
  523. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +85 -30
  524. package/one/things/claude/agents/share-optimization-specialist.md +50 -25
  525. package/one/things/claude/agents/sm.md +50 -25
  526. package/one/things/claude/agents/story-teller.md +51 -26
  527. package/one/things/claude/agents/task-master.md +52 -27
  528. package/one/things/claude/agents/tauri-cross-platform-specialist.md +201 -116
  529. package/one/things/claude/agents/tester.md +85 -46
  530. package/one/things/claude/agents/the-bull-character-manager.md +48 -25
  531. package/one/things/claude/agents/tools-playbook-generator.md +43 -40
  532. package/one/things/claude/agents/turbo-repo-builder.md +57 -27
  533. package/one/things/claude/agents/upsell-strategist.md +48 -25
  534. package/one/things/claude/agents/ux-expert.md +50 -25
  535. package/one/things/claude/agents/viral-growth-orchestrator.md +50 -27
  536. package/one/things/claude/commands/agent.md +25 -5
  537. package/one/things/claude/commands/cascade-status.md +33 -8
  538. package/one/things/claude/commands/ingest.md +64 -11
  539. package/one/things/claude/commands/ingestor.md +29 -7
  540. package/one/things/claude/commands/mission.md +24 -4
  541. package/one/things/claude/commands/npx.md +30 -7
  542. package/one/things/claude/commands/one.md +114 -68
  543. package/one/things/claude/commands/quality-check.md +72 -24
  544. package/one/things/claude/commands/smart-route.md +45 -4
  545. package/one/things/claude/commands/start.md +22 -4
  546. package/one/things/claude/commands/story.md +25 -5
  547. package/one/things/claude/commands/task.md +21 -1
  548. package/one/things/cli/cli-code.md +244 -219
  549. package/one/things/cli/cli-compiler-code.md +244 -219
  550. package/one/things/cli/cli.md +30 -6
  551. package/one/things/components/card-shadcn.md +252 -228
  552. package/one/things/components/card.md +315 -324
  553. package/one/things/components.md +667 -593
  554. package/one/things/componets.md +16 -1
  555. package/one/things/creator-diagram.md +23 -5
  556. package/one/things/demo-accessibility-animations.md +73 -47
  557. package/one/things/demo-components.md +225 -219
  558. package/one/things/demo-design-summary.md +89 -26
  559. package/one/things/demo-design-system.md +184 -130
  560. package/one/things/demo-page-layouts.md +52 -25
  561. package/one/things/designs/accessibility-audit.md +153 -66
  562. package/one/things/designs/component-specifications.md +163 -65
  563. package/one/things/designs/design-overview.md +81 -22
  564. package/one/things/designs/design-tokens.md +127 -93
  565. package/one/things/designs/wireframes-dashboard.md +64 -7
  566. package/one/things/docs/api-requests.md +75 -11
  567. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +18 -0
  568. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +57 -0
  569. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +62 -6
  570. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +60 -5
  571. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +95 -27
  572. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +130 -62
  573. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +43 -19
  574. package/one/things/docs/ecommerce/QUICK-START.md +41 -4
  575. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +75 -6
  576. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +58 -24
  577. package/one/things/examples/children/lemonade-stand.md +52 -14
  578. package/one/things/examples/enterprise/crm-saas.md +43 -28
  579. package/one/things/features/1-1-agent-prompts.md +76 -0
  580. package/one/things/features/1-2-yaml-orchestrator.md +32 -0
  581. package/one/things/features/1-3-event-coordination.md +40 -1
  582. package/one/things/features/1-4-knowledge-management.md +91 -16
  583. package/one/things/features/1-5-quality-loops.md +88 -4
  584. package/one/things/features/1-6-numbering-structure.md +78 -14
  585. package/one/things/features/2-1-dataprovider-interface.md +311 -86
  586. package/one/things/features/2-2-config-system.md +307 -140
  587. package/one/things/features/2-3-effectts-services.md +263 -116
  588. package/one/things/features/2-4-react-hooks.md +217 -201
  589. package/one/things/features/2-5-auth-migration.md +406 -308
  590. package/one/things/features/2-6-dashboard-migration.md +112 -13
  591. package/one/things/features/2-7-alternative-providers.md +138 -65
  592. package/one/things/features/2-7-implementation-report.md +68 -24
  593. package/one/things/features/2-cli.md +88 -76
  594. package/one/things/features/2-design.md +112 -80
  595. package/one/things/features/2-tests.md +56 -0
  596. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +91 -36
  597. package/one/things/features/DECOUPLING.md +36 -18
  598. package/one/things/features/DEPLOYMENT.md +22 -4
  599. package/one/things/features/IMPLEMENTATION_SUMMARY.md +48 -2
  600. package/one/things/features/improve.md +47 -29
  601. package/one/things/features/remove-convex-deps.md +18 -0
  602. package/one/things/features/top-features.md +28 -20
  603. package/one/things/features/use-one-backend.md +210 -173
  604. package/one/things/features-in-english.md +19 -6
  605. package/one/things/files.yaml +721 -0
  606. package/one/things/ideas/1-create-workflow.md +18 -0
  607. package/one/things/ideas/2-backend-agnostic-frontend.md +57 -2
  608. package/one/things/implementation/backend-guide.md +64 -19
  609. package/one/things/interface.md +43 -0
  610. package/one/things/landing-page-implementation.md +455 -0
  611. package/one/things/legal/README.md +44 -0
  612. package/one/things/legal/privacy-policy.md +186 -23
  613. package/one/things/legal/terms-of-service.md +164 -3
  614. package/one/things/master-workflow-plan.md +806 -0
  615. package/one/things/plans/0-timeline.md +36 -0
  616. package/one/things/plans/1-create-workflow.md +19 -0
  617. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +333 -0
  618. package/one/things/plans/README-SIMPLIFICATION.md +349 -0
  619. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +16 -0
  620. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +455 -0
  621. package/one/things/plans/ai-elements.md +21 -2
  622. package/one/things/plans/ai-integration.md +108 -59
  623. package/one/things/plans/ai-sdk.md +85 -48
  624. package/one/things/plans/ai-tools.md +621 -0
  625. package/one/things/plans/app.md +142 -71
  626. package/one/things/plans/architecture-summary.md +34 -5
  627. package/one/things/plans/async-ai-agents.md +19 -1
  628. package/one/things/plans/backend-agnostic-frontend.md +70 -8
  629. package/one/things/plans/backend-cleanup-quickstart.md +52 -18
  630. package/one/things/plans/backend-ontology-conformance.md +110 -51
  631. package/one/things/plans/backend-status.md +58 -0
  632. package/one/things/plans/backend-structure.md +103 -55
  633. package/one/things/plans/backend-target-structure.md +61 -17
  634. package/one/things/plans/backend.md +60 -18
  635. package/one/things/plans/better-auth-any-backend-revised.md +325 -287
  636. package/one/things/plans/better-auth-any-backend.md +575 -531
  637. package/one/things/plans/better-auth-available-features.md +43 -5
  638. package/one/things/plans/big-plan.md +20 -6
  639. package/one/things/plans/cli-updates-required.md +44 -4
  640. package/one/things/plans/complete-step-by-step.md +223 -116
  641. package/one/things/plans/components.md +709 -0
  642. package/one/things/plans/convex-agents.md +79 -50
  643. package/one/things/plans/convex-better-auth.md +186 -154
  644. package/one/things/plans/convex-on-off.md +47 -29
  645. package/one/things/plans/crypto-token-researcher.md +629 -0
  646. package/one/things/plans/data-quality-metrics.md +745 -0
  647. package/one/things/plans/deep-researcher-agent.md +466 -0
  648. package/one/things/plans/deploy-to-cloudflare.md +55 -13
  649. package/one/things/plans/deployment-architecture.md +54 -11
  650. package/one/things/plans/desktop.md +21 -3
  651. package/one/things/plans/development-plan.md +184 -121
  652. package/one/things/plans/development-workflow-tldr.md +207 -0
  653. package/one/things/plans/development-workflow.md +959 -0
  654. package/one/things/plans/effect-components.md +667 -593
  655. package/one/things/plans/effect-patterns-reference.md +2235 -0
  656. package/one/things/plans/effect.md +204 -131
  657. package/one/things/plans/email.md +21 -8
  658. package/one/things/plans/enhance-auth.md +64 -41
  659. package/one/things/plans/execution-strategy.md +1291 -0
  660. package/one/things/plans/existing-infrastructure.md +712 -0
  661. package/one/things/plans/feature-based-sites.md +124 -51
  662. package/one/things/plans/frontend-effects.md +1276 -0
  663. package/one/things/plans/group-folder-multi-tenancy.md +92 -29
  664. package/one/things/plans/improve-codebase.md +498 -421
  665. package/one/things/plans/install-components.md +18 -1
  666. package/one/things/plans/integrate-frontend-and-backend.md +68 -44
  667. package/one/things/plans/landing.md +92 -0
  668. package/one/things/plans/layout.md +45 -1
  669. package/one/things/plans/mail-backend.md +546 -493
  670. package/one/things/plans/mail.md +379 -326
  671. package/one/things/plans/mcp-clear-context-prompt.md +21 -0
  672. package/one/things/plans/mcp-simple.md +20 -0
  673. package/one/things/plans/multi-ontology-architecture.md +115 -66
  674. package/one/things/plans/next-features.md +31 -0
  675. package/one/things/plans/onboarding.md +20 -1
  676. package/one/things/plans/one.md +18 -0
  677. package/one/things/plans/ontology-6-dimensions.md +24 -45
  678. package/one/things/plans/ontology-compliance-audit.md +315 -0
  679. package/one/things/plans/ontology-driven-strategy.md +19 -3
  680. package/one/things/plans/ontology-refine.md +586 -0
  681. package/one/things/plans/ontology-ui-approach.md +18 -0
  682. package/one/things/plans/open-agent.md +152 -97
  683. package/one/things/plans/performace.md +32 -0
  684. package/one/things/plans/phase-1-foundation.md +620 -0
  685. package/one/things/plans/phase-3-implementation.md +1037 -0
  686. package/one/things/plans/quick-wins.md +342 -187
  687. package/one/things/plans/readme-backend-cleanup.md +54 -13
  688. package/one/things/plans/release.md +55 -2
  689. package/one/things/plans/repos.md +22 -0
  690. package/one/things/plans/separate-copy-2.md +127 -71
  691. package/one/things/plans/separate-copy-3.md +35 -14
  692. package/one/things/plans/separate-copy.md +127 -71
  693. package/one/things/plans/separate-demo.md +37 -3
  694. package/one/things/plans/separate.md +24 -6
  695. package/one/things/plans/sequence.md +155 -12
  696. package/one/things/plans/shadcn-integration-summary.md +104 -44
  697. package/one/things/plans/sidebar.md +44 -10
  698. package/one/things/plans/skills.md +103 -0
  699. package/one/things/plans/small-fixes.md +19 -1
  700. package/one/things/plans/start-new.md +34 -8
  701. package/one/things/plans/switch-off-auth.md +22 -0
  702. package/one/things/plans/sync-checklist.md +30 -0
  703. package/one/things/plans/test-backend-connection.md +38 -0
  704. package/one/things/plans/unified-implementation-plan.md +144 -62
  705. package/one/things/plans/update-demos.md +103 -35
  706. package/one/things/plans/use-our-backend.md +572 -0
  707. package/one/things/plans/wave1-onboarding-100-inferences.md +1686 -0
  708. package/one/things/plans/wave1-onboarding-vision.md +744 -0
  709. package/one/things/plans/wave1-orchestration-summary.md +604 -0
  710. package/one/things/plans/wave1-specialist-assignments.md +1413 -0
  711. package/one/things/plans/workflow-files.md +28 -14
  712. package/one/things/plans/workflow.md +18 -12
  713. package/one/things/products/cascade-landing-page.md +150 -46
  714. package/one/things/products/cascade.md +185 -135
  715. package/one/things/products/context-engineering.md +411 -350
  716. package/one/things/products/onthology.md +15 -0
  717. package/one/things/products/ontology-ui-shadcn.md +375 -353
  718. package/one/things/products/ontology-ui.md +101 -59
  719. package/one/things/products/ontology.md +90 -18
  720. package/one/things/products/sdk.md +181 -165
  721. package/one/things/promptkit.md +70 -43
  722. package/one/things/repos/all-repos.md +0 -0
  723. package/one/things/service-providers-new.md +95 -25
  724. package/one/things/service-providers.md +231 -202
  725. package/one/things/structure.md +532 -0
  726. package/one/things/system.md +18 -0
  727. package/one/things/templates.md +40 -0
  728. package/one/things/tests/2-1-dataprovider-interface.md +103 -31
  729. package/one/things/tests/2-1-test-analysis.md +65 -17
  730. package/one/things/things.md +48 -13
  731. package/one/things/todo-acp-integration.md +744 -0
  732. package/one/things/todo-ai.md +933 -0
  733. package/one/things/todo-api.md +1078 -0
  734. package/one/things/todo-assignment.md +580 -0
  735. package/one/things/todo-buy-chatgpt.md +1450 -0
  736. package/one/things/todo-components.md +1683 -0
  737. package/one/things/todo-connections.md +278 -0
  738. package/one/things/todo-ecommerce-frontend.md +1313 -0
  739. package/one/things/todo-ecommerce.md +569 -0
  740. package/one/things/todo-effects.md +1075 -0
  741. package/one/things/todo-frontend-effects.md +977 -0
  742. package/one/things/todo-landing-page.md +1091 -0
  743. package/one/things/todo-mail.md +1160 -0
  744. package/one/things/todo-master-plan.md +490 -0
  745. package/one/things/todo-onboard.md +666 -0
  746. package/one/things/todo-one-ie.md +538 -0
  747. package/one/things/todo-page.md +606 -0
  748. package/one/things/todo-plans.md +282 -0
  749. package/one/things/todo-projects.md +241 -0
  750. package/one/things/todo-refactoring-plan.md +366 -0
  751. package/one/things/todo-sequence.md +1621 -0
  752. package/one/things/todo-use-our-backend.md +1908 -0
  753. package/one/things/todo-workflow.md +626 -0
  754. package/one/things/todo-x402.md +2047 -0
  755. package/one/things/todo.md +459 -1075
  756. package/one/things/video/scripts-crypto.md +835 -0
  757. package/one/things/video-script-ontology.md +334 -0
  758. package/package.json +1 -1
  759. package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +0 -49
  760. package/one/knowledge/docs/flow.md +0 -0
  761. package/one/knowledge/documentation-summary.md +0 -285
  762. package/one/knowledge/inference-score.md +0 -159
  763. package/one/knowledge/ontology-frontend-copy-2.md +0 -1492
  764. package/one/knowledge/ontology-frontend-copy.md +0 -753
  765. package/one/knowledge/ontology-migration-guide.md +0 -811
  766. package/one/things/features/0 All Features.md +0 -2
  767. package/one/things/plans/1-create-workflow-status.md +0 -555
  768. package/one/things/plans/2-backend-agnostic-frontend.md +0 -546
  769. package/one/things/plans/2-sites.md +0 -895
  770. package/one/things/plans/3-groups.md +0 -735
  771. package/one/things/plans/5-build-frontend.md +0 -0
  772. package/one/things/plans/5-complete.md +0 -17
  773. package/one/things/plans/agent-director-100-inference-plans.md +0 -410
  774. package/one/things/plans/dual-website-strategy.md +0 -612
  775. package/one/things/plans/releases.md +0 -809
@@ -1,2077 +1,1742 @@
1
- # ONE Platform - System Architecture
1
+ ---
2
+ title: Architecture
3
+ dimension: knowledge
4
+ category: architecture.md
5
+ tags: agent, ai, architecture, people, system-design
6
+ related_dimensions: people, things
7
+ scope: global
8
+ created: 2025-11-03
9
+ updated: 2025-11-03
10
+ version: 1.0.0
11
+ ai_context: |
12
+ This document is part of the knowledge dimension in the architecture.md category.
13
+ Location: one/knowledge/architecture.md
14
+ Purpose: Documents one platform - the universal code generation language
15
+ Related dimensions: people, things
16
+ For AI agents: Read this to understand architecture.
17
+ ---
18
+
19
+ # ONE Platform - The Universal Code Generation Language
20
+
21
+ **Version:** 3.0.0
22
+ **Purpose:** Explain how ONE creates a Domain-Specific Language (DSL) that enables compound structure accuracy in AI code generation
23
+
24
+ ---
25
+
26
+ ## Why This Changes Everything
27
+
28
+ ### The Breakthrough Insight
29
+
30
+ **Most people think AI code generation has a fundamental problem: it gets worse as codebases grow.**
31
+
32
+ They're right. But not because AI is fundamentally limited. Because **traditional architectures are optimized for humans, not AI**.
33
+
34
+ ONE flips this. It creates an architecture where:
35
+
36
+ - **Every new line of code makes the next line MORE accurate**
37
+ - **The 10,000-file codebase is EASIER than the 100-file codebase**
38
+ - **Agents don't just write code—they BUILD a universal language**
39
+
40
+ This isn't incremental improvement. **This is a paradigm shift.**
41
+
42
+ ### The Economic Impact
43
+
44
+ **Traditional Development:**
45
+ - Developer writes 100 lines/day
46
+ - AI assistance degrades over time
47
+ - Technical debt compounds
48
+ - Codebases become unmaintainable
49
+ - **Cost scales linearly with codebase size**
50
+
51
+ **ONE Development:**
52
+ - Agent generates 10,000 lines/day (100x)
53
+ - AI accuracy improves over time (98%+)
54
+ - Structure compounds (technical credit)
55
+ - Codebases become MORE maintainable
56
+ - **Cost scales sublinearly—larger codebases are cheaper per feature**
57
+
58
+ **Result:** 100x developer productivity. Not hyperbole. Math.
59
+
60
+ ### The "Aha Moment"
61
+
62
+ Traditional codebases have **infinite ways to express the same concept**:
63
+
64
+ ```typescript
65
+ // 10 different ways to create a user
66
+ createUser(email)
67
+ addUser(email)
68
+ registerUser(email)
69
+ insertUser(email)
70
+ saveUser(email)
71
+ User.create(email)
72
+ new User(email).save()
73
+ db.users.add(email)
74
+ await createNewUser(email)
75
+ userService.register(email)
76
+ ```
77
+
78
+ **Agents see:** 10 different patterns. Accuracy degrades.
79
+
80
+ ONE has **ONE way**:
81
+
82
+ ```typescript
83
+ // Always the same pattern
84
+ provider.things.create({ type: "user", name: email, properties: { email } })
85
+ ```
86
+
87
+ **Agents see:** ONE pattern. Accuracy compounds.
88
+
89
+ **This is the insight.** Restrict expressiveness for humans (slight cost). Maximize pattern recognition for AI (massive gain).
90
+
91
+ ---
92
+
93
+ ## The Core Vision
94
+
95
+ This isn't about "simplifying for beginners." This is about creating a **Domain-Specific Language (DSL)** that:
96
+
97
+ 1. **Models reality, not technology** (groups, people, things, connections, events, knowledge)
98
+ 2. **Never breaks** (because reality doesn't change, even when technology does)
99
+ 3. **Makes each line of code add structure** (compound accuracy over time)
100
+ 4. **Enables universal feature import** (clone ANY system into the ontology)
101
+
102
+ ### The Problem with Traditional Architectures
103
+
104
+ **Traditional AI code generation degrades over time:**
105
+
106
+ ```
107
+ Generation 1: Clean code → 95% accurate
108
+ Generation 2: Slight drift → 90% accurate (-5% - patterns starting to diverge)
109
+ Generation 3: Pattern divergence → 80% accurate (-10% - AI sees multiple patterns)
110
+ Generation 4: Inconsistency → 65% accurate (-15% - AI confused by variations)
111
+ Generation N: Unmaintainable mess → 30% accurate (-20% - complete chaos)
112
+ ```
113
+
114
+ **Why?**
115
+ 1. No universal structure (every feature introduces new patterns)
116
+ 2. Technology-specific abstractions leak (React patterns, SQL patterns, REST patterns)
117
+ 3. Infinite expressiveness (100 ways to do the same thing)
118
+ 4. Implicit dependencies (global state, side effects)
119
+ 5. Untyped errors (try/catch everywhere, no pattern)
120
+
121
+ **The death spiral:** Each feature makes the next feature HARDER to generate accurately.
122
+
123
+ ### The ONE Approach: Compound Structure Accuracy
124
+
125
+ **ONE's AI code generation improves over time:**
126
+
127
+ ```
128
+ Generation 1: Maps to ontology → 85% accurate (learning the ontology)
129
+ Generation 2: Follows patterns → 90% accurate (+5% - recognizing service pattern)
130
+ Generation 3: Reuses services → 93% accurate (+3% - composing existing services)
131
+ Generation 4: Predictable structure → 96% accurate (+3% - mastering Effect.ts patterns)
132
+ Generation N: Perfect consistency → 98%+ accurate (+2% - generalized patterns)
133
+ ```
134
+
135
+ **Why?**
136
+ 1. Universal structure (everything maps to 6 dimensions)
137
+ 2. Reality-based abstraction (groups/people/things never change)
138
+ 3. Restricted expressiveness (ONE way to do each thing)
139
+ 4. Explicit dependencies (Effect.ts makes everything visible)
140
+ 5. Typed errors (tagged unions, exhaustive patterns)
141
+
142
+ **The virtuous cycle:** Each feature makes the next feature EASIER to generate accurately.
143
+
144
+ ### Visual: Pattern Convergence vs Divergence
145
+
146
+ **Traditional Codebase (Pattern Divergence):**
147
+
148
+ ```
149
+ Feature 1: createUser(email) ────────┐
150
+ Feature 2: addProduct(name) ─────────┼─→ 10 patterns
151
+ Feature 3: registerCustomer(data) ───┤ AI confused
152
+ Feature 4: insertOrder(items) ───────┤ Accuracy: 30%
153
+ Feature 5: saveInvoice(invoice) ─────┘
154
+ ...each uses different approach
155
+ ```
156
+
157
+ **ONE Codebase (Pattern Convergence):**
158
+
159
+ ```
160
+ Feature 1: provider.things.create({ type: "user" }) ────┐
161
+ Feature 2: provider.things.create({ type: "product" }) ─┼─→ 1 pattern
162
+ Feature 3: provider.things.create({ type: "customer" })─┤ AI masters it
163
+ Feature 4: provider.things.create({ type: "order" }) ───┤ Accuracy: 98%
164
+ Feature 5: provider.things.create({ type: "invoice" }) ─┘
165
+ ...all use same pattern
166
+ ```
167
+
168
+ **The difference:** Traditional codebases teach AI 100 patterns (chaos). ONE teaches AI 1 pattern (mastery).
169
+
170
+ ---
171
+
172
+ ## The Three Pillars of the Universal Language
173
+
174
+ ### Pillar 1: The 6-Dimension Ontology (Reality as DSL)
175
+
176
+ **The ontology IS the language. Every feature in every system maps to these 6 dimensions:**
177
+
178
+ ```typescript
179
+ interface Reality {
180
+ groups: Container[]; // Hierarchical spaces (friend circles → governments)
181
+ people: Actor[]; // Authorization (who can do what)
182
+ things: Entity[]; // All nouns (users, products, courses, agents)
183
+ connections: Relation[]; // All verbs (owns, enrolled_in, purchased)
184
+ events: Action[]; // Audit trail (what happened when)
185
+ knowledge: Embedding[]; // Understanding (RAG, search, AI)
186
+ }
187
+ ```
188
+
189
+ **Why this works:**
190
+
191
+ 1. **Reality doesn't change** - Groups always contain things, people always authorize, connections always relate
192
+ 2. **Technology does change** - React → Svelte, REST → GraphQL, MySQL → Convex
193
+ 3. **The ontology maps to ALL technology** - It's an abstraction of reality itself
194
+ 4. **Agents understand reality** - Not framework-specific patterns
195
+
196
+ **Example: Mapping Shopify to the Ontology**
197
+
198
+ ```
199
+ Shopify Products → things (type: product)
200
+ Shopify Customers → people (role: customer)
201
+ Shopify Orders → connections (type: purchased) + events (type: order_placed)
202
+ Shopify Cart → connections (type: in_cart)
203
+ Shopify Inventory → properties on product thing
204
+ Shopify Admin → people (role: org_owner)
205
+ Shopify Store → groups (type: business)
206
+ ```
207
+
208
+ **The agent doesn't learn Shopify. It learns the ontology. Shopify maps to it.**
209
+
210
+ ### Pillar 2: Effect.ts (Composable Structure for Agents)
211
+
212
+ **Effect.ts isn't for humans. It's for AGENTS.**
213
+
214
+ Humans see this:
215
+ ```typescript
216
+ const registerUser = Effect.gen(function* () {
217
+ const validated = yield* validateUser(input);
218
+ const user = yield* createUser(validated);
219
+ yield* sendEmail(user);
220
+ return user;
221
+ });
222
+ ```
2
223
 
3
- **Version:** 2.0.0
4
- **Purpose:** Explain the beautiful three-layer separation with Effect.ts as the glue layer
224
+ Agents see this:
225
+ ```
226
+ PATTERN DETECTED: Service composition
227
+ - Input: unknown data
228
+ - Step 1: Validation (Effect<T, ValidationError>)
229
+ - Step 2: Persistence (Effect<T, DatabaseError>)
230
+ - Step 3: Side effect (Effect<void, EmailError>)
231
+ - Output: Success or tagged union error
232
+ - PREDICTABLE. STRUCTURED. COMPOSABLE.
233
+ ```
234
+
235
+ **Why Effect.ts:**
236
+
237
+ 1. **Readable** - Each line is a discrete step (agents can parse steps)
238
+ 2. **Structured** - Error handling is explicit (tagged unions, no try/catch)
239
+ 3. **Composable** - Services chain together predictably (agents compose services)
240
+ 4. **Type-safe** - 100% typed (`Effect<Success, Error, Dependencies>`)
241
+ 5. **Agent-friendly** - Patterns are consistent across entire codebase
242
+
243
+ **Every service follows this pattern. Every. Single. One. That's compound structure.**
244
+
245
+ ### Pillar 3: Provider Pattern (Universal Adapter)
246
+
247
+ **The provider pattern isn't "extra complexity" - it's the UNIVERSAL INTERFACE.**
248
+
249
+ ```typescript
250
+ // Frontend speaks ontology (never changes)
251
+ const provider = getContentProvider("products");
252
+ const products = await provider.things.list();
253
+
254
+ // Backend can be ANYTHING:
255
+ // - Shopify, WordPress, Convex, Supabase, Custom API
256
+ // The ontology is the CONTRACT
257
+ ```
258
+
259
+ **This is how agent-clone imports ANY feature from ANY system.**
260
+
261
+ ```typescript
262
+ // Same interface for ALL backends
263
+ interface ContentProvider {
264
+ things: {
265
+ list: (opts) => Effect.Effect<Thing[], QueryError>;
266
+ get: (id) => Effect.Effect<Thing, NotFoundError>;
267
+ create: (input) => Effect.Effect<string, CreateError>;
268
+ };
269
+ connections: { /* ... */ };
270
+ events: { /* ... */ };
271
+ knowledge: { /* ... */ };
272
+ }
273
+ ```
274
+
275
+ **Implementations:**
276
+ - `MarkdownProvider` - Development (static files)
277
+ - `ConvexProvider` - Production (real-time database)
278
+ - `ShopifyProvider` - E-commerce (Shopify API → ontology)
279
+ - `WordPressProvider` - Content (WordPress REST → ontology)
280
+ - `SupabaseProvider` - Custom backend (PostgreSQL → ontology)
281
+
282
+ **The frontend code NEVER changes. One env var switches backends.**
5
283
 
6
284
  ---
7
285
 
8
- ## 🎯 The Beautiful Separation
286
+ ## Counter-Arguments Addressed
9
287
 
10
- This architecture achieves **perfect separation of concerns** with three distinct layers:
288
+ ### "Effect.ts is too verbose and complex"
289
+
290
+ **Counter:** Effect.ts isn't designed for human reading pleasure. It's designed for AI pattern recognition.
291
+
292
+ Compare these:
293
+
294
+ **Option A: Concise (for humans)**
295
+ ```typescript
296
+ async function buy(id) {
297
+ const p = await stripe.charge(99);
298
+ const t = await mint(id);
299
+ await db.add(p, t);
300
+ }
301
+ ```
302
+
303
+ **Option B: Explicit (for agents)**
304
+ ```typescript
305
+ const buy = (id: string): Effect.Effect<Purchase, StripeError | MintError | DbError> =>
306
+ Effect.gen(function* () {
307
+ const payment = yield* stripe.charge(99);
308
+ const tokens = yield* mint(id);
309
+ const purchase = yield* db.insert({ payment, tokens });
310
+ return purchase;
311
+ });
312
+ ```
313
+
314
+ **Humans prefer A** (less typing, looks cleaner).
315
+
316
+ **Agents need B** because:
317
+ 1. Input/output types are explicit (`string` → `Purchase`)
318
+ 2. All possible errors are in the signature (`StripeError | MintError | DbError`)
319
+ 3. Every dependency is visible (no hidden imports)
320
+ 4. Every step is discrete (can be pattern-matched)
321
+ 5. Composition is predictable (always `Effect.gen` + `yield*`)
322
+
323
+ **The tradeoff:** Write 20% more code. Get 300% better AI accuracy. Worth it.
324
+
325
+ ### "The ontology is too generic—you lose domain specificity"
326
+
327
+ **Counter:** Generic schema, specific metadata. Best of both worlds.
328
+
329
+ **Bad approach:** Custom tables for everything
330
+ ```sql
331
+ CREATE TABLE courses (...)
332
+ CREATE TABLE products (...)
333
+ CREATE TABLE events (...)
334
+ CREATE TABLE workshops (...)
335
+ -- 100 custom tables = 100 patterns = AI confusion
336
+ ```
337
+
338
+ **ONE approach:** One schema, rich metadata
339
+ ```typescript
340
+ // All are "things" with type-specific properties
341
+ { type: "course", properties: { instructor, curriculum, duration } }
342
+ { type: "product", properties: { price, inventory, variants } }
343
+ { type: "event", properties: { date, location, capacity } }
344
+ { type: "workshop", properties: { instructor, materials, prerequisites } }
345
+ ```
346
+
347
+ **Why this works:**
348
+ - **AI learns ONE pattern** (create thing → connection → event → knowledge)
349
+ - **Full type safety** (Zod schemas validate properties per type)
350
+ - **Domain flexibility** (properties can be ANYTHING for each type)
351
+ - **Query simplicity** (`things.filter(t => t.type === "course")`)
352
+
353
+ **You don't lose specificity. You gain universality.**
354
+
355
+ ### "Nanostores adds unnecessary complexity"
356
+
357
+ **Counter:** Nanostores REMOVES complexity by providing structure.
358
+
359
+ **Without nanostores (Astro islands can't communicate):**
360
+ ```typescript
361
+ // Island 1: Header.tsx (can't access cart)
362
+ // Island 2: AddToCart.tsx (can't update header)
363
+ // Island 3: CartSidebar.tsx (can't sync with others)
364
+
365
+ // "Solutions":
366
+ // - localStorage (unstructured, no types)
367
+ // - URL params (messy, limited data)
368
+ // - window.dispatchEvent (no types, manual sync)
369
+ // - Rebuild as SPA (lose Astro benefits)
370
+ ```
371
+
372
+ **With nanostores (ONE pattern):**
373
+ ```typescript
374
+ // stores/cart.ts
375
+ export const cart$ = atom<CartItem[]>([]);
376
+
377
+ // ANY island can read/write
378
+ const cart = useStore(cart$);
379
+ cart$.set([...cart, newItem]);
380
+ ```
381
+
382
+ **Agents see:** ONE way to share state across islands. Pattern learned. Accuracy compounds.
383
+
384
+ ### "Provider pattern is over-engineering"
385
+
386
+ **Counter:** Provider pattern is the ONLY way to achieve backend agnosticism.
387
+
388
+ **Without providers:**
389
+ ```typescript
390
+ // Tightly coupled to Convex
391
+ const product = await ctx.db.query("products").first();
392
+
393
+ // Want to switch to WordPress? REWRITE EVERYTHING.
394
+ ```
395
+
396
+ **With providers:**
397
+ ```typescript
398
+ // Backend-agnostic
399
+ const product = await provider.things.get(productId);
400
+
401
+ // Switch backends with ONE ENV VAR:
402
+ // CONTENT_SOURCE=markdown (development)
403
+ // CONTENT_SOURCE=convex (production)
404
+ // CONTENT_SOURCE=wordpress (existing site)
405
+ // CONTENT_SOURCE=shopify (e-commerce)
406
+
407
+ // CODE NEVER CHANGES.
408
+ ```
409
+
410
+ **This isn't over-engineering. This is the MINIMUM structure needed for true portability.**
411
+
412
+ ---
413
+
414
+ ## The Agent's Perspective: What AI Actually "Sees"
415
+
416
+ ### Humans vs Agents
417
+
418
+ **Humans think in concepts:**
419
+ - "I need to create a user"
420
+ - "I should add authentication"
421
+ - "Let's build a shopping cart"
422
+
423
+ **Agents think in patterns:**
424
+ - "I've seen `provider.things.create` 47 times. 98% confidence this is the pattern."
425
+ - "Every time I see `Effect.gen`, the next line is `yield*`. 100% confidence."
426
+ - "Services always have dependencies in the constructor. Pattern complete."
427
+
428
+ ### What Traditional Codebases Look Like to Agents
429
+
430
+ **Agent analyzing traditional codebase:**
431
+
432
+ ```
433
+ File 1: createUser(email) { await db.users.insert({email}) }
434
+ File 2: addProduct(name, price) { await database.products.add({name, price}) }
435
+ File 3: registerCustomer(data) { try { await api.post('/customers', data) } catch (e) { ... } }
436
+ File 4: insertOrder(items) { const order = new Order(items); await order.save(); }
437
+ File 5: saveInvoice(inv) { await db.collection('invoices').insertOne(inv) }
438
+
439
+ AGENT ANALYSIS:
440
+ - Pattern confidence: 23%
441
+ - 5 different function naming conventions
442
+ - 4 different data access patterns
443
+ - 3 different error handling approaches
444
+ - 2 different promise patterns
445
+ - PREDICTION: Next "create entity" function will use ???
446
+
447
+ ACCURACY: 45% (guessing)
448
+ ```
449
+
450
+ **Agent analyzing ONE codebase:**
451
+
452
+ ```
453
+ File 1: provider.things.create({ type: "user", name: email, properties: { email } })
454
+ File 2: provider.things.create({ type: "product", name, properties: { price } })
455
+ File 3: provider.things.create({ type: "customer", name: data.name, properties: data })
456
+ File 4: provider.things.create({ type: "order", name: `Order ${id}`, properties: { items } })
457
+ File 5: provider.things.create({ type: "invoice", name: inv.number, properties: inv })
458
+
459
+ AGENT ANALYSIS:
460
+ - Pattern confidence: 98%
461
+ - 1 function pattern (provider.things.create)
462
+ - 1 data structure ({ type, name, properties })
463
+ - 1 error handling pattern (Effect errors)
464
+ - 1 promise pattern (Effect<T, E>)
465
+ - PREDICTION: Next "create entity" function will use provider.things.create
466
+
467
+ ACCURACY: 98% (certainty)
468
+ ```
469
+
470
+ **The difference:** Traditional code requires AI to be a "code psychic" (guess the pattern). ONE code requires AI to be a "pattern matcher" (recognize the pattern).
471
+
472
+ ### Learning Progression: How Agents Master ONE
473
+
474
+ **Generation 1-5: Learning the Ontology (85% accurate)**
475
+
476
+ Agent thinks:
477
+ ```
478
+ "I see things being created with `type` field. Let me check..."
479
+ "All entities are things? Even users, products, courses?"
480
+ "Connections link things together. Got it."
481
+ "Events log actions. People are actors."
482
+ "Pattern emerging: 6 dimensions for everything."
483
+ CONFIDENCE: 85% (still learning)
484
+ ```
485
+
486
+ **Generation 6-20: Recognizing Patterns (90% accurate)**
487
+
488
+ Agent thinks:
489
+ ```
490
+ "Every create operation uses provider.things.create. 100% of the time."
491
+ "Every service uses Effect.gen. Pattern confirmed."
492
+ "All errors are tagged unions. I can handle exhaustively."
493
+ "Dependencies are injected. I know what's needed."
494
+ CONFIDENCE: 90% (pattern recognized)
495
+ ```
496
+
497
+ **Generation 21-50: Composing Services (93% accurate)**
498
+
499
+ Agent thinks:
500
+ ```
501
+ "I can reuse existing services:"
502
+ "- createThing service exists"
503
+ "- createConnection service exists"
504
+ "- logEvent service exists"
505
+ "My new feature: compose these three services."
506
+ "No new patterns needed. Just composition."
507
+ CONFIDENCE: 93% (composing existing patterns)
508
+ ```
509
+
510
+ **Generation 51-100: Mastering Structure (96% accurate)**
511
+
512
+ Agent thinks:
513
+ ```
514
+ "I've generated 50 services. All follow same structure:"
515
+ "1. Get provider from context"
516
+ "2. Call provider operation"
517
+ "3. Handle typed errors"
518
+ "4. Return typed result"
519
+ "Pattern is UNIVERSAL. Works for ANY feature."
520
+ CONFIDENCE: 96% (mastered the structure)
521
+ ```
522
+
523
+ **Generation 100+: Generalizing (98%+ accurate)**
524
+
525
+ Agent thinks:
526
+ ```
527
+ "I don't even need to think. The pattern IS the system."
528
+ "New feature request? Map to 6 dimensions."
529
+ "Need validation? Effect.ts service."
530
+ "Need data? Provider interface."
531
+ "Need state? Nanostores."
532
+ "Every decision is deterministic."
533
+ CONFIDENCE: 98%+ (system internalized)
534
+ ```
535
+
536
+ ---
537
+
538
+ ## What 98% Accuracy Enables
539
+
540
+ ### Today (With 30-70% AI Accuracy)
541
+
542
+ **Development workflow:**
543
+ 1. Developer writes spec (1 hour)
544
+ 2. AI generates code (30-70% accurate)
545
+ 3. Developer fixes bugs (3-5 hours)
546
+ 4. Developer refactors for consistency (2 hours)
547
+ 5. **Total: 6-8 hours per feature**
548
+
549
+ **Economics:**
550
+ - AI saves maybe 30% of time
551
+ - Still need senior developers
552
+ - Still accumulates technical debt
553
+ - **Cost: $150/hour × 6 hours = $900/feature**
554
+
555
+ ### Tomorrow (With 98% AI Accuracy via ONE)
556
+
557
+ **Development workflow:**
558
+ 1. Developer writes spec (1 hour)
559
+ 2. AI generates code (98% accurate)
560
+ 3. Developer reviews (30 minutes)
561
+ 4. **Total: 1.5 hours per feature**
562
+
563
+ **Economics:**
564
+ - AI saves 80% of time
565
+ - Junior developers can review
566
+ - Structure compounds (technical credit)
567
+ - **Cost: $50/hour × 1.5 hours = $75/feature**
568
+
569
+ **Result: 12x cheaper per feature. Not 2x. 12x.**
570
+
571
+ ### Future (With Agent-Clone)
572
+
573
+ **Development workflow:**
574
+ 1. Point agent-clone at Shopify repo (5 minutes)
575
+ 2. AI maps to ontology automatically (5 minutes)
576
+ 3. AI generates entire e-commerce platform (10 minutes)
577
+ 4. **Total: 20 minutes for full clone**
578
+
579
+ **Economics:**
580
+ - Cloning Shopify from scratch normally takes 6-12 months
581
+ - With agent-clone: 20 minutes
582
+ - **Time savings: 99.999%**
583
+ - **Cost savings: Infinite (effectively free after ONE setup)**
584
+
585
+ ### What Becomes Possible
586
+
587
+ **1. Infinite Customization (No Cost Penalty)**
588
+
589
+ Traditional: Every customization adds technical debt. Eventually unmaintainable.
590
+
591
+ ONE: Every customization adds to the ontology. System becomes MORE maintainable.
592
+
593
+ **2. Instant Platform Migration**
594
+
595
+ Traditional: Migrating from WordPress to custom backend takes months.
596
+
597
+ ONE: Switch `CONTENT_SOURCE` env var. Done in 1 minute.
598
+
599
+ **3. Universal Feature Import**
600
+
601
+ Traditional: Want Shopify's checkout? Build it from scratch (3 months).
602
+
603
+ ONE: Point agent-clone at Shopify. Clone checkout feature (20 minutes).
604
+
605
+ **4. Compound Velocity**
606
+
607
+ Traditional: Feature #100 takes LONGER than feature #1 (technical debt).
608
+
609
+ ONE: Feature #100 takes LESS TIME than feature #1 (pattern reuse).
610
+
611
+ **5. AI-Native Development**
612
+
613
+ Traditional: AI is an assistant. Human is the driver.
614
+
615
+ ONE: AI is the primary builder. Human is the architect.
616
+
617
+ ---
618
+
619
+ ## Real Metrics: Why This Matters
620
+
621
+ ### Context Efficiency
622
+
623
+ **Before (Traditional Architecture):**
624
+ - Agent needs to read 10,000+ lines to understand patterns
625
+ - 80% of context is irrelevant to current task
626
+ - Pattern recognition confidence: 30-50%
627
+ - Generation time: 60 seconds per feature
628
+ - **Cost: $0.06/1k tokens × 50k tokens = $3/feature**
629
+
630
+ **After (ONE Architecture):**
631
+ - Agent needs to read 2,000 lines (ontology + patterns)
632
+ - 90% of context is directly relevant
633
+ - Pattern recognition confidence: 98%
634
+ - Generation time: 15 seconds per feature
635
+ - **Cost: $0.06/1k tokens × 5k tokens = $0.30/feature**
636
+
637
+ **Result: 10x context efficiency. 4x faster. 10x cheaper.**
638
+
639
+ ### Accuracy Compounding
640
+
641
+ **Example: Building a SaaS with 100 features**
642
+
643
+ **Traditional approach:**
644
+ ```
645
+ Feature 1-10: 90% accurate × 10 = 9 working features, 1 broken
646
+ Feature 11-20: 80% accurate × 10 = 8 working features, 2 broken
647
+ Feature 21-30: 70% accurate × 10 = 7 working features, 3 broken
648
+ Feature 31-40: 60% accurate × 10 = 6 working features, 4 broken
649
+ ...
650
+ Feature 91-100: 30% accurate × 10 = 3 working features, 7 broken
651
+
652
+ Total: 50/100 features working correctly
653
+ Time to fix: 250 hours (debugging mess)
654
+ ```
655
+
656
+ **ONE approach:**
657
+ ```
658
+ Feature 1-10: 85% accurate × 10 = 8.5 working features, 1.5 broken
659
+ Feature 11-20: 90% accurate × 10 = 9 working features, 1 broken
660
+ Feature 21-30: 93% accurate × 10 = 9.3 working features, 0.7 broken
661
+ Feature 31-40: 96% accurate × 10 = 9.6 working features, 0.4 broken
662
+ ...
663
+ Feature 91-100: 98% accurate × 10 = 9.8 working features, 0.2 broken
664
+
665
+ Total: 95/100 features working correctly
666
+ Time to fix: 25 hours (minor tweaks)
667
+ ```
668
+
669
+ **Difference:**
670
+ - 1.9x more working features
671
+ - 10x less debugging time
672
+ - System is MORE maintainable at the end (not less)
673
+
674
+ ### The Exponential Payoff
675
+
676
+ **Feature #1:**
677
+ - Traditional: 8 hours (70% AI, 30% human)
678
+ - ONE: 8 hours (70% AI, 30% human)
679
+ - **No difference yet**
680
+
681
+ **Feature #10:**
682
+ - Traditional: 10 hours (60% AI, 40% human - patterns diverging)
683
+ - ONE: 6 hours (85% AI, 15% human - patterns converging)
684
+ - **ONE is 1.7x faster**
685
+
686
+ **Feature #50:**
687
+ - Traditional: 16 hours (40% AI, 60% human - technical debt)
688
+ - ONE: 3 hours (95% AI, 5% human - pattern mastery)
689
+ - **ONE is 5.3x faster**
690
+
691
+ **Feature #100:**
692
+ - Traditional: 24 hours (25% AI, 75% human - chaos)
693
+ - ONE: 1.5 hours (98% AI, 2% human - generalized)
694
+ - **ONE is 16x faster**
695
+
696
+ **Cumulative for 100 features:**
697
+ - Traditional: 1,400 hours
698
+ - ONE: 350 hours
699
+ - **ONE is 4x faster overall**
700
+ - **And the gap keeps growing**
701
+
702
+ ---
703
+
704
+ ## The Architecture: Layered Reality
705
+
706
+ **Every single thing in ONE platform exists within one of these 6 dimensions:**
707
+
708
+ ```
709
+ ┌──────────────────────────────────────────────────────────────┐
710
+ │ 1. GROUPS │
711
+ │ Multi-tenant isolation with hierarchical nesting - who owns │
712
+ │ what at group level (friend circles → DAOs → governments) │
713
+ └──────────────────────────────────────────────────────────────┘
714
+ ↓
715
+ ┌──────────────────────────────────────────────────────────────┐
716
+ │ 2. PEOPLE │
717
+ │ Authorization & governance - platform owner, group owners │
718
+ └──────────────────────────────────────────────────────────────┘
719
+ ↓
720
+ ┌──────────────────────────────────────────────────────────────┐
721
+ │ 3. THINGS │
722
+ │ Every "thing" - users, agents, content, tokens, courses │
723
+ └──────────────────────────────────────────────────────────────┘
724
+ ↓
725
+ ┌──────────────────────────────────────────────────────────────┐
726
+ │ 4. CONNECTIONS │
727
+ │ Every relationship - owns, follows, taught_by, powers │
728
+ └──────────────────────────────────────────────────────────────┘
729
+ ↓
730
+ ┌──────────────────────────────────────────────────────────────┐
731
+ │ 5. EVENTS │
732
+ │ Every action - purchased, created, viewed, completed │
733
+ └──────────────────────────────────────────────────────────────┘
734
+ ↓
735
+ ┌──────────────────────────────────────────────────────────────┐
736
+ │ 6. KNOWLEDGE │
737
+ │ Labels + chunks + vectors powering RAG & search │
738
+ └──────────────────────────────────────────────────────────────┘
739
+ ```
740
+
741
+ **How Technology Layers Implement the 6-Dimension DSL:**
11
742
 
12
743
  ```
13
744
  ┌─────────────────────────────────────────────────────────────────────┐
14
- │ LAYER 1: ASTRO FRONTEND │
15
- │ Documentation: docs/Frontend.md │
745
+ │ LAYER 1: UNIVERSAL INTERFACE │
746
+ │ (The 6-Dimension DSL) │
16
747
  ├─────────────────────────────────────────────────────────────────────┤
17
- │ ✅ User-customizable "vibe code" │
18
- │ ✅ Islands architecture (static + selective hydration) │
19
- │ ✅ Content collections (type-safe blog, docs, marketing) │
20
- │ ✅ shadcn/ui components + Tailwind v4 │
21
- │ ✅ Deployed to Cloudflare Pages (global edge SSR) │
748
+ │ groups → Hierarchical containers (friend circles → governments)│
749
+ │ people → Authorization & governance (who can do what) │
750
+ │ things → All entities (66 types: user, product, course...) │
751
+ │ connections → All relationships (25 types: owns, purchased...) │
752
+ │ events → All actions (67 types: created, updated, logged...) │
753
+ │ knowledge → AI understanding (embeddings, search, RAG) │
22
754
  │ │
23
- │ Pages (.astro) React Islands Content Collections │
24
- │ ├─ SEO-optimized ├─ Interactive UI ├─ Type-safe schemas │
25
- │ ├─ Fast load ├─ Real-time data ├─ References │
26
- │ └─ Static gen └─ Convex hooks └─ Search/filter │
755
+ │ This layer NEVER changes. It models reality. │
27
756
  └──────────────────┬──────────────────────────────────────────────────┘
28
757
  │
29
- │ Convex hooks (useQuery, useMutation)
30
- │ Hono API client (REST for mutations)
31
758
  ↓
32
759
  ┌─────────────────────────────────────────────────────────────────────┐
33
- │ LAYER 2: EFFECT.TS GLUE LAYER (100% Coverage) │
34
- │ Documentation: docs/Hono.md + docs/Architecture.md │
760
+ │ LAYER 2: COMPOSITION ENGINE │
761
+ │ (Effect.ts Services) │
35
762
  ├─────────────────────────────────────────────────────────────────────┤
36
- │ ✅ ALL business logic (pure functional programming) │
37
- │ ✅ Service providers for external APIs │
38
- │ ✅ Typed errors throughout (no try/catch) │
39
- │ ✅ Automatic dependency injection │
40
- │ ✅ Built-in retry, timeout, resource management │
763
+ │ ALL business logic (pure functional programming) │
764
+ │ ├─ Service layer (composable business logic) │
765
+ │ ├─ Provider layer (external system adapters) │
766
+ │ ├─ Layer system (dependency injection) │
767
+ │ └─ 100% Effect.ts (typed errors, automatic retry/timeout) │
41
768
  │ │
42
- │ Services Providers Layers │
43
- │ ├─ TokenService ├─ StripeProvider ├─ MainLayer │
44
- │ ├─ AgentService ├─ SuiProvider ├─ TestLayer │
45
- │ ├─ ContentService ├─ OpenAIProvider ├─ DevLayer │
46
- │ └─ 100% Effect.ts └─ ResendProvider └─ DI automatic │
769
+ │ Services compose ontology operations into features. │
47
770
  └──────────────────┬──────────────────────────────────────────────────┘
48
771
  │
49
- │ Confect bridge (Effect.ts ↔ Convex)
50
- │ Hono routes (Effect.ts ↔ HTTP)
51
772
  ↓
52
773
  ┌─────────────────────────────────────────────────────────────────────┐
53
- │ LAYER 3: BACKEND (Hono + Convex) │
54
- │ Documentation: docs/Hono.md │
774
+ │ LAYER 3: TECHNOLOGY ADAPTERS │
775
+ │ (Convex, Hono, Astro, React) │
55
776
  ├─────────────────────────────────────────────────────────────────────┤
56
- │ ✅ Hono: REST API routes (Cloudflare Workers) │
57
- │ ✅ Convex: Real-time database + typed functions │
58
- │ ✅ Better Auth: Authentication with Convex adapter │
59
- │ ✅ 6-Dimension Ontology: Reality-aware data model │
777
+ │ Backend: Hono API + Convex Database (implements ontology) │
778
+ │ Frontend: Astro SSR + React Islands (renders ontology) │
779
+ │ Real-time: Convex hooks (live ontology subscriptions) │
780
+ │ Static: Astro Content Collections (ontology as files) │
60
781
  │ │
61
- │ Hono API Routes Convex Functions 6-Dimension Ontology │
62
- │ ├─ /api/auth/* ├─ Queries (reads) ├─ organizations │
63
- │ ├─ /api/tokens/* ├─ Mutations (writes) ├─ people │
64
- │ ├─ /api/agents/* ├─ Actions (external) ├─ things (entities) │
65
- │ └─ /api/content/* └─ Real-time subs ├─ connections │
66
- │ ├─ events │
67
- │ └─ knowledge │
782
+ │ Technology can be swapped. Ontology stays the same. │
68
783
  └─────────────────────────────────────────────────────────────────────┘
69
784
  ```
70
785
 
71
- ## 🔑 Key Architectural Decisions
786
+ ### Layer Interactions
72
787
 
73
- ### 1. Effect.ts as the Glue Layer (100% Coverage)
788
+ **Example: User purchases a course**
74
789
 
75
- **Decision:** ALL business logic uses Effect.ts (no raw async/await)
790
+ ```typescript
791
+ // LAYER 1: Ontology (The Language)
792
+ // These dimensions are ALWAYS the same, regardless of technology
793
+
794
+ Group: "fitnesspro" (organization boundary)
795
+ Person: "john@fitnesspro.com" (actor, role: customer)
796
+ Thing: "Fitness Fundamentals" (entity, type: course)
797
+ Connection: john -[purchased]-> course (relationship)
798
+ Event: "purchase_completed" (action, actorId: john)
799
+ Knowledge: "John likes fitness courses" (AI learning)
800
+
801
+ // LAYER 2: Service (Effect.ts - The Composition)
802
+ const purchaseCourse = Effect.gen(function* () {
803
+ const provider = yield* DataProvider;
804
+
805
+ // Step 1: Validate (ontology operation)
806
+ const person = yield* provider.people.get(userId);
807
+ const course = yield* provider.things.get(courseId);
808
+
809
+ // Step 2: Create connection (ontology operation)
810
+ const purchase = yield* provider.connections.create({
811
+ fromPersonId: person._id,
812
+ toThingId: course._id,
813
+ relationshipType: "purchased",
814
+ metadata: { amount: 99, method: "stripe" },
815
+ });
76
816
 
77
- **Why:**
78
- - **Consistency:** Same patterns across entire codebase
79
- - **Type Safety:** Errors are explicit in type signatures
80
- - **Composability:** Services combine cleanly without callback hell
81
- - **Testability:** Easy to mock dependencies via layers
82
- - **Observability:** Built-in tracing, logging, metrics
817
+ // Step 3: Log event (ontology operation)
818
+ yield* provider.events.log({
819
+ type: "purchase_completed",
820
+ actorId: person._id,
821
+ targetId: purchase._id,
822
+ metadata: { amount: 99 },
823
+ });
83
824
 
84
- **Example:**
85
- ```typescript
86
- // ❌ WRONG: Raw async/await in business logic
87
- export const purchaseTokens = mutation({
88
- handler: async (ctx, args) => {
89
- try {
90
- const payment = await stripe.charge(args.amount);
91
- const tokens = await blockchain.mint(args.tokenId);
92
- await ctx.db.insert("events", { /* ... */ });
93
- return { success: true };
94
- } catch (error) {
95
- throw new Error("Purchase failed");
96
- }
97
- }
825
+ return { success: true, purchaseId: purchase._id };
98
826
  });
99
827
 
100
- // ✅ CORRECT: 100% Effect.ts
101
- export const purchaseTokens = confect.mutation({
102
- handler: (ctx, args) =>
103
- Effect.gen(function* () {
104
- const tokenService = yield* TokenService;
105
- return yield* tokenService.purchase(args);
106
- }).pipe(Effect.provide(MainLayer))
107
- });
828
+ // LAYER 3: Technology (Adapters - The Implementation)
108
829
 
109
- // Business logic in pure Effect service
110
- export class TokenService extends Effect.Service<TokenService>()(
111
- "TokenService",
112
- {
113
- effect: Effect.gen(function* () {
114
- const stripe = yield* StripeProvider;
115
- const blockchain = yield* BlockchainProvider;
116
-
117
- return {
118
- purchase: (args) =>
119
- Effect.gen(function* () {
120
- const payment = yield* stripe.charge(args.amount);
121
- const tokens = yield* blockchain.mint(args.tokenId);
122
- return { success: true, payment, tokens };
123
- }).pipe(
124
- Effect.retry({ times: 3 }),
125
- Effect.timeout("30 seconds"),
126
- Effect.onError((e) => /* automatic rollback */)
127
- )
128
- };
830
+ // Convex implementation
831
+ class ConvexProvider implements DataProvider {
832
+ people = {
833
+ get: (id) => Effect.tryPromise({
834
+ try: () => this.client.query(api.people.get, { id }),
835
+ catch: (e) => new PersonNotFoundError(id),
129
836
  }),
130
- dependencies: [StripeProvider.Default, BlockchainProvider.Default]
131
- }
132
- ) {}
837
+ };
838
+ // ... implements all ontology operations
839
+ }
840
+
841
+ // WordPress implementation (different technology, SAME interface)
842
+ class WordPressProvider implements DataProvider {
843
+ people = {
844
+ get: (id) => Effect.tryPromise({
845
+ try: () => wpClient.users.get(id).then(mapToOntology),
846
+ catch: (e) => new PersonNotFoundError(id),
847
+ }),
848
+ };
849
+ // ... implements all ontology operations
850
+ }
851
+
852
+ // Frontend (Astro + React)
853
+ const purchaseButton = (
854
+ <Button onClick={() => provider.purchaseCourse(courseId)}>
855
+ Buy Course
856
+ </Button>
857
+ );
133
858
  ```
134
859
 
135
- ### 2. Hono for API Backend Separation
860
+ **The magic:** Same ontology operations work with Convex, WordPress, Shopify, Supabase, or ANY backend. The frontend never changes.
861
+
862
+ ---
136
863
 
137
- **Decision:** Separate Hono API backend from Astro frontend
864
+ ## Why This Enables Compound Structure Accuracy
138
865
 
139
- **Why:**
140
- - **Multi-Tenancy:** Different orgs can customize frontend while sharing backend
141
- - **API Portability:** Backend logic reusable across web, mobile, desktop
142
- - **Clear Contracts:** REST API endpoints define clear boundaries
143
- - **Independent Deployment:** Deploy frontend and backend separately
144
- - **Team Specialization:** Frontend devs work on UI, backend devs work on logic
866
+ ### Traditional Approach: Degrading Patterns
145
867
 
146
- **Workflow:**
147
- ```
148
- User clicks "Buy Tokens"
149
- ↓
150
- React component calls Hono API (POST /api/tokens/purchase)
151
- ↓
152
- Hono route validates session (Better Auth)
153
- ↓
154
- Effect.ts service processes business logic
155
- ↓
156
- Service calls Convex mutation via ConvexHttpClient
157
- ↓
158
- Convex updates entities/events tables
159
- ↓
160
- Convex real-time subscription pushes update to UI
161
- ↓
162
- Component re-renders with new balance ✅
163
- ```
868
+ ```typescript
869
+ // Generation 1: Create user (initial pattern)
870
+ async function createUser(email: string) {
871
+ const user = await db.users.create({ email });
872
+ return user;
873
+ }
164
874
 
165
- ### 3. Dual Integration Pattern (Frontend)
875
+ // Generation 2: Create product (different pattern - drift begins)
876
+ async function createProduct(name: string) {
877
+ try {
878
+ const product = await db.products.insert({ name });
879
+ await logProductCreated(product);
880
+ return product;
881
+ } catch (e) {
882
+ console.error(e);
883
+ throw new Error("Failed");
884
+ }
885
+ }
886
+
887
+ // Generation 3: Create course (more drift)
888
+ async function createCourse(title: string) {
889
+ let course;
890
+ try {
891
+ course = await database.addCourse({ title });
892
+ await notifyAdmins(course);
893
+ await updateMetrics("course_created");
894
+ } catch (error) {
895
+ if (course) {
896
+ await database.deleteCourse(course.id);
897
+ }
898
+ throw error;
899
+ }
900
+ return course;
901
+ }
166
902
 
167
- **Decision:** Convex hooks for queries, Hono API for mutations
903
+ // Agent sees three different patterns. Accuracy degrades.
904
+ ```
168
905
 
169
- **Why:**
170
- - **Real-Time Data:** Convex hooks provide live subscriptions
171
- - **Business Logic:** Hono API handles complex validation, payments, external APIs
172
- - **Best of Both:** Real-time updates + robust backend processing
906
+ ### ONE Approach: Converging Patterns
173
907
 
174
- **Example:**
175
908
  ```typescript
176
- // src/components/TokenPurchase.tsx
177
- export function TokenPurchase({ tokenId }) {
178
- // Real-time data via Convex hook
179
- const token = useQuery(api.queries.tokens.get, { id: tokenId });
180
-
181
- // Purchase via Hono API (handles validation, payment, etc.)
182
- const handlePurchase = async () => {
183
- const result = await honoApi.purchaseTokens(tokenId, 100);
184
- // Convex subscription automatically updates balance!
185
- };
909
+ // Generation 1: Create user (ontology pattern)
910
+ export const createUser = Effect.gen(function* () {
911
+ const provider = yield* DataProvider;
912
+ const userId = yield* provider.things.create({
913
+ type: "user",
914
+ name: input.email,
915
+ properties: { email: input.email },
916
+ });
917
+ return userId;
918
+ });
186
919
 
187
- return (
188
- <div>
189
- <p>Balance: {token?.properties.balance || 0}</p>
190
- <Button onClick={handlePurchase}>Buy 100 Tokens</Button>
191
- </div>
192
- );
193
- }
920
+ // Generation 2: Create product (SAME ontology pattern)
921
+ export const createProduct = Effect.gen(function* () {
922
+ const provider = yield* DataProvider;
923
+ const productId = yield* provider.things.create({
924
+ type: "product",
925
+ name: input.name,
926
+ properties: { price: input.price },
927
+ });
928
+ return productId;
929
+ });
930
+
931
+ // Generation 3: Create course (SAME ontology pattern)
932
+ export const createCourse = Effect.gen(function* () {
933
+ const provider = yield* DataProvider;
934
+ const courseId = yield* provider.things.create({
935
+ type: "course",
936
+ name: input.title,
937
+ properties: { instructor: input.instructor },
938
+ });
939
+ return courseId;
940
+ });
941
+
942
+ // Agent sees ONE pattern. Accuracy compounds.
194
943
  ```
195
944
 
196
- ## System Overview
945
+ **What the agent learns:**
197
946
 
198
947
  ```
199
- ┌─────────────────────────────────────────────────────────────────────┐
200
- │ USER'S BROWSER │
201
- ├─────────────────────────────────────────────────────────────────────┤
202
- │ Astro Pages (SSR) React Components (Islands) │
203
- │ ├─ SEO-optimized ├─ Interactive UI │
204
- │ ├─ Fast initial load ├─ Real-time updates │
205
- │ └─ Static generation └─ Client hydration │
206
- └──────────────────┬──────────────────────────┬────────────────────────┘
207
- │ │
208
- ↓ ↓
209
- ┌───────────────┐ ┌──────────────┐
210
- │ Convex Hooks │ │ Hono API │
211
- │ useQuery │ │ Client │
212
- │ useMutation │ │ REST calls │
213
- └───────┬───────┘ └──────┬───────┘
214
- │ │
215
- ↓ ↓
216
- ┌───────────────────────────────────────┐
217
- │ EFFECT.TS GLUE LAYER │
218
- │ - Services (business logic) │
219
- │ - Providers (external APIs) │
220
- │ - Layers (dependency injection) │
221
- └───────┬───────────────────────────────┘
222
- │
223
- ├──────────────────┬──────────────┐
224
- ↓ ↓ ↓
225
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
226
- │ HONO API │ │ CONVEX │ │ EXTERNAL │
227
- │ /api/auth/* │ │ Real-time DB │ │ PROVIDERS │
228
- │ /api/tokens/*│ │ Functions │ │ Stripe, etc. │
229
- └──────────────┘ └──────────────┘ └──────────────┘
230
- │
231
- ↓
232
- ┌───────────────┐
233
- │ Confect │ ← Bridge Layer (Convex ↔ Effect)
234
- │ (E→C Bridge) │
235
- └───────┬───────┘
236
- │
237
- ↓
238
- ┌─────────────────────────────────────────────────────────────────────┐
239
- │ EFFECT.TS SERVICE LAYER (100% Coverage) │
240
- ├─────────────────────────────────────────────────────────────────────┤
241
- │ ALL Business Logic (Pure Functional Programming) │
242
- │ ├─ AICloneService ├─ TokenService ├─ CourseService │
243
- │ ├─ AgentOrchestrator ├─ CommunityService ├─ AnalyticsService │
244
- │ ├─ PaymentService ├─ LivestreamService ├─ ReferralService │
245
- │ ├─ NotificationService ├─ MetricsService ├─ WebsiteService │
246
- │ └─ All services compose, errors typed, DI automatic, retry/timeout │
247
- └──────────────────┬──────────────────────────────────────────────────┘
248
- │
249
- ├─────────────────────────┬────────────────────────┐
250
- │ │ │
251
- ↓ ↓ ↓
252
- ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
253
- │ External Providers│ │ Blockchain (3x) │ │ Payments │
254
- │ ├─ OpenAI │ │ ├─ SuiProvider │ │ ├─ Stripe (FIAT) │
255
- │ ├─ ElevenLabs │ │ ├─ BaseProvider │ │ └─ Crypto via │
256
- │ ├─ D-ID │ │ ├─ SolanaProvider│ │ blockchain │
257
- │ ├─ HeyGen │ │ └─ Alchemy (RPC) │ └──────────────────┘
258
- │ ├─ Resend │ └──────────────────┘
259
- │ ├─ SendGrid │ ┌──────────────────┐
260
- │ ├─ Twilio │ │ Infrastructure │
261
- │ ├─ AWS │ │ ├─ Cloudflare │
262
- │ └─ Cloudflare │ │ │ (Livestream) │
263
- │ (Livestream) │ │ └─ AWS (Storage) │
264
- └──────────────────┘ └──────────────────┘
265
- │
266
- ↓
267
- ┌───────────────────────────┐
268
- │ 6-Dimension Ontology │
269
- │ (Plain Convex Schema) │
270
- │ ├─ organizations │
271
- │ ├─ people (via things) │
272
- │ ├─ things (66 types) │
273
- │ ├─ connections (25 types)│
274
- │ ├─ events (67 types) │
275
- │ └─ knowledge │
276
- │ │
277
- │ NO Convex Ents │
278
- │ Direct DB access │
279
- └───────────────────────────┘
948
+ PATTERN: Create entity
949
+ 1. Get DataProvider from context
950
+ 2. Call provider.things.create()
951
+ 3. Specify type (maps to thingType in ontology)
952
+ 4. Specify name (required field)
953
+ 5. Specify properties (type-specific data)
954
+ 6. Return entity ID (Effect<string, CreateError>)
955
+
956
+ LEARNED: This pattern works for ALL entity types.
957
+ RESULT: Next generation uses same pattern → more accurate.
958
+ ```
959
+
960
+ ### Compound Structure in Action
961
+
962
+ ```typescript
963
+ // Generation 50: Agent has seen 49 entity creation patterns
964
+ // Agent recognizes the universal pattern immediately
965
+
966
+ export const createAnything = <T extends Thing>(
967
+ type: ThingType,
968
+ input: CreateThingInput<T>
969
+ ) => Effect.gen(function* () {
970
+ const provider = yield* DataProvider;
971
+
972
+ // Validation (learned pattern)
973
+ const validated = yield* validateThing(type, input);
974
+
975
+ // Creation (learned pattern)
976
+ const thingId = yield* provider.things.create({
977
+ type,
978
+ name: validated.name,
979
+ properties: validated.properties,
980
+ });
981
+
982
+ // Event logging (learned pattern)
983
+ yield* provider.events.log({
984
+ type: `${type}_created`,
985
+ actorId: validated.creatorId,
986
+ targetId: thingId,
987
+ });
988
+
989
+ return thingId;
990
+ });
991
+
992
+ // Agent has GENERALIZED the pattern.
993
+ // Accuracy is now 98%+ because pattern is universal.
280
994
  ```
281
995
 
282
996
  ---
283
997
 
284
- ## Layer Responsibilities
998
+ ## The 6-Dimension Ontology: Complete Specification
999
+
1000
+ ### Dimension 1: Groups (Containers)
1001
+
1002
+ **Purpose:** Hierarchical spaces that partition all other dimensions.
1003
+
1004
+ **For comprehensive documentation, see:** `/one/connections/groups.md`
1005
+
1006
+ ```typescript
1007
+ interface Group {
1008
+ _id: Id<"groups">;
1009
+ slug: string; // Unique identifier (URL-friendly)
1010
+ name: string;
1011
+ type: "friend_circle" | "business" | "community" | "dao" | "government" | "organization";
1012
+ parentGroupId?: Id<"groups">; // CRITICAL: Infinite hierarchical nesting
1013
+ description?: string;
1014
+ metadata: any;
1015
+ settings: {
1016
+ visibility: "public" | "private";
1017
+ joinPolicy: "open" | "invite_only" | "approval_required";
1018
+ plan?: "starter" | "pro" | "enterprise";
1019
+ limits?: {
1020
+ users: number;
1021
+ storage: number;
1022
+ apiCalls: number;
1023
+ };
1024
+ };
1025
+ status: "active" | "archived";
1026
+ createdAt: number;
1027
+ updatedAt: number;
1028
+ }
1029
+ ```
1030
+
1031
+ **Key insights:**
1032
+ - **Every other dimension is scoped to a `groupId`** - This is the foundation of multi-tenancy
1033
+ - **Groups can contain groups** - Hierarchical via `parentGroupId` (infinite nesting)
1034
+ - **Scales infinitely** - From friend circles (2 people) to governments (billions)
1035
+ - **Multi-tenancy:** Each group has isolated data, billing, quotas, and customization
1036
+ - **6 group types:** friend_circle, business, community, dao, government, organization
1037
+ - **Access control:** Parent groups can access child groups (configurable)
285
1038
 
286
- ### Layer 1: Frontend (Astro + React)
1039
+ **Why groups are dimension #1:**
1040
+ - Without groups → single-tenant system
1041
+ - With groups → infinite multi-tenant scale
1042
+ - All queries MUST filter by `groupId` first
1043
+ - All entities MUST include `groupId` field
287
1044
 
288
- **Astro's Role:**
289
- - Server-side render pages for SEO and performance
290
- - Generate static HTML where possible
291
- - Route requests to correct pages
292
- - Provide data to React islands via props
1045
+ **See `/one/connections/groups.md` for:**
1046
+ - Complete group lifecycle (create, update, archive)
1047
+ - Hierarchical query patterns (children, descendants, ancestors)
1048
+ - Multi-tenancy isolation guarantees
1049
+ - Access control patterns
1050
+ - Usage tracking & quotas
1051
+ - Real-world examples (lemonade stand → enterprise → DAO)
293
1052
 
294
- **React's Role:**
295
- - Interactive components only (not the whole page)
296
- - Real-time UI updates via Convex subscriptions
297
- - Form handling and user interactions
298
- - Client-side state management
1053
+ ### Dimension 2: People (Authorization)
299
1054
 
300
- **Why This Split:**
301
- ```typescript
302
- // ✅ CORRECT: Astro SSR with React island
303
- ---
304
- // Astro (server-side)
305
- const creator = await convex.query(api.creators.get, { id });
306
- ---
1055
+ **Purpose:** Actors who perform actions and control access.
307
1056
 
308
- <Layout>
309
- <h1>{creator.name}</h1> <!-- Astro renders -->
310
- <CreatorChat client:load creatorId={id} /> <!-- React hydrates -->
311
- </Layout>
1057
+ **Conceptual Model (for understanding):**
312
1058
 
313
- // ❌ WRONG: All React (loses SSR benefits)
314
- export default function Page() {
315
- const creator = useQuery(api.creators.get, { id });
316
- // Everything client-side, slow initial load, bad SEO
1059
+ ```typescript
1060
+ interface Person {
1061
+ _id: Id<"entities">; // NOTE: Stored in entities table
1062
+ type: "creator" | "ai_clone" | "audience_member";
1063
+ name: string;
1064
+ groupId: Id<"groups">;
1065
+ properties: {
1066
+ email: string;
1067
+ username?: string;
1068
+ displayName?: string;
1069
+ role: "platform_owner" | "org_owner" | "org_user" | "customer";
1070
+ groups?: Id<"groups">[]; // Multi-org membership
1071
+ permissions?: string[];
1072
+ image?: string;
1073
+ bio?: string;
1074
+ };
1075
+ status: "active" | "inactive" | "archived";
1076
+ createdAt: number;
1077
+ updatedAt: number;
317
1078
  }
318
1079
  ```
319
1080
 
320
- **Key Principle:** Astro for content, React for interactivity.
1081
+ **Implementation Note:**
321
1082
 
322
- ### Layer 2: Convex Backend
1083
+ People are **conceptually a separate dimension** but **implemented as entities** with special types (`creator`, `ai_clone`, `audience_member`). This design choice provides:
323
1084
 
324
- **Three Function Types:**
1085
+ 1. **Unified interface:** All dimensions use the same base structure (groupId, type, name, properties)
1086
+ 2. **Flexible properties:** Role and permissions stored in `properties.role` field
1087
+ 3. **Relationship simplicity:** Connections can link people ↔ things without special handling
1088
+ 4. **Query efficiency:** Same index patterns work for people and things
325
1089
 
326
- **Queries (Read):**
327
- ```typescript
328
- export const get = query({
329
- args: { id: v.id("entities") },
330
- handler: async (ctx, args) => {
331
- return await ctx.db.get(args.id);
332
- }
333
- });
334
- ```
335
- - Read-only
336
- - Automatically cached
337
- - Real-time subscriptions
338
- - Can run in parallel
1090
+ **Why not a separate table?**
339
1091
 
340
- **Mutations (Write):**
341
- ```typescript
342
- export const update = mutation({
343
- args: { id: v.id("entities"), name: v.string() },
344
- handler: async (ctx, args) => {
345
- await ctx.db.patch(args.id, { name: args.name });
346
- }
347
- });
348
- ```
349
- - Write operations
350
- - Transactional (all-or-nothing)
351
- - Optimistic UI updates
352
- - Validated with Convex validators
1092
+ - Eliminates JOIN operations (people and things share connections)
1093
+ - Consistent query patterns (all entities use same indexes)
1094
+ - Simpler schema evolution (one entity type system)
1095
+ - Better agent code generation (one pattern to learn, not two)
1096
+
1097
+ **Key insights:**
1098
+ - Every action has an `actorId` (entity with type="creator")
1099
+ - Roles define permissions (stored in `properties.role`)
1100
+ - People can belong to multiple groups (via `properties.groups` array)
1101
+ - Implementation uses entities table, but conceptually a separate dimension
1102
+
1103
+ ### Dimension 3: Things (Entities)
1104
+
1105
+ **Purpose:** All nouns in the system.
353
1106
 
354
- **Actions (External APIs):**
355
1107
  ```typescript
356
- export const cloneVoice = action({
357
- args: { samples: v.array(v.string()) },
358
- handler: async (ctx, args) => {
359
- const result = await elevenLabs.cloneVoice(args.samples);
360
- return result.voiceId;
361
- }
362
- });
1108
+ interface Thing {
1109
+ _id: Id<"things">;
1110
+ type: ThingType; // 66 types: user, product, course, agent, token...
1111
+ name: string;
1112
+ groupId: Id<"groups">; // Scoped to group
1113
+ description?: string;
1114
+ properties: any; // Type-specific data (flexible)
1115
+ status: "draft" | "active" | "published" | "archived";
1116
+ createdAt: number;
1117
+ updatedAt: number;
1118
+ }
363
1119
  ```
364
- - Call external services (OpenAI, Stripe, etc.)
365
- - Can call mutations/queries
366
- - Not transactional
367
- - Can be long-running
368
-
369
- **Why Convex:**
370
- - Real-time by default (no websockets to manage)
371
- - Automatic caching and optimization
372
- - Edge deployment (fast globally)
373
- - Built-in auth and file storage
374
- - TypeScript-first
375
-
376
- ### Layer 3: Effect.ts Service Layer (100% Coverage)
377
-
378
- **This is where ALL business logic lives.**
379
-
380
- **CRITICAL: Effect.ts is used for 100% of business logic** - not just complex flows:
381
- - Every service is an Effect.ts service
382
- - Every business operation is an Effect pipeline
383
- - Every external API call goes through Effect providers
384
- - NO raw async/await in business logic
385
- - NO try/catch blocks (errors are typed)
386
- - NO imperative state management
387
-
388
- Effect.ts is a functional programming library that makes code:
389
- 1. **Predictable** - Same input always produces same output
390
- 2. **Composable** - Small functions combine into larger ones
391
- 3. **Typed** - Errors are explicit in the type system
392
- 4. **Testable** - Dependencies can be mocked easily
393
- 5. **Observable** - Built-in tracing and logging
394
-
395
- **100% Effect.ts Coverage Means:**
396
- ```typescript
397
- // ❌ WRONG: Direct async/await in business logic
398
- export const createToken = mutation({
399
- handler: async (ctx, args) => {
400
- try {
401
- const result = await fetch("https://api.blockchain.com/mint");
402
- const token = await ctx.db.insert("entities", { ...result });
403
- return token;
404
- } catch (error) {
405
- throw new Error("Failed to create token");
406
- }
407
- }
408
- });
409
1120
 
410
- // ✅ CORRECT: Everything through Effect.ts
411
- export const createToken = confect.mutation({
412
- handler: (ctx, args) =>
413
- Effect.gen(function* () {
414
- const tokenService = yield* TokenService;
415
- return yield* tokenService.create(args);
416
- }).pipe(Effect.provide(MainLayer))
417
- });
1121
+ **66 thing types organized by domain:**
418
1122
 
419
- // Business logic in pure Effect service
420
- export class TokenService extends Effect.Service<TokenService>()("TokenService", {
421
- effect: Effect.gen(function* () {
422
- const db = yield* ConvexDatabase;
423
- const blockchain = yield* BlockchainProvider;
1123
+ **Platform:** website, landing_page, template, livestream, recording, media_asset
1124
+ **Content:** post, article, lesson, module, course, series
1125
+ **Commerce:** product, variant, collection, subscription, plan
1126
+ **Social:** creator, community, group, event
1127
+ **Business:** invoice, payment, metric, insight, prediction, report
1128
+ **Crypto:** token, wallet, nft, contract
1129
+ **AI:** agent, model, prompt, workflow
1130
+ **Communication:** notification, email, message, announcement
424
1131
 
425
- return {
426
- create: (args) =>
427
- Effect.gen(function* () {
428
- const result = yield* blockchain.mint(args);
429
- const token = yield* db.insert("entities", {
430
- entityType: "token",
431
- metadata: result,
432
- });
433
- return token;
434
- }).pipe(
435
- Effect.retry({ times: 3, schedule: Schedule.exponential("100 millis") }),
436
- Effect.timeout("30 seconds"),
437
- Effect.catchTags({
438
- BlockchainError: (e) => Effect.fail(new TokenCreationError(e)),
439
- DatabaseError: (e) => Effect.fail(new TokenCreationError(e)),
440
- })
441
- )
442
- };
443
- }),
444
- }) {}
445
- ```
1132
+ **Key insights:**
1133
+ - Flexible `properties` field for type-specific data
1134
+ - Every thing belongs to a group (scoped)
1135
+ - Status lifecycle: draft → active → published → archived
446
1136
 
447
- **Why 100% Effect.ts:**
448
- - AI generates consistent patterns across entire codebase
449
- - No mixing of error handling styles (typed vs try/catch)
450
- - All dependencies visible in type signatures
451
- - Automatic retry, timeout, resource management everywhere
452
- - Testing is uniform (always mock Effect services)
453
- - Observability built-in (traces, logs, metrics)
1137
+ ### Dimension 4: Connections (Relationships)
1138
+
1139
+ **Purpose:** All relationships between entities.
454
1140
 
455
- **Example Service:**
456
1141
  ```typescript
457
- export class AICloneService extends Effect.Service<AICloneService>()(
458
- "AICloneService",
459
- {
460
- effect: Effect.gen(function* () {
461
- // Dependencies injected automatically
462
- const db = yield* ConvexDatabase;
463
- const elevenlabs = yield* ElevenLabsProvider;
464
- const openai = yield* OpenAIProvider;
465
-
466
- return {
467
- createClone: (creatorId: Id<"entities">) =>
468
- Effect.gen(function* () {
469
- // Business logic here
470
- // Every step is explicit
471
- // Every error is typed
472
- const content = yield* db.getCreatorContent(creatorId);
473
- const voiceId = yield* elevenlabs.cloneVoice(content.samples);
474
- const personality = yield* openai.extractPersonality(content.text);
475
-
476
- return { voiceId, personality };
477
- }).pipe(
478
- // Composition: add retry, timeout, error handling
479
- Effect.retry({ times: 3 }),
480
- Effect.timeout("5 minutes"),
481
- Effect.catchTag("VoiceCloneError", handleError)
482
- )
483
- };
484
- }),
485
- dependencies: [ConvexDatabase.Default, ElevenLabsProvider.Default, OpenAIProvider.Default]
486
- }
487
- ) {}
1142
+ interface Connection {
1143
+ _id: Id<"connections">;
1144
+ fromThingId?: Id<"things">;
1145
+ toThingId?: Id<"things">;
1146
+ fromPersonId?: Id<"people">; // Can connect people → things
1147
+ toPersonId?: Id<"people">; // Or people → people
1148
+ relationshipType: ConnectionType; // 25 types
1149
+ groupId: Id<"groups">; // Scoped to group
1150
+ metadata: any; // Relationship-specific data
1151
+ createdAt: number;
1152
+ }
488
1153
  ```
489
1154
 
490
- **Why Effect.ts:**
491
- - Business logic separated from Convex infrastructure
492
- - Services compose cleanly (no callback hell)
493
- - Errors are in the type signature (no silent failures)
494
- - Easy to test (mock dependencies)
495
- - Built-in retry, timeout, resource management
1155
+ **25 connection types (consolidated):**
496
1156
 
497
- ### Layer 4: Confect Bridge
1157
+ **User Relationships (6):** follows, subscribes_to, owns, purchased, created, manages
1158
+ **Content Relationships (6):** belongs_to, tagged_with, appears_in, references, derived_from, version_of
1159
+ **Token & Financial (5):** holds_tokens, staked_in, earned_from, spent_on, paid_for
1160
+ **Platform & Infrastructure (4):** hosted_on, deployed_to, integrated_with, streamed_on
1161
+ **Business & Analytics (3):** tracked_by, invoiced_by, referred_by
498
1162
 
499
- Connects Effect.ts ↔ Convex:
1163
+ **Key insights:**
1164
+ - Bidirectional (from → to)
1165
+ - Rich metadata for relationship-specific data
1166
+ - Can connect things ↔ things, people ↔ things, people ↔ people
1167
+ - Temporal validity (can add validFrom/validTo to metadata)
500
1168
 
501
- ```typescript
502
- // Regular Convex mutation
503
- export const purchaseTokens = mutation({
504
- handler: async (ctx, args) => {
505
- // Lots of try/catch, manual error handling
506
- }
507
- });
1169
+ ### Dimension 5: Events (Actions)
508
1170
 
509
- // Confect mutation (Effect.ts wrapper)
510
- export const purchaseTokens = confect.mutation({
511
- handler: (ctx, args) =>
512
- Effect.gen(function* () {
513
- const tokenService = yield* TokenService;
514
- return yield* tokenService.purchase(args);
515
- }).pipe(Effect.provide(MainLayer))
516
- });
1171
+ **Purpose:** Complete audit trail of all actions over time.
1172
+
1173
+ ```typescript
1174
+ interface Event {
1175
+ _id: Id<"events">;
1176
+ type: EventType; // 55 types (44 specific + 11 consolidated)
1177
+ actorId: Id<"people">; // REQUIRED: Who did it
1178
+ targetId?: Id<"things"> | Id<"people"> | Id<"connections">; // What was acted upon
1179
+ groupId: Id<"groups">; // Scoped to group
1180
+ metadata: any; // Event-specific data
1181
+ timestamp: number;
1182
+ }
517
1183
  ```
518
1184
 
519
- **Confect provides:**
520
- - Automatic conversion of Convex context to Effect services
521
- - Error handling (Convex errors → Effect errors)
522
- - Type safety across the boundary
1185
+ **55 event types (44 specific + 11 consolidated):**
1186
+
1187
+ **Entity Lifecycle (4):** entity_created, entity_updated, entity_deleted, entity_archived
1188
+ **User Events (5):** user_registered, user_verified, user_login, user_logout, profile_updated
1189
+ **Authentication Events (6):** password_reset_requested, password_reset_completed, email_verification_sent, email_verified, two_factor_enabled, two_factor_disabled
1190
+ **Organization Events (5):** organization_created, organization_updated, user_invited_to_org, user_joined_org, user_removed_from_org
1191
+ **Dashboard & UI Events (4):** dashboard_viewed, settings_updated, theme_changed, preferences_updated
1192
+ **AI/Clone Events (4):** clone_created, clone_updated, voice_cloned, appearance_cloned
1193
+ **Agent Events (4):** agent_created, agent_executed, agent_completed, agent_failed
1194
+ **Token Events (7):** token_created, token_minted, token_burned, tokens_purchased, tokens_staked, tokens_unstaked, tokens_transferred
1195
+ **Course Events (5):** course_created, course_enrolled, lesson_completed, course_completed, certificate_earned
1196
+ **Analytics Events (5):** metric_calculated, insight_generated, prediction_made, optimization_applied, report_generated
523
1197
 
524
- ### Layer 4.5: DataProvider Interface (Backend-Agnostic)
1198
+ **Consolidated Event Types (11):** content_event, payment_event, subscription_event, commerce_event, livestream_event, notification_event, referral_event, communication_event, task_event, mandate_event, price_event (use metadata.action for variants)
525
1199
 
526
- **The Universal Ontology API**
1200
+ **Key insights:**
1201
+ - Every event has an `actorId` (person)
1202
+ - Events are immutable (append-only)
1203
+ - Rich metadata for event-specific data
1204
+ - Enables complete audit trail, analytics, AI learning
527
1205
 
528
- The frontend communicates with ANY backend through the DataProvider interface. This makes the platform truly backend-agnostic—swap Convex for WordPress, Supabase, or Notion by changing ONE line.
1206
+ ### Dimension 6: Knowledge (Understanding)
1207
+
1208
+ **Purpose:** Embeddings, vectors, and semantic search for AI.
529
1209
 
530
1210
  ```typescript
531
- // frontend/src/providers/DataProvider.ts
532
- import { Effect } from 'effect'
533
-
534
- // DataProvider interface (every backend must implement this)
535
- export interface DataProvider {
536
- // Dimension 1: Organizations operations
537
- organizations: {
538
- get: (id: string) => Effect.Effect<Organization, OrganizationNotFoundError>
539
- list: (params: {
540
- status?: 'active' | 'suspended' | 'trial' | 'cancelled'
541
- limit?: number
542
- }) => Effect.Effect<Organization[], Error>
543
- update: (id: string, updates: Partial<Organization>) => Effect.Effect<void, Error>
544
- }
1211
+ interface Knowledge {
1212
+ _id: Id<"knowledge">;
1213
+ type: "embedding" | "label" | "category" | "tag";
1214
+ text?: string;
1215
+ embedding?: number[]; // Vector embedding
1216
+ embeddingModel?: string;
1217
+ embeddingDim?: number;
1218
+ sourceThingId?: Id<"things">;
1219
+ sourcePersonId?: Id<"people">;
1220
+ groupId: Id<"groups">; // Scoped to group
1221
+ labels?: string[];
1222
+ metadata?: any;
1223
+ createdAt: number;
1224
+ updatedAt: number;
1225
+ }
1226
+ ```
545
1227
 
546
- // Dimension 2: People operations
547
- people: {
548
- get: (id: string) => Effect.Effect<Person, PersonNotFoundError | UnauthorizedError>
549
- list: (params: {
550
- organizationId?: string
551
- role?: 'platform_owner' | 'org_owner' | 'org_user' | 'customer'
552
- filters?: Record<string, any>
553
- limit?: number
554
- }) => Effect.Effect<Person[], Error>
555
- create: (input: {
556
- email: string
557
- displayName: string
558
- role: string
559
- organizationId: string
560
- password?: string
561
- }) => Effect.Effect<string, PersonCreateError>
562
- update: (id: string, updates: Partial<Person>) => Effect.Effect<void, Error>
563
- delete: (id: string) => Effect.Effect<void, Error>
564
- }
1228
+ **Key insights:**
1229
+ - Vector storage for RAG (Retrieval-Augmented Generation)
1230
+ - Linked to things/people via sourceId
1231
+ - Enables semantic search, recommendations, AI learning
1232
+ - Scoped to groups (knowledge isolation)
565
1233
 
566
- // Dimension 3: Things operations
567
- things: {
568
- get: (id: string) => Effect.Effect<Thing, ThingNotFoundError | UnauthorizedError>
569
- list: (params: {
570
- type: ThingType
571
- organizationId?: string
572
- filters?: Record<string, any>
573
- limit?: number
574
- }) => Effect.Effect<Thing[], Error>
575
- create: (input: {
576
- type: ThingType
577
- name: string
578
- organizationId: string
579
- properties: Record<string, any>
580
- }) => Effect.Effect<string, Error>
581
- update: (id: string, updates: Partial<Thing>) => Effect.Effect<void, Error>
582
- delete: (id: string) => Effect.Effect<void, Error>
583
- }
1234
+ ---
584
1235
 
585
- // Dimension 4: Connections operations
586
- connections: {
587
- create: (input: {
588
- fromThingId: string
589
- toThingId: string
590
- relationshipType: ConnectionType
591
- metadata?: Record<string, any>
592
- }) => Effect.Effect<string, ConnectionCreateError>
593
- getRelated: (params: {
594
- thingId: string
595
- relationshipType: ConnectionType
596
- direction: 'from' | 'to' | 'both'
597
- }) => Effect.Effect<Thing[], Error>
598
- getCount: (thingId: string, relationshipType: ConnectionType) => Effect.Effect<number, Error>
599
- delete: (id: string) => Effect.Effect<void, Error>
600
- }
1236
+ ## Protocols as Metadata: Universal Integration
601
1237
 
602
- // Dimension 5: Events operations
603
- events: {
604
- log: (event: {
605
- type: EventType
606
- actorId: string // Person ID (who did it)
607
- targetId?: string // Thing/Person/Connection ID
608
- organizationId: string // Org scope
609
- metadata?: Record<string, any>
610
- }) => Effect.Effect<void, Error>
611
- query: (params: {
612
- type?: EventType
613
- actorId?: string
614
- targetId?: string
615
- organizationId?: string
616
- from?: Date
617
- to?: Date
618
- }) => Effect.Effect<Event[], Error>
619
- }
1238
+ **X402 (Blockchain Settlement)**
620
1239
 
621
- // Dimension 6: Knowledge operations
622
- knowledge: {
623
- embed: (params: {
624
- text: string
625
- sourceThingId?: string
626
- sourcePersonId?: string
627
- organizationId: string
628
- labels?: string[]
629
- }) => Effect.Effect<string, Error>
630
- search: (params: {
631
- query: string
632
- organizationId?: string
633
- limit?: number
634
- }) => Effect.Effect<KnowledgeMatch[], Error>
635
- }
636
- }
1240
+ ```typescript
1241
+ yield* provider.connections.create({
1242
+ fromPersonId: senderId,
1243
+ toPersonId: receiverId,
1244
+ relationshipType: "transacted",
1245
+ metadata: {
1246
+ protocol: "x402",
1247
+ blockchain: "ethereum",
1248
+ amount: "1.5",
1249
+ currency: "USDC",
1250
+ txHash: "0x...",
1251
+ },
1252
+ });
637
1253
  ```
638
1254
 
639
- **Provider Implementations:**
1255
+ **ActivityPub 2.0 (Federation)**
640
1256
 
641
1257
  ```typescript
642
- // frontend/src/providers/convex/ConvexProvider.ts
643
- export class ConvexProvider implements DataProvider {
644
- constructor(private client: ConvexHttpClient) {}
645
-
646
- organizations = {
647
- get: (id) =>
648
- Effect.tryPromise({
649
- try: () => this.client.query(api.organizations.get, { id }),
650
- catch: (error) => new OrganizationNotFoundError(id)
651
- })
652
- // ... other operations
653
- }
1258
+ yield* provider.connections.create({
1259
+ fromPersonId: localUserId,
1260
+ toPersonId: remoteUserId,
1261
+ relationshipType: "follows",
1262
+ metadata: {
1263
+ protocol: "activitypub",
1264
+ activityType: "Follow",
1265
+ actor: "https://mastodon.social/@user",
1266
+ object: "https://one.ie/@otheruser",
1267
+ },
1268
+ });
1269
+ ```
654
1270
 
655
- people = {
656
- get: (id) =>
657
- Effect.tryPromise({
658
- try: () => this.client.query(api.people.get, { id }),
659
- catch: (error) => new PersonNotFoundError(id)
660
- }),
661
- list: (params) =>
662
- Effect.tryPromise({
663
- try: () => this.client.query(api.people.list, params),
664
- catch: (error) => new Error(String(error))
665
- })
666
- // ... other operations
667
- }
1271
+ **A2A (Agent-to-Agent)**
668
1272
 
669
- things = {
670
- list: (params) =>
671
- Effect.tryPromise({
672
- try: () => this.client.query(api.things.list, params),
673
- catch: (error) => new Error(String(error))
674
- }),
675
- create: (input) =>
676
- Effect.tryPromise({
677
- try: () => this.client.mutation(api.things.create, input),
678
- catch: (error) => new Error(String(error))
679
- })
680
- // ... other operations
681
- }
1273
+ ```typescript
1274
+ yield* provider.connections.create({
1275
+ fromThingId: agentId1,
1276
+ toThingId: agentId2,
1277
+ relationshipType: "delegated",
1278
+ metadata: {
1279
+ protocol: "a2a",
1280
+ task: "generate_invoice",
1281
+ status: "pending",
1282
+ payload: { orderId: "123" },
1283
+ },
1284
+ });
1285
+ ```
682
1286
 
683
- // ... connections, events, knowledge
684
- }
1287
+ **Key insight:** Protocols don't require new tables or schemas. They're just metadata on connections. The ontology is protocol-agnostic.
685
1288
 
686
- // frontend/astro.config.ts - Change backend with ONE line
687
- export default defineConfig({
688
- integrations: [
689
- one({
690
- // ✅ Using Convex
691
- provider: convexProvider({
692
- url: import.meta.env.PUBLIC_BACKEND_URL
693
- })
694
-
695
- // Or use WordPress:
696
- // provider: wordpressProvider({
697
- // url: 'https://yoursite.com',
698
- // apiKey: import.meta.env.WORDPRESS_API_KEY
699
- // })
700
-
701
- // Or use Supabase:
702
- // provider: supabaseProvider({
703
- // url: import.meta.env.PUBLIC_SUPABASE_URL,
704
- // key: import.meta.env.PUBLIC_SUPABASE_KEY
705
- // })
706
- })
707
- ]
708
- })
709
- ```
710
-
711
- **Key Benefits:**
712
- - ✅ Frontend code never changes when swapping backends
713
- - ✅ Organizations can bring their own infrastructure
714
- - ✅ Effect.ts provides type-safety across all providers
715
- - ✅ Same interface for Convex, WordPress, Supabase, Notion
716
- - ✅ All 6 dimensions supported universally
717
-
718
- ### Layer 5: Data Layer (6-Dimension Ontology - Plain Convex)
719
-
720
- All data maps to 6 dimensions using **plain Convex schema** (no Convex Ents):
721
-
722
- **Core Tables:**
723
- - **organizations** - Multi-tenant partitioning (Dimension 1)
724
- - **people** - Users & authorization (Dimension 2, separate from things!)
725
- - **things** - Domain entities (Dimension 3) - All 66 entity types (courses, products, lessons, etc.)
726
- - **connections** - Relationships (Dimension 4) - All 25 relationship types
727
- - **events** - Actions (Dimension 5) - All 67 event types with actorId
728
- - **knowledge** - AI intelligence (Dimension 6) - Vectors, embeddings, labels
729
-
730
- **Schema Implementation:**
731
- ```typescript
732
- // Plain Convex schema - NO Convex Ents
733
- import { defineSchema, defineTable } from "convex/server";
734
- import { v } from "convex/values";
1289
+ ---
1290
+
1291
+ ## Technology Layer: Implementation Details
1292
+
1293
+ ### Backend: Convex + Hono + Effect.ts
1294
+
1295
+ **Convex Schema (Plain, No Convex Ents):**
735
1296
 
1297
+ ```typescript
1298
+ // backend/convex/schema.ts
736
1299
  export default defineSchema({
737
- // Dimension 1: Organizations
738
- organizations: defineTable({
1300
+ groups: defineTable({
739
1301
  name: v.string(),
740
- slug: v.string(),
1302
+ type: v.string(),
1303
+ parentGroupId: v.optional(v.id("groups")),
1304
+ properties: v.any(),
741
1305
  status: v.string(),
742
- plan: v.string(),
743
- limits: v.any(),
744
- usage: v.any(),
745
- billing: v.any(),
746
- settings: v.any(),
747
1306
  createdAt: v.number(),
748
1307
  updatedAt: v.number(),
749
- })
750
- .index("by_slug", ["slug"])
751
- .index("by_status", ["status"]),
1308
+ }).index("by_type", ["type"]),
752
1309
 
753
- // Dimension 2: People (separate table, NOT things!)
754
1310
  people: defineTable({
755
1311
  email: v.string(),
756
1312
  username: v.string(),
757
1313
  displayName: v.string(),
758
- emailVerified: v.boolean(),
759
- role: v.string(), // platform_owner, org_owner, org_user, customer
760
- organizationId: v.id("organizations"),
761
- organizations: v.array(v.id("organizations")), // Multi-org membership
762
- permissions: v.optional(v.array(v.string())),
763
- image: v.optional(v.string()),
764
- bio: v.optional(v.string()),
1314
+ role: v.string(),
1315
+ groupId: v.id("groups"),
1316
+ groups: v.array(v.id("groups")),
765
1317
  createdAt: v.number(),
766
1318
  updatedAt: v.number(),
767
- })
768
- .index("by_email", ["email"])
769
- .index("by_org", ["organizationId"])
770
- .index("by_role", ["role"]),
1319
+ }).index("by_email", ["email"])
1320
+ .index("by_group", ["groupId"]),
771
1321
 
772
- // Dimension 3: Things
773
1322
  things: defineTable({
774
- thingType: v.string(),
1323
+ type: v.string(),
775
1324
  name: v.string(),
776
- organizationId: v.id("organizations"), // NEW: Every thing belongs to an org
777
- description: v.optional(v.string()),
1325
+ groupId: v.id("groups"),
778
1326
  properties: v.any(),
779
1327
  status: v.string(),
780
1328
  createdAt: v.number(),
781
1329
  updatedAt: v.number(),
782
- })
783
- .index("by_type", ["thingType"])
784
- .index("by_org", ["organizationId"]) // NEW: Query things by org
785
- .index("by_org_type", ["organizationId", "thingType"])
786
- .searchIndex("search_things", {
787
- searchField: "name",
788
- filterFields: ["thingType", "organizationId"],
789
- }),
1330
+ }).index("by_type", ["type"])
1331
+ .index("by_group", ["groupId"])
1332
+ .index("by_group_type", ["groupId", "type"]),
790
1333
 
791
- // Dimension 4: Connections
792
1334
  connections: defineTable({
793
- fromThingId: v.id("things"), // Can connect things
794
- toThingId: v.id("things"),
795
- fromPersonId: v.optional(v.id("people")), // OR connect people → things
1335
+ fromThingId: v.optional(v.id("things")),
1336
+ toThingId: v.optional(v.id("things")),
1337
+ fromPersonId: v.optional(v.id("people")),
796
1338
  toPersonId: v.optional(v.id("people")),
797
1339
  relationshipType: v.string(),
798
- organizationId: v.id("organizations"), // Connections scoped to org
1340
+ groupId: v.id("groups"),
799
1341
  metadata: v.any(),
800
1342
  createdAt: v.number(),
801
- })
802
- .index("by_from", ["fromThingId"])
803
- .index("by_to", ["toThingId"])
804
- .index("by_org", ["organizationId"])
1343
+ }).index("by_from_thing", ["fromThingId"])
1344
+ .index("by_to_thing", ["toThingId"])
1345
+ .index("by_from_person", ["fromPersonId"])
1346
+ .index("by_to_person", ["toPersonId"])
805
1347
  .index("by_relationship", ["relationshipType"])
806
- .index("by_from_person", ["fromPersonId"]) // Query connections by person
807
- .index("by_to_person", ["toPersonId"]),
1348
+ .index("by_group", ["groupId"]),
808
1349
 
809
- // Dimension 5: Events
810
1350
  events: defineTable({
811
- eventType: v.string(),
812
- actorId: v.id("people"), // REQUIRED: Actor is always a person
813
- targetId: v.optional(v.union(
814
- v.id("things"),
815
- v.id("people"),
816
- v.id("connections")
817
- )),
818
- organizationId: v.id("organizations"), // Events scoped to org
1351
+ type: v.string(),
1352
+ actorId: v.id("people"),
1353
+ targetId: v.optional(v.union(v.id("things"), v.id("people"), v.id("connections"))),
1354
+ groupId: v.id("groups"),
819
1355
  metadata: v.any(),
820
1356
  timestamp: v.number(),
821
- })
822
- .index("by_actor", ["actorId"]) // Query by who did it
823
- .index("by_target", ["targetId"]) // Query by what was acted upon
824
- .index("by_org", ["organizationId"]) // Query events by org
825
- .index("by_type", ["eventType"])
826
- .index("by_timestamp", ["timestamp"])
827
- .index("by_org_actor", ["organizationId", "actorId"]),
828
-
829
- // Dimension 6: Knowledge
1357
+ }).index("by_actor", ["actorId"])
1358
+ .index("by_target", ["targetId"])
1359
+ .index("by_type", ["type"])
1360
+ .index("by_group", ["groupId"])
1361
+ .index("by_timestamp", ["timestamp"]),
1362
+
830
1363
  knowledge: defineTable({
831
- knowledgeType: v.string(),
1364
+ type: v.string(),
832
1365
  text: v.optional(v.string()),
833
1366
  embedding: v.optional(v.array(v.number())),
834
1367
  embeddingModel: v.optional(v.string()),
835
- embeddingDim: v.optional(v.number()),
836
1368
  sourceThingId: v.optional(v.id("things")),
837
- sourcePersonId: v.optional(v.id("people")), // Knowledge can come from people
838
- sourceField: v.optional(v.string()),
839
- organizationId: v.id("organizations"), // Knowledge scoped to org
840
- chunk: v.optional(v.any()),
1369
+ sourcePersonId: v.optional(v.id("people")),
1370
+ groupId: v.id("groups"),
841
1371
  labels: v.optional(v.array(v.string())),
842
1372
  metadata: v.optional(v.any()),
843
1373
  createdAt: v.number(),
844
1374
  updatedAt: v.number(),
845
- })
846
- .index("by_type", ["knowledgeType"])
847
- .index("by_source_thing", ["sourceThingId"])
848
- .index("by_source_person", ["sourcePersonId"]) // Query knowledge by person
849
- .index("by_org", ["organizationId"])
850
- .index("by_created", ["createdAt"])
1375
+ }).index("by_source_thing", ["sourceThingId"])
1376
+ .index("by_source_person", ["sourcePersonId"])
1377
+ .index("by_group", ["groupId"])
851
1378
  .vectorIndex("by_embedding", {
852
1379
  vectorField: "embedding",
853
1380
  dimensions: 768,
854
- filterFields: ["knowledgeType", "organizationId"]
1381
+ filterFields: ["type", "groupId"],
855
1382
  }),
856
1383
  });
857
1384
  ```
858
1385
 
859
- **Key Design Principles:**
860
- - Organizations partition ALL data (perfect multi-tenant isolation)
861
- - People are represented as things with `role` property (platform_owner, org_owner, org_user, customer)
862
- - Every thing, connection, event, and knowledge item is scoped to an organization
863
- - No ORM layer (Convex Ents) - direct database access
864
- - Flexible metadata fields for type-specific data
865
- - Comprehensive indexing for query performance (including org-scoped indexes)
866
-
867
- **New Entity Types** (Strategy.md support):
868
- - **Platform**: website, landing_page, template, livestream, recording, media_asset
869
- - **Business**: payment, subscription, invoice, metric, insight, prediction, report
870
- - **Marketing**: notification, email_campaign, announcement, referral, campaign, lead
871
-
872
- **Optimized Connection Types (24 total):**
873
- - User relationships: follows, subscribes_to, owns, purchased
874
- - Content relationships: created, belongs_to, tagged_with, appears_in
875
- - Token relationships: holds_tokens, staked_in, earned_from, spent_on
876
- - Platform relationships: hosted_on, deployed_to, integrated_with
877
- - Business relationships: paid_for, invoiced_by, tracked_by, referred_by
878
-
879
- **Optimized Event Types (38 total):**
880
- - User events: user_registered, profile_updated, preferences_changed
881
- - Content events: content_created, published, viewed, liked, shared
882
- - Token events: tokens_purchased, transferred, staked, unstaked
883
- - Platform events: website_created, livestream_started, recording_created
884
- - Business events: payment_processed, subscription_started, invoice_generated
885
-
886
- See `docs/Ontology.md` for complete details.
887
-
888
- #### Type System Optimization: 24 Connections + 38 Events
889
-
890
- **Previous Approach:** 33 connection types + 54 event types = 87 total types
891
- **Optimized Approach:** 25 connection types + 35 event types = 62 total types (-29% reduction)
892
-
893
- **Why Fewer Types is Better:**
894
- - Less cognitive load for AI agents
895
- - Fewer type discriminations in code
896
- - Easier to maintain type consistency
897
- - More generic types handle more use cases
898
- - Reduced documentation burden
899
-
900
- **Connection Type Consolidation Strategy:**
901
- ```typescript
902
- // ❌ BEFORE: Too specific (33 types)
903
- "follows_creator"
904
- "follows_community"
905
- "follows_course"
906
- // Each follow type was separate
907
-
908
- // ✅ AFTER: Generic (24 types)
909
- "follows"
910
- // Single type, entity metadata determines what's being followed
911
- // Connection from User → Creator/Community/Course all use "follows"
912
-
913
- // Metadata example:
914
- {
915
- fromEntityId: "user-123",
916
- toEntityId: "creator-456",
917
- relationshipType: "follows",
918
- metadata: {
919
- followedEntityType: "creator", // Stored in metadata
920
- notificationsEnabled: true
921
- }
922
- }
923
- ```
924
-
925
- **24 Core Connection Types:**
926
- 1. **User Relationships** (6 types):
927
- - `follows` - User follows any entity (creator, community, course)
928
- - `subscribes_to` - Paid subscription to any entity
929
- - `owns` - Ownership of any entity
930
- - `purchased` - Purchase of any entity
931
- - `created` - Creation of any entity
932
- - `manages` - Management/admin rights
933
-
934
- 2. **Content Relationships** (6 types):
935
- - `belongs_to` - Entity belongs to parent entity
936
- - `tagged_with` - Entity tagged with category
937
- - `appears_in` - Entity appears in another entity
938
- - `references` - Entity references another entity
939
- - `derived_from` - Entity derived from source entity
940
- - `version_of` - Entity is version of another entity
941
-
942
- 3. **Token & Financial** (5 types):
943
- - `holds_tokens` - Token balance
944
- - `staked_in` - Staked token position
945
- - `earned_from` - Token earnings source
946
- - `spent_on` - Token expenditure
947
- - `paid_for` - Fiat payment for entity
948
-
949
- 4. **Platform & Infrastructure** (4 types):
950
- - `hosted_on` - Platform hosting
951
- - `deployed_to` - Deployment location
952
- - `integrated_with` - Integration connection
953
- - `streamed_on` - Livestream platform
954
-
955
- 5. **Business & Analytics** (3 types):
956
- - `tracked_by` - Metric tracking
957
- - `invoiced_by` - Invoice relationship
958
- - `referred_by` - Referral source
959
-
960
- **38 Core Event Types:**
961
- 1. **User Events** (8 types):
962
- - `user_registered`, `user_updated`, `user_deleted`
963
- - `profile_updated`, `preferences_changed`
964
- - `login`, `logout`, `password_reset`
965
-
966
- 2. **Content Events** (10 types):
967
- - `content_created`, `content_updated`, `content_deleted`
968
- - `published`, `unpublished`, `archived`
969
- - `viewed`, `liked`, `shared`, `commented`
970
-
971
- 3. **Token Events** (8 types):
972
- - `tokens_purchased`, `tokens_transferred`, `tokens_burned`
973
- - `tokens_staked`, `tokens_unstaked`
974
- - `tokens_earned`, `tokens_spent`, `tokens_claimed`
975
-
976
- 4. **Platform Events** (5 types):
977
- - `website_created`, `website_deployed`, `website_updated`
978
- - `livestream_started`, `livestream_ended`
979
-
980
- 5. **Business Events** (7 types):
981
- - `payment_processed`, `payment_failed`, `payment_refunded`
982
- - `subscription_started`, `subscription_cancelled`
983
- - `invoice_generated`, `invoice_paid`
984
-
985
- **Benefits of Consolidation:**
986
- - **AI Generation**: Fewer types = more consistent patterns
987
- - **Type Safety**: Still strongly typed via metadata
988
- - **Flexibility**: Generic types handle edge cases
989
- - **Maintainability**: Less code duplication
990
- - **Query Performance**: Fewer index types to maintain
991
-
992
- **Metadata Pattern for Type Specificity:**
993
- ```typescript
994
- // Generic type + rich metadata = type-safe flexibility
995
- interface Connection {
996
- fromEntityId: Id<"entities">;
997
- toEntityId: Id<"entities">;
998
- relationshipType: "follows" | "owns" | "subscribes_to" | /* ... 21 more */;
999
- metadata: {
1000
- // Type-specific metadata stored here
1001
- entityType?: string;
1002
- amount?: number;
1003
- status?: string;
1004
- permissions?: string[];
1005
- // Any additional context
1006
- };
1007
- }
1386
+ **Effect.ts Service Pattern:**
1008
1387
 
1009
- // Query example: Get all follows (regardless of what's being followed)
1010
- await ctx.db
1011
- .query("connections")
1012
- .withIndex("by_relationship", (q) =>
1013
- q.eq("relationshipType", "follows")
1014
- )
1015
- .filter((q) => q.eq(q.field("fromEntityId"), userId))
1016
- .collect();
1017
-
1018
- // Query example: Get all creator follows specifically
1019
- await ctx.db
1020
- .query("connections")
1021
- .withIndex("by_relationship", (q) =>
1022
- q.eq("relationshipType", "follows")
1023
- )
1024
- .filter((q) =>
1025
- q.and(
1026
- q.eq(q.field("fromEntityId"), userId),
1027
- q.eq(q.field("metadata.entityType"), "creator")
1028
- )
1029
- )
1030
- .collect();
1031
- ```
1032
-
1033
- See `docs/Ontology.md` for complete details.
1034
-
1035
- ### Layer 6: External Service Providers
1036
-
1037
- 14 external service providers integrated via Effect.ts with **multi-chain architecture**:
1038
-
1039
- **Core AI & Content**:
1040
- - **OpenAI** - LLM, embeddings, content generation
1041
- - **ElevenLabs** - Voice cloning and synthesis
1042
- - **D-ID** - AI appearance/avatar cloning
1043
- - **HeyGen** - Premium AI video avatars
1044
-
1045
- **Multi-Chain Blockchain Providers** (separate services per chain):
1046
- - **SuiProvider** - Sui blockchain integration (Move language, high throughput)
1047
- - **BaseProvider** - Base (Coinbase L2) integration (EVM-compatible, low fees)
1048
- - **SolanaProvider** - Solana blockchain integration (high-speed, low-cost)
1049
- - **Alchemy** - Multi-chain RPC infrastructure (supports all chains)
1050
-
1051
- **CRITICAL: Stripe is for FIAT ONLY** (not blockchain):
1052
- - **StripeProvider** - Fiat payment processing, subscriptions, traditional invoicing
1053
- - Used ONLY for USD/EUR/etc payments
1054
- - Does NOT handle crypto or blockchain transactions
1055
- - Separate from all blockchain providers
1056
-
1057
- **CRITICAL: Cloudflare is for LIVESTREAMING ONLY**:
1058
- - **CloudflareProvider** - Live streaming and video hosting ONLY
1059
- - Stream API for live broadcasts
1060
- - Video storage and playback
1061
- - NOT used for web hosting (that's Cloudflare Pages, different service)
1062
-
1063
- **Communications**:
1064
- - **Resend** - Primary email service
1065
- - **SendGrid** - Advanced email with tracking
1066
- - **Twilio** - SMS and voice communications
1067
-
1068
- **Infrastructure**:
1069
- - **AWS** - Media storage (S3), CDN (CloudFront)
1070
-
1071
- **Multi-Chain Architecture Pattern:**
1072
1388
  ```typescript
1073
- // Each blockchain is a separate Effect.ts provider
1074
- export class SuiProvider extends Effect.Service<SuiProvider>()("SuiProvider", {
1389
+ // backend/convex/services/things.ts
1390
+ export class ThingService extends Effect.Service<ThingService>()("ThingService", {
1075
1391
  effect: Effect.gen(function* () {
1076
- return {
1077
- transfer: (args) => Effect.gen(function* () { /* Sui-specific */ }),
1078
- mintNFT: (args) => Effect.gen(function* () { /* Sui Move contract */ }),
1079
- getBalance: (address) => Effect.gen(function* () { /* Sui RPC */ }),
1080
- };
1081
- }),
1082
- }) {}
1392
+ const db = yield* ConvexDatabase;
1083
1393
 
1084
- export class BaseProvider extends Effect.Service<BaseProvider>()("BaseProvider", {
1085
- effect: Effect.gen(function* () {
1086
1394
  return {
1087
- transfer: (args) => Effect.gen(function* () { /* Base L2 */ }),
1088
- mintNFT: (args) => Effect.gen(function* () { /* ERC-721 on Base */ }),
1089
- getBalance: (address) => Effect.gen(function* () { /* Base RPC */ }),
1090
- };
1091
- }),
1092
- }) {}
1395
+ create: (input: CreateThingInput) =>
1396
+ Effect.gen(function* () {
1397
+ // Validation
1398
+ const validated = yield* validateThing(input);
1399
+
1400
+ // Creation
1401
+ const thingId = yield* db.insert("things", {
1402
+ type: validated.type,
1403
+ name: validated.name,
1404
+ groupId: validated.groupId,
1405
+ properties: validated.properties,
1406
+ status: "draft",
1407
+ createdAt: Date.now(),
1408
+ updatedAt: Date.now(),
1409
+ });
1093
1410
 
1094
- export class SolanaProvider extends Effect.Service<SolanaProvider>()("SolanaProvider", {
1095
- effect: Effect.gen(function* () {
1096
- return {
1097
- transfer: (args) => Effect.gen(function* () { /* Solana web3.js */ }),
1098
- mintNFT: (args) => Effect.gen(function* () { /* Metaplex */ }),
1099
- getBalance: (address) => Effect.gen(function* () { /* Solana RPC */ }),
1411
+ // Event logging
1412
+ yield* db.insert("events", {
1413
+ type: `${validated.type}_created`,
1414
+ actorId: validated.creatorId,
1415
+ targetId: thingId,
1416
+ groupId: validated.groupId,
1417
+ metadata: {},
1418
+ timestamp: Date.now(),
1419
+ });
1420
+
1421
+ return thingId;
1422
+ }).pipe(
1423
+ Effect.retry({ times: 3 }),
1424
+ Effect.timeout("30 seconds"),
1425
+ Effect.catchTags({
1426
+ ValidationError: (e) => Effect.fail(new ThingCreateError(e)),
1427
+ DatabaseError: (e) => Effect.fail(new ThingCreateError(e)),
1428
+ })
1429
+ ),
1100
1430
  };
1101
1431
  }),
1432
+ dependencies: [ConvexDatabase.Default],
1102
1433
  }) {}
1103
-
1104
- // Services choose which chain based on user preference or entity metadata
1105
- export class TokenService extends Effect.Service<TokenService>()(
1106
- "TokenService",
1107
- {
1108
- effect: Effect.gen(function* () {
1109
- const sui = yield* SuiProvider;
1110
- const base = yield* BaseProvider;
1111
- const solana = yield* SolanaProvider;
1112
-
1113
- return {
1114
- transfer: (args) =>
1115
- Effect.gen(function* () {
1116
- // Route to correct chain based on tokenId metadata
1117
- const token = yield* db.get(args.tokenId);
1118
-
1119
- switch (token.metadata.blockchain) {
1120
- case "sui": return yield* sui.transfer(args);
1121
- case "base": return yield* base.transfer(args);
1122
- case "solana": return yield* solana.transfer(args);
1123
- }
1124
- })
1125
- };
1126
- }),
1127
- dependencies: [SuiProvider.Default, BaseProvider.Default, SolanaProvider.Default]
1128
- }
1129
- ) {}
1130
1434
  ```
1131
1435
 
1132
- **Why Separate Providers Per Chain:**
1133
- - Different APIs (Sui uses Move, Base uses EVM, Solana uses web3.js)
1134
- - Different transaction models and gas fee structures
1135
- - Type safety per chain (each has unique error types)
1136
- - Easy to add new chains without modifying existing code
1137
- - Users can choose preferred blockchain per token/NFT
1436
+ ### Frontend: Astro + React + Provider Pattern
1138
1437
 
1139
- All providers follow Effect.ts patterns:
1140
- - Typed errors in signature
1141
- - Automatic dependency injection
1142
- - Composable operations
1143
- - Built-in retry logic
1438
+ **Progressive Complexity (5 Layers):**
1144
1439
 
1145
- See `docs/Service Providers.md` and `docs/Service Providers - New.md` for details.
1440
+ **Layer 1:** Content + Pages (static) - 80% of apps stop here
1441
+ **Layer 2:** + Validation (Effect.ts services) - 15% of apps
1442
+ **Layer 3:** + State (Nanostores + hooks) - 4% of apps
1443
+ **Layer 4:** + Multiple Sources (provider pattern) - 1% of apps
1444
+ **Layer 5:** + Backend (REST API + database) - <1% of apps
1146
1445
 
1446
+ **Layer 1 Example (Blog):**
1447
+
1448
+ ```astro
1449
+ ---
1450
+ // src/pages/blog/index.astro
1451
+ import { getCollection } from "astro:content";
1452
+ const posts = await getCollection("posts");
1147
1453
  ---
1148
1454
 
1149
- ## Why Functional Programming Enables Better AI Generation
1455
+ <Layout>
1456
+ {posts.map(post => (
1457
+ <PostCard post={post.data} />
1458
+ ))}
1459
+ </Layout>
1460
+ ```
1150
1461
 
1151
- ### Problem: Imperative Code Is Unpredictable
1462
+ **Layer 4 Example (Multi-Source):**
1152
1463
 
1153
- **Imperative style (typical code):**
1154
1464
  ```typescript
1155
- async function purchaseTokens(userId, tokenId, amount) {
1156
- // State mutation everywhere
1157
- let payment = null;
1158
- let tokens = null;
1159
- let error = null;
1160
-
1161
- try {
1162
- payment = await stripe.charge(amount);
1163
- tokens = await blockchain.mint(amount);
1164
- await db.updateBalance(userId, tokens);
1165
- } catch (e) {
1166
- error = e;
1167
- // Try to rollback? Maybe? Depends on where we failed
1168
- if (payment) {
1169
- await stripe.refund(payment.id);
1170
- }
1171
- if (tokens) {
1172
- // Can we even rollback blockchain?
1173
- }
1465
+ // src/lib/providers/getContentProvider.ts
1466
+ export function getContentProvider(collection: string) {
1467
+ const mode = import.meta.env.CONTENT_SOURCE || "markdown";
1468
+
1469
+ switch (mode) {
1470
+ case "api":
1471
+ return new ApiProvider(apiUrl);
1472
+ case "hybrid":
1473
+ return new HybridProvider(
1474
+ new ApiProvider(apiUrl),
1475
+ new MarkdownProvider(collection)
1476
+ );
1477
+ default:
1478
+ return new MarkdownProvider(collection);
1174
1479
  }
1175
-
1176
- // What state are we in? Unclear.
1177
1480
  }
1178
- ```
1179
-
1180
- **Problems for AI:**
1181
- 1. **Implicit state** - AI can't track where mutations happen
1182
- 2. **Error handling unclear** - Try/catch doesn't say what errors can occur
1183
- 3. **Partial failures complex** - Rollback logic is manual and error-prone
1184
- 4. **Hard to compose** - Can't easily combine with other functions
1185
- 5. **Testing difficult** - Need to mock global state
1186
-
1187
- **AI generates buggy code because:**
1188
- - Can't predict all state changes
1189
- - Doesn't know what errors to handle
1190
- - Misses edge cases in rollback logic
1191
- - Creates tight coupling
1192
1481
 
1193
- ### Solution: Functional Programming Is Predictable
1194
-
1195
- **Functional style (Effect.ts):**
1196
- ```typescript
1197
- const purchaseTokens = (
1198
- userId: Id<"entities">,
1199
- tokenId: Id<"entities">,
1200
- amount: number
1201
- ): Effect.Effect<
1202
- { paymentId: string; tokens: number }, // Success type
1203
- StripeError | BlockchainError | DatabaseError, // Error types (explicit!)
1204
- TokenService // Dependencies (explicit!)
1205
- > =>
1206
- Effect.gen(function* () {
1207
- const service = yield* TokenService;
1208
-
1209
- // All operations must succeed together
1210
- const [payment, tokens] = yield* Effect.all([
1211
- service.charge(userId, amount),
1212
- service.mint(tokenId, amount),
1213
- ]);
1214
-
1215
- // Automatically rolls back on any failure
1216
- yield* service.recordPurchase(userId, payment, tokens);
1217
-
1218
- return { paymentId: payment.id, tokens };
1219
- }).pipe(
1220
- // Declarative error handling
1221
- Effect.onError(() =>
1222
- Effect.all([
1223
- service.refund(payment.id),
1224
- service.burn(tokens)
1225
- ])
1226
- )
1227
- );
1228
- ```
1229
-
1230
- **Benefits for AI:**
1231
- 1. **Pure functions** - Same input → same output (predictable)
1232
- 2. **Typed errors** - AI knows exactly what can fail
1233
- 3. **Explicit dependencies** - AI sees what's needed
1234
- 4. **Automatic rollback** - Declarative, not manual
1235
- 5. **Composable** - AI can combine functions safely
1236
-
1237
- **AI generates better code because:**
1238
- - All inputs/outputs are in the type signature
1239
- - Error cases are exhaustive in types
1240
- - Dependencies are explicit
1241
- - Rollback is automatic
1242
- - Functions compose predictably
1482
+ // Same code, different backends
1483
+ const provider = getContentProvider("products");
1484
+ const products = await provider.things.list({ type: "product" });
1485
+ ```
1243
1486
 
1244
1487
  ---
1245
1488
 
1246
- ## Functional Programming Principles That Help AI
1489
+ ## Agent Clone: Import ANY Feature from ANY System
1247
1490
 
1248
- ### 1. Pure Functions
1491
+ ### Example: Clone Shopify E-commerce
1249
1492
 
1250
- **Pure function:**
1251
- ```typescript
1252
- // ✅ Pure: Same input → same output, no side effects
1253
- function calculateTokenPrice(
1254
- supply: number,
1255
- demand: number
1256
- ): number {
1257
- return demand / supply;
1258
- }
1259
- ```
1260
-
1261
- **Impure function:**
1262
- ```typescript
1263
- // ❌ Impure: Depends on external state, has side effects
1264
- let globalSupply = 1000000;
1265
-
1266
- function calculateTokenPrice(demand: number): number {
1267
- globalSupply -= 100; // Side effect!
1268
- return demand / globalSupply; // Depends on mutable state!
1269
- }
1493
+ ```bash
1494
+ npx oneie clone https://github.com/Shopify/shopify-api-node
1270
1495
  ```
1271
1496
 
1272
- **Why AI prefers pure functions:**
1273
- - AI can reason about behavior from signature alone
1274
- - No hidden dependencies to track
1275
- - No order-of-execution bugs
1276
- - Can be moved/refactored safely
1277
- - Easy to test (no setup needed)
1278
-
1279
- ### 2. Immutability
1497
+ **Agent workflow:**
1280
1498
 
1281
- **Immutable:**
1282
- ```typescript
1283
- // ✅ Immutable: Create new, don't modify
1284
- const addToken = (
1285
- balance: TokenBalance,
1286
- amount: number
1287
- ): TokenBalance => ({
1288
- ...balance,
1289
- amount: balance.amount + amount,
1290
- updatedAt: Date.now()
1291
- });
1499
+ **Step 1: Analyze Shopify schema**
1292
1500
  ```
1293
-
1294
- **Mutable:**
1295
- ```typescript
1296
- // ❌ Mutable: Modify in place
1297
- const addToken = (
1298
- balance: TokenBalance,
1299
- amount: number
1300
- ): void => {
1301
- balance.amount += amount; // Mutation!
1302
- balance.updatedAt = Date.now();
1303
- };
1304
- ```
1305
-
1306
- **Why AI prefers immutability:**
1307
- - AI doesn't have to track where mutations occur
1308
- - No aliasing bugs (two references to same object)
1309
- - Can reason about state at any point in time
1310
- - Easier to parallelize operations
1311
- - Prevents accidental data corruption
1312
-
1313
- ### 3. Composition Over Inheritance
1314
-
1315
- **Composition:**
1316
- ```typescript
1317
- // ✅ Compose small functions
1318
- const createClone = (creatorId: Id<"entities">) =>
1319
- Effect.gen(function* () {
1320
- const content = yield* fetchContent(creatorId);
1321
- const voice = yield* cloneVoice(content);
1322
- const personality = yield* extractPersonality(content);
1323
-
1324
- return { voice, personality };
1325
- });
1326
-
1327
- // Each piece is independent, reusable
1501
+ Products → things (type: product)
1502
+ Customers → people (role: customer)
1503
+ Orders → connections (purchased) + events (order_placed)
1504
+ Cart → connections (in_cart)
1505
+ Inventory → thing properties
1506
+ Collections → groups (type: collection)
1328
1507
  ```
1329
1508
 
1330
- **Inheritance:**
1509
+ **Step 2: Generate ShopifyProvider**
1331
1510
  ```typescript
1332
- // ❌ Inheritance hierarchy (rigid, complex)
1333
- class BaseClone {
1334
- constructor(protected creator: Creator) {}
1335
- }
1336
-
1337
- class VoiceClone extends BaseClone {
1338
- async clone() { /* ... */ }
1339
- }
1340
-
1341
- class PersonalityClone extends VoiceClone {
1342
- async extract() { /* ... */ }
1511
+ export class ShopifyProvider implements ContentProvider {
1512
+ things = {
1513
+ list: ({ type }) => {
1514
+ if (type === "product") {
1515
+ return Effect.tryPromise({
1516
+ try: async () => {
1517
+ const products = await shopify.product.list();
1518
+ return products.map(p => ({
1519
+ _id: p.id,
1520
+ type: "product",
1521
+ name: p.title,
1522
+ properties: {
1523
+ price: p.variants[0].price,
1524
+ inventory: p.variants[0].inventory_quantity,
1525
+ shopifyId: p.id,
1526
+ },
1527
+ }));
1528
+ },
1529
+ catch: (e) => new QueryError(String(e)),
1530
+ });
1531
+ }
1532
+ },
1533
+ };
1534
+ // ... implement all ontology operations
1343
1535
  }
1344
-
1345
- // AI has to understand entire hierarchy
1346
1536
  ```
1347
1537
 
1348
- **Why AI prefers composition:**
1349
- - Smaller, independent pieces
1350
- - No need to understand inheritance chains
1351
- - Can mix and match functionality
1352
- - Easier to modify without breaking other parts
1353
- - Clear data flow (input → process → output)
1354
-
1355
- ### 4. Typed Errors (Effect.ts)
1356
-
1357
- **Typed errors:**
1538
+ **Step 3: Generate Effect.ts services**
1358
1539
  ```typescript
1359
- // ✅ Errors in type signature
1360
- const cloneVoice = (
1361
- samples: string[]
1362
- ): Effect.Effect<
1363
- VoiceId,
1364
- InsufficientSamplesError | VoiceCloneFailedError, // Explicit!
1365
- ElevenLabsProvider
1366
- > => { /* ... */ }
1367
-
1368
- // AI knows exactly what to catch
1369
- Effect.catchTags({
1370
- InsufficientSamplesError: (e) => askForMoreSamples(),
1371
- VoiceCloneFailedError: (e) => useDefaultVoice()
1372
- })
1373
- ```
1374
-
1375
- **Generic errors:**
1376
- ```typescript
1377
- // ❌ Generic error (AI doesn't know what can fail)
1378
- async function cloneVoice(samples: string[]): Promise<VoiceId> {
1379
- try {
1380
- // What can go wrong? Who knows!
1381
- return await elevenLabs.clone(samples);
1382
- } catch (e) {
1383
- // Lost all type information
1384
- throw e;
1385
- }
1386
- }
1387
- ```
1540
+ export const createOrder = Effect.gen(function* () {
1541
+ const provider = yield* DataProvider;
1388
1542
 
1389
- **Why AI prefers typed errors:**
1390
- - Compiler enforces handling all error cases
1391
- - AI can't forget to handle errors
1392
- - Clear what errors are possible
1393
- - Exhaustive pattern matching
1394
- - No silent failures
1543
+ const product = yield* provider.things.get(productId);
1544
+ const customer = yield* provider.people.get(customerId);
1395
1545
 
1396
- ### 5. Dependency Injection
1546
+ const connection = yield* provider.connections.create({
1547
+ fromPersonId: customer._id,
1548
+ toThingId: product._id,
1549
+ relationshipType: "purchased",
1550
+ metadata: { quantity, price: product.properties.price },
1551
+ });
1397
1552
 
1398
- **Dependency injection:**
1399
- ```typescript
1400
- // ✅ Dependencies explicit
1401
- class TokenService extends Effect.Service<TokenService>()(
1402
- "TokenService",
1403
- {
1404
- effect: Effect.gen(function* () {
1405
- const stripe = yield* StripeProvider;
1406
- const blockchain = yield* BlockchainProvider;
1407
-
1408
- return { /* methods */ };
1409
- }),
1410
- dependencies: [StripeProvider.Default, BlockchainProvider.Default]
1411
- }
1412
- ) {}
1553
+ yield* provider.events.log({
1554
+ type: "order_placed",
1555
+ actorId: customer._id,
1556
+ targetId: connection._id,
1557
+ metadata: { amount: quantity * product.properties.price },
1558
+ });
1413
1559
 
1414
- // AI knows what's needed
1415
- // AI can mock for tests
1560
+ return connection._id;
1561
+ });
1416
1562
  ```
1417
1563
 
1418
- **Global dependencies:**
1419
- ```typescript
1420
- // ❌ Global imports (implicit dependencies)
1421
- import { stripe } from '@/lib/stripe';
1422
- import { blockchain } from '@/lib/blockchain';
1423
-
1424
- async function purchaseTokens() {
1425
- // AI doesn't know these are needed until runtime
1426
- await stripe.charge();
1427
- await blockchain.mint();
1428
- }
1564
+ **Step 4: Generate Astro pages**
1565
+ ```astro
1566
+ ---
1567
+ const provider = getContentProvider("products");
1568
+ const products = await provider.things.list({ type: "product" });
1569
+ ---
1570
+ <Layout>
1571
+ {products.map(product => (
1572
+ <ProductCard product={product} />
1573
+ ))}
1574
+ </Layout>
1429
1575
  ```
1430
1576
 
1431
- **Why AI prefers DI:**
1432
- - All dependencies visible in type signature
1433
- - Easy to mock for testing
1434
- - Clear boundaries between modules
1435
- - Can swap implementations easily
1436
- - No hidden global state
1577
+ **Result:** Full e-commerce system imported into ONE's ontology. No custom schema. Everything maps to the 6 dimensions.
1437
1578
 
1438
1579
  ---
1439
1580
 
1440
- ## How This Scales With AI Code Generation
1441
-
1442
- ### At 100 Files
1443
-
1444
- **Imperative codebase:**
1445
- - AI generates code with implicit dependencies
1446
- - Global state makes changes risky
1447
- - Hard to predict what breaks
1448
- - Tests are integration tests (slow, flaky)
1449
- - Refactoring is dangerous
1450
-
1451
- **Functional codebase (ONE):**
1452
- - AI generates code with explicit dependencies
1453
- - No global state to corrupt
1454
- - Types catch breaking changes
1455
- - Tests are unit tests (fast, reliable)
1456
- - Refactoring is safe (types + tests)
1457
-
1458
- ### At 1,000 Files
1459
-
1460
- **Imperative codebase:**
1461
- - AI generates increasingly coupled code
1462
- - Side effects everywhere
1463
- - Debugging requires tracing through many files
1464
- - Fear of changing anything
1465
- - **Code quality degrades**
1466
-
1467
- **Functional codebase (ONE):**
1468
- - AI generates composable services
1469
- - Pure functions with clear boundaries
1470
- - Each function testable in isolation
1471
- - Can change implementation without breaking interface
1472
- - **Code quality improves** (later code uses earlier patterns)
1473
-
1474
- ### At 10,000 Files (Large Application)
1475
-
1476
- **Imperative codebase:**
1477
- - AI generates duplicate logic (doesn't recognize patterns)
1478
- - State management is spaghetti
1479
- - Technical debt compounds
1480
- - **AI becomes a liability**
1581
+ ## Why This Never Breaks
1481
1582
 
1482
- **Functional codebase (ONE):**
1483
- - AI recognizes and reuses services
1484
- - Services compose into higher-level services
1485
- - Patterns are clear and consistent
1486
- - **AI becomes more valuable** (understands architecture deeply)
1583
+ ### 1. Reality is Stable
1487
1584
 
1488
- ---
1585
+ The 6 dimensions model reality:
1586
+ - Groups (containers)
1587
+ - People (actors)
1588
+ - Things (entities)
1589
+ - Connections (relationships)
1590
+ - Events (actions)
1591
+ - Knowledge (understanding)
1489
1592
 
1490
- ## Concrete Example: Token Purchase Flow
1593
+ **Reality doesn't change.** Technology does. The ontology abstracts reality.
1491
1594
 
1492
- ### Step 1: User Clicks "Buy Tokens" (Frontend)
1595
+ ### 2. Technology is Adapter
1493
1596
 
1494
- ```tsx
1495
- // src/components/features/tokens/TokenPurchase.tsx
1496
- export function TokenPurchase({ tokenId }: { tokenId: Id<"entities"> }) {
1497
- const purchase = useMutation(api.tokens.purchase);
1498
-
1499
- return (
1500
- <Button onClick={() => purchase({ tokenId, amount: 100 })}>
1501
- Buy 100 Tokens
1502
- </Button>
1503
- );
1504
- }
1505
1597
  ```
1506
-
1507
- ### Step 2: Convex Mutation Receives Request
1508
-
1509
- ```typescript
1510
- // convex/mutations/tokens.ts
1511
- export const purchase = confect.mutation({
1512
- args: { tokenId: v.id("entities"), amount: v.number() },
1513
- handler: (ctx, args) =>
1514
- Effect.gen(function* () {
1515
- const userId = yield* getUserId(ctx);
1516
- const tokenService = yield* TokenService;
1517
-
1518
- return yield* tokenService.purchase({
1519
- userId,
1520
- tokenId: args.tokenId,
1521
- amount: args.amount
1522
- });
1523
- }).pipe(Effect.provide(MainLayer))
1524
- });
1598
+ Shopify API → ShopifyProvider → Ontology Interface
1599
+ Moodle Database → MoodleProvider → Ontology Interface
1600
+ WordPress REST → WordPressProvider → Ontology Interface
1601
+ Custom Backend → CustomProvider → Ontology Interface
1525
1602
  ```
1526
1603
 
1527
- ### Step 3: Effect.ts Service Orchestrates
1528
-
1529
- ```typescript
1530
- // convex/services/tokens/purchase.ts
1531
- export class TokenService extends Effect.Service<TokenService>()(
1532
- "TokenService",
1533
- {
1534
- effect: Effect.gen(function* () {
1535
- const db = yield* ConvexDatabase;
1536
- const stripe = yield* StripeProvider; // FIAT payments only
1537
- const sui = yield* SuiProvider; // Sui blockchain
1538
- const base = yield* BaseProvider; // Base L2
1539
- const solana = yield* SolanaProvider; // Solana
1540
-
1541
- return {
1542
- purchase: ({ userId, tokenId, amount, paymentMethod }) =>
1543
- Effect.gen(function* () {
1544
- // Get token metadata to determine blockchain
1545
- const token = yield* db.get(tokenId);
1546
- const blockchain = token.metadata.blockchain; // "sui" | "base" | "solana"
1547
-
1548
- // Step 1: Process payment (FIAT via Stripe OR crypto direct)
1549
- const payment = paymentMethod === "fiat"
1550
- ? yield* stripe.charge({
1551
- amount: amount * 0.10, // $0.10 per token (fiat)
1552
- currency: "usd"
1553
- })
1554
- : { method: "crypto", txHash: null }; // Crypto payment handled on-chain
1555
-
1556
- // Step 2: Mint tokens on the correct blockchain
1557
- const mintResult = yield* (
1558
- blockchain === "sui" ? sui.mintToken({ amount, toAddress: userId }) :
1559
- blockchain === "base" ? base.mintToken({ amount, toAddress: userId }) :
1560
- blockchain === "solana" ? solana.mintToken({ amount, toAddress: userId }) :
1561
- Effect.fail(new UnsupportedBlockchainError(blockchain))
1562
- );
1563
-
1564
- // Step 3: Record in database
1565
- yield* db.insert("events", {
1566
- entityId: tokenId,
1567
- eventType: "tokens_purchased",
1568
- timestamp: Date.now(),
1569
- actorType: "user",
1570
- actorId: userId,
1571
- metadata: {
1572
- amount,
1573
- blockchain,
1574
- paymentMethod,
1575
- paymentId: payment.method === "crypto" ? null : payment.id,
1576
- txHash: mintResult.txHash
1577
- }
1578
- });
1579
-
1580
- // Step 4: Update balance connection
1581
- yield* db.upsert("connections", {
1582
- fromEntityId: userId,
1583
- toEntityId: tokenId,
1584
- relationshipType: "holds_tokens",
1585
- metadata: {
1586
- balance: amount,
1587
- blockchain,
1588
- lastUpdated: Date.now()
1589
- }
1590
- });
1591
-
1592
- return { success: true, amount, blockchain, txHash: mintResult.txHash };
1593
- }).pipe(
1594
- // Automatic rollback on any failure
1595
- Effect.onError((error) =>
1596
- Effect.gen(function* () {
1597
- // Refund fiat payment if it was processed
1598
- if (payment.method !== "crypto") {
1599
- yield* stripe.refund(payment.id);
1600
- }
1601
-
1602
- // Burn tokens on the correct blockchain
1603
- if (mintResult) {
1604
- yield* (
1605
- blockchain === "sui" ? sui.burnToken({ amount, txHash: mintResult.txHash }) :
1606
- blockchain === "base" ? base.burnToken({ amount, txHash: mintResult.txHash }) :
1607
- blockchain === "solana" ? solana.burnToken({ amount, txHash: mintResult.txHash }) :
1608
- Effect.succeed(null)
1609
- );
1610
- }
1611
- })
1612
- )
1613
- )
1614
- };
1615
- }),
1616
- dependencies: [
1617
- ConvexDatabase.Default,
1618
- StripeProvider.Default, // Fiat only
1619
- SuiProvider.Default, // Multi-chain
1620
- BaseProvider.Default,
1621
- SolanaProvider.Default
1622
- ]
1623
- }
1624
- ) {}
1625
- ```
1626
-
1627
- ### Why This Is AI-Friendly
1628
-
1629
- **AI can see:**
1630
- 1. **Inputs:** `userId`, `tokenId`, `amount`, `paymentMethod` (explicit)
1631
- 2. **Outputs:** `{ success: boolean, amount: number, blockchain: string, txHash: string }` (explicit)
1632
- 3. **Errors:** `StripeError | SuiError | BaseError | SolanaError | UnsupportedBlockchainError | DatabaseError` (explicit)
1633
- 4. **Dependencies:** `ConvexDatabase`, `StripeProvider`, `SuiProvider`, `BaseProvider`, `SolanaProvider` (explicit)
1634
- 5. **Side effects:** Fiat payment OR crypto payment, minting on specific blockchain, database writes (explicit)
1635
- 6. **Rollback:** Automatic if any step fails, chain-specific rollback (declarative)
1636
- 7. **Multi-chain routing:** Token metadata determines which blockchain to use (explicit)
1637
-
1638
- **AI can generate:**
1639
- - Tests with mocked services for each blockchain
1640
- - Similar flows for other multi-chain operations
1641
- - Error handling for each blockchain's unique errors
1642
- - Chain-specific logging and monitoring
1643
- - Rate limiting per blockchain
1644
- - Retry logic with chain-specific strategies
1645
- - New blockchain integrations following the same pattern
1646
-
1647
- **AI cannot break:**
1648
- - Type system prevents invalid states
1649
- - Compiler catches missing error handling per chain
1650
- - Dependencies are wired automatically
1651
- - Rollback is automatic and chain-aware
1652
- - Unsupported blockchains fail explicitly (not silently)
1653
- - Fiat vs crypto payment paths are type-safe
1654
-
1655
- **Multi-chain pattern benefits:**
1656
- 1. **Consistency:** Same interface for all blockchains
1657
- 2. **Type Safety:** Each chain has unique error types
1658
- 3. **Extensibility:** Add new chains without modifying existing code
1659
- 4. **Testing:** Mock individual chains independently
1660
- 5. **Observability:** Chain-specific tracing and metrics
1661
-
1662
- ---
1663
-
1664
- ## Testing With Functional Programming
1604
+ **New technology?** Write new adapter. Ontology stays the same.
1665
1605
 
1666
- ### Unit Test (Service)
1606
+ ### 3. Structure Compounds
1667
1607
 
1668
1608
  ```typescript
1669
- // tests/unit/services/token.test.ts
1670
- import { Effect, Layer } from "effect";
1671
- import { TokenService } from "@/convex/services/tokens/purchase";
1672
-
1673
- describe("TokenService.purchase", () => {
1674
- it("should purchase tokens successfully", async () => {
1675
- // Mock dependencies
1676
- const MockStripe = Layer.succeed(StripeProvider, {
1677
- charge: () => Effect.succeed({ id: "pay_123" })
1678
- });
1679
-
1680
- const MockBlockchain = Layer.succeed(BlockchainProvider, {
1681
- mint: () => Effect.succeed({ txHash: "0x456" })
1682
- });
1683
-
1684
- const MockDB = Layer.succeed(ConvexDatabase, {
1685
- insert: () => Effect.succeed("evt_789"),
1686
- upsert: () => Effect.succeed("conn_012")
1687
- });
1688
-
1689
- const TestLayer = Layer.mergeAll(MockStripe, MockBlockchain, MockDB);
1690
-
1691
- // Run test
1692
- const result = await Effect.runPromise(
1693
- Effect.gen(function* () {
1694
- const service = yield* TokenService;
1695
- return yield* service.purchase({
1696
- userId: "user-123",
1697
- tokenId: "token-456",
1698
- amount: 100
1699
- });
1700
- }).pipe(Effect.provide(TestLayer))
1701
- );
1702
-
1703
- expect(result.success).toBe(true);
1704
- expect(result.amount).toBe(100);
1705
- });
1706
-
1707
- it("should rollback on payment failure", async () => {
1708
- const MockStripe = Layer.succeed(StripeProvider, {
1709
- charge: () => Effect.fail(new StripeError("Card declined"))
1710
- });
1711
-
1712
- // Test that blockchain.mint is NOT called
1713
- const mintSpy = vi.fn();
1714
- const MockBlockchain = Layer.succeed(BlockchainProvider, {
1715
- mint: () => Effect.sync(mintSpy)
1716
- });
1717
-
1718
- const TestLayer = Layer.mergeAll(MockStripe, MockBlockchain);
1719
-
1720
- await expect(
1721
- Effect.runPromise(
1722
- /* ... */.pipe(Effect.provide(TestLayer))
1723
- )
1724
- ).rejects.toThrow("Card declined");
1725
-
1726
- expect(mintSpy).not.toHaveBeenCalled();
1727
- });
1609
+ // Generation 1: Agent learns the pattern
1610
+ export const createUser = Effect.gen(function* () {
1611
+ const provider = yield* DataProvider;
1612
+ return yield* provider.things.create({ type: "user", ...input });
1728
1613
  });
1729
- ```
1730
1614
 
1731
- **AI can generate these tests because:**
1732
- - Clear service interface
1733
- - Easy to mock dependencies
1734
- - Behavior is predictable
1735
- - Error cases are explicit
1615
+ // Generation 2: Agent reuses the pattern
1616
+ export const createProduct = Effect.gen(function* () {
1617
+ const provider = yield* DataProvider;
1618
+ return yield* provider.things.create({ type: "product", ...input });
1619
+ });
1736
1620
 
1737
- ---
1621
+ // Generation N: Agent has mastered the pattern
1622
+ export const createAnything = <T>(type: ThingType, input: T) =>
1623
+ Effect.gen(function* () {
1624
+ const provider = yield* DataProvider;
1625
+ return yield* provider.things.create({ type, ...input });
1626
+ });
1627
+ ```
1738
1628
 
1739
- ## Summary: Why This Architecture Works for AI
1629
+ **Each generation reinforces the pattern. Accuracy compounds to 98%+.**
1740
1630
 
1741
- ### Traditional Approach (Fails at Scale)
1742
- ```
1743
- Imperative code
1744
- → Hidden state
1745
- → Implicit errors
1746
- → Tight coupling
1747
- → AI generates bugs
1748
- → Code quality degrades
1749
- → AI becomes liability
1750
- ```
1631
+ ### 4. Type Safety is Complete
1751
1632
 
1752
- ### ONE Approach (Improves at Scale)
1753
1633
  ```
1754
- Functional programming
1755
- → Pure functions
1756
- → Typed errors
1757
- → Explicit dependencies
1758
- → AI generates correct code
1759
- → Code quality improves
1760
- → AI becomes more valuable
1634
+ Schema (Zod) → Type (TypeScript) → Service (Effect) → Component (React)
1761
1635
  ```
1762
1636
 
1763
- **The key insight:** AI is pattern matching. Functional programming creates consistent, explicit patterns that AI can recognize and replicate.
1764
-
1765
- **The result:** Your 10,000-file codebase is EASIER to work with than your 100-file codebase because:
1766
- 1. AI learns patterns from existing code
1767
- 2. Types catch breaking changes automatically
1768
- 3. Services compose rather than duplicate
1769
- 4. Tests verify behavior mechanically
1770
- 5. Refactoring is safe and automated
1771
-
1772
- **This is why larger codebases get BETTER with functional programming + AI, not worse.**
1773
-
1774
- ---
1775
-
1776
- ## Key Architectural Decisions Summary
1777
-
1778
- ### 1. Plain Convex Schema with 6-Dimension Ontology
1779
- **Decision:** Use plain Convex `defineSchema` with 6 dimensions (organizations, people, things, connections, events, knowledge)
1780
- **Rationale:**
1781
- - Simpler mental model for AI agents
1782
- - Organizations provide perfect multi-tenant isolation
1783
- - People represented as things with role metadata (no duplicate tables)
1784
- - No ORM abstraction layer to learn
1785
- - Direct control over indexes and queries
1786
- - Every dimension scoped to organization
1787
- - Scales from children's apps to enterprise SaaS
1788
-
1789
- ### 2. Organizations as First-Class Dimension
1790
- **Decision:** Every resource (thing, connection, event, knowledge) belongs to an organization
1791
- **Rationale:**
1792
- - Perfect data isolation for multi-tenancy
1793
- - Clear ownership boundaries
1794
- - Independent billing and quotas per org
1795
- - Custom frontends per org
1796
- - Platform-level services (shared infrastructure)
1797
-
1798
- ### 3. People as Authorization Layer
1799
- **Decision:** People are things with role property (platform_owner, org_owner, org_user, customer)
1800
- **Rationale:**
1801
- - Every action has an actor (person)
1802
- - Clear permission hierarchy
1803
- - Roles define what actions are allowed
1804
- - Org owners control their users
1805
- - Platform owner can access everything (support/debugging)
1806
-
1807
- ### 4. Multi-Chain Blockchain Architecture
1808
- **Decision:** Separate Effect.ts provider per blockchain (Sui, Base, Solana)
1809
- **Rationale:**
1810
- - Each chain has unique APIs and transaction models
1811
- - Type safety per chain (unique error types)
1812
- - Easy to add new chains without modifying existing code
1813
- - Users can choose preferred blockchain per token/NFT
1814
- - Chain-specific retry strategies and error handling
1815
-
1816
- ### 5. Stripe for FIAT Only
1817
- **Decision:** Stripe handles USD/EUR/etc payments only, NOT crypto
1818
- **Rationale:**
1819
- - Clear separation of concerns (fiat vs crypto)
1820
- - Blockchain providers handle all crypto transactions
1821
- - Prevents confusion about payment routing
1822
- - Simpler error handling (payment method determines provider)
1823
-
1824
- ### 6. Effect.ts 100% Coverage
1825
- **Decision:** ALL business logic uses Effect.ts (no raw async/await)
1826
- **Rationale:**
1827
- - Consistent patterns across entire codebase
1828
- - Typed errors everywhere (no try/catch)
1829
- - Automatic dependency injection
1830
- - Built-in retry, timeout, resource management
1831
- - AI generates consistent code every time
1832
-
1833
- ### 7. 6-Dimension Ontology (Organizations + People + 4 Core Dimensions)
1834
- **Decision:** Expand from 4 tables to 6 dimensions
1835
- **Rationale:**
1836
- - Organizations: Multi-tenant isolation boundary
1837
- - People: Authorization and governance
1838
- - Things: 66 entity types (what exists)
1839
- - Connections: 25 relationship types (how they relate)
1840
- - Events: 67 event types (what happened)
1841
- - Knowledge: Vectors + labels (what it means)
1842
- - Simple enough for children, powerful enough for enterprises
1843
- - AI agents can reason about complete reality model
1637
+ **Every layer is 100% typed.** No `any` types (except flexible `properties`). No runtime surprises.
1844
1638
 
1845
1639
  ---
1846
1640
 
1847
- ## 🎯 Benefits of the Three-Layer Architecture
1848
-
1849
- ### For Developers
1850
-
1851
- **Frontend Developers:**
1852
- - Work independently with Astro + React
1853
- - Use Convex hooks for real-time data (no backend changes needed)
1854
- - Call Hono API for complex operations (clear contracts)
1855
- - Rapid prototyping with "vibe code"
1856
- - Full TypeScript support with generated types
1857
-
1858
- **Backend Developers:**
1859
- - Focus on business logic in Effect.ts services
1860
- - Clear separation between API layer (Hono) and data layer (Convex)
1861
- - Easy to test (mock dependencies via Effect layers)
1862
- - Composable services (combine small functions into larger ones)
1863
- - Automatic retry, timeout, error handling
1864
-
1865
- **Full-Stack Developers:**
1866
- - Clear boundaries between layers
1867
- - Easy to understand data flow (Frontend → Effect.ts → Backend)
1868
- - Consistent patterns across entire stack
1869
- - Type safety end-to-end (TypeScript + Effect.ts)
1641
+ ## Documentation Structure: Cascading Context
1870
1642
 
1871
- ### For AI Code Generation
1643
+ ONE uses **hierarchical context precedence** for AI agents and humans:
1872
1644
 
1873
- **Why This Architecture Works for AI:**
1874
-
1875
- 1. **Predictable Patterns:** Same structure for every feature (map to ontology → Effect.ts service → Hono route → React component)
1876
- 2. **Explicit Types:** AI knows exactly what inputs, outputs, errors, and dependencies are needed
1877
- 3. **Composable:** AI can combine existing services to create new features
1878
- 4. **Testable:** AI can generate tests by mocking Effect layers
1879
- 5. **Self-Improving:** Each new feature makes the next feature easier (AI learns patterns)
1880
-
1881
- **Example: AI generates a new feature in minutes:**
1882
- ```
1883
- 1. Read docs/Ontology.md (understand 6-dimension model: organizations, people, things, connections, events, knowledge)
1884
- 2. Read docs/Frontend.md (understand Astro + React patterns)
1885
- 3. Read docs/Hono.md (understand Effect.ts service patterns)
1886
- 4. Generate Effect.ts service (pure business logic)
1887
- 5. Generate Hono route (thin wrapper)
1888
- 6. Generate Convex wrapper (confect bridge)
1889
- 7. Generate React component (uses Convex hooks + Hono API)
1890
- 8. Generate tests (mock Effect layers)
1891
- 9. Done! Feature is complete, type-safe, tested
1892
- ```
1893
-
1894
- ### For Multi-Tenancy
1895
-
1896
- **Different orgs can customize their frontend:**
1897
- - Each org has their own Astro deployment (unique branding, features)
1898
- - All orgs share the same Hono API + Convex backend
1899
- - Backend remains stable while frontends evolve independently
1900
- - API contracts ensure compatibility
1901
-
1902
- **Example:**
1903
1645
  ```
1904
- Org A: Marketing site with blog (Astro + shadcn/ui dark theme)
1905
- Org B: E-commerce store (Astro + shadcn/ui + custom components)
1906
- Org C: Dashboard app (Astro + custom charting library)
1907
-
1908
- All three: Share same Hono API + Convex backend (auth, tokens, content)
1646
+ /CLAUDE.md (root) ← Platform-wide instructions (all agents read)
1647
+ ↓ precedence
1648
+ /backend/CLAUDE.md ← Backend-specific instructions (agents in backend/)
1649
+ ↓ precedence
1650
+ /backend/convex/CLAUDE.md ← Convex-specific instructions (agents in convex/)
1651
+ ↓ precedence
1652
+ /backend/convex/services/CLAUDE.md ← Service-specific instructions
1653
+
1654
+ /web/CLAUDE.md ← Frontend-specific instructions (agents in web/)
1655
+ ↓ precedence
1656
+ /web/src/pages/CLAUDE.md ← Astro pages instructions (agents in pages/)
1657
+
1658
+ /one/CLAUDE.md ← Ontology documentation instructions
1909
1659
  ```
1910
1660
 
1911
- ### For Performance
1661
+ **Same pattern for:**
1662
+ - `AGENTS.md` - Instructions for GPT (via Codex/other systems)
1663
+ - `README.md` - Instructions for humans
1912
1664
 
1913
- **Deployment Strategy:**
1914
- ```
1915
- Frontend: Cloudflare Pages (global edge network)
1916
- ↓
1917
- Hono API: Cloudflare Workers (edge compute, sub-100ms)
1918
- ↓
1919
- Convex: Real-time database (global replication)
1920
- ```
1665
+ **How it works:**
1921
1666
 
1922
- **Result:**
1923
- - Sub-100ms response times globally
1924
- - Real-time data subscriptions via Convex
1925
- - Static pages cached at the edge (Cloudflare Pages)
1926
- - API routes execute at the edge (Cloudflare Workers)
1927
- - Database queries optimized with indexes
1667
+ 1. Agent starts at root `/CLAUDE.md` (global context)
1668
+ 2. Agent navigates to `/backend/`
1669
+ 3. Agent reads `/backend/CLAUDE.md` (backend context, takes precedence)
1670
+ 4. Agent navigates to `/backend/convex/services/`
1671
+ 5. Agent reads `/backend/convex/services/CLAUDE.md` (most specific, highest precedence)
1928
1672
 
1929
- ## The Complete 6-Dimension Picture
1673
+ **Benefits:**
1930
1674
 
1931
- **Example: User purchases a course**
1675
+ - **Context efficiency:** Agents read only what they need
1676
+ - **Specificity:** More specific instructions override general ones
1677
+ - **Scalability:** Add context at any level without cluttering root
1678
+ - **Consistency:** Global patterns in root, exceptions in subdirectories
1932
1679
 
1933
- Here's how all 6 dimensions work together in a real scenario:
1680
+ See `/one/knowledge/context-engineering.md` for complete documentation structure.
1934
1681
 
1935
- ```
1936
- 1. Organization → "fitnesspro" (Id<'organizations'>)
1937
- └─ Multi-tenant boundary
1938
- └─ Settings: allow purchases, payment methods
1682
+ ---
1939
1683
 
1940
- 2. Person → "john@fitnesspro.com" (Id<'people'>)
1941
- └─ Separate people table (NOT a thing!)
1942
- └─ role: "customer"
1943
- └─ organizationId: fitnesspro_id
1684
+ ## Summary: The Universal Code Generation Language
1944
1685
 
1945
- 3. Thing → "Fitness Fundamentals Course" (Id<'things'>)
1946
- └─ type: "course"
1947
- └─ organizationId: fitnesspro_id
1948
- └─ properties: { price: 99, instructor: "Jane" }
1686
+ ### What Makes ONE Universal
1949
1687
 
1950
- 4. Connection → Purchase (Id<'connections'>)
1951
- └─ fromPersonId: john_person_id (NOT thingId!)
1952
- └─ toThingId: course_thing_id
1953
- └─ type: "purchased"
1954
- └─ metadata: { amount: 99, method: "stripe" }
1688
+ 1. **6-Dimension Ontology** - Models reality, not technology
1689
+ 2. **Effect.ts Services** - Composable structure agents can master
1690
+ 3. **Provider Pattern** - Universal adapter for ANY backend
1691
+ 4. **Cascading Context** - Hierarchical documentation with precedence
1692
+ 5. **Type Safety** - 100% typed end-to-end
1693
+ 6. **Compound Accuracy** - Each generation adds structure
1955
1694
 
1956
- 5. Event → "purchase_completed" (Id<'events'>)
1957
- └─ actorId: john_person_id (Person ID - who did it)
1958
- └─ targetId: connection_id (what happened)
1959
- └─ organizationId: fitnesspro_id
1960
- └─ metadata: { amount: 99, stripe_id: "ch_123" }
1695
+ ### The Result
1961
1696
 
1962
- 6. Knowledge → Purchase pattern (Id<'knowledge'>)
1963
- └─ sourcePersonId: john_person_id
1964
- └─ AI learns: John prefers fitness courses, buys on weekends
1965
- └─ Can recommend similar courses
1697
+ **Traditional Codebases:**
1698
+ ```
1699
+ 100 files → 90% accurate
1700
+ 1,000 files → 70% accurate
1701
+ 10,000 files → 30% accurate
1702
+ AI becomes a liability
1966
1703
  ```
1967
1704
 
1968
- **When the same person purchases from a different org:**
1969
-
1705
+ **ONE Codebase:**
1970
1706
  ```
1971
- 1. Organization → "yoga-academy" (different org!)
1972
- 2. Person → Same John, but organizationId: yoga_academy_id
1973
- 3. Thing → "Beginner Yoga" (yoga-academy course)
1974
- 4. Connection → New purchase connection (yoga_academy scoped)
1975
- 5. Event → Logged to yoga-academy (perfect isolation)
1976
- 6. Knowledge → Separate yoga-academy knowledge (no cross-org leakage)
1707
+ 100 files → 85% accurate (learning)
1708
+ 1,000 files → 92% accurate (mastering)
1709
+ 10,000 files → 98% accurate (generalized)
1710
+ AI becomes more valuable
1977
1711
  ```
1978
1712
 
1979
- **Key Benefits:**
1980
- - ✅ **Organizations** isolate data (fitnesspro can't see yoga-academy)
1981
- - ✅ **People** act across orgs (John can belong to multiple orgs)
1982
- - ✅ **Things** are org-scoped (courses belong to specific orgs)
1983
- - ✅ **Connections** link people → things (purchases, enrollments)
1984
- - ✅ **Events** track all actions with actorId (complete audit trail)
1985
- - ✅ **Knowledge** learns patterns (AI recommends based on behavior)
1986
-
1987
- **DataProvider Makes It Backend-Agnostic:**
1713
+ **Why?** The ontology is the language. Patterns converge. Structure compounds.
1988
1714
 
1989
- ```typescript
1990
- // Frontend code - works with ANY backend
1991
- const program = Effect.gen(function* () {
1992
- const provider = yield* DataProvider
1993
-
1994
- // Purchase flow
1995
- const person = yield* provider.people.get(userId)
1996
- const course = yield* provider.things.get(courseId)
1997
-
1998
- // Create purchase connection
1999
- const purchaseId = yield* provider.connections.create({
2000
- fromPersonId: person._id,
2001
- toThingId: course._id,
2002
- relationshipType: "purchased",
2003
- organizationId: person.organizationId,
2004
- metadata: { amount: 99, method: "stripe" }
2005
- })
2006
-
2007
- // Log event
2008
- yield* provider.events.log({
2009
- type: "purchase_completed",
2010
- actorId: person._id,
2011
- targetId: purchaseId,
2012
- organizationId: person.organizationId,
2013
- metadata: { amount: 99 }
2014
- })
2015
-
2016
- return { success: true, purchaseId }
2017
- })
1715
+ ---
2018
1716
 
2019
- // Same code works with:
2020
- // - ConvexProvider (real-time database)
2021
- // - WordPressProvider (WooCommerce backend)
2022
- // - SupabaseProvider (PostgreSQL database)
2023
- // - NotionProvider (Notion databases)
2024
- ```
1717
+ ## Next Steps for AI Agents
2025
1718
 
2026
- **This is why the architecture is beautiful:**
2027
- - Frontend doesn't know which backend it's talking to
2028
- - People are separate from things (clear authorization)
2029
- - Everything is org-scoped (perfect multi-tenancy)
2030
- - Events log who did what (complete audit trail)
2031
- - Knowledge learns from behavior (AI gets smarter)
2032
- - Effect.ts makes it all type-safe
1719
+ **When implementing ANY feature:**
1720
+
1721
+ 1. Read `/CLAUDE.md` (platform overview)
1722
+ 2. Read `/one/knowledge/ontology.md` (understand the 6 dimensions)
1723
+ 3. Map feature to ontology (groups, people, things, connections, events, knowledge)
1724
+ 4. Read specialist docs:
1725
+ - Frontend: `/one/knowledge/astro-effect-simple-architecture.md`
1726
+ - Backend: `/web/AGENTS.md` (Convex patterns)
1727
+ - Integration: `/one/connections/protocols.md`
1728
+ 5. Generate Effect.ts services (composable business logic)
1729
+ 6. Generate provider adapters (if needed)
1730
+ 7. Generate UI components (shadcn/ui)
1731
+ 8. Test with mocked layers
1732
+
1733
+ **Remember:**
1734
+ - The ontology never changes (it's reality)
1735
+ - Effect.ts is for agents (predictable patterns)
1736
+ - Provider pattern is the universal adapter
1737
+ - Every feature adds structure
1738
+ - Each generation compounds accuracy
2033
1739
 
2034
1740
  ---
2035
1741
 
2036
- ## Next Steps for AI Agents
2037
-
2038
- When implementing a new feature:
2039
-
2040
- 1. **Read the documentation:**
2041
- - **docs/Frontend.md** - If building UI components or pages
2042
- - **docs/Hono.md** - If building API routes or Effect.ts services
2043
- - **docs/Architecture.md** - To understand how everything fits together
2044
- - **docs/Ontology.md** - Map feature to 6 dimensions (organizations, people, things, connections, events, knowledge)
2045
-
2046
- 2. **Design the layers:**
2047
- - **Frontend:** Astro page + React component (uses Convex hooks + Hono API)
2048
- - **Glue:** Effect.ts service (pure business logic)
2049
- - **Backend:** Hono route (thin wrapper) + Convex wrapper (confect bridge)
2050
-
2051
- 3. **Implement with patterns:**
2052
- - 100% Effect.ts for business logic (NO async/await)
2053
- - Typed errors with `_tag` pattern
2054
- - Dependency injection via Effect layers
2055
- - Automatic retry, timeout, rollback
2056
-
2057
- 4. **Test thoroughly:**
2058
- - Unit tests for Effect.ts services (mock layers)
2059
- - Integration tests for Hono routes
2060
- - E2E tests for React components
2061
-
2062
- 5. **Document patterns:**
2063
- - Add to `docs/Patterns.md` for future AI
2064
- - Update `docs/Files.md` with new file locations
2065
-
2066
- **Key Reminders:**
2067
- - **Frontend Layer:** Astro + React, content collections, Convex hooks + Hono API client
2068
- - **Glue Layer:** Effect.ts services (100% coverage), typed errors, DI
2069
- - **Backend Layer:** Hono API routes, Convex database (6-dimension ontology), Better Auth
2070
- - **6 Dimensions:** Organizations partition, People authorize, Things exist, Connections relate, Events record, Knowledge understands
2071
- - Stripe = fiat only (NOT crypto)
2072
- - Cloudflare = livestreaming only (NOT web hosting)
2073
- - Plain Convex schema (NO Convex Ents)
2074
- - Multi-chain providers (separate services per blockchain)
2075
- - 25 connection types + 67 event types (optimized, generic)
2076
-
2077
- **The Result:** Each feature makes the next feature easier because AI has more patterns to learn from, and the architecture ensures consistency across all layers.
1742
+ **This is how software should be built.**