oneie 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (406) hide show
  1. package/AGENTS.md +245 -0
  2. package/CLAUDE.md +534 -0
  3. package/README.md +61 -4
  4. package/one/.obsidian/app.json +1 -0
  5. package/one/.obsidian/appearance.json +1 -0
  6. package/one/.obsidian/core-plugins.json +33 -0
  7. package/one/.obsidian/workspace.json +211 -0
  8. package/one/connections/a2a.md +551 -0
  9. package/one/connections/acp.md +761 -0
  10. package/one/connections/acps.md +731 -0
  11. package/one/connections/agui.md +767 -0
  12. package/one/connections/any-backend.md +1702 -0
  13. package/one/connections/ap2.md +998 -0
  14. package/one/connections/api-docs.md +1891 -0
  15. package/one/connections/api.md +2190 -0
  16. package/one/connections/architecture-diagram.md +94 -0
  17. package/one/connections/communications.md +449 -0
  18. package/one/connections/connections.md +339 -0
  19. package/one/connections/cryptonetworks.md +781 -0
  20. package/one/connections/documentation.md +1120 -0
  21. package/one/connections/effect.md +279 -0
  22. package/one/connections/elizaos.md +1290 -0
  23. package/one/connections/inference.md +58 -0
  24. package/one/connections/kyc.md +632 -0
  25. package/one/connections/mcp.md +842 -0
  26. package/one/connections/membership.md +1152 -0
  27. package/one/connections/middleware.md +1067 -0
  28. package/one/connections/multitenant.md +1341 -0
  29. package/one/connections/n8n.md +1015 -0
  30. package/one/connections/patterns.md +89 -0
  31. package/one/connections/protocols.md +279 -0
  32. package/one/connections/relationships.md +107 -0
  33. package/one/connections/schema.md +587 -0
  34. package/one/connections/service-layer.md +550 -0
  35. package/one/connections/structure.md +0 -0
  36. package/one/connections/vectors.md +207 -0
  37. package/one/connections/wordpress.md +1302 -0
  38. package/one/connections/workflow-copy.md +905 -0
  39. package/one/connections/workflow-examples.md +741 -0
  40. package/one/connections/workflow.md +905 -0
  41. package/one/connections/workflows/delegation.md +885 -0
  42. package/one/connections/workflows/frontend.md +1037 -0
  43. package/one/connections/workflows/strategy.md +903 -0
  44. package/one/connections/workflows/tasks.md +698 -0
  45. package/one/connections/x402.md +1249 -0
  46. package/one/events/events.md +545 -0
  47. package/one/knowledge/ai-platform.md +305 -0
  48. package/one/knowledge/architecture-diagram.md +94 -0
  49. package/one/knowledge/architecture-frontend.md +930 -0
  50. package/one/knowledge/architecture.md +2077 -0
  51. package/one/knowledge/crypto.md +960 -0
  52. package/one/knowledge/dsl.md +1660 -0
  53. package/one/knowledge/files.md +2471 -0
  54. package/one/knowledge/frontend.md +1038 -0
  55. package/one/knowledge/hono.md +2109 -0
  56. package/one/knowledge/implementation-examples.md +2536 -0
  57. package/one/knowledge/inference-score.md +159 -0
  58. package/one/knowledge/knowledge.md +642 -0
  59. package/one/knowledge/language.md +980 -0
  60. package/one/knowledge/lessons-learned.md +70 -0
  61. package/one/knowledge/ontology-6-dimensions.md +0 -0
  62. package/one/knowledge/ontology-documentation.md +356 -0
  63. package/one/knowledge/ontology-engineering-specification.md +1292 -0
  64. package/one/knowledge/ontology-engineering.md +1652 -0
  65. package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
  66. package/one/knowledge/ontology-frontend-copy.md +753 -0
  67. package/one/knowledge/ontology-frontend-specifications.md +2188 -0
  68. package/one/knowledge/ontology-frontend.md +2427 -0
  69. package/one/knowledge/ontology-minimal.yaml +299 -0
  70. package/one/knowledge/ontology.md +2819 -0
  71. package/one/knowledge/ontology.yaml +1165 -0
  72. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
  73. package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
  74. package/one/knowledge/patterns/backend/mutation-template.md +231 -0
  75. package/one/knowledge/patterns/backend/query-template.md +267 -0
  76. package/one/knowledge/patterns/backend/service-template.md +237 -0
  77. package/one/knowledge/patterns/design/component-architecture.md +399 -0
  78. package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
  79. package/one/knowledge/patterns/design/wireframe-template.md +216 -0
  80. package/one/knowledge/patterns/frontend/component-template.md +195 -0
  81. package/one/knowledge/patterns/frontend/form-template.md +276 -0
  82. package/one/knowledge/patterns/frontend/page-template.md +178 -0
  83. package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
  84. package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
  85. package/one/knowledge/patterns/test/technical-test-template.md +544 -0
  86. package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
  87. package/one/knowledge/patterns/test/user-flow-template.md +254 -0
  88. package/one/knowledge/quality-loop.md +401 -0
  89. package/one/knowledge/readme.md +131 -0
  90. package/one/knowledge/rules.md +626 -0
  91. package/one/knowledge/score.md +67 -0
  92. package/one/knowledge/specifications.md +855 -0
  93. package/one/knowledge/tags.md +130 -0
  94. package/one/organisation/one.md +599 -0
  95. package/one/organisation/organisation.md +438 -0
  96. package/one/organisation/revenue.md +673 -0
  97. package/one/organisation/strategy.md +869 -0
  98. package/one/organisation/vision.md +98 -0
  99. package/one/people/anthony-o-connell.md +440 -0
  100. package/one/people/people.md +567 -0
  101. package/one/repomix-output.md +92634 -0
  102. package/one/things/agentkit.md +349 -0
  103. package/one/things/agents/agent-backend.md +1401 -0
  104. package/one/things/agents/agent-builder.md +955 -0
  105. package/one/things/agents/agent-clean.md +709 -0
  106. package/one/things/agents/agent-clone.md +1341 -0
  107. package/one/things/agents/agent-designer.md +2177 -0
  108. package/one/things/agents/agent-director.md +1508 -0
  109. package/one/things/agents/agent-documenter.md +1049 -0
  110. package/one/things/agents/agent-frontend.md +1119 -0
  111. package/one/things/agents/agent-integrator.md +1192 -0
  112. package/one/things/agents/agent-problem-solver.md +1379 -0
  113. package/one/things/agents/agent-quality.md +1353 -0
  114. package/one/things/agents/agent-sales.md +986 -0
  115. package/one/things/cascade/cascade.yaml +464 -0
  116. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
  117. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
  118. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
  119. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
  120. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
  121. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
  122. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
  123. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
  124. package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
  125. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
  126. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
  127. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
  128. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
  129. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
  130. package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
  131. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
  132. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
  133. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
  134. package/one/things/cascade/docs/examples/readme.md +222 -0
  135. package/one/things/cascade/docs/getting-started.md +515 -0
  136. package/one/things/cascade/docs/workflow.md +1372 -0
  137. package/one/things/cascade/readme.md +336 -0
  138. package/one/things/cascade/templates/feature-template.md +267 -0
  139. package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
  140. package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
  141. package/one/things/claude/agents/analyst.md +483 -0
  142. package/one/things/claude/agents/architect.md +480 -0
  143. package/one/things/claude/agents/brand-identity-specialist.md +513 -0
  144. package/one/things/claude/agents/bstp-token-strategist.md +667 -0
  145. package/one/things/claude/agents/builder-repo.md +489 -0
  146. package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
  147. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
  148. package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
  149. package/one/things/claude/agents/company-bullstamp-character.md +587 -0
  150. package/one/things/claude/agents/company-bullstamp-community.md +292 -0
  151. package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
  152. package/one/things/claude/agents/company-bullstamp-token.md +292 -0
  153. package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
  154. package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
  155. package/one/things/claude/agents/content-calendar-planner.md +448 -0
  156. package/one/things/claude/agents/content-chapter-formatter.md +488 -0
  157. package/one/things/claude/agents/content-formatter.md +546 -0
  158. package/one/things/claude/agents/content-hook-specialist.md +462 -0
  159. package/one/things/claude/agents/content-image-formatter.md +535 -0
  160. package/one/things/claude/agents/content-introduction-formatter.md +485 -0
  161. package/one/things/claude/agents/content-multiplication-engine.md +556 -0
  162. package/one/things/claude/agents/content-playbook-writer.md +448 -0
  163. package/one/things/claude/agents/content-team-manager.md +622 -0
  164. package/one/things/claude/agents/content-toc-formatter.md +522 -0
  165. package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
  166. package/one/things/claude/agents/core-manager.md +582 -0
  167. package/one/things/claude/agents/core-master.md +403 -0
  168. package/one/things/claude/agents/cross-functional-manager.md +471 -0
  169. package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
  170. package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
  171. package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
  172. package/one/things/claude/agents/crypto-community-analyst.md +298 -0
  173. package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
  174. package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
  175. package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
  176. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
  177. package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
  178. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
  179. package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
  180. package/one/things/claude/agents/crypto-market-researcher.md +292 -0
  181. package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
  182. package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
  183. package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
  184. package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
  185. package/one/things/claude/agents/crypto-team-manager.md +387 -0
  186. package/one/things/claude/agents/crypto-token-analyst.md +278 -0
  187. package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
  188. package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
  189. package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
  190. package/one/things/claude/agents/customer-journey-designer.md +481 -0
  191. package/one/things/claude/agents/customer-success-manager.md +581 -0
  192. package/one/things/claude/agents/dev.md +413 -0
  193. package/one/things/claude/agents/documenter.md +546 -0
  194. package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
  195. package/one/things/claude/agents/engagement-specialist.md +509 -0
  196. package/one/things/claude/agents/engineering-architect.md +387 -0
  197. package/one/things/claude/agents/engineering-business-analyst.md +537 -0
  198. package/one/things/claude/agents/engineering-developer.md +387 -0
  199. package/one/things/claude/agents/engineering-director.md +282 -0
  200. package/one/things/claude/agents/engineering-ingestor.md +649 -0
  201. package/one/things/claude/agents/engineering-product-manager.md +537 -0
  202. package/one/things/claude/agents/engineering-product-owner.md +537 -0
  203. package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
  204. package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
  205. package/one/things/claude/agents/engineering-team-manager.md +512 -0
  206. package/one/things/claude/agents/engineering-user-experience.md +387 -0
  207. package/one/things/claude/agents/framework-elevate-manager.md +294 -0
  208. package/one/things/claude/agents/improver.md +763 -0
  209. package/one/things/claude/agents/intelligence-team-manager.md +385 -0
  210. package/one/things/claude/agents/lead-capture-expert.md +466 -0
  211. package/one/things/claude/agents/lead-magnet-creator.md +453 -0
  212. package/one/things/claude/agents/market-research-analyst.md +412 -0
  213. package/one/things/claude/agents/marketing-brand-identity.md +314 -0
  214. package/one/things/claude/agents/marketing-content-hooks.md +450 -0
  215. package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
  216. package/one/things/claude/agents/marketing-content-poster.md +361 -0
  217. package/one/things/claude/agents/marketing-customer-journey.md +326 -0
  218. package/one/things/claude/agents/marketing-director.md +397 -0
  219. package/one/things/claude/agents/marketing-engagement.md +326 -0
  220. package/one/things/claude/agents/marketing-lead-capture.md +326 -0
  221. package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
  222. package/one/things/claude/agents/marketing-network-effects.md +326 -0
  223. package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
  224. package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
  225. package/one/things/claude/agents/marketing-team-manager.md +446 -0
  226. package/one/things/claude/agents/marketing-viral-growth.md +201 -0
  227. package/one/things/claude/agents/mission-commander.md +373 -0
  228. package/one/things/claude/agents/network-effect-analyst.md +587 -0
  229. package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
  230. package/one/things/claude/agents/npx.md +890 -0
  231. package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
  232. package/one/things/claude/agents/one-master.md +355 -0
  233. package/one/things/claude/agents/one-orchestrator.md +315 -0
  234. package/one/things/claude/agents/one.md +601 -0
  235. package/one/things/claude/agents/playbook-generator.md +503 -0
  236. package/one/things/claude/agents/pm.md +326 -0
  237. package/one/things/claude/agents/po.md +345 -0
  238. package/one/things/claude/agents/qa.md +336 -0
  239. package/one/things/claude/agents/research-foundation-analyst.md +307 -0
  240. package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
  241. package/one/things/claude/agents/research-market-analyst.md +307 -0
  242. package/one/things/claude/agents/research-team-manager.md +482 -0
  243. package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
  244. package/one/things/claude/agents/sales-team-manager.md +400 -0
  245. package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
  246. package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
  247. package/one/things/claude/agents/service-advocacy-manager.md +307 -0
  248. package/one/things/claude/agents/service-success-manager.md +307 -0
  249. package/one/things/claude/agents/service-team-manager.md +400 -0
  250. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
  251. package/one/things/claude/agents/share-optimization-specialist.md +551 -0
  252. package/one/things/claude/agents/sm.md +327 -0
  253. package/one/things/claude/agents/story-teller.md +473 -0
  254. package/one/things/claude/agents/task-master.md +596 -0
  255. package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
  256. package/one/things/claude/agents/tester.md +556 -0
  257. package/one/things/claude/agents/the-bull-character-manager.md +580 -0
  258. package/one/things/claude/agents/tools-playbook-generator.md +489 -0
  259. package/one/things/claude/agents/turbo-repo-builder.md +316 -0
  260. package/one/things/claude/agents/upsell-strategist.md +480 -0
  261. package/one/things/claude/agents/ux-expert.md +335 -0
  262. package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
  263. package/one/things/claude/claude-code-hooks-development.json +21 -0
  264. package/one/things/claude/claude-code-hooks-production.json +21 -0
  265. package/one/things/claude/claude-code-hooks.json +25 -0
  266. package/one/things/claude/commands/agent.md +104 -0
  267. package/one/things/claude/commands/cascade-status.md +128 -0
  268. package/one/things/claude/commands/ingest.md +290 -0
  269. package/one/things/claude/commands/ingestor.md +136 -0
  270. package/one/things/claude/commands/mission.md +83 -0
  271. package/one/things/claude/commands/npx.md +133 -0
  272. package/one/things/claude/commands/one.md +440 -0
  273. package/one/things/claude/commands/quality-check.md +204 -0
  274. package/one/things/claude/commands/smart-route.md +220 -0
  275. package/one/things/claude/commands/start.md +121 -0
  276. package/one/things/claude/commands/story.md +83 -0
  277. package/one/things/claude/commands/task.md +173 -0
  278. package/one/things/claude/hook-bypass.json +32 -0
  279. package/one/things/claude/hooks/agent-hook-config.json +427 -0
  280. package/one/things/claude/hooks/agent-hook-manager.js +525 -0
  281. package/one/things/claude/hooks/agent-load-balancer.js +271 -0
  282. package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
  283. package/one/things/claude/hooks/build-hook.sh +156 -0
  284. package/one/things/claude/hooks/cascade-feedback.js +297 -0
  285. package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
  286. package/one/things/claude/hooks/cleanup-hook.sh +201 -0
  287. package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
  288. package/one/things/claude/hooks/file-organization-engine.js +427 -0
  289. package/one/things/claude/hooks/file-organization-hook.sh +80 -0
  290. package/one/things/claude/hooks/file-organization-monitor.js +269 -0
  291. package/one/things/claude/hooks/format-hook.sh +43 -0
  292. package/one/things/claude/hooks/hook-bypass.sh +293 -0
  293. package/one/things/claude/hooks/hook-config-manager.js +202 -0
  294. package/one/things/claude/hooks/hook-debouncer.sh +62 -0
  295. package/one/things/claude/hooks/hook-logger.sh +89 -0
  296. package/one/things/claude/hooks/hook-orchestrator.js +662 -0
  297. package/one/things/claude/hooks/hook-performance-report.js +120 -0
  298. package/one/things/claude/hooks/lint-hook.sh +140 -0
  299. package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
  300. package/one/things/claude/hooks/memory-optimizer.js +510 -0
  301. package/one/things/claude/hooks/notification-hook.sh +204 -0
  302. package/one/things/claude/hooks/ontology-compliance.js +394 -0
  303. package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
  304. package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
  305. package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
  306. package/one/things/claude/hooks/performance-metrics.json +25 -0
  307. package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
  308. package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
  309. package/one/things/claude/hooks/security-hook.sh +256 -0
  310. package/one/things/claude/hooks/simple-load-balancer.js +238 -0
  311. package/one/things/claude/hooks/startup-optimizer.js +625 -0
  312. package/one/things/claude/hooks/story-scoring-system.js +445 -0
  313. package/one/things/claude/hooks/story-validation-engine.js +473 -0
  314. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
  315. package/one/things/claude/hooks/story-validation-hook.sh +145 -0
  316. package/one/things/claude/hooks/structure-synchronizer.js +194 -0
  317. package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
  318. package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
  319. package/one/things/claude/hooks/test-hook.sh +145 -0
  320. package/one/things/claude/hooks/test-story-validation.sh +170 -0
  321. package/one/things/claude/hooks/trinity-validation-system.js +392 -0
  322. package/one/things/claude/settings-local.json +86 -0
  323. package/one/things/cli-code.md +652 -0
  324. package/one/things/cli-compiler-code.md +652 -0
  325. package/one/things/cli.md +1045 -0
  326. package/one/things/components/card-shadcn.md +929 -0
  327. package/one/things/components/card.md +1050 -0
  328. package/one/things/components.md +1669 -0
  329. package/one/things/componets.md +4 -0
  330. package/one/things/copilotkit.md +1559 -0
  331. package/one/things/creator-diagram.md +166 -0
  332. package/one/things/examples/children/lemonade-stand.md +366 -0
  333. package/one/things/examples/enterprise/crm-saas.md +1429 -0
  334. package/one/things/features/1-1-agent-prompts/design.md +470 -0
  335. package/one/things/features/1-1-agent-prompts/tests.md +264 -0
  336. package/one/things/features/1-1-agent-prompts.md +486 -0
  337. package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
  338. package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
  339. package/one/things/features/1-2-yaml-orchestrator.md +516 -0
  340. package/one/things/features/1-3-event-coordination/design.md +544 -0
  341. package/one/things/features/1-3-event-coordination/tests.md +223 -0
  342. package/one/things/features/1-3-event-coordination.md +508 -0
  343. package/one/things/features/1-4-knowledge-management/design.md +609 -0
  344. package/one/things/features/1-4-knowledge-management/tests.md +195 -0
  345. package/one/things/features/1-4-knowledge-management.md +577 -0
  346. package/one/things/features/1-5-quality-loops/design.md +797 -0
  347. package/one/things/features/1-5-quality-loops/tests.md +212 -0
  348. package/one/things/features/1-5-quality-loops.md +641 -0
  349. package/one/things/features/1-6-numbering-structure/design.md +610 -0
  350. package/one/things/features/1-6-numbering-structure/tests.md +213 -0
  351. package/one/things/features/1-6-numbering-structure.md +575 -0
  352. package/one/things/features/2-cli.md +1235 -0
  353. package/one/things/features/use-one-backend.md +1180 -0
  354. package/one/things/ideas/1-create-workflow.md +189 -0
  355. package/one/things/plans/1-create-workflow-status.md +555 -0
  356. package/one/things/plans/1-create-workflow.md +713 -0
  357. package/one/things/plans/app.md +761 -0
  358. package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
  359. package/one/things/plans/better-auth-any-backend.md +1852 -0
  360. package/one/things/plans/better-auth-available-features.md +235 -0
  361. package/one/things/plans/big-plan.md +38 -0
  362. package/one/things/plans/convex-better-auth.md +1109 -0
  363. package/one/things/plans/convex-on-off.md +389 -0
  364. package/one/things/plans/desktop.md +1121 -0
  365. package/one/things/plans/effect-components.md +1669 -0
  366. package/one/things/plans/effect.md +973 -0
  367. package/one/things/plans/email.md +953 -0
  368. package/one/things/plans/enhance-auth.md +1669 -0
  369. package/one/things/plans/install-components.md +198 -0
  370. package/one/things/plans/landing.md +728 -0
  371. package/one/things/plans/layout.md +205 -0
  372. package/one/things/plans/mail-backend.md +1308 -0
  373. package/one/things/plans/mail.md +2624 -0
  374. package/one/things/plans/next-features.md +83 -0
  375. package/one/things/plans/one.md +658 -0
  376. package/one/things/plans/ontology-6-dimensions.md +2216 -0
  377. package/one/things/plans/ontology-driven-strategy.md +866 -0
  378. package/one/things/plans/ontology-ui-approach.md +357 -0
  379. package/one/things/plans/open-agent.md +785 -0
  380. package/one/things/plans/performace.md +90 -0
  381. package/one/things/plans/releases.md +809 -0
  382. package/one/things/plans/repos.md +76 -0
  383. package/one/things/plans/separate-copy-2.md +1293 -0
  384. package/one/things/plans/separate-copy-3.md +2458 -0
  385. package/one/things/plans/separate-copy.md +1293 -0
  386. package/one/things/plans/separate.md +1983 -0
  387. package/one/things/plans/shadcn-integration-summary.md +450 -0
  388. package/one/things/plans/sidebar.md +172 -0
  389. package/one/things/plans/small-fixes.md +5 -0
  390. package/one/things/plans/test-backend-connection.md +476 -0
  391. package/one/things/plans/workflow-files.md +1196 -0
  392. package/one/things/plans/workflow.md +1372 -0
  393. package/one/things/products/cascade-landing-page.md +737 -0
  394. package/one/things/products/cascade.md +1518 -0
  395. package/one/things/products/context-engineering.md +1427 -0
  396. package/one/things/products/onthology.md +0 -0
  397. package/one/things/products/ontology-ui-shadcn.md +1280 -0
  398. package/one/things/products/ontology-ui.md +1387 -0
  399. package/one/things/products/ontology.md +717 -0
  400. package/one/things/products/sdk.md +557 -0
  401. package/one/things/promptkit.md +903 -0
  402. package/one/things/service-providers-new.md +982 -0
  403. package/one/things/service-providers.md +1092 -0
  404. package/one/things/things.md +349 -0
  405. package/one/things/todo.md +1248 -0
  406. package/package.json +5 -2
@@ -0,0 +1,473 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Story Validation Engine - R.O.C.K.E.T. Framework Implementation
5
+ * Implements 10-step validation process for story files
6
+ */
7
+
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+
11
+ // Configuration
12
+ const CONFIG = {
13
+ CRITICAL_PENALTY: 3,
14
+ SHOULD_FIX_PENALTY: 1.5,
15
+ NICE_TO_HAVE_PENALTY: 0.5,
16
+ COMPLETENESS_BONUS: 1,
17
+ ANTI_HALLUCINATION_BONUS: 1,
18
+ BASE_SCORE: 10
19
+ };
20
+
21
+ // Required story template sections
22
+ const REQUIRED_SECTIONS = [
23
+ 'Status',
24
+ 'Story',
25
+ 'Acceptance Criteria',
26
+ 'Tasks / Subtasks',
27
+ 'Dev Notes',
28
+ 'Change Log',
29
+ 'Dev Agent Record'
30
+ ];
31
+
32
+ class StoryValidationEngine {
33
+ constructor(filePath, isSubAgent = false) {
34
+ this.filePath = filePath;
35
+ this.content = '';
36
+ this.isSubAgent = isSubAgent;
37
+ this.issues = {
38
+ critical: [],
39
+ shouldFix: [],
40
+ niceToHave: []
41
+ };
42
+ this.score = CONFIG.BASE_SCORE;
43
+ this.cache = new Map(); // Performance: Cache regex results
44
+ this.sectionCache = new Map(); // Performance: Cache extracted sections
45
+ this.subAgentInfo = null; // Store detected sub-agent information
46
+ }
47
+
48
+ async validate() {
49
+ try {
50
+ // Load and parse story file
51
+ await this.loadStoryFile();
52
+
53
+ // Execute 10-step validation process
54
+ this.step1_loadCoreConfiguration();
55
+ this.step2_templateCompletenessValidation();
56
+ this.step3_fileStructureValidation();
57
+ this.step4_uiFrontendValidation();
58
+ this.step5_acceptanceCriteriaAssessment();
59
+ this.step6_validationTestingInstructions();
60
+ this.step7_securityConsiderations();
61
+ this.step8_tasksSubtasksSequence();
62
+ this.step9_antiHallucinationVerification();
63
+ this.step10_generateReport();
64
+
65
+ return this.generateOutput();
66
+ } catch (error) {
67
+ return this.generateErrorOutput(error);
68
+ }
69
+ }
70
+
71
+ async loadStoryFile() {
72
+ // Security: Validate file path
73
+ if (!this.filePath || typeof this.filePath !== 'string') {
74
+ throw new Error('Invalid file path provided');
75
+ }
76
+
77
+ // Security: Prevent path traversal (allow stories and test directories)
78
+ const resolvedPath = path.resolve(this.filePath);
79
+ const allowedPaths = ['/stories/', '/test', 'stories/', 'test/'];
80
+ const isAllowed = allowedPaths.some(allowedPath => resolvedPath.includes(allowedPath));
81
+
82
+ if (!isAllowed) {
83
+ throw new Error(`File path not in allowed directory: ${resolvedPath}`);
84
+ }
85
+
86
+ if (!fs.existsSync(this.filePath)) {
87
+ throw new Error(`Story file not found: ${this.filePath}`);
88
+ }
89
+
90
+ // Security: Check file size (prevent DoS via large files)
91
+ const stats = fs.statSync(this.filePath);
92
+ if (stats.size > 10 * 1024 * 1024) { // 10MB limit
93
+ throw new Error('Story file too large (max 10MB)');
94
+ }
95
+
96
+ this.content = fs.readFileSync(this.filePath, 'utf8');
97
+
98
+ if (!this.content.trim()) {
99
+ throw new Error('Story file is empty');
100
+ }
101
+
102
+ // Detect if content was generated by a sub-agent
103
+ this.detectSubAgentGeneration();
104
+
105
+ // Security: Validate content encoding (allow for multi-byte UTF-8 characters)
106
+ try {
107
+ const buffer = Buffer.from(this.content, 'utf8');
108
+ const reconstructed = buffer.toString('utf8');
109
+ if (reconstructed !== this.content) {
110
+ throw new Error('Invalid file encoding - must be UTF-8');
111
+ }
112
+ } catch (error) {
113
+ throw new Error('Invalid file encoding - must be UTF-8');
114
+ }
115
+ }
116
+
117
+ detectSubAgentGeneration() {
118
+ // Check for sub-agent indicators in content
119
+ const subAgentPatterns = [
120
+ /Agent Model Used.*Claude/i,
121
+ /🤖 Generated with \[Claude Code\]/i,
122
+ /Sub-agent:/i,
123
+ /Co-Authored-By: Claude/i,
124
+ /Generated by.*agent/i
125
+ ];
126
+
127
+ for (const pattern of subAgentPatterns) {
128
+ const match = this.content.match(pattern);
129
+ if (match) {
130
+ this.isSubAgent = true;
131
+ this.subAgentInfo = {
132
+ detected: true,
133
+ indicator: match[0],
134
+ pattern: pattern.toString()
135
+ };
136
+ break;
137
+ }
138
+ }
139
+
140
+ // Extract specific agent information if available
141
+ if (this.isSubAgent) {
142
+ const agentModelMatch = this.content.match(/Agent Model Used:\s*(.+)/i);
143
+ const agentNameMatch = this.content.match(/Agent:\s*(.+)/i);
144
+
145
+ if (agentModelMatch || agentNameMatch) {
146
+ this.subAgentInfo.model = agentModelMatch ? agentModelMatch[1].trim() : null;
147
+ this.subAgentInfo.name = agentNameMatch ? agentNameMatch[1].trim() : null;
148
+ }
149
+ }
150
+ }
151
+
152
+ step1_loadCoreConfiguration() {
153
+ // Check if story follows user story format - more flexible regex
154
+ const userStoryPattern = /\*\*As a\*\*.*\*\*I want\*\*.*\*\*so that\*\*/is;
155
+ if (!userStoryPattern.test(this.content)) {
156
+ this.issues.critical.push('Story does not follow required user story format (As a... I want... so that...)');
157
+ }
158
+ }
159
+
160
+ step2_templateCompletenessValidation() {
161
+ const missingSections = [];
162
+
163
+ REQUIRED_SECTIONS.forEach(section => {
164
+ const sectionPattern = new RegExp(`^##\\s+${section}`, 'm');
165
+ if (!sectionPattern.test(this.content)) {
166
+ missingSections.push(section);
167
+ }
168
+ });
169
+
170
+ if (missingSections.length > 0) {
171
+ this.issues.critical.push(`Missing required sections: ${missingSections.join(', ')}`);
172
+ } else {
173
+ this.score += CONFIG.COMPLETENESS_BONUS;
174
+ }
175
+
176
+ // Check for unfilled template variables
177
+ const templateVars = this.content.match(/\{\{[^}]+\}\}/g);
178
+ if (templateVars && templateVars.length > 0) {
179
+ this.issues.shouldFix.push(`Unfilled template variables found: ${templateVars.join(', ')}`);
180
+ }
181
+ }
182
+
183
+ step3_fileStructureValidation() {
184
+ // Check if story references valid file paths
185
+ const fileReferences = this.content.match(/[\/\w\-\.]+\.(js|ts|md|json|yaml|sh)/g);
186
+ if (fileReferences) {
187
+ // Filter out relative paths and focus on absolute paths that should exist
188
+ const criticalFiles = fileReferences.filter(filePath =>
189
+ filePath.startsWith('/') &&
190
+ !filePath.startsWith('/Users/') &&
191
+ !filePath.includes('example') &&
192
+ !filePath.includes('template')
193
+ );
194
+
195
+ const invalidFiles = criticalFiles.filter(filePath => {
196
+ try {
197
+ const fullPath = path.resolve(filePath);
198
+ return !fs.existsSync(fullPath);
199
+ } catch (error) {
200
+ return true; // Invalid path format
201
+ }
202
+ });
203
+
204
+ if (invalidFiles.length > 0) {
205
+ this.issues.shouldFix.push(`Referenced critical files not found: ${invalidFiles.join(', ')}`);
206
+ }
207
+ }
208
+ }
209
+
210
+ step4_uiFrontendValidation() {
211
+ // Check for UI/frontend considerations if applicable
212
+ const uiKeywords = ['interface', 'component', 'frontend', 'UI', 'user interface'];
213
+ const hasUIContent = uiKeywords.some(keyword =>
214
+ this.content.toLowerCase().includes(keyword.toLowerCase())
215
+ );
216
+
217
+ if (hasUIContent) {
218
+ const hasUISpec = /user interface|UI design|component spec/i.test(this.content);
219
+ if (!hasUISpec) {
220
+ this.issues.niceToHave.push('Story mentions UI elements but lacks detailed interface specifications');
221
+ }
222
+ }
223
+ }
224
+
225
+ step5_acceptanceCriteriaAssessment() {
226
+ const acSection = this.extractSection('Acceptance Criteria');
227
+ if (!acSection) {
228
+ this.issues.critical.push('Acceptance Criteria section is missing or empty');
229
+ return;
230
+ }
231
+
232
+ // Check for testable criteria
233
+ const criteria = acSection.split('\n').filter(line => line.trim().match(/^\d+\./));
234
+ if (criteria.length === 0) {
235
+ this.issues.critical.push('No numbered acceptance criteria found');
236
+ }
237
+
238
+ // Check for vague criteria
239
+ const vaguePatterns = ['implement', 'create', 'build', 'make'];
240
+ const vagueCriteria = criteria.filter(criterion =>
241
+ vaguePatterns.some(pattern => criterion.toLowerCase().includes(pattern))
242
+ );
243
+
244
+ if (vagueCriteria.length > 0) {
245
+ this.issues.shouldFix.push('Some acceptance criteria are vague and may not be testable');
246
+ }
247
+ }
248
+
249
+ step6_validationTestingInstructions() {
250
+ const hasTestingSection = /testing|test|validation/i.test(this.content);
251
+ if (!hasTestingSection) {
252
+ this.issues.shouldFix.push('Missing testing strategy or validation instructions');
253
+ }
254
+ }
255
+
256
+ step7_securityConsiderations() {
257
+ const securityKeywords = ['security', 'authentication', 'authorization', 'validation', 'sanitization'];
258
+ const hasSecurityContent = securityKeywords.some(keyword =>
259
+ this.content.toLowerCase().includes(keyword.toLowerCase())
260
+ );
261
+
262
+ if (hasSecurityContent) {
263
+ const hasSecuritySpec = /security consideration|auth|validation|sanitization/i.test(this.content);
264
+ if (!hasSecuritySpec) {
265
+ this.issues.shouldFix.push('Story mentions security elements but lacks detailed security specifications');
266
+ }
267
+ }
268
+ }
269
+
270
+ step8_tasksSubtasksSequence() {
271
+ const tasksSection = this.extractSection('Tasks / Subtasks');
272
+ if (!tasksSection) {
273
+ this.issues.critical.push('Tasks/Subtasks section is missing');
274
+ return;
275
+ }
276
+
277
+ // Check for task structure
278
+ const tasks = tasksSection.match(/- \[ \]/g);
279
+ if (!tasks || tasks.length === 0) {
280
+ this.issues.shouldFix.push('No checkboxed tasks found in Tasks/Subtasks section');
281
+ }
282
+
283
+ // Check for circular dependencies
284
+ const taskLines = tasksSection.split('\n').filter(line => line.includes('[ ]'));
285
+ const hasDependencies = taskLines.some(line => line.includes('depends on') || line.includes('requires'));
286
+ if (hasDependencies) {
287
+ this.issues.niceToHave.push('Consider reviewing task dependencies for potential circular references');
288
+ }
289
+ }
290
+
291
+ step9_antiHallucinationVerification() {
292
+ let hallucinationIssues = 0;
293
+ const verificationResults = [];
294
+
295
+ // Sub-agent content gets different validation rules
296
+ const claimPatterns = this.isSubAgent ? [
297
+ // More lenient patterns for sub-agent generated content
298
+ {pattern: /\d+%\s+(improvement|increase|reduction)/i, severity: 'high'},
299
+ {pattern: /\b(proven|demonstrated|verified)\b/i, severity: 'moderate'}
300
+ ] : [
301
+ // Standard patterns for human-generated content
302
+ {pattern: /\b(complete|completed|operational|working|tested)\b/i, severity: 'moderate'},
303
+ {pattern: /\d+%\s+(improvement|increase|reduction)/i, severity: 'high'},
304
+ {pattern: /\b(proven|demonstrated|verified)\b/i, severity: 'high'}
305
+ ];
306
+
307
+ claimPatterns.forEach(({pattern, severity}) => {
308
+ const matches = this.content.match(new RegExp(pattern, 'gi'));
309
+ if (matches && matches.length > 0) {
310
+ // Only flag if not in proper context (like "to be completed" or "needs to be tested")
311
+ const contextuallyValid = matches.some(match => {
312
+ const context = this.getMatchContext(match, 50);
313
+ return context.includes('to be') || context.includes('will be') ||
314
+ context.includes('should be') || context.includes('needs');
315
+ });
316
+
317
+ if (!contextuallyValid) {
318
+ hallucinationIssues++;
319
+ verificationResults.push(`${severity} claim: "${matches[0]}" may be unverifiable`);
320
+ }
321
+ }
322
+ });
323
+
324
+ // Check for contradictory status
325
+ const statusSection = this.extractSection('Status');
326
+ const storySection = this.extractSection('Story');
327
+
328
+ if (statusSection && storySection) {
329
+ if (statusSection.includes('Complete') && storySection.includes('want to implement')) {
330
+ this.issues.critical.push('Status shows Complete but Story indicates implementation needed');
331
+ }
332
+ }
333
+
334
+ if (hallucinationIssues === 0) {
335
+ this.score += CONFIG.ANTI_HALLUCINATION_BONUS;
336
+ } else if (hallucinationIssues <= 2) {
337
+ this.issues.niceToHave.push(`Found ${hallucinationIssues} potentially unverifiable claims - consider adding evidence or qualifying language`);
338
+ } else {
339
+ this.issues.shouldFix.push(`Found ${hallucinationIssues} potentially unverifiable claims requiring verification`);
340
+ }
341
+
342
+ // Add bonus for confirmed sub-agent content with proper attribution
343
+ if (this.isSubAgent && this.subAgentInfo) {
344
+ this.score += 0.5; // Bonus for proper sub-agent attribution
345
+ }
346
+ }
347
+
348
+ getMatchContext(match, contextLength = 50) {
349
+ const matchIndex = this.content.indexOf(match);
350
+ const start = Math.max(0, matchIndex - contextLength);
351
+ const end = Math.min(this.content.length, matchIndex + match.length + contextLength);
352
+ return this.content.slice(start, end).toLowerCase();
353
+ }
354
+
355
+ step10_generateReport() {
356
+ // Calculate final score
357
+ this.score -= this.issues.critical.length * CONFIG.CRITICAL_PENALTY;
358
+ this.score -= this.issues.shouldFix.length * CONFIG.SHOULD_FIX_PENALTY;
359
+ this.score -= this.issues.niceToHave.length * CONFIG.NICE_TO_HAVE_PENALTY;
360
+
361
+ // Ensure score is within bounds
362
+ this.score = Math.max(0, Math.min(10, this.score));
363
+ }
364
+
365
+ extractSection(sectionName) {
366
+ // Performance: Use cached result if available
367
+ if (this.sectionCache.has(sectionName)) {
368
+ return this.sectionCache.get(sectionName);
369
+ }
370
+
371
+ const sectionPattern = new RegExp(`^##\\s+${sectionName}\\s*$`, 'm');
372
+ const match = this.content.match(sectionPattern);
373
+
374
+ if (!match) {
375
+ this.sectionCache.set(sectionName, null);
376
+ return null;
377
+ }
378
+
379
+ const sectionStart = match.index + match[0].length;
380
+ const nextSectionPattern = /^##\s+/m;
381
+ const remainingContent = this.content.slice(sectionStart);
382
+ const nextSectionMatch = remainingContent.match(nextSectionPattern);
383
+
384
+ const sectionEnd = nextSectionMatch ? sectionStart + nextSectionMatch.index : this.content.length;
385
+ const result = this.content.slice(sectionStart, sectionEnd).trim();
386
+
387
+ // Performance: Cache the result
388
+ this.sectionCache.set(sectionName, result);
389
+ return result;
390
+ }
391
+
392
+ generateOutput() {
393
+ const status = this.score >= 7 ? 'PASS' : 'FAIL';
394
+ const recommendation = this.getRecommendation();
395
+
396
+ const output = {
397
+ score: this.score.toFixed(1),
398
+ status: status,
399
+ recommendation: recommendation,
400
+ issues: this.issues,
401
+ summary: `Story validation ${status.toLowerCase()} with score ${this.score.toFixed(1)}/10`
402
+ };
403
+
404
+ // Add sub-agent information if detected
405
+ if (this.isSubAgent && this.subAgentInfo) {
406
+ output.subAgent = this.subAgentInfo;
407
+ output.summary += ` (Sub-agent generated content)`;
408
+ }
409
+
410
+ return output;
411
+ }
412
+
413
+ generateErrorOutput(error) {
414
+ return {
415
+ score: '0.0',
416
+ status: 'ERROR',
417
+ recommendation: 'Fix validation errors and try again',
418
+ error: error.message,
419
+ summary: `Validation failed: ${error.message}`
420
+ };
421
+ }
422
+
423
+ getRecommendation() {
424
+ if (this.score >= 9) return 'Ready for immediate implementation';
425
+ if (this.score >= 7) return 'Minor issues, can proceed with caution';
426
+ if (this.score >= 5) return 'Moderate issues, fixes recommended before implementation';
427
+ if (this.score >= 3) return 'Major issues, fixes required before proceeding';
428
+ return 'Severe issues, complete story revision needed';
429
+ }
430
+ }
431
+
432
+ // Main execution
433
+ async function main() {
434
+ const filePath = process.argv[2];
435
+ const isSubAgent = process.argv.includes('--sub-agent');
436
+
437
+ if (!filePath) {
438
+ console.error('Usage: story-validation-engine.js <story_file_path> [--sub-agent]');
439
+ process.exit(1);
440
+ }
441
+
442
+ const engine = new StoryValidationEngine(filePath, isSubAgent);
443
+ const result = await engine.validate();
444
+
445
+ // Output for hook consumption
446
+ console.log(`SCORE: ${result.score}`);
447
+ console.log(`STATUS: ${result.status}`);
448
+ console.log(`RECOMMENDATION: ${result.recommendation}`);
449
+
450
+ if (result.issues) {
451
+ if (result.issues.critical.length > 0) {
452
+ console.log(`CRITICAL: ${result.issues.critical.join('; ')}`);
453
+ }
454
+ if (result.issues.shouldFix.length > 0) {
455
+ console.log(`SHOULD_FIX: ${result.issues.shouldFix.join('; ')}`);
456
+ }
457
+ if (result.issues.niceToHave.length > 0) {
458
+ console.log(`NICE_TO_HAVE: ${result.issues.niceToHave.join('; ')}`);
459
+ }
460
+ }
461
+
462
+ process.exit(result.status === 'PASS' ? 0 : 1);
463
+ }
464
+
465
+ // Check if this is the main module (ES module equivalent of require.main === module)
466
+ if (import.meta.url === `file://${process.argv[1]}`) {
467
+ main().catch(error => {
468
+ console.error('VALIDATION_ERROR:', error.message);
469
+ process.exit(1);
470
+ });
471
+ }
472
+
473
+ export default StoryValidationEngine;
@@ -0,0 +1,210 @@
1
+ #!/bin/bash
2
+
3
+ # Enhanced Story Validation Hook for Claude Code with Sub-Agent Support
4
+ # Implements R.O.C.K.E.T. framework validation for story files with sub-agent integration
5
+ # Usage: story-validation-hook-enhanced.sh <file_path> [agent_name]
6
+
7
+ set -euo pipefail
8
+
9
+ # Configuration
10
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
+ LOG_FILE="$SCRIPT_DIR/../validation.log"
12
+ VALIDATION_ENGINE="$SCRIPT_DIR/story-validation-engine.js"
13
+ SUB_AGENT_VALIDATOR="$SCRIPT_DIR/sub-agent-validation-hook.js"
14
+ PERFORMANCE_MONITOR="$SCRIPT_DIR/performance-monitoring-hook.js"
15
+
16
+ # Input validation
17
+ if [ $# -lt 1 ] || [ $# -gt 2 ]; then
18
+ echo "Error: Usage: $0 <file_path> [agent_name]" >&2
19
+ exit 1
20
+ fi
21
+
22
+ FILE_PATH="$1"
23
+ AGENT_NAME="${2:-unknown}"
24
+ START_TIME=$(date +%s%3N) # Milliseconds
25
+
26
+ # Security: Validate file path to prevent injection attacks
27
+ if [[ "$FILE_PATH" =~ [^a-zA-Z0-9/_.-] ]]; then
28
+ echo "Error: Invalid characters in file path" >&2
29
+ exit 1
30
+ fi
31
+
32
+ # Security: Ensure file exists and is readable
33
+ if [ ! -f "$FILE_PATH" ]; then
34
+ echo "Error: File does not exist: $FILE_PATH" >&2
35
+ exit 1
36
+ fi
37
+
38
+ if [ ! -r "$FILE_PATH" ]; then
39
+ echo "Error: File is not readable: $FILE_PATH" >&2
40
+ exit 1
41
+ fi
42
+
43
+ TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
44
+
45
+ # Logging function with agent context
46
+ log() {
47
+ echo "[$TIMESTAMP] [$AGENT_NAME] $1" | tee -a "$LOG_FILE"
48
+ }
49
+
50
+ # Performance tracking function
51
+ track_performance() {
52
+ local end_time=$(date +%s%3N)
53
+ local duration=$((end_time - START_TIME))
54
+ local error_flag=${1:-false}
55
+
56
+ if [ -f "$PERFORMANCE_MONITOR" ]; then
57
+ node "$PERFORMANCE_MONITOR" record "$AGENT_NAME" "$duration" "$error_flag" 2>/dev/null || true
58
+ fi
59
+ }
60
+
61
+ # Check if file is a story file
62
+ if [[ ! "$FILE_PATH" =~ .*stories/.*\.md$ ]]; then
63
+ log "INFO: File $FILE_PATH is not a story file, skipping validation"
64
+ track_performance false
65
+ exit 0
66
+ fi
67
+
68
+ log "Starting enhanced story validation for: $FILE_PATH"
69
+
70
+ # Detect if content was generated by a sub-agent
71
+ CONTENT=$(cat "$FILE_PATH")
72
+ SUB_AGENT_GENERATED=false
73
+
74
+ # Check for sub-agent signatures in content
75
+ if echo "$CONTENT" | grep -qE "(I'm [A-Z][a-z]+ [A-Z][A-Za-z']+|Irish [A-Za-z]+ Excellence|**Irish [A-Za-z]+ with)"; then
76
+ SUB_AGENT_GENERATED=true
77
+ log "INFO: Sub-agent generated content detected"
78
+ fi
79
+
80
+ # Run appropriate validation based on content type
81
+ if [ "$SUB_AGENT_GENERATED" = true ] && [ -f "$SUB_AGENT_VALIDATOR" ]; then
82
+ log "Running sub-agent validation with R.O.C.K.E.T. framework..."
83
+
84
+ # Run sub-agent specific validation
85
+ if ! SUB_VALIDATION_RESULT=$(node "$SUB_AGENT_VALIDATOR" "$CONTENT" "$AGENT_NAME" 2>&1); then
86
+ log "ERROR: Sub-agent validation failed: $SUB_VALIDATION_RESULT"
87
+ track_performance true
88
+ exit 2
89
+ fi
90
+
91
+ # Parse JSON result
92
+ if ! PARSED_RESULT=$(echo "$SUB_VALIDATION_RESULT" | tail -n 1 | jq -r '.overallScore, .passed' 2>/dev/null); then
93
+ log "ERROR: Failed to parse sub-agent validation result"
94
+ track_performance true
95
+ exit 1
96
+ fi
97
+
98
+ SCORE=$(echo "$PARSED_RESULT" | head -n 1)
99
+ PASSED=$(echo "$PARSED_RESULT" | tail -n 1)
100
+
101
+ if [ "$PASSED" = "true" ]; then
102
+ STATUS="PASSED"
103
+ else
104
+ STATUS="FAILED"
105
+ fi
106
+
107
+ # Extract recommendations if available
108
+ RECOMMENDATIONS=$(echo "$SUB_VALIDATION_RESULT" | tail -n 1 | jq -r '.recommendations[]?' 2>/dev/null | head -3 || echo "")
109
+
110
+ log "Sub-agent validation completed - Score: $SCORE, Status: $STATUS"
111
+
112
+ else
113
+ # Fall back to standard story validation
114
+ log "Running standard R.O.C.K.E.T. validation engine..."
115
+
116
+ # Check if validation engine exists
117
+ if [ ! -f "$VALIDATION_ENGINE" ]; then
118
+ log "ERROR: Validation engine not found at $VALIDATION_ENGINE"
119
+ track_performance true
120
+ exit 1
121
+ fi
122
+
123
+ # Run validation engine
124
+ if ! VALIDATION_RESULT=$(node "$VALIDATION_ENGINE" "$FILE_PATH" 2>&1); then
125
+ log "ERROR: Validation engine failed: $VALIDATION_RESULT"
126
+ track_performance true
127
+ exit 1
128
+ fi
129
+
130
+ # Parse validation result
131
+ SCORE=$(echo "$VALIDATION_RESULT" | grep "SCORE:" | cut -d: -f2 | tr -d ' ')
132
+ STATUS=$(echo "$VALIDATION_RESULT" | grep "STATUS:" | cut -d: -f2 | tr -d ' ')
133
+
134
+ # Validate parsed values
135
+ if [ -z "$SCORE" ] || [ -z "$STATUS" ]; then
136
+ log "ERROR: Failed to parse validation result"
137
+ log "Raw output: $VALIDATION_RESULT"
138
+ track_performance true
139
+ exit 1
140
+ fi
141
+
142
+ log "Standard validation completed - Score: $SCORE, Status: $STATUS"
143
+ fi
144
+
145
+ # Apply quality gate with agent-specific thresholds
146
+ declare -A AGENT_THRESHOLDS=(
147
+ ["marketing-director"]=7.0
148
+ ["engineering-director"]=8.0
149
+ ["marketing-content-hooks"]=7.5
150
+ ["marketing-viral-growth"]=7.5
151
+ ["engineering-developer"]=8.0
152
+ ["default"]=7.0
153
+ )
154
+
155
+ QUALITY_THRESHOLD=${AGENT_THRESHOLDS[$AGENT_NAME]:-${AGENT_THRESHOLDS[default]}}
156
+
157
+ # Convert score to integer for comparison (multiply by 10 to handle decimals)
158
+ if command -v bc >/dev/null 2>&1; then
159
+ SCORE_INT=$(echo "$SCORE * 10" | bc -l | cut -d. -f1)
160
+ THRESHOLD_INT=$(echo "$QUALITY_THRESHOLD * 10" | bc -l | cut -d. -f1)
161
+ else
162
+ SCORE_INT=$(echo "$SCORE" | awk '{print int($1 * 10)}')
163
+ THRESHOLD_INT=$(echo "$QUALITY_THRESHOLD" | awk '{print int($1 * 10)}')
164
+ fi
165
+
166
+ # Generate response based on validation result
167
+ if (( SCORE_INT >= THRESHOLD_INT )); then
168
+ log "✅ PASS: Story validation successful (Score: $SCORE >= $QUALITY_THRESHOLD)"
169
+ track_performance false
170
+
171
+ # Generate success notification with agent context
172
+ cat <<EOF
173
+ {
174
+ "continue": true,
175
+ "decision": "approve",
176
+ "reason": "Story validation passed with score $SCORE/10 (Agent: $AGENT_NAME, Threshold: $QUALITY_THRESHOLD)",
177
+ "agent": "$AGENT_NAME",
178
+ "score": $SCORE,
179
+ "threshold": $QUALITY_THRESHOLD,
180
+ "validation_type": "$([ "$SUB_AGENT_GENERATED" = true ] && echo "sub-agent" || echo "standard")"
181
+ }
182
+ EOF
183
+ exit 0
184
+ else
185
+ log "❌ FAIL: Story validation failed (Score: $SCORE < $QUALITY_THRESHOLD)"
186
+ track_performance true
187
+
188
+ # Prepare recommendations for improvement
189
+ IMPROVEMENT_SUGGESTIONS=""
190
+ if [ -n "$RECOMMENDATIONS" ]; then
191
+ IMPROVEMENT_SUGGESTIONS="Recommendations: $RECOMMENDATIONS"
192
+ else
193
+ IMPROVEMENT_SUGGESTIONS="Review R.O.C.K.E.T. framework compliance: Role clarity, Objective alignment, Context usage, Key instructions, Examples, and Tone"
194
+ fi
195
+
196
+ # Block execution and provide detailed feedback
197
+ cat <<EOF
198
+ {
199
+ "continue": false,
200
+ "decision": "block",
201
+ "reason": "Story validation failed with score $SCORE/10. Minimum required: $QUALITY_THRESHOLD/10 for $AGENT_NAME. $IMPROVEMENT_SUGGESTIONS",
202
+ "agent": "$AGENT_NAME",
203
+ "score": $SCORE,
204
+ "threshold": $QUALITY_THRESHOLD,
205
+ "validation_type": "$([ "$SUB_AGENT_GENERATED" = true ] && echo "sub-agent" || echo "standard")",
206
+ "improvements": "$IMPROVEMENT_SUGGESTIONS"
207
+ }
208
+ EOF
209
+ exit 2
210
+ fi