oneie 3.6.13 → 3.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (773) hide show
  1. package/.claude/agents/AUDIT-agent-ops-alignment.md +379 -0
  2. package/.claude/agents/NEWS-QUICKSTART.md +321 -0
  3. package/.claude/agents/NEWS-README.md +353 -0
  4. package/.claude/agents/agent-backend.md +1 -1
  5. package/.claude/agents/agent-builder.md +220 -151
  6. package/.claude/agents/agent-clean.md +39 -31
  7. package/.claude/agents/agent-clone.md +107 -54
  8. package/.claude/agents/agent-designer.md +76 -71
  9. package/.claude/agents/agent-director.md +164 -1
  10. package/.claude/agents/agent-documenter.md +169 -132
  11. package/.claude/agents/agent-frontend.md +442 -446
  12. package/.claude/agents/agent-integrator.md +30 -23
  13. package/.claude/agents/agent-lawyer.md +145 -98
  14. package/.claude/agents/agent-news.md +363 -0
  15. package/.claude/agents/agent-onboard.md +99 -69
  16. package/.claude/agents/agent-ontology.md +585 -0
  17. package/.claude/agents/agent-ops.md +178 -171
  18. package/.claude/agents/agent-problem-solver.md +132 -115
  19. package/.claude/agents/agent-quality.md +94 -77
  20. package/.claude/agents/agent-sales.md +89 -67
  21. package/.claude/commands/release.md +3 -1
  22. package/.claude/hooks/README-knowledge-hooks.md +266 -80
  23. package/.claude/hooks/README-root-cleanup.md +200 -0
  24. package/.claude/hooks/README.md +284 -0
  25. package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
  26. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  27. package/.claude/hooks/check-filenames.py +169 -32
  28. package/.claude/hooks/clean-post.py +195 -28
  29. package/.claude/hooks/clean-pre.py +96 -11
  30. package/.claude/hooks/done.py +74 -13
  31. package/.claude/hooks/format-hook.sh +105 -17
  32. package/.claude/hooks/hook-logger.sh +121 -7
  33. package/.claude/hooks/knowledge-post.py +136 -32
  34. package/.claude/hooks/knowledge-pre.py +129 -34
  35. package/.claude/hooks/notification-hook.sh +184 -17
  36. package/.claude/hooks/root-cleanup.py +181 -39
  37. package/.claude/hooks/security-hook.sh +248 -8
  38. package/.claude/hooks/tag-all-docs.py +175 -49
  39. package/.claude/hooks/test-validate-ontology.sh +170 -0
  40. package/.claude/hooks/todo.py +92 -22
  41. package/.claude/hooks/validate-ontology-structure-summary.md +243 -0
  42. package/.claude/hooks/validate-ontology-structure.py +83 -20
  43. package/AGENTS.md +60 -245
  44. package/CLAUDE.md +70 -1
  45. package/README.md +25 -0
  46. package/one/.claude/settings.local.json +11 -0
  47. package/one/.obsidian/community-plugins.json +3 -1
  48. package/one/.obsidian/plugins/editing-toolbar/data.json +328 -0
  49. package/one/.obsidian/plugins/editing-toolbar/main.js +12 -0
  50. package/one/.obsidian/plugins/editing-toolbar/manifest.json +10 -0
  51. package/one/.obsidian/plugins/editing-toolbar/styles.css +1338 -0
  52. package/one/.obsidian/plugins/terminal/data.json +154 -0
  53. package/one/.obsidian/plugins/terminal/main.js +197 -0
  54. package/one/.obsidian/plugins/terminal/manifest.json +14 -0
  55. package/one/.obsidian/plugins/terminal/styles.css +32 -0
  56. package/one/.obsidian/workspace.json +71 -45
  57. package/one/README.md +18 -0
  58. package/one/connections/a2a.md +49 -0
  59. package/one/connections/acp.md +47 -0
  60. package/one/connections/acps.md +18 -0
  61. package/one/connections/agentkit.md +18 -0
  62. package/one/connections/agui.md +18 -0
  63. package/one/connections/any-backend.md +39 -21
  64. package/one/connections/ap2.md +74 -0
  65. package/one/connections/api/queries-reference.md +18 -0
  66. package/one/connections/api-docs.md +18 -0
  67. package/one/connections/api-reference.md +18 -0
  68. package/one/connections/api.md +18 -0
  69. package/one/connections/architecture-diagram.md +18 -0
  70. package/one/connections/communications.md +18 -0
  71. package/one/connections/connections.md +18 -0
  72. package/one/connections/copilotkit.md +18 -0
  73. package/one/connections/cryptonetworks.md +18 -0
  74. package/one/connections/documentation.md +18 -0
  75. package/one/connections/effect.md +18 -0
  76. package/one/connections/elizaos.md +18 -0
  77. package/one/connections/groups.md +814 -0
  78. package/one/connections/inference.md +18 -0
  79. package/one/connections/integration-examples.md +18 -0
  80. package/one/connections/integration-guide.md +18 -0
  81. package/one/connections/integration-phase2.md +32 -14
  82. package/one/connections/kyc.md +18 -0
  83. package/one/connections/mcp.md +18 -0
  84. package/one/connections/membership.md +18 -0
  85. package/one/connections/middleware.md +18 -0
  86. package/one/connections/multitenant.md +18 -0
  87. package/one/connections/n8n.md +18 -0
  88. package/one/connections/patterns.md +18 -0
  89. package/one/connections/protocols.md +20 -2
  90. package/one/connections/relationships.md +18 -0
  91. package/one/connections/schema.md +18 -0
  92. package/one/connections/service-layer.md +18 -0
  93. package/one/connections/vectors.md +18 -0
  94. package/one/connections/wordpress.md +18 -0
  95. package/one/connections/workflow-copy.md +18 -0
  96. package/one/connections/workflow-examples.md +18 -0
  97. package/one/connections/workflow-onboarding.md +18 -0
  98. package/one/connections/workflow.md +18 -0
  99. package/one/connections/workflows/delegation.md +18 -0
  100. package/one/connections/workflows/frontend.md +18 -0
  101. package/one/connections/workflows/strategy.md +18 -0
  102. package/one/connections/workflows/tasks.md +18 -0
  103. package/one/connections/x402-baazar.md +131 -0
  104. package/one/connections/x402.md +268 -164
  105. package/one/events/2024-10-14-deployment-plan.md +15 -16
  106. package/one/events/2024-10-14-deployment-success.md +15 -16
  107. package/one/events/2024-10-14-final-sync-complete.md +15 -16
  108. package/one/events/2024-10-14-release-v2.0.6.md +15 -16
  109. package/one/events/2024-10-15-agent-clean-v2-summary.md +15 -16
  110. package/one/events/2024-10-15-handoff-to-clean.md +15 -16
  111. package/one/events/2024-10-15-package-manager-tests.md +15 -16
  112. package/one/events/2024-10-15-release-command-complete.md +15 -16
  113. package/one/events/2025-10-15-private-files-secured.md +18 -0
  114. package/one/events/2025-10-15-unignore-public-group-docs.md +18 -0
  115. package/one/events/ALIGNMENT_REPORT_PROBLEM_SOLVER.md +335 -0
  116. package/one/events/ALIGNMENT_SUMMARY.md +280 -0
  117. package/one/events/API_ROUTES_FIXES_SUMMARY.md +18 -0
  118. package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +18 -0
  119. package/one/events/AUDIT-ONTOLOGY-ALIGNMENT.md +598 -0
  120. package/one/events/BEFORE_AFTER_COMPARISON.md +18 -0
  121. package/one/events/CART-DRAWER-INTEGRATION-GUIDE.md +18 -0
  122. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +18 -0
  123. package/one/events/CLAUDE copy.md +897 -0
  124. package/one/events/CLEANUP-RELEASE-V2.0.8.md +18 -0
  125. package/one/events/CONNECTIONS_DEMO.md +18 -0
  126. package/one/events/CREATE-WEBSITE.md +18 -0
  127. package/one/events/CRITICAL-FIXES-COMPLETE.md +18 -0
  128. package/one/events/CUSTOM-DOMAIN.md +18 -0
  129. package/one/events/DELIVERABLES.md +18 -0
  130. package/one/events/DEMO-GROUPS-PAGE.md +18 -0
  131. package/one/events/DEMO-TESTING-SUMMARY.md +18 -0
  132. package/one/events/DEMO_COMPONENTS.md +18 -0
  133. package/one/events/DEMO_HOOKS_INDEX.md +18 -0
  134. package/one/events/DEMO_INFRASTRUCTURE.md +18 -0
  135. package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +18 -0
  136. package/one/events/DEMO_INTEGRATION_CHECKLIST.md +18 -0
  137. package/one/events/DEMO_QUICK_REFERENCE.md +18 -0
  138. package/one/events/DEMO_SETUP.md +18 -0
  139. package/one/events/DEPLOYMENT copy.md +18 -0
  140. package/one/events/DEPLOYMENT.md +18 -0
  141. package/one/events/ECOMMERCE-BEFORE-AFTER.md +16 -0
  142. package/one/events/ECOMMERCE-DEMO-PLAN.md +18 -0
  143. package/one/events/ECOMMERCE-ENHANCEMENTS.md +18 -0
  144. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +18 -0
  145. package/one/events/ECOMMERCE-LIVE-DEMO.md +18 -0
  146. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +18 -0
  147. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +18 -0
  148. package/one/events/ECOMMERCE-TEMPLATE-COMPLETE.md +18 -0
  149. package/one/events/ECOMMERCE-TEMPLATES-SUMMARY.md +18 -0
  150. package/one/events/EFFECT_TS_API_PATTERN.md +18 -0
  151. package/one/events/FEATURE-2-4-COMPLETE.md +18 -0
  152. package/one/events/FEATURE_2_3_COMPLETE.md +18 -0
  153. package/one/events/GRADIENT-TEXT-PERMANENT-FIX.md +18 -0
  154. package/one/events/GROUPS-MIGRATION.md +18 -0
  155. package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +18 -0
  156. package/one/events/HANDOFF.md +18 -0
  157. package/one/events/HOOKS-DEMO.md +18 -0
  158. package/one/events/IMPLEMENTATION-SUMMARY-FINAL.md +18 -0
  159. package/one/events/IMPLEMENTATION_SUMMARY.md +18 -0
  160. package/one/events/INSTALL-TESTS.md +18 -0
  161. package/one/events/INSTALLATION_FOLDERS.md +18 -0
  162. package/one/events/INSTALLATION_FOLDERS_FILES.md +18 -0
  163. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +18 -0
  164. package/one/events/INTEGRATION-ARCHITECTURE.md +18 -0
  165. package/one/events/INTEGRATION-CHECKLIST.md +18 -0
  166. package/one/events/INTEGRATION-ORCHESTRATION.md +18 -0
  167. package/one/events/INTEGRATION-SUMMARY.md +18 -0
  168. package/one/events/LANDING-PAGE-EXAMPLE-OUTPUT.md +18 -0
  169. package/one/events/LANDING-PAGE-IMPLEMENTATION.md +18 -0
  170. package/one/events/LANDING-PAGE-QUICKSTART.md +18 -0
  171. package/one/events/LICENSE.md +18 -0
  172. package/one/events/MCP-CONFIGURATION.md +18 -0
  173. package/one/events/MCP-SETUP-COMPLETE.md +18 -0
  174. package/one/events/MIGRATION-REPORT.md +18 -0
  175. package/one/events/MIGRATION.md +18 -0
  176. package/one/events/MULTI-ONTOLOGY-COMPLETE-GUIDE.md +18 -0
  177. package/one/events/MULTI-ONTOLOGY-IMPLEMENTATION-COMPLETE.md +18 -0
  178. package/one/events/NODE-UPGRADE.md +18 -0
  179. package/one/events/ONBOARDING-IMPLEMENTATION-COMPLETE copy.md +18 -0
  180. package/one/events/ONTOLOGY-HOOKS-README.md +18 -0
  181. package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +18 -0
  182. package/one/events/ONTOLOGY-TUTORIALS-SUMMARY.md +18 -0
  183. package/one/events/ONTOLOGY-TYPE-GENERATOR-SUMMARY.md +18 -0
  184. package/one/events/ONTOLOGY_DISCOVERY_IMPLEMENTATION.md +18 -0
  185. package/one/events/ONTOLOGY_DISCOVERY_QUICKSTART.md +18 -0
  186. package/one/events/PACKAGE-STRUCTURE.md +18 -0
  187. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +18 -0
  188. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +18 -0
  189. package/one/events/QA-CHECKLIST.md +18 -0
  190. package/one/events/QUICK-START-ONTOLOGY.md +18 -0
  191. package/one/events/README-archived.md +18 -0
  192. package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +18 -0
  193. package/one/events/SEARCH_DEMO_DELIVERY.md +18 -0
  194. package/one/events/SEARCH_DEMO_SUMMARY.md +18 -0
  195. package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +18 -0
  196. package/one/events/SECURITY-AUDIT-FIXES.md +18 -0
  197. package/one/events/SECURITY-SCAN-COMPLETE.md +18 -0
  198. package/one/events/SHOP-BUILD-STATUS.md +18 -0
  199. package/one/events/SHOP-PREMIUM-UPDATE.md +16 -0
  200. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +18 -0
  201. package/one/events/SITE-WIDE-GRADIENT-FIX.md +18 -0
  202. package/one/events/STORE-PRODUCTION-READY-STATUS.md +18 -0
  203. package/one/events/STRIPE-INTEGRATION.md +18 -0
  204. package/one/events/STRIPE-PAYMENT-METHODS-GUIDE.md +18 -0
  205. package/one/events/STRIPE-SETUP-GUIDE.md +18 -0
  206. package/one/events/TEST-PLAN-INDEX.md +18 -0
  207. package/one/events/TEST-PLAN.md +18 -0
  208. package/one/events/TEST-SUMMARY.md +18 -0
  209. package/one/events/TESTS-QUICK-REF.md +18 -0
  210. package/one/events/TRANSITIONS-QUICK-START.md +18 -0
  211. package/one/events/TRANSPARENCY-FIXES.md +18 -0
  212. package/one/events/TYPESCRIPT_FIXES.md +18 -0
  213. package/one/events/TYPESCRIPT_FIXES_INDEX.md +18 -0
  214. package/one/events/VIEW-TRANSITIONS.md +18 -0
  215. package/one/events/agent-director-enhancement-summary.md +18 -0
  216. package/one/events/agent-onboard-implementation-summary.md +18 -0
  217. package/one/events/agent-ontology-alignment-completion.md +263 -0
  218. package/one/events/backend-integration-tests.md +18 -0
  219. package/one/events/clean-agent-ontology-cleanup-report.md +18 -0
  220. package/one/events/clean-agent-todo-analysis-summary.md +336 -0
  221. package/one/events/cloudflare-automation-complete.md +18 -0
  222. package/one/events/cloudflare-pages-infrastructure-setup.md +18 -0
  223. package/one/events/contact-page-complete.md +18 -0
  224. package/one/events/convex-analysis-index.md +18 -0
  225. package/one/events/convex-structure-analysis.md +18 -0
  226. package/one/events/deployment-installation-folders.md +18 -0
  227. package/one/events/deployment-ops-summary.md +18 -0
  228. package/one/events/deployment-verification.md +18 -0
  229. package/one/events/design-spec-complete.md +18 -0
  230. package/one/events/documentation-audit-index.md +473 -0
  231. package/one/events/documentation-audit-summary.md +417 -0
  232. package/one/events/documentation-improvement-roadmap.md +906 -0
  233. package/one/events/documentation-standards-compliance-report.md +538 -0
  234. package/one/events/events.md +18 -0
  235. package/one/events/frontend-effects-complete.md +584 -0
  236. package/one/events/frontend-effects-orchestration.md +1356 -0
  237. package/one/events/frontend-effects-risk-register.md +1055 -0
  238. package/one/events/frontend-effects-week1-assignments.md +1594 -0
  239. package/one/events/hook-ontology-alignment-summary.md +528 -0
  240. package/one/events/installation-folders-workflow-integration.md +18 -0
  241. package/one/events/landing-page-generator.md +18 -0
  242. package/one/events/legal-assessment-2025-10-16.md +18 -0
  243. package/one/events/onboarding-implementation-complete.md +18 -0
  244. package/one/events/ontology-test-examples.md +18 -0
  245. package/one/events/phase1-backend-implementation-complete.md +18 -0
  246. package/one/events/release.md +18 -0
  247. package/one/events/root-cleanup-alignment-report.md +265 -0
  248. package/one/events/separate-implementation-status.md +18 -0
  249. package/one/events/session-summary-2025-10-18.md +18 -0
  250. package/one/events/skills-complete.md +18 -0
  251. package/one/events/skills-infer-6-10-summary.md +18 -0
  252. package/one/events/skills-phase1-complete.md +18 -0
  253. package/one/events/structural-analysis-architecture-vs-plans.md +559 -0
  254. package/one/events/test-dashboard.md +18 -0
  255. package/one/events/test-index.md +18 -0
  256. package/one/events/test-report-ontology.md +18 -0
  257. package/one/events/testing-summary.md +18 -0
  258. package/one/events/todo-refactoring-complete.md +408 -0
  259. package/one/events/wave1-backend-implementation-complete.md +698 -0
  260. package/one/groups/features.md +26 -0
  261. package/one/groups/groups.md +83 -39
  262. package/one/groups/one.md +47 -27
  263. package/one/groups/{strategy copy.md → strategy-copy.md} +23 -5
  264. package/one/knowledge/.obsidian/ecommerce-ontology.md +18 -0
  265. package/one/knowledge/100-inference-quick-reference.md +18 -0
  266. package/one/knowledge/agent-onboard-usage.md +18 -0
  267. package/one/knowledge/agentic-commerce.md +146 -0
  268. package/one/knowledge/ai-agents-vs-memecoins-thesis.md +683 -0
  269. package/one/knowledge/ai-platform.md +18 -0
  270. package/one/knowledge/ai-token-crypto-analysis-framework.md +1191 -0
  271. package/one/knowledge/ai-token-paradigm-shift-2025.md +732 -0
  272. package/one/knowledge/altcoin-cycle-prediction-ontology.md +884 -0
  273. package/one/knowledge/altcoin-cycle-trading-strategy.md +642 -0
  274. package/one/knowledge/architecture-any-backend.md +265 -42
  275. package/one/knowledge/architecture-diagram.md +404 -94
  276. package/one/knowledge/architecture-frontend.md +130 -51
  277. package/one/knowledge/architecture.md +1496 -1831
  278. package/one/knowledge/{ontology.md.backup → archived/ontology.old.md} +18 -0
  279. package/one/knowledge/astro-effect-complete-vision.md +2148 -0
  280. package/one/knowledge/astro-effect-simple-architecture.md +717 -0
  281. package/one/knowledge/audit-agent-onboard-alignment.md +481 -0
  282. package/one/knowledge/audit-agent-sales-alignment.md +444 -0
  283. package/one/knowledge/backend-api-reference.md +18 -0
  284. package/one/knowledge/cli-claude-handoff.md +18 -0
  285. package/one/knowledge/context-engineering.md +610 -0
  286. package/one/knowledge/crypto-analysis-strategy.md +1276 -0
  287. package/one/knowledge/crypto-cycle-2024-2025-analysis.md +44 -0
  288. package/one/knowledge/crypto.md +18 -0
  289. package/one/knowledge/docs.md +627 -0
  290. package/one/knowledge/dsl.md +18 -0
  291. package/one/knowledge/files.md +18 -0
  292. package/one/knowledge/frontend.md +18 -0
  293. package/one/knowledge/hono.md +18 -0
  294. package/one/knowledge/implementation-examples.md +18 -0
  295. package/one/knowledge/installation-folders.md +18 -0
  296. package/one/knowledge/institutional-cycle-paradigm-2025.md +555 -0
  297. package/one/knowledge/knowledge.md +18 -0
  298. package/one/knowledge/language.md +18 -0
  299. package/one/knowledge/lessons-learned.md +18 -0
  300. package/one/knowledge/lessons-website-building-focus.md +18 -0
  301. package/one/knowledge/merge-report.md +254 -0
  302. package/one/knowledge/nine-padel-playbook.md +18 -0
  303. package/one/knowledge/ontology-blog.yaml +42 -26
  304. package/one/knowledge/ontology-cheatsheet.md +18 -0
  305. package/one/knowledge/ontology-community.yaml +60 -37
  306. package/one/knowledge/ontology-core-universal.md +19 -1
  307. package/one/knowledge/ontology-core.yaml +58 -45
  308. package/one/knowledge/ontology-courses.yaml +71 -48
  309. package/one/knowledge/ontology-creator.md +30 -4
  310. package/one/knowledge/ontology-crypto.md +1603 -0
  311. package/one/knowledge/ontology-developer-guide.md +18 -0
  312. package/one/knowledge/ontology-documentation.md +46 -25
  313. package/one/knowledge/ontology-ecommerce.md +24 -6
  314. package/one/knowledge/ontology-education.md +18 -0
  315. package/one/knowledge/ontology-engineering-specification.md +22 -4
  316. package/one/knowledge/ontology-engineering.md +67 -43
  317. package/one/knowledge/ontology-files.yaml +525 -0
  318. package/one/knowledge/ontology-frontend-master.md +2898 -0
  319. package/one/knowledge/ontology-frontend-specifications.md +57 -49
  320. package/one/knowledge/ontology-frontend.md +40 -22
  321. package/one/knowledge/ontology-index.md +18 -0
  322. package/one/knowledge/ontology-minimal.yaml +18 -16
  323. package/one/knowledge/ontology-portfolio.yaml +40 -26
  324. package/one/knowledge/ontology-quickstart.md +18 -0
  325. package/one/knowledge/ontology-release.md +317 -0
  326. package/one/knowledge/ontology-shop.yaml +146 -119
  327. package/one/knowledge/ontology-tokens.yaml +46 -27
  328. package/one/knowledge/ontology-tutorial.md +18 -0
  329. package/one/knowledge/ontology-video-script.md +18 -0
  330. package/one/knowledge/ontology-visual-guide.md +20 -2
  331. package/one/knowledge/ontology.md +1329 -304
  332. package/one/knowledge/ontology.yaml +763 -275
  333. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +48 -18
  334. package/one/knowledge/patterns/backend/convex-query-pattern.md +78 -23
  335. package/one/knowledge/patterns/backend/mutation-template.md +28 -10
  336. package/one/knowledge/patterns/backend/query-template.md +44 -25
  337. package/one/knowledge/patterns/backend/service-template.md +35 -14
  338. package/one/knowledge/patterns/design/component-architecture.md +45 -9
  339. package/one/knowledge/patterns/design/test-driven-design-pattern.md +37 -3
  340. package/one/knowledge/patterns/design/wireframe-template.md +36 -2
  341. package/one/knowledge/patterns/frontend/component-template.md +91 -40
  342. package/one/knowledge/patterns/frontend/form-template.md +131 -59
  343. package/one/knowledge/patterns/frontend/page-template.md +59 -28
  344. package/one/knowledge/patterns/frontend/react-component-pattern.md +87 -27
  345. package/one/knowledge/patterns/test/acceptance-criteria-template.md +28 -10
  346. package/one/knowledge/patterns/test/technical-test-template.md +48 -26
  347. package/one/knowledge/patterns/test/test-driven-pattern.md +25 -5
  348. package/one/knowledge/patterns/test/user-flow-template.md +18 -0
  349. package/one/knowledge/provider-agnostic-content.md +995 -0
  350. package/one/knowledge/provider-creation-guide.md +18 -0
  351. package/one/knowledge/quality-loop.md +18 -0
  352. package/one/knowledge/readme-architecture.md +158 -0
  353. package/one/knowledge/readme.md +18 -0
  354. package/one/knowledge/rules.md +18 -0
  355. package/one/knowledge/score.md +18 -0
  356. package/one/knowledge/specifications.md +18 -0
  357. package/one/knowledge/tags.md +18 -0
  358. package/one/knowledge/todo-template.md +18 -0
  359. package/one/knowledge/todo.md +18 -0
  360. package/one/knowledge/typescript-patterns.md +18 -0
  361. package/one/knowledge/universal-generation-language.md +827 -0
  362. package/one/knowledge/x402-research.md +104 -0
  363. package/one/license.md +18 -0
  364. package/one/people/anthony-o-connell.md +48 -19
  365. package/one/people/people.md +54 -31
  366. package/one/things/ALIGNMENT_AUDIT_QUALITY_AGENT.md +401 -0
  367. package/one/things/AUDIT_AGENT_INTEGRATOR_ALIGNMENT.md +588 -0
  368. package/one/things/AUDIT_REPORT_AGENT_CLEAN.md +461 -0
  369. package/one/things/CHECKLIST.md +51 -0
  370. package/one/things/IMPLEMENTATION_STATUS.md +379 -0
  371. package/one/things/ONE.md +19 -1
  372. package/one/things/agents/agent-backend.md +198 -98
  373. package/one/things/agents/agent-builder.md +267 -158
  374. package/one/things/agents/agent-clean.md +40 -15
  375. package/one/things/agents/agent-clone.md +33 -50
  376. package/one/things/agents/agent-deploy.md +59 -11
  377. package/one/things/agents/agent-designer.md +274 -146
  378. package/one/things/agents/agent-director.md +20 -2
  379. package/one/things/agents/agent-documenter.md +126 -46
  380. package/one/things/agents/agent-frontend.md +104 -22
  381. package/one/things/agents/agent-integrator.md +153 -76
  382. package/one/things/agents/agent-lawyer.md +197 -92
  383. package/one/things/agents/agent-problem-solver.md +302 -224
  384. package/one/things/agents/agent-quality.md +149 -19
  385. package/one/things/agents/agent-sales.md +95 -7
  386. package/one/things/cascade/cascade.yaml +20 -3
  387. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +53 -0
  388. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +50 -0
  389. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +76 -0
  390. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +49 -3
  391. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +45 -0
  392. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +32 -0
  393. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +45 -3
  394. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +44 -0
  395. package/one/things/cascade/docs/examples/1-3-event-coordination.md +40 -1
  396. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +81 -25
  397. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +41 -0
  398. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +91 -16
  399. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +136 -73
  400. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +43 -0
  401. package/one/things/cascade/docs/examples/1-5-quality-loops.md +88 -4
  402. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +52 -3
  403. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +44 -1
  404. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +78 -14
  405. package/one/things/cascade/docs/examples/readme.md +37 -0
  406. package/one/things/cascade/docs/getting-started.md +18 -0
  407. package/one/things/cascade/docs/workflow.md +18 -12
  408. package/one/things/cascade/readme.md +43 -0
  409. package/one/things/cascade/templates/feature-template.md +28 -6
  410. package/one/things/claude/agents/advocacy-activation-manager.md +64 -39
  411. package/one/things/claude/agents/advocacy-campaign-designer.md +64 -39
  412. package/one/things/claude/agents/analyst.md +64 -39
  413. package/one/things/claude/agents/architect.md +64 -39
  414. package/one/things/claude/agents/brand-identity-specialist.md +64 -39
  415. package/one/things/claude/agents/bstp-token-strategist.md +48 -25
  416. package/one/things/claude/agents/builder-repo.md +69 -26
  417. package/one/things/claude/agents/bullstamp-community-builder.md +48 -25
  418. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +48 -25
  419. package/one/things/claude/agents/bulltilt-platform-growth.md +48 -25
  420. package/one/things/claude/agents/company-bullstamp-character.md +45 -30
  421. package/one/things/claude/agents/company-bullstamp-community.md +45 -30
  422. package/one/things/claude/agents/company-bullstamp-marketing.md +45 -30
  423. package/one/things/claude/agents/company-bullstamp-token.md +45 -30
  424. package/one/things/claude/agents/company-bulltilt-growth.md +45 -30
  425. package/one/things/claude/agents/content-bibliography-formatter.md +48 -25
  426. package/one/things/claude/agents/content-calendar-planner.md +59 -34
  427. package/one/things/claude/agents/content-chapter-formatter.md +60 -35
  428. package/one/things/claude/agents/content-formatter.md +59 -34
  429. package/one/things/claude/agents/content-hook-specialist.md +54 -31
  430. package/one/things/claude/agents/content-image-formatter.md +59 -34
  431. package/one/things/claude/agents/content-introduction-formatter.md +59 -34
  432. package/one/things/claude/agents/content-multiplication-engine.md +54 -31
  433. package/one/things/claude/agents/content-playbook-writer.md +60 -35
  434. package/one/things/claude/agents/content-team-manager.md +59 -34
  435. package/one/things/claude/agents/content-toc-formatter.md +60 -35
  436. package/one/things/claude/agents/convex-backend-specialist.md +380 -216
  437. package/one/things/claude/agents/core-manager.md +59 -34
  438. package/one/things/claude/agents/core-master.md +55 -32
  439. package/one/things/claude/agents/cross-functional-manager.md +46 -41
  440. package/one/things/claude/agents/crypto-airdrop-strategist.md +74 -54
  441. package/one/things/claude/agents/crypto-analytics-educator.md +73 -30
  442. package/one/things/claude/agents/crypto-architecture-specialist.md +70 -39
  443. package/one/things/claude/agents/crypto-community-analyst.md +47 -31
  444. package/one/things/claude/agents/crypto-community-psychologist.md +68 -31
  445. package/one/things/claude/agents/crypto-dex-optimization-expert.md +72 -31
  446. package/one/things/claude/agents/crypto-dex-optimizer.md +45 -30
  447. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +69 -30
  448. package/one/things/claude/agents/crypto-diamond-hands.md +45 -30
  449. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +73 -30
  450. package/one/things/claude/agents/crypto-engagement-specialist.md +71 -30
  451. package/one/things/claude/agents/crypto-market-researcher.md +45 -30
  452. package/one/things/claude/agents/crypto-marketing-orchestrator.md +74 -34
  453. package/one/things/claude/agents/crypto-network-effect-amplifier.md +75 -30
  454. package/one/things/claude/agents/crypto-optimization-analyst.md +73 -30
  455. package/one/things/claude/agents/crypto-strategic-synthesizer.md +69 -30
  456. package/one/things/claude/agents/crypto-team-manager.md +45 -40
  457. package/one/things/claude/agents/crypto-token-analyst.md +66 -25
  458. package/one/things/claude/agents/crypto-viral-content-creator.md +64 -61
  459. package/one/things/claude/agents/crypto-wallet-identification-expert.md +61 -51
  460. package/one/things/claude/agents/crypto-wallet-identifier.md +45 -30
  461. package/one/things/claude/agents/customer-journey-designer.md +51 -58
  462. package/one/things/claude/agents/customer-success-manager.md +51 -58
  463. package/one/things/claude/agents/dev.md +51 -58
  464. package/one/things/claude/agents/documenter.md +71 -69
  465. package/one/things/claude/agents/elevate-marketing-orchestrator.md +45 -52
  466. package/one/things/claude/agents/engagement-specialist.md +45 -52
  467. package/one/things/claude/agents/engineering-architect.md +54 -54
  468. package/one/things/claude/agents/engineering-business-analyst.md +46 -56
  469. package/one/things/claude/agents/engineering-developer.md +51 -52
  470. package/one/things/claude/agents/engineering-director.md +65 -25
  471. package/one/things/claude/agents/engineering-ingestor.md +110 -100
  472. package/one/things/claude/agents/engineering-product-manager.md +43 -55
  473. package/one/things/claude/agents/engineering-product-owner.md +46 -56
  474. package/one/things/claude/agents/engineering-project-coordinator.md +44 -56
  475. package/one/things/claude/agents/engineering-quality-assurance.md +53 -54
  476. package/one/things/claude/agents/engineering-team-manager.md +46 -43
  477. package/one/things/claude/agents/engineering-user-experience.md +51 -52
  478. package/one/things/claude/agents/framework-elevate-manager.md +45 -30
  479. package/one/things/claude/agents/improver.md +120 -78
  480. package/one/things/claude/agents/intelligence-team-manager.md +45 -40
  481. package/one/things/claude/agents/lead-capture-expert.md +45 -52
  482. package/one/things/claude/agents/lead-magnet-creator.md +45 -52
  483. package/one/things/claude/agents/market-research-analyst.md +48 -25
  484. package/one/things/claude/agents/marketing-brand-identity.md +57 -27
  485. package/one/things/claude/agents/marketing-content-hooks.md +45 -40
  486. package/one/things/claude/agents/marketing-content-multiplier.md +45 -40
  487. package/one/things/claude/agents/marketing-content-poster.md +71 -60
  488. package/one/things/claude/agents/marketing-customer-journey.md +45 -40
  489. package/one/things/claude/agents/marketing-director.md +46 -41
  490. package/one/things/claude/agents/marketing-engagement.md +45 -40
  491. package/one/things/claude/agents/marketing-lead-capture.md +45 -40
  492. package/one/things/claude/agents/marketing-lead-magnet.md +45 -40
  493. package/one/things/claude/agents/marketing-network-effects.md +45 -40
  494. package/one/things/claude/agents/marketing-nurture-campaigns.md +45 -40
  495. package/one/things/claude/agents/marketing-share-optimizer.md +45 -40
  496. package/one/things/claude/agents/marketing-team-manager.md +45 -40
  497. package/one/things/claude/agents/marketing-viral-growth.md +49 -18
  498. package/one/things/claude/agents/mission-commander.md +45 -40
  499. package/one/things/claude/agents/network-effect-analyst.md +48 -31
  500. package/one/things/claude/agents/nextjs-15-specialist.md +209 -122
  501. package/one/things/claude/agents/npx.md +126 -70
  502. package/one/things/claude/agents/nurture-campaign-manager.md +48 -25
  503. package/one/things/claude/agents/one-master.md +48 -25
  504. package/one/things/claude/agents/one-orchestrator.md +57 -27
  505. package/one/things/claude/agents/one.md +88 -31
  506. package/one/things/claude/agents/playbook-generator.md +48 -25
  507. package/one/things/claude/agents/pm.md +48 -25
  508. package/one/things/claude/agents/po.md +51 -26
  509. package/one/things/claude/agents/qa.md +50 -25
  510. package/one/things/claude/agents/research-foundation-analyst.md +48 -31
  511. package/one/things/claude/agents/research-intelligence-gatherer.md +59 -32
  512. package/one/things/claude/agents/research-market-analyst.md +47 -30
  513. package/one/things/claude/agents/research-team-manager.md +47 -40
  514. package/one/things/claude/agents/sales-environment-optimizer.md +50 -25
  515. package/one/things/claude/agents/sales-team-manager.md +47 -40
  516. package/one/things/claude/agents/sales-upsell-strategist.md +47 -30
  517. package/one/things/claude/agents/service-advocacy-campaigns.md +47 -30
  518. package/one/things/claude/agents/service-advocacy-manager.md +47 -30
  519. package/one/things/claude/agents/service-success-manager.md +47 -30
  520. package/one/things/claude/agents/service-team-manager.md +45 -40
  521. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +85 -30
  522. package/one/things/claude/agents/share-optimization-specialist.md +50 -25
  523. package/one/things/claude/agents/sm.md +50 -25
  524. package/one/things/claude/agents/story-teller.md +51 -26
  525. package/one/things/claude/agents/task-master.md +52 -27
  526. package/one/things/claude/agents/tauri-cross-platform-specialist.md +201 -116
  527. package/one/things/claude/agents/tester.md +85 -46
  528. package/one/things/claude/agents/the-bull-character-manager.md +48 -25
  529. package/one/things/claude/agents/tools-playbook-generator.md +43 -40
  530. package/one/things/claude/agents/turbo-repo-builder.md +57 -27
  531. package/one/things/claude/agents/upsell-strategist.md +48 -25
  532. package/one/things/claude/agents/ux-expert.md +50 -25
  533. package/one/things/claude/agents/viral-growth-orchestrator.md +50 -27
  534. package/one/things/claude/commands/agent.md +25 -5
  535. package/one/things/claude/commands/cascade-status.md +33 -8
  536. package/one/things/claude/commands/ingest.md +64 -11
  537. package/one/things/claude/commands/ingestor.md +29 -7
  538. package/one/things/claude/commands/mission.md +24 -4
  539. package/one/things/claude/commands/npx.md +30 -7
  540. package/one/things/claude/commands/one.md +114 -68
  541. package/one/things/claude/commands/quality-check.md +72 -24
  542. package/one/things/claude/commands/smart-route.md +45 -4
  543. package/one/things/claude/commands/start.md +22 -4
  544. package/one/things/claude/commands/story.md +25 -5
  545. package/one/things/claude/commands/task.md +21 -1
  546. package/one/things/cli/cli-code.md +244 -219
  547. package/one/things/cli/cli-compiler-code.md +244 -219
  548. package/one/things/cli/cli.md +30 -6
  549. package/one/things/components/card-shadcn.md +252 -228
  550. package/one/things/components/card.md +315 -324
  551. package/one/things/components.md +667 -593
  552. package/one/things/componets.md +16 -1
  553. package/one/things/creator-diagram.md +23 -5
  554. package/one/things/demo-accessibility-animations.md +73 -47
  555. package/one/things/demo-components.md +225 -219
  556. package/one/things/demo-design-summary.md +89 -26
  557. package/one/things/demo-design-system.md +184 -130
  558. package/one/things/demo-page-layouts.md +52 -25
  559. package/one/things/designs/accessibility-audit.md +153 -66
  560. package/one/things/designs/component-specifications.md +163 -65
  561. package/one/things/designs/design-overview.md +81 -22
  562. package/one/things/designs/design-tokens.md +127 -93
  563. package/one/things/designs/wireframes-dashboard.md +64 -7
  564. package/one/things/docs/api-requests.md +75 -11
  565. package/one/things/docs/ecommerce/ARCHITECTURE-DIAGRAM.md +18 -0
  566. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-IMPLEMENTATION.md +57 -0
  567. package/one/things/docs/ecommerce/CONVERSION-ELEMENTS-SUMMARY.md +62 -6
  568. package/one/things/docs/ecommerce/CONVERSION-UX-IMPLEMENTATION-SUMMARY.md +60 -5
  569. package/one/things/docs/ecommerce/FEATURE-SUMMARY.md +95 -27
  570. package/one/things/docs/ecommerce/IMPLEMENTATION-NOTES.md +130 -62
  571. package/one/things/docs/ecommerce/INTEGRATION-EXAMPLE.md +43 -19
  572. package/one/things/docs/ecommerce/QUICK-START.md +41 -4
  573. package/one/things/docs/ecommerce/URGENCY-IMPLEMENTATION-SUMMARY.md +75 -6
  574. package/one/things/docs/ecommerce/URGENCY-QUICK-REFERENCE.md +58 -24
  575. package/one/things/examples/children/lemonade-stand.md +52 -14
  576. package/one/things/examples/enterprise/crm-saas.md +43 -28
  577. package/one/things/features/1-1-agent-prompts.md +76 -0
  578. package/one/things/features/1-2-yaml-orchestrator.md +32 -0
  579. package/one/things/features/1-3-event-coordination.md +40 -1
  580. package/one/things/features/1-4-knowledge-management.md +91 -16
  581. package/one/things/features/1-5-quality-loops.md +88 -4
  582. package/one/things/features/1-6-numbering-structure.md +78 -14
  583. package/one/things/features/2-1-dataprovider-interface.md +311 -86
  584. package/one/things/features/2-2-config-system.md +307 -140
  585. package/one/things/features/2-3-effectts-services.md +263 -116
  586. package/one/things/features/2-4-react-hooks.md +217 -201
  587. package/one/things/features/2-5-auth-migration.md +406 -308
  588. package/one/things/features/2-6-dashboard-migration.md +112 -13
  589. package/one/things/features/2-7-alternative-providers.md +138 -65
  590. package/one/things/features/2-7-implementation-report.md +68 -24
  591. package/one/things/features/2-cli.md +88 -76
  592. package/one/things/features/2-design.md +112 -80
  593. package/one/things/features/2-tests.md +56 -0
  594. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +91 -36
  595. package/one/things/features/DECOUPLING.md +36 -18
  596. package/one/things/features/DEPLOYMENT.md +22 -4
  597. package/one/things/features/IMPLEMENTATION_SUMMARY.md +48 -2
  598. package/one/things/features/improve.md +47 -29
  599. package/one/things/features/remove-convex-deps.md +18 -0
  600. package/one/things/features/top-features.md +28 -20
  601. package/one/things/features/use-one-backend.md +210 -173
  602. package/one/things/features-in-english.md +19 -6
  603. package/one/things/files.yaml +721 -0
  604. package/one/things/ideas/1-create-workflow.md +18 -0
  605. package/one/things/ideas/2-backend-agnostic-frontend.md +57 -2
  606. package/one/things/implementation/backend-guide.md +64 -19
  607. package/one/things/interface.md +43 -0
  608. package/one/things/landing-page-implementation.md +455 -0
  609. package/one/things/legal/README.md +44 -0
  610. package/one/things/legal/privacy-policy.md +186 -23
  611. package/one/things/legal/terms-of-service.md +164 -3
  612. package/one/things/master-workflow-plan.md +806 -0
  613. package/one/things/plans/0-timeline.md +36 -0
  614. package/one/things/plans/1-create-workflow.md +19 -0
  615. package/one/things/plans/QUICK-START-SIMPLIFICATION.md +333 -0
  616. package/one/things/plans/README-SIMPLIFICATION.md +349 -0
  617. package/one/things/plans/SIMPLIFICATION-EXAMPLES.md +16 -0
  618. package/one/things/plans/SIMPLIFICATION-SUMMARY.md +455 -0
  619. package/one/things/plans/ai-elements.md +21 -2
  620. package/one/things/plans/ai-integration.md +108 -59
  621. package/one/things/plans/ai-sdk.md +85 -48
  622. package/one/things/plans/ai-tools.md +621 -0
  623. package/one/things/plans/app.md +142 -71
  624. package/one/things/plans/architecture-summary.md +34 -5
  625. package/one/things/plans/async-ai-agents.md +19 -1
  626. package/one/things/plans/backend-agnostic-frontend.md +70 -8
  627. package/one/things/plans/backend-cleanup-quickstart.md +52 -18
  628. package/one/things/plans/backend-ontology-conformance.md +110 -51
  629. package/one/things/plans/backend-status.md +58 -0
  630. package/one/things/plans/backend-structure.md +103 -55
  631. package/one/things/plans/backend-target-structure.md +61 -17
  632. package/one/things/plans/backend.md +60 -18
  633. package/one/things/plans/better-auth-any-backend-revised.md +325 -287
  634. package/one/things/plans/better-auth-any-backend.md +575 -531
  635. package/one/things/plans/better-auth-available-features.md +43 -5
  636. package/one/things/plans/big-plan.md +20 -6
  637. package/one/things/plans/cli-updates-required.md +44 -4
  638. package/one/things/plans/complete-step-by-step.md +223 -116
  639. package/one/things/plans/components.md +709 -0
  640. package/one/things/plans/convex-agents.md +79 -50
  641. package/one/things/plans/convex-better-auth.md +186 -154
  642. package/one/things/plans/convex-on-off.md +47 -29
  643. package/one/things/plans/crypto-token-researcher.md +629 -0
  644. package/one/things/plans/data-quality-metrics.md +745 -0
  645. package/one/things/plans/deep-researcher-agent.md +466 -0
  646. package/one/things/plans/deploy-to-cloudflare.md +55 -13
  647. package/one/things/plans/deployment-architecture.md +54 -11
  648. package/one/things/plans/desktop.md +21 -3
  649. package/one/things/plans/development-plan.md +184 -121
  650. package/one/things/plans/development-workflow-tldr.md +207 -0
  651. package/one/things/plans/development-workflow.md +959 -0
  652. package/one/things/plans/effect-components.md +667 -593
  653. package/one/things/plans/effect-patterns-reference.md +2235 -0
  654. package/one/things/plans/effect.md +204 -131
  655. package/one/things/plans/email.md +21 -8
  656. package/one/things/plans/enhance-auth.md +64 -41
  657. package/one/things/plans/execution-strategy.md +1291 -0
  658. package/one/things/plans/existing-infrastructure.md +712 -0
  659. package/one/things/plans/feature-based-sites.md +124 -51
  660. package/one/things/plans/frontend-effects.md +1276 -0
  661. package/one/things/plans/group-folder-multi-tenancy.md +92 -29
  662. package/one/things/plans/improve-codebase.md +498 -421
  663. package/one/things/plans/install-components.md +18 -1
  664. package/one/things/plans/integrate-frontend-and-backend.md +68 -44
  665. package/one/things/plans/landing.md +92 -0
  666. package/one/things/plans/layout.md +45 -1
  667. package/one/things/plans/mail-backend.md +546 -493
  668. package/one/things/plans/mail.md +379 -326
  669. package/one/things/plans/mcp-clear-context-prompt.md +21 -0
  670. package/one/things/plans/mcp-simple.md +20 -0
  671. package/one/things/plans/multi-ontology-architecture.md +115 -66
  672. package/one/things/plans/next-features.md +31 -0
  673. package/one/things/plans/onboarding.md +20 -1
  674. package/one/things/plans/one.md +18 -0
  675. package/one/things/plans/ontology-6-dimensions.md +24 -45
  676. package/one/things/plans/ontology-compliance-audit.md +315 -0
  677. package/one/things/plans/ontology-driven-strategy.md +19 -3
  678. package/one/things/plans/ontology-refine.md +586 -0
  679. package/one/things/plans/ontology-ui-approach.md +18 -0
  680. package/one/things/plans/open-agent.md +152 -97
  681. package/one/things/plans/performace.md +32 -0
  682. package/one/things/plans/phase-1-foundation.md +620 -0
  683. package/one/things/plans/phase-3-implementation.md +1037 -0
  684. package/one/things/plans/quick-wins.md +342 -187
  685. package/one/things/plans/readme-backend-cleanup.md +54 -13
  686. package/one/things/plans/release.md +55 -2
  687. package/one/things/plans/repos.md +22 -0
  688. package/one/things/plans/separate-copy-2.md +127 -71
  689. package/one/things/plans/separate-copy-3.md +35 -14
  690. package/one/things/plans/separate-copy.md +127 -71
  691. package/one/things/plans/separate-demo.md +37 -3
  692. package/one/things/plans/separate.md +24 -6
  693. package/one/things/plans/sequence.md +155 -12
  694. package/one/things/plans/shadcn-integration-summary.md +104 -44
  695. package/one/things/plans/sidebar.md +44 -10
  696. package/one/things/plans/skills.md +103 -0
  697. package/one/things/plans/small-fixes.md +19 -1
  698. package/one/things/plans/start-new.md +34 -8
  699. package/one/things/plans/switch-off-auth.md +22 -0
  700. package/one/things/plans/sync-checklist.md +30 -0
  701. package/one/things/plans/test-backend-connection.md +38 -0
  702. package/one/things/plans/unified-implementation-plan.md +144 -62
  703. package/one/things/plans/update-demos.md +103 -35
  704. package/one/things/plans/use-our-backend.md +572 -0
  705. package/one/things/plans/wave1-onboarding-100-inferences.md +1686 -0
  706. package/one/things/plans/wave1-onboarding-vision.md +744 -0
  707. package/one/things/plans/wave1-orchestration-summary.md +604 -0
  708. package/one/things/plans/wave1-specialist-assignments.md +1413 -0
  709. package/one/things/plans/workflow-files.md +28 -14
  710. package/one/things/plans/workflow.md +18 -12
  711. package/one/things/products/cascade-landing-page.md +150 -46
  712. package/one/things/products/cascade.md +185 -135
  713. package/one/things/products/context-engineering.md +411 -350
  714. package/one/things/products/onthology.md +15 -0
  715. package/one/things/products/ontology-ui-shadcn.md +375 -353
  716. package/one/things/products/ontology-ui.md +101 -59
  717. package/one/things/products/ontology.md +90 -18
  718. package/one/things/products/sdk.md +181 -165
  719. package/one/things/promptkit.md +70 -43
  720. package/one/things/repos/all-repos.md +0 -0
  721. package/one/things/service-providers-new.md +95 -25
  722. package/one/things/service-providers.md +231 -202
  723. package/one/things/structure.md +532 -0
  724. package/one/things/system.md +18 -0
  725. package/one/things/templates.md +40 -0
  726. package/one/things/tests/2-1-dataprovider-interface.md +103 -31
  727. package/one/things/tests/2-1-test-analysis.md +65 -17
  728. package/one/things/things.md +48 -13
  729. package/one/things/todo-acp-integration.md +744 -0
  730. package/one/things/todo-ai.md +933 -0
  731. package/one/things/todo-api.md +1078 -0
  732. package/one/things/todo-assignment.md +580 -0
  733. package/one/things/todo-buy-chatgpt.md +1450 -0
  734. package/one/things/todo-components.md +1683 -0
  735. package/one/things/todo-connections.md +278 -0
  736. package/one/things/todo-ecommerce-frontend.md +1313 -0
  737. package/one/things/todo-ecommerce.md +569 -0
  738. package/one/things/todo-effects.md +1075 -0
  739. package/one/things/todo-frontend-effects.md +977 -0
  740. package/one/things/todo-landing-page.md +1091 -0
  741. package/one/things/todo-mail.md +1160 -0
  742. package/one/things/todo-master-plan.md +490 -0
  743. package/one/things/todo-onboard.md +666 -0
  744. package/one/things/todo-one-ie.md +538 -0
  745. package/one/things/todo-page.md +606 -0
  746. package/one/things/todo-plans.md +282 -0
  747. package/one/things/todo-projects.md +241 -0
  748. package/one/things/todo-refactoring-plan.md +366 -0
  749. package/one/things/todo-sequence.md +1621 -0
  750. package/one/things/todo-use-our-backend.md +1908 -0
  751. package/one/things/todo-workflow.md +626 -0
  752. package/one/things/todo-x402.md +2047 -0
  753. package/one/things/todo.md +459 -1075
  754. package/one/things/video/scripts-crypto.md +835 -0
  755. package/one/things/video-script-ontology.md +334 -0
  756. package/package.json +1 -1
  757. package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +0 -49
  758. package/one/knowledge/docs/flow.md +0 -0
  759. package/one/knowledge/documentation-summary.md +0 -285
  760. package/one/knowledge/inference-score.md +0 -159
  761. package/one/knowledge/ontology-frontend-copy-2.md +0 -1492
  762. package/one/knowledge/ontology-frontend-copy.md +0 -753
  763. package/one/knowledge/ontology-migration-guide.md +0 -811
  764. package/one/things/features/0 All Features.md +0 -2
  765. package/one/things/plans/1-create-workflow-status.md +0 -555
  766. package/one/things/plans/2-backend-agnostic-frontend.md +0 -546
  767. package/one/things/plans/2-sites.md +0 -895
  768. package/one/things/plans/3-groups.md +0 -735
  769. package/one/things/plans/5-build-frontend.md +0 -0
  770. package/one/things/plans/5-complete.md +0 -17
  771. package/one/things/plans/agent-director-100-inference-plans.md +0 -410
  772. package/one/things/plans/dual-website-strategy.md +0 -612
  773. package/one/things/plans/releases.md +0 -809
@@ -0,0 +1,2047 @@
1
+ ---
2
+ title: Todo X402
3
+ dimension: things
4
+ primary_dimension: things
5
+ category: todo-x402.md
6
+ tags: agent, ai, architecture, connections, groups, inference, ontology, people, protocol, things
7
+ related_dimensions: connections, events, groups, knowledge, people
8
+ scope: global
9
+ created: 2025-11-03
10
+ updated: 2025-11-03
11
+ version: 1.0.0
12
+ ai_context: |
13
+ This document is part of the things dimension in the todo-x402.md category.
14
+ Location: one/things/todo-x402.md
15
+ Purpose: Documents one platform: x402 integration roadmap v1.0.0
16
+ Related dimensions: connections, events, groups, knowledge, people
17
+ For AI agents: Read this to understand todo x402.
18
+ ---
19
+
20
+ # ONE Platform: X402 Integration Roadmap v1.0.0
21
+
22
+ **Focus:** Integrate X402 HTTP-native payments into the web platform
23
+ **Protocol:** https://www.x402.org/ (HTTP 402 Payment Required)
24
+ **Timeline:** 100 inferences (inference-based planning, not time-based)
25
+ **Target:** AI agent micropayments, API monetization, provider discovery via Bazar
26
+
27
+ ---
28
+
29
+ ## PHASE 1: FOUNDATION & SETUP (Infer 1-10)
30
+
31
+ **Purpose:** Validate architecture, map to 6-dimension ontology, plan implementation
32
+
33
+ ### Infer 1: Validate X402 Protocol Alignment with Ontology
34
+
35
+ - [ ] Read `/one/connections/x402.md` (protocol spec)
36
+ - [ ] Map X402 payment flow to 6-dimension ontology:
37
+ - [ ] **Groups:** Merchant group owns API service, customer group initiates payment
38
+ - [ ] **People:** Platform owner authorizes payment schemes, merchant/customer actors
39
+ - [ ] **Things:** payment (transaction), external_agent (service provider), product (API listing)
40
+ - [ ] **Connections:** transacted (payment relationship), communicated (X402 protocol handshake)
41
+ - [ ] **Events:** payment_event (402 response, payment verified, settled)
42
+ - [ ] **Knowledge:** payment_method label, x402_scheme, blockchain_network labels
43
+ - [ ] Identify 3 core use cases:
44
+ - [ ] Agent-to-agent API calls (internal agents)
45
+ - [ ] External provider access (ElizaOS agents via A2A)
46
+ - [ ] Bazar marketplace discovery + payment
47
+
48
+ ### Infer 2: Review Existing Payment Infrastructure
49
+
50
+ - [ ] Examine `backend/convex/schema.ts` for payment thing type
51
+ - [ ] Check `web/src/components/` for any existing payment UI
52
+ - [ ] Review `backend/convex/mutations/` for payment flows
53
+ - [ ] Document current payment handling:
54
+ - [ ] Stripe integration (if any)
55
+ - [ ] Token purchase flows
56
+ - [ ] Invoice/subscription patterns
57
+ - [ ] Note: **Goal is X402 as PRIMARY payment, not replacement**
58
+
59
+ ### Infer 3: Map X402 to Web Application Layers
60
+
61
+ - [ ] **Frontend (Astro):**
62
+ - [ ] X402 payment prompt components (402 handling)
63
+ - [ ] Wallet connection UI (viem, wagmi)
64
+ - [ ] Payment status display
65
+ - [ ] **API Routes (Astro):**
66
+ - [ ] GET routes that can respond 402
67
+ - [ ] Handle X-PAYMENT header verification
68
+ - [ ] Return protected resources on valid payment
69
+ - [ ] **Backend (Convex):**
70
+ - [ ] X402PaymentService (Effect.ts)
71
+ - [ ] Blockchain provider integrations
72
+ - [ ] Payment verification + settlement
73
+ - [ ] **Database (Convex):**
74
+ - [ ] payment thing type schema
75
+ - [ ] payment_event event types
76
+ - [ ] transacted connection metadata
77
+
78
+ ### Infer 4: Define X402 Integration Scope
79
+
80
+ - [ ] **Phase 1 (Infer 1-100):** Core X402 infrastructure
81
+ - [ ] HTTP 402 protocol implementation
82
+ - [ ] Base network support (preferred for low fees)
83
+ - [ ] Permit + Transfer payment schemes
84
+ - [ ] Payment verification via facilitator
85
+ - [ ] **Future phases (separate todos):**
86
+ - [ ] Bazar marketplace discovery layer
87
+ - [ ] Multi-chain support (Ethereum, Solana)
88
+ - [ ] Advanced payment schemes (invoice, signature)
89
+ - [ ] Revenue distribution to merchants
90
+ - [ ] Document assumptions:
91
+ - [ ] Base USDC as primary token
92
+ - [ ] Coinbase facilitator for verification
93
+ - [ ] Pay-per-request model (not subscriptions initially)
94
+
95
+ ### Infer 5: Set Up Development Environment
96
+
97
+ - [ ] Ensure `.env.local` in `/web` contains:
98
+ - [ ] `PUBLIC_CONVEX_URL` (Convex endpoint)
99
+ - [ ] `BETTER_AUTH_SECRET` (auth)
100
+ - [ ] Add (new): `VITE_X402_FACILITATOR_URL` (e.g., Coinbase CDP)
101
+ - [ ] Add (new): `VITE_BLOCKCHAIN_RPC_BASE` (Base network RPC)
102
+ - [ ] Ensure `backend/.env.local` contains:
103
+ - [ ] `CONVEX_DEPLOYMENT` (Convex)
104
+ - [ ] Add (new): `X402_PAYMENT_ADDRESS_BASE` (treasury address)
105
+ - [ ] Add (new): `X402_PAYMENT_ADDRESS_ETHEREUM` (treasury address)
106
+ - [ ] Add (new): `X402_PAYMENT_ADDRESS_SOLANA` (future)
107
+ - [ ] Add (new): `FACILITATOR_URL` (Coinbase CDP)
108
+ - [ ] Add (new): `FACILITATOR_API_KEY` (if needed)
109
+ - [ ] Add to `package.json` dependencies:
110
+ - [ ] `viem` (blockchain client)
111
+ - [ ] `wagmi` (React hooks)
112
+ - [ ] `@coinbase/cdp-sdk` (facilitator)
113
+ - [ ] `effect` (Effect.ts already included)
114
+
115
+ ### Infer 6: Review Convex Schema for Payment Thing Type
116
+
117
+ - [ ] Open `backend/convex/schema.ts`
118
+ - [ ] Verify payment thing type exists:
119
+ ```typescript
120
+ {
121
+ type: "payment",
122
+ properties: {
123
+ protocol: "x402", // NEW: add protocol field
124
+ amount: number,
125
+ currency: "USDC",
126
+ paymentMethod: "crypto",
127
+ scheme: "permit" | "transfer",
128
+ network: "base" | "ethereum" | "solana",
129
+ status: "pending" | "verified" | "settled" | "failed",
130
+ txHash: string,
131
+ paymentId: string,
132
+ payTo: string,
133
+ facilitatorResponse: any, // NEW: store facilitator verification
134
+ }
135
+ }
136
+ ```
137
+ - [ ] If missing, add payment thing type to schema
138
+ - [ ] Verify indexes on payment things:
139
+ - [ ] by_type(type = "payment")
140
+ - [ ] by_status(status)
141
+ - [ ] by_protocol(protocol)
142
+
143
+ ### Infer 7: Create X402 Protocol Type Definitions File
144
+
145
+ - [ ] Create `backend/convex/protocols/x402.ts` with:
146
+ - [ ] PaymentRequired interface (402 response)
147
+ - [ ] PaymentRequirement interface (per-scheme/network)
148
+ - [ ] PaymentPayload interface (X-PAYMENT header)
149
+ - [ ] PermitPayload, TransferPayload interfaces
150
+ - [ ] FacilitatorEndpoints, VerifyPaymentRequest/Response
151
+ - [ ] SupportedSchemesResponse interface
152
+ - [ ] Convex validators for all above
153
+ - [ ] X402_VERSION = 1 constant
154
+ - [ ] Document TypeScript patterns for each interface
155
+ - [ ] Note: Copy from `/one/connections/x402.md` "TypeScript Protocol Interfaces" section
156
+
157
+ ### Infer 8: Understand X402 Protocol Flow in Web Context
158
+
159
+ - [ ] Study the 4-step HTTP 402 flow:
160
+ 1. Client requests protected resource
161
+ 2. Server responds 402 with PaymentRequired
162
+ 3. Client sends payment in X-PAYMENT header + retries
163
+ 4. Server verifies, returns resource + X-PAYMENT-ID header
164
+ - [ ] Map to Astro patterns:
165
+ - [ ] `GET /api/agent/execute` (Astro API route)
166
+ - [ ] Check if payment required (config-based)
167
+ - [ ] Return 402 if unpaid
168
+ - [ ] Handle POST with X-PAYMENT header
169
+ - [ ] Verify via Convex effect service
170
+ - [ ] Execute agent + return 200
171
+ - [ ] Identify which endpoints need X402 protection:
172
+ - [ ] Agent execution: `/api/agent/[agentId]/execute`
173
+ - [ ] Provider access: `/api/provider/[providerId]/call`
174
+ - [ ] N8N workflows: `/api/workflow/[workflowId]/trigger`
175
+ - [ ] Custom API: `/api/custom/[name]` (future)
176
+
177
+ ### Infer 9: Plan Blockchain Integration
178
+
179
+ - [ ] Choose primary network: **Base (Coinbase L2)**
180
+ - [ ] Lowest fees (~$0.001 per transaction)
181
+ - [ ] USDC natively supported
182
+ - [ ] ERC-2612 permit support
183
+ - [ ] Fast finality (~2 seconds)
184
+ - [ ] Secondary networks (future):
185
+ - [ ] Ethereum mainnet (if higher value txns)
186
+ - [ ] Solana (if volume justifies)
187
+ - [ ] Choose permit scheme (preferred):
188
+ - [ ] ERC-2612 permit (gasless approval)
189
+ - [ ] No approval tx needed
190
+ - [ ] Saves gas + UX
191
+ - [ ] Identify token: **USDC on Base**
192
+ - [ ] Address: `0x833589fcd6edb6e08f4c7c32d4f71b54bda02913` (Base)
193
+ - [ ] Decimals: 6
194
+ - [ ] Facilitator: Coinbase CDP (pre-hosted)
195
+
196
+ ### Infer 10: Define Success Metrics for X402 Phase
197
+
198
+ - [ ] Integration complete when:
199
+ - [ ] [ ] HTTP 402 responses sent from Astro API routes
200
+ - [ ] [ ] X-PAYMENT header validation working
201
+ - [ ] [ ] Blockchain payment verification functional
202
+ - [ ] [ ] Payment events logged in Convex
203
+ - [ ] [ ] UI shows payment prompt + wallet connection
204
+ - [ ] [ ] Demo: Agent request → 402 prompt → payment → resource delivered
205
+ - [ ] Test targets:
206
+ - [ ] 3+ protected endpoints (agent, provider, workflow)
207
+ - [ ] 2+ payment schemes (permit, transfer)
208
+ - [ ] Payment history queryable
209
+ - [ ] E2E test: Request → payment → access
210
+ - [ ] Document in: `one/events/deployments/x402-phase1.md`
211
+
212
+ ---
213
+
214
+ ## PHASE 2: BACKEND SCHEMA & SERVICES (Infer 11-20)
215
+
216
+ **Purpose:** Implement Effect.ts payment services, update Convex schema
217
+
218
+ ### Infer 11: Extend Payment Thing Type in Schema
219
+
220
+ - [ ] Edit `backend/convex/schema.ts`
221
+ - [ ] Update payment thing properties:
222
+
223
+ ```typescript
224
+ properties: {
225
+ protocol: v.literal('x402'), // X402-specific
226
+ scheme: v.union(
227
+ v.literal('permit'),
228
+ v.literal('transfer'),
229
+ v.literal('signature'),
230
+ v.literal('invoice')
231
+ ),
232
+ network: v.union(
233
+ v.literal('base'),
234
+ v.literal('ethereum'),
235
+ v.literal('solana'),
236
+ v.literal('arbitrum'),
237
+ v.literal('optimism'),
238
+ v.literal('polygon')
239
+ ),
240
+ amount: v.string(), // Decimal string
241
+ currency: v.literal('USDC'),
242
+ paymentMethod: v.literal('crypto'),
243
+
244
+ // Payment details
245
+ payTo: v.string(), // Recipient address
246
+ payFrom: v.string(), // Payer address
247
+ txHash: v.optional(v.string()),
248
+ paymentId: v.string(), // Unique ID
249
+
250
+ // Status tracking
251
+ status: v.union(
252
+ v.literal('pending'),
253
+ v.literal('payment_required'),
254
+ v.literal('verified'),
255
+ v.literal('settled'),
256
+ v.literal('failed')
257
+ ),
258
+
259
+ // X402 request/response
260
+ resource: v.string(), // Protected endpoint
261
+ payload: v.optional(v.any()), // X-PAYMENT payload
262
+ facilitatorResponse: v.optional(v.any()), // Verification response
263
+
264
+ // Metadata
265
+ description: v.optional(v.string()),
266
+ invoiceId: v.optional(v.string()),
267
+ metadata: v.optional(v.any()),
268
+ }
269
+ ```
270
+
271
+ - [ ] Add payment indexes:
272
+ - [ ] by_type("payment")
273
+ - [ ] by_status(status)
274
+ - [ ] by_network(network)
275
+ - [ ] by_payto(payTo)
276
+ - [ ] Create migration if needed (Convex migrations)
277
+
278
+ ### Infer 12: Create X402PaymentService (Effect.ts)
279
+
280
+ - [ ] Create `backend/convex/services/x402-payment.ts`
281
+ - [ ] Implement X402PaymentService class:
282
+ ```typescript
283
+ export class X402PaymentService extends Effect.Service<...>() {
284
+ // Service methods (from /one/connections/x402.md)
285
+ }
286
+ ```
287
+ - [ ] Implement core methods:
288
+ - [ ] `createPaymentRequest()` → PaymentRequired (402 response)
289
+ - [ ] `verifyPayment()` → boolean (X-PAYMENT validation)
290
+ - [ ] `settlePayment()` → string (txHash)
291
+ - [ ] `getPaymentHistory()` → Payment[]
292
+ - [ ] `recordPayment()` → void (log event)
293
+ - [ ] Document each method with:
294
+ - [ ] Input types
295
+ - [ ] Output types
296
+ - [ ] Effect.ts error handling
297
+ - [ ] Blockchain interaction
298
+ - [ ] Note: Reference `/one/connections/x402.md` Part 2 for code
299
+
300
+ ### Infer 13: Create X402FacilitatorService (Effect.ts)
301
+
302
+ - [ ] Create `backend/convex/services/x402-facilitator.ts`
303
+ - [ ] Implement X402FacilitatorService class:
304
+ ```typescript
305
+ export class X402FacilitatorService extends Effect.Service<...>() {
306
+ // Facilitator interaction methods
307
+ }
308
+ ```
309
+ - [ ] Implement methods to interact with Coinbase CDP:
310
+ - [ ] `verifyPayment(paymentPayload)` → VerifyPaymentResponse
311
+ - [ ] `settlePayment(settlementRequest)` → SettlePaymentResponse
312
+ - [ ] `getSupportedSchemes()` → SupportedSchemesResponse
313
+ - [ ] `checkNetworkSupport(network)` → boolean
314
+ - [ ] Handle facilitator API calls:
315
+ - [ ] POST /verify (validate X402 payment)
316
+ - [ ] POST /settle (execute settlement)
317
+ - [ ] GET /supported (list schemes)
318
+ - [ ] Implement error handling:
319
+ - [ ] Network errors (retry logic)
320
+ - [ ] Invalid payment (return error)
321
+ - [ ] Unsupported scheme/network
322
+
323
+ ### Infer 14: Create Blockchain Provider Service (Effect.ts)
324
+
325
+ - [ ] Create `backend/convex/services/blockchain-provider.ts`
326
+ - [ ] Implement BlockchainProviderService class:
327
+ ```typescript
328
+ export class BlockchainProviderService extends Effect.Service<...>() {
329
+ // Multi-chain provider methods
330
+ }
331
+ ```
332
+ - [ ] Support networks:
333
+ - [ ] **Base:** via viem/ethers client
334
+ - [ ] **Ethereum:** via viem/ethers client
335
+ - [ ] **Solana:** (stub for now, full in future)
336
+ - [ ] Implement methods:
337
+ - [ ] `getProvider(network)` → Client instance
338
+ - [ ] `getTokenContract(network)` → Contract ABI
339
+ - [ ] `verifyTransaction(txHash, network)` → tx details
340
+ - [ ] `estimateGas(tx, network)` → gas estimate
341
+ - [ ] `getGasPrice(network)` → current gas price
342
+ - [ ] Cache provider instances for efficiency
343
+
344
+ ### Infer 15: Implement Payment Event Logging
345
+
346
+ - [ ] Ensure payment_event exists in events table (from ontology)
347
+ - [ ] Create `backend/convex/services/payment-event-logger.ts`
348
+ - [ ] Log event types:
349
+ - [ ] `payment_event` with metadata.status = "requested" (402 sent)
350
+ - [ ] `payment_event` with metadata.status = "verified" (X-PAYMENT valid)
351
+ - [ ] `payment_event` with metadata.status = "settled" (blockchain confirmed)
352
+ - [ ] `payment_event` with metadata.status = "failed" (error occurred)
353
+ - [ ] Event structure:
354
+ ```typescript
355
+ {
356
+ type: 'payment_event',
357
+ actorId: userId, // Who initiated payment
358
+ targetId: paymentId, // Payment thing ID
359
+ timestamp: Date.now(),
360
+ metadata: {
361
+ protocol: 'x402',
362
+ status: 'requested' | 'verified' | 'settled' | 'failed',
363
+ network: 'base' | 'ethereum' | ...,
364
+ scheme: 'permit' | 'transfer' | ...,
365
+ amount: amount,
366
+ txHash: txHash, // if settled
367
+ resource: resourcePath,
368
+ facilitatorResponse: response,
369
+ }
370
+ }
371
+ ```
372
+ - [ ] Create helper function to log events
373
+ - [ ] Test event logging in dev environment
374
+
375
+ ### Infer 16: Create X402Middleware for Astro API Routes
376
+
377
+ - [ ] Create `web/src/middleware/x402-middleware.ts`
378
+ - [ ] Implement middleware that:
379
+ - [ ] Intercepts API route requests
380
+ - [ ] Checks if endpoint requires X402 payment
381
+ - [ ] Validates X-PAYMENT header if present
382
+ - [ ] Returns 402 if payment required + not provided
383
+ - [ ] Returns 200 + X-PAYMENT-ID if valid payment
384
+ - [ ] Middleware signature:
385
+ ```typescript
386
+ export function x402Middleware(
387
+ request: Request,
388
+ endpoint: X402ProtectedEndpoint,
389
+ ): {
390
+ requiresPayment: boolean;
391
+ statusCode: number;
392
+ paymentRequired?: PaymentRequired;
393
+ xPaymentId?: string;
394
+ };
395
+ ```
396
+ - [ ] Handle edge cases:
397
+ - [ ] Missing X-PAYMENT header
398
+ - [ ] Invalid X-PAYMENT JSON
399
+ - [ ] Payment amount < required
400
+ - [ ] Payment already used (replay protection)
401
+
402
+ ### Infer 17: Set Up X402 Configuration
403
+
404
+ - [ ] Create `backend/convex/config/x402-config.ts`
405
+ - [ ] Define configuration object:
406
+ ```typescript
407
+ export const x402Config = {
408
+ enabled: true,
409
+ facilitator: {
410
+ url: process.env.FACILITATOR_URL,
411
+ apiKey: process.env.FACILITATOR_API_KEY,
412
+ },
413
+ networks: {
414
+ base: {
415
+ rpcUrl: process.env.VITE_BLOCKCHAIN_RPC_BASE,
416
+ chainId: 8453,
417
+ usdcAddress: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
418
+ treasury: process.env.X402_PAYMENT_ADDRESS_BASE,
419
+ },
420
+ ethereum: {
421
+ rpcUrl: process.env.VITE_BLOCKCHAIN_RPC_ETHEREUM,
422
+ chainId: 1,
423
+ usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
424
+ treasury: process.env.X402_PAYMENT_ADDRESS_ETHEREUM,
425
+ },
426
+ },
427
+ payments: {
428
+ minAmount: "0.001", // $0.001 minimum
429
+ defaultAmount: "0.01", // $0.01 default for API calls
430
+ defaultNetwork: "base",
431
+ defaultScheme: "permit",
432
+ expirationTime: 5 * 60 * 1000, // 5 minutes
433
+ },
434
+ };
435
+ ```
436
+ - [ ] Load config from env vars in both `.env` files
437
+ - [ ] Document required env vars
438
+
439
+ ### Infer 18: Implement Payment Verification Logic
440
+
441
+ - [ ] Create `backend/convex/lib/x402-verify.ts`
442
+ - [ ] Implement verification function:
443
+ ```typescript
444
+ export async function verifyX402Payment(
445
+ paymentPayload: PaymentPayload,
446
+ requirement: PaymentRequirement,
447
+ resource: string,
448
+ ): Promise<{ valid: boolean; paymentId: string; error?: string }>;
449
+ ```
450
+ - [ ] Verification steps:
451
+ 1. Validate payload structure (JSON schema)
452
+ 2. Verify X402 version matches
453
+ 3. Validate scheme (permit/transfer/etc)
454
+ 4. Call facilitator API to verify payment
455
+ 5. Check payment amount >= required
456
+ 6. Verify recipient address matches
457
+ 7. Check replay (txHash not used before)
458
+ 8. Log result in events table
459
+ 9. Return validation result
460
+ - [ ] Handle each error case with descriptive message
461
+
462
+ ### Infer 19: Implement Payment Settlement
463
+
464
+ - [ ] Create `backend/convex/lib/x402-settle.ts`
465
+ - [ ] Implement settlement function:
466
+ ```typescript
467
+ export async function settleX402Payment(
468
+ paymentPayload: PaymentPayload,
469
+ paymentId: string,
470
+ ): Promise<{ settled: boolean; txHash: string; error?: string }>;
471
+ ```
472
+ - [ ] Settlement steps:
473
+ 1. Get verified payment from database
474
+ 2. Check status = "verified"
475
+ 3. Call facilitator to execute settlement
476
+ 4. Update payment status to "settled"
477
+ 5. Log settlement event
478
+ 6. Return settlement result
479
+ - [ ] Handle settlement errors:
480
+ - [ ] Blockchain errors (retry)
481
+ - [ ] Insufficient gas (recommend amount)
482
+ - [ ] Network issues (queue for retry)
483
+
484
+ ### Infer 20: Create Convex Mutations for Payment Handling
485
+
486
+ - [ ] Create `backend/convex/mutations/payments.ts`
487
+ - [ ] Implement mutations:
488
+ - [ ] `createPaymentRequest(resource, amount)` → PaymentRequired
489
+ - [ ] `verifyPayment(paymentPayload, requirement)` → verification result
490
+ - [ ] `recordPayment(paymentPayload, resource)` → paymentId
491
+ - [ ] `updatePaymentStatus(paymentId, status)` → void
492
+ - [ ] Each mutation:
493
+ - [ ] Takes typed arguments (Convex v)
494
+ - [ ] Calls appropriate Effect.ts service
495
+ - [ ] Handles errors gracefully
496
+ - [ ] Returns structured result
497
+ - [ ] Logs events
498
+ - [ ] Document expected flow:
499
+ - [ ] Frontend requests resource
500
+ - [ ] Astro calls `createPaymentRequest` mutation
501
+ - [ ] Returns 402 to frontend
502
+ - [ ] Frontend shows payment prompt
503
+ - [ ] User connects wallet + makes payment
504
+ - [ ] Frontend calls `verifyPayment` mutation
505
+ - [ ] If valid, calls `recordPayment` mutation
506
+ - [ ] Astro re-processes original request
507
+
508
+ ---
509
+
510
+ ## PHASE 3: FRONTEND COMPONENTS & PAGES (Infer 21-30)
511
+
512
+ **Purpose:** Build React components and Astro pages for payment flow
513
+
514
+ ### Infer 21: Create PaymentRequired Component
515
+
516
+ - [ ] Create `web/src/components/features/PaymentRequired.tsx`
517
+ - [ ] Component displays:
518
+ - [ ] Payment amount in USD + tokens
519
+ - [ ] Multiple network options (Base, Ethereum)
520
+ - [ ] Multiple scheme options (Permit, Transfer)
521
+ - [ ] "Connect Wallet" button
522
+ - [ ] Error messages
523
+ - [ ] Loading state during payment
524
+ - [ ] Props:
525
+ ```typescript
526
+ interface PaymentRequiredProps {
527
+ paymentRequired: PaymentRequired; // 402 response
528
+ onPaymentComplete: (payload: PaymentPayload) => void;
529
+ onCancel: () => void;
530
+ }
531
+ ```
532
+ - [ ] Features:
533
+ - [ ] Responsive design
534
+ - [ ] Dark mode support
535
+ - [ ] Accessibility (WCAG)
536
+ - [ ] Mobile wallet support
537
+
538
+ ### Infer 22: Create WalletConnection Component
539
+
540
+ - [ ] Create `web/src/components/features/WalletConnection.tsx`
541
+ - [ ] Component handles:
542
+ - [ ] Connecting wallet (MetaMask, Rainbow Kit, etc)
543
+ - [ ] Displaying connected address
544
+ - [ ] Showing wallet balance (USDC)
545
+ - [ ] Switching networks (to Base, Ethereum)
546
+ - [ ] Disconnecting wallet
547
+ - [ ] Use libraries:
548
+ - [ ] `wagmi` (React hooks for wallet)
549
+ - [ ] `viem` (blockchain client)
550
+ - [ ] `@rainbow-me/rainbowkit` (UI kit)
551
+ - [ ] Features:
552
+ - [ ] One-click connect
553
+ - [ ] Auto-switch to required network
554
+ - [ ] Display balance in USD + tokens
555
+ - [ ] Error handling for network mismatch
556
+
557
+ ### Infer 23: Create PaymentProcessor Component
558
+
559
+ - [ ] Create `web/src/components/features/PaymentProcessor.tsx`
560
+ - [ ] Component orchestrates:
561
+ - [ ] Taking PaymentRequired + PaymentPayload
562
+ - [ ] Calling Convex to verify payment
563
+ - [ ] Handling verification response
564
+ - [ ] Showing success/error to user
565
+ - [ ] Retrying if transaction pending
566
+ - [ ] Handles payment schemes:
567
+ - [ ] **Permit:** ERC-2612 signature + transfer in one tx
568
+ - [ ] **Transfer:** Direct token transfer (requires approval first)
569
+ - [ ] Features:
570
+ - [ ] Retry logic for network timeouts
571
+ - [ ] Shows tx hash when sent
572
+ - [ ] Polls for confirmation (~2 seconds on Base)
573
+ - [ ] Timeout after 5 minutes
574
+
575
+ ### Infer 24: Create PaymentPrompt Modal
576
+
577
+ - [ ] Create `web/src/components/features/PaymentPromptModal.tsx`
578
+ - [ ] Modal that combines:
579
+ - [ ] PaymentRequired display
580
+ - [ ] WalletConnection
581
+ - [ ] PaymentProcessor
582
+ - [ ] Success/error states
583
+ - [ ] Behavior:
584
+ - [ ] Shows when backend returns 402
585
+ - [ ] User connects wallet
586
+ - [ ] Processes payment
587
+ - [ ] Auto-closes + retries original request on success
588
+ - [ ] Design:
589
+ - [ ] Centered modal with overlay
590
+ - [ ] Progress indicator (step 1/3, etc)
591
+ - [ ] Clear instructions for user
592
+ - [ ] Cancel button to dismiss
593
+
594
+ ### Infer 25: Create PaymentHistory Component
595
+
596
+ - [ ] Create `web/src/components/features/PaymentHistory.tsx`
597
+ - [ ] Component displays:
598
+ - [ ] List of past payments
599
+ - [ ] Amount, date, status, network
600
+ - [ ] Tx hash link to explorer
601
+ - [ ] Filter by status, network, date range
602
+ - [ ] Search by tx hash
603
+ - [ ] Table columns:
604
+ - [ ] Timestamp
605
+ - [ ] Resource (API endpoint)
606
+ - [ ] Amount (USD + tokens)
607
+ - [ ] Network
608
+ - [ ] Status badge (✓ settled, ⏳ verified, ✗ failed)
609
+ - [ ] Tx hash (link to block explorer)
610
+ - [ ] Action button (view details)
611
+ - [ ] Fetches data from Convex query
612
+ - [ ] Pagination for many transactions
613
+
614
+ ### Infer 26: Create BalanceDisplay Component
615
+
616
+ - [ ] Create `web/src/components/features/BalanceDisplay.tsx`
617
+ - [ ] Component shows:
618
+ - [ ] Wallet USDC balance
619
+ - [ ] Formatted in USD + token units
620
+ - [ ] Network indicator (Base, Ethereum, etc)
621
+ - [ ] Refresh button
622
+ - [ ] Low balance warning (if < $0.05)
623
+ - [ ] Real-time updates:
624
+ - [ ] Subscribes to Convex changes
625
+ - [ ] Updates when new payment made
626
+ - [ ] Design:
627
+ - [ ] Card layout
628
+ - [ ] Badge showing network
629
+ - [ ] Loading skeleton
630
+ - [ ] Error message if balance fetch fails
631
+
632
+ ### Infer 27: Create AgentExecutionFlow with X402
633
+
634
+ - [ ] Create `web/src/components/features/AgentExecutionFlow.tsx`
635
+ - [ ] Component orchestrates:
636
+ - [ ] User selects agent + parameters
637
+ - [ ] Clicks "Execute" button
638
+ - [ ] Backend returns 402 if payment required
639
+ - [ ] Shows PaymentPromptModal
640
+ - [ ] User pays
641
+ - [ ] Retries agent execution
642
+ - [ ] Shows agent result
643
+ - [ ] Handles all payment states:
644
+ - [ ] Payment required
645
+ - [ ] Payment processing
646
+ - [ ] Payment verified
647
+ - [ ] Agent executing
648
+ - [ ] Agent complete
649
+ - [ ] Payment failed (show retry)
650
+ - [ ] UX flow:
651
+ ```
652
+ Agent Selection → Execute → [Payment Modal if 402] → Agent Results
653
+ ```
654
+
655
+ ### Infer 28: Update ExternalProviderAccess Component
656
+
657
+ - [ ] Modify `web/src/components/features/ExternalProviderAccess.tsx`
658
+ - [ ] Add X402 payment flow:
659
+ - [ ] Show provider listing from Bazar (future)
660
+ - [ ] Compare pricing + availability
661
+ - [ ] Select provider + call API
662
+ - [ ] Handle 402 payment prompt
663
+ - [ ] Execute provider request
664
+ - [ ] Show results
665
+ - [ ] Features:
666
+ - [ ] Provider comparison table
667
+ - [ ] Price in USD per request
668
+ - [ ] Network availability badge
669
+ - [ ] Success rate %
670
+
671
+ ### Infer 29: Create X402 Demo Page
672
+
673
+ - [ ] Create `web/src/pages/demo/x402-payments.astro`
674
+ - [ ] Interactive demo showing:
675
+ - [ ] Protected API endpoint (returns 402)
676
+ - [ ] Payment requirement breakdown
677
+ - [ ] Wallet connection flow
678
+ - [ ] Payment execution
679
+ - [ ] Transaction confirmation
680
+ - [ ] Final resource access
681
+ - [ ] Demo scenarios:
682
+ - [ ] Minimum payment ($0.001)
683
+ - [ ] Standard payment ($0.01)
684
+ - [ ] Higher amount ($1.00)
685
+ - [ ] Educational content:
686
+ - [ ] How X402 works (animation)
687
+ - [ ] Why X402 > API keys
688
+ - [ ] Integration for developers
689
+ - [ ] FAQ section
690
+
691
+ ### Infer 30: Create X402 Documentation Page
692
+
693
+ - [ ] Create `web/src/pages/docs/x402-integration.astro`
694
+ - [ ] Document for developers:
695
+ - [ ] X402 protocol overview
696
+ - [ ] How to protect endpoints
697
+ - [ ] How to handle 402 responses
698
+ - [ ] Integration examples (curl, JS, Python)
699
+ - [ ] Error handling
700
+ - [ ] Retry logic
701
+ - [ ] Code examples:
702
+ - [ ] Backend: Mark endpoint as requiring payment
703
+ - [ ] Frontend: Handle 402 + show payment modal
704
+ - [ ] Wallet: Connect + sign permit
705
+ - [ ] Settlement: Verify payment + grant access
706
+ - [ ] Deploy to `/docs/x402-integration`
707
+
708
+ ---
709
+
710
+ ## PHASE 4: API ROUTES & ASTRO INTEGRATION (Infer 31-40)
711
+
712
+ **Purpose:** Implement X402-protected API routes in Astro
713
+
714
+ ### Infer 31: Create X402 Astro API Route Handler
715
+
716
+ - [ ] Create `web/src/lib/x402-route-handler.ts`
717
+ - [ ] Export function:
718
+ ```typescript
719
+ export async function handleX402Request(
720
+ request: Request,
721
+ handler: (req: Request) => Promise<Response>,
722
+ options: X402RouteOptions,
723
+ ): Promise<Response>;
724
+ ```
725
+ - [ ] Implements full X402 flow:
726
+ 1. Check if X-PAYMENT header exists
727
+ 2. If not → return 402 PaymentRequired
728
+ 3. If yes → verify payment via Convex
729
+ 4. If invalid → return 402 with error
730
+ 5. If valid → call handler to get resource
731
+ 6. Return 200 + X-PAYMENT-ID header + resource
732
+ - [ ] Options interface:
733
+ ```typescript
734
+ interface X402RouteOptions {
735
+ requiresPayment: boolean;
736
+ amount?: string;
737
+ description?: string;
738
+ resource: string; // endpoint path
739
+ }
740
+ ```
741
+ - [ ] Error handling:
742
+ - [ ] Invalid payload format
743
+ - [ ] Verification failed
744
+ - [ ] Facilitator error (return 502)
745
+ - [ ] Payment expired
746
+
747
+ ### Infer 32: Create Agent Execution API Route
748
+
749
+ - [ ] Create `web/src/pages/api/agent/execute.ts`
750
+ - [ ] Astro API route that:
751
+ - [ ] Accepts POST request with agent config
752
+ - [ ] Checks if payment required (config-based)
753
+ - [ ] Uses handleX402Request to enforce payment
754
+ - [ ] Calls Convex to execute agent
755
+ - [ ] Returns agent result
756
+ - [ ] Request body:
757
+ ```typescript
758
+ {
759
+ agentId: string;
760
+ parameters: Record<string, any>;
761
+ userId: string;
762
+ }
763
+ ```
764
+ - [ ] Response on success (200):
765
+ ```typescript
766
+ {
767
+ success: true;
768
+ result: any;
769
+ executionTime: number;
770
+ paymentId: string; // X-PAYMENT-ID
771
+ }
772
+ ```
773
+ - [ ] Response on payment required (402):
774
+ ```typescript
775
+ {
776
+ x402Version: 1;
777
+ accepts: PaymentRequirement[];
778
+ }
779
+ ```
780
+
781
+ ### Infer 33: Create Provider API Call Route
782
+
783
+ - [ ] Create `web/src/pages/api/provider/[providerId]/call.ts`
784
+ - [ ] Astro API route that:
785
+ - [ ] Accepts POST request with provider method + params
786
+ - [ ] Enforces X402 payment
787
+ - [ ] Forwards request to external provider
788
+ - [ ] Returns provider response
789
+ - [ ] Request body:
790
+ ```typescript
791
+ {
792
+ method: string;
793
+ parameters: Record<string, any>;
794
+ }
795
+ ```
796
+ - [ ] Handles:
797
+ - [ ] Rate limiting per provider
798
+ - [ ] Provider availability check
799
+ - [ ] Timeout handling
800
+ - [ ] Error forwarding from provider
801
+
802
+ ### Infer 34: Create Workflow Trigger Route
803
+
804
+ - [ ] Create `web/src/pages/api/workflow/[workflowId]/trigger.ts`
805
+ - [ ] Astro API route that:
806
+ - [ ] Accepts POST with workflow inputs
807
+ - [ ] Enforces X402 payment
808
+ - [ ] Triggers N8N workflow
809
+ - [ ] Returns workflow execution status
810
+ - [ ] Workflow payment tiers (future):
811
+ - [ ] Small workflow ($0.001)
812
+ - [ ] Medium workflow ($0.01)
813
+ - [ ] Large workflow ($0.10)
814
+ - [ ] Integration with N8N:
815
+ - [ ] POST to N8N webhook URL
816
+ - [ ] Include payment ID in headers
817
+ - [ ] Track execution in Convex
818
+
819
+ ### Infer 35: Create Payment Verification Route
820
+
821
+ - [ ] Create `web/src/pages/api/payments/verify.ts`
822
+ - [ ] POST route that:
823
+ - [ ] Takes X-PAYMENT payload
824
+ - [ ] Calls Convex to verify
825
+ - [ ] Returns verification result
826
+ - [ ] Request body:
827
+ ```typescript
828
+ {
829
+ paymentPayload: PaymentPayload;
830
+ resource: string;
831
+ }
832
+ ```
833
+ - [ ] Response:
834
+ ```typescript
835
+ {
836
+ valid: boolean;
837
+ paymentId: string;
838
+ txHash: string;
839
+ error?: string;
840
+ }
841
+ ```
842
+
843
+ ### Infer 36: Create Payment Settlement Route
844
+
845
+ - [ ] Create `web/src/pages/api/payments/settle.ts`
846
+ - [ ] POST route that:
847
+ - [ ] Takes verified payment
848
+ - [ ] Calls Convex to settle on blockchain
849
+ - [ ] Returns settlement result
850
+ - [ ] Request body:
851
+ ```typescript
852
+ {
853
+ paymentId: string;
854
+ }
855
+ ```
856
+ - [ ] Response:
857
+ ```typescript
858
+ {
859
+ settled: boolean;
860
+ txHash: string;
861
+ blockNumber: number;
862
+ error?: string;
863
+ }
864
+ ```
865
+
866
+ ### Infer 37: Create Payment Query Route
867
+
868
+ - [ ] Create `web/src/pages/api/payments/history.ts`
869
+ - [ ] GET route that:
870
+ - [ ] Requires authentication
871
+ - [ ] Returns user's payment history
872
+ - [ ] Supports filtering + pagination
873
+ - [ ] Query params:
874
+ ```
875
+ ?status=settled&network=base&limit=20&offset=0&sortBy=date
876
+ ```
877
+ - [ ] Response:
878
+ ```typescript
879
+ {
880
+ payments: Payment[];
881
+ total: number;
882
+ page: number;
883
+ }
884
+ ```
885
+
886
+ ### Infer 38: Create Payment Configuration Route
887
+
888
+ - [ ] Create `web/src/pages/api/x402/config.ts`
889
+ - [ ] GET route that returns:
890
+ - [ ] Supported networks
891
+ - [ ] Supported payment schemes
892
+ - [ ] Min/max payment amounts
893
+ - [ ] Accepted tokens
894
+ - [ ] Facilitator details
895
+ - [ ] Used by frontend to:
896
+ - [ ] Display payment options
897
+ - [ ] Validate amounts
898
+ - [ ] Show available networks
899
+ - [ ] Response:
900
+ ```typescript
901
+ {
902
+ version: 1;
903
+ networks: BlockchainNetwork[];
904
+ schemes: PaymentScheme[];
905
+ tokens: Token[];
906
+ minAmount: string;
907
+ maxAmount: string;
908
+ facilitator: FacilitatorInfo;
909
+ }
910
+ ```
911
+
912
+ ### Infer 39: Add Error Handling Middleware
913
+
914
+ - [ ] Create `web/src/middleware/error-handler.ts`
915
+ - [ ] Handle X402-specific errors:
916
+ - [ ] 402: Payment Required
917
+ - [ ] 402 with error: Payment Invalid
918
+ - [ ] 503: Facilitator Down
919
+ - [ ] 500: Internal Server Error
920
+ - [ ] Error response format:
921
+ ```typescript
922
+ {
923
+ error: string;
924
+ code: string;
925
+ details: any;
926
+ x402Info?: PaymentRequired; // If 402
927
+ }
928
+ ```
929
+
930
+ ### Infer 40: Test All API Routes
931
+
932
+ - [ ] Write tests for each route:
933
+ - [ ] Test without payment (expect 402)
934
+ - [ ] Test with invalid payment (expect error)
935
+ - [ ] Test with valid payment (expect 200)
936
+ - [ ] Test payment history query
937
+ - [ ] Test config endpoint
938
+ - [ ] Test error scenarios:
939
+ - [ ] Malformed X-PAYMENT header
940
+ - [ ] Expired payment request
941
+ - [ ] Replay attack (same txHash twice)
942
+ - [ ] Insufficient amount
943
+ - [ ] Document test results
944
+
945
+ ---
946
+
947
+ ## PHASE 5: BLOCKCHAIN & PAYMENT MECHANICS (Infer 41-50)
948
+
949
+ **Purpose:** Implement blockchain payment processing
950
+
951
+ ### Infer 41: Implement Permit-Based Payment Flow
952
+
953
+ - [ ] Create `backend/convex/lib/permit-payment.ts`
954
+ - [ ] Implement permit generation:
955
+ ```typescript
956
+ export async function generatePermit(
957
+ token: string, // USDC address
958
+ owner: string, // User's wallet
959
+ spender: string, // Treasury contract
960
+ amount: string, // Amount in token units
961
+ deadline: number, // Unix timestamp
962
+ nonce: number, // Permit nonce
963
+ ): Promise<{
964
+ permit: PermitData;
965
+ signature: string;
966
+ }>;
967
+ ```
968
+ - [ ] Permit structure (ERC-2612):
969
+ - [ ] Token holder (owner) can authorize transfer
970
+ - [ ] Without separate approval transaction
971
+ - [ ] Signature proves authorization
972
+ - [ ] Spender executes transfer with permit
973
+ - [ ] Frontend flow:
974
+ 1. Show permit details to user
975
+ 2. User signs with wallet (MetaMask popup)
976
+ 3. Signature sent to backend
977
+ 4. Backend calls facilitator to execute transfer
978
+
979
+ ### Infer 42: Implement Transfer-Based Payment Flow
980
+
981
+ - [ ] Create `backend/convex/lib/transfer-payment.ts`
982
+ - [ ] For chains without permit support (Solana):
983
+ - [ ] User approves spender in separate tx
984
+ - [ ] User signs transfer in second tx
985
+ - [ ] Both txHashes submitted to backend
986
+ - [ ] Flow:
987
+ 1. Generate approval tx (user can preview)
988
+ 2. User submits + signs approval
989
+ 3. Wait for approval confirmation
990
+ 4. Generate transfer tx
991
+ 5. User submits + signs transfer
992
+ 6. Backend verifies both on-chain
993
+ - [ ] Handle edge cases:
994
+ - [ ] User cancels approval
995
+ - [ ] Approval expires (re-generate)
996
+ - [ ] Insufficient allowance (show error)
997
+
998
+ ### Infer 43: Integrate with Coinbase CDP Facilitator
999
+
1000
+ - [ ] Create `backend/convex/lib/coinbase-facilitator.ts`
1001
+ - [ ] Implement facilitator client:
1002
+ ```typescript
1003
+ export class CoinbaseFacilitator {
1004
+ async verifyPayment(payload: PaymentPayload): Promise<VerifyResponse>;
1005
+ async settlePayment(txHash: string): Promise<SettleResponse>;
1006
+ async getSupportedSchemes(): Promise<SupportedSchemesResponse>;
1007
+ }
1008
+ ```
1009
+ - [ ] API calls to Coinbase:
1010
+ - [ ] POST /verify - Check payment validity
1011
+ - [ ] POST /settle - Execute on-chain settlement
1012
+ - [ ] GET /supported - List supported schemes/networks
1013
+ - [ ] Authentication:
1014
+ - [ ] API key in env var
1015
+ - [ ] Include in Authorization header
1016
+ - [ ] Error handling:
1017
+ - [ ] Retry on 5xx errors
1018
+ - [ ] Propagate validation errors
1019
+ - [ ] Log all facilitator calls
1020
+
1021
+ ### Infer 44: Implement Gas Estimation
1022
+
1023
+ - [ ] Create `backend/convex/lib/gas-estimation.ts`
1024
+ - [ ] Estimate gas for:
1025
+ - [ ] Permit signature (no gas)
1026
+ - [ ] Transfer transaction (gas cost on Base ~$0.0001)
1027
+ - [ ] Settlement on Base (gas cost)
1028
+ - [ ] Functions:
1029
+ ```typescript
1030
+ async function estimateTransferGas(network: string): Promise<string>;
1031
+ async function estimateTxCost(network: string, gas: string): Promise<string>;
1032
+ ```
1033
+ - [ ] Show to user:
1034
+ - [ ] Gas cost in USD
1035
+ - [ ] Total cost = amount + gas
1036
+ - [ ] On Base: Gas typically negligible (~$0.0001)
1037
+
1038
+ ### Infer 45: Implement Transaction Verification
1039
+
1040
+ - [ ] Create `backend/convex/lib/tx-verification.ts`
1041
+ - [ ] Verify on-chain transaction:
1042
+ ```typescript
1043
+ async function verifyTransaction(
1044
+ txHash: string,
1045
+ network: string,
1046
+ expectedAmount: string,
1047
+ expectedRecipient: string,
1048
+ ): Promise<{
1049
+ valid: boolean;
1050
+ blockNumber: number;
1051
+ confirmations: number;
1052
+ error?: string;
1053
+ }>;
1054
+ ```
1055
+ - [ ] Checks:
1056
+ - [ ] Tx exists on-chain
1057
+ - [ ] Status = success
1058
+ - [ ] Amount >= required
1059
+ - [ ] Recipient = treasury address
1060
+ - [ ] Token = USDC
1061
+ - [ ] Enough confirmations (1 on Base)
1062
+ - [ ] Handle cases:
1063
+ - [ ] Tx pending (return confirmations = 0)
1064
+ - [ ] Tx failed (return error)
1065
+ - [ ] Wrong recipient (return error)
1066
+ - [ ] Insufficient amount (return error)
1067
+
1068
+ ### Infer 46: Implement Replay Protection
1069
+
1070
+ - [ ] Create `backend/convex/lib/replay-protection.ts`
1071
+ - [ ] Prevent using same payment twice:
1072
+ ```typescript
1073
+ async function checkReplayProtection(
1074
+ paymentPayload: PaymentPayload,
1075
+ ): Promise<boolean>;
1076
+ ```
1077
+ - [ ] Methods:
1078
+ - [ ] Check txHash not in used payments
1079
+ - [ ] Check nonce unique (if present)
1080
+ - [ ] Check timestamp recent (< 5 minutes)
1081
+ - [ ] Mark txHash as used after payment
1082
+ - [ ] Store used txHashes:
1083
+ - [ ] In Convex `payments` table (status = "settled")
1084
+ - [ ] Add index: by_txHash(txHash)
1085
+ - [ ] Query existing payments:
1086
+ ```typescript
1087
+ const existing = await db
1088
+ .query("entities")
1089
+ .withIndex("by_type", (q) => q.eq("type", "payment"))
1090
+ .filter((q) => q.eq(q.field("properties.txHash"), txHash))
1091
+ .first();
1092
+ ```
1093
+
1094
+ ### Infer 47: Implement Rate Limiting per User
1095
+
1096
+ - [ ] Create `backend/convex/lib/rate-limiter.ts`
1097
+ - [ ] Rate limit payment attempts:
1098
+ - [ ] Per user: 10 requests/minute (prevent spam)
1099
+ - [ ] Per endpoint: 100 payments/minute (per-resource)
1100
+ - [ ] Sliding window counter
1101
+ - [ ] Store rates in Convex or in-memory (fast)
1102
+ - [ ] Return 429 Too Many Requests if exceeded
1103
+ - [ ] Log rate limit violations
1104
+
1105
+ ### Infer 48: Implement Payment Reconciliation
1106
+
1107
+ - [ ] Create `backend/convex/services/payment-reconciliation.ts`
1108
+ - [ ] Scheduled job to:
1109
+ - [ ] Check pending payments (every minute)
1110
+ - [ ] Verify status with blockchain
1111
+ - [ ] Update payment status in DB
1112
+ - [ ] Log discrepancies
1113
+ - [ ] States:
1114
+ - [ ] payment_required: Awaiting user action
1115
+ - [ ] verified: User signed, awaiting settlement
1116
+ - [ ] settled: Confirmed on-chain
1117
+ - [ ] failed: Error, mark for cleanup
1118
+ - [ ] Reconciliation logic:
1119
+ ```typescript
1120
+ async function reconcilePendingPayments() {
1121
+ // Get all payments with status != "settled"
1122
+ // For each, check blockchain
1123
+ // Update status + log event
1124
+ }
1125
+ ```
1126
+
1127
+ ### Infer 49: Implement Refund Logic (Future)
1128
+
1129
+ - [ ] Create `backend/convex/lib/refund-handler.ts`
1130
+ - [ ] Handle refunds if:
1131
+ - [ ] Service fails after payment
1132
+ - [ ] User cancels within timeout
1133
+ - [ ] Overpayment (refund difference)
1134
+ - [ ] Refund flow:
1135
+ 1. Receive refund request
1136
+ 2. Verify eligibility
1137
+ 3. Call facilitator to issue refund
1138
+ 4. Update payment status to "refunded"
1139
+ 5. Log refund event
1140
+ - [ ] Note: Implement in Phase 2+ (not required for MVP)
1141
+
1142
+ ### Infer 50: Document Payment Architecture
1143
+
1144
+ - [ ] Write `one/connections/x402-architecture.md`
1145
+ - [ ] Document:
1146
+ - [ ] Payment flow diagram
1147
+ - [ ] Components + responsibilities
1148
+ - [ ] Data structures
1149
+ - [ ] Error scenarios + recovery
1150
+ - [ ] Security considerations
1151
+ - [ ] Performance characteristics
1152
+ - [ ] Add to `/one` documentation
1153
+
1154
+ ---
1155
+
1156
+ ## PHASE 6: QUALITY & TESTING (Infer 51-60)
1157
+
1158
+ **Purpose:** Test all payment flows end-to-end
1159
+
1160
+ ### Infer 51: Write Unit Tests for X402 Services
1161
+
1162
+ - [ ] Create `backend/convex/__tests__/x402-payment.test.ts`
1163
+ - [ ] Test X402PaymentService:
1164
+ - [ ] createPaymentRequest returns 402 structure
1165
+ - [ ] verifyPayment validates payload
1166
+ - [ ] getPaymentHistory returns user's payments
1167
+ - [ ] Test X402FacilitatorService:
1168
+ - [ ] verifyPayment calls Coinbase API
1169
+ - [ ] settlePayment executes transaction
1170
+ - [ ] Error handling + retries
1171
+ - [ ] Mock external calls:
1172
+ - [ ] Mock Convex database
1173
+ - [ ] Mock HTTP calls to facilitator
1174
+ - [ ] Mock blockchain calls
1175
+
1176
+ ### Infer 52: Write Integration Tests
1177
+
1178
+ - [ ] Create `backend/convex/__tests__/x402-integration.test.ts`
1179
+ - [ ] Test complete flow:
1180
+ 1. Create payment request (get 402)
1181
+ 2. Create payment payload (sign)
1182
+ 3. Verify payment (call facilitator)
1183
+ 4. Settle payment (on-chain)
1184
+ 5. Verify recorded in DB
1185
+ - [ ] Test error scenarios:
1186
+ - [ ] Invalid signature
1187
+ - [ ] Insufficient balance
1188
+ - [ ] Wrong recipient
1189
+ - [ ] Replay attack
1190
+ - [ ] Network timeout
1191
+
1192
+ ### Infer 53: Write Frontend Component Tests
1193
+
1194
+ - [ ] Create `web/src/components/__tests__/PaymentRequired.test.tsx`
1195
+ - [ ] Test PaymentRequired component:
1196
+ - [ ] Renders correctly
1197
+ - [ ] Shows network/scheme options
1198
+ - [ ] Handles wallet connection
1199
+ - [ ] Displays error messages
1200
+ - [ ] Callback on payment
1201
+ - [ ] Test WalletConnection component:
1202
+ - [ ] Connect button works
1203
+ - [ ] Wallet list shows
1204
+ - [ ] Balance displays
1205
+ - [ ] Network switching
1206
+ - [ ] Test PaymentProcessor:
1207
+ - [ ] Calls verify endpoint
1208
+ - [ ] Handles verification result
1209
+ - [ ] Retries on failure
1210
+ - [ ] Shows success message
1211
+
1212
+ ### Infer 54: Write E2E Tests
1213
+
1214
+ - [ ] Create `web/src/__tests__/x402-e2e.test.ts`
1215
+ - [ ] Test full user flow:
1216
+ 1. Visit protected endpoint
1217
+ 2. Get 402 response
1218
+ 3. Modal shows payment prompt
1219
+ 4. User connects wallet
1220
+ 5. User approves permit
1221
+ 6. Payment verified
1222
+ 7. Endpoint returns resource
1223
+ - [ ] Use test wallet (e.g., testnet USDC)
1224
+ - [ ] Verify in block explorer
1225
+ - [ ] Test retry flows
1226
+
1227
+ ### Infer 55: Write API Route Tests
1228
+
1229
+ - [ ] Create `web/src/pages/api/__tests__/agent-execute.test.ts`
1230
+ - [ ] Test agent execution endpoint:
1231
+ - [ ] Without payment → 402
1232
+ - [ ] With invalid payment → error
1233
+ - [ ] With valid payment → 200 + result
1234
+ - [ ] Test other routes similarly:
1235
+ - [ ] Provider call
1236
+ - [ ] Workflow trigger
1237
+ - [ ] Payment history
1238
+
1239
+ ### Infer 56: Create Test Fixtures
1240
+
1241
+ - [ ] Create `web/src/__fixtures__/x402-fixtures.ts`
1242
+ - [ ] Define test data:
1243
+ - [ ] Sample payment payloads
1244
+ - [ ] Sample facilitator responses
1245
+ - [ ] Sample blockchain transactions
1246
+ - [ ] Mock wallet addresses
1247
+ - [ ] Test amounts
1248
+ - [ ] Reuse across all tests
1249
+
1250
+ ### Infer 57: Test Error Scenarios
1251
+
1252
+ - [ ] Create `web/src/__tests__/x402-error-scenarios.test.ts`
1253
+ - [ ] Test error handling:
1254
+ - [ ] Facilitator down (503)
1255
+ - [ ] Invalid payment (402 with error)
1256
+ - [ ] Expired request
1257
+ - [ ] Malformed payload
1258
+ - [ ] Network timeout
1259
+ - [ ] Gas estimation error
1260
+ - [ ] Insufficient gas
1261
+ - [ ] Verify error messages are helpful
1262
+
1263
+ ### Infer 58: Test Security
1264
+
1265
+ - [ ] Create `web/src/__tests__/x402-security.test.ts`
1266
+ - [ ] Test security aspects:
1267
+ - [ ] Replay protection works
1268
+ - [ ] Signature verification
1269
+ - [ ] Recipient validation
1270
+ - [ ] Amount validation
1271
+ - [ ] Rate limiting
1272
+ - [ ] XSS protection (payment modal)
1273
+ - [ ] CSRF protection
1274
+
1275
+ ### Infer 59: Test Performance
1276
+
1277
+ - [ ] Create `web/src/__tests__/x402-performance.test.ts`
1278
+ - [ ] Measure:
1279
+ - [ ] Payment creation time (< 100ms)
1280
+ - [ ] Verification time (< 500ms)
1281
+ - [ ] Settlement time (< 2s on Base)
1282
+ - [ ] UI responsiveness during payment
1283
+ - [ ] Load test: 100 concurrent payments
1284
+ - [ ] Document results in metrics file
1285
+
1286
+ ### Infer 60: Final Test Coverage Report
1287
+
1288
+ - [ ] Run full test suite: `bun test`
1289
+ - [ ] Generate coverage report
1290
+ - [ ] Target: 80%+ coverage
1291
+ - [ ] Document:
1292
+ - [ ] Test count
1293
+ - [ ] Coverage %
1294
+ - [ ] Known gaps
1295
+ - [ ] Performance metrics
1296
+ - [ ] Save to: `one/events/x402-test-report.md`
1297
+
1298
+ ---
1299
+
1300
+ ## PHASE 7: DESIGN & WIREFRAMES (Infer 61-70)
1301
+
1302
+ **Purpose:** Finalize UI/UX design for payment flow
1303
+
1304
+ ### Infer 61: Design Payment Prompt Modal
1305
+
1306
+ - [ ] Create wireframe: PaymentPromptModal
1307
+ - [ ] Layout:
1308
+ - [ ] Title: "Payment Required"
1309
+ - [ ] Amount display (USD + tokens)
1310
+ - [ ] Network selector dropdown
1311
+ - [ ] Scheme selector (Permit, Transfer)
1312
+ - [ ] "Connect Wallet" button
1313
+ - [ ] "Cancel" button
1314
+ - [ ] States:
1315
+ - [ ] Initial (awaiting wallet connect)
1316
+ - [ ] Connected (show address + balance)
1317
+ - [ ] Signing (show "Please sign in wallet")
1318
+ - [ ] Processing (show spinner)
1319
+ - [ ] Success (show checkmark + close)
1320
+ - [ ] Error (show error message + retry)
1321
+
1322
+ ### Infer 62: Design Payment History Page
1323
+
1324
+ - [ ] Create wireframe: PaymentHistory
1325
+ - [ ] Components:
1326
+ - [ ] Header: "Payment History"
1327
+ - [ ] Filter bar (status, network, date)
1328
+ - [ ] Table with columns:
1329
+ - [ ] Date/time
1330
+ - [ ] Resource (API endpoint)
1331
+ - [ ] Amount
1332
+ - [ ] Network badge
1333
+ - [ ] Status badge
1334
+ - [ ] Tx hash (clickable)
1335
+ - [ ] Pagination controls
1336
+ - [ ] Empty state (no payments)
1337
+ - [ ] Error state (failed to load)
1338
+
1339
+ ### Infer 63: Design Balance Display
1340
+
1341
+ - [ ] Create wireframe: BalanceDisplay
1342
+ - [ ] Card layout:
1343
+ - [ ] Title: "Wallet Balance"
1344
+ - [ ] Network badge (Base, Ethereum)
1345
+ - [ ] Large balance display ($X.XX)
1346
+ - [ ] Token display (Y USDC)
1347
+ - [ ] Refresh button
1348
+ - [ ] Low balance warning (if < $0.05)
1349
+ - [ ] "Add Funds" link (future)
1350
+
1351
+ ### Infer 64: Design Agent Execution Flow
1352
+
1353
+ - [ ] Create wireframe: AgentExecutionFlow
1354
+ - [ ] States:
1355
+ - [ ] Initial: Agent selection + parameters
1356
+ - [ ] Submitted: Show spinner "Executing..."
1357
+ - [ ] Payment required: Show PaymentPromptModal
1358
+ - [ ] Retrying: Show spinner "Retrying execution..."
1359
+ - [ ] Success: Show agent result
1360
+ - [ ] Error: Show error message + retry button
1361
+ - [ ] Include payment info in result:
1362
+ - [ ] Payment ID
1363
+ - [ ] Tx hash
1364
+ - [ ] Network used
1365
+ - [ ] Cost in USD
1366
+
1367
+ ### Infer 65: Design X402 Demo Page
1368
+
1369
+ - [ ] Create wireframe: DemoPage (/demo/x402-payments)
1370
+ - [ ] Sections:
1371
+ - [ ] Hero: "Try X402 Payments"
1372
+ - [ ] How it works (3-step animation)
1373
+ - [ ] Live demo (test payment)
1374
+ - [ ] Pricing comparison (X402 vs traditional)
1375
+ - [ ] FAQ section
1376
+ - [ ] CTA: "Integrate X402"
1377
+ - [ ] Interactive elements:
1378
+ - [ ] Animated flow chart
1379
+ - [ ] Live payment example
1380
+ - [ ] Code snippets (copy-able)
1381
+
1382
+ ### Infer 66: Create Design Tokens for X402
1383
+
1384
+ - [ ] Update `web/src/styles/x402-tokens.css`:
1385
+
1386
+ ```css
1387
+ :root {
1388
+ --x402-primary: hsl(180, 82%, 50%); /* X402 blue */
1389
+ --x402-success: hsl(120, 100%, 50%); /* Payment success */
1390
+ --x402-warning: hsl(45, 100%, 50%); /* Awaiting user */
1391
+ --x402-error: hsl(0, 100%, 50%); /* Payment failed */
1392
+ --x402-pending: hsl(45, 100%, 50%); /* Processing */
1393
+
1394
+ --blockchain-base: hsl(220, 90%, 50%); /* Base blue */
1395
+ --blockchain-ethereum: hsl(250, 60%, 50%); /* Ethereum purple */
1396
+ --blockchain-solana: hsl(280, 80%, 50%); /* Solana pink */
1397
+
1398
+ --x402-border-radius: 12px;
1399
+ --x402-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
1400
+ }
1401
+ ```
1402
+
1403
+ ### Infer 67: Ensure Accessibility (WCAG 2.1 AA)
1404
+
1405
+ - [ ] Update components for accessibility:
1406
+ - [ ] PaymentPromptModal: Add aria-modal, role, keyboard nav
1407
+ - [ ] WalletConnection: Add labels, focus states
1408
+ - [ ] PaymentProcessor: Add aria-live for status updates
1409
+ - [ ] PaymentHistory: Add table headers, sort buttons
1410
+ - [ ] BalanceDisplay: Add aria-label for amount
1411
+ - [ ] Test with:
1412
+ - [ ] Screen reader (NVDA, JAWS)
1413
+ - [ ] Keyboard navigation (Tab, Enter, Escape)
1414
+ - [ ] Color contrast (ratio 4.5:1 minimum)
1415
+ - [ ] Focus indicators (visible)
1416
+
1417
+ ### Infer 68: Test Mobile Responsiveness
1418
+
1419
+ - [ ] Test PaymentPromptModal on:
1420
+ - [ ] iPhone 12 (390px)
1421
+ - [ ] iPad (768px)
1422
+ - [ ] Android phone (360px)
1423
+ - [ ] Issues to fix:
1424
+ - [ ] Modal overflow
1425
+ - [ ] Button sizes (tap targets 48px+)
1426
+ - [ ] Text readability
1427
+ - [ ] Wallet connect dropdown
1428
+ - [ ] Test touch interactions:
1429
+ - [ ] Network selector (dropdown)
1430
+ - [ ] Scheme selector (radio buttons)
1431
+ - [ ] Buttons (click area)
1432
+
1433
+ ### Infer 69: Design Dark Mode Styles
1434
+
1435
+ - [ ] Update CSS for dark mode:
1436
+ ```css
1437
+ @media (prefers-color-scheme: dark) {
1438
+ --x402-bg: hsl(220, 13%, 13%);
1439
+ --x402-text: hsl(0, 0%, 100%);
1440
+ --x402-border: hsl(220, 13%, 23%);
1441
+ --x402-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
1442
+ }
1443
+ ```
1444
+ - [ ] Test all components in dark mode
1445
+ - [ ] Verify contrast ratios still valid
1446
+
1447
+ ### Infer 70: Create Component Library Documentation
1448
+
1449
+ - [ ] Document all X402 components:
1450
+ - [ ] PaymentPromptModal
1451
+ - [ ] WalletConnection
1452
+ - [ ] PaymentProcessor
1453
+ - [ ] PaymentHistory
1454
+ - [ ] BalanceDisplay
1455
+ - [ ] AgentExecutionFlow
1456
+ - [ ] For each: Props, states, usage examples
1457
+ - [ ] Add Storybook stories (future):
1458
+ - [ ] Story for each state
1459
+ - [ ] Interactive playground
1460
+ - [ ] Component docs
1461
+
1462
+ ---
1463
+
1464
+ ## PHASE 8: PERFORMANCE & OPTIMIZATION (Infer 71-80)
1465
+
1466
+ **Purpose:** Optimize payment flow for speed + efficiency
1467
+
1468
+ ### Infer 71: Optimize Frontend Bundle Size
1469
+
1470
+ - [ ] Audit bundle:
1471
+ - [ ] Run `bun run build` with analysis
1472
+ - [ ] Identify large dependencies (wagmi, viem)
1473
+ - [ ] Tree-shake unused code
1474
+ - [ ] Optimize:
1475
+ - [ ] Code-split payment components (lazy load)
1476
+ - [ ] Minimize Redux/state duplicates
1477
+ - [ ] Remove unused shadcn/ui components
1478
+ - [ ] Target: Payment modal < 50KB gzipped
1479
+
1480
+ ### Infer 72: Implement Payment Caching
1481
+
1482
+ - [ ] Cache frequently accessed data:
1483
+ - [ ] X402 config (supported networks, amounts)
1484
+ - [ ] User payment history (first 50 records)
1485
+ - [ ] Facilitator status
1486
+ - [ ] Cache strategy:
1487
+ - [ ] Config: 1 hour (update on page load)
1488
+ - [ ] History: 5 minutes (refresh on new payment)
1489
+ - [ ] Facilitator: 5 minutes (health check)
1490
+ - [ ] Use Convex caching + browser localStorage
1491
+
1492
+ ### Infer 73: Implement Pagination for Payment History
1493
+
1494
+ - [ ] Load payments in batches:
1495
+ - [ ] Initial load: 20 most recent
1496
+ - [ ] On scroll: Load next 20
1497
+ - [ ] User can jump to page
1498
+ - [ ] Database query optimization:
1499
+ - [ ] Index: by_timestamp(createdAt)
1500
+ - [ ] Limit + offset in query
1501
+ - [ ] Count total for pagination info
1502
+
1503
+ ### Infer 74: Optimize Blockchain RPC Calls
1504
+
1505
+ - [ ] Batch RPC requests:
1506
+ - [ ] Use eth_call for read-only operations
1507
+ - [ ] Batch multiple calls in single JSON-RPC batch
1508
+ - [ ] Cache results (gas prices, contract state)
1509
+ - [ ] Reduce RPC calls:
1510
+ - [ ] Cache token balances (poll every 10 seconds)
1511
+ - [ ] Cache gas prices (poll every 30 seconds)
1512
+ - [ ] Cache supported schemes (poll on demand)
1513
+ - [ ] Monitor RPC usage:
1514
+ - [ ] Track calls per second
1515
+ - [ ] Alert if quota exceeded
1516
+
1517
+ ### Infer 75: Implement Permit Caching
1518
+
1519
+ - [ ] Cache permit data to avoid re-generating:
1520
+ - [ ] Store permit in localStorage + Convex
1521
+ - [ ] Reuse for 5 minutes (before expiry)
1522
+ - [ ] User can view previous permits
1523
+ - [ ] Cache structure:
1524
+ ```typescript
1525
+ {
1526
+ paymentId: string;
1527
+ permit: PermitData;
1528
+ signature: string;
1529
+ expiresAt: number;
1530
+ usedAt?: number;
1531
+ }
1532
+ ```
1533
+
1534
+ ### Infer 76: Implement Progressive Enhancement
1535
+
1536
+ - [ ] Website works without JavaScript (server-rendered):
1537
+ - [ ] Show payment form with standard HTML
1538
+ - [ ] POST to API endpoint
1539
+ - [ ] Server returns 402 with HTML form
1540
+ - [ ] User can submit (without client-side validation)
1541
+ - [ ] With JavaScript: Enhanced UX
1542
+ - [ ] Client-side validation
1543
+ - [ ] Real-time feedback
1544
+ - [ ] Wallet integration
1545
+ - [ ] Goal: Graceful degradation
1546
+
1547
+ ### Infer 77: Monitor Payment Latency
1548
+
1549
+ - [ ] Add performance metrics:
1550
+ - [ ] Payment creation time
1551
+ - [ ] Verification time
1552
+ - [ ] Settlement time
1553
+ - [ ] UI render time
1554
+ - [ ] Track in Convex events:
1555
+ ```typescript
1556
+ {
1557
+ type: 'payment_event',
1558
+ metadata: {
1559
+ status: 'settled',
1560
+ createdAt: 1234567890,
1561
+ verifiedAt: 1234567900,
1562
+ settledAt: 1234567910,
1563
+ creationMs: 10,
1564
+ verificationMs: 10,
1565
+ settlementMs: 10,
1566
+ }
1567
+ }
1568
+ ```
1569
+ - [ ] Alert if > expected time
1570
+
1571
+ ### Infer 78: Implement Connection Pooling
1572
+
1573
+ - [ ] Reuse blockchain client connections:
1574
+ - [ ] Create single viem client per network
1575
+ - [ ] Share across multiple requests
1576
+ - [ ] Avoid creating new clients per request
1577
+ - [ ] Connection pooling strategy:
1578
+ - [ ] Singleton pattern for viem clients
1579
+ - [ ] Base client created on startup
1580
+ - [ ] Reuse for all requests
1581
+
1582
+ ### Infer 79: Optimize Payment Settlement
1583
+
1584
+ - [ ] Parallelize settlement tasks:
1585
+ - [ ] Verify payment on blockchain (parallel)
1586
+ - [ ] Update DB (parallel)
1587
+ - [ ] Log event (parallel)
1588
+ - [ ] Notify user (parallel)
1589
+ - [ ] Use Convex's scheduler for batch operations
1590
+ - [ ] Goal: Settlement < 2 seconds on Base
1591
+
1592
+ ### Infer 80: Performance Baseline & Regression Testing
1593
+
1594
+ - [ ] Establish baseline metrics:
1595
+ - [ ] Payment creation: 50-100ms
1596
+ - [ ] Verification: 300-500ms
1597
+ - [ ] Settlement: 1-2s (blockchain dependent)
1598
+ - [ ] UI responsiveness: 60 FPS
1599
+ - [ ] CI/CD integration:
1600
+ - [ ] Run performance tests on every PR
1601
+ - [ ] Fail if regression > 10%
1602
+ - [ ] Report metrics in PR
1603
+ - [ ] Document in: `one/events/x402-performance.md`
1604
+
1605
+ ---
1606
+
1607
+ ## PHASE 9: DEPLOYMENT & DOCUMENTATION (Infer 81-90)
1608
+
1609
+ **Purpose:** Deploy to production, document for users + developers
1610
+
1611
+ ### Infer 81: Set Up Production Environment Variables
1612
+
1613
+ - [ ] Update `.env` (root) with production values:
1614
+ - [ ] VITE_BLOCKCHAIN_RPC_BASE (Coinbase mainnet RPC)
1615
+ - [ ] VITE_BLOCKCHAIN_RPC_ETHEREUM (if needed)
1616
+ - [ ] X402_PAYMENT_ADDRESS_BASE (production treasury)
1617
+ - [ ] FACILITATOR_URL (production Coinbase endpoint)
1618
+ - [ ] FACILITATOR_API_KEY (production API key)
1619
+ - [ ] Secure env vars:
1620
+ - [ ] Use Cloudflare secrets (not .env.local)
1621
+ - [ ] Rotate API keys quarterly
1622
+ - [ ] Audit access logs monthly
1623
+ - [ ] Document in: `DEPLOYMENT.md`
1624
+
1625
+ ### Infer 82: Deploy Backend to Convex
1626
+
1627
+ - [ ] Ensure all backend changes committed:
1628
+ - [ ] `backend/convex/schema.ts` updated
1629
+ - [ ] `backend/convex/protocols/x402.ts` created
1630
+ - [ ] `backend/convex/services/x402-*.ts` created
1631
+ - [ ] `backend/convex/mutations/payments.ts` created
1632
+ - [ ] `backend/convex/queries/payments.ts` created
1633
+ - [ ] Run deployment checks:
1634
+ - [ ] `npx convex dev` (local test)
1635
+ - [ ] TypeScript check passes
1636
+ - [ ] No schema breaking changes
1637
+ - [ ] Deploy: `npx convex deploy`
1638
+ - [ ] Verify in Convex dashboard
1639
+
1640
+ ### Infer 83: Build + Deploy Frontend to Cloudflare
1641
+
1642
+ - [ ] Build frontend:
1643
+ - [ ] `cd web && bun run build`
1644
+ - [ ] Type check: `bunx astro check`
1645
+ - [ ] Verify dist/ created
1646
+ - [ ] Deploy to Cloudflare Pages:
1647
+ - [ ] `wrangler pages deploy dist --project-name=web`
1648
+ - [ ] Verify deployment URL: https://web.one.ie
1649
+ - [ ] Test in browser (smoke test)
1650
+ - [ ] Monitor for errors:
1651
+ - [ ] Check DevTools console
1652
+ - [ ] Monitor Cloudflare logs
1653
+
1654
+ ### Infer 84: Verify Production Endpoints
1655
+
1656
+ - [ ] Test in production:
1657
+ - [ ] GET /api/agent/execute (without payment) → 402
1658
+ - [ ] POST /api/agent/execute (with payment) → 200
1659
+ - [ ] GET /api/payments/history → user's payments
1660
+ - [ ] GET /api/x402/config → config object
1661
+ - [ ] Verify payment flows:
1662
+ - [ ] Create payment request
1663
+ - [ ] Verify payment
1664
+ - [ ] Settle payment
1665
+ - [ ] Check Convex logs
1666
+ - [ ] Monitor for issues:
1667
+ - [ ] Error rates
1668
+ - [ ] Slow requests
1669
+ - [ ] Failed payments
1670
+
1671
+ ### Infer 85: Create User Documentation
1672
+
1673
+ - [ ] Write `web/public/docs/x402-user-guide.md`:
1674
+ - [ ] How to connect wallet
1675
+ - [ ] How to approve payments
1676
+ - [ ] How to view payment history
1677
+ - [ ] Supported networks
1678
+ - [ ] Minimum/maximum amounts
1679
+ - [ ] Troubleshooting section
1680
+ - [ ] FAQ
1681
+ - [ ] Include screenshots:
1682
+ - [ ] Payment prompt
1683
+ - [ ] Wallet connection
1684
+ - [ ] Payment confirmation
1685
+ - [ ] Payment history
1686
+
1687
+ ### Infer 86: Create Developer Documentation
1688
+
1689
+ - [ ] Write `one/connections/x402-developer-guide.md`:
1690
+ - [ ] X402 protocol overview
1691
+ - [ ] How to protect endpoints with X402
1692
+ - [ ] How to handle 402 responses
1693
+ - [ ] Integration examples:
1694
+ - [ ] cURL
1695
+ - [ ] JavaScript/fetch
1696
+ - [ ] Python
1697
+ - [ ] Go
1698
+ - [ ] Error codes + meanings
1699
+ - [ ] Rate limiting info
1700
+ - [ ] Security best practices
1701
+ - [ ] Code examples:
1702
+
1703
+ ```bash
1704
+ # Request protected resource
1705
+ curl https://one.ie/api/agent/execute
1706
+ # → 402 Payment Required (with PaymentRequired body)
1707
+
1708
+ # Make payment + retry
1709
+ curl -H "X-PAYMENT: {...}" https://one.ie/api/agent/execute
1710
+ # → 200 OK (with X-PAYMENT-ID header)
1711
+ ```
1712
+
1713
+ ### Infer 87: Create Integration Guide for Partners
1714
+
1715
+ - [ ] Write `one/connections/x402-integration-guide.md`:
1716
+ - [ ] High-level overview
1717
+ - [ ] When to use X402
1718
+ - [ ] How to onboard:
1719
+ 1. Set payment requirements on endpoints
1720
+ 2. Choose amount + description
1721
+ 3. Choose networks
1722
+ 4. Configure payout address
1723
+ - [ ] How to test:
1724
+ 1. Use testnet (if available)
1725
+ 2. Test 402 responses
1726
+ 3. Test payment flows
1727
+ - [ ] How to monitor:
1728
+ - [ ] Payment history
1729
+ - [ ] Error rates
1730
+ - [ ] Settlement times
1731
+ - [ ] Support + troubleshooting
1732
+
1733
+ ### Infer 88: Write Architecture Decision Record (ADR)
1734
+
1735
+ - [ ] Create `one/events/adr-x402-integration.md`:
1736
+ - [ ] Context: Why X402?
1737
+ - [ ] Decision: Use X402 for micropayments
1738
+ - [ ] Consequences:
1739
+ - [ ] Positive: No payment infrastructure needed
1740
+ - [ ] Positive: Instant settlement
1741
+ - [ ] Positive: Blockchain transparent
1742
+ - [ ] Negative: Requires user wallet
1743
+ - [ ] Negative: Blockchain dependent
1744
+ - [ ] Alternatives considered:
1745
+ - [ ] Stripe/PayPal
1746
+ - [ ] Custom payment solution
1747
+ - [ ] Status: APPROVED/IN PROGRESS
1748
+
1749
+ ### Infer 89: Create Monitoring + Alerting
1750
+
1751
+ - [ ] Set up monitoring for:
1752
+ - [ ] Payment success rate (target 99%+)
1753
+ - [ ] Settlement time (target < 2s)
1754
+ - [ ] Facilitator availability (target 99.9%)
1755
+ - [ ] Blockchain RPC uptime (target 99.99%)
1756
+ - [ ] Alerting rules:
1757
+ - [ ] Payment success rate < 95% → alert
1758
+ - [ ] Settlement time > 5s → alert
1759
+ - [ ] Facilitator down → alert
1760
+ - [ ] RPC down → alert
1761
+ - [ ] Dashboard:
1762
+ - [ ] Real-time metrics
1763
+ - [ ] Payment volume
1764
+ - [ ] Revenue tracked
1765
+ - [ ] Error rate by type
1766
+
1767
+ ### Infer 90: Plan Maintenance + Updates
1768
+
1769
+ - [ ] Document maintenance schedule:
1770
+ - [ ] Monthly: Security updates
1771
+ - [ ] Quarterly: Dependency updates
1772
+ - [ ] Annually: Major version upgrades
1773
+ - [ ] Runbooks:
1774
+ - [ ] How to handle facilitator outage
1775
+ - [ ] How to handle blockchain outage
1776
+ - [ ] How to handle security incident
1777
+ - [ ] How to rollback deployment
1778
+ - [ ] Store in: `one/events/x402-maintenance.md`
1779
+
1780
+ ---
1781
+
1782
+ ## PHASE 10: KNOWLEDGE & LESSONS LEARNED (Infer 91-100)
1783
+
1784
+ **Purpose:** Document learnings, capture institutional knowledge
1785
+
1786
+ ### Infer 91: Document Ontology Mapping
1787
+
1788
+ - [ ] Write `one/knowledge/x402-ontology-mapping.md`:
1789
+ - [ ] **Groups:** Merchant group, customer group, platform
1790
+ - [ ] **People:** Platform owner, merchant, customer
1791
+ - [ ] **Things:** payment, external_agent, product
1792
+ - [ ] **Connections:** transacted, communicated, delegated
1793
+ - [ ] **Events:** payment_event (with protocol: x402)
1794
+ - [ ] **Knowledge:** payment_method, x402_scheme labels
1795
+ - [ ] Use 6-dimension framework throughout
1796
+ - [ ] Show examples of real data structures
1797
+
1798
+ ### Infer 92: Create Payment Flow State Diagram
1799
+
1800
+ - [ ] Create `one/events/x402-state-diagram.md` with diagram:
1801
+ ```
1802
+ [ initial ] --request_payment--> [ payment_required ]
1803
+ ^ |
1804
+ | user_initiates_payment
1805
+ | ↓
1806
+ +--- [verify_failed] <-- [ payment_signing ]
1807
+ | |
1808
+ | user_signs_permit
1809
+ | ↓
1810
+ +--- [verify_success] <-- [ verification ]
1811
+ |
1812
+ facilitator_confirms
1813
+ ↓
1814
+ [ settled ]
1815
+ ```
1816
+ - [ ] Document transitions:
1817
+ - [ ] Timeout: 5 minutes in any state
1818
+ - [ ] Retry: User can retry on failure
1819
+ - [ ] Settlement: Happens automatically after verification
1820
+
1821
+ ### Infer 93: Document Security Considerations
1822
+
1823
+ - [ ] Write `one/connections/x402-security.md`:
1824
+ - [ ] **Signature Verification:** User signature proves authorization
1825
+ - [ ] **Replay Protection:** Each txHash used only once
1826
+ - [ ] **Amount Validation:** Check >= required
1827
+ - [ ] **Recipient Validation:** Check = treasury address
1828
+ - [ ] **Expiry:** Payment request valid 5 minutes
1829
+ - [ ] **Rate Limiting:** 10 requests/min per user
1830
+ - [ ] **Facilitator Verification:** Trust Coinbase CDP
1831
+ - [ ] **Blockchain Finality:** Verify 1+ confirmations on Base
1832
+ - [ ] Known risks:
1833
+ - [ ] User sends to wrong address (no recovery)
1834
+ - [ ] Private key compromised (wallet issue, not ours)
1835
+ - [ ] Blockchain reorg (very unlikely on Base)
1836
+ - [ ] Facilitator breach (trust issue)
1837
+
1838
+ ### Infer 94: Document Blockchain Specifics
1839
+
1840
+ - [ ] Write `one/connections/x402-blockchain.md`:
1841
+ - [ ] **Base Network:**
1842
+ - [ ] Chain ID: 8453
1843
+ - [ ] Block time: ~2 seconds
1844
+ - [ ] Finality: 1 block (~2 seconds)
1845
+ - [ ] USDC address: 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
1846
+ - [ ] Average cost per transaction: $0.0001
1847
+ - [ ] **Permit Support:**
1848
+ - [ ] ERC-2612 standard
1849
+ - [ ] No separate approval needed
1850
+ - [ ] Deadline: must be > current block timestamp
1851
+ - [ ] Nonce: auto-incrementing for each permit
1852
+ - [ ] **Token Contracts:**
1853
+ - [ ] USDC decimals: 6
1854
+ - [ ] Balance queries: eth_call (read-only)
1855
+ - [ ] Transfer: state-changing transaction
1856
+
1857
+ ### Infer 95: Capture Performance Benchmarks
1858
+
1859
+ - [ ] Write `one/events/x402-performance-benchmarks.md`:
1860
+ - [ ] **Payment Creation:** 50-100ms
1861
+ - [ ] **Permit Generation:** 30-50ms
1862
+ - [ ] **User Signature:** 2-5s (user-dependent)
1863
+ - [ ] **Facilitator Verification:** 200-300ms
1864
+ - [ ] **Blockchain Settlement:** 1-2s (on Base)
1865
+ - [ ] **Total E2E Time:** 4-8s
1866
+ - [ ] **UI Responsiveness:** 60 FPS (payment modal)
1867
+ - [ ] **Bundle Size:** 45KB gzipped (payment module)
1868
+ - [ ] **Cache Hit Rate:** 85%+ for config/history
1869
+ - [ ] Comparison to alternatives:
1870
+ - [ ] Stripe: 1-3s (no blockchain wait)
1871
+ - [ ] PayPal: 2-5s (no blockchain wait)
1872
+ - [ ] X402: 4-8s (includes blockchain settlement)
1873
+
1874
+ ### Infer 96: Document Common Issues + Solutions
1875
+
1876
+ - [ ] Write `one/connections/x402-troubleshooting.md`:
1877
+ - [ ] **Issue: Payment times out**
1878
+ - [ ] Cause: Facilitator slow or down
1879
+ - [ ] Solution: Retry after 5 minutes
1880
+ - [ ] **Issue: "Insufficient Balance"**
1881
+ - [ ] Cause: User balance < payment amount
1882
+ - [ ] Solution: Show user balance, suggest adding funds
1883
+ - [ ] **Issue: "Wrong Recipient"**
1884
+ - [ ] Cause: Payment sent to wrong address
1885
+ - [ ] Solution: Show treasury address before signing
1886
+ - [ ] **Issue: "Permit Signature Invalid"**
1887
+ - [ ] Cause: User canceled signing
1888
+ - [ ] Solution: Show error, let user retry
1889
+ - [ ] **Issue: "Network Mismatch"**
1890
+ - [ ] Cause: User on wrong blockchain
1891
+ - [ ] Solution: Auto-switch or show dialog
1892
+ - [ ] **Issue: "Replay Protection Triggered"**
1893
+ - [ ] Cause: User tried same payment twice
1894
+ - [ ] Solution: Create new payment request
1895
+
1896
+ ### Infer 97: Create Cost Analysis Report
1897
+
1898
+ - [ ] Write `one/events/x402-cost-analysis.md`:
1899
+ - [ ] **Blockchain Costs:**
1900
+ - [ ] Base: $0.0001 per payment
1901
+ - [ ] Ethereum: $1-5 per payment (high)
1902
+ - [ ] Solana: $0.00001 per payment (future)
1903
+ - [ ] **Facilitator Costs:**
1904
+ - [ ] Coinbase CDP: Free (for now)
1905
+ - [ ] **Infrastructure Costs:**
1906
+ - [ ] Convex: Included in platform costs
1907
+ - [ ] Cloudflare: Included in platform costs
1908
+ - [ ] RPC Provider: $100-500/month (if own node)
1909
+ - [ ] **Revenue Potential:**
1910
+ - [ ] If 1000 payments/day at $0.01 = $10/day
1911
+ - [ ] At 80% markup = $2/day profit
1912
+ - [ ] Annualized: $730/year at current volume
1913
+ - [ ] **Break-even Analysis:**
1914
+ - [ ] Need 10+ payments/day to offset costs
1915
+
1916
+ ### Infer 98: Plan Future Enhancements
1917
+
1918
+ - [ ] Document Phase 2+ features in `one/things/todo-x402-phase2.md`:
1919
+ - [ ] [ ] Bazar marketplace discovery layer
1920
+ - [ ] [ ] Multi-chain support (Ethereum, Solana, Polygon)
1921
+ - [ ] [ ] Invoice payment scheme
1922
+ - [ ] [ ] Signature-based payments
1923
+ - [ ] [ ] Refund mechanism
1924
+ - [ ] [ ] Revenue distribution to merchants
1925
+ - [ ] [ ] Subscription-based payments
1926
+ - [ ] [ ] Conditional payments (if/then logic)
1927
+ - [ ] [ ] Payment analytics dashboard
1928
+ - [ ] [ ] Webhook notifications on payment
1929
+ - [ ] [ ] Custom facilitator support
1930
+ - [ ] [ ] Stablecoin alternatives (USDT, DAI)
1931
+ - [ ] Prioritize by impact + effort
1932
+
1933
+ ### Infer 99: Create Lessons Learned Document
1934
+
1935
+ - [ ] Write `one/events/x402-lessons-learned.md`:
1936
+ - [ ] **What went well:**
1937
+ - [ ] Coinbase CDP integration smooth
1938
+ - [ ] Permit-based payments have great UX
1939
+ - [ ] Base network perfect for micropayments
1940
+ - [ ] **What was challenging:**
1941
+ - [ ] Wallet integration complexity
1942
+ - [ ] Blockchain async operations
1943
+ - [ ] Testing with real wallets
1944
+ - [ ] **What we'd do differently:**
1945
+ - [ ] Start with testnet longer
1946
+ - [ ] Build more test utilities earlier
1947
+ - [ ] Design payment history upfront
1948
+ - [ ] **Skills gained:**
1949
+ - [ ] ERC-2612 permits
1950
+ - [ ] Facilitator patterns
1951
+ - [ ] Blockchain integration testing
1952
+ - [ ] **Team feedback:**
1953
+ - [ ] Quotes from team members
1954
+ - [ ] What they learned
1955
+
1956
+ ### Infer 100: Final Summary + Celebration
1957
+
1958
+ - [ ] Create `one/events/x402-phase1-complete.md`:
1959
+ - [ ] **Project Status:** ✅ COMPLETE
1960
+ - [ ] **Timeline:** Infer 1-100 (100 inferences)
1961
+ - [ ] **Delivered:**
1962
+ - [ ] [x] HTTP 402 protocol implementation
1963
+ - [ ] [x] X402PaymentService (Effect.ts)
1964
+ - [ ] [x] Blockchain integration (Base)
1965
+ - [ ] [x] Frontend components (React)
1966
+ - [ ] [x] Astro API routes (protected)
1967
+ - [ ] [x] Payment history tracking
1968
+ - [ ] [x] Full E2E testing
1969
+ - [ ] [x] Production deployment
1970
+ - [ ] [x] Complete documentation
1971
+ - [ ] **Next Steps:**
1972
+ - [ ] Monitor production metrics
1973
+ - [ ] Gather user feedback
1974
+ - [ ] Plan Phase 2 features
1975
+ - [ ] **Thank you message:**
1976
+ - [ ] Credit to team
1977
+ - [ ] Thanks to Coinbase for CDP
1978
+ - [ ] Thanks to users for feedback
1979
+ - [ ] 🎉 **X402 Phase 1 Complete!**
1980
+
1981
+ ---
1982
+
1983
+ ## SUCCESS CRITERIA
1984
+
1985
+ X402 integration is complete when:
1986
+
1987
+ - ✅ HTTP 402 responses sent from Astro API routes
1988
+ - ✅ X-PAYMENT header validation working end-to-end
1989
+ - ✅ Blockchain payment verification via Coinbase facilitator
1990
+ - ✅ Payment events logged in Convex events table
1991
+ - ✅ Payment history queryable + filterable
1992
+ - ✅ Frontend components (React) render correctly
1993
+ - ✅ UI shows payment prompt + wallet connection
1994
+ - ✅ Demo: Request → 402 → payment → access
1995
+ - ✅ 3+ protected endpoints (agent, provider, workflow)
1996
+ - ✅ All tests passing (80%+ coverage)
1997
+ - ✅ Performance baselines established
1998
+ - ✅ Production deployment verified
1999
+ - ✅ Documentation complete (user + developer)
2000
+ - ✅ Architecture documented in ontology
2001
+ - ✅ Lessons learned captured
2002
+
2003
+ ---
2004
+
2005
+ ## QUICK REFERENCE
2006
+
2007
+ **Files Created:**
2008
+
2009
+ - `backend/convex/protocols/x402.ts` - Type definitions
2010
+ - `backend/convex/services/x402-payment.ts` - Payment service
2011
+ - `backend/convex/services/x402-facilitator.ts` - Facilitator service
2012
+ - `backend/convex/services/blockchain-provider.ts` - Blockchain client
2013
+ - `backend/convex/config/x402-config.ts` - Configuration
2014
+ - `backend/convex/mutations/payments.ts` - Convex mutations
2015
+ - `backend/convex/queries/payments.ts` - Convex queries
2016
+ - `web/src/components/features/PaymentRequired.tsx` - Component
2017
+ - `web/src/components/features/WalletConnection.tsx` - Component
2018
+ - `web/src/components/features/PaymentProcessor.tsx` - Component
2019
+ - `web/src/pages/api/agent/execute.ts` - API route
2020
+ - `web/src/pages/api/provider/[providerId]/call.ts` - API route
2021
+ - `web/src/pages/api/payments/verify.ts` - API route
2022
+ - `web/src/pages/demo/x402-payments.astro` - Demo page
2023
+ - `one/connections/x402-architecture.md` - Architecture docs
2024
+ - `one/connections/x402-developer-guide.md` - Developer docs
2025
+ - `one/connections/x402-security.md` - Security docs
2026
+
2027
+ **Environment Variables Required:**
2028
+
2029
+ - `VITE_BLOCKCHAIN_RPC_BASE` - Base network RPC URL
2030
+ - `X402_PAYMENT_ADDRESS_BASE` - Treasury address
2031
+ - `FACILITATOR_URL` - Coinbase CDP endpoint
2032
+ - `FACILITATOR_API_KEY` - API key (if needed)
2033
+
2034
+ **Tests to Write:**
2035
+
2036
+ - Unit tests (payment services)
2037
+ - Integration tests (E2E payment flow)
2038
+ - Component tests (React components)
2039
+ - API route tests (Astro endpoints)
2040
+ - Security tests (replay, validation)
2041
+ - Performance tests (benchmarks)
2042
+
2043
+ ---
2044
+
2045
+ **Remember:** Plan in inferences, not days. Where in the sequence does each thing belong?
2046
+
2047
+ **Status:** Ready for execution. Begin with Infer 1-10 (Foundation).