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,905 @@
1
+ # Workflow - Ontology-Driven Development
2
+
3
+ **Version:** 1.0.0
4
+ **Purpose:** Define the exact workflow for building features on the ONE Platform using the 6-dimension ontology
5
+
6
+ ---
7
+
8
+ ## Overview
9
+
10
+ Every feature in ONE Platform follows a 6-phase workflow that ensures consistency, quality, and adherence to the ontology. This workflow prevents technical debt and makes AI agents more effective at code generation.
11
+
12
+ **The Golden Rule:** If you can't map your feature to the 6 dimensions (organizations, people, things, connections, events, knowledge), you're thinking about it wrong.
13
+
14
+ ---
15
+
16
+ ## The 6-Phase Workflow
17
+
18
+ ```
19
+ Phase 1: UNDERSTAND
20
+ ↓
21
+ Phase 2: MAP TO ONTOLOGY
22
+ ↓
23
+ Phase 3: DESIGN SERVICES
24
+ ↓
25
+ Phase 4: IMPLEMENT BACKEND
26
+ ↓
27
+ Phase 5: BUILD FRONTEND
28
+ ↓
29
+ Phase 6: TEST & DOCUMENT
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Phase 1: UNDERSTAND
35
+
36
+ **Goal:** Fully understand the feature requirements and context.
37
+
38
+ ### Step 1.1: Read Context Documentation
39
+
40
+ **MANDATORY READING ORDER:**
41
+
42
+ 1. **`one/knowledge/ontology.md`** (5 min) - The 6-dimension universe
43
+ 2. **`one/things/README.md`** (2 min) - Understand thing types
44
+ 3. **`one/connections/README.md`** (2 min) - Understand connection types
45
+ 4. **`one/events/README.md`** (2 min) - Understand event types
46
+ 5. **`one/things/files.md`** (3 min) - File organization
47
+
48
+ **For specific features, also read:**
49
+
50
+ - **Blockchain features:** `one/things/Sui.md`, `one/connections/cryptonetworks.md`
51
+ - **Inference features:** `one/events/InferenceRevenue.md`
52
+ - **Protocol features:** `one/connections/protocols.md` + specific protocol doc
53
+ - **Integration features:** `one/connections/communications.md` + specific integration doc
54
+ - **Agent features:** `one/things/AgentKit.md`, `one/things/CopilotKit.md`
55
+
56
+ ### Step 1.2: Identify Feature Category
57
+
58
+ **Ask yourself:**
59
+
60
+ - Is this a new entity type?
61
+ - Is this a new relationship?
62
+ - Is this a new action/event?
63
+ - Is this a query/reporting feature?
64
+ - Does it involve external protocols (A2A, ACP, AP2, X402)?
65
+ - Does it involve blockchain (SUI, Solana, Base)?
66
+
67
+ ### Step 1.3: Find Similar Patterns
68
+
69
+ **Search for existing implementations:**
70
+
71
+ - Similar entity types in `convex/schema.ts`
72
+ - Similar mutations in `convex/mutations/`
73
+ - Similar queries in `convex/queries/`
74
+ - Similar services in `convex/services/`
75
+ - Similar components in `src/components/features/`
76
+
77
+ **Example:**
78
+ If building "NFT Minting", search for:
79
+
80
+ - Token minting patterns
81
+ - Blockchain transaction patterns
82
+ - Payment processing patterns
83
+
84
+ ---
85
+
86
+ ## Phase 2: MAP TO ONTOLOGY
87
+
88
+ **Goal:** Map the feature to the 6-dimension ontology BEFORE writing any code.
89
+
90
+ ### Step 2.1: Identify Things
91
+
92
+ **Question:** What entities are involved?
93
+
94
+ **Template:**
95
+
96
+ ```
97
+ Things:
98
+ - <thing_name> (type: "<thing_type>")
99
+ properties: { <key properties> }
100
+ - <thing_name> (type: "<thing_type>")
101
+ properties: { <key properties> }
102
+ ```
103
+
104
+ **Example: Token Purchase**
105
+
106
+ ```
107
+ Things:
108
+ - user (type: "creator" or "audience_member")
109
+ properties: { email, walletAddress }
110
+ - token (type: "token")
111
+ properties: { contractAddress, totalSupply, price }
112
+ ```
113
+
114
+ ### Step 2.2: Identify Connections
115
+
116
+ **Question:** How do entities relate to each other?
117
+
118
+ **Template:**
119
+
120
+ ```
121
+ Connections:
122
+ - <from_thing> → <to_thing> (relationshipType: "<type>")
123
+ metadata: { <relationship details> }
124
+ ```
125
+
126
+ **Example: Token Purchase**
127
+
128
+ ```
129
+ Connections:
130
+ - user → token (relationshipType: "holds_tokens")
131
+ metadata: {
132
+ balance: 100,
133
+ balanceObjectId: "0x123...", // SUI coin object
134
+ walletAddress: "0xabc...",
135
+ acquiredAt: Date.now()
136
+ }
137
+ ```
138
+
139
+ ### Step 2.3: Identify Events
140
+
141
+ **Question:** What actions need to be logged?
142
+
143
+ **Template:**
144
+
145
+ ```
146
+ Events:
147
+ - <event_type>
148
+ actorId: <who_did_it>
149
+ targetId: <what_it_affected>
150
+ metadata: { <event details> }
151
+ ```
152
+
153
+ **Example: Token Purchase**
154
+
155
+ ```
156
+ Events:
157
+ - tokens_purchased
158
+ actorId: userId
159
+ targetId: tokenId
160
+ metadata: {
161
+ network: "sui",
162
+ amount: 100,
163
+ paidAmount: 0.5, // SUI paid
164
+ txDigest: "9mKG...",
165
+ }
166
+ ```
167
+
168
+ ### Step 2.4: Tags & Knowledge
169
+
170
+ **Question:** What categorization or semantic data is needed?
171
+
172
+ Use tags for categorization; use knowledge items for RAG when needed.
173
+
174
+ **Template:**
175
+
176
+ ```
177
+ Tags:
178
+ - thingTags: [<tag1>, <tag2>] // applied via junction
179
+
180
+ Knowledge (optional):
181
+ - knowledge_item things for chunks/summaries
182
+ - embedding things for vectors when stored explicitly
183
+ ```
184
+
185
+ **Example: Token Purchase**
186
+
187
+ ```
188
+ Tags:
189
+ - ["network:sui", "protocol:sui-move", "status:active"]
190
+
191
+ Knowledge:
192
+ - None (tokens typically don’t require RAG)
193
+ ```
194
+
195
+ ### Step 2.5: Validate Ontology Mapping
196
+
197
+ **Checklist:**
198
+
199
+ - [ ] All entities map to existing thing types (or propose new type)
200
+ - [ ] All relationships use existing connection types
201
+ - [ ] All events use existing event types
202
+ - [ ] Metadata captures protocol/network specifics
203
+ - [ ] No custom tables needed (everything fits in 6 dimensions)
204
+
205
+ **If validation fails:** Re-think the feature. The ontology is intentionally complete.
206
+
207
+ ### Step 2.6: Protocol Mapping
208
+
209
+ Declare protocol usage explicitly across primitives.
210
+
211
+ - Thing: set `properties.protocol` (e.g., `openai`, `ap2`, `acp`, `x402`, `sui`).
212
+ - Connection: set `metadata.protocol` for protocol-scoped relationships.
213
+ - Event: set `metadata.protocol` and echo key protocol fields (ids, tx hashes, network, status).
214
+
215
+ ---
216
+
217
+ ## Phase 3: DESIGN SERVICES
218
+
219
+ **Goal:** Design pure Effect.ts services for business logic.
220
+
221
+ ### Step 3.1: Define Service Interface
222
+
223
+ **Pattern:**
224
+
225
+ ```typescript
226
+ // convex/services/<category>/<service>.ts
227
+ export class <Service>Service extends Effect.Service<<Service>Service>()(
228
+ "<Service>Service",
229
+ {
230
+ effect: Effect.gen(function* () {
231
+ const db = yield* ConvexDatabase;
232
+ const <provider> = yield* <Provider>;
233
+
234
+ return {
235
+ <method>: (args: <Args>) =>
236
+ Effect.gen(function* () {
237
+ // Business logic here
238
+ }),
239
+ };
240
+ }),
241
+ dependencies: [ConvexDatabase.Default, <Provider>.Default],
242
+ }
243
+ ) {}
244
+ ```
245
+
246
+ **Example: Token Purchase Service**
247
+
248
+ ```typescript
249
+ // convex/services/blockchain/token.ts
250
+ export class TokenService extends Effect.Service<TokenService>()(
251
+ "TokenService",
252
+ {
253
+ effect: Effect.gen(function* () {
254
+ const db = yield* ConvexDatabase;
255
+ const sui = yield* SuiProvider;
256
+
257
+ return {
258
+ purchase: (args: PurchaseTokenArgs) =>
259
+ Effect.gen(function* () {
260
+ // 1. Validate
261
+ const user = yield* Effect.tryPromise(() => db.get(args.userId));
262
+ const token = yield* Effect.tryPromise(() => db.get(args.tokenId));
263
+
264
+ if (!user) {
265
+ return yield* Effect.fail(new UserNotFoundError());
266
+ }
267
+
268
+ // 2. Execute blockchain transaction
269
+ const tx = new Transaction();
270
+ // ... build transaction
271
+ const result = yield* sui.executeTransaction(tx);
272
+
273
+ // 3. Create/update connection
274
+ yield* Effect.tryPromise(() =>
275
+ db.insert("connections", {
276
+ fromThingId: args.userId,
277
+ toThingId: args.tokenId,
278
+ relationshipType: "holds_tokens",
279
+ metadata: {
280
+ network: "sui",
281
+ balance: args.amount,
282
+ balanceObjectId: result.objectId,
283
+ walletAddress: user.properties.walletAddress,
284
+ acquiredAt: Date.now(),
285
+ },
286
+ createdAt: Date.now(),
287
+ })
288
+ );
289
+
290
+ // 4. Log event
291
+ yield* Effect.tryPromise(() =>
292
+ db.insert("events", {
293
+ type: "tokens_purchased",
294
+ actorId: args.userId,
295
+ targetId: args.tokenId,
296
+ timestamp: Date.now(),
297
+ metadata: {
298
+ network: "sui",
299
+ amount: args.amount,
300
+ txDigest: result.digest,
301
+ },
302
+ })
303
+ );
304
+
305
+ return { success: true, txDigest: result.digest };
306
+ }),
307
+ };
308
+ }),
309
+ dependencies: [ConvexDatabase.Default, SuiProvider.Default],
310
+ }
311
+ ) {}
312
+ ```
313
+
314
+ ### Step 3.2: Define Error Types
315
+
316
+ **Pattern:**
317
+
318
+ ```typescript
319
+ // convex/services/<category>/errors.ts
320
+ import { Data } from "effect";
321
+
322
+ export class <Error>Error extends Data.TaggedError("<Error>Error")<{
323
+ message: string;
324
+ code?: string;
325
+ }> {}
326
+ ```
327
+
328
+ **Example:**
329
+
330
+ ```typescript
331
+ // convex/services/blockchain/errors.ts
332
+ export class UserNotFoundError extends Data.TaggedError("UserNotFoundError")<{
333
+ message: string;
334
+ userId: string;
335
+ }> {}
336
+
337
+ export class InsufficientBalanceError extends Data.TaggedError(
338
+ "InsufficientBalanceError"
339
+ )<{
340
+ message: string;
341
+ required: number;
342
+ available: number;
343
+ }> {}
344
+
345
+ export class BlockchainError extends Data.TaggedError("BlockchainError")<{
346
+ message: string;
347
+ network: "sui" | "solana" | "base";
348
+ txHash?: string;
349
+ }> {}
350
+ ```
351
+
352
+ ### Step 3.3: Service Rules
353
+
354
+ **MUST:**
355
+
356
+ - Pure functions only (no side effects outside Effect)
357
+ - Explicit types (no `any`)
358
+ - Typed errors with `_tag` pattern
359
+ - Dependency injection via Effect.Service
360
+ - Business logic ONLY (no Convex-specific code)
361
+
362
+ **MUST NOT:**
363
+
364
+ - Use `console.log` (use Effect.log)
365
+ - Catch errors with try/catch (use Effect.tryPromise)
366
+ - Mix UI logic with business logic
367
+ - Hard-code configuration (use environment variables)
368
+
369
+ ### Step 3.4: Service Invariants Checklist
370
+
371
+ - Validate inputs with `v` validators and explicit types.
372
+ - Enforce tenancy and roles via connections before mutating.
373
+ - Prefer consolidated types (`transacted`, `communicated`, `delegated`).
374
+ - Always include `metadata.protocol` when a provider/protocol is involved.
375
+ - Ensure indexes exist for every non-id lookup used.
376
+
377
+ ---
378
+
379
+ ## Phase 4: IMPLEMENT BACKEND
380
+
381
+ **Goal:** Create thin Convex wrappers that call Effect.ts services.
382
+
383
+ ### Step 4.1: Create Mutation
384
+
385
+ **Pattern:**
386
+
387
+ ```typescript
388
+ // convex/mutations/<domain>.ts
389
+ import { confect } from "@/convex/lib/confect";
390
+ import { v } from "convex/values";
391
+ import { Effect } from "effect";
392
+ import { <Service>Service } from "@/convex/services/<category>/<service>";
393
+ import { MainLayer } from "@/convex/layers";
394
+
395
+ export const <methodName> = confect.mutation({
396
+ args: {
397
+ // Convex validators
398
+ <arg>: v.id("things"),
399
+ <arg>: v.number(),
400
+ },
401
+ handler: (ctx, args) =>
402
+ Effect.gen(function* () {
403
+ const service = yield* <Service>Service;
404
+ return yield* service.<method>(args);
405
+ }).pipe(Effect.provide(MainLayer)),
406
+ });
407
+ ```
408
+
409
+ **Example: Token Purchase Mutation**
410
+
411
+ ```typescript
412
+ // convex/mutations/tokens.ts
413
+ export const purchase = confect.mutation({
414
+ args: {
415
+ tokenId: v.id("things"),
416
+ amount: v.number(),
417
+ },
418
+ handler: (ctx, args) =>
419
+ Effect.gen(function* () {
420
+ const tokenService = yield* TokenService;
421
+ const userId = yield* Effect.fromNullable(
422
+ ctx.auth.userId,
423
+ () => new UnauthorizedError({ message: "Must be logged in" })
424
+ );
425
+
426
+ return yield* tokenService.purchase({
427
+ userId,
428
+ tokenId: args.tokenId,
429
+ amount: args.amount,
430
+ });
431
+ }).pipe(Effect.provide(MainLayer)),
432
+ });
433
+ ```
434
+
435
+ ### Step 4.2: Create Query
436
+
437
+ **Pattern:**
438
+
439
+ ```typescript
440
+ // convex/queries/<domain>.ts
441
+ export const <queryName> = confect.query({
442
+ args: {
443
+ <arg>: v.id("things"),
444
+ },
445
+ handler: (ctx, args) =>
446
+ Effect.gen(function* () {
447
+ const service = yield* <Service>Service;
448
+ return yield* service.<method>(args);
449
+ }).pipe(Effect.provide(MainLayer)),
450
+ });
451
+ ```
452
+
453
+ **Example: Get Token Balance**
454
+
455
+ ```typescript
456
+ // convex/queries/tokens.ts
457
+ export const getBalance = confect.query({
458
+ args: {
459
+ userId: v.id("things"),
460
+ tokenId: v.id("things"),
461
+ },
462
+ handler: (ctx, args) =>
463
+ Effect.gen(function* () {
464
+ const tokenService = yield* TokenService;
465
+ return yield* tokenService.getBalance(args);
466
+ }).pipe(Effect.provide(MainLayer)),
467
+ });
468
+ ```
469
+
470
+ ### Step 4.3: Backend Rules
471
+
472
+ **Convex functions should:**
473
+
474
+ - Validate arguments with Convex validators
475
+ - Call service methods (thin wrapper)
476
+ - Provide MainLayer
477
+ - Handle authentication/authorization
478
+ - Return serializable data only
479
+
480
+ **Convex functions should NOT:**
481
+
482
+ - Contain business logic (use services)
483
+ - Make external API calls directly (use services)
484
+ - Parse/transform complex data (use services)
485
+
486
+ ### Step 4.4: Streaming & AG-UI (Optional)
487
+
488
+ For AI outputs that the UI should render dynamically, emit `communication_event` rows with structured payloads and protocol metadata.
489
+
490
+ ```typescript
491
+ await ctx.db.insert("events", {
492
+ type: "communication_event",
493
+ actorId: agentId,
494
+ targetId: conversationId,
495
+ timestamp: Date.now(),
496
+ metadata: {
497
+ protocol: "openai",
498
+ messageType: "ui",
499
+ component: "Card",
500
+ data: { title: "Campaign Outline", items: ["Hook", "CTA", "Channels"] },
501
+ },
502
+ });
503
+ ```
504
+
505
+ See `one/things/CopilotKit.md` and `one/things/AgentKit.md` for details.
506
+
507
+ ---
508
+
509
+ ## Phase 5: BUILD FRONTEND
510
+
511
+ **Goal:** Create React components that use Convex hooks.
512
+
513
+ ### Step 5.1: Create Feature Component
514
+
515
+ **Pattern:**
516
+
517
+ ```typescript
518
+ // src/components/features/<domain>/<Component>.tsx
519
+ import { useMutation, useQuery } from "convex/react";
520
+ import { api } from "@/convex/_generated/api";
521
+ import { Button } from "@/components/ui/button";
522
+ import type { Id } from "@/convex/_generated/dataModel";
523
+
524
+ export function <Component>({ <prop> }: { <prop>: <Type> }) {
525
+ const <mutation> = useMutation(api.<domain>.<method>);
526
+ const <query> = useQuery(api.<domain>.<query>, { <arg> });
527
+
528
+ return (
529
+ <div>
530
+ {/* UI here */}
531
+ <Button onClick={() => <mutation>({ <arg> })}>
532
+ Action
533
+ </Button>
534
+ </div>
535
+ );
536
+ }
537
+ ```
538
+
539
+ **Example: Token Purchase Component**
540
+
541
+ ```typescript
542
+ // src/components/features/tokens/TokenPurchase.tsx
543
+ import { useMutation, useQuery } from "convex/react";
544
+ import { api } from "@/convex/_generated/api";
545
+ import { Button } from "@/components/ui/button";
546
+ import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
547
+ import type { Id } from "@/convex/_generated/dataModel";
548
+ import { useState } from "react";
549
+
550
+ export function TokenPurchase({ tokenId }: { tokenId: Id<"things"> }) {
551
+ const [amount, setAmount] = useState(100);
552
+ const [loading, setLoading] = useState(false);
553
+
554
+ const purchase = useMutation(api.tokens.purchase);
555
+ const balance = useQuery(api.tokens.getBalance, { tokenId });
556
+ const token = useQuery(api.tokens.get, { id: tokenId });
557
+
558
+ const handlePurchase = async () => {
559
+ setLoading(true);
560
+ try {
561
+ await purchase({ tokenId, amount });
562
+ } catch (error) {
563
+ console.error("Purchase failed:", error);
564
+ } finally {
565
+ setLoading(false);
566
+ }
567
+ };
568
+
569
+ return (
570
+ <Card>
571
+ <CardHeader>
572
+ <CardTitle>{token?.name || "Token"}</CardTitle>
573
+ </CardHeader>
574
+ <CardContent>
575
+ <p>Your balance: {balance?.metadata.balance || 0}</p>
576
+ <p>Price: {token?.properties.price} SUI</p>
577
+
578
+ <div className="flex gap-2 mt-4">
579
+ <input
580
+ type="number"
581
+ value={amount}
582
+ onChange={(e) => setAmount(Number(e.target.value))}
583
+ className="border rounded px-2"
584
+ />
585
+ <Button onClick={handlePurchase} disabled={loading}>
586
+ {loading ? "Purchasing..." : `Buy ${amount} Tokens`}
587
+ </Button>
588
+ </div>
589
+ </CardContent>
590
+ </Card>
591
+ );
592
+ }
593
+ ```
594
+
595
+ ### Step 5.2: Create Astro Page (if needed)
596
+
597
+ **Pattern:**
598
+
599
+ ```astro
600
+ ---
601
+ // src/pages/<domain>/[id].astro
602
+ import { ConvexHttpClient } from "convex/browser";
603
+ import { api } from "@/convex/_generated/api";
604
+ import Layout from "@/layouts/Layout.astro";
605
+ import <Component> from "@/components/features/<domain>/<Component>";
606
+
607
+ const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
608
+ const <data> = await convex.query(api.<domain>.<query>, {
609
+ id: Astro.params.id,
610
+ });
611
+ ---
612
+
613
+ <Layout title={<data>.name}>
614
+ <h1>{<data>.name}</h1>
615
+ <<Component> client:load <prop>={<data>._id} />
616
+ </Layout>
617
+ ```
618
+
619
+ **Example: Token Detail Page**
620
+
621
+ ```astro
622
+ ---
623
+ // src/pages/tokens/[id].astro
624
+ import { ConvexHttpClient } from "convex/browser";
625
+ import { api } from "@/convex/_generated/api";
626
+ import Layout from "@/layouts/Layout.astro";
627
+ import TokenPurchase from "@/components/features/tokens/TokenPurchase";
628
+
629
+ const convex = new ConvexHttpClient(import.meta.env.PUBLIC_CONVEX_URL);
630
+ const token = await convex.query(api.tokens.get, {
631
+ id: Astro.params.id as any,
632
+ });
633
+ ---
634
+
635
+ <Layout title={token.name}>
636
+ <div class="container mx-auto p-4">
637
+ <h1 class="text-3xl font-bold mb-4">{token.name}</h1>
638
+ <p class="text-muted-foreground mb-8">{token.properties.description}</p>
639
+
640
+ <TokenPurchase client:load tokenId={token._id} />
641
+ </div>
642
+ </Layout>
643
+ ```
644
+
645
+ ### Step 5.3: Frontend Rules
646
+
647
+ **Components should:**
648
+
649
+ - Use Convex hooks (`useQuery`, `useMutation`)
650
+ - Use shadcn/ui components
651
+ - Handle loading states
652
+ - Handle error states
653
+ - Be small and focused (single responsibility)
654
+
655
+ When rendering AG-UI messages, map `communication_event` payloads to PromptKit components (no raw HTML injection).
656
+
657
+ **Components should NOT:**
658
+
659
+ - Contain business logic (use mutations)
660
+ - Make API calls directly (use Convex)
661
+ - Mutate props
662
+ - Use class components (use function components)
663
+
664
+ ---
665
+
666
+ ## Phase 6: TEST & DOCUMENT
667
+
668
+ **Goal:** Ensure quality and maintainability.
669
+
670
+ ### Step 6.1: Write Unit Tests
671
+
672
+ **Pattern:**
673
+
674
+ ```typescript
675
+ // tests/unit/services/<service>.test.ts
676
+ import { describe, it, expect } from "vitest";
677
+ import { Effect, Layer } from "effect";
678
+ import { <Service>Service } from "@/convex/services/<category>/<service>";
679
+ import { ConvexDatabase } from "@/convex/lib/convex-database";
680
+
681
+ describe("<Service>Service.<method>", () => {
682
+ it("should <expected behavior>", async () => {
683
+ // Mock dependencies
684
+ const MockDatabase = Layer.succeed(ConvexDatabase, {
685
+ get: () => Effect.succeed({ _id: "123", type: "token" }),
686
+ insert: () => Effect.succeed("456"),
687
+ // ...
688
+ });
689
+
690
+ const TestLayer = MockDatabase;
691
+
692
+ const result = await Effect.runPromise(
693
+ Effect.gen(function* () {
694
+ const service = yield* <Service>Service;
695
+ return yield* service.<method>({ <args> });
696
+ }).pipe(Effect.provide(TestLayer))
697
+ );
698
+
699
+ expect(result.success).toBe(true);
700
+ });
701
+
702
+ it("should fail when <error condition>", async () => {
703
+ // Test error cases
704
+ });
705
+ });
706
+ ```
707
+
708
+ **Example: Token Service Test**
709
+
710
+ ```typescript
711
+ // tests/unit/services/token.test.ts
712
+ describe("TokenService.purchase", () => {
713
+ it("should purchase tokens successfully", async () => {
714
+ const MockSUI = Layer.succeed(SuiProvider, {
715
+ executeTransaction: () =>
716
+ Effect.succeed({
717
+ digest: "9mKG...",
718
+ objectId: "0x123...",
719
+ }),
720
+ });
721
+
722
+ const MockDB = Layer.succeed(ConvexDatabase, {
723
+ get: (id) =>
724
+ Effect.succeed({
725
+ _id: id,
726
+ type: "token",
727
+ properties: { price: 0.1 },
728
+ }),
729
+ insert: () => Effect.succeed("connection_id"),
730
+ });
731
+
732
+ const TestLayer = Layer.merge(MockSUI, MockDB);
733
+
734
+ const result = await Effect.runPromise(
735
+ Effect.gen(function* () {
736
+ const service = yield* TokenService;
737
+ return yield* service.purchase({
738
+ userId: "user_123",
739
+ tokenId: "token_456",
740
+ amount: 100,
741
+ });
742
+ }).pipe(Effect.provide(TestLayer))
743
+ );
744
+
745
+ expect(result.success).toBe(true);
746
+ expect(result.txDigest).toBe("9mKG...");
747
+ });
748
+ });
749
+ ```
750
+
751
+ ### Step 6.2: Write Integration Tests
752
+
753
+ **Pattern:**
754
+
755
+ ```typescript
756
+ // tests/integration/<feature>.test.ts
757
+ import { describe, it, expect } from "vitest";
758
+ import { ConvexTestingHelper } from "convex-test";
759
+
760
+ describe("<Feature> Integration", () => {
761
+ it("should complete full flow", async () => {
762
+ const t = new ConvexTestingHelper();
763
+
764
+ // Test full flow: mutation → service → database → event
765
+ });
766
+ });
767
+ ```
768
+
769
+ ### Step 6.3: Update Documentation
770
+
771
+ **Required updates:**
772
+
773
+ - Add to `one/things/README.md` if new thing type
774
+ - Add to `one/connections/README.md` if new connection type
775
+ - Add to `one/events/README.md` if new event type
776
+ - Update `one/things/files.md` with new files
777
+ - Add code examples to relevant docs
778
+
779
+ **Optional updates:**
780
+
781
+ - Create dedicated doc in `one/things/<ThingType>.md`
782
+ - Create dedicated doc in `one/events/<EventCategory>.md`
783
+ - Update `one/connections/patterns.md` if novel pattern
784
+
785
+ ---
786
+
787
+ ## Workflow Checklist
788
+
789
+ ### Before Starting
790
+
791
+ - [ ] Read `one/knowledge/ontology.md`
792
+ - [ ] Understand the 6-dimension model
793
+ - [ ] Identify similar existing patterns
794
+ - [ ] Map feature to ontology (Phase 2)
795
+
796
+ ### During Implementation
797
+
798
+ - [ ] Design Effect.ts services (Phase 3)
799
+ - [ ] Create thin Convex wrappers (Phase 4)
800
+ - [ ] Build React components (Phase 5)
801
+ - [ ] Follow naming conventions
802
+ - [ ] Use explicit types
803
+ - [ ] Set `properties.protocol` / `metadata.protocol` as applicable
804
+ - [ ] Ensure indexes exist for all queries
805
+
806
+ ### After Implementation
807
+
808
+ - [ ] Write unit tests (Phase 6)
809
+ - [ ] Write integration tests (Phase 6)
810
+ - [ ] Update documentation (Phase 6)
811
+ - [ ] Run TypeScript checks (`bunx astro check`)
812
+ - [ ] Run tests (`bun test`)
813
+ - [ ] Review safety gates (tenancy, approvals, audit events)
814
+
815
+ ---
816
+
817
+ ## Anti-Patterns to Avoid
818
+
819
+ ### ❌ DON'T: Skip Ontology Mapping
820
+
821
+ ```typescript
822
+ // BAD: Creating custom tables
823
+ await db.insert("custom_nft_table", { ... });
824
+ ```
825
+
826
+ ### ✅ DO: Map to Ontology
827
+
828
+ ```typescript
829
+ // GOOD: Using things table
830
+ await db.insert("things", {
831
+ type: "nft",
832
+ properties: { ... }
833
+ });
834
+ ```
835
+
836
+ ### ❌ DON'T: Put Business Logic in Convex Functions
837
+
838
+ ```typescript
839
+ // BAD
840
+ export const purchase = mutation({
841
+ handler: async (ctx, args) => {
842
+ const balance = await getBalance(args.userId);
843
+ if (balance < args.price) {
844
+ throw new Error("Insufficient balance");
845
+ }
846
+ // ... more logic
847
+ },
848
+ });
849
+ ```
850
+
851
+ ### ✅ DO: Put Business Logic in Services
852
+
853
+ ```typescript
854
+ // GOOD
855
+ export const purchase = confect.mutation({
856
+ handler: (ctx, args) =>
857
+ Effect.gen(function* () {
858
+ const service = yield* TokenService;
859
+ return yield* service.purchase(args);
860
+ }).pipe(Effect.provide(MainLayer)),
861
+ });
862
+ ```
863
+
864
+ ### ❌ DON'T: Use `any` Types
865
+
866
+ ```typescript
867
+ // BAD
868
+ const result: any = await service.execute();
869
+ ```
870
+
871
+ ### ✅ DO: Use Explicit Types
872
+
873
+ ```typescript
874
+ // GOOD
875
+ const result: PurchaseResult = await service.purchase(args);
876
+ ```
877
+
878
+ ---
879
+
880
+ ## Summary
881
+
882
+ **The 6-Phase Workflow:**
883
+
884
+ 1. **UNDERSTAND** - Read docs, identify category
885
+ 2. **MAP TO ONTOLOGY** - Things, connections, events, tags
886
+ 3. **DESIGN SERVICES** - Pure Effect.ts business logic
887
+ 4. **IMPLEMENT BACKEND** - Thin Convex wrappers
888
+ 5. **BUILD FRONTEND** - React components with Convex hooks
889
+ 6. **TEST & DOCUMENT** - Unit tests, integration tests, docs
890
+
891
+ **Key Principles:**
892
+
893
+ - Ontology first, code second
894
+ - Pure functions, explicit types
895
+ - Business logic in services
896
+ - Thin wrappers everywhere
897
+ - Test everything
898
+
899
+ Additional principles:
900
+
901
+ - Explicit protocol mapping (`properties.protocol`, `metadata.protocol`).
902
+ - Prefer consolidated connection/event types.
903
+ - Use tags for categorization; use knowledge things for RAG.
904
+
905
+ **This workflow ensures every feature makes the codebase BETTER, not worse.**