oneie 2.0.1 → 2.0.3

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 (406) hide show
  1. package/AGENTS.md +245 -0
  2. package/CLAUDE.md +534 -0
  3. package/README.md +61 -4
  4. package/one/.obsidian/app.json +1 -0
  5. package/one/.obsidian/appearance.json +1 -0
  6. package/one/.obsidian/core-plugins.json +33 -0
  7. package/one/.obsidian/workspace.json +211 -0
  8. package/one/connections/a2a.md +551 -0
  9. package/one/connections/acp.md +761 -0
  10. package/one/connections/acps.md +731 -0
  11. package/one/connections/agui.md +767 -0
  12. package/one/connections/any-backend.md +1702 -0
  13. package/one/connections/ap2.md +998 -0
  14. package/one/connections/api-docs.md +1891 -0
  15. package/one/connections/api.md +2190 -0
  16. package/one/connections/architecture-diagram.md +94 -0
  17. package/one/connections/communications.md +449 -0
  18. package/one/connections/connections.md +339 -0
  19. package/one/connections/cryptonetworks.md +781 -0
  20. package/one/connections/documentation.md +1120 -0
  21. package/one/connections/effect.md +279 -0
  22. package/one/connections/elizaos.md +1290 -0
  23. package/one/connections/inference.md +58 -0
  24. package/one/connections/kyc.md +632 -0
  25. package/one/connections/mcp.md +842 -0
  26. package/one/connections/membership.md +1152 -0
  27. package/one/connections/middleware.md +1067 -0
  28. package/one/connections/multitenant.md +1341 -0
  29. package/one/connections/n8n.md +1015 -0
  30. package/one/connections/patterns.md +89 -0
  31. package/one/connections/protocols.md +279 -0
  32. package/one/connections/relationships.md +107 -0
  33. package/one/connections/schema.md +587 -0
  34. package/one/connections/service-layer.md +550 -0
  35. package/one/connections/structure.md +0 -0
  36. package/one/connections/vectors.md +207 -0
  37. package/one/connections/wordpress.md +1302 -0
  38. package/one/connections/workflow-copy.md +905 -0
  39. package/one/connections/workflow-examples.md +741 -0
  40. package/one/connections/workflow.md +905 -0
  41. package/one/connections/workflows/delegation.md +885 -0
  42. package/one/connections/workflows/frontend.md +1037 -0
  43. package/one/connections/workflows/strategy.md +903 -0
  44. package/one/connections/workflows/tasks.md +698 -0
  45. package/one/connections/x402.md +1249 -0
  46. package/one/events/events.md +545 -0
  47. package/one/knowledge/ai-platform.md +305 -0
  48. package/one/knowledge/architecture-diagram.md +94 -0
  49. package/one/knowledge/architecture-frontend.md +930 -0
  50. package/one/knowledge/architecture.md +2077 -0
  51. package/one/knowledge/crypto.md +960 -0
  52. package/one/knowledge/dsl.md +1660 -0
  53. package/one/knowledge/files.md +2471 -0
  54. package/one/knowledge/frontend.md +1038 -0
  55. package/one/knowledge/hono.md +2109 -0
  56. package/one/knowledge/implementation-examples.md +2536 -0
  57. package/one/knowledge/inference-score.md +159 -0
  58. package/one/knowledge/knowledge.md +642 -0
  59. package/one/knowledge/language.md +980 -0
  60. package/one/knowledge/lessons-learned.md +70 -0
  61. package/one/knowledge/ontology-6-dimensions.md +0 -0
  62. package/one/knowledge/ontology-documentation.md +356 -0
  63. package/one/knowledge/ontology-engineering-specification.md +1292 -0
  64. package/one/knowledge/ontology-engineering.md +1652 -0
  65. package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
  66. package/one/knowledge/ontology-frontend-copy.md +753 -0
  67. package/one/knowledge/ontology-frontend-specifications.md +2188 -0
  68. package/one/knowledge/ontology-frontend.md +2427 -0
  69. package/one/knowledge/ontology-minimal.yaml +299 -0
  70. package/one/knowledge/ontology.md +2819 -0
  71. package/one/knowledge/ontology.yaml +1165 -0
  72. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
  73. package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
  74. package/one/knowledge/patterns/backend/mutation-template.md +231 -0
  75. package/one/knowledge/patterns/backend/query-template.md +267 -0
  76. package/one/knowledge/patterns/backend/service-template.md +237 -0
  77. package/one/knowledge/patterns/design/component-architecture.md +399 -0
  78. package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
  79. package/one/knowledge/patterns/design/wireframe-template.md +216 -0
  80. package/one/knowledge/patterns/frontend/component-template.md +195 -0
  81. package/one/knowledge/patterns/frontend/form-template.md +276 -0
  82. package/one/knowledge/patterns/frontend/page-template.md +178 -0
  83. package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
  84. package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
  85. package/one/knowledge/patterns/test/technical-test-template.md +544 -0
  86. package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
  87. package/one/knowledge/patterns/test/user-flow-template.md +254 -0
  88. package/one/knowledge/quality-loop.md +401 -0
  89. package/one/knowledge/readme.md +131 -0
  90. package/one/knowledge/rules.md +626 -0
  91. package/one/knowledge/score.md +67 -0
  92. package/one/knowledge/specifications.md +855 -0
  93. package/one/knowledge/tags.md +130 -0
  94. package/one/organisation/one.md +599 -0
  95. package/one/organisation/organisation.md +438 -0
  96. package/one/organisation/revenue.md +673 -0
  97. package/one/organisation/strategy.md +869 -0
  98. package/one/organisation/vision.md +98 -0
  99. package/one/people/anthony-o-connell.md +440 -0
  100. package/one/people/people.md +567 -0
  101. package/one/repomix-output.md +92634 -0
  102. package/one/things/agentkit.md +349 -0
  103. package/one/things/agents/agent-backend.md +1401 -0
  104. package/one/things/agents/agent-builder.md +955 -0
  105. package/one/things/agents/agent-clean.md +709 -0
  106. package/one/things/agents/agent-clone.md +1341 -0
  107. package/one/things/agents/agent-designer.md +2177 -0
  108. package/one/things/agents/agent-director.md +1508 -0
  109. package/one/things/agents/agent-documenter.md +1049 -0
  110. package/one/things/agents/agent-frontend.md +1119 -0
  111. package/one/things/agents/agent-integrator.md +1192 -0
  112. package/one/things/agents/agent-problem-solver.md +1379 -0
  113. package/one/things/agents/agent-quality.md +1353 -0
  114. package/one/things/agents/agent-sales.md +986 -0
  115. package/one/things/cascade/cascade.yaml +464 -0
  116. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
  117. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
  118. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
  119. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
  120. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
  121. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
  122. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
  123. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
  124. package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
  125. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
  126. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
  127. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
  128. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
  129. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
  130. package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
  131. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
  132. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
  133. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
  134. package/one/things/cascade/docs/examples/readme.md +222 -0
  135. package/one/things/cascade/docs/getting-started.md +515 -0
  136. package/one/things/cascade/docs/workflow.md +1372 -0
  137. package/one/things/cascade/readme.md +336 -0
  138. package/one/things/cascade/templates/feature-template.md +267 -0
  139. package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
  140. package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
  141. package/one/things/claude/agents/analyst.md +483 -0
  142. package/one/things/claude/agents/architect.md +480 -0
  143. package/one/things/claude/agents/brand-identity-specialist.md +513 -0
  144. package/one/things/claude/agents/bstp-token-strategist.md +667 -0
  145. package/one/things/claude/agents/builder-repo.md +489 -0
  146. package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
  147. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
  148. package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
  149. package/one/things/claude/agents/company-bullstamp-character.md +587 -0
  150. package/one/things/claude/agents/company-bullstamp-community.md +292 -0
  151. package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
  152. package/one/things/claude/agents/company-bullstamp-token.md +292 -0
  153. package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
  154. package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
  155. package/one/things/claude/agents/content-calendar-planner.md +448 -0
  156. package/one/things/claude/agents/content-chapter-formatter.md +488 -0
  157. package/one/things/claude/agents/content-formatter.md +546 -0
  158. package/one/things/claude/agents/content-hook-specialist.md +462 -0
  159. package/one/things/claude/agents/content-image-formatter.md +535 -0
  160. package/one/things/claude/agents/content-introduction-formatter.md +485 -0
  161. package/one/things/claude/agents/content-multiplication-engine.md +556 -0
  162. package/one/things/claude/agents/content-playbook-writer.md +448 -0
  163. package/one/things/claude/agents/content-team-manager.md +622 -0
  164. package/one/things/claude/agents/content-toc-formatter.md +522 -0
  165. package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
  166. package/one/things/claude/agents/core-manager.md +582 -0
  167. package/one/things/claude/agents/core-master.md +403 -0
  168. package/one/things/claude/agents/cross-functional-manager.md +471 -0
  169. package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
  170. package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
  171. package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
  172. package/one/things/claude/agents/crypto-community-analyst.md +298 -0
  173. package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
  174. package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
  175. package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
  176. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
  177. package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
  178. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
  179. package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
  180. package/one/things/claude/agents/crypto-market-researcher.md +292 -0
  181. package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
  182. package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
  183. package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
  184. package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
  185. package/one/things/claude/agents/crypto-team-manager.md +387 -0
  186. package/one/things/claude/agents/crypto-token-analyst.md +278 -0
  187. package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
  188. package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
  189. package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
  190. package/one/things/claude/agents/customer-journey-designer.md +481 -0
  191. package/one/things/claude/agents/customer-success-manager.md +581 -0
  192. package/one/things/claude/agents/dev.md +413 -0
  193. package/one/things/claude/agents/documenter.md +546 -0
  194. package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
  195. package/one/things/claude/agents/engagement-specialist.md +509 -0
  196. package/one/things/claude/agents/engineering-architect.md +387 -0
  197. package/one/things/claude/agents/engineering-business-analyst.md +537 -0
  198. package/one/things/claude/agents/engineering-developer.md +387 -0
  199. package/one/things/claude/agents/engineering-director.md +282 -0
  200. package/one/things/claude/agents/engineering-ingestor.md +649 -0
  201. package/one/things/claude/agents/engineering-product-manager.md +537 -0
  202. package/one/things/claude/agents/engineering-product-owner.md +537 -0
  203. package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
  204. package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
  205. package/one/things/claude/agents/engineering-team-manager.md +512 -0
  206. package/one/things/claude/agents/engineering-user-experience.md +387 -0
  207. package/one/things/claude/agents/framework-elevate-manager.md +294 -0
  208. package/one/things/claude/agents/improver.md +763 -0
  209. package/one/things/claude/agents/intelligence-team-manager.md +385 -0
  210. package/one/things/claude/agents/lead-capture-expert.md +466 -0
  211. package/one/things/claude/agents/lead-magnet-creator.md +453 -0
  212. package/one/things/claude/agents/market-research-analyst.md +412 -0
  213. package/one/things/claude/agents/marketing-brand-identity.md +314 -0
  214. package/one/things/claude/agents/marketing-content-hooks.md +450 -0
  215. package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
  216. package/one/things/claude/agents/marketing-content-poster.md +361 -0
  217. package/one/things/claude/agents/marketing-customer-journey.md +326 -0
  218. package/one/things/claude/agents/marketing-director.md +397 -0
  219. package/one/things/claude/agents/marketing-engagement.md +326 -0
  220. package/one/things/claude/agents/marketing-lead-capture.md +326 -0
  221. package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
  222. package/one/things/claude/agents/marketing-network-effects.md +326 -0
  223. package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
  224. package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
  225. package/one/things/claude/agents/marketing-team-manager.md +446 -0
  226. package/one/things/claude/agents/marketing-viral-growth.md +201 -0
  227. package/one/things/claude/agents/mission-commander.md +373 -0
  228. package/one/things/claude/agents/network-effect-analyst.md +587 -0
  229. package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
  230. package/one/things/claude/agents/npx.md +890 -0
  231. package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
  232. package/one/things/claude/agents/one-master.md +355 -0
  233. package/one/things/claude/agents/one-orchestrator.md +315 -0
  234. package/one/things/claude/agents/one.md +601 -0
  235. package/one/things/claude/agents/playbook-generator.md +503 -0
  236. package/one/things/claude/agents/pm.md +326 -0
  237. package/one/things/claude/agents/po.md +345 -0
  238. package/one/things/claude/agents/qa.md +336 -0
  239. package/one/things/claude/agents/research-foundation-analyst.md +307 -0
  240. package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
  241. package/one/things/claude/agents/research-market-analyst.md +307 -0
  242. package/one/things/claude/agents/research-team-manager.md +482 -0
  243. package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
  244. package/one/things/claude/agents/sales-team-manager.md +400 -0
  245. package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
  246. package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
  247. package/one/things/claude/agents/service-advocacy-manager.md +307 -0
  248. package/one/things/claude/agents/service-success-manager.md +307 -0
  249. package/one/things/claude/agents/service-team-manager.md +400 -0
  250. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
  251. package/one/things/claude/agents/share-optimization-specialist.md +551 -0
  252. package/one/things/claude/agents/sm.md +327 -0
  253. package/one/things/claude/agents/story-teller.md +473 -0
  254. package/one/things/claude/agents/task-master.md +596 -0
  255. package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
  256. package/one/things/claude/agents/tester.md +556 -0
  257. package/one/things/claude/agents/the-bull-character-manager.md +580 -0
  258. package/one/things/claude/agents/tools-playbook-generator.md +489 -0
  259. package/one/things/claude/agents/turbo-repo-builder.md +316 -0
  260. package/one/things/claude/agents/upsell-strategist.md +480 -0
  261. package/one/things/claude/agents/ux-expert.md +335 -0
  262. package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
  263. package/one/things/claude/claude-code-hooks-development.json +21 -0
  264. package/one/things/claude/claude-code-hooks-production.json +21 -0
  265. package/one/things/claude/claude-code-hooks.json +25 -0
  266. package/one/things/claude/commands/agent.md +104 -0
  267. package/one/things/claude/commands/cascade-status.md +128 -0
  268. package/one/things/claude/commands/ingest.md +290 -0
  269. package/one/things/claude/commands/ingestor.md +136 -0
  270. package/one/things/claude/commands/mission.md +83 -0
  271. package/one/things/claude/commands/npx.md +133 -0
  272. package/one/things/claude/commands/one.md +440 -0
  273. package/one/things/claude/commands/quality-check.md +204 -0
  274. package/one/things/claude/commands/smart-route.md +220 -0
  275. package/one/things/claude/commands/start.md +121 -0
  276. package/one/things/claude/commands/story.md +83 -0
  277. package/one/things/claude/commands/task.md +173 -0
  278. package/one/things/claude/hook-bypass.json +32 -0
  279. package/one/things/claude/hooks/agent-hook-config.json +427 -0
  280. package/one/things/claude/hooks/agent-hook-manager.js +525 -0
  281. package/one/things/claude/hooks/agent-load-balancer.js +271 -0
  282. package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
  283. package/one/things/claude/hooks/build-hook.sh +156 -0
  284. package/one/things/claude/hooks/cascade-feedback.js +297 -0
  285. package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
  286. package/one/things/claude/hooks/cleanup-hook.sh +201 -0
  287. package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
  288. package/one/things/claude/hooks/file-organization-engine.js +427 -0
  289. package/one/things/claude/hooks/file-organization-hook.sh +80 -0
  290. package/one/things/claude/hooks/file-organization-monitor.js +269 -0
  291. package/one/things/claude/hooks/format-hook.sh +43 -0
  292. package/one/things/claude/hooks/hook-bypass.sh +293 -0
  293. package/one/things/claude/hooks/hook-config-manager.js +202 -0
  294. package/one/things/claude/hooks/hook-debouncer.sh +62 -0
  295. package/one/things/claude/hooks/hook-logger.sh +89 -0
  296. package/one/things/claude/hooks/hook-orchestrator.js +662 -0
  297. package/one/things/claude/hooks/hook-performance-report.js +120 -0
  298. package/one/things/claude/hooks/lint-hook.sh +140 -0
  299. package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
  300. package/one/things/claude/hooks/memory-optimizer.js +510 -0
  301. package/one/things/claude/hooks/notification-hook.sh +204 -0
  302. package/one/things/claude/hooks/ontology-compliance.js +394 -0
  303. package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
  304. package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
  305. package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
  306. package/one/things/claude/hooks/performance-metrics.json +25 -0
  307. package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
  308. package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
  309. package/one/things/claude/hooks/security-hook.sh +256 -0
  310. package/one/things/claude/hooks/simple-load-balancer.js +238 -0
  311. package/one/things/claude/hooks/startup-optimizer.js +625 -0
  312. package/one/things/claude/hooks/story-scoring-system.js +445 -0
  313. package/one/things/claude/hooks/story-validation-engine.js +473 -0
  314. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
  315. package/one/things/claude/hooks/story-validation-hook.sh +145 -0
  316. package/one/things/claude/hooks/structure-synchronizer.js +194 -0
  317. package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
  318. package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
  319. package/one/things/claude/hooks/test-hook.sh +145 -0
  320. package/one/things/claude/hooks/test-story-validation.sh +170 -0
  321. package/one/things/claude/hooks/trinity-validation-system.js +392 -0
  322. package/one/things/claude/settings-local.json +86 -0
  323. package/one/things/cli-code.md +652 -0
  324. package/one/things/cli-compiler-code.md +652 -0
  325. package/one/things/cli.md +1045 -0
  326. package/one/things/components/card-shadcn.md +929 -0
  327. package/one/things/components/card.md +1050 -0
  328. package/one/things/components.md +1669 -0
  329. package/one/things/componets.md +4 -0
  330. package/one/things/copilotkit.md +1559 -0
  331. package/one/things/creator-diagram.md +166 -0
  332. package/one/things/examples/children/lemonade-stand.md +366 -0
  333. package/one/things/examples/enterprise/crm-saas.md +1429 -0
  334. package/one/things/features/1-1-agent-prompts/design.md +470 -0
  335. package/one/things/features/1-1-agent-prompts/tests.md +264 -0
  336. package/one/things/features/1-1-agent-prompts.md +486 -0
  337. package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
  338. package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
  339. package/one/things/features/1-2-yaml-orchestrator.md +516 -0
  340. package/one/things/features/1-3-event-coordination/design.md +544 -0
  341. package/one/things/features/1-3-event-coordination/tests.md +223 -0
  342. package/one/things/features/1-3-event-coordination.md +508 -0
  343. package/one/things/features/1-4-knowledge-management/design.md +609 -0
  344. package/one/things/features/1-4-knowledge-management/tests.md +195 -0
  345. package/one/things/features/1-4-knowledge-management.md +577 -0
  346. package/one/things/features/1-5-quality-loops/design.md +797 -0
  347. package/one/things/features/1-5-quality-loops/tests.md +212 -0
  348. package/one/things/features/1-5-quality-loops.md +641 -0
  349. package/one/things/features/1-6-numbering-structure/design.md +610 -0
  350. package/one/things/features/1-6-numbering-structure/tests.md +213 -0
  351. package/one/things/features/1-6-numbering-structure.md +575 -0
  352. package/one/things/features/2-cli.md +1235 -0
  353. package/one/things/features/use-one-backend.md +1180 -0
  354. package/one/things/ideas/1-create-workflow.md +189 -0
  355. package/one/things/plans/1-create-workflow-status.md +555 -0
  356. package/one/things/plans/1-create-workflow.md +713 -0
  357. package/one/things/plans/app.md +761 -0
  358. package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
  359. package/one/things/plans/better-auth-any-backend.md +1852 -0
  360. package/one/things/plans/better-auth-available-features.md +235 -0
  361. package/one/things/plans/big-plan.md +38 -0
  362. package/one/things/plans/convex-better-auth.md +1109 -0
  363. package/one/things/plans/convex-on-off.md +389 -0
  364. package/one/things/plans/desktop.md +1121 -0
  365. package/one/things/plans/effect-components.md +1669 -0
  366. package/one/things/plans/effect.md +973 -0
  367. package/one/things/plans/email.md +953 -0
  368. package/one/things/plans/enhance-auth.md +1669 -0
  369. package/one/things/plans/install-components.md +198 -0
  370. package/one/things/plans/landing.md +728 -0
  371. package/one/things/plans/layout.md +205 -0
  372. package/one/things/plans/mail-backend.md +1308 -0
  373. package/one/things/plans/mail.md +2624 -0
  374. package/one/things/plans/next-features.md +83 -0
  375. package/one/things/plans/one.md +658 -0
  376. package/one/things/plans/ontology-6-dimensions.md +2216 -0
  377. package/one/things/plans/ontology-driven-strategy.md +866 -0
  378. package/one/things/plans/ontology-ui-approach.md +357 -0
  379. package/one/things/plans/open-agent.md +785 -0
  380. package/one/things/plans/performace.md +90 -0
  381. package/one/things/plans/releases.md +809 -0
  382. package/one/things/plans/repos.md +76 -0
  383. package/one/things/plans/separate-copy-2.md +1293 -0
  384. package/one/things/plans/separate-copy-3.md +2458 -0
  385. package/one/things/plans/separate-copy.md +1293 -0
  386. package/one/things/plans/separate.md +1983 -0
  387. package/one/things/plans/shadcn-integration-summary.md +450 -0
  388. package/one/things/plans/sidebar.md +172 -0
  389. package/one/things/plans/small-fixes.md +5 -0
  390. package/one/things/plans/test-backend-connection.md +476 -0
  391. package/one/things/plans/workflow-files.md +1196 -0
  392. package/one/things/plans/workflow.md +1372 -0
  393. package/one/things/products/cascade-landing-page.md +737 -0
  394. package/one/things/products/cascade.md +1518 -0
  395. package/one/things/products/context-engineering.md +1427 -0
  396. package/one/things/products/onthology.md +0 -0
  397. package/one/things/products/ontology-ui-shadcn.md +1280 -0
  398. package/one/things/products/ontology-ui.md +1387 -0
  399. package/one/things/products/ontology.md +717 -0
  400. package/one/things/products/sdk.md +557 -0
  401. package/one/things/promptkit.md +903 -0
  402. package/one/things/service-providers-new.md +982 -0
  403. package/one/things/service-providers.md +1092 -0
  404. package/one/things/things.md +349 -0
  405. package/one/things/todo.md +1248 -0
  406. package/package.json +5 -2
@@ -0,0 +1,1292 @@
1
+ # ONE Ontology Engineering
2
+
3
+ **Version:** 1.0.0
4
+ **Purpose:** Context Engineering, Agent Architecture, and Dynamic Website Generation
5
+ **Philosophy:** Minimal Context, Maximum Intelligence
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ 1. [Context Engineering Strategy](#context-engineering-strategy)
12
+ 2. [Specialist AI Agent Architecture](#specialist-ai-agent-architecture)
13
+ 3. [Frontend/Backend Implementation](#frontendbackend-implementation)
14
+ 4. [Dynamic Website Generation](#dynamic-website-generation)
15
+ 5. [Code Generation Patterns](#code-generation-patterns)
16
+ 6. [Performance Optimization](#performance-optimization)
17
+
18
+ ---
19
+
20
+ ## Context Engineering Strategy
21
+
22
+ ### The Problem: Context Window Explosion
23
+
24
+ **Traditional Approach (❌ Bad):**
25
+ ```
26
+ AI reads entire codebase → 100k+ tokens → expensive, slow, hallucinations
27
+ ```
28
+
29
+ **ONE Approach (✅ Good):**
30
+ ```
31
+ AI queries ontology → focused retrieval → <5k tokens → fast, accurate, cheap
32
+ ```
33
+
34
+ ### Principle 1: Ontology as Context Compression
35
+
36
+ The 6-dimension ontology IS our context compression:
37
+
38
+ ```typescript
39
+ // Instead of loading 50 files (30k tokens):
40
+ const allUsers = readFiles(['users.ts', 'auth.ts', 'sessions.ts', ...])
41
+
42
+ // Query the ontology (500 tokens):
43
+ const context = {
44
+ things: ['creator', 'audience_member'],
45
+ connections: ['member_of'],
46
+ events: ['user_login', 'user_registered']
47
+ }
48
+ ```
49
+
50
+ **Result:** 98% context reduction with full semantic fidelity.
51
+
52
+ ### Principle 2: Just-In-Time Context Loading
53
+
54
+ **Strategy:** Load context ONLY when needed, not upfront.
55
+
56
+ ```typescript
57
+ // ❌ BAD: Load everything
58
+ const fullOntology = await loadOntology() // 15k tokens
59
+
60
+ // ✅ GOOD: Load on demand
61
+ async function getRelevantContext(userIntent: string) {
62
+ const embedding = await embed(userIntent)
63
+ const relevantChunks = await vectorSearch(embedding, { k: 3 }) // 800 tokens
64
+ const relevantThings = await getThingsByType(extractTypes(relevantChunks)) // 300 tokens
65
+
66
+ return { chunks: relevantChunks, things: relevantThings } // Total: 1,100 tokens
67
+ }
68
+ ```
69
+
70
+ ### Principle 3: Query-First Architecture
71
+
72
+ **Pattern:** Every operation starts with a focused query.
73
+
74
+ ```typescript
75
+ // User request: "Show me all fitness creators"
76
+
77
+ // Step 1: Parse intent
78
+ const intent = {
79
+ thingType: 'creator',
80
+ filter: { niche: 'fitness' },
81
+ connections: undefined,
82
+ events: undefined
83
+ }
84
+
85
+ // Step 2: Focused query (only what's needed)
86
+ const creators = await db
87
+ .query('things')
88
+ .withIndex('by_type', q => q.eq('type', 'creator'))
89
+ .filter(q => q.field('properties.niche').includes('fitness'))
90
+ .take(10) // ALWAYS LIMIT
91
+
92
+ // Step 3: Load related data IF NEEDED
93
+ if (needsStats) {
94
+ const stats = await getCreatorStats(creators.map(c => c._id))
95
+ }
96
+ ```
97
+
98
+ **Context Used:**
99
+ - Intent parsing: ~200 tokens
100
+ - Query: ~50 tokens
101
+ - Results: ~500 tokens
102
+ - **Total: ~750 tokens** (vs 10k+ for full creator records)
103
+
104
+ ### Principle 4: Contextual Caching
105
+
106
+ **Strategy:** Cache frequently accessed ontology patterns.
107
+
108
+ ```typescript
109
+ // Cache structure
110
+ const ontologyCache = {
111
+ // Thing type definitions (rarely change)
112
+ thingTypes: Map<ThingType, ThingDefinition>, // ~2k tokens
113
+
114
+ // Connection patterns (rarely change)
115
+ connectionTypes: Map<ConnectionType, ConnectionDefinition>, // ~1k tokens
116
+
117
+ // Event types (rarely change)
118
+ eventTypes: Map<EventType, EventDefinition>, // ~1k tokens
119
+
120
+ // Organization-specific (cache per org, TTL: 5 min)
121
+ orgSchema: Map<OrgId, OrgContext>, // ~500 tokens per org
122
+
123
+ // User-specific (cache per session, TTL: 1 hour)
124
+ userContext: Map<UserId, UserContext>, // ~300 tokens per user
125
+ }
126
+
127
+ // Total cold start: ~5k tokens
128
+ // Total warm (per request): ~800 tokens
129
+ ```
130
+
131
+ ### Principle 5: Semantic Compression via Knowledge
132
+
133
+ **Strategy:** Use knowledge embeddings to compress semantic meaning.
134
+
135
+ ```typescript
136
+ // Instead of passing full documentation (5k tokens):
137
+ const docs = `
138
+ The creator entity represents a human creator...
139
+ Properties include email, username, niche...
140
+ Creators can own ai_clones and create content...
141
+ [3000+ more words]
142
+ `
143
+
144
+ // Pass compressed reference (50 tokens + retrieval):
145
+ const creatorContext = {
146
+ thingType: 'creator',
147
+ knowledgeRef: 'knowledge_item_creator_docs', // Vector retrieval when needed
148
+ quickRef: 'Human creator with email, username, niche. Owns clones & content.'
149
+ }
150
+
151
+ // AI retrieves detailed docs ONLY if needed
152
+ if (needsDetail) {
153
+ const detailedDocs = await retrieveKnowledge('knowledge_item_creator_docs')
154
+ }
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Specialist AI Agent Architecture
160
+
161
+ ### Agent Design Philosophy
162
+
163
+ **Traditional Monolithic Agent (❌ Bad):**
164
+ ```
165
+ One agent tries to do everything → 50k token context → slow, expensive, confused
166
+ ```
167
+
168
+ **ONE Specialist Agents (✅ Good):**
169
+ ```
170
+ 10 specialist agents, each expert in one domain → 3k tokens each → fast, cheap, accurate
171
+ ```
172
+
173
+ ### Core Agent Types
174
+
175
+ #### 1. **Ontology Agent** - The Router
176
+
177
+ **Purpose:** Parse user intent and route to specialist agents.
178
+
179
+ **Context Budget:** 2k tokens max
180
+
181
+ **Capabilities:**
182
+ - Intent classification
183
+ - Entity/connection/event identification
184
+ - Agent routing
185
+
186
+ ```typescript
187
+ interface OntologyAgent {
188
+ parseIntent(userInput: string): Intent
189
+ routeToAgent(intent: Intent): SpecialistAgent
190
+
191
+ context: {
192
+ ontologyTypes: ThingType[] // Cached
193
+ connectionTypes: ConnectionType[] // Cached
194
+ eventTypes: EventType[] // Cached
195
+ }
196
+ }
197
+
198
+ // Example
199
+ const intent = await ontologyAgent.parseIntent("Create a fitness course")
200
+ // Returns: { action: 'create', thingType: 'course', metadata: { niche: 'fitness' } }
201
+
202
+ const agent = ontologyAgent.routeToAgent(intent)
203
+ // Returns: ContentCreationAgent
204
+ ```
205
+
206
+ #### 2. **Schema Agent** - Database Structure Expert
207
+
208
+ **Purpose:** Generate Convex schemas, indexes, and migrations.
209
+
210
+ **Context Budget:** 3k tokens max
211
+
212
+ **Capabilities:**
213
+ - Schema generation
214
+ - Index optimization
215
+ - Migration planning
216
+
217
+ ```typescript
218
+ interface SchemaAgent {
219
+ generateSchema(thingTypes: ThingType[]): ConvexSchema
220
+ optimizeIndexes(queryPatterns: QueryPattern[]): IndexDefinition[]
221
+ planMigration(from: Schema, to: Schema): MigrationPlan
222
+
223
+ context: {
224
+ ontologySpec: OntologyReference // Links to detailed docs
225
+ indexPatterns: IndexPattern[] // Common patterns
226
+ validationRules: ValidationRule[]
227
+ }
228
+ }
229
+
230
+ // Example
231
+ const schema = await schemaAgent.generateSchema(['creator', 'course', 'lesson'])
232
+ // Returns optimized Convex schema with indexes
233
+ ```
234
+
235
+ #### 3. **Query Agent** - Database Query Expert
236
+
237
+ **Purpose:** Generate optimized Convex queries.
238
+
239
+ **Context Budget:** 2k tokens max
240
+
241
+ **Capabilities:**
242
+ - Query generation
243
+ - Query optimization
244
+ - Index selection
245
+
246
+ ```typescript
247
+ interface QueryAgent {
248
+ generateQuery(intent: QueryIntent): ConvexQuery
249
+ optimizeQuery(query: ConvexQuery): ConvexQuery
250
+ explainQuery(query: ConvexQuery): QueryExplanation
251
+
252
+ context: {
253
+ availableIndexes: Index[] // Current DB indexes
254
+ queryPatterns: QueryPattern[] // Common patterns
255
+ }
256
+ }
257
+
258
+ // Example
259
+ const query = await queryAgent.generateQuery({
260
+ thingType: 'creator',
261
+ filter: { niche: 'fitness', totalFollowers: { $gt: 10000 } },
262
+ limit: 10
263
+ })
264
+ // Returns optimized Convex query with correct index usage
265
+ ```
266
+
267
+ #### 4. **Mutation Agent** - Database Write Expert
268
+
269
+ **Purpose:** Generate Convex mutations with proper validation and events.
270
+
271
+ **Context Budget:** 3k tokens max
272
+
273
+ **Capabilities:**
274
+ - Mutation generation
275
+ - Validation logic
276
+ - Event logging
277
+ - Transaction handling
278
+
279
+ ```typescript
280
+ interface MutationAgent {
281
+ generateMutation(action: MutationIntent): ConvexMutation
282
+ addValidation(mutation: ConvexMutation): ConvexMutation
283
+ logEvents(mutation: ConvexMutation): ConvexMutation
284
+
285
+ context: {
286
+ validationRules: ValidationRule[]
287
+ eventTypes: EventType[]
288
+ transactionPatterns: TransactionPattern[]
289
+ }
290
+ }
291
+
292
+ // Example
293
+ const mutation = await mutationAgent.generateMutation({
294
+ action: 'create',
295
+ thingType: 'course',
296
+ properties: { title: 'Fitness 101', niche: 'fitness' },
297
+ connections: [{ type: 'owns', fromId: creatorId }]
298
+ })
299
+ // Returns mutation with validation + event logging + connection creation
300
+ ```
301
+
302
+ #### 5. **Frontend Component Agent** - UI Generator
303
+
304
+ **Purpose:** Generate Astro/React components from ontology.
305
+
306
+ **Context Budget:** 4k tokens max
307
+
308
+ **Capabilities:**
309
+ - Component generation
310
+ - Type-safe props
311
+ - Convex integration
312
+ - Styling with Tailwind
313
+
314
+ ```typescript
315
+ interface FrontendAgent {
316
+ generateComponent(spec: ComponentSpec): AstroComponent
317
+ generatePage(spec: PageSpec): AstroPage
318
+ generateAPI(spec: APISpec): HonoRoute
319
+
320
+ context: {
321
+ componentPatterns: ComponentPattern[] // Reusable patterns
322
+ designSystem: DesignTokens // Colors, spacing, etc.
323
+ ontologyTypes: ThingType[] // For type generation
324
+ }
325
+ }
326
+
327
+ // Example
328
+ const component = await frontendAgent.generateComponent({
329
+ name: 'CourseCard',
330
+ thingType: 'course',
331
+ fields: ['title', 'description', 'price'],
332
+ actions: ['enroll', 'view']
333
+ })
334
+ // Returns fully typed Astro component with Convex hooks
335
+ ```
336
+
337
+ #### 6. **Backend Logic Agent** - Business Logic Expert
338
+
339
+ **Purpose:** Generate Convex actions and complex business logic.
340
+
341
+ **Context Budget:** 4k tokens max
342
+
343
+ **Capabilities:**
344
+ - Action generation
345
+ - External API integration
346
+ - Workflow orchestration
347
+ - Error handling
348
+
349
+ ```typescript
350
+ interface BackendAgent {
351
+ generateAction(spec: ActionSpec): ConvexAction
352
+ orchestrateWorkflow(steps: WorkflowStep[]): WorkflowAction
353
+ handleErrors(action: ConvexAction): ConvexAction
354
+
355
+ context: {
356
+ workflowPatterns: WorkflowPattern[]
357
+ integrationPatterns: IntegrationPattern[]
358
+ errorPatterns: ErrorPattern[]
359
+ }
360
+ }
361
+
362
+ // Example
363
+ const action = await backendAgent.generateAction({
364
+ name: 'createCourseWithAI',
365
+ steps: [
366
+ 'generateContent',
367
+ 'createCourse',
368
+ 'embedContent',
369
+ 'notifyCreator'
370
+ ]
371
+ })
372
+ // Returns orchestrated Convex action with error handling
373
+ ```
374
+
375
+ #### 7. **Knowledge Agent** - RAG & Embeddings Expert
376
+
377
+ **Purpose:** Manage knowledge embeddings and semantic search.
378
+
379
+ **Context Budget:** 3k tokens max
380
+
381
+ **Capabilities:**
382
+ - Embedding generation
383
+ - Vector search
384
+ - Chunk optimization
385
+ - Label management
386
+
387
+ ```typescript
388
+ interface KnowledgeAgent {
389
+ embedContent(thing: Thing, fields: string[]): Knowledge[]
390
+ semanticSearch(query: string, filters: Filter): Knowledge[]
391
+ optimizeChunks(text: string): Chunk[]
392
+ manageLabels(thing: Thing): Label[]
393
+
394
+ context: {
395
+ embeddingModel: 'text-embedding-3-large'
396
+ chunkStrategy: ChunkStrategy
397
+ labelTaxonomy: LabelCategory[]
398
+ }
399
+ }
400
+
401
+ // Example
402
+ const chunks = await knowledgeAgent.embedContent(course, ['title', 'description', 'content'])
403
+ // Returns knowledge chunks with embeddings + links via thingKnowledge
404
+ ```
405
+
406
+ #### 8. **Organization Agent** - Multi-Tenant Expert
407
+
408
+ **Purpose:** Manage organization scope, permissions, quotas.
409
+
410
+ **Context Budget:** 2k tokens max
411
+
412
+ **Capabilities:**
413
+ - Scope enforcement
414
+ - Permission checks
415
+ - Quota tracking
416
+ - Billing logic
417
+
418
+ ```typescript
419
+ interface OrganizationAgent {
420
+ enforceScope(query: Query, orgId: OrgId): Query
421
+ checkPermissions(userId: UserId, action: Action): boolean
422
+ trackUsage(orgId: OrgId, resource: Resource): Usage
423
+
424
+ context: {
425
+ orgPlans: Plan[] // starter, pro, enterprise
426
+ quotaLimits: QuotaLimit[]
427
+ permissionMatrix: Permission[][]
428
+ }
429
+ }
430
+
431
+ // Example
432
+ const scopedQuery = await orgAgent.enforceScope(rawQuery, orgId)
433
+ // Returns query filtered to org's data only
434
+ ```
435
+
436
+ #### 9. **Analytics Agent** - Metrics & Insights Expert
437
+
438
+ **Purpose:** Generate analytics from events and metrics.
439
+
440
+ **Context Budget:** 3k tokens max
441
+
442
+ **Capabilities:**
443
+ - Metric calculation
444
+ - Insight generation
445
+ - Prediction models
446
+ - Report generation
447
+
448
+ ```typescript
449
+ interface AnalyticsAgent {
450
+ calculateMetrics(orgId: OrgId, period: Period): Metrics
451
+ generateInsights(metrics: Metrics): Insight[]
452
+ predictTrends(history: Metrics[]): Prediction[]
453
+
454
+ context: {
455
+ metricDefinitions: MetricDef[]
456
+ insightPatterns: InsightPattern[]
457
+ predictionModels: Model[]
458
+ }
459
+ }
460
+
461
+ // Example
462
+ const insights = await analyticsAgent.generateInsights(metrics)
463
+ // Returns actionable insights with confidence scores
464
+ ```
465
+
466
+ #### 10. **Protocol Agent** - Cross-Protocol Expert
467
+
468
+ **Purpose:** Handle A2A, ACP, AP2, X402, AG-UI integrations.
469
+
470
+ **Context Budget:** 4k tokens max
471
+
472
+ **Capabilities:**
473
+ - Protocol detection
474
+ - Message formatting
475
+ - Transaction handling
476
+ - Cross-chain bridges
477
+
478
+ ```typescript
479
+ interface ProtocolAgent {
480
+ detectProtocol(request: Request): Protocol
481
+ formatMessage(data: any, protocol: Protocol): Message
482
+ handleTransaction(tx: Transaction, protocol: Protocol): Event
483
+
484
+ context: {
485
+ protocolSpecs: ProtocolSpec[] // A2A, ACP, AP2, X402, AG-UI
486
+ networkConfigs: NetworkConfig[] // Base, Sui, Solana
487
+ }
488
+ }
489
+
490
+ // Example
491
+ const message = await protocolAgent.formatMessage(purchase, 'acp')
492
+ // Returns ACP-formatted commerce message
493
+ ```
494
+
495
+ ---
496
+
497
+ ## Agent Orchestration Pattern
498
+
499
+ ### Sequential Coordination
500
+
501
+ ```typescript
502
+ // User: "Create a fitness course and publish it to my website"
503
+
504
+ // 1. Ontology Agent routes
505
+ const intent = await ontologyAgent.parse("Create fitness course...")
506
+ // → { actions: ['create_course', 'publish_website'] }
507
+
508
+ // 2. Mutation Agent creates course
509
+ const course = await mutationAgent.create({
510
+ thingType: 'course',
511
+ properties: { title: '...', niche: 'fitness' }
512
+ })
513
+
514
+ // 3. Knowledge Agent embeds content
515
+ await knowledgeAgent.embed(course, ['title', 'description', 'modules'])
516
+
517
+ // 4. Frontend Agent generates page
518
+ const page = await frontendAgent.generatePage({
519
+ thingType: 'course',
520
+ thingId: course._id
521
+ })
522
+
523
+ // 5. Backend Agent deploys
524
+ await backendAgent.deploy(page, { domain: creator.properties.domain })
525
+
526
+ // Total context: 2k + 3k + 3k + 4k + 4k = 16k tokens
527
+ // vs Monolithic: 80k+ tokens
528
+ ```
529
+
530
+ ### Parallel Execution
531
+
532
+ ```typescript
533
+ // User: "Analyze my creator platform performance"
534
+
535
+ // Ontology Agent routes to multiple specialists
536
+ const [metrics, insights, predictions] = await Promise.all([
537
+ analyticsAgent.calculateMetrics(orgId, '30d'),
538
+ analyticsAgent.generateInsights(/* ... */),
539
+ analyticsAgent.predictTrends(/* ... */)
540
+ ])
541
+
542
+ // Each agent runs in parallel with own context
543
+ // Total context: max(3k, 3k, 3k) = 3k tokens (not additive!)
544
+ ```
545
+
546
+ ---
547
+
548
+ ## Frontend/Backend Implementation
549
+
550
+ ### Architecture Overview
551
+
552
+ ```
553
+ ┌─────────────────────────────────────────────────────────┐
554
+ │ FRONTEND (Astro) │
555
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
556
+ │ │ Pages │ │ Components │ │ API │ │
557
+ │ │ (SSR/SSG) │ │ (React) │ │ (Hono) │ │
558
+ │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
559
+ │ │ │ │ │
560
+ │ └─────────────────┴─────────────────┘ │
561
+ │ ↓ │
562
+ │ ConvexHttpClient │
563
+ └────────────────────────────┬────────────────────────────┘
564
+ ↓
565
+ ┌─────────────────────────────────────────────────────────┐
566
+ │ BACKEND (Convex) │
567
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐│
568
+ │ │ Queries │ │Mutations │ │ Actions │ │Scheduler││
569
+ │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬────┘│
570
+ │ │ │ │ │ │
571
+ │ └─────────────┴──────────────┴──────────────┘ │
572
+ │ ↓ │
573
+ │ ┌────────────────────────┐ │
574
+ │ │ 6-Dimension Ontology │ │
575
+ │ │ things │ connections │ │ │
576
+ │ │ events │ knowledge │ │ │
577
+ │ └────────────────────────┘ │
578
+ └─────────────────────────────────────────────────────────┘
579
+ ```
580
+
581
+ ### Context-Aware Query Pattern
582
+
583
+ **Traditional (❌ Bad):**
584
+ ```typescript
585
+ // Load everything, filter in memory
586
+ const allThings = await db.query('things').collect() // 50k records
587
+ const filtered = allThings.filter(t => t.type === 'course')
588
+ ```
589
+
590
+ **Context-Optimized (✅ Good):**
591
+ ```typescript
592
+ // Query with index, limit results
593
+ const courses = await db
594
+ .query('things')
595
+ .withIndex('by_type', q => q.eq('type', 'course'))
596
+ .take(20) // ALWAYS PAGINATE
597
+
598
+ // Load related data ONLY if needed
599
+ if (needsCreators) {
600
+ const creatorIds = [...new Set(courses.map(c => c.properties.creatorId))]
601
+ const creators = await db.getMany(creatorIds) // Batch fetch
602
+ }
603
+ ```
604
+
605
+ ### Dynamic Component Generation
606
+
607
+ **Pattern:** Generate components from ontology at build time.
608
+
609
+ ```typescript
610
+ // scripts/generate-components.ts
611
+
612
+ import { ontology } from './ontology'
613
+ import { FrontendAgent } from './agents/frontend'
614
+
615
+ // Generate component for each thing type
616
+ for (const thingType of ontology.thingTypes) {
617
+ // Generate card component
618
+ const card = await frontendAgent.generateComponent({
619
+ name: `${thingType}Card`,
620
+ thingType,
621
+ fields: ontology.getDisplayFields(thingType),
622
+ variant: 'card'
623
+ })
624
+
625
+ await writeFile(`src/components/cards/${thingType}Card.tsx`, card)
626
+
627
+ // Generate list component
628
+ const list = await frontendAgent.generateComponent({
629
+ name: `${thingType}List`,
630
+ thingType,
631
+ variant: 'list',
632
+ pagination: true
633
+ })
634
+
635
+ await writeFile(`src/components/lists/${thingType}List.tsx`, list)
636
+
637
+ // Generate detail page
638
+ const page = await frontendAgent.generatePage({
639
+ name: `${thingType}Detail`,
640
+ thingType,
641
+ sections: ['header', 'properties', 'connections', 'events']
642
+ })
643
+
644
+ await writeFile(`src/pages/${thingType}/[id].astro`, page)
645
+ }
646
+
647
+ // Result: 66 thing types × 3 components = 198 auto-generated components
648
+ ```
649
+
650
+ ### Backend Query Optimization
651
+
652
+ **Pattern:** Use indexes and batching to minimize context.
653
+
654
+ ```typescript
655
+ // Convex query with index optimization
656
+ export const getCourseWithRelations = query({
657
+ args: { courseId: v.id('things') },
658
+ handler: async (ctx, { courseId }) => {
659
+ // 1. Get course (1 read)
660
+ const course = await ctx.db.get(courseId)
661
+ if (!course) return null
662
+
663
+ // 2. Get creator via connection (index scan, not full table)
664
+ const ownerConn = await ctx.db
665
+ .query('connections')
666
+ .withIndex('to_type', q =>
667
+ q.eq('toThingId', courseId).eq('relationshipType', 'owns')
668
+ )
669
+ .first()
670
+
671
+ // 3. Get creator (1 read)
672
+ const creator = ownerConn ? await ctx.db.get(ownerConn.fromThingId) : null
673
+
674
+ // 4. Get lessons via connection (index scan)
675
+ const lessonConns = await ctx.db
676
+ .query('connections')
677
+ .withIndex('from_type', q =>
678
+ q.eq('fromThingId', courseId).eq('relationshipType', 'part_of')
679
+ )
680
+ .collect()
681
+
682
+ // 5. Batch fetch lessons (N reads in parallel)
683
+ const lessons = await Promise.all(
684
+ lessonConns.map(c => ctx.db.get(c.toThingId))
685
+ )
686
+
687
+ // Total: 3 + N reads (vs full table scans)
688
+ return { course, creator, lessons }
689
+ }
690
+ })
691
+ ```
692
+
693
+ ---
694
+
695
+ ## Dynamic Website Generation
696
+
697
+ ### Concept: Organizations Create Custom Websites
698
+
699
+ **Flow:**
700
+ ```
701
+ 1. Organization creates account
702
+ 2. Chooses template (minimal, showcase, portfolio)
703
+ 3. Customizes branding (colors, logo, domain)
704
+ 4. Creates content (courses, blog posts, products)
705
+ 5. ONE auto-generates website at org.one.ie
706
+ ```
707
+
708
+ ### Implementation Strategy
709
+
710
+ #### 1. Template System
711
+
712
+ **Static Templates** (pre-built):
713
+ ```typescript
714
+ // templates/minimal.ts
715
+ export const minimalTemplate: Template = {
716
+ name: 'minimal',
717
+ sections: ['hero', 'about', 'content', 'footer'],
718
+ thingTypes: ['creator', 'blog_post', 'course'],
719
+ colors: {
720
+ primary: 'blue-600',
721
+ secondary: 'gray-800',
722
+ accent: 'green-500'
723
+ }
724
+ }
725
+ ```
726
+
727
+ **Dynamic Generation**:
728
+ ```typescript
729
+ // Generate website for organization
730
+ export async function generateWebsite(orgId: Id<'things'>) {
731
+ // 1. Get org preferences
732
+ const org = await db.get(orgId)
733
+ const template = templates[org.properties.template || 'minimal']
734
+
735
+ // 2. Get org's things
736
+ const things = await db
737
+ .query('things')
738
+ .filter(q => q.eq(q.field('properties.organizationId'), orgId))
739
+ .collect()
740
+
741
+ // 3. Generate pages
742
+ const pages = []
743
+
744
+ // Homepage
745
+ pages.push(await frontendAgent.generatePage({
746
+ template: 'homepage',
747
+ sections: template.sections,
748
+ data: { org, creators: things.filter(t => t.type === 'creator') }
749
+ }))
750
+
751
+ // Content pages (one per thing)
752
+ for (const thing of things) {
753
+ pages.push(await frontendAgent.generatePage({
754
+ template: 'detail',
755
+ thingType: thing.type,
756
+ data: thing
757
+ }))
758
+ }
759
+
760
+ // 4. Deploy to org.one.ie
761
+ await deploy(pages, { domain: `${org.properties.slug}.one.ie` })
762
+ }
763
+ ```
764
+
765
+ #### 2. Component-Based Pages
766
+
767
+ **Pattern:** Pages are composed of thing-based components.
768
+
769
+ ```astro
770
+ ---
771
+ // [orgSlug]/index.astro (auto-generated)
772
+ import { ConvexHttpClient } from 'convex/browser'
773
+ import Hero from '@/components/Hero.astro'
774
+ import CreatorCard from '@/components/cards/CreatorCard.tsx'
775
+ import CourseList from '@/components/lists/CourseList.tsx'
776
+
777
+ const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL)
778
+
779
+ // Get org
780
+ const org = await convex.query(api.queries.orgs.getBySlug, {
781
+ slug: Astro.params.orgSlug
782
+ })
783
+
784
+ // Get creators
785
+ const creators = await convex.query(api.queries.things.list, {
786
+ type: 'creator',
787
+ organizationId: org._id
788
+ })
789
+
790
+ // Get courses
791
+ const courses = await convex.query(api.queries.things.list, {
792
+ type: 'course',
793
+ organizationId: org._id,
794
+ limit: 6
795
+ })
796
+ ---
797
+
798
+ <Layout title={org.name}>
799
+ <Hero
800
+ title={org.name}
801
+ subtitle={org.properties.description}
802
+ cta="Explore Courses"
803
+ />
804
+
805
+ <section class="creators">
806
+ <h2>Our Creators</h2>
807
+ <div class="grid">
808
+ {creators.map(creator => (
809
+ <CreatorCard client:load creator={creator} />
810
+ ))}
811
+ </div>
812
+ </section>
813
+
814
+ <section class="courses">
815
+ <h2>Featured Courses</h2>
816
+ <CourseList client:load courses={courses} />
817
+ </section>
818
+ </Layout>
819
+ ```
820
+
821
+ #### 3. Real-Time Updates
822
+
823
+ **Pattern:** Components subscribe to changes.
824
+
825
+ ```tsx
826
+ // components/cards/CourseCard.tsx
827
+ import { useQuery } from 'convex/react'
828
+ import { api } from '@/convex/_generated/api'
829
+
830
+ export function CourseCard({ courseId }: { courseId: Id<'things'> }) {
831
+ // Real-time subscription
832
+ const course = useQuery(api.queries.things.get, { id: courseId })
833
+
834
+ if (!course) return <Skeleton />
835
+
836
+ return (
837
+ <div class="card">
838
+ <img src={course.properties.thumbnail} alt={course.properties.title} />
839
+ <h3>{course.properties.title}</h3>
840
+ <p>{course.properties.description}</p>
841
+ <span>${course.properties.price}</span>
842
+ <button>Enroll Now</button>
843
+ </div>
844
+ )
845
+ }
846
+ ```
847
+
848
+ **When creator updates course → Component auto-updates on all visitors' screens**
849
+
850
+ #### 4. Multi-Tenant Routing
851
+
852
+ **Pattern:** Route to correct org's website.
853
+
854
+ ```typescript
855
+ // middleware/tenant.ts
856
+ export async function onRequest(context, next) {
857
+ const url = new URL(context.request.url)
858
+
859
+ // Extract org slug from subdomain
860
+ const hostname = url.hostname // creator.one.ie
861
+ const orgSlug = hostname.split('.')[0]
862
+
863
+ // Load org context
864
+ const org = await convex.query(api.queries.orgs.getBySlug, { slug: orgSlug })
865
+
866
+ if (!org) {
867
+ return new Response('Organization not found', { status: 404 })
868
+ }
869
+
870
+ // Inject org context into request
871
+ context.locals.org = org
872
+ context.locals.orgId = org._id
873
+
874
+ return next()
875
+ }
876
+ ```
877
+
878
+ ---
879
+
880
+ ## Code Generation Patterns
881
+
882
+ ### 1. Thing → CRUD Components
883
+
884
+ **Input:** Thing type definition
885
+
886
+ **Output:** Full CRUD components
887
+
888
+ ```typescript
889
+ async function generateCRUD(thingType: ThingType) {
890
+ const definition = ontology.getDefinition(thingType)
891
+
892
+ // Generate list component
893
+ const list = `
894
+ import { useQuery } from 'convex/react'
895
+ import { api } from '@/convex/_generated/api'
896
+
897
+ export function ${pascalCase(thingType)}List({ orgId }) {
898
+ const items = useQuery(api.queries.${thingType}.list, { orgId })
899
+
900
+ return (
901
+ <div class="grid gap-4">
902
+ {items?.map(item => (
903
+ <${pascalCase(thingType)}Card key={item._id} item={item} />
904
+ ))}
905
+ </div>
906
+ )
907
+ }
908
+ `
909
+
910
+ // Generate create form
911
+ const form = `
912
+ import { useMutation } from 'convex/react'
913
+ import { api } from '@/convex/_generated/api'
914
+
915
+ export function Create${pascalCase(thingType)}() {
916
+ const create = useMutation(api.mutations.${thingType}.create)
917
+
918
+ return (
919
+ <form onSubmit={async (e) => {
920
+ e.preventDefault()
921
+ const formData = new FormData(e.currentTarget)
922
+ await create({
923
+ ${definition.fields.map(f => `${f.name}: formData.get('${f.name}')`).join(',\n ')}
924
+ })
925
+ }}>
926
+ ${definition.fields.map(f => `
927
+ <label>
928
+ ${f.label}
929
+ <input name="${f.name}" type="${f.inputType}" required={${f.required}} />
930
+ </label>
931
+ `).join('\n')}
932
+ <button type="submit">Create</button>
933
+ </form>
934
+ )
935
+ }
936
+ `
937
+
938
+ // Generate backend mutations
939
+ const mutations = `
940
+ import { v } from 'convex/values'
941
+ import { mutation } from './_generated/server'
942
+
943
+ export const create = mutation({
944
+ args: {
945
+ ${definition.fields.map(f => `${f.name}: v.${f.vType}()`).join(',\n ')}
946
+ },
947
+ handler: async (ctx, args) => {
948
+ // Create thing
949
+ const id = await ctx.db.insert('things', {
950
+ type: '${thingType}',
951
+ name: args.${definition.nameField || 'name'},
952
+ properties: args,
953
+ status: 'active',
954
+ createdAt: Date.now(),
955
+ updatedAt: Date.now()
956
+ })
957
+
958
+ // Log event
959
+ await ctx.db.insert('events', {
960
+ type: 'entity_created',
961
+ actorId: ctx.auth.userId,
962
+ targetId: id,
963
+ timestamp: Date.now(),
964
+ metadata: { thingType: '${thingType}' }
965
+ })
966
+
967
+ return id
968
+ }
969
+ })
970
+ `
971
+
972
+ return { list, form, mutations }
973
+ }
974
+ ```
975
+
976
+ ### 2. Connection → Relationship Components
977
+
978
+ **Input:** Connection type definition
979
+
980
+ **Output:** Relationship management UI
981
+
982
+ ```typescript
983
+ async function generateRelationshipUI(connectionType: ConnectionType) {
984
+ // Generate "Add Connection" button
985
+ const addButton = `
986
+ export function Add${pascalCase(connectionType)}({ fromId, toType }) {
987
+ const [open, setOpen] = useState(false)
988
+ const createConnection = useMutation(api.mutations.connections.create)
989
+
990
+ return (
991
+ <>
992
+ <button onClick={() => setOpen(true)}>
993
+ Add {connectionType}
994
+ </button>
995
+
996
+ <Dialog open={open} onClose={() => setOpen(false)}>
997
+ <ThingPicker
998
+ type={toType}
999
+ onSelect={async (toId) => {
1000
+ await createConnection({
1001
+ fromThingId: fromId,
1002
+ toThingId: toId,
1003
+ relationshipType: '${connectionType}'
1004
+ })
1005
+ setOpen(false)
1006
+ }}
1007
+ />
1008
+ </Dialog>
1009
+ </>
1010
+ )
1011
+ }
1012
+ `
1013
+
1014
+ // Generate "Show Connections" list
1015
+ const list = `
1016
+ export function ${pascalCase(connectionType)}List({ thingId }) {
1017
+ const connections = useQuery(api.queries.connections.list, {
1018
+ fromThingId: thingId,
1019
+ relationshipType: '${connectionType}'
1020
+ })
1021
+
1022
+ return (
1023
+ <div>
1024
+ <h3>{connectionType}s</h3>
1025
+ {connections?.map(conn => (
1026
+ <ConnectionCard key={conn._id} connection={conn} />
1027
+ ))}
1028
+ </div>
1029
+ )
1030
+ }
1031
+ `
1032
+
1033
+ return { addButton, list }
1034
+ }
1035
+ ```
1036
+
1037
+ ### 3. Event → Analytics Dashboard
1038
+
1039
+ **Input:** Event types for org
1040
+
1041
+ **Output:** Analytics dashboard
1042
+
1043
+ ```typescript
1044
+ async function generateAnalyticsDashboard(orgId: Id<'things'>) {
1045
+ // Get all event types used by this org
1046
+ const eventTypes = await db
1047
+ .query('events')
1048
+ .filter(q => q.eq(q.field('metadata.organizationId'), orgId))
1049
+ .collect()
1050
+ .then(events => [...new Set(events.map(e => e.type))])
1051
+
1052
+ // Generate metrics for each event type
1053
+ const dashboard = `
1054
+ export function AnalyticsDashboard({ orgId }) {
1055
+ ${eventTypes.map(type => `
1056
+ const ${camelCase(type)}Count = useQuery(api.queries.analytics.count, {
1057
+ orgId,
1058
+ eventType: '${type}',
1059
+ period: '30d'
1060
+ })
1061
+ `).join('\n')}
1062
+
1063
+ return (
1064
+ <div class="dashboard">
1065
+ ${eventTypes.map(type => `
1066
+ <MetricCard
1067
+ title="${titleCase(type)}"
1068
+ value={${camelCase(type)}Count}
1069
+ change={calculateChange(${camelCase(type)}Count)}
1070
+ />
1071
+ `).join('\n')}
1072
+ </div>
1073
+ )
1074
+ }
1075
+ `
1076
+
1077
+ return dashboard
1078
+ }
1079
+ ```
1080
+
1081
+ ---
1082
+
1083
+ ## Performance Optimization
1084
+
1085
+ ### 1. Context Budget Management
1086
+
1087
+ **Rule:** Every agent has a max context budget.
1088
+
1089
+ ```typescript
1090
+ class Agent {
1091
+ maxContextTokens = 5000
1092
+ currentContext: any[] = []
1093
+
1094
+ async addContext(item: any) {
1095
+ const tokens = estimateTokens(item)
1096
+
1097
+ if (this.totalTokens() + tokens > this.maxContextTokens) {
1098
+ // Evict least recently used context
1099
+ this.evictLRU()
1100
+ }
1101
+
1102
+ this.currentContext.push({ item, tokens, lastUsed: Date.now() })
1103
+ }
1104
+
1105
+ totalTokens() {
1106
+ return this.currentContext.reduce((sum, c) => sum + c.tokens, 0)
1107
+ }
1108
+
1109
+ evictLRU() {
1110
+ this.currentContext.sort((a, b) => a.lastUsed - b.lastUsed)
1111
+ this.currentContext.shift()
1112
+ }
1113
+ }
1114
+ ```
1115
+
1116
+ ### 2. Query Result Caching
1117
+
1118
+ **Pattern:** Cache query results to avoid redundant DB reads.
1119
+
1120
+ ```typescript
1121
+ // Convex query with caching
1122
+ export const getCourseWithRelations = query({
1123
+ args: { courseId: v.id('things') },
1124
+ handler: async (ctx, { courseId }) => {
1125
+ // Check cache first
1126
+ const cacheKey = `course:${courseId}`
1127
+ const cached = await ctx.db.get(/* cache table */)
1128
+
1129
+ if (cached && Date.now() - cached.timestamp < 5 * 60 * 1000) {
1130
+ return cached.data
1131
+ }
1132
+
1133
+ // Fetch from DB
1134
+ const data = await fetchCourseWithRelations(ctx, courseId)
1135
+
1136
+ // Cache result
1137
+ await ctx.db.insert('cache', {
1138
+ key: cacheKey,
1139
+ data,
1140
+ timestamp: Date.now(),
1141
+ ttl: 5 * 60 * 1000
1142
+ })
1143
+
1144
+ return data
1145
+ }
1146
+ })
1147
+ ```
1148
+
1149
+ ### 3. Lazy Loading
1150
+
1151
+ **Pattern:** Load data only when visible.
1152
+
1153
+ ```tsx
1154
+ export function ThingGrid({ things }: { things: Thing[] }) {
1155
+ return (
1156
+ <div class="grid">
1157
+ {things.map(thing => (
1158
+ <LazyLoad key={thing._id} offset={100}>
1159
+ <ThingCard thingId={thing._id} />
1160
+ </LazyLoad>
1161
+ ))}
1162
+ </div>
1163
+ )
1164
+ }
1165
+
1166
+ function ThingCard({ thingId }: { thingId: Id<'things'> }) {
1167
+ // Only queries when visible
1168
+ const thing = useQuery(api.queries.things.get, { id: thingId })
1169
+
1170
+ if (!thing) return <Skeleton />
1171
+ return <Card {...thing} />
1172
+ }
1173
+ ```
1174
+
1175
+ ### 4. Batch Operations
1176
+
1177
+ **Pattern:** Batch creates/updates to reduce mutations.
1178
+
1179
+ ```typescript
1180
+ // Instead of N mutations
1181
+ for (const lesson of lessons) {
1182
+ await createLesson(lesson) // N calls
1183
+ }
1184
+
1185
+ // Batch into 1 mutation
1186
+ export const createLessonsBatch = mutation({
1187
+ args: { lessons: v.array(v.any()) },
1188
+ handler: async (ctx, { lessons }) => {
1189
+ const ids = []
1190
+
1191
+ for (const lesson of lessons) {
1192
+ const id = await ctx.db.insert('things', {
1193
+ type: 'lesson',
1194
+ name: lesson.title,
1195
+ properties: lesson,
1196
+ status: 'active',
1197
+ createdAt: Date.now(),
1198
+ updatedAt: Date.now()
1199
+ })
1200
+ ids.push(id)
1201
+ }
1202
+
1203
+ // Single event for batch
1204
+ await ctx.db.insert('events', {
1205
+ type: 'entity_created',
1206
+ actorId: ctx.auth.userId,
1207
+ timestamp: Date.now(),
1208
+ metadata: {
1209
+ thingType: 'lesson',
1210
+ batchSize: lessons.length,
1211
+ ids
1212
+ }
1213
+ })
1214
+
1215
+ return ids
1216
+ }
1217
+ })
1218
+ ```
1219
+
1220
+ ---
1221
+
1222
+ ## Summary: Engineering Principles
1223
+
1224
+ ### 1. **Minimal Context is Beautiful**
1225
+ - Never load full ontology
1226
+ - Query-first, load-on-demand
1227
+ - Cache frequently used patterns
1228
+ - Evict stale context aggressively
1229
+
1230
+ ### 2. **Specialist Agents Win**
1231
+ - 10 small experts beat 1 generalist
1232
+ - Each agent has focused context
1233
+ - Agents compose via orchestration
1234
+ - Parallel execution when possible
1235
+
1236
+ ### 3. **Ontology Drives Everything**
1237
+ - Schema generation from ontology
1238
+ - Component generation from thing types
1239
+ - Query optimization from indexes
1240
+ - Analytics from event types
1241
+
1242
+ ### 4. **Dynamic is Better Than Static**
1243
+ - Generate components at build time
1244
+ - Generate pages from org content
1245
+ - Real-time updates via subscriptions
1246
+ - Multi-tenant routing
1247
+
1248
+ ### 5. **Performance Through Design**
1249
+ - Index-first queries
1250
+ - Batch operations
1251
+ - Lazy loading
1252
+ - Result caching
1253
+
1254
+ ---
1255
+
1256
+ ## Next Steps
1257
+
1258
+ 1. **Implement Core Agents**
1259
+ - Start with Ontology Agent (router)
1260
+ - Add Query Agent (most used)
1261
+ - Add Mutation Agent (critical path)
1262
+
1263
+ 2. **Build Code Generators**
1264
+ - Thing → CRUD components
1265
+ - Connection → Relationship UI
1266
+ - Event → Analytics dashboards
1267
+
1268
+ 3. **Create Template System**
1269
+ - 3 base templates (minimal, showcase, portfolio)
1270
+ - Component library
1271
+ - Deployment pipeline
1272
+
1273
+ 4. **Optimize Context Usage**
1274
+ - Measure token usage per operation
1275
+ - Set budgets per agent
1276
+ - Monitor and optimize
1277
+
1278
+ 5. **Scale Testing**
1279
+ - 100 orgs × 1000 things each
1280
+ - Context usage under load
1281
+ - Query performance
1282
+ - Real-time subscription limits
1283
+
1284
+ ---
1285
+
1286
+ **Philosophy:** Context is expensive. Intelligence is cheap when focused. The ontology is our compression algorithm.
1287
+
1288
+ **Result:** Build infinitely complex systems with minimal context by leveraging specialist agents and dynamic generation from a stable 6-dimension ontology.
1289
+
1290
+ ---
1291
+
1292
+ **END OF ONTOLOGY ENGINEERING SPECIFICATION**