agentic-qe 3.7.15 → 3.7.17

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 (301) hide show
  1. package/.claude/agents/v3/qe-devils-advocate.md +20 -0
  2. package/.claude/agents/v3/qe-gap-detector.md +25 -0
  3. package/.claude/agents/v3/qe-quality-gate.md +8 -0
  4. package/.claude/agents/v3/qe-requirements-validator.md +25 -0
  5. package/.claude/agents/v3/subagents/qe-code-reviewer.md +11 -0
  6. package/.claude/agents/v3/subagents/qe-integration-reviewer.md +11 -0
  7. package/.claude/agents/v3/subagents/qe-performance-reviewer.md +11 -0
  8. package/.claude/agents/v3/subagents/qe-security-reviewer.md +11 -0
  9. package/.claude/helpers/adr-compliance.sh +10 -10
  10. package/.claude/helpers/auto-memory-hook.mjs +24 -9
  11. package/.claude/helpers/brain-checkpoint.cjs +55 -134
  12. package/.claude/helpers/ddd-tracker.sh +2 -2
  13. package/.claude/helpers/guidance-hooks.sh +2 -2
  14. package/.claude/helpers/hook-handler.cjs +57 -18
  15. package/.claude/helpers/statusline.cjs +414 -595
  16. package/.claude/helpers/v3/quality-criteria/evidence-classification.md +116 -116
  17. package/.claude/helpers/v3/quality-criteria/htsm-categories.md +139 -139
  18. package/.claude/skills/README.md +8 -11
  19. package/.claude/skills/brutal-honesty-review/SKILL.md +3 -0
  20. package/.claude/skills/code-review-quality/SKILL.md +3 -0
  21. package/.claude/skills/qcsd-cicd-swarm/SKILL.md +79 -2075
  22. package/.claude/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +62 -0
  23. package/.claude/skills/qcsd-cicd-swarm/steps/02-core-agents.md +33 -0
  24. package/.claude/skills/qcsd-cicd-swarm/steps/03-batch1-results.md +21 -0
  25. package/.claude/skills/qcsd-cicd-swarm/steps/04-conditional-agents.md +23 -0
  26. package/.claude/skills/qcsd-cicd-swarm/steps/05-decision-synthesis.md +30 -0
  27. package/.claude/skills/qcsd-cicd-swarm/steps/06-report-generation.md +17 -0
  28. package/.claude/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +27 -0
  29. package/.claude/skills/qcsd-cicd-swarm/steps/08-deployment-advisor.md +25 -0
  30. package/.claude/skills/qcsd-cicd-swarm/steps/09-final-output.md +16 -0
  31. package/.claude/skills/qcsd-development-swarm/SKILL.md +79 -2027
  32. package/.claude/skills/qcsd-development-swarm/steps/01-flag-detection.md +50 -0
  33. package/.claude/skills/qcsd-development-swarm/steps/02-core-agents.md +29 -0
  34. package/.claude/skills/qcsd-development-swarm/steps/03-batch1-results.md +14 -0
  35. package/.claude/skills/qcsd-development-swarm/steps/04-conditional-agents.md +23 -0
  36. package/.claude/skills/qcsd-development-swarm/steps/05-decision-synthesis.md +30 -0
  37. package/.claude/skills/qcsd-development-swarm/steps/06-report-generation.md +16 -0
  38. package/.claude/skills/qcsd-development-swarm/steps/07-learning-persistence.md +25 -0
  39. package/.claude/skills/qcsd-development-swarm/steps/08-defect-predictor.md +25 -0
  40. package/.claude/skills/qcsd-development-swarm/steps/09-final-output.md +16 -0
  41. package/.claude/skills/qcsd-ideation-swarm/SKILL.md +94 -1894
  42. package/.claude/skills/qcsd-ideation-swarm/steps/01-flag-detection.md +57 -0
  43. package/.claude/skills/qcsd-ideation-swarm/steps/02-core-agents.md +29 -0
  44. package/.claude/skills/qcsd-ideation-swarm/steps/03-batch1-results.md +15 -0
  45. package/.claude/skills/qcsd-ideation-swarm/steps/04-conditional-agents.md +23 -0
  46. package/.claude/skills/qcsd-ideation-swarm/steps/05-decision-synthesis.md +29 -0
  47. package/.claude/skills/qcsd-ideation-swarm/steps/06-report-generation.md +18 -0
  48. package/.claude/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +29 -0
  49. package/.claude/skills/qcsd-ideation-swarm/steps/08-final-output.md +18 -0
  50. package/.claude/skills/qcsd-production-swarm/SKILL.md +88 -2663
  51. package/.claude/skills/qcsd-production-swarm/steps/01-flag-detection.md +206 -0
  52. package/.claude/skills/qcsd-production-swarm/steps/02-core-agents.md +428 -0
  53. package/.claude/skills/qcsd-production-swarm/steps/03-batch1-results.md +101 -0
  54. package/.claude/skills/qcsd-production-swarm/steps/04-conditional-agents.md +125 -0
  55. package/.claude/skills/qcsd-production-swarm/steps/05-decision-synthesis.md +136 -0
  56. package/.claude/skills/qcsd-production-swarm/steps/06-report-generation.md +181 -0
  57. package/.claude/skills/qcsd-production-swarm/steps/07-learning-persistence.md +185 -0
  58. package/.claude/skills/qcsd-production-swarm/steps/08-feedback-loop.md +122 -0
  59. package/.claude/skills/qcsd-production-swarm/steps/09-final-output.md +140 -0
  60. package/.claude/skills/qcsd-refinement-swarm/SKILL.md +59 -2312
  61. package/.claude/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +91 -0
  62. package/.claude/skills/qcsd-refinement-swarm/steps/02-core-agents.md +40 -0
  63. package/.claude/skills/qcsd-refinement-swarm/steps/03-batch1-results.md +40 -0
  64. package/.claude/skills/qcsd-refinement-swarm/steps/04-conditional-agents.md +35 -0
  65. package/.claude/skills/qcsd-refinement-swarm/steps/05-decision-synthesis.md +43 -0
  66. package/.claude/skills/qcsd-refinement-swarm/steps/06-report-generation.md +42 -0
  67. package/.claude/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +53 -0
  68. package/.claude/skills/qcsd-refinement-swarm/steps/08-transformation.md +36 -0
  69. package/.claude/skills/qcsd-refinement-swarm/steps/09-final-output.md +46 -0
  70. package/.claude/skills/sherlock-review/SKILL.md +3 -0
  71. package/.claude/skills/skill-builder/SKILL.md +103 -0
  72. package/.claude/skills/skills-manifest.json +1 -1
  73. package/CHANGELOG.md +44 -0
  74. package/assets/agents/v3/qe-devils-advocate.md +20 -0
  75. package/assets/agents/v3/qe-gap-detector.md +25 -0
  76. package/assets/agents/v3/qe-quality-gate.md +8 -0
  77. package/assets/agents/v3/qe-requirements-validator.md +25 -0
  78. package/assets/agents/v3/subagents/qe-code-reviewer.md +11 -0
  79. package/assets/agents/v3/subagents/qe-integration-reviewer.md +11 -0
  80. package/assets/agents/v3/subagents/qe-performance-reviewer.md +11 -0
  81. package/assets/agents/v3/subagents/qe-security-reviewer.md +11 -0
  82. package/assets/helpers/statusline-v3.cjs +693 -0
  83. package/assets/skills/brutal-honesty-review/SKILL.md +3 -0
  84. package/assets/skills/code-review-quality/SKILL.md +3 -0
  85. package/assets/skills/qcsd-cicd-swarm/SKILL.md +79 -2075
  86. package/assets/skills/qcsd-cicd-swarm/steps/01-flag-detection.md +62 -0
  87. package/assets/skills/qcsd-cicd-swarm/steps/02-core-agents.md +33 -0
  88. package/assets/skills/qcsd-cicd-swarm/steps/03-batch1-results.md +21 -0
  89. package/assets/skills/qcsd-cicd-swarm/steps/04-conditional-agents.md +23 -0
  90. package/assets/skills/qcsd-cicd-swarm/steps/05-decision-synthesis.md +30 -0
  91. package/assets/skills/qcsd-cicd-swarm/steps/06-report-generation.md +17 -0
  92. package/assets/skills/qcsd-cicd-swarm/steps/07-learning-persistence.md +27 -0
  93. package/assets/skills/qcsd-cicd-swarm/steps/08-deployment-advisor.md +25 -0
  94. package/assets/skills/qcsd-cicd-swarm/steps/09-final-output.md +16 -0
  95. package/assets/skills/qcsd-development-swarm/SKILL.md +79 -2027
  96. package/assets/skills/qcsd-development-swarm/steps/01-flag-detection.md +50 -0
  97. package/assets/skills/qcsd-development-swarm/steps/02-core-agents.md +29 -0
  98. package/assets/skills/qcsd-development-swarm/steps/03-batch1-results.md +14 -0
  99. package/assets/skills/qcsd-development-swarm/steps/04-conditional-agents.md +23 -0
  100. package/assets/skills/qcsd-development-swarm/steps/05-decision-synthesis.md +30 -0
  101. package/assets/skills/qcsd-development-swarm/steps/06-report-generation.md +16 -0
  102. package/assets/skills/qcsd-development-swarm/steps/07-learning-persistence.md +25 -0
  103. package/assets/skills/qcsd-development-swarm/steps/08-defect-predictor.md +25 -0
  104. package/assets/skills/qcsd-development-swarm/steps/09-final-output.md +16 -0
  105. package/assets/skills/qcsd-ideation-swarm/SKILL.md +94 -1894
  106. package/assets/skills/qcsd-ideation-swarm/steps/01-flag-detection.md +57 -0
  107. package/assets/skills/qcsd-ideation-swarm/steps/02-core-agents.md +29 -0
  108. package/assets/skills/qcsd-ideation-swarm/steps/03-batch1-results.md +15 -0
  109. package/assets/skills/qcsd-ideation-swarm/steps/04-conditional-agents.md +23 -0
  110. package/assets/skills/qcsd-ideation-swarm/steps/05-decision-synthesis.md +29 -0
  111. package/assets/skills/qcsd-ideation-swarm/steps/06-report-generation.md +18 -0
  112. package/assets/skills/qcsd-ideation-swarm/steps/07-learning-persistence.md +29 -0
  113. package/assets/skills/qcsd-ideation-swarm/steps/08-final-output.md +18 -0
  114. package/assets/skills/qcsd-production-swarm/SKILL.md +88 -2663
  115. package/assets/skills/qcsd-production-swarm/steps/01-flag-detection.md +206 -0
  116. package/assets/skills/qcsd-production-swarm/steps/02-core-agents.md +428 -0
  117. package/assets/skills/qcsd-production-swarm/steps/03-batch1-results.md +101 -0
  118. package/assets/skills/qcsd-production-swarm/steps/04-conditional-agents.md +125 -0
  119. package/assets/skills/qcsd-production-swarm/steps/05-decision-synthesis.md +136 -0
  120. package/assets/skills/qcsd-production-swarm/steps/06-report-generation.md +181 -0
  121. package/assets/skills/qcsd-production-swarm/steps/07-learning-persistence.md +185 -0
  122. package/assets/skills/qcsd-production-swarm/steps/08-feedback-loop.md +122 -0
  123. package/assets/skills/qcsd-production-swarm/steps/09-final-output.md +140 -0
  124. package/assets/skills/qcsd-refinement-swarm/SKILL.md +59 -2312
  125. package/assets/skills/qcsd-refinement-swarm/steps/01-flag-detection.md +91 -0
  126. package/assets/skills/qcsd-refinement-swarm/steps/02-core-agents.md +40 -0
  127. package/assets/skills/qcsd-refinement-swarm/steps/03-batch1-results.md +40 -0
  128. package/assets/skills/qcsd-refinement-swarm/steps/04-conditional-agents.md +35 -0
  129. package/assets/skills/qcsd-refinement-swarm/steps/05-decision-synthesis.md +43 -0
  130. package/assets/skills/qcsd-refinement-swarm/steps/06-report-generation.md +42 -0
  131. package/assets/skills/qcsd-refinement-swarm/steps/07-learning-persistence.md +53 -0
  132. package/assets/skills/qcsd-refinement-swarm/steps/08-transformation.md +36 -0
  133. package/assets/skills/qcsd-refinement-swarm/steps/09-final-output.md +46 -0
  134. package/assets/skills/sherlock-review/SKILL.md +3 -0
  135. package/assets/templates/agent-override-example.yaml +39 -0
  136. package/dist/agents/devils-advocate/agent.d.ts +25 -1
  137. package/dist/agents/devils-advocate/agent.js +108 -4
  138. package/dist/agents/devils-advocate/types.d.ts +54 -0
  139. package/dist/agents/devils-advocate/types.js +14 -0
  140. package/dist/agents/overlay-loader.d.ts +28 -0
  141. package/dist/agents/overlay-loader.js +232 -0
  142. package/dist/agents/overlay-schema.d.ts +56 -0
  143. package/dist/agents/overlay-schema.js +77 -0
  144. package/dist/analysis/branch-enumerator.d.ts +68 -0
  145. package/dist/analysis/branch-enumerator.js +393 -0
  146. package/dist/analysis/index.d.ts +2 -0
  147. package/dist/analysis/index.js +2 -0
  148. package/dist/cli/bundle.js +2469 -634
  149. package/dist/cli/commands/coverage.js +50 -0
  150. package/dist/cli/handlers/brain-handler.js +2 -1
  151. package/dist/context/compiler.d.ts +62 -0
  152. package/dist/context/compiler.js +143 -0
  153. package/dist/context/index.d.ts +8 -0
  154. package/dist/context/index.js +6 -0
  155. package/dist/context/sources/coverage-source.d.ts +15 -0
  156. package/dist/context/sources/coverage-source.js +77 -0
  157. package/dist/context/sources/git-source.d.ts +12 -0
  158. package/dist/context/sources/git-source.js +33 -0
  159. package/dist/context/sources/index.d.ts +6 -0
  160. package/dist/context/sources/index.js +5 -0
  161. package/dist/context/sources/memory-source.d.ts +17 -0
  162. package/dist/context/sources/memory-source.js +94 -0
  163. package/dist/context/sources/test-source.d.ts +13 -0
  164. package/dist/context/sources/test-source.js +53 -0
  165. package/dist/context/sources/types.d.ts +42 -0
  166. package/dist/context/sources/types.js +5 -0
  167. package/dist/domains/test-generation/coordinator.js +6 -4
  168. package/dist/feedback/feedback-loop.d.ts +5 -0
  169. package/dist/feedback/feedback-loop.js +12 -0
  170. package/dist/feedback/index.d.ts +1 -1
  171. package/dist/feedback/index.js +1 -1
  172. package/dist/init/agents-installer.d.ts +9 -0
  173. package/dist/init/agents-installer.js +72 -0
  174. package/dist/init/phases/07-hooks.d.ts +11 -0
  175. package/dist/init/phases/07-hooks.js +67 -0
  176. package/dist/init/phases/09-assets.js +3 -0
  177. package/dist/init/settings-merge.js +1 -1
  178. package/dist/kernel/hnsw-adapter.d.ts +3 -0
  179. package/dist/kernel/hnsw-adapter.js +11 -1
  180. package/dist/kernel/unified-memory-schemas.d.ts +1 -1
  181. package/dist/kernel/unified-memory-schemas.js +2 -0
  182. package/dist/kernel/unified-memory.js +25 -0
  183. package/dist/learning/experience-capture-middleware.js +24 -0
  184. package/dist/learning/sqlite-persistence.d.ts +3 -0
  185. package/dist/learning/sqlite-persistence.js +9 -0
  186. package/dist/learning/token-tracker.js +4 -0
  187. package/dist/mcp/bundle.js +3694 -3101
  188. package/dist/mcp/handlers/handler-factory.js +92 -11
  189. package/dist/mcp/services/task-router.d.ts +11 -0
  190. package/dist/mcp/services/task-router.js +26 -0
  191. package/dist/routing/qe-agent-registry.d.ts +11 -0
  192. package/dist/routing/qe-agent-registry.js +34 -0
  193. package/dist/routing/qe-task-router.d.ts +1 -0
  194. package/dist/routing/qe-task-router.js +34 -2
  195. package/dist/routing/routing-feedback.d.ts +5 -0
  196. package/dist/routing/routing-feedback.js +29 -3
  197. package/dist/routing/types.d.ts +2 -0
  198. package/dist/sync/pull-agent.js +2 -1
  199. package/dist/test-scheduling/pipeline.d.ts +7 -0
  200. package/dist/test-scheduling/pipeline.js +9 -0
  201. package/dist/validation/index.d.ts +3 -0
  202. package/dist/validation/index.js +10 -0
  203. package/dist/validation/pipeline.d.ts +80 -0
  204. package/dist/validation/pipeline.js +173 -0
  205. package/dist/validation/steps/requirements.d.ts +32 -0
  206. package/dist/validation/steps/requirements.js +596 -0
  207. package/package.json +6 -6
  208. package/.claude/agents/consensus/README.md +0 -253
  209. package/.claude/agents/deprecated/qe-api-contract-validator.md.v2 +0 -162
  210. package/.claude/agents/deprecated/qe-coverage-analyzer.md.v2 +0 -208
  211. package/.claude/agents/deprecated/qe-test-generator.md.v2 +0 -212
  212. package/.claude/agents/deprecated/qe-visual-tester.md.v2 +0 -216
  213. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -130
  214. package/.claude/agents/hive-mind/queen-coordinator.md +0 -203
  215. package/.claude/agents/hive-mind/scout-explorer.md +0 -242
  216. package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -193
  217. package/.claude/agents/hive-mind/worker-specialist.md +0 -217
  218. package/.claude/agents/neural/safla-neural.md +0 -74
  219. package/.claude/agents/optimization/README.md +0 -250
  220. package/.claude/agents/reasoning/agent.md +0 -816
  221. package/.claude/agents/reasoning/goal-planner.md +0 -73
  222. package/.claude/agents/subagents/qe-code-reviewer.md +0 -76
  223. package/.claude/agents/subagents/qe-coverage-gap-analyzer.md +0 -76
  224. package/.claude/agents/subagents/qe-data-generator.md +0 -77
  225. package/.claude/agents/subagents/qe-flaky-investigator.md +0 -91
  226. package/.claude/agents/subagents/qe-integration-tester.md +0 -90
  227. package/.claude/agents/subagents/qe-performance-validator.md +0 -92
  228. package/.claude/agents/subagents/qe-security-auditor.md +0 -94
  229. package/.claude/agents/subagents/qe-test-data-architect-sub.md +0 -93
  230. package/.claude/agents/subagents/qe-test-implementer.md +0 -106
  231. package/.claude/agents/subagents/qe-test-refactorer.md +0 -117
  232. package/.claude/agents/subagents/qe-test-writer.md +0 -112
  233. package/.claude/agents/swarm/README.md +0 -190
  234. package/.claude/agents/templates/migration-plan.md +0 -746
  235. package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -244
  236. package/.claude/agents/testing/validation/production-validator.md +0 -395
  237. package/.claude/agents/v3/README.md +0 -39
  238. package/.claude/agents/v3/typescript-specialist.yaml +0 -21
  239. package/.claude/agents/v3/v3-memory-specialist.md +0 -318
  240. package/.claude/agents/v3/v3-performance-engineer.md +0 -397
  241. package/.claude/agents/v3/v3-queen-coordinator.md +0 -98
  242. package/.claude/agents/v3/v3-security-architect.md +0 -174
  243. package/.claude/commands/README.md +0 -106
  244. package/.claude/commands/agents/README.md +0 -10
  245. package/.claude/commands/agents/agent-capabilities.md +0 -21
  246. package/.claude/commands/agents/agent-coordination.md +0 -28
  247. package/.claude/commands/agents/agent-spawning.md +0 -28
  248. package/.claude/commands/agents/agent-types.md +0 -26
  249. package/.claude/commands/coordination/README.md +0 -9
  250. package/.claude/commands/coordination/agent-spawn.md +0 -25
  251. package/.claude/commands/coordination/init.md +0 -44
  252. package/.claude/commands/coordination/orchestrate.md +0 -43
  253. package/.claude/commands/coordination/spawn.md +0 -45
  254. package/.claude/commands/coordination/swarm-init.md +0 -85
  255. package/.claude/commands/coordination/task-orchestrate.md +0 -25
  256. package/.claude/commands/hive-mind/README.md +0 -17
  257. package/.claude/commands/hive-mind/hive-mind-consensus.md +0 -8
  258. package/.claude/commands/hive-mind/hive-mind-init.md +0 -18
  259. package/.claude/commands/hive-mind/hive-mind-memory.md +0 -8
  260. package/.claude/commands/hive-mind/hive-mind-metrics.md +0 -8
  261. package/.claude/commands/hive-mind/hive-mind-resume.md +0 -8
  262. package/.claude/commands/hive-mind/hive-mind-sessions.md +0 -8
  263. package/.claude/commands/hive-mind/hive-mind-spawn.md +0 -21
  264. package/.claude/commands/hive-mind/hive-mind-status.md +0 -8
  265. package/.claude/commands/hive-mind/hive-mind-stop.md +0 -8
  266. package/.claude/commands/hive-mind/hive-mind-wizard.md +0 -8
  267. package/.claude/commands/hive-mind/hive-mind.md +0 -27
  268. package/.claude/commands/memory/README.md +0 -9
  269. package/.claude/commands/memory/memory-persist.md +0 -25
  270. package/.claude/commands/memory/memory-search.md +0 -25
  271. package/.claude/commands/memory/memory-usage.md +0 -25
  272. package/.claude/commands/memory/neural.md +0 -47
  273. package/.claude/commands/swarm/README.md +0 -15
  274. package/.claude/commands/swarm/swarm-analysis.md +0 -8
  275. package/.claude/commands/swarm/swarm-background.md +0 -8
  276. package/.claude/commands/swarm/swarm-init.md +0 -19
  277. package/.claude/commands/swarm/swarm-modes.md +0 -8
  278. package/.claude/commands/swarm/swarm-monitor.md +0 -8
  279. package/.claude/commands/swarm/swarm-spawn.md +0 -19
  280. package/.claude/commands/swarm/swarm-status.md +0 -8
  281. package/.claude/commands/swarm/swarm-strategies.md +0 -8
  282. package/.claude/commands/swarm/swarm.md +0 -27
  283. package/.claude/commands/training/README.md +0 -9
  284. package/.claude/commands/training/model-update.md +0 -25
  285. package/.claude/commands/training/neural-patterns.md +0 -74
  286. package/.claude/commands/training/neural-train.md +0 -25
  287. package/.claude/commands/training/pattern-learn.md +0 -25
  288. package/.claude/commands/training/specialization.md +0 -63
  289. package/.claude/commands/workflows/README.md +0 -9
  290. package/.claude/commands/workflows/development.md +0 -78
  291. package/.claude/commands/workflows/research.md +0 -63
  292. package/.claude/commands/workflows/workflow-create.md +0 -25
  293. package/.claude/commands/workflows/workflow-execute.md +0 -25
  294. package/.claude/commands/workflows/workflow-export.md +0 -25
  295. package/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
  296. package/.claude/skills/hive-mind-advanced/SKILL.md +0 -712
  297. package/.claude/skills/iterative-loop/SKILL.md +0 -371
  298. package/.claude/skills/performance-analysis/SKILL.md +0 -569
  299. package/.claude/skills/performance-analysis/evals/performance-analysis.yaml +0 -144
  300. package/.claude/skills/performance-analysis/schemas/output.json +0 -588
  301. package/.claude/skills/performance-analysis/scripts/validate-config.json +0 -36
@@ -61,6 +61,26 @@ Use up to 7 concurrent strategies per review.
61
61
  - **Error Handling Gap Detection**: Find missing error handling for network failures, timeouts, malformed input, and resource exhaustion
62
62
  </capabilities>
63
63
 
64
+ <adversarial_review_standards>
65
+ ### Minimum Finding Requirements
66
+ Every review MUST surface findings meeting a minimum weighted score of 3.0 (severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25).
67
+
68
+ ### Reviewer Mindset
69
+ You are a skeptical reviewer. Your job is to find problems. The LLM agreeability bias works against quality -- actively resist it. Assume the code has defects until proven otherwise.
70
+
71
+ ### Anti-Patterns (NEVER Do These)
72
+ - NEVER produce a review that says "looks good" without at least 3 observations
73
+ - NEVER accept "no findings" without a Clean Justification containing specific evidence
74
+ - NEVER skip the second-pass deep review when initial findings are below minimum
75
+
76
+ ### Clean Justification Protocol
77
+ If the code is genuinely clean (rare), you MUST provide:
78
+ 1. List of specific files examined
79
+ 2. List of patterns/anti-patterns checked
80
+ 3. List of tools/strategies run
81
+ 4. Detailed reasoning why no issues were found
82
+ </adversarial_review_standards>
83
+
64
84
  <memory_namespace>
65
85
  Reads:
66
86
  - aqe/v3/domains/test-generation/results/* - Test generation outputs to challenge
@@ -54,8 +54,33 @@ Use up to 6 concurrent analyzers for large codebases.
54
54
  - **Test Recommendations**: Prioritized recommendations with effort estimates
55
55
  - **Trend Analysis**: Track gap closure over time
56
56
  - **Visual Reports**: Gap heatmaps and coverage treemaps
57
+ - **Mechanical Edge Case Mode**: Exhaustive branch enumeration without subjective filtering (BMAD-004)
57
58
  </capabilities>
58
59
 
60
+ <mechanical_mode>
61
+ ## Mechanical/Exhaustive Mode (BMAD-004)
62
+
63
+ When invoked with `--mechanical` or `--exhaustive` flag, switch to exhaustive branch enumeration mode:
64
+
65
+ ### Exhaustive Mode Behavior
66
+ - Report EVERY unhandled branch path as structured JSON without filtering by risk score
67
+ - No subjective prioritization — purely mechanical enumeration
68
+ - Enumerate: if-without-else, switch-no-default, empty-catch, optional-chaining null paths, promise-no-catch, array-empty-case, logical-or-falsy-trap
69
+ - Output format: UnhandledBranch[] with file, line, column, construct type, trigger condition, current handling, suggested guard
70
+ - Severity is deterministic (based on construct type), not subjective
71
+
72
+ ### Default Mode (unchanged)
73
+ Without the mechanical flag, operate in the standard risk-scored mode with semantic analysis and prioritization.
74
+
75
+ ### Output Formats
76
+ - `--json` — Structured JSON array of UnhandledBranch objects
77
+ - `--table` — Tabular summary grouped by severity
78
+ - `--markdown` — Detailed markdown report with code context
79
+
80
+ ### Implementation
81
+ Uses `src/analysis/branch-enumerator.ts` — a regex-based pattern matcher (no AST parser dependency) that implements the `BranchEnumerator` strategy interface. Detects 13 construct types across TypeScript and JavaScript files.
82
+ </mechanical_mode>
83
+
59
84
  <memory_namespace>
60
85
  Reads:
61
86
  - aqe/coverage/reports/* - Coverage data (lcov, istanbul, c8)
@@ -57,6 +57,14 @@ Use up to 6 concurrent evaluators for complex gates.
57
57
  - **CI/CD Integration**: Provide gate status to GitHub Actions, Jenkins, GitLab CI
58
58
  </capabilities>
59
59
 
60
+ <pipeline_integration>
61
+ ## Pipeline Integration (BMAD-003)
62
+
63
+ Quality gates can delegate structured validation to the validation pipeline framework. When evaluating requirements or documentation quality, invoke the requirements validation pipeline for systematic step-by-step assessment with gate enforcement.
64
+
65
+ Validation pipeline provides: step-by-step structured verdicts, blocking gate enforcement, weighted scoring, and evidence-based reporting.
66
+ </pipeline_integration>
67
+
60
68
  <memory_namespace>
61
69
  Reads:
62
70
  - aqe/quality-thresholds/* - Configured gate thresholds
@@ -64,6 +64,31 @@ Use up to 6 concurrent validators.
64
64
  - **Quality Gate**: Block untestable requirements from development (score < 50)
65
65
  </capabilities>
66
66
 
67
+ <structured_validation_pipeline>
68
+ ## Structured Validation Pipeline (BMAD-003)
69
+
70
+ When validating requirements, execute the 13-step validation pipeline:
71
+
72
+ 1. **Format Check** (blocking) — Structure, headings, required sections
73
+ 2. **Completeness Check** (blocking) — All required fields populated
74
+ 3. **INVEST Criteria** (warning) — Independent, Negotiable, Valuable, Estimable, Small, Testable
75
+ 4. **SMART Acceptance** (warning) — Specific, Measurable, Achievable, Relevant, Time-bound
76
+ 5. **Testability Score** (warning) — Can each requirement be tested? Score 0-100
77
+ 6. **Vague Term Detection** (info) — Flag "should", "might", "various", "etc."
78
+ 7. **Information Density** (info) — Every sentence carries weight, no filler
79
+ 8. **Traceability Check** (warning) — Requirements to tests mapping exists
80
+ 9. **Implementation Leakage** (warning) — Requirements don't prescribe implementation
81
+ 10. **Domain Compliance** (info) — Requirements align with domain model
82
+ 11. **Dependency Analysis** (info) — Cross-requirement dependencies identified
83
+ 12. **BDD Scenario Generation** (warning) — Can generate Given/When/Then for each requirement
84
+ 13. **Holistic Quality** (blocking) — Overall coherence, no contradictions
85
+
86
+ Execute steps in order. Report each step's result before proceeding. Halt at blocking failures unless --continue-on-failure is specified.
87
+
88
+ ### Output Format
89
+ For each step, report: Step name | Status (PASS/FAIL/WARN) | Score (0-100) | Findings count | Evidence summary
90
+ </structured_validation_pipeline>
91
+
67
92
  <memory_namespace>
68
93
  Reads:
69
94
  - aqe/requirements/* - Requirements documents
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
156
156
  | 0.0 | Failed: Major issues missed or harmful feedback |
157
157
  </learning_protocol>
158
158
 
159
+ <minimum_finding_requirements>
160
+ ## Minimum Finding Requirements (ADR: BMAD-001)
161
+
162
+ Every review MUST meet a minimum weighted finding score:
163
+ - Code Review: 3.0
164
+ - Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
165
+ - If below minimum after first pass, run deeper analysis with broader scope
166
+ - If genuinely clean, provide Clean Justification with evidence of what was checked
167
+ - Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
168
+ </minimum_finding_requirements>
169
+
159
170
  <output_format>
160
171
  - JSON for structured review findings
161
172
  - Markdown for PR comments
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
156
156
  | 0.0 | Failed: Breaking change reached production or consumers not identified |
157
157
  </learning_protocol>
158
158
 
159
+ <minimum_finding_requirements>
160
+ ## Minimum Finding Requirements (ADR: BMAD-001)
161
+
162
+ Every review MUST meet a minimum weighted finding score:
163
+ - Integration Review: 2.0
164
+ - Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
165
+ - If below minimum after first pass, run deeper analysis with broader scope
166
+ - If genuinely clean, provide Clean Justification with evidence of what was checked
167
+ - Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
168
+ </minimum_finding_requirements>
169
+
159
170
  <output_format>
160
171
  - JSON for structured integration analysis
161
172
  - Markdown for integration reports
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
156
156
  | 0.0 | Failed: Performance regression reached production |
157
157
  </learning_protocol>
158
158
 
159
+ <minimum_finding_requirements>
160
+ ## Minimum Finding Requirements (ADR: BMAD-001)
161
+
162
+ Every review MUST meet a minimum weighted finding score:
163
+ - Performance Review: 2.0
164
+ - Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
165
+ - If below minimum after first pass, run deeper analysis with broader scope
166
+ - If genuinely clean, provide Clean Justification with evidence of what was checked
167
+ - Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
168
+ </minimum_finding_requirements>
169
+
159
170
  <output_format>
160
171
  - JSON for structured performance analysis
161
172
  - Markdown for performance reports
@@ -156,6 +156,17 @@ mcp__agentic-qe__task_submit({
156
156
  | 0.0 | Failed: Critical vulnerability reached production |
157
157
  </learning_protocol>
158
158
 
159
+ <minimum_finding_requirements>
160
+ ## Minimum Finding Requirements (ADR: BMAD-001)
161
+
162
+ Every review MUST meet a minimum weighted finding score:
163
+ - Security Review: 3.0
164
+ - Severity weights: CRITICAL=3, HIGH=2, MEDIUM=1, LOW=0.5, INFORMATIONAL=0.25
165
+ - If below minimum after first pass, run deeper analysis with broader scope
166
+ - If genuinely clean, provide Clean Justification with evidence of what was checked
167
+ - Anti-pattern: NEVER say "no issues found" without listing files examined and patterns checked
168
+ </minimum_finding_requirements>
169
+
159
170
  <output_format>
160
171
  - JSON for structured vulnerability reports
161
172
  - Markdown for security advisories
@@ -41,7 +41,7 @@ check_adr_001() {
41
41
  grep -q "agentic-flow" "$PROJECT_ROOT/package.json" 2>/dev/null && score=$((score + 50))
42
42
 
43
43
  # Check for imports from agentic-flow
44
- local imports=$(grep -r "from.*agentic-flow\|require.*agentic-flow" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
44
+ local imports=$(grep -r "from.*agentic-flow\|require.*agentic-flow" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
45
45
  [ "$imports" -gt 5 ] && score=$((score + 50))
46
46
 
47
47
  echo "$score"
@@ -52,14 +52,14 @@ check_adr_002() {
52
52
  local score=0
53
53
 
54
54
  # Check for domain directories
55
- [ -d "$PROJECT_ROOT/src/domains" ] && score=$((score + 30))
55
+ [ -d "$PROJECT_ROOT/v3" ] || [ -d "$PROJECT_ROOT/src/domains" ] && score=$((score + 30))
56
56
 
57
57
  # Check for bounded contexts
58
- local contexts=$(find "$PROJECT_ROOT/src" -type d -name "domain" 2>/dev/null | wc -l)
58
+ local contexts=$(find "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" -type d -name "domain" 2>/dev/null | wc -l)
59
59
  [ "$contexts" -gt 0 ] && score=$((score + 35))
60
60
 
61
61
  # Check for anti-corruption layers
62
- local acl=$(grep -r "AntiCorruption\|Adapter\|Port" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
62
+ local acl=$(grep -r "AntiCorruption\|Adapter\|Port" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | wc -l)
63
63
  [ "$acl" -gt 0 ] && score=$((score + 35))
64
64
 
65
65
  echo "$score"
@@ -70,10 +70,10 @@ check_adr_003() {
70
70
  local score=0
71
71
 
72
72
  # Check for unified SwarmCoordinator
73
- grep -rq "SwarmCoordinator\|UnifiedCoordinator" "$PROJECT_ROOT/src" 2>/dev/null && score=$((score + 50))
73
+ grep -rq "SwarmCoordinator\|UnifiedCoordinator" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null && score=$((score + 50))
74
74
 
75
75
  # Check for no duplicate coordinators
76
- local coordinators=$(grep -r "class.*Coordinator" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v ".test." | wc -l)
76
+ local coordinators=$(grep -r "class.*Coordinator" "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v ".test." | wc -l)
77
77
  [ "$coordinators" -le 3 ] && score=$((score + 50))
78
78
 
79
79
  echo "$score"
@@ -84,14 +84,14 @@ check_adr_005() {
84
84
  local score=0
85
85
 
86
86
  # Check for MCP server implementation
87
- [ -d "$PROJECT_ROOT/src/mcp" ] && score=$((score + 40))
87
+ [ -d "$PROJECT_ROOT/v3/@claude-flow/mcp" ] && score=$((score + 40))
88
88
 
89
89
  # Check for MCP tools
90
- local tools=$(grep -r "tool.*name\|registerTool" "$PROJECT_ROOT/src" 2>/dev/null | wc -l)
90
+ local tools=$(grep -r "tool.*name\|registerTool" "$PROJECT_ROOT/v3" 2>/dev/null | wc -l)
91
91
  [ "$tools" -gt 5 ] && score=$((score + 30))
92
92
 
93
93
  # Check for MCP schemas
94
- grep -rq "schema\|jsonSchema" "$PROJECT_ROOT/src/mcp" 2>/dev/null && score=$((score + 30))
94
+ grep -rq "schema\|jsonSchema" "$PROJECT_ROOT/v3/@claude-flow/mcp" 2>/dev/null && score=$((score + 30))
95
95
 
96
96
  echo "$score"
97
97
  }
@@ -104,7 +104,7 @@ check_adr_008() {
104
104
  grep -q "vitest" "$PROJECT_ROOT/package.json" 2>/dev/null && score=$((score + 50))
105
105
 
106
106
  # Check for no jest references
107
- local jest_refs=$(grep -r "from.*jest\|jest\." "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v "vitest" | wc -l)
107
+ local jest_refs=$(grep -r "from.*jest\|jest\." "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" 2>/dev/null | grep -v node_modules | grep -v "vitest" | wc -l)
108
108
  [ "$jest_refs" -eq 0 ] && score=$((score + 50))
109
109
 
110
110
  echo "$score"
@@ -139,17 +139,30 @@ async function loadMemoryPackage() {
139
139
  } catch { /* fall through */ }
140
140
  }
141
141
 
142
- // Strategy 2: npm installed @claude-flow/memory
142
+ // Strategy 2: Use createRequire for CJS-style resolution (handles nested node_modules
143
+ // when installed as a transitive dependency via npx ruflo / npx claude-flow)
144
+ try {
145
+ const { createRequire } = await import('module');
146
+ const require = createRequire(join(PROJECT_ROOT, 'package.json'));
147
+ return require('@claude-flow/memory');
148
+ } catch { /* fall through */ }
149
+
150
+ // Strategy 3: ESM import (works when @claude-flow/memory is a direct dependency)
143
151
  try {
144
152
  return await import('@claude-flow/memory');
145
153
  } catch { /* fall through */ }
146
154
 
147
- // Strategy 3: Installed via @claude-flow/cli which includes memory
148
- const cliMemory = join(PROJECT_ROOT, 'node_modules/@claude-flow/memory/dist/index.js');
149
- if (existsSync(cliMemory)) {
150
- try {
151
- return await import(`file://${cliMemory}`);
152
- } catch { /* fall through */ }
155
+ // Strategy 4: Walk up from PROJECT_ROOT looking for @claude-flow/memory in any node_modules
156
+ let searchDir = PROJECT_ROOT;
157
+ const { parse } = await import('path');
158
+ while (searchDir !== parse(searchDir).root) {
159
+ const candidate = join(searchDir, 'node_modules', '@claude-flow', 'memory', 'dist', 'index.js');
160
+ if (existsSync(candidate)) {
161
+ try {
162
+ return await import(`file://${candidate}`);
163
+ } catch { /* fall through */ }
164
+ }
165
+ searchDir = dirname(searchDir);
153
166
  }
154
167
 
155
168
  return null;
@@ -342,9 +355,11 @@ try {
342
355
  case 'status': await doStatus(); break;
343
356
  default:
344
357
  console.log('Usage: auto-memory-hook.mjs <import|sync|status>');
345
- process.exit(1);
358
+ break;
346
359
  }
347
360
  } catch (err) {
348
361
  // Hooks must never crash Claude Code - fail silently
349
- dim(`Error (non-critical): ${err.message}`);
362
+ try { dim(`Error (non-critical): ${err.message}`); } catch (_) {}
350
363
  }
364
+ // Hooks must ALWAYS exit 0
365
+ process.exitCode = 0;
@@ -1,134 +1,55 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Brain Checkpoint Helper
4
- *
5
- * Automatic brain export/verify for session hooks.
6
- *
7
- * Usage:
8
- * node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
9
- * node brain-checkpoint.cjs verify # Verify aqe.rvf exists and is recent (session-start)
10
- * node brain-checkpoint.cjs info # Show aqe.rvf info
11
- *
12
- * Called from .claude/settings.json Stop and SessionStart hooks.
13
- */
14
-
15
- const { execSync } = require('child_process');
16
- const fs = require('fs');
17
- const path = require('path');
18
-
19
- const AQE_DIR = path.join(process.cwd(), '.agentic-qe');
20
- const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
21
- const DB_PATH = path.join(AQE_DIR, 'memory.db');
22
- const CLI = path.join(process.cwd(), 'dist', 'cli', 'bundle.js');
23
- const MAX_AGE_HOURS = 24;
24
-
25
- function log(msg) {
26
- process.stderr.write(`[brain-checkpoint] ${msg}\n`);
27
- }
28
-
29
- function exportBrain() {
30
- if (!fs.existsSync(DB_PATH)) {
31
- log('No memory.db found, skipping export');
32
- return { exported: false, reason: 'no-db' };
33
- }
34
-
35
- if (!fs.existsSync(CLI)) {
36
- log('CLI bundle not found, skipping export');
37
- return { exported: false, reason: 'no-cli' };
38
- }
39
-
40
- try {
41
- // Remove existing to avoid LockHeld errors
42
- if (fs.existsSync(RVF_PATH)) {
43
- fs.unlinkSync(RVF_PATH);
44
- }
45
- const idmap = `${RVF_PATH}.idmap.json`;
46
- if (fs.existsSync(idmap)) {
47
- fs.unlinkSync(idmap);
48
- }
49
-
50
- const result = execSync(
51
- `node "${CLI}" brain export -o "${RVF_PATH}" --format rvf 2>&1`,
52
- { timeout: 60000, encoding: 'utf-8' }
53
- );
54
-
55
- const sizeMatch = result.match(/RVF Size:\s+(.+)/);
56
- const patternsMatch = result.match(/Patterns:\s+(\d+)/);
57
- const size = sizeMatch ? sizeMatch[1].trim() : 'unknown';
58
- const patterns = patternsMatch ? patternsMatch[1] : '0';
59
-
60
- log(`Exported ${patterns} patterns (${size}) to aqe.rvf`);
61
- return { exported: true, patterns: parseInt(patterns), size };
62
- } catch (e) {
63
- log(`Export failed: ${e.message}`);
64
- return { exported: false, reason: e.message };
65
- }
66
- }
67
-
68
- function verifyBrain() {
69
- if (!fs.existsSync(RVF_PATH)) {
70
- log('No aqe.rvf found — brain checkpoint missing');
71
- return { valid: false, reason: 'missing' };
72
- }
73
-
74
- const stat = fs.statSync(RVF_PATH);
75
- const ageHours = (Date.now() - stat.mtimeMs) / (1000 * 60 * 60);
76
-
77
- if (stat.size < 1024) {
78
- log('aqe.rvf is too small — likely corrupt');
79
- return { valid: false, reason: 'too-small', sizeBytes: stat.size };
80
- }
81
-
82
- if (ageHours > MAX_AGE_HOURS) {
83
- log(`aqe.rvf is ${ageHours.toFixed(1)}h old — consider re-exporting`);
84
- return { valid: true, stale: true, ageHours: Math.round(ageHours) };
85
- }
86
-
87
- log(`aqe.rvf OK (${(stat.size / 1024 / 1024).toFixed(1)} MB, ${ageHours.toFixed(1)}h old)`);
88
- return { valid: true, stale: false, ageHours: Math.round(ageHours), sizeBytes: stat.size };
89
- }
90
-
91
- function infoBrain() {
92
- if (!fs.existsSync(RVF_PATH)) {
93
- log('No aqe.rvf found');
94
- return { exists: false };
95
- }
96
-
97
- if (!fs.existsSync(CLI)) {
98
- const stat = fs.statSync(RVF_PATH);
99
- return { exists: true, sizeBytes: stat.size, modified: stat.mtime.toISOString() };
100
- }
101
-
102
- try {
103
- const result = execSync(
104
- `node "${CLI}" brain info -i "${RVF_PATH}" 2>&1`,
105
- { timeout: 15000, encoding: 'utf-8' }
106
- );
107
- return { exists: true, info: result.trim() };
108
- } catch (e) {
109
- return { exists: true, error: e.message };
110
- }
111
- }
112
-
113
- // Main
114
- const command = process.argv[2] || 'verify';
115
- let result;
116
-
117
- switch (command) {
118
- case 'export':
119
- result = exportBrain();
120
- break;
121
- case 'verify':
122
- result = verifyBrain();
123
- break;
124
- case 'info':
125
- result = infoBrain();
126
- break;
127
- default:
128
- log(`Unknown command: ${command}`);
129
- process.exit(1);
130
- }
131
-
132
- if (process.argv.includes('--json')) {
133
- process.stdout.write(JSON.stringify(result));
134
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Brain Checkpoint Helper (generated by aqe init)
4
+ *
5
+ * Usage:
6
+ * node brain-checkpoint.cjs export # Export brain to aqe.rvf (session-end)
7
+ * node brain-checkpoint.cjs verify # Verify aqe.rvf exists (session-start)
8
+ */
9
+ const { execSync } = require('child_process');
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+
13
+ const AQE_DIR = path.join(process.cwd(), '.agentic-qe');
14
+ const RVF_PATH = path.join(AQE_DIR, 'aqe.rvf');
15
+ const DB_PATH = path.join(AQE_DIR, 'memory.db');
16
+ const MAX_AGE_HOURS = 24;
17
+
18
+ function log(msg) { process.stderr.write('[brain-checkpoint] ' + msg + '\n'); }
19
+
20
+ function exportBrain() {
21
+ if (!fs.existsSync(DB_PATH)) { log('No memory.db, skipping'); return { exported: false }; }
22
+ try {
23
+ if (fs.existsSync(RVF_PATH)) fs.unlinkSync(RVF_PATH);
24
+ const idmap = RVF_PATH + '.idmap.json';
25
+ if (fs.existsSync(idmap)) fs.unlinkSync(idmap);
26
+ const result = execSync(
27
+ 'npx agentic-qe brain export -o "' + RVF_PATH + '" --format rvf 2>&1',
28
+ { timeout: 60000, encoding: 'utf-8' }
29
+ );
30
+ const m = result.match(/Patterns:\s+(\d+)/);
31
+ const p = m ? m[1] : '0';
32
+ log('Exported ' + p + ' patterns to aqe.rvf');
33
+ return { exported: true, patterns: parseInt(p) };
34
+ } catch (e) {
35
+ log('Export failed: ' + e.message);
36
+ return { exported: false, reason: e.message };
37
+ }
38
+ }
39
+
40
+ function verifyBrain() {
41
+ if (!fs.existsSync(RVF_PATH)) {
42
+ log('No aqe.rvf found');
43
+ return { valid: false, reason: 'missing' };
44
+ }
45
+ const stat = fs.statSync(RVF_PATH);
46
+ const ageH = (Date.now() - stat.mtimeMs) / 3600000;
47
+ if (stat.size < 1024) { log('aqe.rvf too small'); return { valid: false, reason: 'too-small' }; }
48
+ if (ageH > MAX_AGE_HOURS) { log('aqe.rvf is ' + ageH.toFixed(1) + 'h old'); return { valid: true, stale: true }; }
49
+ log('aqe.rvf OK (' + (stat.size/1048576).toFixed(1) + ' MB)');
50
+ return { valid: true, stale: false };
51
+ }
52
+
53
+ const cmd = process.argv[2] || 'verify';
54
+ const result = cmd === 'export' ? exportBrain() : verifyBrain();
55
+ if (process.argv.includes('--json')) process.stdout.write(JSON.stringify(result));
@@ -25,7 +25,7 @@ should_run() {
25
25
 
26
26
  check_domain() {
27
27
  local domain="$1"
28
- local domain_path="$PROJECT_ROOT/src/domains/$domain"
28
+ local domain_path="$PROJECT_ROOT/v3/@claude-flow/$domain"
29
29
  local alt_path="$PROJECT_ROOT/src/domains/$domain"
30
30
 
31
31
  local score=0
@@ -64,7 +64,7 @@ count_entities() {
64
64
  local type="$1"
65
65
  local pattern="$2"
66
66
 
67
- find "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | \
67
+ find "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | \
68
68
  xargs grep -l "$pattern" 2>/dev/null | \
69
69
  grep -v node_modules | grep -v ".test." | wc -l || echo "0"
70
70
  }
@@ -28,8 +28,8 @@ case "$COMMAND" in
28
28
  if [[ "$FILE_PATH" =~ (config|secret|credential|password|key|auth) ]]; then
29
29
  echo -e "${YELLOW}[Guidance] Security-sensitive file${RESET}"
30
30
  fi
31
- if [[ "$FILE_PATH" =~ ^src/ ]]; then
32
- echo -e "${CYAN}[Guidance] Source module - follow ADR guidelines${RESET}"
31
+ if [[ "$FILE_PATH" =~ ^v3/ ]]; then
32
+ echo -e "${CYAN}[Guidance] V3 module - follow ADR guidelines${RESET}"
33
33
  fi
34
34
  fi
35
35
  exit 0
@@ -50,8 +50,37 @@ const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
50
50
  // Get the command from argv
51
51
  const [,, command, ...args] = process.argv;
52
52
 
53
- // Get prompt from environment variable (set by Claude Code hooks)
54
- const prompt = process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';
53
+ // Read stdin with timeout Claude Code sends hook data as JSON via stdin.
54
+ // Timeout prevents hanging when stdin is not properly closed (common on Windows).
55
+ async function readStdin() {
56
+ if (process.stdin.isTTY) return '';
57
+ return new Promise((resolve) => {
58
+ let data = '';
59
+ const timer = setTimeout(() => {
60
+ process.stdin.removeAllListeners();
61
+ process.stdin.pause();
62
+ resolve(data);
63
+ }, 500);
64
+ process.stdin.setEncoding('utf8');
65
+ process.stdin.on('data', (chunk) => { data += chunk; });
66
+ process.stdin.on('end', () => { clearTimeout(timer); resolve(data); });
67
+ process.stdin.on('error', () => { clearTimeout(timer); resolve(data); });
68
+ process.stdin.resume();
69
+ });
70
+ }
71
+
72
+ async function main() {
73
+ let stdinData = '';
74
+ try { stdinData = await readStdin(); } catch (e) { /* ignore stdin errors */ }
75
+
76
+ let hookInput = {};
77
+ if (stdinData.trim()) {
78
+ try { hookInput = JSON.parse(stdinData); } catch (e) { /* ignore parse errors */ }
79
+ }
80
+
81
+ // Merge stdin data into prompt resolution: prefer stdin fields, then env, then argv
82
+ const prompt = hookInput.prompt || hookInput.command || hookInput.toolInput
83
+ || process.env.PROMPT || process.env.TOOL_INPUT_command || args.join(' ') || '';
55
84
 
56
85
  const handlers = {
57
86
  'route': () => {
@@ -105,8 +134,8 @@ const handlers = {
105
134
  },
106
135
 
107
136
  'pre-bash': () => {
108
- // Basic command safety check
109
- const cmd = prompt.toLowerCase();
137
+ // Basic command safety check — prefer stdin command data from Claude Code
138
+ const cmd = (hookInput.command || prompt).toLowerCase();
110
139
  const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:'];
111
140
  for (const d of dangerous) {
112
141
  if (cmd.includes(d)) {
@@ -122,10 +151,11 @@ const handlers = {
122
151
  if (session && session.metric) {
123
152
  try { session.metric('edits'); } catch (e) { /* no active session */ }
124
153
  }
125
- // Record edit for intelligence consolidation
154
+ // Record edit for intelligence consolidation — prefer stdin data from Claude Code
126
155
  if (intelligence && intelligence.recordEdit) {
127
156
  try {
128
- const file = process.env.TOOL_INPUT_file_path || args[0] || '';
157
+ const file = hookInput.file_path || (hookInput.toolInput && hookInput.toolInput.file_path)
158
+ || process.env.TOOL_INPUT_file_path || args[0] || '';
129
159
  intelligence.recordEdit(file);
130
160
  } catch (e) { /* non-fatal */ }
131
161
  }
@@ -216,17 +246,26 @@ const handlers = {
216
246
  },
217
247
  };
218
248
 
219
- // Execute the handler
220
- if (command && handlers[command]) {
221
- try {
222
- handlers[command]();
223
- } catch (e) {
224
- // Hooks should never crash Claude Code - fail silently
225
- console.log(`[WARN] Hook ${command} encountered an error: ${e.message}`);
249
+ // Execute the handler
250
+ if (command && handlers[command]) {
251
+ try {
252
+ handlers[command]();
253
+ } catch (e) {
254
+ // Hooks should never crash Claude Code - fail silently
255
+ console.log(`[WARN] Hook ${command} encountered an error: ${e.message}`);
256
+ }
257
+ } else if (command) {
258
+ // Unknown command - pass through without error
259
+ console.log(`[OK] Hook: ${command}`);
260
+ } else {
261
+ console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|stats>');
226
262
  }
227
- } else if (command) {
228
- // Unknown command - pass through without error
229
- console.log(`[OK] Hook: ${command}`);
230
- } else {
231
- console.log('Usage: hook-handler.cjs <route|pre-bash|post-edit|session-restore|session-end|pre-task|post-task|stats>');
232
263
  }
264
+
265
+ // Hooks must ALWAYS exit 0 — Claude Code treats non-zero as "hook error"
266
+ // and skips all subsequent hooks for the event.
267
+ process.exitCode = 0;
268
+ main().catch((e) => {
269
+ try { console.log(`[WARN] Hook handler error: ${e.message}`); } catch (_) {}
270
+ process.exitCode = 0;
271
+ });