oneie 3.6.40 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (984) hide show
  1. package/README.md +28 -9
  2. package/dist/admin/build.d.ts +15 -0
  3. package/dist/admin/build.d.ts.map +1 -0
  4. package/dist/admin/build.js +295 -0
  5. package/dist/admin/build.js.map +1 -0
  6. package/dist/admin/index.d.ts +24 -0
  7. package/dist/admin/index.d.ts.map +1 -0
  8. package/dist/admin/index.js +98 -0
  9. package/dist/admin/index.js.map +1 -0
  10. package/dist/admin/list.d.ts +14 -0
  11. package/dist/admin/list.d.ts.map +1 -0
  12. package/dist/admin/list.js +90 -0
  13. package/dist/admin/list.js.map +1 -0
  14. package/dist/admin/manifest.d.ts +86 -0
  15. package/dist/admin/manifest.d.ts.map +1 -0
  16. package/dist/admin/manifest.js +183 -0
  17. package/dist/admin/manifest.js.map +1 -0
  18. package/dist/admin/monorepo.d.ts +25 -0
  19. package/dist/admin/monorepo.d.ts.map +1 -0
  20. package/dist/admin/monorepo.js +59 -0
  21. package/dist/admin/monorepo.js.map +1 -0
  22. package/dist/admin/release.d.ts +17 -0
  23. package/dist/admin/release.d.ts.map +1 -0
  24. package/dist/admin/release.js +144 -0
  25. package/dist/admin/release.js.map +1 -0
  26. package/dist/admin/sync.d.ts +14 -0
  27. package/dist/admin/sync.d.ts.map +1 -0
  28. package/dist/admin/sync.js +104 -0
  29. package/dist/admin/sync.js.map +1 -0
  30. package/dist/admin/validate.d.ts +15 -0
  31. package/dist/admin/validate.d.ts.map +1 -0
  32. package/dist/admin/validate.js +169 -0
  33. package/dist/admin/validate.js.map +1 -0
  34. package/dist/commands/agent.d.ts +2 -0
  35. package/dist/commands/agent.d.ts.map +1 -1
  36. package/dist/commands/agent.js +44 -0
  37. package/dist/commands/agent.js.map +1 -1
  38. package/dist/commands/ask.d.ts +4 -0
  39. package/dist/commands/ask.d.ts.map +1 -0
  40. package/dist/commands/ask.js +8 -0
  41. package/dist/commands/ask.js.map +1 -0
  42. package/dist/commands/bounty.d.ts +4 -0
  43. package/dist/commands/bounty.d.ts.map +1 -0
  44. package/dist/commands/bounty.js +24 -0
  45. package/dist/commands/bounty.js.map +1 -0
  46. package/dist/commands/capabilities.d.ts +4 -0
  47. package/dist/commands/capabilities.d.ts.map +1 -0
  48. package/dist/commands/capabilities.js +18 -0
  49. package/dist/commands/capabilities.js.map +1 -0
  50. package/dist/commands/claw.d.ts +4 -0
  51. package/dist/commands/claw.d.ts.map +1 -0
  52. package/dist/commands/claw.js +14 -0
  53. package/dist/commands/claw.js.map +1 -0
  54. package/dist/commands/commend.d.ts +4 -0
  55. package/dist/commands/commend.d.ts.map +1 -0
  56. package/dist/commands/commend.js +13 -0
  57. package/dist/commands/commend.js.map +1 -0
  58. package/dist/commands/completion.d.ts +4 -0
  59. package/dist/commands/completion.d.ts.map +1 -0
  60. package/dist/commands/completion.js +49 -0
  61. package/dist/commands/completion.js.map +1 -0
  62. package/dist/commands/config.d.ts +4 -0
  63. package/dist/commands/config.d.ts.map +1 -0
  64. package/dist/commands/config.js +78 -0
  65. package/dist/commands/config.js.map +1 -0
  66. package/dist/commands/deploy.d.ts +4 -0
  67. package/dist/commands/deploy.d.ts.map +1 -0
  68. package/dist/commands/deploy.js +10 -0
  69. package/dist/commands/deploy.js.map +1 -0
  70. package/dist/commands/doctor.d.ts +4 -0
  71. package/dist/commands/doctor.d.ts.map +1 -0
  72. package/dist/commands/doctor.js +72 -0
  73. package/dist/commands/doctor.js.map +1 -0
  74. package/dist/commands/export.d.ts +4 -0
  75. package/dist/commands/export.d.ts.map +1 -0
  76. package/dist/commands/export.js +15 -0
  77. package/dist/commands/export.js.map +1 -0
  78. package/dist/commands/fade.d.ts +4 -0
  79. package/dist/commands/fade.d.ts.map +1 -0
  80. package/dist/commands/fade.js +15 -0
  81. package/dist/commands/fade.js.map +1 -0
  82. package/dist/commands/flag.d.ts +4 -0
  83. package/dist/commands/flag.d.ts.map +1 -0
  84. package/dist/commands/flag.js +13 -0
  85. package/dist/commands/flag.js.map +1 -0
  86. package/dist/commands/forget.d.ts +4 -0
  87. package/dist/commands/forget.d.ts.map +1 -0
  88. package/dist/commands/forget.js +16 -0
  89. package/dist/commands/forget.js.map +1 -0
  90. package/dist/commands/frontier.d.ts +4 -0
  91. package/dist/commands/frontier.d.ts.map +1 -0
  92. package/dist/commands/frontier.js +11 -0
  93. package/dist/commands/frontier.js.map +1 -0
  94. package/dist/commands/health.d.ts +4 -0
  95. package/dist/commands/health.d.ts.map +1 -0
  96. package/dist/commands/health.js +11 -0
  97. package/dist/commands/health.js.map +1 -0
  98. package/dist/commands/highways.d.ts +4 -0
  99. package/dist/commands/highways.d.ts.map +1 -0
  100. package/dist/commands/highways.js +14 -0
  101. package/dist/commands/highways.js.map +1 -0
  102. package/dist/commands/hire.d.ts +4 -0
  103. package/dist/commands/hire.d.ts.map +1 -0
  104. package/dist/commands/hire.js +16 -0
  105. package/dist/commands/hire.js.map +1 -0
  106. package/dist/commands/init.d.ts.map +1 -1
  107. package/dist/commands/init.js +69 -42
  108. package/dist/commands/init.js.map +1 -1
  109. package/dist/commands/know.d.ts +4 -0
  110. package/dist/commands/know.d.ts.map +1 -0
  111. package/dist/commands/know.js +8 -0
  112. package/dist/commands/know.js.map +1 -0
  113. package/dist/commands/launch.d.ts +4 -0
  114. package/dist/commands/launch.d.ts.map +1 -0
  115. package/dist/commands/launch.js +16 -0
  116. package/dist/commands/launch.js.map +1 -0
  117. package/dist/commands/mark.d.ts +4 -0
  118. package/dist/commands/mark.d.ts.map +1 -0
  119. package/dist/commands/mark.js +15 -0
  120. package/dist/commands/mark.js.map +1 -0
  121. package/dist/commands/pay.d.ts +4 -0
  122. package/dist/commands/pay.d.ts.map +1 -0
  123. package/dist/commands/pay.js +21 -0
  124. package/dist/commands/pay.js.map +1 -0
  125. package/dist/commands/pipe.d.ts +4 -0
  126. package/dist/commands/pipe.d.ts.map +1 -0
  127. package/dist/commands/pipe.js +35 -0
  128. package/dist/commands/pipe.js.map +1 -0
  129. package/dist/commands/publish.d.ts +4 -0
  130. package/dist/commands/publish.d.ts.map +1 -0
  131. package/dist/commands/publish.js +23 -0
  132. package/dist/commands/publish.js.map +1 -0
  133. package/dist/commands/recall.d.ts +4 -0
  134. package/dist/commands/recall.d.ts.map +1 -0
  135. package/dist/commands/recall.js +12 -0
  136. package/dist/commands/recall.js.map +1 -0
  137. package/dist/commands/repl.d.ts +4 -0
  138. package/dist/commands/repl.d.ts.map +1 -0
  139. package/dist/commands/repl.js +56 -0
  140. package/dist/commands/repl.js.map +1 -0
  141. package/dist/commands/reveal.d.ts +4 -0
  142. package/dist/commands/reveal.d.ts.map +1 -0
  143. package/dist/commands/reveal.js +11 -0
  144. package/dist/commands/reveal.js.map +1 -0
  145. package/dist/commands/revenue.d.ts +4 -0
  146. package/dist/commands/revenue.d.ts.map +1 -0
  147. package/dist/commands/revenue.js +11 -0
  148. package/dist/commands/revenue.js.map +1 -0
  149. package/dist/commands/select.d.ts +4 -0
  150. package/dist/commands/select.d.ts.map +1 -0
  151. package/dist/commands/select.js +19 -0
  152. package/dist/commands/select.js.map +1 -0
  153. package/dist/commands/signal.d.ts +4 -0
  154. package/dist/commands/signal.d.ts.map +1 -0
  155. package/dist/commands/signal.js +8 -0
  156. package/dist/commands/signal.js.map +1 -0
  157. package/dist/commands/stats.d.ts +4 -0
  158. package/dist/commands/stats.d.ts.map +1 -0
  159. package/dist/commands/stats.js +11 -0
  160. package/dist/commands/stats.js.map +1 -0
  161. package/dist/commands/status.d.ts +4 -0
  162. package/dist/commands/status.d.ts.map +1 -0
  163. package/dist/commands/status.js +18 -0
  164. package/dist/commands/status.js.map +1 -0
  165. package/dist/commands/sync.d.ts +4 -0
  166. package/dist/commands/sync.d.ts.map +1 -0
  167. package/dist/commands/sync.js +20 -0
  168. package/dist/commands/sync.js.map +1 -0
  169. package/dist/commands/tail.d.ts +4 -0
  170. package/dist/commands/tail.d.ts.map +1 -0
  171. package/dist/commands/tail.js +51 -0
  172. package/dist/commands/tail.js.map +1 -0
  173. package/dist/commands/warn.d.ts +4 -0
  174. package/dist/commands/warn.d.ts.map +1 -0
  175. package/dist/commands/warn.js +15 -0
  176. package/dist/commands/warn.js.map +1 -0
  177. package/dist/create-org-profile.js +2 -2
  178. package/dist/create-user-profile.js +2 -2
  179. package/dist/index.js +135 -7
  180. package/dist/index.js.map +1 -1
  181. package/dist/lib/args.d.ts +11 -0
  182. package/dist/lib/args.d.ts.map +1 -0
  183. package/dist/lib/args.js +57 -0
  184. package/dist/lib/args.js.map +1 -0
  185. package/dist/lib/config.d.ts +12 -0
  186. package/dist/lib/config.d.ts.map +1 -0
  187. package/dist/lib/config.js +38 -0
  188. package/dist/lib/config.js.map +1 -0
  189. package/dist/lib/http.d.ts +9 -0
  190. package/dist/lib/http.d.ts.map +1 -0
  191. package/dist/lib/http.js +25 -0
  192. package/dist/lib/http.js.map +1 -0
  193. package/dist/lib/output.d.ts +5 -0
  194. package/dist/lib/output.d.ts.map +1 -0
  195. package/dist/lib/output.js +32 -0
  196. package/dist/lib/output.js.map +1 -0
  197. package/dist/lib/sdk.d.ts +10 -0
  198. package/dist/lib/sdk.d.ts.map +1 -0
  199. package/dist/lib/sdk.js +22 -0
  200. package/dist/lib/sdk.js.map +1 -0
  201. package/dist/lib/telemetry.d.ts +4 -0
  202. package/dist/lib/telemetry.d.ts.map +1 -0
  203. package/dist/lib/telemetry.js +61 -0
  204. package/dist/lib/telemetry.js.map +1 -0
  205. package/dist/utils/file-resolver.js +1 -3
  206. package/dist/utils/file-resolver.js.map +1 -1
  207. package/dist/utils/installation-setup.d.ts +15 -0
  208. package/dist/utils/installation-setup.d.ts.map +1 -1
  209. package/dist/utils/installation-setup.js +71 -8
  210. package/dist/utils/installation-setup.js.map +1 -1
  211. package/package.json +5 -21
  212. package/.claude/agents/TROUBLESHOOTING.md +0 -530
  213. package/.claude/agents/agent-backend.md +0 -574
  214. package/.claude/agents/agent-builder.md +0 -911
  215. package/.claude/agents/agent-claude.md +0 -645
  216. package/.claude/agents/agent-clean.md +0 -477
  217. package/.claude/agents/agent-clone.md +0 -554
  218. package/.claude/agents/agent-designer.md +0 -1080
  219. package/.claude/agents/agent-director.md +0 -2254
  220. package/.claude/agents/agent-documenter.md +0 -688
  221. package/.claude/agents/agent-frontend.md +0 -1199
  222. package/.claude/agents/agent-integrator.md +0 -670
  223. package/.claude/agents/agent-lawyer.md +0 -1320
  224. package/.claude/agents/agent-news.md +0 -363
  225. package/.claude/agents/agent-onboard.md +0 -613
  226. package/.claude/agents/agent-ontology.md +0 -585
  227. package/.claude/agents/agent-ops.md +0 -1275
  228. package/.claude/agents/agent-problem-solver.md +0 -669
  229. package/.claude/agents/agent-quality.md +0 -1042
  230. package/.claude/agents/agent-sales.md +0 -507
  231. package/.claude/agents/agent-writer.md +0 -1068
  232. package/.claude/commands/cascade.md +0 -742
  233. package/.claude/commands/chat.md +0 -728
  234. package/.claude/commands/commit.md +0 -95
  235. package/.claude/commands/create.md +0 -544
  236. package/.claude/commands/deploy.md +0 -309
  237. package/.claude/commands/fast.md +0 -636
  238. package/.claude/commands/mcp-on.md +0 -191
  239. package/.claude/commands/media-upload.md +0 -186
  240. package/.claude/commands/news.md +0 -274
  241. package/.claude/commands/onboard.md +0 -440
  242. package/.claude/commands/one.md +0 -398
  243. package/.claude/commands/optimize.md +0 -74
  244. package/.claude/commands/plan.md +0 -719
  245. package/.claude/commands/push.md +0 -214
  246. package/.claude/commands/release.md +0 -105
  247. package/.claude/commands/review.md +0 -99
  248. package/.claude/commands/server.md +0 -487
  249. package/.claude/commands/start.md +0 -227
  250. package/.claude/commands/test.md +0 -197
  251. package/.claude/commands/validate.md +0 -140
  252. package/.claude/hooks/.last-news-context +0 -1
  253. package/.claude/hooks/PULL-BEFORE-PUSH-GUIDE.md +0 -473
  254. package/.claude/hooks/README-knowledge-hooks.md +0 -451
  255. package/.claude/hooks/README-news-generation.md +0 -364
  256. package/.claude/hooks/README-root-cleanup.md +0 -200
  257. package/.claude/hooks/README.md +0 -284
  258. package/.claude/hooks/__pycache__/todo.cpython-312.pyc +0 -0
  259. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  260. package/.claude/hooks/auto-format.sh +0 -106
  261. package/.claude/hooks/check-filenames.py +0 -177
  262. package/.claude/hooks/clean-post.py +0 -468
  263. package/.claude/hooks/clean-pre.py +0 -393
  264. package/.claude/hooks/clean-root-markdown.sh +0 -73
  265. package/.claude/hooks/commit-push.sh +0 -95
  266. package/.claude/hooks/done.py +0 -236
  267. package/.claude/hooks/format-hook.sh +0 -163
  268. package/.claude/hooks/formatting.py +0 -187
  269. package/.claude/hooks/hook-logger.sh +0 -173
  270. package/.claude/hooks/knowledge-post.py +0 -355
  271. package/.claude/hooks/knowledge-pre.py +0 -245
  272. package/.claude/hooks/mcp-on.sh +0 -134
  273. package/.claude/hooks/notification-hook.sh +0 -279
  274. package/.claude/hooks/ontology-validation.py +0 -255
  275. package/.claude/hooks/push.sh +0 -153
  276. package/.claude/hooks/release-cli.sh +0 -205
  277. package/.claude/hooks/root-cleanup.py +0 -217
  278. package/.claude/hooks/security-hook.sh +0 -397
  279. package/.claude/hooks/tag-all-docs.py +0 -464
  280. package/.claude/hooks/test-validate-ontology.sh +0 -170
  281. package/.claude/hooks/todo.py +0 -368
  282. package/.claude/hooks/track-changes.sh +0 -101
  283. package/.claude/hooks/validate-imports.py +0 -182
  284. package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
  285. package/.claude/hooks/validate-ontology-structure.py +0 -558
  286. package/.claude/hooks/validate-ontology-structure.py.backup +0 -518
  287. package/.claude/hooks/validate-ontology.py +0 -140
  288. package/.claude/hooks/write-news.sh +0 -194
  289. package/.claude/skills/INDEX.md +0 -523
  290. package/.claude/skills/REGISTRY.md +0 -529
  291. package/.claude/skills/agent-backend-create-mutation.md +0 -319
  292. package/.claude/skills/agent-designer-create-wireframe.md +0 -341
  293. package/.claude/skills/agent-frontend-create-page.md +0 -413
  294. package/.claude/skills/agents/README.md +0 -238
  295. package/.claude/skills/astro/add-content-collection.md +0 -30
  296. package/.claude/skills/astro/check-build.md +0 -29
  297. package/.claude/skills/astro/create-component.md +0 -29
  298. package/.claude/skills/astro/create-page.md +0 -30
  299. package/.claude/skills/astro/optimize-performance.md +0 -21
  300. package/.claude/skills/convex/check-deployment.md +0 -46
  301. package/.claude/skills/convex/create-mutation.md +0 -405
  302. package/.claude/skills/convex/create-query.md +0 -52
  303. package/.claude/skills/convex/read-schema.md +0 -373
  304. package/.claude/skills/convex/test-function.md +0 -50
  305. package/.claude/skills/deployment/check-deployment-health.md +0 -20
  306. package/.claude/skills/deployment/create-release.md +0 -21
  307. package/.claude/skills/deployment/deploy-cloudflare.md +0 -31
  308. package/.claude/skills/deployment/deploy-convex.md +0 -30
  309. package/.claude/skills/deployment/sync-repositories.md +0 -19
  310. package/.claude/skills/design/check-accessibility.md +0 -21
  311. package/.claude/skills/design/create-component-spec.md +0 -27
  312. package/.claude/skills/design/generate-design-tokens.md +0 -24
  313. package/.claude/skills/design/generate-wireframe.md +0 -30
  314. package/.claude/skills/documentation/create-migration-guide.md +0 -20
  315. package/.claude/skills/documentation/generate-api-docs.md +0 -27
  316. package/.claude/skills/documentation/generate-readme.md +0 -22
  317. package/.claude/skills/documentation/update-knowledge.md +0 -20
  318. package/.claude/skills/integration/connect-external-system.md +0 -21
  319. package/.claude/skills/integration/implement-a2a.md +0 -20
  320. package/.claude/skills/integration/implement-acp.md +0 -20
  321. package/.claude/skills/integration/verify-integration.md +0 -20
  322. package/.claude/skills/ontology/README.md +0 -255
  323. package/.claude/skills/ontology/check-dimension.md +0 -307
  324. package/.claude/skills/ontology/generate-entity-type.md +0 -339
  325. package/.claude/skills/ontology/validate-schema.md +0 -229
  326. package/.claude/skills/ontology/verify-relationships.md +0 -310
  327. package/.claude/skills/problem-solving/analyze-test-failure.md +0 -21
  328. package/.claude/skills/problem-solving/identify-root-cause.md +0 -20
  329. package/.claude/skills/problem-solving/propose-solution.md +0 -29
  330. package/.claude/skills/problem-solving/verify-fix.md +0 -21
  331. package/.claude/skills/sales/generate-demo-script.md +0 -21
  332. package/.claude/skills/sales/qualify-lead.md +0 -30
  333. package/.claude/skills/sales/track-trial.md +0 -20
  334. package/.claude/skills/sales/verify-kyc.md +0 -20
  335. package/.claude/skills/testing/analyze-coverage.md +0 -24
  336. package/.claude/skills/testing/generate-tests.md +0 -24
  337. package/.claude/skills/testing/run-tests.md +0 -27
  338. package/.claude/skills/testing/validate-e2e.md +0 -25
  339. package/AGENTS.md +0 -60
  340. package/CLAUDE.md +0 -321
  341. package/CREATE-WEBSITE.md +0 -458
  342. package/SECURITY.md +0 -31
  343. package/dist/commands/create-website.d.ts +0 -19
  344. package/dist/commands/create-website.d.ts.map +0 -1
  345. package/dist/commands/create-website.js +0 -231
  346. package/dist/commands/create-website.js.map +0 -1
  347. package/folders.yaml +0 -92
  348. package/one/README.md +0 -760
  349. package/one/connections/a2a.md +0 -600
  350. package/one/connections/acp.md +0 -808
  351. package/one/connections/acps.md +0 -749
  352. package/one/connections/agentkit.md +0 -367
  353. package/one/connections/agui.md +0 -785
  354. package/one/connections/any-backend.md +0 -1720
  355. package/one/connections/ap2.md +0 -1072
  356. package/one/connections/api/queries-reference.md +0 -860
  357. package/one/connections/api-docs.md +0 -1909
  358. package/one/connections/api-reference.md +0 -1029
  359. package/one/connections/api.md +0 -2208
  360. package/one/connections/architecture-diagram.md +0 -112
  361. package/one/connections/communications.md +0 -467
  362. package/one/connections/connections.md +0 -357
  363. package/one/connections/copilotkit.md +0 -1577
  364. package/one/connections/cryptonetworks.md +0 -799
  365. package/one/connections/documentation.md +0 -1138
  366. package/one/connections/effect.md +0 -297
  367. package/one/connections/elizaos.md +0 -1308
  368. package/one/connections/groups.md +0 -814
  369. package/one/connections/inference.md +0 -76
  370. package/one/connections/integration-examples.md +0 -893
  371. package/one/connections/integration-guide.md +0 -887
  372. package/one/connections/integration-phase2.md +0 -754
  373. package/one/connections/kyc.md +0 -650
  374. package/one/connections/mcp.md +0 -860
  375. package/one/connections/membership.md +0 -1170
  376. package/one/connections/middleware.md +0 -1085
  377. package/one/connections/multitenant.md +0 -1359
  378. package/one/connections/n8n.md +0 -1033
  379. package/one/connections/patterns.md +0 -107
  380. package/one/connections/protocols.md +0 -297
  381. package/one/connections/relationships.md +0 -125
  382. package/one/connections/schema.md +0 -605
  383. package/one/connections/service-layer.md +0 -568
  384. package/one/connections/vectors.md +0 -225
  385. package/one/connections/wordpress.md +0 -1320
  386. package/one/connections/workflow-copy.md +0 -923
  387. package/one/connections/workflow-examples.md +0 -759
  388. package/one/connections/workflow-onboarding.md +0 -701
  389. package/one/connections/workflow.md +0 -923
  390. package/one/connections/workflows/delegation.md +0 -903
  391. package/one/connections/workflows/frontend.md +0 -1055
  392. package/one/connections/workflows/strategy.md +0 -921
  393. package/one/connections/workflows/tasks.md +0 -716
  394. package/one/connections/x402-baazar.md +0 -131
  395. package/one/connections/x402.md +0 -1353
  396. package/one/groups/features.md +0 -2904
  397. package/one/groups/groups.md +0 -587
  398. package/one/groups/one.md +0 -619
  399. package/one/groups/strategy-copy.md +0 -887
  400. package/one/knowledge/.obsidian/app.json +0 -1
  401. package/one/knowledge/.obsidian/appearance.json +0 -1
  402. package/one/knowledge/.obsidian/core-plugins.json +0 -33
  403. package/one/knowledge/.obsidian/ecommerce-ontology.md +0 -210
  404. package/one/knowledge/.obsidian/workspace.json +0 -211
  405. package/one/knowledge/100-inference-quick-reference.md +0 -449
  406. package/one/knowledge/ag-ui-protocol.md +0 -613
  407. package/one/knowledge/agent-onboard-usage.md +0 -630
  408. package/one/knowledge/agentic-commerce.md +0 -146
  409. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +0 -683
  410. package/one/knowledge/ai-api-reference.md +0 -715
  411. package/one/knowledge/ai-platform.md +0 -323
  412. package/one/knowledge/ai-quickstart.md +0 -355
  413. package/one/knowledge/ai-sdk-implementation.md +0 -436
  414. package/one/knowledge/ai-token-crypto-analysis-framework.md +0 -1191
  415. package/one/knowledge/ai-token-paradigm-shift-2025.md +0 -732
  416. package/one/knowledge/altcoin-cycle-prediction-ontology.md +0 -884
  417. package/one/knowledge/altcoin-cycle-trading-strategy.md +0 -642
  418. package/one/knowledge/architecture-any-backend.md +0 -1589
  419. package/one/knowledge/architecture-diagram.md +0 -404
  420. package/one/knowledge/architecture-frontend.md +0 -1014
  421. package/one/knowledge/architecture.md +0 -1742
  422. package/one/knowledge/archived/ontology.old.md +0 -2840
  423. package/one/knowledge/astro-effect-complete-vision.md +0 -2148
  424. package/one/knowledge/astro-effect-simple-architecture.md +0 -750
  425. package/one/knowledge/audit-agent-onboard-alignment.md +0 -481
  426. package/one/knowledge/audit-agent-sales-alignment.md +0 -444
  427. package/one/knowledge/backend-api-reference.md +0 -728
  428. package/one/knowledge/cascading-context-specification.md +0 -1617
  429. package/one/knowledge/claude-code-integration.md +0 -1293
  430. package/one/knowledge/cli-claude-handoff.md +0 -736
  431. package/one/knowledge/context-engineering.md +0 -610
  432. package/one/knowledge/crypto-analysis-strategy.md +0 -1276
  433. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +0 -44
  434. package/one/knowledge/crypto.md +0 -978
  435. package/one/knowledge/develop/design.md +0 -364
  436. package/one/knowledge/develop/index.md +0 -145
  437. package/one/knowledge/development-commands.md +0 -251
  438. package/one/knowledge/docs.md +0 -627
  439. package/one/knowledge/dsl.md +0 -1678
  440. package/one/knowledge/event-driven-documentation.md +0 -270
  441. package/one/knowledge/files.md +0 -2489
  442. package/one/knowledge/frontend.md +0 -1056
  443. package/one/knowledge/games-english.md +0 -691
  444. package/one/knowledge/games.md +0 -1082
  445. package/one/knowledge/generative-ui-patterns.md +0 -559
  446. package/one/knowledge/guidelines.md +0 -314
  447. package/one/knowledge/hono.md +0 -2127
  448. package/one/knowledge/implementation-examples.md +0 -2554
  449. package/one/knowledge/installation-folders.md +0 -366
  450. package/one/knowledge/institutional-cycle-paradigm-2025.md +0 -555
  451. package/one/knowledge/knowledge.md +0 -660
  452. package/one/knowledge/language.md +0 -998
  453. package/one/knowledge/lessons-learned.md +0 -378
  454. package/one/knowledge/lessons-website-building-focus.md +0 -382
  455. package/one/knowledge/merge-report.md +0 -254
  456. package/one/knowledge/metadata-system.md +0 -504
  457. package/one/knowledge/nine-padel-playbook.md +0 -229
  458. package/one/knowledge/one-protocol-ai-agents.md +0 -892
  459. package/one/knowledge/one-protocol-executive-report.md +0 -617
  460. package/one/knowledge/one-protocol-standard.md +0 -869
  461. package/one/knowledge/one-protocol-whitepaper.md +0 -756
  462. package/one/knowledge/ontology-blog.yaml +0 -47
  463. package/one/knowledge/ontology-cheatsheet.md +0 -617
  464. package/one/knowledge/ontology-community.yaml +0 -65
  465. package/one/knowledge/ontology-core-universal.md +0 -740
  466. package/one/knowledge/ontology-core.yaml +0 -63
  467. package/one/knowledge/ontology-courses.yaml +0 -76
  468. package/one/knowledge/ontology-creator.md +0 -402
  469. package/one/knowledge/ontology-crypto.md +0 -1603
  470. package/one/knowledge/ontology-developer-guide.md +0 -814
  471. package/one/knowledge/ontology-documentation.md +0 -377
  472. package/one/knowledge/ontology-ecommerce.md +0 -269
  473. package/one/knowledge/ontology-education-game.md +0 -1654
  474. package/one/knowledge/ontology-education.md +0 -938
  475. package/one/knowledge/ontology-engineering-specification.md +0 -1310
  476. package/one/knowledge/ontology-engineering.md +0 -1676
  477. package/one/knowledge/ontology-files.yaml +0 -525
  478. package/one/knowledge/ontology-frontend-master.md +0 -2898
  479. package/one/knowledge/ontology-frontend-specifications.md +0 -2196
  480. package/one/knowledge/ontology-frontend.md +0 -2475
  481. package/one/knowledge/ontology-index.md +0 -397
  482. package/one/knowledge/ontology-minimal.yaml +0 -301
  483. package/one/knowledge/ontology-portfolio.yaml +0 -45
  484. package/one/knowledge/ontology-quickstart.md +0 -602
  485. package/one/knowledge/ontology-release.md +0 -317
  486. package/one/knowledge/ontology-shop.yaml +0 -148
  487. package/one/knowledge/ontology-tokens.yaml +0 -51
  488. package/one/knowledge/ontology-tutorial.md +0 -455
  489. package/one/knowledge/ontology-v2.md +0 -4449
  490. package/one/knowledge/ontology-video-script.md +0 -939
  491. package/one/knowledge/ontology-visual-guide.md +0 -378
  492. package/one/knowledge/ontology.md +0 -3847
  493. package/one/knowledge/ontology.yaml +0 -1653
  494. package/one/knowledge/parallel-agents.md +0 -932
  495. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +0 -130
  496. package/one/knowledge/patterns/backend/convex-query-pattern.md +0 -143
  497. package/one/knowledge/patterns/backend/mutation-template.md +0 -249
  498. package/one/knowledge/patterns/backend/query-template.md +0 -286
  499. package/one/knowledge/patterns/backend/service-template.md +0 -258
  500. package/one/knowledge/patterns/design/component-architecture.md +0 -435
  501. package/one/knowledge/patterns/design/index.md +0 -160
  502. package/one/knowledge/patterns/design/test-driven-design-pattern.md +0 -196
  503. package/one/knowledge/patterns/design/wireframe-template.md +0 -250
  504. package/one/knowledge/patterns/frontend/component-template.md +0 -246
  505. package/one/knowledge/patterns/frontend/form-template.md +0 -348
  506. package/one/knowledge/patterns/frontend/page-template.md +0 -209
  507. package/one/knowledge/patterns/frontend/react-component-pattern.md +0 -188
  508. package/one/knowledge/patterns/test/acceptance-criteria-template.md +0 -396
  509. package/one/knowledge/patterns/test/technical-test-template.md +0 -566
  510. package/one/knowledge/patterns/test/test-driven-pattern.md +0 -160
  511. package/one/knowledge/patterns/test/user-flow-template.md +0 -272
  512. package/one/knowledge/performance.md +0 -459
  513. package/one/knowledge/provider-agnostic-content.md +0 -995
  514. package/one/knowledge/provider-creation-guide.md +0 -1082
  515. package/one/knowledge/quality-loop.md +0 -419
  516. package/one/knowledge/quick-start-ontology-mapping.md +0 -773
  517. package/one/knowledge/readme-architecture.md +0 -158
  518. package/one/knowledge/readme.md +0 -149
  519. package/one/knowledge/rules.md +0 -644
  520. package/one/knowledge/score.md +0 -85
  521. package/one/knowledge/specifications.md +0 -873
  522. package/one/knowledge/tags.md +0 -148
  523. package/one/knowledge/todo-template.md +0 -269
  524. package/one/knowledge/todo.md +0 -269
  525. package/one/knowledge/troubleshooting.md +0 -434
  526. package/one/knowledge/typescript-patterns.md +0 -321
  527. package/one/knowledge/universal-generation-language.md +0 -827
  528. package/one/knowledge/x402-research.md +0 -104
  529. package/one/license.md +0 -107
  530. package/one/people/anthony-o-connell.md +0 -469
  531. package/one/people/people.md +0 -590
  532. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +0 -401
  533. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +0 -588
  534. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +0 -461
  535. package/one/things/CHECKLIST.md +0 -407
  536. package/one/things/IMPLEMENTATION_STATUS.md +0 -379
  537. package/one/things/ONE.md +0 -529
  538. package/one/things/agents/agent-backend.md +0 -1501
  539. package/one/things/agents/agent-builder.md +0 -1064
  540. package/one/things/agents/agent-clean.md +0 -1112
  541. package/one/things/agents/agent-clone.md +0 -1324
  542. package/one/things/agents/agent-deploy.md +0 -986
  543. package/one/things/agents/agent-designer.md +0 -2305
  544. package/one/things/agents/agent-director.md +0 -1526
  545. package/one/things/agents/agent-documenter.md +0 -1129
  546. package/one/things/agents/agent-frontend.md +0 -1201
  547. package/one/things/agents/agent-integrator.md +0 -1269
  548. package/one/things/agents/agent-lawyer.md +0 -1371
  549. package/one/things/agents/agent-problem-solver.md +0 -1457
  550. package/one/things/agents/agent-quality.md +0 -1483
  551. package/one/things/agents/agent-sales.md +0 -1074
  552. package/one/things/cascade/cascade.yaml +0 -481
  553. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +0 -523
  554. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +0 -314
  555. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +0 -562
  556. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +0 -543
  557. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +0 -272
  558. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +0 -548
  559. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +0 -586
  560. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +0 -267
  561. package/one/things/cascade/docs/examples/1-3-event-coordination.md +0 -547
  562. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +0 -665
  563. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +0 -236
  564. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +0 -652
  565. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +0 -860
  566. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +0 -255
  567. package/one/things/cascade/docs/examples/1-5-quality-loops.md +0 -725
  568. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +0 -659
  569. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +0 -256
  570. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +0 -639
  571. package/one/things/cascade/docs/examples/readme.md +0 -259
  572. package/one/things/cascade/docs/getting-started.md +0 -533
  573. package/one/things/cascade/docs/workflow.md +0 -1378
  574. package/one/things/cascade/readme.md +0 -379
  575. package/one/things/cascade/templates/feature-template.md +0 -289
  576. package/one/things/claude/agents/advocacy-activation-manager.md +0 -710
  577. package/one/things/claude/agents/advocacy-campaign-designer.md +0 -688
  578. package/one/things/claude/agents/analyst.md +0 -508
  579. package/one/things/claude/agents/architect.md +0 -505
  580. package/one/things/claude/agents/brand-identity-specialist.md +0 -538
  581. package/one/things/claude/agents/bstp-token-strategist.md +0 -690
  582. package/one/things/claude/agents/builder-repo.md +0 -532
  583. package/one/things/claude/agents/bullstamp-community-builder.md +0 -597
  584. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +0 -529
  585. package/one/things/claude/agents/bulltilt-platform-growth.md +0 -590
  586. package/one/things/claude/agents/company-bullstamp-character.md +0 -602
  587. package/one/things/claude/agents/company-bullstamp-community.md +0 -307
  588. package/one/things/claude/agents/company-bullstamp-marketing.md +0 -307
  589. package/one/things/claude/agents/company-bullstamp-token.md +0 -307
  590. package/one/things/claude/agents/company-bulltilt-growth.md +0 -307
  591. package/one/things/claude/agents/content-bibliography-formatter.md +0 -404
  592. package/one/things/claude/agents/content-calendar-planner.md +0 -473
  593. package/one/things/claude/agents/content-chapter-formatter.md +0 -513
  594. package/one/things/claude/agents/content-formatter.md +0 -571
  595. package/one/things/claude/agents/content-hook-specialist.md +0 -485
  596. package/one/things/claude/agents/content-image-formatter.md +0 -560
  597. package/one/things/claude/agents/content-introduction-formatter.md +0 -510
  598. package/one/things/claude/agents/content-multiplication-engine.md +0 -579
  599. package/one/things/claude/agents/content-playbook-writer.md +0 -473
  600. package/one/things/claude/agents/content-team-manager.md +0 -647
  601. package/one/things/claude/agents/content-toc-formatter.md +0 -547
  602. package/one/things/claude/agents/convex-backend-specialist.md +0 -2725
  603. package/one/things/claude/agents/core-manager.md +0 -607
  604. package/one/things/claude/agents/core-master.md +0 -426
  605. package/one/things/claude/agents/cross-functional-manager.md +0 -476
  606. package/one/things/claude/agents/crypto-airdrop-strategist.md +0 -622
  607. package/one/things/claude/agents/crypto-analytics-educator.md +0 -596
  608. package/one/things/claude/agents/crypto-architecture-specialist.md +0 -497
  609. package/one/things/claude/agents/crypto-community-analyst.md +0 -314
  610. package/one/things/claude/agents/crypto-community-psychologist.md +0 -546
  611. package/one/things/claude/agents/crypto-dex-optimization-expert.md +0 -579
  612. package/one/things/claude/agents/crypto-dex-optimizer.md +0 -307
  613. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +0 -552
  614. package/one/things/claude/agents/crypto-diamond-hands.md +0 -307
  615. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +0 -597
  616. package/one/things/claude/agents/crypto-engagement-specialist.md +0 -581
  617. package/one/things/claude/agents/crypto-market-researcher.md +0 -307
  618. package/one/things/claude/agents/crypto-marketing-orchestrator.md +0 -563
  619. package/one/things/claude/agents/crypto-network-effect-amplifier.md +0 -614
  620. package/one/things/claude/agents/crypto-optimization-analyst.md +0 -597
  621. package/one/things/claude/agents/crypto-strategic-synthesizer.md +0 -556
  622. package/one/things/claude/agents/crypto-team-manager.md +0 -392
  623. package/one/things/claude/agents/crypto-token-analyst.md +0 -319
  624. package/one/things/claude/agents/crypto-viral-content-creator.md +0 -549
  625. package/one/things/claude/agents/crypto-wallet-identification-expert.md +0 -527
  626. package/one/things/claude/agents/crypto-wallet-identifier.md +0 -307
  627. package/one/things/claude/agents/customer-journey-designer.md +0 -474
  628. package/one/things/claude/agents/customer-success-manager.md +0 -574
  629. package/one/things/claude/agents/dev.md +0 -406
  630. package/one/things/claude/agents/documenter.md +0 -548
  631. package/one/things/claude/agents/elevate-marketing-orchestrator.md +0 -403
  632. package/one/things/claude/agents/engagement-specialist.md +0 -502
  633. package/one/things/claude/agents/engineering-architect.md +0 -387
  634. package/one/things/claude/agents/engineering-business-analyst.md +0 -527
  635. package/one/things/claude/agents/engineering-developer.md +0 -386
  636. package/one/things/claude/agents/engineering-director.md +0 -322
  637. package/one/things/claude/agents/engineering-ingestor.md +0 -659
  638. package/one/things/claude/agents/engineering-product-manager.md +0 -525
  639. package/one/things/claude/agents/engineering-product-owner.md +0 -527
  640. package/one/things/claude/agents/engineering-project-coordinator.md +0 -525
  641. package/one/things/claude/agents/engineering-quality-assurance.md +0 -392
  642. package/one/things/claude/agents/engineering-team-manager.md +0 -515
  643. package/one/things/claude/agents/engineering-user-experience.md +0 -386
  644. package/one/things/claude/agents/framework-elevate-manager.md +0 -309
  645. package/one/things/claude/agents/improver.md +0 -805
  646. package/one/things/claude/agents/intelligence-team-manager.md +0 -390
  647. package/one/things/claude/agents/lead-capture-expert.md +0 -459
  648. package/one/things/claude/agents/lead-magnet-creator.md +0 -446
  649. package/one/things/claude/agents/market-research-analyst.md +0 -435
  650. package/one/things/claude/agents/marketing-brand-identity.md +0 -344
  651. package/one/things/claude/agents/marketing-content-hooks.md +0 -455
  652. package/one/things/claude/agents/marketing-content-multiplier.md +0 -331
  653. package/one/things/claude/agents/marketing-content-poster.md +0 -372
  654. package/one/things/claude/agents/marketing-customer-journey.md +0 -331
  655. package/one/things/claude/agents/marketing-director.md +0 -402
  656. package/one/things/claude/agents/marketing-engagement.md +0 -331
  657. package/one/things/claude/agents/marketing-lead-capture.md +0 -331
  658. package/one/things/claude/agents/marketing-lead-magnet.md +0 -331
  659. package/one/things/claude/agents/marketing-network-effects.md +0 -331
  660. package/one/things/claude/agents/marketing-nurture-campaigns.md +0 -331
  661. package/one/things/claude/agents/marketing-share-optimizer.md +0 -331
  662. package/one/things/claude/agents/marketing-team-manager.md +0 -451
  663. package/one/things/claude/agents/marketing-viral-growth.md +0 -232
  664. package/one/things/claude/agents/mission-commander.md +0 -378
  665. package/one/things/claude/agents/network-effect-analyst.md +0 -604
  666. package/one/things/claude/agents/nextjs-15-specialist.md +0 -1634
  667. package/one/things/claude/agents/npx.md +0 -946
  668. package/one/things/claude/agents/nurture-campaign-manager.md +0 -554
  669. package/one/things/claude/agents/one-master.md +0 -378
  670. package/one/things/claude/agents/one-orchestrator.md +0 -345
  671. package/one/things/claude/agents/one.md +0 -658
  672. package/one/things/claude/agents/playbook-generator.md +0 -526
  673. package/one/things/claude/agents/pm.md +0 -349
  674. package/one/things/claude/agents/po.md +0 -370
  675. package/one/things/claude/agents/qa.md +0 -361
  676. package/one/things/claude/agents/research-foundation-analyst.md +0 -324
  677. package/one/things/claude/agents/research-intelligence-gatherer.md +0 -435
  678. package/one/things/claude/agents/research-market-analyst.md +0 -324
  679. package/one/things/claude/agents/research-team-manager.md +0 -489
  680. package/one/things/claude/agents/sales-environment-optimizer.md +0 -519
  681. package/one/things/claude/agents/sales-team-manager.md +0 -407
  682. package/one/things/claude/agents/sales-upsell-strategist.md +0 -324
  683. package/one/things/claude/agents/service-advocacy-campaigns.md +0 -324
  684. package/one/things/claude/agents/service-advocacy-manager.md +0 -324
  685. package/one/things/claude/agents/service-success-manager.md +0 -324
  686. package/one/things/claude/agents/service-team-manager.md +0 -405
  687. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +0 -2357
  688. package/one/things/claude/agents/share-optimization-specialist.md +0 -576
  689. package/one/things/claude/agents/sm.md +0 -352
  690. package/one/things/claude/agents/story-teller.md +0 -498
  691. package/one/things/claude/agents/task-master.md +0 -621
  692. package/one/things/claude/agents/tauri-cross-platform-specialist.md +0 -1912
  693. package/one/things/claude/agents/tester.md +0 -595
  694. package/one/things/claude/agents/the-bull-character-manager.md +0 -603
  695. package/one/things/claude/agents/tools-playbook-generator.md +0 -492
  696. package/one/things/claude/agents/turbo-repo-builder.md +0 -346
  697. package/one/things/claude/agents/upsell-strategist.md +0 -503
  698. package/one/things/claude/agents/ux-expert.md +0 -360
  699. package/one/things/claude/agents/viral-growth-orchestrator.md +0 -520
  700. package/one/things/claude/claude-code-hooks-development.json +0 -21
  701. package/one/things/claude/claude-code-hooks-production.json +0 -21
  702. package/one/things/claude/claude-code-hooks.json +0 -25
  703. package/one/things/claude/commands/agent.md +0 -124
  704. package/one/things/claude/commands/cascade-status.md +0 -153
  705. package/one/things/claude/commands/ingest.md +0 -343
  706. package/one/things/claude/commands/ingestor.md +0 -158
  707. package/one/things/claude/commands/mission.md +0 -103
  708. package/one/things/claude/commands/npx.md +0 -156
  709. package/one/things/claude/commands/one.md +0 -486
  710. package/one/things/claude/commands/quality-check.md +0 -252
  711. package/one/things/claude/commands/smart-route.md +0 -261
  712. package/one/things/claude/commands/start.md +0 -139
  713. package/one/things/claude/commands/story.md +0 -103
  714. package/one/things/claude/commands/task.md +0 -193
  715. package/one/things/claude/hook-bypass.json +0 -32
  716. package/one/things/claude/hooks/agent-hook-config.json +0 -427
  717. package/one/things/claude/hooks/build-hook.sh +0 -156
  718. package/one/things/claude/hooks/cleanup-hook.sh +0 -201
  719. package/one/things/claude/hooks/file-organization-hook.sh +0 -80
  720. package/one/things/claude/hooks/format-hook.sh +0 -43
  721. package/one/things/claude/hooks/hook-bypass.sh +0 -293
  722. package/one/things/claude/hooks/hook-debouncer.sh +0 -62
  723. package/one/things/claude/hooks/hook-logger.sh +0 -89
  724. package/one/things/claude/hooks/lint-hook.sh +0 -140
  725. package/one/things/claude/hooks/notification-hook.sh +0 -204
  726. package/one/things/claude/hooks/ontology-validation-hook.sh +0 -86
  727. package/one/things/claude/hooks/performance-metrics.json +0 -25
  728. package/one/things/claude/hooks/security-hook.sh +0 -256
  729. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +0 -210
  730. package/one/things/claude/hooks/story-validation-hook.sh +0 -145
  731. package/one/things/claude/hooks/test-hook.sh +0 -145
  732. package/one/things/claude/hooks/test-story-validation.sh +0 -170
  733. package/one/things/claude/settings-local.json +0 -86
  734. package/one/things/cli/cli-code.md +0 -677
  735. package/one/things/cli/cli-compiler-code.md +0 -677
  736. package/one/things/cli/cli.md +0 -871
  737. package/one/things/components/card-shadcn.md +0 -953
  738. package/one/things/components/card.md +0 -1041
  739. package/one/things/components.md +0 -1743
  740. package/one/things/componets.md +0 -19
  741. package/one/things/contracts/Move.toml +0 -12
  742. package/one/things/contracts/README.md +0 -288
  743. package/one/things/contracts/one.move +0 -762
  744. package/one/things/contracts/sdk.ts +0 -578
  745. package/one/things/creator-diagram.md +0 -184
  746. package/one/things/crypto/FEATURES.md +0 -78
  747. package/one/things/crypto/ONECORE.md +0 -62
  748. package/one/things/crypto/ONECOREFAQ.md +0 -22
  749. package/one/things/crypto/ONECOREHOW.md +0 -46
  750. package/one/things/crypto/ONEENTERPRISE.md +0 -64
  751. package/one/things/crypto/ONEENTERPRISEFAQ.md +0 -64
  752. package/one/things/crypto/ONEENTERPRISEHOW.md +0 -53
  753. package/one/things/crypto/ONEPRO.md +0 -60
  754. package/one/things/crypto/ONEPROFAQ.md +0 -22
  755. package/one/things/crypto/ONEPROHOW.md +0 -53
  756. package/one/things/crypto/READMEAGENCY.md +0 -64
  757. package/one/things/crypto/VSL.md +0 -45
  758. package/one/things/crypto/WebsiteCopy.md +0 -176
  759. package/one/things/demo-accessibility-animations.md +0 -1025
  760. package/one/things/demo-components.md +0 -1310
  761. package/one/things/demo-design-summary.md +0 -692
  762. package/one/things/demo-design-system.md +0 -973
  763. package/one/things/demo-page-layouts.md +0 -1016
  764. package/one/things/design-system.md +0 -832
  765. package/one/things/designs/accessibility-audit.md +0 -877
  766. package/one/things/designs/component-specifications.md +0 -855
  767. package/one/things/designs/design-overview.md +0 -377
  768. package/one/things/designs/design-tokens.md +0 -448
  769. package/one/things/designs/wireframes-dashboard.md +0 -710
  770. package/one/things/docs/api-requests.md +0 -987
  771. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +0 -485
  772. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +0 -465
  773. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +0 -425
  774. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +0 -451
  775. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +0 -536
  776. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +0 -650
  777. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +0 -473
  778. package/one/things/docs/ecommerce/QUICK-START.md +0 -405
  779. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +0 -567
  780. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +0 -271
  781. package/one/things/docs/ecommerce/USAGE-EXAMPLE.astro +0 -171
  782. package/one/things/docs/ecommerce/demo.astro +0 -309
  783. package/one/things/examples/children/lemonade-stand.md +0 -404
  784. package/one/things/examples/enterprise/crm-saas.md +0 -1444
  785. package/one/things/features/1-1-agent-prompts.md +0 -562
  786. package/one/things/features/1-2-yaml-orchestrator.md +0 -548
  787. package/one/things/features/1-3-event-coordination.md +0 -547
  788. package/one/things/features/1-4-knowledge-management.md +0 -652
  789. package/one/things/features/1-5-quality-loops.md +0 -725
  790. package/one/things/features/1-6-numbering-structure.md +0 -639
  791. package/one/things/features/2-1-dataprovider-interface.md +0 -2583
  792. package/one/things/features/2-2-config-system.md +0 -3242
  793. package/one/things/features/2-3-effectts-services.md +0 -1645
  794. package/one/things/features/2-4-react-hooks.md +0 -2136
  795. package/one/things/features/2-5-auth-migration.md +0 -2144
  796. package/one/things/features/2-6-dashboard-migration.md +0 -2084
  797. package/one/things/features/2-7-alternative-providers.md +0 -2578
  798. package/one/things/features/2-7-implementation-report.md +0 -724
  799. package/one/things/features/2-cli.md +0 -1720
  800. package/one/things/features/2-design.md +0 -1770
  801. package/one/things/features/2-tests.md +0 -576
  802. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +0 -576
  803. package/one/things/features/DECOUPLING.md +0 -290
  804. package/one/things/features/DEPLOYMENT.md +0 -470
  805. package/one/things/features/IMPLEMENTATION_SUMMARY.md +0 -362
  806. package/one/things/features/improve.md +0 -861
  807. package/one/things/features/remove-convex-deps.md +0 -63
  808. package/one/things/features/top-features.md +0 -87
  809. package/one/things/features/use-one-backend.md +0 -1217
  810. package/one/things/features-in-english.md +0 -200
  811. package/one/things/files.yaml +0 -721
  812. package/one/things/ideas/1-create-workflow.md +0 -207
  813. package/one/things/ideas/2-backend-agnostic-frontend.md +0 -439
  814. package/one/things/implementation/backend-guide.md +0 -457
  815. package/one/things/interface.md +0 -257
  816. package/one/things/landing-page-implementation.md +0 -455
  817. package/one/things/legal/README.md +0 -234
  818. package/one/things/legal/privacy-policy.md +0 -1227
  819. package/one/things/legal/terms-of-service.md +0 -1432
  820. package/one/things/master-workflow-plan.md +0 -806
  821. package/one/things/pay.one.ie.md +0 -53
  822. package/one/things/plans/0-in-sync.md +0 -136
  823. package/one/things/plans/0-timeline.md +0 -36
  824. package/one/things/plans/1-create-workflow.md +0 -732
  825. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +0 -333
  826. package/one/things/plans/README-SIMPLIFICATION.md +0 -349
  827. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +0 -16
  828. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +0 -455
  829. package/one/things/plans/ai-elements-integration.md +0 -483
  830. package/one/things/plans/ai-elements.md +0 -1278
  831. package/one/things/plans/ai-integration-plan.md +0 -263
  832. package/one/things/plans/ai-integration.md +0 -996
  833. package/one/things/plans/ai-sdk.md +0 -798
  834. package/one/things/plans/ai-tools.md +0 -621
  835. package/one/things/plans/app.md +0 -832
  836. package/one/things/plans/architecture-summary.md +0 -312
  837. package/one/things/plans/async-ai-agents.md +0 -233
  838. package/one/things/plans/backend-agnostic-frontend.md +0 -390
  839. package/one/things/plans/backend-cleanup-quickstart.md +0 -380
  840. package/one/things/plans/backend-ontology-conformance.md +0 -475
  841. package/one/things/plans/backend-status.md +0 -599
  842. package/one/things/plans/backend-structure.md +0 -847
  843. package/one/things/plans/backend-target-structure.md +0 -482
  844. package/one/things/plans/backend.md +0 -1175
  845. package/one/things/plans/better-auth-any-backend-revised.md +0 -1103
  846. package/one/things/plans/better-auth-any-backend.md +0 -1896
  847. package/one/things/plans/better-auth-available-features.md +0 -273
  848. package/one/things/plans/big-plan.md +0 -52
  849. package/one/things/plans/cli-updates-required.md +0 -320
  850. package/one/things/plans/complete-step-by-step.md +0 -1409
  851. package/one/things/plans/components.md +0 -709
  852. package/one/things/plans/convex-agents.md +0 -1034
  853. package/one/things/plans/convex-better-auth.md +0 -1141
  854. package/one/things/plans/convex-on-off.md +0 -407
  855. package/one/things/plans/crypto-token-researcher.md +0 -629
  856. package/one/things/plans/data-quality-metrics.md +0 -745
  857. package/one/things/plans/deep-researcher-agent.md +0 -466
  858. package/one/things/plans/deploy-to-cloudflare.md +0 -623
  859. package/one/things/plans/deployment-architecture.md +0 -469
  860. package/one/things/plans/desktop.md +0 -1139
  861. package/one/things/plans/development-plan.md +0 -1283
  862. package/one/things/plans/development-workflow-tldr.md +0 -207
  863. package/one/things/plans/development-workflow.md +0 -959
  864. package/one/things/plans/dsl-claude-code.md +0 -1011
  865. package/one/things/plans/effect-components.md +0 -1743
  866. package/one/things/plans/effect-patterns-reference.md +0 -2235
  867. package/one/things/plans/effect.md +0 -1806
  868. package/one/things/plans/email.md +0 -966
  869. package/one/things/plans/enhance-auth.md +0 -1692
  870. package/one/things/plans/execution-strategy.md +0 -1291
  871. package/one/things/plans/existing-infrastructure.md +0 -712
  872. package/one/things/plans/feature-based-sites.md +0 -894
  873. package/one/things/plans/frontend-effects.md +0 -1276
  874. package/one/things/plans/group-folder-multi-tenancy.md +0 -893
  875. package/one/things/plans/improve-codebase.md +0 -1811
  876. package/one/things/plans/install-components.md +0 -215
  877. package/one/things/plans/integrate-frontend-and-backend.md +0 -603
  878. package/one/things/plans/landing.md +0 -820
  879. package/one/things/plans/layout.md +0 -249
  880. package/one/things/plans/mail-backend.md +0 -1361
  881. package/one/things/plans/mail.md +0 -2677
  882. package/one/things/plans/mcp-clear-context-prompt.md +0 -81
  883. package/one/things/plans/mcp-simple.md +0 -248
  884. package/one/things/plans/multi-ontology-architecture.md +0 -885
  885. package/one/things/plans/next-features.md +0 -114
  886. package/one/things/plans/npx-agent-safety.md +0 -785
  887. package/one/things/plans/npx-agent.md +0 -1089
  888. package/one/things/plans/onboarding.md +0 -51
  889. package/one/things/plans/one-protocol-and-payone-usage.md +0 -82
  890. package/one/things/plans/one.md +0 -677
  891. package/one/things/plans/ontology-6-dimensions.md +0 -2201
  892. package/one/things/plans/ontology-compliance-audit.md +0 -342
  893. package/one/things/plans/ontology-driven-strategy.md +0 -882
  894. package/one/things/plans/ontology-refine.md +0 -586
  895. package/one/things/plans/ontology-ui-approach.md +0 -375
  896. package/one/things/plans/open-agent.md +0 -840
  897. package/one/things/plans/performace.md +0 -122
  898. package/one/things/plans/phase-1-foundation.md +0 -620
  899. package/one/things/plans/phase-3-implementation.md +0 -1037
  900. package/one/things/plans/plan-connect-to-api.md +0 -146
  901. package/one/things/plans/quick-wins.md +0 -1428
  902. package/one/things/plans/r2.md +0 -777
  903. package/one/things/plans/readme-backend-cleanup.md +0 -402
  904. package/one/things/plans/release.md +0 -507
  905. package/one/things/plans/remove-backend-development-from-agents.md +0 -1331
  906. package/one/things/plans/repos.md +0 -98
  907. package/one/things/plans/separate-copy-2.md +0 -1349
  908. package/one/things/plans/separate-copy-3.md +0 -2479
  909. package/one/things/plans/separate-copy.md +0 -1349
  910. package/one/things/plans/separate-demo.md +0 -864
  911. package/one/things/plans/separate.md +0 -1999
  912. package/one/things/plans/sequence.md +0 -2040
  913. package/one/things/plans/shadcn-integration-summary.md +0 -510
  914. package/one/things/plans/sidebar.md +0 -206
  915. package/one/things/plans/skills.md +0 -709
  916. package/one/things/plans/small-fixes.md +0 -23
  917. package/one/things/plans/start-new.md +0 -764
  918. package/one/things/plans/switch-off-auth.md +0 -42
  919. package/one/things/plans/sync-checklist.md +0 -351
  920. package/one/things/plans/test-backend-connection.md +0 -514
  921. package/one/things/plans/unified-implementation-plan.md +0 -934
  922. package/one/things/plans/update-demos.md +0 -581
  923. package/one/things/plans/use-our-backend.md +0 -572
  924. package/one/things/plans/video-backend.md +0 -638
  925. package/one/things/plans/video-frontend.md +0 -490
  926. package/one/things/plans/video-old-archived.md +0 -656
  927. package/one/things/plans/wave1-onboarding-100-inferences.md +0 -1686
  928. package/one/things/plans/wave1-onboarding-vision.md +0 -744
  929. package/one/things/plans/wave1-orchestration-summary.md +0 -604
  930. package/one/things/plans/wave1-specialist-assignments.md +0 -1413
  931. package/one/things/plans/workflow-files.md +0 -1210
  932. package/one/things/plans/workflow.md +0 -1378
  933. package/one/things/plans-u.md +0 -905
  934. package/one/things/products/Blockchain Products.md +0 -6278
  935. package/one/things/products/cascade-landing-page.md +0 -841
  936. package/one/things/products/cascade.md +0 -1568
  937. package/one/things/products/context-engineering.md +0 -1488
  938. package/one/things/products/onthology.md +0 -15
  939. package/one/things/products/ontology-ui-shadcn.md +0 -1302
  940. package/one/things/products/ontology-ui.md +0 -1429
  941. package/one/things/products/ontology.md +0 -789
  942. package/one/things/products/sdk.md +0 -573
  943. package/one/things/promptkit.md +0 -930
  944. package/one/things/repos/all-repos.md +0 -0
  945. package/one/things/scripts-clean-mac.sh +0 -409
  946. package/one/things/service-providers-new.md +0 -1052
  947. package/one/things/service-providers.md +0 -1121
  948. package/one/things/structure.md +0 -532
  949. package/one/things/system.md +0 -618
  950. package/one/things/templates.md +0 -294
  951. package/one/things/tests/2-1-dataprovider-interface.md +0 -1216
  952. package/one/things/tests/2-1-test-analysis.md +0 -544
  953. package/one/things/things.md +0 -384
  954. package/one/things/todo-acp-integration.md +0 -744
  955. package/one/things/todo-ai.md +0 -933
  956. package/one/things/todo-api.md +0 -1078
  957. package/one/things/todo-assignment.md +0 -580
  958. package/one/things/todo-buy-chatgpt.md +0 -1450
  959. package/one/things/todo-components.md +0 -1683
  960. package/one/things/todo-connections.md +0 -278
  961. package/one/things/todo-ecommerce-frontend.md +0 -1313
  962. package/one/things/todo-ecommerce.md +0 -569
  963. package/one/things/todo-effects.md +0 -1075
  964. package/one/things/todo-frontend-effects.md +0 -977
  965. package/one/things/todo-landing-page.md +0 -1091
  966. package/one/things/todo-mail.md +0 -1160
  967. package/one/things/todo-master-plan.md +0 -490
  968. package/one/things/todo-onboard.md +0 -666
  969. package/one/things/todo-one-ie.md +0 -538
  970. package/one/things/todo-page.md +0 -606
  971. package/one/things/todo-plans.md +0 -282
  972. package/one/things/todo-projects.md +0 -241
  973. package/one/things/todo-refactoring-plan.md +0 -366
  974. package/one/things/todo-release.md +0 -654
  975. package/one/things/todo-sequence.md +0 -1621
  976. package/one/things/todo-use-our-backend.md +0 -1908
  977. package/one/things/todo-workflow.md +0 -626
  978. package/one/things/todo-x402.md +0 -2047
  979. package/one/things/todo.md +0 -21
  980. package/one/things/video/scripts-crypto.md +0 -835
  981. package/one/things/video-script-backup.md +0 -318
  982. package/one/things/video-script-demo.md +0 -382
  983. package/one/things/video-script-ontology.md +0 -333
  984. package/one/things/video-script.md +0 -361
@@ -1,2475 +0,0 @@
1
- ---
2
- title: Ontology Frontend
3
- dimension: knowledge
4
- category: ontology-frontend.md
5
- tags: 6-dimensions, agent, architecture, backend, frontend, ontology, testing, ui
6
- related_dimensions: connections, events, groups, 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 ontology-frontend.md category.
13
- Location: one/knowledge/ontology-frontend.md
14
- Purpose: Documents frontend development ontology
15
- Related dimensions: connections, events, groups, people, things
16
- For AI agents: Read this to understand ontology frontend.
17
- ---
18
-
19
- # Frontend Development Ontology
20
-
21
- **Version:** 2.0.0
22
- **Type System:** Formal ontology for backend-agnostic Astro website development
23
- **Paradigm:** Pure declarative type theory + Provider pattern + Context engineering
24
-
25
- ---
26
-
27
- ## Table of Contents
28
-
29
- 1. [Core Axioms](#core-axioms)
30
- 2. [Provider Pattern & Context Engineering](#provider-pattern--context-engineering)
31
- 3. [Type Hierarchy](#type-hierarchy)
32
- 4. [Critical Distinctions](#critical-distinctions)
33
- 5. [State Management Hierarchy](#state-management-hierarchy)
34
- 6. [DataProvider Interface](#dataprovider-interface-universal-api)
35
- 7. [Entity Definitions](#entity-definitions)
36
- 8. [Multi-Tenant Architecture](#multi-tenant-architecture)
37
- 9. [Caching Ontology](#caching-ontology)
38
- 10. [Error Propagation Ontology](#error-propagation-ontology)
39
- 11. [Testing Ontology](#testing-ontology)
40
- 12. [Pattern Language](#pattern-language)
41
- 13. [Type Sync Automation](#type-sync-automation)
42
- 14. [Observability Layer](#observability-layer)
43
- 15. [Agent Task Mapping](#agent-task-mapping)
44
- 16. [Common Mistakes](#common-mistakes)
45
- 17. [Summary](#summary)
46
-
47
- ---
48
-
49
- ## Core Axioms
50
-
51
- ### Axiom 1: Everything is a Thing
52
-
53
- ```
54
- ∀x ∈ Frontend → x : Thing
55
- Thing ::= Page | Component | Content | Service | Provider | Configuration
56
- ```
57
-
58
- ### Axiom 2: All Things Have Type
59
-
60
- ```
61
- type : Thing → TypeID
62
- TypeID ::= String ∈ ontology.things.types
63
- ```
64
-
65
- ### Axiom 3: Things Connect
66
-
67
- ```
68
- connect : Thing × Thing → Connection
69
- Connection ::= { from: Thing, to: Thing, type: RelationType, metadata: Object }
70
- ```
71
-
72
- ### Axiom 4: Actions Emit Events
73
-
74
- ```
75
- action : Thing → Event
76
- Event ::= { type: EventType, actor: Thing, target: Thing, timestamp: Time, metadata: Object }
77
- ```
78
-
79
- ### Axiom 5: Patterns Compose
80
-
81
- ```
82
- compose : Pattern × Pattern → Pattern
83
- Pattern ::= { type: PatternType, inputs: [Thing], outputs: [Thing], transform: Function }
84
- ```
85
-
86
- ### Axiom 6: Backend Agnosticism
87
-
88
- ```
89
- ∀Provider. Provider implements DataProviderInterface → Frontend works with Provider
90
- DataProviderInterface ::= { organizations, people, things, connections, events, knowledge }
91
- ```
92
-
93
- ### Axiom 7: Context Minimalism
94
-
95
- ```
96
- ∀Operation. Load only required types, not implementations
97
- ContextUsed << ContextAvailable
98
- target_reduction: 98%+
99
- ```
100
-
101
- **Key Principle:** Frontend knows 6-dimension ontology, not backend implementation.
102
-
103
- ---
104
-
105
- ## Provider Pattern & Context Engineering
106
-
107
- ### The Core Insight: Providers ARE Context Loaders
108
-
109
- ```typescript
110
- {
111
- insight: "Provider pattern = 99.9% context reduction"
112
-
113
- // ❌ Traditional: Load entire backend
114
- traditionalApproach: {
115
- load: "Full Convex schema + all implementations + all docs",
116
- tokens: 280_000,
117
- problem: "Frontend context explodes with backend knowledge"
118
- }
119
-
120
- // ✅ Provider pattern: Load only interface
121
- providerApproach: {
122
- load: "DataProviderInterface only (contract)",
123
- tokens: 300,
124
- benefit: "Frontend never loads backend implementation"
125
- }
126
-
127
- // Backend translation happens at runtime (0 frontend tokens)
128
- execution: {
129
- frontend: "provider.things.get(id)", // Uses interface
130
- provider: "convexClient.query(...)", // Translates to backend
131
- backend: "Database query", // Executes
132
- result: "Frontend context = 300 tokens (not 280k)"
133
- }
134
-
135
- result: {
136
- context_reduction: "99.9%",
137
- backend_flexibility: "infinite (swap with config)",
138
- type_safety: "Effect.ts typed errors",
139
- testability: "Mock provider for tests"
140
- }
141
- }
142
- ```
143
-
144
- ### Provider as Just-In-Time Loader
145
-
146
- ```typescript
147
- // Traditional AI code generation
148
- ❌ function generateCourseComponent_Traditional() {
149
- context = {
150
- convexSchema: loadConvexSchema(), // 15,000 tokens
151
- convexMutations: loadMutations(), // 20,000 tokens
152
- convexQueries: loadQueries(), // 18,000 tokens
153
- implementations: loadImplementations() // 50,000 tokens
154
- } // Total: 103,000 tokens
155
-
156
- return ai.generate(task, context)
157
- }
158
-
159
- // ✅ Provider pattern
160
- ✅ function generateCourseComponent_Provider() {
161
- context = {
162
- interface: "DataProviderInterface", // 300 tokens
163
- operations: ["things.get", "things.list"] // Which operations needed
164
- } // Total: 300 tokens
165
-
166
- // AI generates code using interface
167
- code = ai.generate(task, context)
168
- // Result: provider.things.get(id) - works with ANY backend
169
-
170
- return code
171
- }
172
-
173
- // Savings: 103,000 → 300 tokens = 99.7% reduction
174
- ```
175
-
176
- ### Context Engineering Formula
177
-
178
- ```typescript
179
- {
180
- traditional: {
181
- formula: "ContextSize = Σ(all_files + all_docs + all_examples)",
182
- typical: "50k-300k tokens per request",
183
- problem: "Hits context limits, slow, expensive"
184
- },
185
-
186
- provider: {
187
- formula: "ContextSize = interface_definition + operation_signatures",
188
- typical: "300-500 tokens per request",
189
- benefit: "Never hits limits, fast, cheap, infinite backends"
190
- },
191
-
192
- improvement: {
193
- context_reduction: "99%+",
194
- cost_reduction: "100x cheaper",
195
- speed_improvement: "10x faster",
196
- backend_flexibility: "∞ backends supported"
197
- }
198
- }
199
- ```
200
-
201
- ---
202
-
203
- ## Type Hierarchy
204
-
205
- ### Base Types
206
-
207
- ```
208
- Thing
209
- ├── Artifact // Code artifacts (what agents create)
210
- │ ├── Page
211
- │ │ ├── LandingPage
212
- │ │ ├── BlogIndex
213
- │ │ ├── BlogPost
214
- │ │ ├── AppPage
215
- │ │ ├── AccountPage
216
- │ │ └── APIRoute
217
- │ ├── Component
218
- │ │ ├── UIComponent
219
- │ │ ├── FeatureComponent
220
- │ │ ├── Layout
221
- │ │ └── Island
222
- │ ├── Content
223
- │ │ ├── Collection
224
- │ │ ├── Entry
225
- │ │ └── Schema
226
- │ ├── Service // Effect.ts services (type-safe data operations)
227
- │ │ ├── GenericService // Handles all 66 types (ThingService, ConnectionService)
228
- │ │ └── SpecializedService // Optional convenience (CourseService)
229
- │ ├── Provider // Backend implementations (swap backends)
230
- │ │ ├── ConvexProvider // Convex backend
231
- │ │ ├── WordPressProvider // WordPress REST API
232
- │ │ ├── NotionProvider // Notion databases
233
- │ │ ├── SupabaseProvider // Supabase PostgreSQL
234
- │ │ └── CustomProvider // Any backend
235
- │ └── Configuration // Display & provider config (NOT business logic)
236
- │ ├── DisplayConfig // UI labels, icons, colors
237
- │ └── ProviderConfig // Backend URL, API keys
238
- ├── Pattern // Reusable templates
239
- │ ├── PagePattern
240
- │ ├── ComponentPattern
241
- │ ├── DataPattern
242
- │ ├── ServicePattern
243
- │ └── StylePattern
244
- ├── Interface // Abstract contracts
245
- │ ├── DataProviderInterface // Universal 6-dimension API
246
- │ └── SubscriptionInterface // Real-time updates (optional)
247
- ├── Capability // Agent capabilities
248
- │ ├── Create
249
- │ ├── Read
250
- │ ├── Update
251
- │ └── Delete
252
- └── Context // Execution context
253
- ├── TypeContext
254
- ├── PatternContext
255
- └── ExampleContext
256
- ```
257
-
258
- ---
259
-
260
- ## Critical Distinctions
261
-
262
- ### What Frontend IS
263
-
264
- ```typescript
265
- type FrontendResponsibility =
266
- | { type: "render"; data: any } // Display UI from data
267
- | { type: "call_provider"; operation: DataOperation } // Call DataProvider (not direct backend)
268
- | { type: "manage_ui_state"; state: UIState } // Form inputs, modals, loading (component-local)
269
- | { type: "route"; path: Path } // Client-side navigation
270
- | { type: "cache_display"; data: CachedData }; // Cache UI data (not business data)
271
- ```
272
-
273
- ### What Frontend IS NOT
274
-
275
- ```typescript
276
- type FrontendProhibition =
277
- | { type: "database_access"; reason: "Backend-only (provider abstracts)" }
278
- | {
279
- type: "business_logic";
280
- reason: "Backend validates (frontend calls provider)";
281
- }
282
- | { type: "event_logging"; reason: "Backend logs (frontend just triggers)" }
283
- | {
284
- type: "authorization";
285
- reason: "Backend authorizes (frontend just checks state)";
286
- }
287
- | {
288
- type: "data_validation";
289
- reason: "Backend validates (frontend UX hints only)";
290
- }
291
- | {
292
- type: "org_filtering";
293
- reason: "Provider handles (frontend never filters by org)";
294
- }
295
- | {
296
- type: "backend_specific_code";
297
- reason: "Provider abstracts (frontend uses interface)";
298
- };
299
- ```
300
-
301
- ---
302
-
303
- ## State Management Hierarchy
304
-
305
- ### Four-Layer State Architecture
306
-
307
- ```typescript
308
- {
309
- // Level 1: Server State (Provider owns - SOURCE OF TRUTH)
310
- ServerState: {
311
- owner: "Provider (backed by database)",
312
- source: "Backend database",
313
- access: "Query/Mutation via provider.interface only",
314
- examples: [
315
- "course list",
316
- "user profile",
317
- "enrollment count",
318
- "lesson progress"
319
- ],
320
- caching: "Provider-level (Cloudflare KV, Edge cache)",
321
- lifetime: "Persistent (until backend changes)",
322
- rule: "NEVER duplicate in frontend state. Query when needed."
323
- },
324
-
325
- // Level 2: SSR State (Astro owns - REQUEST SCOPED)
326
- SSRState: {
327
- owner: "Astro page (.astro files)",
328
- source: "Server-side provider fetch",
329
- access: "Props passed to components",
330
- examples: [
331
- "Initial page data (course details)",
332
- "SEO metadata (title, description)",
333
- "Organization context (from subdomain)"
334
- ],
335
- lifetime: "One HTTP request (not persisted)",
336
- pattern: `
337
- ---
338
- const course = await provider.things.get(id)
339
- ---
340
- <Layout title={course.name}>
341
- <CourseDetail course={course} />
342
- </Layout>
343
- `,
344
- rule: "Use for SEO, initial render, server-only data"
345
- },
346
-
347
- // Level 3: Island State (React owns - COMPONENT SCOPED)
348
- IslandState: {
349
- owner: "React component (useState/useReducer)",
350
- source: "Component-local logic",
351
- access: "Component-private (not shared)",
352
- examples: [
353
- "Form input values",
354
- "Modal open/closed",
355
- "Dropdown expanded",
356
- "Loading spinner visible"
357
- ],
358
- lifetime: "Component mounted (unmount = state destroyed)",
359
- pattern: `
360
- export function CourseForm() {
361
- const [title, setTitle] = useState('')
362
- const [loading, setLoading] = useState(false)
363
- // State dies when component unmounts
364
- }
365
- `,
366
- rule: "UI-only state. Never duplicate server state."
367
- },
368
-
369
- // Level 4: Shared Client State (Nanostores owns - SESSION SCOPED)
370
- SharedState: {
371
- owner: "Nanostores (global atoms)",
372
- source: "Cross-component coordination",
373
- access: "Multiple components subscribe",
374
- examples: [
375
- "Sidebar expanded/collapsed",
376
- "Dark/light theme preference",
377
- "User locale (en/es/fr)",
378
- "Toast notifications"
379
- ],
380
- lifetime: "Browser session + localStorage",
381
- pattern: `
382
- // stores/layout.ts
383
- export const sidebarExpanded = atom(true)
384
-
385
- // Component A
386
- const expanded = useStore(sidebarExpanded)
387
-
388
- // Component B (synced with A)
389
- const expanded = useStore(sidebarExpanded)
390
- `,
391
- rule: "UI preferences only. NOT server data."
392
- },
393
-
394
- // Anti-Pattern: Duplicating Server State
395
- antiPattern: {
396
- problem: "Storing server data in frontend state",
397
- example: `
398
- ❌ const [courses, setCourses] = useState([])
399
- ❌ useEffect(() => {
400
- provider.things.list('course').then(setCourses)
401
- }, [])
402
- // Problem: Server state duplicated in frontend
403
- // Problem: Stale data, manual sync, cache invalidation
404
- `,
405
- solution: `
406
- ✅ const courses = useQuery(api.courses.list)
407
- // Provider handles caching, revalidation, subscriptions
408
- // Frontend just renders. No state duplication.
409
- `
410
- },
411
-
412
- // Golden Rule
413
- rule: "State lives at HIGHEST appropriate level. Don't lift unnecessarily."
414
-
415
- // Decision Tree
416
- decisionTree: {
417
- question: "Does this state persist after page reload?",
418
- yes: {
419
- question: "Is this data from backend?",
420
- yes: "ServerState (provider query)",
421
- no: "SharedState (nanostores + localStorage)"
422
- },
423
- no: {
424
- question: "Do multiple components need this state?",
425
- yes: "SharedState (nanostores, session-only)",
426
- no: {
427
- question: "Is this SSR data?",
428
- yes: "SSRState (Astro props)",
429
- no: "IslandState (useState)"
430
- }
431
- }
432
- }
433
- }
434
- ```
435
-
436
- ---
437
-
438
- ## DataProvider Interface (Universal API)
439
-
440
- ### Core Contract
441
-
442
- ```typescript
443
- // ALL backends must implement this interface
444
- interface DataProviderInterface {
445
- // Dimension 1: Organizations
446
- organizations: {
447
- get: (id: string) → Effect<Organization, OrganizationNotFoundError>
448
- list: (params: ListParams) → Effect<Organization[], Error>
449
- update: (id: string, updates: Partial<Organization>) → Effect<void, Error>
450
- }
451
-
452
- // Dimension 2: People
453
- people: {
454
- get: (id: string) → Effect<Person, PersonNotFoundError | UnauthorizedError>
455
- list: (params: ListParams) → Effect<Person[], Error>
456
- create: (input: CreatePersonInput) → Effect<string, PersonCreateError>
457
- update: (id: string, updates: Partial<Person>) → Effect<void, Error>
458
- delete: (id: string) → Effect<void, Error>
459
- }
460
-
461
- // Dimension 3: Things
462
- things: {
463
- get: (id: string) → Effect<Thing, ThingNotFoundError | UnauthorizedError>
464
- list: (params: { type: ThingType; groupId?: string; filters?: any }) → Effect<Thing[], Error>
465
- create: (input: CreateThingInput) → Effect<string, ThingCreateError>
466
- update: (id: string, updates: Partial<Thing>) → Effect<void, Error>
467
- delete: (id: string) → Effect<void, Error>
468
- }
469
-
470
- // Dimension 4: Connections
471
- connections: {
472
- create: (input: CreateConnectionInput) → Effect<string, ConnectionCreateError>
473
- getRelated: (params: { thingId: string; relationshipType: ConnectionType; direction: Direction }) → Effect<Thing[], Error>
474
- getCount: (thingId: string, relationshipType: ConnectionType) → Effect<number, Error>
475
- delete: (id: string) → Effect<void, Error>
476
- }
477
-
478
- // Dimension 5: Events
479
- events: {
480
- log: (event: LogEventInput) → Effect<void, Error>
481
- query: (params: EventQueryParams) → Effect<Event[], Error>
482
- }
483
-
484
- // Dimension 6: Knowledge
485
- knowledge: {
486
- embed: (params: EmbedParams) → Effect<string, Error>
487
- search: (params: SearchParams) → Effect<KnowledgeMatch[], Error>
488
- }
489
-
490
- // Optional: Real-time subscriptions (not all backends support)
491
- subscriptions?: {
492
- watchThing: (id: string) → Effect<Observable<Thing>, Error>
493
- watchList: (type: ThingType, groupId?: string) → Effect<Observable<Thing[]>, Error>
494
- }
495
- }
496
- ```
497
-
498
- ### Provider Algebra
499
-
500
- ```typescript
501
- // Provider composition
502
- implement : Backend × DataProviderInterface → Provider
503
-
504
- // Examples:
505
- ConvexProvider = implement(ConvexBackend, DataProviderInterface)
506
- WordPressProvider = implement(WordPressBackend, DataProviderInterface)
507
- NotionProvider = implement(NotionBackend, DataProviderInterface)
508
-
509
- // Swapping backends (change ONE line in config)
510
- config.provider = ConvexProvider({ url: "..." })
511
- // OR
512
- config.provider = WordPressProvider({ url: "...", apiKey: "..." })
513
- // OR
514
- config.provider = NotionProvider({ apiKey: "...", databaseId: "..." })
515
-
516
- // Result: Frontend components don't change
517
- ```
518
-
519
- ---
520
-
521
- ## Entity Definitions
522
-
523
- ### Services (Effect.ts Layer)
524
-
525
- ```typescript
526
- // Generic Service (handles ALL 66 thing types)
527
- type GenericService = Service & {
528
- subtype: "generic"
529
- coverage: ThingType[] // All 66 types
530
- operations: CRUD
531
-
532
- invariant: {
533
- backend_agnostic: true // Works with ANY provider
534
- type_safe: true // Effect.ts typed errors
535
- composable: true // Combines into workflows
536
- }
537
- }
538
-
539
- // Example: ThingService handles courses, lessons, products, EVERYTHING
540
- type ThingService = GenericService & {
541
- name: "ThingService"
542
- operations: {
543
- get: (id: string) → Effect<Thing, ThingNotFoundError>
544
- list: (type: ThingType, orgId?: string) → Effect<Thing[], Error>
545
- create: (input: CreateThingInput) → Effect<string, ThingCreateError>
546
- update: (id: string, updates: any) → Effect<void, Error>
547
- delete: (id: string) → Effect<void, Error>
548
- }
549
-
550
- // Delegates to configured provider
551
- implementation: (provider: DataProvider) => ({
552
- get: (id) => provider.things.get(id),
553
- list: (type, groupId) => provider.things.list({ type, groupId }),
554
- // ...
555
- })
556
- }
557
-
558
- // Example: ConnectionService handles ALL relationship types
559
- type ConnectionService = GenericService & {
560
- name: "ConnectionService"
561
- operations: {
562
- create: (input: CreateConnectionInput) → Effect<string, ConnectionCreateError>
563
- getRelated: (thingId, type, direction) → Effect<Thing[], Error>
564
- getCount: (thingId, type) → Effect<number, Error>
565
- delete: (id) → Effect<void, Error>
566
- }
567
-
568
- implementation: (provider: DataProvider) => ({
569
- create: (input) => provider.connections.create(input),
570
- getRelated: (thingId, type, dir) => provider.connections.getRelated({ thingId, relationshipType: type, direction: dir }),
571
- // ...
572
- })
573
- }
574
-
575
- // Specialized Service (OPTIONAL - only add when patterns repeat 3+ times)
576
- type SpecializedService = Service & {
577
- subtype: "specialized"
578
- coverage: ThingType[] // Specific types only
579
- operations: DomainOperations
580
- dependencies: GenericService[] // Composes generic services
581
-
582
- invariant: {
583
- adds_convenience: true // Clearer domain vocabulary
584
- reduces_repetition: true // Encapsulates multi-step operations
585
- optional: true // NOT required (can use generic services directly)
586
- }
587
- }
588
-
589
- // Example: CourseService (OPTIONAL - only if you repeat these patterns)
590
- type CourseService = SpecializedService & {
591
- name: "CourseService"
592
- coverage: ["course"]
593
- dependencies: [ThingService, ConnectionService]
594
-
595
- operations: {
596
- // Convenience: Get course with lessons (vs 2 separate calls)
597
- getCourseWithLessons: (courseId) → Effect<{ course: Thing; lessons: Thing[] }, Error>
598
-
599
- // Convenience: Domain vocabulary (vs generic connection.create)
600
- enrollUser: (userId, courseId) → Effect<string, Error>
601
-
602
- // Convenience: Specific query (vs generic connection.getCount)
603
- getEnrollmentCount: (courseId) → Effect<number, Error>
604
- }
605
-
606
- implementation: (thingService, connectionService) => ({
607
- getCourseWithLessons: (id) => Effect.all([
608
- thingService.get(id),
609
- connectionService.getRelated(id, 'part_of', 'to')
610
- ]),
611
- enrollUser: (userId, courseId) => connectionService.create({
612
- fromThingId: userId,
613
- toThingId: courseId,
614
- relationshipType: 'enrolled_in'
615
- }),
616
- getEnrollmentCount: (courseId) => connectionService.getCount(courseId, 'enrolled_in')
617
- })
618
- }
619
- ```
620
-
621
- ### Providers (Backend Implementations)
622
-
623
- ```typescript
624
- type Provider = {
625
- type: "provider"
626
- backend: Backend // Convex, WordPress, Notion, etc
627
- implements: DataProviderInterface
628
-
629
- // Map ontology operations → backend-specific API calls
630
- translation: {
631
- things: {
632
- get: (id) → BackendSpecificCall
633
- list: (params) → BackendSpecificCall
634
- create: (input) → BackendSpecificCall
635
- // ...
636
- }
637
- connections: {
638
- // ...
639
- }
640
- // ... all 6 dimensions
641
- }
642
-
643
- invariant: {
644
- implements_interface: true // Must implement DataProviderInterface
645
- handles_6_dimensions: true // Organizations, People, Things, Connections, Events, Knowledge
646
- }
647
- }
648
-
649
- // Convex Provider
650
- type ConvexProvider = Provider & {
651
- backend: "convex"
652
-
653
- translation: {
654
- things: {
655
- get: (id) => convexClient.query(api.queries.things.get, { id }),
656
- list: (params) => convexClient.query(api.queries.things.list, params),
657
- create: (input) => convexClient.mutation(api.mutations.things.create, input),
658
- // ...
659
- }
660
- // ... map all operations to Convex API
661
- }
662
- }
663
-
664
- // WordPress Provider
665
- type WordPressProvider = Provider & {
666
- backend: "wordpress"
667
-
668
- translation: {
669
- things: {
670
- get: (id) => fetch(`${url}/wp-json/wp/v2/posts/${id}`)
671
- .then(transformWordPressPost → OneThing),
672
- list: (params) => fetch(`${url}/wp-json/wp/v2/posts?per_page=${params.limit}`)
673
- .then(transformWordPressPosts → OneThings),
674
- create: (input) => fetch(`${url}/wp-json/wp/v2/posts`, {
675
- method: 'POST',
676
- body: transformOneThing → WordPressPost
677
- }),
678
- // ...
679
- }
680
- // ... map all operations to WordPress REST API
681
- }
682
- }
683
-
684
- // Notion Provider
685
- type NotionProvider = Provider & {
686
- backend: "notion"
687
-
688
- translation: {
689
- things: {
690
- get: (id) => notionClient.pages.retrieve({ page_id: id })
691
- .then(transformNotionPage → OneThing),
692
- list: (params) => notionClient.databases.query({ database_id, page_size: params.limit })
693
- .then(transformNotionPages → OneThings),
694
- create: (input) => notionClient.pages.create({
695
- parent: { database_id },
696
- properties: transformOneThing → NotionProperties
697
- }),
698
- // ...
699
- }
700
- // ... map all operations to Notion API
701
- }
702
- }
703
- ```
704
-
705
- ### Configuration
706
-
707
- ```typescript
708
- // Display Configuration (UI only, NOT business logic)
709
- type DisplayConfig = Configuration & {
710
- purpose: "ui_presentation";
711
- scope: ThingType[];
712
-
713
- properties: {
714
- displayName: string; // "Course" (singular)
715
- displayNamePlural: string; // "Courses" (plural)
716
- icon: LucideIconName; // "BookOpen"
717
- color: TailwindColor; // "green"
718
- primaryField: string; // Which property to show as title
719
- secondaryField: string; // Which property to show as subtitle
720
- imageField: string; // Which property is the image
721
- fields: FieldConfig[]; // Form fields for UI
722
- };
723
-
724
- invariant: {
725
- ui_only: true; // NO business logic
726
- backend_agnostic: true; // Works with any provider
727
- display_hints: true; // Labels, placeholders, icons
728
- };
729
- };
730
-
731
- // Provider Configuration (backend connection)
732
- type ProviderConfig = Configuration & {
733
- purpose: "backend_connection";
734
-
735
- properties: {
736
- provider: ProviderType; // "convex" | "wordpress" | "notion" | etc
737
- url: string; // Backend URL
738
- apiKey?: string; // API key (if needed)
739
- databaseId?: string; // Database ID (for Notion)
740
- // ... other backend-specific config
741
- };
742
-
743
- invariant: {
744
- one_line_swap: true; // Change provider in ONE line
745
- environment_vars: true; // Use .env for secrets
746
- };
747
- };
748
- ```
749
-
750
- ---
751
-
752
- ## Multi-Tenant Architecture
753
-
754
- ### Subdomain-Based Organization Isolation
755
-
756
- ```typescript
757
- {
758
- pattern: "subdomain_org_isolation",
759
- problem: "How does provider handle fitnesspro.one.ie vs techcorp.one.ie?",
760
-
761
- solution: {
762
- // Middleware extracts orgId from subdomain
763
- middleware: `
764
- // src/middleware.ts
765
- export function onRequest(context, next) {
766
- const subdomain = context.url.hostname.split('.')[0]
767
- const group = await provider.groups.get({ slug: subdomain })
768
-
769
- context.locals.groupId = group._id
770
- context.locals.group = group
771
-
772
- return next()
773
- }
774
- `,
775
-
776
- // Provider auto-injects groupId in ALL queries
777
- provider: `
778
- // Provider automatically scopes ALL queries
779
- class ConvexProvider implements DataProviderInterface {
780
- constructor(private ctx: Context) {}
781
-
782
- things = {
783
- list: (params) => {
784
- // Provider ALWAYS adds org filter (frontend never needs to)
785
- return this.client.query(api.things.list, {
786
- ...params,
787
- groupId: this.ctx.locals.groupId // Auto-injected
788
- })
789
- },
790
-
791
- create: (input) => {
792
- // Provider ALWAYS stamps org on creation
793
- return this.client.mutation(api.things.create, {
794
- ...input,
795
- properties: {
796
- ...input.properties,
797
- groupId: this.ctx.locals.groupId // Auto-injected
798
- }
799
- })
800
- }
801
- }
802
- }
803
- `,
804
-
805
- // Frontend NEVER manually filters by org
806
- frontend: `
807
- // ✅ Frontend code (same for all orgs)
808
- const courses = await provider.things.list({ type: 'course' })
809
- // Provider adds groupId automatically
810
-
811
- // ❌ NEVER do this
812
- const courses = await provider.things.list({
813
- type: 'course',
814
- groupId: ctx.locals.groupId // Provider handles this
815
- })
816
- `,
817
-
818
- invariants: [
819
- "Provider enforces isolation (not frontend)",
820
- "Frontend never knows about multi-tenancy",
821
- "One frontend codebase for all groups",
822
- "Data isolation enforced at provider level"
823
- ]
824
- },
825
-
826
- benefits: [
827
- "Frontend code 100% group-agnostic",
828
- "Security enforced by provider (not UI)",
829
- "No group-specific frontend builds",
830
- "Impossible to leak group data (provider enforces)"
831
- ]
832
- }
833
- ```
834
-
835
- ---
836
-
837
- ## Caching Ontology
838
-
839
- ### Four-Tier Caching Architecture
840
-
841
- ```typescript
842
- {
843
- // Tier 1: Type Definition Cache (STATIC - INFINITE TTL)
844
- L1_TypeDefinitions: {
845
- what: "Ontology type structures",
846
- ttl: "∞ (types never change at runtime)",
847
- storage: "Memory (startup load)",
848
- size: "200 tokens × 66 types = 13,200 tokens",
849
- hitRate: "99.9%+ (loaded once)",
850
-
851
- implementation: `
852
- class TypeDefinitionCache {
853
- private cache = new Map<ThingType, TypeDefinition>()
854
-
855
- async load() {
856
- // Load all 66 types at startup (one time)
857
- const types = await import('./ontology/types')
858
- types.forEach(type => this.cache.set(type.name, type))
859
- }
860
-
861
- get(type: ThingType): TypeDefinition {
862
- return this.cache.get(type) // Always hits (loaded at startup)
863
- }
864
- }
865
-
866
- // Usage: ~13k tokens loaded ONCE, reused for ALL requests
867
- const typeDef = typeCache.get('course') // 200 tokens, instant
868
- `,
869
-
870
- benefit: "AI loads 200 tokens (not 15k implementation tokens)"
871
- },
872
-
873
- // Tier 2: Provider Interface Cache (STATIC - INFINITE TTL)
874
- L2_ProviderInterface: {
875
- what: "DataProvider method signatures",
876
- ttl: "∞ (interface never changes)",
877
- storage: "Memory (startup load)",
878
- size: "300 tokens (entire interface)",
879
- hitRate: "100% (never changes)",
880
-
881
- implementation: `
882
- // Loaded once at startup
883
- const providerInterface = {
884
- things: {
885
- get: "(id: string) → Effect<Thing, Error>",
886
- list: "(params) → Effect<Thing[], Error>",
887
- // ...
888
- }
889
- // ... all 6 dimensions
890
- } // 300 tokens total
891
-
892
- // Usage: AI references interface (not backend implementation)
893
- context = { interface: providerInterface } // 300 tokens
894
- `,
895
-
896
- benefit: "AI never loads backend implementation (0 tokens)"
897
- },
898
-
899
- // Tier 3: SSR Data Cache (DYNAMIC - TTL: 1-60s)
900
- L3_SSRData: {
901
- what: "Server-rendered page data",
902
- ttl: "1-60s (configurable per route)",
903
- storage: "Cloudflare KV / Edge cache",
904
- size: "Variable (full pages or data)",
905
- strategy: "Stale-while-revalidate",
906
-
907
- implementation: `
908
- // Astro page with edge caching
909
- export const prerender = false
910
-
911
- export async function GET(context) {
912
- const cacheKey = \`course:\${context.params.id}\`
913
-
914
- // Check cache
915
- const cached = await context.locals.cache.get(cacheKey)
916
- if (cached && !isStale(cached, 60)) {
917
- return cached
918
- }
919
-
920
- // Fetch fresh
921
- const course = await provider.things.get(context.params.id)
922
-
923
- // Cache for 60s
924
- await context.locals.cache.set(cacheKey, course, { ttl: 60 })
925
-
926
- return course
927
- }
928
- `,
929
-
930
- patterns: {
931
- high_traffic_pages: "60s TTL (homepage, popular courses)",
932
- dynamic_pages: "10s TTL (user dashboards)",
933
- real_time_pages: "0s TTL (admin, analytics)"
934
- },
935
-
936
- benefit: "Reduces provider calls by 80-95%"
937
- },
938
-
939
- // Tier 4: Client Subscriptions (REALTIME - TTL: 0)
940
- L4_RealtimeSubscriptions: {
941
- what: "WebSocket live updates",
942
- ttl: "0 (always fresh)",
943
- storage: "Client memory (ephemeral)",
944
- strategy: "Provider pushes updates",
945
-
946
- implementation: `
947
- // React component with real-time subscription
948
- export function EnrollmentCount({ courseId }) {
949
- // Convex subscription (or any provider with subscription support)
950
- const count = useQuery(api.connections.getCount, {
951
- thingId: courseId,
952
- relationshipType: 'enrolled_in'
953
- })
954
-
955
- // Updates automatically when backend changes
956
- return <span>{count}</span>
957
- }
958
- `,
959
-
960
- when_to_use: [
961
- "Real-time dashboards",
962
- "Live enrollment counts",
963
- "Collaborative editing",
964
- "Chat/notifications"
965
- ],
966
-
967
- fallback: "If provider doesn't support subscriptions, poll with L3 cache"
968
- },
969
-
970
- // Cache Hierarchy Decision Tree
971
- decisionTree: {
972
- question: "Is this ontology type data?",
973
- yes: "L1 (Type Definition Cache) - infinite TTL",
974
- no: {
975
- question: "Is this provider interface?",
976
- yes: "L2 (Provider Interface Cache) - infinite TTL",
977
- no: {
978
- question: "Does data change in real-time?",
979
- yes: "L4 (Real-time Subscriptions) - 0 TTL",
980
- no: {
981
- question: "Is data page-level?",
982
- yes: "L3 (SSR Data Cache) - 1-60s TTL",
983
- no: "No cache (fetch on demand)"
984
- }
985
- }
986
- }
987
- },
988
-
989
- // Golden Rule
990
- rule: "Cache closer to definition = less context loaded. Types/interface = cached forever."
991
- }
992
- ```
993
-
994
- ### Cache Invalidation Strategies
995
-
996
- ```typescript
997
- {
998
- strategies: {
999
- // L1 & L2: Never invalidate (static types/interface)
1000
- static: {
1001
- invalidation: "None (only invalidate on deployment)",
1002
- reason: "Types and interface don't change at runtime"
1003
- },
1004
-
1005
- // L3: Time-based + event-based
1006
- ssr: {
1007
- time_based: "TTL expires → fetch fresh",
1008
- event_based: "Backend mutation → invalidate affected pages",
1009
-
1010
- example: `
1011
- // When course updated, invalidate course page cache
1012
- await provider.things.update(courseId, updates)
1013
- await cache.delete(\`course:\${courseId}\`)
1014
- `
1015
- },
1016
-
1017
- // L4: Automatic (subscription handles)
1018
- realtime: {
1019
- invalidation: "Provider pushes updates automatically",
1020
- reason: "WebSocket connection = always fresh"
1021
- }
1022
- }
1023
- }
1024
- ```
1025
-
1026
- ---
1027
-
1028
- ## Error Propagation Ontology
1029
-
1030
- ### Full Error Flow: Provider → Service → Component → UI
1031
-
1032
- ```typescript
1033
- {
1034
- errorFlow: "Provider → Service → Component → UI",
1035
-
1036
- // Level 1: Provider Errors (Effect.ts tagged errors)
1037
- providerErrors: {
1038
- ThingNotFoundError: {
1039
- _tag: "ThingNotFoundError",
1040
- fields: { thingId: string; type: ThingType },
1041
- recovery: "Show 404 page or 'Not Found' component",
1042
- httpStatus: 404
1043
- },
1044
-
1045
- UnauthorizedError: {
1046
- _tag: "UnauthorizedError",
1047
- fields: { userId?: string; requiredPermission: string },
1048
- recovery: "Redirect to /login with returnUrl",
1049
- httpStatus: 401
1050
- },
1051
-
1052
- NetworkError: {
1053
- _tag: "NetworkError",
1054
- fields: { message: string; retryable: boolean },
1055
- recovery: "Retry with exponential backoff (if retryable)",
1056
- httpStatus: 503
1057
- },
1058
-
1059
- RateLimitError: {
1060
- _tag: "RateLimitError",
1061
- fields: { retryAfter: number },
1062
- recovery: "Show 'Try again in X seconds' message",
1063
- httpStatus: 429
1064
- }
1065
- },
1066
-
1067
- // Level 2: Service Errors (Domain-specific, compose provider errors)
1068
- serviceErrors: {
1069
- pattern: "Transform provider error → domain error",
1070
-
1071
- example: `
1072
- // CourseService.ts
1073
- getCourseWithLessons(id: string) {
1074
- return Effect.gen(function* () {
1075
- const course = yield* thingService.get(id)
1076
- const lessons = yield* connectionService.getRelated(id, 'part_of', 'to')
1077
-
1078
- return { course, lessons }
1079
- }).pipe(
1080
- // Transform provider error → domain error
1081
- Effect.catchTag('ThingNotFoundError', (e) =>
1082
- Effect.fail(new CourseNotFoundError({
1083
- courseId: e.thingId,
1084
- message: \`Course \${e.thingId} not found\`
1085
- }))
1086
- )
1087
- )
1088
- }
1089
- `,
1090
-
1091
- benefits: [
1092
- "Domain-specific error vocabulary",
1093
- "Hides provider implementation details",
1094
- "Easier for frontend to handle"
1095
- ]
1096
- },
1097
-
1098
- // Level 3: Component Errors (Catch and render)
1099
- componentErrors: {
1100
- pattern: "Match error._tag → Render UI component",
1101
-
1102
- example: `
1103
- // CourseDetail.tsx
1104
- export function CourseDetail({ courseId }: Props) {
1105
- const [course, setCourse] = useState<Thing | null>(null)
1106
- const [error, setError] = useState<Error | null>(null)
1107
-
1108
- useEffect(() => {
1109
- Effect.runPromise(
1110
- courseService.getCourseWithLessons(courseId)
1111
- )
1112
- .then(result => setCourse(result.course))
1113
- .catch(e => setError(e))
1114
- }, [courseId])
1115
-
1116
- // Render based on error type
1117
- if (error) {
1118
- switch (error._tag) {
1119
- case 'CourseNotFoundError':
1120
- return <Alert variant="warning">Course not found</Alert>
1121
-
1122
- case 'UnauthorizedError':
1123
- return <Alert variant="error">Please log in to view</Alert>
1124
-
1125
- case 'NetworkError':
1126
- return <Alert variant="error">Network error. Retrying...</Alert>
1127
-
1128
- default:
1129
- return <Alert variant="error">Something went wrong</Alert>
1130
- }
1131
- }
1132
-
1133
- return <div>{/* Render course */}</div>
1134
- }
1135
- `
1136
- },
1137
-
1138
- // Level 4: UI Errors (User-facing messages)
1139
- uiErrors: {
1140
- pattern: "Error → User-friendly message + Action",
1141
-
1142
- mapping: {
1143
- ThingNotFoundError: {
1144
- message: "This {type} doesn't exist",
1145
- action: "Go back or search for another",
1146
- component: "<Alert404 />"
1147
- },
1148
-
1149
- UnauthorizedError: {
1150
- message: "You need to log in to see this",
1151
- action: "Log in or Sign up",
1152
- component: "<LoginPrompt returnUrl={currentPath} />"
1153
- },
1154
-
1155
- NetworkError: {
1156
- message: "Connection issue",
1157
- action: "Retrying automatically...",
1158
- component: "<RetryAlert retrying={true} />"
1159
- },
1160
-
1161
- RateLimitError: {
1162
- message: "Too many requests",
1163
- action: "Try again in {retryAfter} seconds",
1164
- component: "<RateLimitAlert retryAfter={error.retryAfter} />"
1165
- }
1166
- }
1167
- },
1168
-
1169
- // Error Boundary Pattern
1170
- errorBoundary: `
1171
- // ErrorBoundary.tsx
1172
- export class ErrorBoundary extends React.Component {
1173
- state = { error: null }
1174
-
1175
- static getDerivedStateFromError(error) {
1176
- return { error }
1177
- }
1178
-
1179
- render() {
1180
- if (this.state.error) {
1181
- return <ErrorFallback error={this.state.error} />
1182
- }
1183
-
1184
- return this.props.children
1185
- }
1186
- }
1187
-
1188
- // Usage: Wrap islands in error boundaries
1189
- <ErrorBoundary>
1190
- <CourseDetail client:load courseId={id} />
1191
- </ErrorBoundary>
1192
- `,
1193
-
1194
- // Golden Rule
1195
- invariant: "Every error path has explicit UI recovery. No silent failures."
1196
- }
1197
- ```
1198
-
1199
- ---
1200
-
1201
- ## Testing Ontology
1202
-
1203
- ### Three-Layer Testing Strategy
1204
-
1205
- ```typescript
1206
- {
1207
- // Layer 1: Unit Tests (Service logic with mock provider)
1208
- unitTests: {
1209
- what: "Test service logic in isolation",
1210
- mock: "MockProvider (no real backend)",
1211
- fast: "Milliseconds per test",
1212
-
1213
- example: `
1214
- // tests/unit/services/course.test.ts
1215
- import { describe, it, expect } from 'vitest'
1216
- import { Effect, Layer } from 'effect'
1217
- import { CourseService } from '@/services/CourseService'
1218
- import { DataProvider } from '@/providers/DataProvider'
1219
-
1220
- describe('CourseService.getCourseWithLessons', () => {
1221
- it('should return course with lessons', async () => {
1222
- // Mock provider
1223
- const MockProvider = Layer.succeed(DataProvider, {
1224
- things: {
1225
- get: (id) => Effect.succeed({
1226
- _id: id,
1227
- type: 'course',
1228
- name: 'Test Course'
1229
- })
1230
- },
1231
- connections: {
1232
- getRelated: (thingId, type, direction) => Effect.succeed([
1233
- { _id: 'lesson1', type: 'lesson', name: 'Lesson 1' },
1234
- { _id: 'lesson2', type: 'lesson', name: 'Lesson 2' }
1235
- ])
1236
- }
1237
- })
1238
-
1239
- // Test service
1240
- const result = await Effect.runPromise(
1241
- Effect.gen(function* () {
1242
- const service = yield* CourseService
1243
- return yield* service.getCourseWithLessons('course123')
1244
- }).pipe(Effect.provide(MockProvider))
1245
- )
1246
-
1247
- expect(result.course.name).toBe('Test Course')
1248
- expect(result.lessons).toHaveLength(2)
1249
- })
1250
-
1251
- it('should fail with CourseNotFoundError', async () => {
1252
- const MockProvider = Layer.succeed(DataProvider, {
1253
- things: {
1254
- get: (id) => Effect.fail(new ThingNotFoundError({ thingId: id }))
1255
- }
1256
- })
1257
-
1258
- const result = await Effect.runPromiseExit(
1259
- Effect.gen(function* () {
1260
- const service = yield* CourseService
1261
- return yield* service.getCourseWithLessons('invalid')
1262
- }).pipe(Effect.provide(MockProvider))
1263
- )
1264
-
1265
- expect(result._tag).toBe('Failure')
1266
- expect(result.cause.error._tag).toBe('CourseNotFoundError')
1267
- })
1268
- })
1269
- `,
1270
-
1271
- coverage: [
1272
- "Service logic (business rules)",
1273
- "Error transformations",
1274
- "Effect composition",
1275
- "Edge cases"
1276
- ]
1277
- },
1278
-
1279
- // Layer 2: Integration Tests (Service + Real Provider + Test Backend)
1280
- integrationTests: {
1281
- what: "Test service + provider + real backend",
1282
- backend: "Test Convex deployment (isolated database)",
1283
- slow: "Seconds per test (real network calls)",
1284
-
1285
- example: `
1286
- // tests/integration/course-creation.test.ts
1287
- import { describe, it, expect, beforeEach, afterEach } from 'vitest'
1288
- import { convexProvider } from '@/providers/convex'
1289
- import { CourseService } from '@/services/CourseService'
1290
-
1291
- describe('Course Creation Flow', () => {
1292
- let testProvider
1293
- let testOrgId
1294
-
1295
- beforeEach(async () => {
1296
- // Use test Convex deployment
1297
- testProvider = convexProvider({
1298
- url: process.env.TEST_CONVEX_URL
1299
- })
1300
-
1301
- // Create test org
1302
- testOrgId = await testProvider.organizations.create({
1303
- name: 'Test Org',
1304
- slug: 'test-org'
1305
- })
1306
- })
1307
-
1308
- afterEach(async () => {
1309
- // Cleanup test data
1310
- await testProvider.organizations.delete(testOrgId)
1311
- })
1312
-
1313
- it('should create course with lessons', async () => {
1314
- // Create course (real mutation)
1315
- const courseId = await testProvider.things.create({
1316
- type: 'course',
1317
- name: 'Integration Test Course',
1318
- properties: { /* thing properties */ }
1319
- })
1320
-
1321
- // Create lessons (real mutations)
1322
- const lesson1Id = await testProvider.things.create({
1323
- type: 'lesson',
1324
- name: 'Lesson 1',
1325
- properties: { /* thing properties */ }
1326
- })
1327
-
1328
- await testProvider.connections.create({
1329
- fromThingId: lesson1Id,
1330
- toThingId: courseId,
1331
- relationshipType: 'part_of'
1332
- })
1333
-
1334
- // Verify (real query)
1335
- const result = await CourseService.getCourseWithLessons(courseId)
1336
-
1337
- expect(result.course.name).toBe('Integration Test Course')
1338
- expect(result.lessons).toHaveLength(1)
1339
- expect(result.lessons[0].name).toBe('Lesson 1')
1340
- })
1341
- })
1342
- `,
1343
-
1344
- coverage: [
1345
- "Full data flow (service → provider → backend → database)",
1346
- "Real mutations and queries",
1347
- "Data consistency",
1348
- "Backend constraints"
1349
- ]
1350
- },
1351
-
1352
- // Layer 3: E2E Tests (Full UI flow in browser)
1353
- e2eTests: {
1354
- what: "Test complete user flows in browser",
1355
- tool: "Playwright (headless Chrome)",
1356
- slow: "10-30s per test (full page loads)",
1357
-
1358
- example: `
1359
- // tests/e2e/course-enrollment.spec.ts
1360
- import { test, expect } from '@playwright/test'
1361
-
1362
- test.describe('Course Enrollment Flow', () => {
1363
- test('user can enroll in course', async ({ page }) => {
1364
- // Navigate to course page
1365
- await page.goto('/courses/course123')
1366
-
1367
- // Verify course details rendered
1368
- await expect(page.locator('h1')).toContainText('Test Course')
1369
-
1370
- // Click enroll button
1371
- await page.click('button:has-text("Enroll")')
1372
-
1373
- // Wait for enrollment confirmation
1374
- await expect(page.locator('.toast')).toContainText('Enrolled successfully')
1375
-
1376
- // Verify button changed to "Go to Course"
1377
- await expect(page.locator('button')).toContainText('Go to Course')
1378
-
1379
- // Navigate to user dashboard
1380
- await page.goto('/account')
1381
-
1382
- // Verify course appears in "My Courses"
1383
- await expect(page.locator('.my-courses')).toContainText('Test Course')
1384
- })
1385
-
1386
- test('unauthorized user prompted to login', async ({ page }) => {
1387
- // Navigate as guest
1388
- await page.goto('/courses/course123')
1389
-
1390
- // Click enroll
1391
- await page.click('button:has-text("Enroll")')
1392
-
1393
- // Should redirect to login
1394
- await expect(page).toHaveURL(/\/login/)
1395
-
1396
- // Login form should have returnUrl
1397
- await expect(page.locator('form')).toHaveAttribute(
1398
- 'data-return-url',
1399
- '/courses/course123'
1400
- )
1401
- })
1402
- })
1403
- `,
1404
-
1405
- coverage: [
1406
- "User flows (click, type, navigate)",
1407
- "Visual rendering",
1408
- "Loading states",
1409
- "Error states",
1410
- "Authentication flows"
1411
- ]
1412
- },
1413
-
1414
- // Test Pyramid
1415
- pyramid: {
1416
- unit: "70% (fast, many tests, mock provider)",
1417
- integration: "20% (medium, key flows, test backend)",
1418
- e2e: "10% (slow, critical paths, real UI)"
1419
- },
1420
-
1421
- // CI/CD Strategy
1422
- cicd: {
1423
- on_pr: "Run unit + integration tests",
1424
- on_merge: "Run all tests (including E2E)",
1425
- on_deploy: "Run smoke tests (E2E critical paths)"
1426
- },
1427
-
1428
- // Golden Rule
1429
- invariant: "Mock providers for unit tests. Real providers for integration. Real UI for E2E."
1430
- }
1431
- ```
1432
-
1433
- ---
1434
-
1435
- ## Pattern Language
1436
-
1437
- ### Pattern: Backend-Agnostic Data Access
1438
-
1439
- ```typescript
1440
- {
1441
- id: "backend_agnostic_data_access",
1442
- type: DATA_PATTERN,
1443
- applicability: (thing) => thing.type === "service" || thing.type === "component",
1444
-
1445
- inputs: [DataProviderInterface],
1446
- outputs: [Data],
1447
-
1448
- transform: (operation) => ({
1449
- code: `
1450
- // Works with ANY backend (Convex, WordPress, Notion, etc.)
1451
- const provider = yield* DataProvider
1452
-
1453
- // Call ontology operation (backend translates)
1454
- const data = yield* provider.things.get(id)
1455
-
1456
- return data
1457
- `
1458
- }),
1459
-
1460
- constraints: [
1461
- "no_backend_specific_code",
1462
- "uses_provider_interface",
1463
- "effect_ts_typed"
1464
- ],
1465
-
1466
- benefits: [
1467
- "swap_backends_one_line",
1468
- "type_safe_errors",
1469
- "testable_via_mock_provider"
1470
- ]
1471
- }
1472
- ```
1473
-
1474
- ### Pattern: Generic vs Specialized Services
1475
-
1476
- ```typescript
1477
- {
1478
- id: "generic_vs_specialized_service_decision",
1479
- type: SERVICE_PATTERN,
1480
-
1481
- decision_tree: {
1482
- // Start with generic
1483
- question: "Do you need to operate on things?",
1484
- yes: {
1485
- default: "Use ThingService (handles all 66 types)",
1486
- code: `
1487
- const thingService = yield* ThingService
1488
- const course = yield* thingService.get(courseId)
1489
- const lesson = yield* thingService.get(lessonId)
1490
- `
1491
- },
1492
-
1493
- // Add specialized only if needed
1494
- question: "Do you repeat the same 2-3 operation sequence 3+ times?",
1495
- yes: {
1496
- action: "Create SpecializedService",
1497
- code: `
1498
- // CourseService.ts (OPTIONAL)
1499
- export class CourseService {
1500
- getCourseWithLessons: (id) => Effect.all([
1501
- thingService.get(id),
1502
- connectionService.getRelated(id, 'part_of', 'to')
1503
- ])
1504
- }
1505
- `
1506
- },
1507
- no: {
1508
- action: "Keep using generic services",
1509
- reason: "Don't create specialized services prematurely"
1510
- }
1511
- },
1512
-
1513
- constraints: [
1514
- "always_have_generic_services",
1515
- "specialized_services_optional",
1516
- "add_specialized_when_patterns_emerge"
1517
- ]
1518
- }
1519
- ```
1520
-
1521
- ### Pattern: Provider Swapping
1522
-
1523
- ```typescript
1524
- {
1525
- id: "provider_swapping",
1526
- type: CONFIGURATION_PATTERN,
1527
- applicability: (thing) => thing.type === "configuration",
1528
-
1529
- inputs: [ProviderConfig],
1530
- outputs: [ConfiguredProvider],
1531
-
1532
- transform: (config) => ({
1533
- // astro.config.ts
1534
- code: `
1535
- import { convexProvider } from './providers/convex'
1536
- // import { wordpressProvider } from './providers/wordpress'
1537
- // import { notionProvider } from './providers/notion'
1538
-
1539
- export default defineConfig({
1540
- integrations: [
1541
- one({
1542
- // ✅ Change this ONE line to swap backends
1543
- provider: convexProvider({
1544
- url: import.meta.env.PUBLIC_CONVEX_URL
1545
- })
1546
-
1547
- // OR use WordPress:
1548
- // provider: wordpressProvider({
1549
- // url: 'https://yoursite.com',
1550
- // apiKey: import.meta.env.WORDPRESS_API_KEY
1551
- // })
1552
- })
1553
- ]
1554
- })
1555
- `
1556
- }),
1557
-
1558
- constraints: [
1559
- "one_line_change",
1560
- "no_code_changes",
1561
- "components_unchanged"
1562
- ]
1563
- }
1564
- ```
1565
-
1566
- ### Pattern: Progressive Enhancement
1567
-
1568
- ```typescript
1569
- {
1570
- id: "progressive_enhancement",
1571
- type: UI_PATTERN,
1572
- strategy: "Start SSR, enhance with islands, add real-time last",
1573
-
1574
- // Level 1: Base (works without JS)
1575
- base: {
1576
- layer: "Astro SSR",
1577
- code: `
1578
- <form action="/api/courses/enroll" method="post">
1579
- <input type="hidden" name="courseId" value={courseId} />
1580
- <button type="submit">Enroll</button>
1581
- </form>
1582
- `,
1583
- works_without_js: true,
1584
- accessibility: "Full keyboard navigation",
1585
- seo: "Search engines can see content"
1586
- },
1587
-
1588
- // Level 2: Enhanced (adds interactivity with JS)
1589
- enhanced: {
1590
- layer: "React island",
1591
- code: `
1592
- <EnrollButton
1593
- client:load
1594
- courseId={courseId}
1595
- initialEnrolled={enrolled}
1596
- />
1597
- `,
1598
- requires_js: true,
1599
- benefit: "Optimistic UI, instant feedback, loading states",
1600
- fallback: "Form still works via SSR if JS fails"
1601
- },
1602
-
1603
- // Level 3: Real-time (live updates)
1604
- realtime: {
1605
- layer: "WebSocket subscription",
1606
- code: `
1607
- export function EnrollmentCount({ courseId }: Props) {
1608
- const count = useQuery(api.connections.getCount, {
1609
- thingId: courseId,
1610
- relationshipType: 'enrolled_in'
1611
- })
1612
- return <span>{count} enrolled</span>
1613
- }
1614
- `,
1615
- requires_js: true,
1616
- requires_subscription: true,
1617
- benefit: "Live count updates as users enroll",
1618
- fallback: "SSR shows stale count (still functional)"
1619
- },
1620
-
1621
- strategy: {
1622
- 1: "Start with SSR (universal baseline)",
1623
- 2: "Add islands for interactivity (progressive)",
1624
- 3: "Add real-time only where needed (rare)",
1625
- rule: "Each layer enhances, never replaces previous layer"
1626
- }
1627
- }
1628
- ```
1629
-
1630
- ---
1631
-
1632
- ## Type Sync Automation
1633
-
1634
- ### Automatic Frontend/Backend Type Synchronization
1635
-
1636
- ```typescript
1637
- {
1638
- principle: "Backend schema = single source of truth. Frontend derives types.",
1639
-
1640
- pipeline: {
1641
- step1: {
1642
- where: "Backend",
1643
- what: "Define schema (convex/schema.ts)",
1644
- code: `
1645
- // convex/schema.ts
1646
- import { defineSchema, defineTable } from 'convex/server'
1647
- import { v } from 'convex/values'
1648
-
1649
- export default defineSchema({
1650
- things: defineTable({
1651
- type: v.string(),
1652
- name: v.string(),
1653
- properties: v.any(),
1654
- status: v.union(
1655
- v.literal('draft'),
1656
- v.literal('published'),
1657
- v.literal('archived')
1658
- ),
1659
- createdAt: v.number(),
1660
- updatedAt: v.number()
1661
- })
1662
- })
1663
- `
1664
- },
1665
-
1666
- step2: {
1667
- where: "Backend deployment",
1668
- what: "Deploy → Auto-generate types",
1669
- command: "npx convex deploy",
1670
- generates: "convex/_generated/dataModel.d.ts",
1671
- code: `
1672
- // Auto-generated by Convex
1673
- export type Thing = {
1674
- _id: Id<'things'>
1675
- _creationTime: number
1676
- type: string
1677
- name: string
1678
- properties: any
1679
- status: 'draft' | 'published' | 'archived'
1680
- createdAt: number
1681
- updatedAt: number
1682
- }
1683
- `
1684
- },
1685
-
1686
- step3: {
1687
- where: "Frontend",
1688
- what: "Import generated types",
1689
- code: `
1690
- // src/services/ThingService.ts
1691
- import type { Id } from '@/convex/_generated/dataModel'
1692
- import type { Thing } from '@/convex/_generated/dataModel'
1693
-
1694
- export class ThingService {
1695
- get(id: Id<'things'>): Effect<Thing, Error> {
1696
- // TypeScript knows exact shape of Thing
1697
- }
1698
- }
1699
- `
1700
- },
1701
-
1702
- step4: {
1703
- where: "Development",
1704
- what: "Hot reload triggers type regeneration",
1705
- trigger: "Save convex/schema.ts",
1706
- action: "Convex dev server regenerates types",
1707
- result: "TypeScript immediately shows errors in frontend"
1708
- }
1709
- },
1710
-
1711
- validation: {
1712
- ci: {
1713
- check: "TypeScript compilation",
1714
- command: "npx astro check",
1715
- fails_if: "Frontend imports types that don't match backend schema",
1716
- result: "Can't merge PR if types mismatch"
1717
- },
1718
-
1719
- dev: {
1720
- watch: "Convex dev server watches schema changes",
1721
- regenerates: "Types on every schema save",
1722
- editor: "VS Code shows TypeScript errors instantly"
1723
- },
1724
-
1725
- deploy: {
1726
- blocks: "Can't deploy frontend if types don't match backend",
1727
- ensures: "Frontend and backend always in sync"
1728
- }
1729
- },
1730
-
1731
- benefits: [
1732
- "Single source of truth (backend schema)",
1733
- "Zero manual type definition duplication",
1734
- "Immediate feedback on type mismatches",
1735
- "Impossible to deploy mismatched types",
1736
- "Refactoring is type-safe (rename propagates)"
1737
- ],
1738
-
1739
- example_refactor: `
1740
- // Backend: Rename field
1741
- // convex/schema.ts
1742
- things: defineTable({
1743
- // name: v.string(), // OLD
1744
- title: v.string(), // NEW
1745
- })
1746
-
1747
- // Deploy: Convex regenerates types
1748
- // convex/_generated/dataModel.d.ts
1749
- export type Thing = {
1750
- title: string // Updated
1751
- }
1752
-
1753
- // Frontend: TypeScript shows errors immediately
1754
- // src/components/CourseCard.tsx
1755
- <h1>{course.name}</h1> // ❌ Error: Property 'name' doesn't exist
1756
- <h1>{course.title}</h1> // ✅ Fixed
1757
-
1758
- // Result: Refactor is type-safe, can't forget any references
1759
- `,
1760
-
1761
- invariant: "Backend schema → Generated types → Frontend imports. Never manual sync."
1762
- }
1763
- ```
1764
-
1765
- ---
1766
-
1767
- ## Observability Layer
1768
-
1769
- ### Four-Pillar Observability Strategy
1770
-
1771
- ```typescript
1772
- {
1773
- // Pillar 1: Provider Call Observability
1774
- provider_calls: {
1775
- what: "Track every provider operation",
1776
- metrics: [
1777
- "Duration (p50, p95, p99)",
1778
- "Success rate (%)",
1779
- "Error types (grouped by _tag)",
1780
- "Throughput (ops/sec)"
1781
- ],
1782
-
1783
- implementation: `
1784
- // Wrap provider with observability layer
1785
- class ObservableProvider implements DataProviderInterface {
1786
- constructor(
1787
- private provider: DataProviderInterface,
1788
- private logger: Logger
1789
- ) {}
1790
-
1791
- things = {
1792
- get: (id) => {
1793
- const start = Date.now()
1794
-
1795
- return this.provider.things.get(id).pipe(
1796
- Effect.tap(() => {
1797
- const duration = Date.now() - start
1798
- this.logger.info('provider.things.get', {
1799
- thingId: id,
1800
- duration,
1801
- success: true
1802
- })
1803
- }),
1804
- Effect.tapError((error) => {
1805
- const duration = Date.now() - start
1806
- this.logger.error('provider.things.get', {
1807
- thingId: id,
1808
- duration,
1809
- error: error._tag,
1810
- success: false
1811
- })
1812
- })
1813
- )
1814
- }
1815
- }
1816
- }
1817
- `,
1818
-
1819
- alerts: [
1820
- "Slow queries (>2s p95)",
1821
- "High error rate (>5% over 5min)",
1822
- "Specific error spikes (e.g., UnauthorizedError >10/min)"
1823
- ]
1824
- },
1825
-
1826
- // Pillar 2: Context Usage Observability
1827
- context_usage: {
1828
- what: "Track AI context loading per request",
1829
- metrics: [
1830
- "Tokens loaded (by category: types, patterns, examples)",
1831
- "Total context size",
1832
- "Context budget utilization (%)",
1833
- "Cache hit rate (%)"
1834
- ],
1835
-
1836
- implementation: `
1837
- class ContextManager {
1838
- private usage = {
1839
- types: 0,
1840
- patterns: 0,
1841
- examples: 0,
1842
- total: 0
1843
- }
1844
-
1845
- addContext(category, content) {
1846
- const tokens = estimateTokens(content)
1847
- this.usage[category] += tokens
1848
- this.usage.total += tokens
1849
-
1850
- // Log to observability
1851
- logger.info('context.added', {
1852
- category,
1853
- tokens,
1854
- total: this.usage.total,
1855
- utilization: this.usage.total / BUDGET.total
1856
- })
1857
- }
1858
-
1859
- getReport() {
1860
- return {
1861
- ...this.usage,
1862
- budget: BUDGET.total,
1863
- utilization: (this.usage.total / BUDGET.total) * 100,
1864
- remaining: BUDGET.total - this.usage.total
1865
- }
1866
- }
1867
- }
1868
- `,
1869
-
1870
- alerts: [
1871
- "Context budget exceeded (>5k tokens)",
1872
- "Utilization >80% (approaching limit)",
1873
- "Cache miss rate >20% (inefficient loading)"
1874
- ]
1875
- },
1876
-
1877
- // Pillar 3: Cache Efficiency Observability
1878
- cache_efficiency: {
1879
- what: "Track cache performance",
1880
- metrics: [
1881
- "Hit rate (%) by cache tier (L1, L2, L3, L4)",
1882
- "Miss count (absolute)",
1883
- "Eviction rate (items evicted/sec)",
1884
- "Cache size (MB)"
1885
- ],
1886
-
1887
- implementation: `
1888
- class ObservableCache<K, V> {
1889
- private hits = 0
1890
- private misses = 0
1891
- private cache = new Map<K, V>()
1892
-
1893
- get(key: K): V | undefined {
1894
- if (this.cache.has(key)) {
1895
- this.hits++
1896
- logger.info('cache.hit', {
1897
- key,
1898
- hitRate: this.hitRate()
1899
- })
1900
- return this.cache.get(key)
1901
- } else {
1902
- this.misses++
1903
- logger.info('cache.miss', {
1904
- key,
1905
- hitRate: this.hitRate()
1906
- })
1907
- return undefined
1908
- }
1909
- }
1910
-
1911
- hitRate() {
1912
- return this.hits / (this.hits + this.misses)
1913
- }
1914
-
1915
- getStats() {
1916
- return {
1917
- hits: this.hits,
1918
- misses: this.misses,
1919
- hitRate: this.hitRate(),
1920
- size: this.cache.size
1921
- }
1922
- }
1923
- }
1924
- `,
1925
-
1926
- alerts: [
1927
- "L1 hit rate <95% (type cache should be near 100%)",
1928
- "L3 hit rate <60% (SSR cache not effective)",
1929
- "Cache size >100MB (memory pressure)"
1930
- ]
1931
- },
1932
-
1933
- // Pillar 4: Page Performance Observability
1934
- page_performance: {
1935
- what: "Track Core Web Vitals + custom metrics",
1936
- metrics: [
1937
- "TTFB (Time To First Byte)",
1938
- "FCP (First Contentful Paint)",
1939
- "LCP (Largest Contentful Paint)",
1940
- "CLS (Cumulative Layout Shift)",
1941
- "FID (First Input Delay)",
1942
- "Provider call duration (frontend metric)"
1943
- ],
1944
-
1945
- implementation: `
1946
- // Client-side performance tracking
1947
- // src/lib/observability.ts
1948
- export function trackPagePerformance() {
1949
- // Core Web Vitals
1950
- if ('web-vital' in window) {
1951
- getCLS(sendToAnalytics)
1952
- getFID(sendToAnalytics)
1953
- getLCP(sendToAnalytics)
1954
- }
1955
-
1956
- // Custom: Provider call timing
1957
- performance.measure('provider-call', {
1958
- start: 'provider-start',
1959
- end: 'provider-end'
1960
- })
1961
-
1962
- const measure = performance.getEntriesByName('provider-call')[0]
1963
- sendToAnalytics({
1964
- metric: 'provider_call_duration',
1965
- value: measure.duration
1966
- })
1967
- }
1968
-
1969
- function sendToAnalytics(metric) {
1970
- fetch('/api/analytics', {
1971
- method: 'POST',
1972
- body: JSON.stringify(metric)
1973
- })
1974
- }
1975
- `,
1976
-
1977
- cloudflare_analytics: {
1978
- what: "Built-in Cloudflare Pages Analytics",
1979
- tracks: ["TTFB", "FCP", "LCP", "requests/sec", "bandwidth"],
1980
- dashboard: "Cloudflare Pages dashboard → Analytics tab"
1981
- },
1982
-
1983
- alerts: [
1984
- "LCP >2.5s (bad user experience)",
1985
- "CLS >0.1 (layout shift)",
1986
- "TTFB >800ms (slow backend)"
1987
- ]
1988
- },
1989
-
1990
- // Event Emission Pattern
1991
- eventEmission: {
1992
- pattern: "Every significant operation emits event to backend",
1993
-
1994
- example: `
1995
- // Frontend calls provider
1996
- const course = await provider.things.get(courseId)
1997
-
1998
- // Provider logs event (backend receives)
1999
- await provider.events.log({
2000
- type: 'provider_query',
2001
- actorId: userId,
2002
- targetId: courseId,
2003
- timestamp: Date.now(),
2004
- metadata: {
2005
- operation: 'things.get',
2006
- duration: 123,
2007
- success: true,
2008
- provider: 'convex'
2009
- }
2010
- })
2011
-
2012
- // Backend stores in events table
2013
- // Dashboard can query: "Show all provider queries today"
2014
- `,
2015
-
2016
- benefits: [
2017
- "Full audit trail of all operations",
2018
- "Query events to debug issues",
2019
- "Aggregate metrics from events",
2020
- "Events table = observability database"
2021
- ]
2022
- },
2023
-
2024
- // Dashboards
2025
- dashboards: {
2026
- realtime: {
2027
- tool: "Convex Dashboard or custom React dashboard",
2028
- queries: [
2029
- "Provider call rate (last 1 hour)",
2030
- "Error rate by type (last 1 hour)",
2031
- "Cache hit rate (last 1 hour)",
2032
- "Top slow queries (p95 >2s)"
2033
- ]
2034
- },
2035
-
2036
- historical: {
2037
- tool: "Cloudflare Analytics + custom aggregations",
2038
- queries: [
2039
- "Page performance trends (last 30 days)",
2040
- "Provider call trends (last 30 days)",
2041
- "Error trends by type (last 30 days)",
2042
- "Cache efficiency trends (last 30 days)"
2043
- ]
2044
- }
2045
- },
2046
-
2047
- // Golden Rule
2048
- invariant: "Observe everything. Log to events. Query events for debugging. Alert on anomalies."
2049
- }
2050
- ```
2051
-
2052
- ---
2053
-
2054
- ## Agent Task Mapping
2055
-
2056
- ### Frontend-Specific Agent Responsibilities
2057
-
2058
- ```typescript
2059
- {
2060
- agents: {
2061
- "frontend-service-agent": {
2062
- creates: ["Effect.ts services"],
2063
- outputs: [
2064
- "src/services/ThingService.ts",
2065
- "src/services/ConnectionService.ts",
2066
- "src/services/[Domain]Service.ts (optional)"
2067
- ],
2068
- coordination: "Autonomous (parallel with provider-agent)"
2069
- },
2070
-
2071
- "frontend-provider-agent": {
2072
- creates: ["DataProvider implementations"],
2073
- outputs: [
2074
- "src/providers/convex/ConvexProvider.ts",
2075
- "src/providers/wordpress/WordPressProvider.ts",
2076
- "src/providers/[backend]/Provider.ts"
2077
- ],
2078
- coordination: "Autonomous (parallel with service-agent)"
2079
- },
2080
-
2081
- "frontend-page-agent": {
2082
- creates: ["Astro SSR pages"],
2083
- outputs: [
2084
- "src/pages/[thing]/index.astro",
2085
- "src/pages/[thing]/[id].astro"
2086
- ],
2087
- coordination: "Waits for service-agent (reads task_completed events)"
2088
- },
2089
-
2090
- "frontend-component-agent": {
2091
- creates: ["React islands (interactive components)"],
2092
- outputs: [
2093
- "src/components/features/[thing]/[Component].tsx"
2094
- ],
2095
- coordination: "Parallel with page-agent (both wait for service-agent)"
2096
- },
2097
-
2098
- "frontend-test-agent": {
2099
- creates: ["Unit, integration, and E2E tests"],
2100
- outputs: [
2101
- "tests/unit/services/[name].test.ts",
2102
- "tests/integration/[flow].test.ts",
2103
- "tests/e2e/[flow].spec.ts"
2104
- ],
2105
- coordination: "Waits for ALL agents (service, provider, page, component)"
2106
- }
2107
- },
2108
-
2109
- // Event-driven coordination (from workflow.md)
2110
- coordination_mechanism: {
2111
- type: "Events table (ontology IS the message bus)",
2112
-
2113
- pattern: `
2114
- // Agent completes → Emits event
2115
- await logEvent({
2116
- type: 'task_completed',
2117
- actorId: 'frontend-service-agent',
2118
- targetId: 'task_id',
2119
- metadata: { files: [...] }
2120
- })
2121
-
2122
- // Dependent agent → Queries events
2123
- const completed = await queryEvents({
2124
- type: 'task_completed',
2125
- actorId: 'frontend-service-agent'
2126
- })
2127
-
2128
- if (completed) {
2129
- // Proceed with task
2130
- }
2131
- `
2132
- },
2133
-
2134
- // Parallel execution (from workflow.md)
2135
- execution_model: {
2136
- services_layer: {
2137
- agents: ["frontend-service-agent", "frontend-provider-agent"],
2138
- parallelism: "Both start simultaneously",
2139
- coordination: "Autonomous (no dependencies)"
2140
- },
2141
-
2142
- ui_layer: {
2143
- agents: ["frontend-page-agent", "frontend-component-agent"],
2144
- parallelism: "Both start after services complete",
2145
- coordination: "Both wait for service-agent events"
2146
- },
2147
-
2148
- testing_layer: {
2149
- agents: ["frontend-test-agent"],
2150
- parallelism: "Starts after all implementation complete",
2151
- coordination: "Waits for all agents"
2152
- }
2153
- }
2154
- }
2155
- ```
2156
-
2157
- ---
2158
-
2159
- ## Common Mistakes
2160
-
2161
- ### Top 10 Anti-Patterns to Avoid
2162
-
2163
- ```typescript
2164
- {
2165
- // Mistake 1: Coupling to specific provider
2166
- mistake1: {
2167
- problem: "Importing Convex directly in frontend code",
2168
- bad: `
2169
- // ❌ BAD
2170
- import { ConvexClient } from 'convex/browser'
2171
- const client = new ConvexClient(url)
2172
- const course = await client.query(api.courses.get, { id })
2173
- `,
2174
- good: `
2175
- // ✅ GOOD
2176
- const provider = yield* DataProvider
2177
- const course = yield* provider.things.get(id)
2178
- `,
2179
- why: "Bad code breaks when you swap backends. Good code works with ANY backend."
2180
- },
2181
-
2182
- // Mistake 2: Creating specialized services prematurely
2183
- mistake2: {
2184
- problem: "Creating CourseService before patterns emerge",
2185
- bad: `
2186
- // ❌ BAD (created after 1 use)
2187
- class CourseService {
2188
- getCourseWithLessons(id) {
2189
- // Used once, doesn't justify specialized service
2190
- }
2191
- }
2192
- `,
2193
- good: `
2194
- // ✅ GOOD (use generic services until pattern repeats 3+ times)
2195
- const course = yield* thingService.get(id)
2196
- const lessons = yield* connectionService.getRelated(id, 'part_of', 'to')
2197
-
2198
- // Only create CourseService after repeating this 3+ times
2199
- `,
2200
- why: "Premature abstraction creates unnecessary complexity. Wait for patterns."
2201
- },
2202
-
2203
- // Mistake 3: Loading too much context
2204
- mistake3: {
2205
- problem: "Loading entire codebase for AI generation",
2206
- bad: `
2207
- // ❌ BAD
2208
- const context = {
2209
- allFiles: loadFiles('**/*.ts'), // 200k tokens
2210
- allDocs: loadDocs(), // 50k tokens
2211
- allExamples: loadExamples() // 30k tokens
2212
- } // 280k tokens
2213
- `,
2214
- good: `
2215
- // ✅ GOOD
2216
- const context = {
2217
- interface: DataProviderInterface, // 300 tokens
2218
- pattern: servicePattern // 400 tokens
2219
- } // 700 tokens (99.7% reduction)
2220
- `,
2221
- why: "Context explosion wastes time and money. Load only what's needed."
2222
- },
2223
-
2224
- // Mistake 4: Duplicating server state in frontend
2225
- mistake4: {
2226
- problem: "Storing backend data in useState",
2227
- bad: `
2228
- // ❌ BAD
2229
- const [courses, setCourses] = useState([])
2230
- useEffect(() => {
2231
- provider.things.list({ type: 'course' })
2232
- .then(setCourses)
2233
- }, [])
2234
- `,
2235
- good: `
2236
- // ✅ GOOD
2237
- const courses = useQuery(api.courses.list)
2238
- // Provider handles caching, no state duplication
2239
- `,
2240
- why: "Duplicating state creates sync issues. Let provider handle caching."
2241
- },
2242
-
2243
- // Mistake 5: Not handling error states
2244
- mistake5: {
2245
- problem: "No UI for errors",
2246
- bad: `
2247
- // ❌ BAD
2248
- const course = await provider.things.get(id)
2249
- return <div>{course.name}</div>
2250
- // What if course is undefined? No error handling!
2251
- `,
2252
- good: `
2253
- // ✅ GOOD
2254
- try {
2255
- const course = await provider.things.get(id)
2256
- return <div>{course.name}</div>
2257
- } catch (error) {
2258
- if (error._tag === 'ThingNotFoundError') {
2259
- return <Alert>Course not found</Alert>
2260
- }
2261
- return <Alert>Error loading course</Alert>
2262
- }
2263
- `,
2264
- why: "Errors WILL happen. Always have UI for error states."
2265
- },
2266
-
2267
- // Mistake 6: Manual group filtering
2268
- mistake6: {
2269
- problem: "Manually filtering by groupId",
2270
- bad: `
2271
- // ❌ BAD
2272
- const courses = await provider.things.list({
2273
- type: 'course',
2274
- groupId: ctx.locals.groupId // Manual filtering
2275
- })
2276
- `,
2277
- good: `
2278
- // ✅ GOOD
2279
- const courses = await provider.things.list({ type: 'course' })
2280
- // Provider auto-injects groupId
2281
- `,
2282
- why: "Provider enforces multi-tenancy. Frontend shouldn't know about groups."
2283
- },
2284
-
2285
- // Mistake 7: Not caching type definitions
2286
- mistake7: {
2287
- problem: "Loading type definitions on every request",
2288
- bad: `
2289
- // ❌ BAD
2290
- async function generateCode(type) {
2291
- const typeDef = await loadTypeFromFile(type) // Loads from disk every time
2292
- return ai.generate(task, { type: typeDef })
2293
- }
2294
- `,
2295
- good: `
2296
- // ✅ GOOD
2297
- const typeCache = new Map()
2298
-
2299
- async function generateCode(type) {
2300
- if (!typeCache.has(type)) {
2301
- typeCache.set(type, await loadTypeFromFile(type)) // Load once
2302
- }
2303
- return ai.generate(task, { type: typeCache.get(type) })
2304
- }
2305
- `,
2306
- why: "Type definitions never change at runtime. Cache forever."
2307
- },
2308
-
2309
- // Mistake 8: Skipping progressive enhancement
2310
- mistake8: {
2311
- problem: "JavaScript-only forms (don't work without JS)",
2312
- bad: `
2313
- // ❌ BAD
2314
- <button onClick={() => enroll()}>Enroll</button>
2315
- // Doesn't work if JS fails to load
2316
- `,
2317
- good: `
2318
- // ✅ GOOD
2319
- <form action="/api/enroll" method="post">
2320
- <button type="submit">Enroll</button>
2321
- </form>
2322
- // Works with or without JS
2323
-
2324
- // Then enhance with JS:
2325
- <EnrollButton client:load /> // Adds optimistic UI
2326
- `,
2327
- why: "Always start with working HTML. JavaScript should enhance, not enable."
2328
- },
2329
-
2330
- // Mistake 9: Not testing with mock providers
2331
- mistake9: {
2332
- problem: "Testing with real backend (slow, flaky)",
2333
- bad: `
2334
- // ❌ BAD
2335
- test('gets course', async () => {
2336
- const course = await service.get('real_id_from_db')
2337
- // Depends on real database state
2338
- })
2339
- `,
2340
- good: `
2341
- // ✅ GOOD
2342
- test('gets course', async () => {
2343
- const MockProvider = Layer.succeed(DataProvider, {
2344
- things: { get: (id) => Effect.succeed(mockCourse) }
2345
- })
2346
-
2347
- const course = await service.get('any_id')
2348
- .pipe(Effect.provide(MockProvider))
2349
- // Fast, deterministic, no database
2350
- })
2351
- `,
2352
- why: "Unit tests should be fast and deterministic. Use mocks."
2353
- },
2354
-
2355
- // Mistake 10: Ignoring type sync
2356
- mistake10: {
2357
- problem: "Manually duplicating backend types in frontend",
2358
- bad: `
2359
- // ❌ BAD
2360
- // frontend/types.ts
2361
- type Course = {
2362
- id: string
2363
- title: string
2364
- // Manually copied from backend
2365
- }
2366
- `,
2367
- good: `
2368
- // ✅ GOOD
2369
- import type { Thing } from '@/convex/_generated/dataModel'
2370
- // Auto-synced from backend schema
2371
- `,
2372
- why: "Manual type sync breaks. Use generated types from backend."
2373
- }
2374
- }
2375
- ```
2376
-
2377
- ---
2378
-
2379
- ## Summary
2380
-
2381
- ### Ontology Evolution
2382
-
2383
- **Version 4.0.0 Additions:**
2384
-
2385
- - **Provider as Context Loader** - 99.9% context reduction via interface abstraction
2386
- - **Multi-Tenant Architecture** - Subdomain-based org isolation enforced by provider
2387
- - **4-Tier Caching** - Type definitions, interface, SSR data, real-time subscriptions
2388
- - **State Management Hierarchy** - Server, SSR, Island, Shared (4 layers)
2389
- - **Error Propagation** - Provider → Service → Component → UI (typed errors)
2390
- - **Testing Ontology** - Unit (mock), Integration (real backend), E2E (browser)
2391
- - **Progressive Enhancement** - SSR → Islands → Real-time (3 layers)
2392
- - **Type Sync Automation** - Backend schema → Generated types → Frontend imports
2393
- - **Observability Layer** - Provider calls, context usage, cache efficiency, page performance
2394
- - **Agent Task Mapping** - Event-driven parallel execution with simplified coordination
2395
-
2396
- ### Key Metrics
2397
-
2398
- | Metric | v3.0.0 | v4.0.0 | Improvement |
2399
- | ----------------------- | ---------------------- | -------------------------------------- | ---------------------- |
2400
- | **Context per request** | 50k-300k tokens | 300-5k tokens | **99%+ reduction** |
2401
- | **Backend coupling** | High (Convex-specific) | Zero (provider abstraction) | **Infinite backends** |
2402
- | **Caching strategy** | Undefined | 4-tier (L1-L4) | **80-95% fewer calls** |
2403
- | **Error handling** | Basic | Full propagation | **100% coverage** |
2404
- | **Testing strategy** | Ad-hoc | 3-layer (unit/int/e2e) | **Systematic** |
2405
- | **State management** | Unclear | 4-layer hierarchy | **No duplication** |
2406
- | **Observability** | None | 4-pillar (calls, context, cache, perf) | **Full visibility** |
2407
- | **Agent coordination** | Sequential | Parallel (event-driven) | **5x faster** |
2408
-
2409
- ### Derivation Power
2410
-
2411
- ```
2412
- From minimal axioms:
2413
- 7 axioms (v4.0.0)
2414
- + DataProviderInterface
2415
- + 4-tier caching
2416
- + 4-layer state management
2417
- + Error propagation ontology
2418
- + Testing ontology
2419
- + Observability layer
2420
- →
2421
- ∞ implementations × ∞ backends × ∞ caching strategies
2422
- ```
2423
-
2424
- ### Context Engineering Results
2425
-
2426
- **Traditional approach:**
2427
-
2428
- - Load: 50k-300k tokens per request
2429
- - Cost: $0.50-$3.00 per request
2430
- - Speed: 30-60 seconds
2431
- - Backends: 1 (tightly coupled)
2432
-
2433
- **Ontology-driven approach (v4.0.0):**
2434
-
2435
- - Load: 300-5k tokens per request (98-99% reduction)
2436
- - Cost: $0.003-$0.05 per request (100x cheaper)
2437
- - Speed: 2-5 seconds (10x faster)
2438
- - Backends: ∞ (swap with 1 line)
2439
-
2440
- ### Properties
2441
-
2442
- - ✅ **Minimal**: Smallest set of axioms for complete expressiveness
2443
- - ✅ **Complete**: Derives all implementations for all backends
2444
- - ✅ **Consistent**: No contradictions
2445
- - ✅ **Composable**: Clear composition algebra
2446
- - ✅ **Formal**: Mathematically rigorous
2447
- - ✅ **Practical**: AI-executable
2448
- - ✅ **Flexible**: Works with ANY backend
2449
- - ✅ **Observable**: Full instrumentation
2450
- - ✅ **Testable**: 3-layer testing strategy
2451
- - ✅ **Performant**: 4-tier caching, 98%+ context reduction
2452
-
2453
- ### Usage Flow (v4.0.0)
2454
-
2455
- ```
2456
- Agent receives task:
2457
- 1. Load type definition [L1 cache: instant]
2458
- 2. Load DataProviderInterface [L2 cache: instant]
2459
- 3. Load pattern [context-engineering: just-in-time]
2460
- 4. Generate backend-agnostic code
2461
- 5. Validate: No backend-specific imports
2462
- 6. Write tests (mock provider for unit tests)
2463
- 7. Emit events (coordination via ontology)
2464
- 8. Observe metrics (provider calls, context usage, cache hits)
2465
-
2466
- Total context: Minimal (vs 280k traditional)
2467
- Result: Code works with Convex, WordPress, Notion, Supabase, etc.
2468
- Performance: 98%+ context reduction, 10x faster, 100x cheaper
2469
- ```
2470
-
2471
- ---
2472
-
2473
- **The ontology is executable. Types are the program. Backends are interchangeable. Context is minimal. Everything is observable.**
2474
-
2475
- **v4.0.0: Complete backend agnosticism + context engineering + observability + event-driven coordination = The future of frontend development.**