@monoes/monomindcli 1.19.0 → 2.0.0

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 (369) hide show
  1. package/.claude/agents/github/issue-tracker.md +0 -2
  2. package/.claude/agents/github/pr-manager.md +0 -2
  3. package/.claude/agents/github/repo-architect.md +3 -11
  4. package/.claude/agents/goal/goal-planner.md +0 -1
  5. package/.claude/commands/github/issue-tracker.md +0 -2
  6. package/.claude/commands/github/pr-manager.md +0 -2
  7. package/.claude/commands/github/repo-architect.md +3 -10
  8. package/.claude/commands/mastermind/help.md +3 -3
  9. package/.claude/commands/workflows/README.md +0 -1
  10. package/.claude/commands/workflows/workflow-create.md +0 -1
  11. package/.claude/commands/workflows/workflow-execute.md +1 -3
  12. package/.claude/commands/workflows/workflow-export.md +0 -2
  13. package/.claude/helpers/handlers/agent-start-handler.cjs +18 -1
  14. package/.claude/helpers/handlers/edit-handler.cjs +15 -0
  15. package/.claude/helpers/handlers/gates-handler.cjs +2 -8
  16. package/.claude/helpers/handlers/route-handler.cjs +149 -7
  17. package/.claude/helpers/handlers/session-handler.cjs +47 -25
  18. package/.claude/helpers/handlers/session-restore-handler.cjs +80 -43
  19. package/.claude/helpers/handlers/task-handler.cjs +8 -4
  20. package/.claude/helpers/hook-handler.cjs +69 -16
  21. package/.claude/helpers/intelligence.cjs +100 -9
  22. package/.claude/helpers/router.cjs +78 -5
  23. package/.claude/helpers/skill-registry.json +0 -189
  24. package/.claude/skills/github-toolkit/SKILL.md +60 -0
  25. package/.claude/skills/hive-mind-advanced/SKILL.md +0 -15
  26. package/.claude/skills/hooks-automation/SKILL.md +0 -1
  27. package/.claude/skills/mastermind-skills/_protocol.md +1 -1
  28. package/.claude/skills/mastermind-skills/build.md +1 -2
  29. package/.claude/skills/memory-toolkit/SKILL.md +75 -0
  30. package/.claude/skills/specialagent/SKILL.md +2 -4
  31. package/.claude/skills/swarm-advanced/SKILL.md +0 -1
  32. package/README.md +2 -5
  33. package/dist/src/autopilot-state.d.ts.map +1 -1
  34. package/dist/src/autopilot-state.js +4 -5
  35. package/dist/src/autopilot-state.js.map +1 -1
  36. package/dist/src/browser/dashboard/server.d.ts.map +1 -1
  37. package/dist/src/browser/dashboard/server.js +69 -1
  38. package/dist/src/browser/dashboard/server.js.map +1 -1
  39. package/dist/src/browser/dashboard/ui.html +214 -1764
  40. package/dist/src/capabilities/index.d.ts +0 -2
  41. package/dist/src/capabilities/index.d.ts.map +1 -1
  42. package/dist/src/capabilities/index.js +0 -1
  43. package/dist/src/capabilities/index.js.map +1 -1
  44. package/dist/src/commands/agent-lifecycle.d.ts.map +1 -1
  45. package/dist/src/commands/agent-lifecycle.js +2 -6
  46. package/dist/src/commands/agent-lifecycle.js.map +1 -1
  47. package/dist/src/commands/analyze.d.ts +0 -4
  48. package/dist/src/commands/analyze.d.ts.map +1 -1
  49. package/dist/src/commands/analyze.js +1 -29
  50. package/dist/src/commands/analyze.js.map +1 -1
  51. package/dist/src/commands/completions.d.ts.map +1 -1
  52. package/dist/src/commands/completions.js +3 -22
  53. package/dist/src/commands/completions.js.map +1 -1
  54. package/dist/src/commands/config.d.ts.map +1 -1
  55. package/dist/src/commands/config.js +0 -6
  56. package/dist/src/commands/config.js.map +1 -1
  57. package/dist/src/commands/doctor-project-checks.d.ts +12 -2
  58. package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
  59. package/dist/src/commands/doctor-project-checks.js +130 -22
  60. package/dist/src/commands/doctor-project-checks.js.map +1 -1
  61. package/dist/src/commands/doctor.d.ts.map +1 -1
  62. package/dist/src/commands/doctor.js +6 -5
  63. package/dist/src/commands/doctor.js.map +1 -1
  64. package/dist/src/commands/guidance.d.ts +5 -1
  65. package/dist/src/commands/guidance.d.ts.map +1 -1
  66. package/dist/src/commands/guidance.js +11 -556
  67. package/dist/src/commands/guidance.js.map +1 -1
  68. package/dist/src/commands/hive-mind-comms.d.ts.map +1 -1
  69. package/dist/src/commands/hive-mind-comms.js +11 -4
  70. package/dist/src/commands/hive-mind-comms.js.map +1 -1
  71. package/dist/src/commands/hive-mind.d.ts +4 -4
  72. package/dist/src/commands/hive-mind.d.ts.map +1 -1
  73. package/dist/src/commands/hive-mind.js +9 -6
  74. package/dist/src/commands/hive-mind.js.map +1 -1
  75. package/dist/src/commands/hooks-formatting.d.ts +1 -5
  76. package/dist/src/commands/hooks-formatting.d.ts.map +1 -1
  77. package/dist/src/commands/hooks-formatting.js +1 -18
  78. package/dist/src/commands/hooks-formatting.js.map +1 -1
  79. package/dist/src/commands/hooks-workers.d.ts +1 -1
  80. package/dist/src/commands/hooks-workers.d.ts.map +1 -1
  81. package/dist/src/commands/hooks-workers.js +82 -330
  82. package/dist/src/commands/hooks-workers.js.map +1 -1
  83. package/dist/src/commands/index.d.ts +0 -5
  84. package/dist/src/commands/index.d.ts.map +1 -1
  85. package/dist/src/commands/index.js +0 -45
  86. package/dist/src/commands/index.js.map +1 -1
  87. package/dist/src/commands/init-wizard.js +1 -1
  88. package/dist/src/commands/init-wizard.js.map +1 -1
  89. package/dist/src/commands/init.d.ts.map +1 -1
  90. package/dist/src/commands/init.js +4 -24
  91. package/dist/src/commands/init.js.map +1 -1
  92. package/dist/src/commands/neural-core.js +11 -11
  93. package/dist/src/commands/neural-core.js.map +1 -1
  94. package/dist/src/commands/neural-optimize.d.ts.map +1 -1
  95. package/dist/src/commands/neural-optimize.js +9 -11
  96. package/dist/src/commands/neural-optimize.js.map +1 -1
  97. package/dist/src/commands/neural-registry.js +10 -10
  98. package/dist/src/commands/neural-registry.js.map +1 -1
  99. package/dist/src/commands/providers.d.ts.map +1 -1
  100. package/dist/src/commands/providers.js +90 -1
  101. package/dist/src/commands/providers.js.map +1 -1
  102. package/dist/src/commands/search-universal.d.ts +7 -1
  103. package/dist/src/commands/search-universal.d.ts.map +1 -1
  104. package/dist/src/commands/search-universal.js +59 -5
  105. package/dist/src/commands/search-universal.js.map +1 -1
  106. package/dist/src/commands/security-cve.d.ts.map +1 -1
  107. package/dist/src/commands/security-cve.js +3 -5
  108. package/dist/src/commands/security-cve.js.map +1 -1
  109. package/dist/src/commands/session.d.ts.map +1 -1
  110. package/dist/src/commands/session.js +143 -3
  111. package/dist/src/commands/session.js.map +1 -1
  112. package/dist/src/commands/start.d.ts.map +1 -1
  113. package/dist/src/commands/start.js +0 -18
  114. package/dist/src/commands/start.js.map +1 -1
  115. package/dist/src/commands/swarm.d.ts.map +1 -1
  116. package/dist/src/commands/swarm.js +112 -65
  117. package/dist/src/commands/swarm.js.map +1 -1
  118. package/dist/src/consensus/audit-writer.d.ts.map +1 -1
  119. package/dist/src/consensus/audit-writer.js +43 -1
  120. package/dist/src/consensus/audit-writer.js.map +1 -1
  121. package/dist/src/consensus/tally.d.ts +19 -0
  122. package/dist/src/consensus/tally.d.ts.map +1 -0
  123. package/dist/src/consensus/tally.js +34 -0
  124. package/dist/src/consensus/tally.js.map +1 -0
  125. package/dist/src/index.d.ts +3 -2
  126. package/dist/src/index.d.ts.map +1 -1
  127. package/dist/src/index.js +9 -12
  128. package/dist/src/index.js.map +1 -1
  129. package/dist/src/init/claudemd-generator.d.ts.map +1 -1
  130. package/dist/src/init/claudemd-generator.js +10 -14
  131. package/dist/src/init/claudemd-generator.js.map +1 -1
  132. package/dist/src/init/executor.d.ts.map +1 -1
  133. package/dist/src/init/executor.js +39 -86
  134. package/dist/src/init/executor.js.map +1 -1
  135. package/dist/src/init/settings-generator.d.ts.map +1 -1
  136. package/dist/src/init/settings-generator.js +0 -12
  137. package/dist/src/init/settings-generator.js.map +1 -1
  138. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  139. package/dist/src/init/statusline-generator.js +62 -0
  140. package/dist/src/init/statusline-generator.js.map +1 -1
  141. package/dist/src/init/types.d.ts +2 -6
  142. package/dist/src/init/types.d.ts.map +1 -1
  143. package/dist/src/init/types.js +0 -3
  144. package/dist/src/init/types.js.map +1 -1
  145. package/dist/src/knowledge/document-pipeline.d.ts.map +1 -1
  146. package/dist/src/knowledge/document-pipeline.js +18 -8
  147. package/dist/src/knowledge/document-pipeline.js.map +1 -1
  148. package/dist/src/mcp-client.d.ts.map +1 -1
  149. package/dist/src/mcp-client.js +0 -2
  150. package/dist/src/mcp-client.js.map +1 -1
  151. package/dist/src/mcp-server.d.ts.map +1 -1
  152. package/dist/src/mcp-server.js +12 -14
  153. package/dist/src/mcp-server.js.map +1 -1
  154. package/dist/src/mcp-tools/coherence/coherence-check.d.ts.map +1 -1
  155. package/dist/src/mcp-tools/coherence/coherence-check.js +1 -19
  156. package/dist/src/mcp-tools/coherence/coherence-check.js.map +1 -1
  157. package/dist/src/mcp-tools/coherence/types.d.ts +3 -2
  158. package/dist/src/mcp-tools/coherence/types.d.ts.map +1 -1
  159. package/dist/src/mcp-tools/coherence/types.js +3 -18
  160. package/dist/src/mcp-tools/coherence/types.js.map +1 -1
  161. package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -1
  162. package/dist/src/mcp-tools/embeddings-tools.js +1 -7
  163. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  164. package/dist/src/mcp-tools/graphify-tools.js +2 -2
  165. package/dist/src/mcp-tools/graphify-tools.js.map +1 -1
  166. package/dist/src/mcp-tools/guidance-tools.d.ts.map +1 -1
  167. package/dist/src/mcp-tools/guidance-tools.js +7 -17
  168. package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
  169. package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -1
  170. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  171. package/dist/src/mcp-tools/hive-mind-tools.js +174 -38
  172. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  173. package/dist/src/mcp-tools/hooks-advanced.d.ts +18 -0
  174. package/dist/src/mcp-tools/hooks-advanced.d.ts.map +1 -0
  175. package/dist/src/mcp-tools/hooks-advanced.js +25 -0
  176. package/dist/src/mcp-tools/hooks-advanced.js.map +1 -0
  177. package/dist/src/mcp-tools/hooks-intelligence.d.ts +4 -8
  178. package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
  179. package/dist/src/mcp-tools/hooks-intelligence.js +33 -482
  180. package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
  181. package/dist/src/mcp-tools/hooks-routing.d.ts +1 -0
  182. package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
  183. package/dist/src/mcp-tools/hooks-routing.js +51 -43
  184. package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
  185. package/dist/src/mcp-tools/hooks-synthesis.d.ts +31 -0
  186. package/dist/src/mcp-tools/hooks-synthesis.d.ts.map +1 -0
  187. package/dist/src/mcp-tools/hooks-synthesis.js +196 -0
  188. package/dist/src/mcp-tools/hooks-synthesis.js.map +1 -0
  189. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  190. package/dist/src/mcp-tools/hooks-tools.js +10 -8
  191. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  192. package/dist/src/mcp-tools/index.d.ts +0 -1
  193. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  194. package/dist/src/mcp-tools/index.js +0 -1
  195. package/dist/src/mcp-tools/index.js.map +1 -1
  196. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  197. package/dist/src/mcp-tools/memory-tools.js +20 -29
  198. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  199. package/dist/src/mcp-tools/monograph-tools.d.ts +6 -0
  200. package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
  201. package/dist/src/mcp-tools/monograph-tools.js +78 -220
  202. package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/neural-tools.d.ts +9 -4
  204. package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
  205. package/dist/src/mcp-tools/neural-tools.js +242 -506
  206. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  207. package/dist/src/mcp-tools/security-tools.d.ts.map +1 -1
  208. package/dist/src/mcp-tools/security-tools.js +103 -0
  209. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  210. package/dist/src/memory/intelligence.d.ts +2 -1
  211. package/dist/src/memory/intelligence.d.ts.map +1 -1
  212. package/dist/src/memory/intelligence.js +56 -43
  213. package/dist/src/memory/intelligence.js.map +1 -1
  214. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  215. package/dist/src/memory/memory-bridge.js +14 -9
  216. package/dist/src/memory/memory-bridge.js.map +1 -1
  217. package/dist/src/memory/memory-read.d.ts.map +1 -1
  218. package/dist/src/memory/memory-read.js +1 -19
  219. package/dist/src/memory/memory-read.js.map +1 -1
  220. package/dist/src/suggest.d.ts.map +1 -1
  221. package/dist/src/suggest.js +1 -7
  222. package/dist/src/suggest.js.map +1 -1
  223. package/dist/src/transfer/store/discovery.d.ts +3 -2
  224. package/dist/src/transfer/store/discovery.d.ts.map +1 -1
  225. package/dist/src/transfer/store/discovery.js +22 -70
  226. package/dist/src/transfer/store/discovery.js.map +1 -1
  227. package/dist/src/update/checker.d.ts.map +1 -1
  228. package/dist/src/update/checker.js +0 -1
  229. package/dist/src/update/checker.js.map +1 -1
  230. package/dist/src/utils/cosine-similarity.d.ts +22 -0
  231. package/dist/src/utils/cosine-similarity.d.ts.map +1 -0
  232. package/dist/src/utils/cosine-similarity.js +38 -0
  233. package/dist/src/utils/cosine-similarity.js.map +1 -0
  234. package/dist/src/utils/input-guards.d.ts +51 -0
  235. package/dist/src/utils/input-guards.d.ts.map +1 -0
  236. package/dist/src/utils/input-guards.js +223 -0
  237. package/dist/src/utils/input-guards.js.map +1 -0
  238. package/dist/src/utils/json-file.d.ts +33 -0
  239. package/dist/src/utils/json-file.d.ts.map +1 -0
  240. package/dist/src/utils/json-file.js +57 -0
  241. package/dist/src/utils/json-file.js.map +1 -0
  242. package/dist/tsconfig.tsbuildinfo +1 -1
  243. package/package.json +9 -6
  244. package/scripts/sync-claude-assets.sh +16 -20
  245. package/.claude/agents/generated/case-analyst.md +0 -50
  246. package/.claude/agents/generated/channel-intelligence-director.md +0 -87
  247. package/.claude/agents/generated/chief-growth-officer.md +0 -88
  248. package/.claude/agents/generated/churn-analyst.md +0 -53
  249. package/.claude/agents/generated/code-reviewer.md +0 -55
  250. package/.claude/agents/generated/code-validator.md +0 -57
  251. package/.claude/agents/generated/complexity-scanner.md +0 -56
  252. package/.claude/agents/generated/content-seo-strategist.md +0 -90
  253. package/.claude/agents/generated/copy-editor.md +0 -45
  254. package/.claude/agents/generated/court-reporter.md +0 -50
  255. package/.claude/agents/generated/defender.md +0 -51
  256. package/.claude/agents/generated/devbot-orchestrator.md +0 -58
  257. package/.claude/agents/generated/devbot-planner.md +0 -63
  258. package/.claude/agents/generated/developer-community-strategist.md +0 -91
  259. package/.claude/agents/generated/editor-in-chief.md +0 -45
  260. package/.claude/agents/generated/fact-checker.md +0 -45
  261. package/.claude/agents/generated/impact-assessor.md +0 -54
  262. package/.claude/agents/generated/judge.md +0 -51
  263. package/.claude/agents/generated/outreach-partnership-strategist.md +0 -90
  264. package/.claude/agents/generated/prosecutor.md +0 -51
  265. package/.claude/agents/generated/reporter.md +0 -45
  266. package/.claude/agents/generated/social-media-strategist.md +0 -91
  267. package/.claude/agents/generated/video-visual-strategist.md +0 -90
  268. package/.claude/agents/reengineer-squad/boss.md +0 -113
  269. package/.claude/agents/reengineer-squad/critic-architect.md +0 -132
  270. package/.claude/agents/reengineer-squad/git-manager.md +0 -145
  271. package/.claude/agents/reengineer-squad/idea-generator.md +0 -95
  272. package/.claude/agents/reengineer-squad/implementer.md +0 -112
  273. package/.claude/agents/reengineer-squad/integration-planner.md +0 -112
  274. package/.claude/agents/reengineer-squad/source-analyst.md +0 -103
  275. package/.claude/agents/reengineer-squad/target-analyst.md +0 -118
  276. package/.claude/agents/reengineer-squad/tester.md +0 -105
  277. package/.claude/agents/sparc/architecture.md +0 -453
  278. package/.claude/agents/sparc/pseudocode.md +0 -299
  279. package/.claude/agents/sparc/refinement.md +0 -504
  280. package/.claude/agents/sparc/specification.md +0 -258
  281. package/.claude/agents/templates/implementer-sparc-coder.md +0 -231
  282. package/.claude/commands/sparc/analyzer.md +0 -35
  283. package/.claude/commands/sparc/architect.md +0 -36
  284. package/.claude/commands/sparc/ask.md +0 -56
  285. package/.claude/commands/sparc/batch-executor.md +0 -37
  286. package/.claude/commands/sparc/code.md +0 -48
  287. package/.claude/commands/sparc/coder.md +0 -37
  288. package/.claude/commands/sparc/debug.md +0 -42
  289. package/.claude/commands/sparc/debugger.md +0 -37
  290. package/.claude/commands/sparc/designer.md +0 -36
  291. package/.claude/commands/sparc/devops.md +0 -68
  292. package/.claude/commands/sparc/docs-writer.md +0 -39
  293. package/.claude/commands/sparc/documenter.md +0 -37
  294. package/.claude/commands/sparc/innovator.md +0 -37
  295. package/.claude/commands/sparc/integration.md +0 -42
  296. package/.claude/commands/sparc/mcp.md +0 -76
  297. package/.claude/commands/sparc/memory-manager.md +0 -57
  298. package/.claude/commands/sparc/optimizer.md +0 -37
  299. package/.claude/commands/sparc/orchestrator.md +0 -70
  300. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -42
  301. package/.claude/commands/sparc/refinement-optimization-mode.md +0 -42
  302. package/.claude/commands/sparc/researcher.md +0 -37
  303. package/.claude/commands/sparc/reviewer.md +0 -37
  304. package/.claude/commands/sparc/security-review.md +0 -39
  305. package/.claude/commands/sparc/sparc-modes.md +0 -120
  306. package/.claude/commands/sparc/sparc.md +0 -71
  307. package/.claude/commands/sparc/spec-pseudocode.md +0 -39
  308. package/.claude/commands/sparc/supabase-admin.md +0 -301
  309. package/.claude/commands/sparc/swarm-coordinator.md +0 -50
  310. package/.claude/commands/sparc/tdd.md +0 -37
  311. package/.claude/commands/sparc/tester.md +0 -37
  312. package/.claude/commands/sparc/tutorial.md +0 -38
  313. package/.claude/commands/sparc/workflow-manager.md +0 -37
  314. package/.claude/commands/sparc.md +0 -112
  315. package/.claude/skills/sparc-methodology/SKILL.md +0 -950
  316. package/dist/src/capabilities/enrichment.d.ts +0 -44
  317. package/dist/src/capabilities/enrichment.d.ts.map +0 -1
  318. package/dist/src/capabilities/enrichment.js +0 -141
  319. package/dist/src/capabilities/enrichment.js.map +0 -1
  320. package/dist/src/commands/analyze-boundaries.d.ts +0 -14
  321. package/dist/src/commands/analyze-boundaries.d.ts.map +0 -1
  322. package/dist/src/commands/analyze-boundaries.js +0 -295
  323. package/dist/src/commands/analyze-boundaries.js.map +0 -1
  324. package/dist/src/commands/analyze-graph.d.ts +0 -14
  325. package/dist/src/commands/analyze-graph.d.ts.map +0 -1
  326. package/dist/src/commands/analyze-graph.js +0 -304
  327. package/dist/src/commands/analyze-graph.js.map +0 -1
  328. package/dist/src/commands/claims.d.ts +0 -10
  329. package/dist/src/commands/claims.d.ts.map +0 -1
  330. package/dist/src/commands/claims.js +0 -650
  331. package/dist/src/commands/claims.js.map +0 -1
  332. package/dist/src/commands/daemon.d.ts +0 -8
  333. package/dist/src/commands/daemon.d.ts.map +0 -1
  334. package/dist/src/commands/daemon.js +0 -681
  335. package/dist/src/commands/daemon.js.map +0 -1
  336. package/dist/src/commands/enrich.d.ts +0 -10
  337. package/dist/src/commands/enrich.d.ts.map +0 -1
  338. package/dist/src/commands/enrich.js +0 -58
  339. package/dist/src/commands/enrich.js.map +0 -1
  340. package/dist/src/commands/issues.d.ts +0 -21
  341. package/dist/src/commands/issues.d.ts.map +0 -1
  342. package/dist/src/commands/issues.js +0 -575
  343. package/dist/src/commands/issues.js.map +0 -1
  344. package/dist/src/commands/workflow.d.ts +0 -8
  345. package/dist/src/commands/workflow.d.ts.map +0 -1
  346. package/dist/src/commands/workflow.js +0 -575
  347. package/dist/src/commands/workflow.js.map +0 -1
  348. package/dist/src/mcp-tools/workflow-tools.d.ts +0 -8
  349. package/dist/src/mcp-tools/workflow-tools.d.ts.map +0 -1
  350. package/dist/src/mcp-tools/workflow-tools.js +0 -717
  351. package/dist/src/mcp-tools/workflow-tools.js.map +0 -1
  352. package/dist/src/services/claim-service.d.ts +0 -198
  353. package/dist/src/services/claim-service.d.ts.map +0 -1
  354. package/dist/src/services/claim-service.js +0 -890
  355. package/dist/src/services/claim-service.js.map +0 -1
  356. package/dist/src/services/headless-worker-executor.d.ts +0 -311
  357. package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
  358. package/dist/src/services/headless-worker-executor.js +0 -1183
  359. package/dist/src/services/headless-worker-executor.js.map +0 -1
  360. package/dist/src/services/worker-daemon.d.ts +0 -230
  361. package/dist/src/services/worker-daemon.d.ts.map +0 -1
  362. package/dist/src/services/worker-daemon.js +0 -1350
  363. package/dist/src/services/worker-daemon.js.map +0 -1
  364. package/dist/src/ui/.monomind/capture/active-run.json +0 -1
  365. package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/real-events-1782290897.convs.jsonl +0 -3
  366. package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/real-events-1782290897.jsonl +0 -11
  367. package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/rigid-qa-restart-1782288201.jsonl +0 -540
  368. package/dist/src/ui/.monomind/orgs/system-trial-qa-threads.jsonl +0 -3
  369. package/dist/src/ui/.monomind/orgs/test-event-fix/runs/rigid-qa-restart-1782288201.jsonl +0 -2
@@ -281,8 +281,6 @@ Updates will be posted automatically by swarm agents during implementation.
281
281
  ### Seamless integration with:
282
282
  - `/github pr-manager` - Link issues to pull requests
283
283
  - `/github release-manager` - Coordinate release issues
284
- - `/sparc orchestrator` - Complex project coordination
285
- - `/sparc tester` - Automated testing workflows
286
284
 
287
285
  ## Metrics and Analytics
288
286
 
@@ -145,8 +145,6 @@ mcp__monomind__memory_store {
145
145
  - `/github issue-tracker` - For project coordination
146
146
  - `/github branch-manager` - For branch strategy
147
147
  - `/github ci-orchestrator` - For CI/CD integration
148
- - `/sparc reviewer` - For detailed code analysis
149
- - `/sparc tester` - For comprehensive testing
150
148
 
151
149
  ## Error Handling
152
150
 
@@ -72,8 +72,8 @@ mcp__github__push_files {
72
72
  content: "[GitHub modes template]"
73
73
  },
74
74
  {
75
- path: ".claude/commands/sparc/sparc-modes.md",
76
- content: "[SPARC modes template]"
75
+ path: ".claude/commands/mastermind/help.md",
76
+ content: "[Mastermind commands template]"
77
77
  },
78
78
  {
79
79
  path: ".claude/settings.json",
@@ -116,7 +116,6 @@ npx monomind@latest mcp start
116
116
 
117
117
  ## Features
118
118
  - Monomind swarm coordination
119
- - SPARC development modes
120
119
  - GitHub workflow automation
121
120
  - Knowledge graph integration
122
121
 
@@ -270,16 +269,11 @@ monomind/
270
269
  │ │ ├── pr-manager.md
271
270
  │ │ ├── issue-tracker.md
272
271
  │ │ └── sync-coordinator.md
273
- │ ├── sparc/
274
- │ │ ├── sparc-modes.md
275
- │ │ ├── coder.md
276
- │ │ └── tester.md
277
272
  │ └── swarm/
278
273
  │ ├── coordination.md
279
274
  │ └── orchestration.md
280
275
  ├── agents/
281
- ├── github/
282
- │ └── sparc/
276
+ └── github/
283
277
  └── settings.json
284
278
  ```
285
279
 
@@ -355,5 +349,3 @@ const integrationPattern = {
355
349
 
356
350
  - `/github sync-coordinator` - For cross-repo synchronization
357
351
  - `/github release-manager` - For coordinated releases
358
- - `/sparc architect` - For detailed architecture design
359
- - `/sparc optimizer` - For performance optimization
@@ -140,7 +140,6 @@ When handling requests:
140
140
  Integration with Monomind:
141
141
  - Coordinate with other specialized agents for specific actions
142
142
  - Use swarm coordination for parallel action execution
143
- - Leverage SPARC methodology for structured development tasks
144
143
  - Apply concurrent execution patterns from CLAUDE.md
145
144
 
146
145
  Advanced swarm coordination patterns:
@@ -275,8 +275,6 @@ Generated with Claude Code
275
275
  ### Seamless integration with:
276
276
  - `/github pr-manager` - Link issues to pull requests
277
277
  - `/github release-manager` - Coordinate release issues
278
- - `/sparc orchestrator` - Complex project coordination
279
- - `/sparc tester` - Automated testing workflows
280
278
 
281
279
  ## Metrics and Analytics
282
280
 
@@ -155,8 +155,6 @@ mcp__monomind__memory_store {
155
155
  - `/github issue-tracker` - For project coordination
156
156
  - `/github branch-manager` - For branch strategy
157
157
  - `/github ci-orchestrator` - For CI/CD integration
158
- - `/sparc reviewer` - For detailed code analysis
159
- - `/sparc tester` - For comprehensive testing
160
158
 
161
159
  ## Error Handling
162
160
 
@@ -78,8 +78,8 @@ mcp__github__push_files {
78
78
  content: "[GitHub modes template]"
79
79
  },
80
80
  {
81
- path: ".claude/commands/sparc/sparc-modes.md",
82
- content: "[SPARC modes template]"
81
+ path: ".claude/commands/mastermind/help.md",
82
+ content: "[Mastermind commands template]"
83
83
  },
84
84
  {
85
85
  path: ".claude/config.json",
@@ -121,14 +121,13 @@ mcp__github__push_files {
121
121
 
122
122
  ## Quick Start
123
123
  \`\`\`bash
124
- npx monomind init --sparc
124
+ npx monomind init
125
125
  npm install
126
126
  npx monomind start --ui
127
127
  \`\`\`
128
128
 
129
129
  ## Features
130
130
  - Monomind swarm integration
131
- - SPARC development modes
132
131
  - GitHub workflow automation
133
132
  - Advanced coordination capabilities
134
133
 
@@ -280,10 +279,6 @@ monomind/
280
279
  │ │ ├── pr-manager.md
281
280
  │ │ ├── issue-tracker.md
282
281
  │ │ └── sync-coordinator.md
283
- │ ├── sparc/
284
- │ │ ├── sparc-modes.md
285
- │ │ ├── coder.md
286
- │ │ └── tester.md
287
282
  │ └── swarm/
288
283
  │ ├── coordination.md
289
284
  │ └── orchestration.md
@@ -368,8 +363,6 @@ const integrationPattern = {
368
363
 
369
364
  - `/github sync-coordinator` - For cross-repo synchronization
370
365
  - `/github release-manager` - For coordinated releases
371
- - `/sparc architect` - For detailed architecture design
372
- - `/sparc optimizer` - For performance optimization
373
366
 
374
367
  ### Workflow Enhancement:
375
368
 
@@ -57,8 +57,8 @@ npx monomind monograph search -q "authentication"
57
57
  npx monomind monograph stats
58
58
 
59
59
  # Pattern logging
60
- npx monomind neural patterns --action list
61
- npx monomind neural status --verbose
60
+ npx monomind hooks intelligence patterns --action list
61
+ npx monomind hooks intelligence status --verbose
62
62
 
63
63
  # Hooks
64
64
  npx monomind hooks pre-task --description "task description"
@@ -78,7 +78,7 @@ npx monomind performance benchmark --suite all
78
78
 
79
79
  ## Built-in Workflow Templates
80
80
 
81
- `development`, `research`, `testing`, `security-audit`, `code-review`, `refactoring`, `sparc`, `custom`
81
+ `development`, `research`, `testing`, `security-audit`, `code-review`, `refactoring`, `custom`
82
82
 
83
83
  ## Swarm Topologies
84
84
 
@@ -51,7 +51,6 @@ npx monomind workflow template create --name "my-workflow"
51
51
  | `security-audit` | Threat Model → Static → Dynamic → Report | security-architect, auditor |
52
52
  | `code-review` | Initial → Security → Quality → Feedback | reviewer, auditor, analyst |
53
53
  | `refactoring` | Analysis → Planning → Refactor → Validation | architect, coder, reviewer |
54
- | `sparc` | Spec → Pseudocode → Architecture → Refinement → Completion | architect, coder, tester, reviewer |
55
54
  | `custom` | Define your own stages | configurable |
56
55
 
57
56
  ## MCP Tools
@@ -29,7 +29,6 @@ npx monomind workflow template list
29
29
 
30
30
  # Show a specific template's stages and agents
31
31
  npx monomind workflow template show development
32
- npx monomind workflow template show sparc
33
32
  ```
34
33
 
35
34
  ## Template Create Flags
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: workflows:workflow-execute
3
- description: Run multi-agent workflows using built-in templates (development, research, testing, sparc, security-audit, etc.) via real npx monomind workflow run CLI
3
+ description: Run multi-agent workflows using built-in templates (development, research, testing, security-audit, etc.) via real npx monomind workflow run CLI
4
4
  ---
5
5
 
6
6
  # Workflow Execute
@@ -23,7 +23,6 @@ npx monomind workflow run -t development --task "Build REST API with auth"
23
23
  npx monomind workflow run -t research --task "Analyze performance bottlenecks"
24
24
  npx monomind workflow run -t testing
25
25
  npx monomind workflow run -t security-audit
26
- npx monomind workflow run -t sparc --task "New payment module"
27
26
 
28
27
  # Run from a workflow file
29
28
  npx monomind workflow run -f ./workflow.yaml
@@ -55,7 +54,6 @@ npx monomind workflow run -t development --dry-run
55
54
  | `security-audit` | Threat Model → Static → Dynamic → Report | security-architect, auditor |
56
55
  | `code-review` | Initial → Security → Quality → Feedback | reviewer, auditor, analyst |
57
56
  | `refactoring` | Analysis → Planning → Refactor → Validation | architect, coder, reviewer |
58
- | `sparc` | Spec → Pseudocode → Architecture → Refinement → Completion | architect, coder, tester, reviewer |
59
57
  | `custom` | Define your own | configurable |
60
58
 
61
59
  ## MCP Tools
@@ -23,7 +23,6 @@ npx monomind workflow template list
23
23
 
24
24
  # Show details for a specific template (stages, agents, estimated duration)
25
25
  npx monomind workflow template show development
26
- npx monomind workflow template show sparc
27
26
  npx monomind workflow template show security-audit
28
27
 
29
28
  # Validate a custom workflow file
@@ -45,7 +44,6 @@ npx monomind workflow list --status all
45
44
  | `security-audit` | Threat Model → Static → Dynamic → Report | 20-40 min |
46
45
  | `code-review` | Initial → Security → Quality → Feedback | 10-25 min |
47
46
  | `refactoring` | Analysis → Planning → Refactor → Validation | 15-35 min |
48
- | `sparc` | Spec → Pseudocode → Architecture → Refinement → Completion | 25-45 min |
49
47
  | `custom` | Define your own stages | varies |
50
48
 
51
49
  ## MCP Tools
@@ -6,7 +6,7 @@ const path = require('path');
6
6
  const fs = require('fs');
7
7
 
8
8
  module.exports = {
9
- handle: function(hCtx) {
9
+ handle: async function(hCtx) {
10
10
  var hookInput = hCtx.hookInput;
11
11
  var CWD = hCtx.CWD;
12
12
  var _openMonographDb = hCtx._openMonographDb;
@@ -79,5 +79,22 @@ module.exports = {
79
79
  }
80
80
  }
81
81
  } catch (e) { /* non-fatal */ }
82
+
83
+ // Bridge to @monomind/hooks registry — fires AgentSpawn hooks (was previously never
84
+ // wired: HookEvent.AgentSpawn existed but no CJS handler ever fired it).
85
+ try {
86
+ var _hooksModule = hCtx._ensureHooksModule ? await hCtx._ensureHooksModule() : null;
87
+ if (_hooksModule && _hooksModule.executeHooks && _hooksModule.HookEvent) {
88
+ var agentTypeBridge = String(hookInput.subagent_type || hookInput.agentType || hookInput.agent_type || hookInput.agentSlug || 'unknown');
89
+ var agentDescBridge = String(hookInput.description || hookInput.prompt_description || '');
90
+ _hooksModule.executeHooks(_hooksModule.HookEvent.AgentSpawn, {
91
+ agent: {
92
+ id: hookInput.agentId || hookInput.agent_id || (agentTypeBridge + '-' + Date.now()),
93
+ type: agentTypeBridge,
94
+ description: agentDescBridge.slice(0, 500),
95
+ },
96
+ }, { continueOnError: true, timeout: 1500 }).catch(function() {});
97
+ }
98
+ } catch (e) { /* non-fatal */ }
82
99
  },
83
100
  };
@@ -140,6 +140,21 @@ module.exports = {
140
140
  }
141
141
  } catch (e) { /* non-fatal */ }
142
142
 
143
+ // Bridge to @monomind/hooks registry — fires PostEdit hooks (observability bus, guidance provider).
144
+ // Each hook event runs in a fresh process, so hCtx._hooksModule set by session-restore in an
145
+ // earlier invocation is never visible here — must (re)load lazily via _ensureHooksModule().
146
+ var _hooksModule = hCtx._hooksModule || (hCtx._ensureHooksModule ? await hCtx._ensureHooksModule() : null);
147
+ if (_hooksModule && _hooksModule.executeHooks && _hooksModule.HookEvent) {
148
+ try {
149
+ var editFileBridge = hookInput.file_path || toolInput.file_path
150
+ || process.env.TOOL_INPUT_file_path || args[0] || '';
151
+ _hooksModule.executeHooks(_hooksModule.HookEvent.PostEdit, {
152
+ file: { path: editFileBridge, operation: 'modify' },
153
+ duration: 0,
154
+ }, { continueOnError: true, timeout: 1500 }).catch(function() {});
155
+ } catch (e) { /* non-fatal */ }
156
+ }
157
+
143
158
  console.log('[OK] Edit recorded');
144
159
  }
145
160
  };
@@ -2,14 +2,8 @@
2
2
  * Enforcement Gates Handler
3
3
  *
4
4
  * Inline gate logic for PreToolUse hooks — no ESM/package dependency.
5
- *
6
- * Patterns are an INTENTIONAL SUPERSET of @monomind/guidance/src/gates.ts defaults:
7
- * - All categories from DEFAULT_GATE_CONFIG are covered here
8
- * - Many patterns are enhanced (e.g. --force-with-lease, -fr reversed flags, broader kubectl)
9
- * - Key thresholds MUST stay aligned: password/secret min length = 8 chars (both files)
10
- *
11
- * When updating patterns in gates.ts, check whether the corresponding pattern here
12
- * also needs updating — and vice versa.
5
+ * This regex table is the canonical (and only) gate definition; the former
6
+ * @monomind/guidance package it mirrored has been removed.
13
7
  *
14
8
  * Gates enforced at runtime:
15
9
  * pre-bash → destructive-ops (require-confirmation → block)
@@ -52,6 +52,14 @@ module.exports = {
52
52
 
53
53
  if (intelligence && intelligence.getContext) {
54
54
  try {
55
+ // Each hook event runs as a fresh node process, so the module-level
56
+ // _entries cache is always empty here — without init() getContext()
57
+ // returns null on every prompt and stored patterns are never recalled.
58
+ // init() reads one small JSON file (auto-memory-store.json), so the
59
+ // per-prompt cost is negligible.
60
+ if (intelligence.init) {
61
+ try { intelligence.init(); } catch (e) { /* non-fatal */ }
62
+ }
55
63
  // Bootstrap intelligence from monograph on first prompt if store is sparse
56
64
  if (intelligence.bootstrapFromDb) {
57
65
  try {
@@ -70,6 +78,43 @@ module.exports = {
70
78
  const routeFn = router.routeTaskSemantic || router.routeTask;
71
79
  var result = await Promise.resolve(routeFn(prompt));
72
80
 
81
+ // ── Enrichment: when router.cjs falls to the broad "coder" catch-all,
82
+ // try @monomind/routing's richer keyword pre-filter (30+ specialized
83
+ // rules for Solidity, game engines, DevOps, embedded, etc.) for a
84
+ // more specific agent match. This bridges the hooks layer (router.cjs)
85
+ // with the CLI routing package without requiring ESM imports. ─────────
86
+ if (result && result.agentSlug === 'coder' && result.confidence <= 0.8) {
87
+ try {
88
+ var routingPkgPath = path.resolve(
89
+ CWD, 'packages', '@monomind', 'routing', 'dist', 'keyword-pre-filter.js'
90
+ );
91
+ // Also check CLI's node_modules (symlinked workspace)
92
+ if (!fs.existsSync(routingPkgPath)) {
93
+ routingPkgPath = path.resolve(
94
+ CWD, 'packages', '@monomind', 'cli', 'node_modules',
95
+ '@monomind', 'routing', 'dist', 'keyword-pre-filter.js'
96
+ );
97
+ }
98
+ if (fs.existsSync(routingPkgPath)) {
99
+ var routingMod = await import(routingPkgPath);
100
+ var enrichRules = routingMod.DEFAULT_KEYWORD_ROUTES;
101
+ if (enrichRules && enrichRules.length > 0) {
102
+ for (var eri = 0; eri < enrichRules.length; eri++) {
103
+ var erRule = enrichRules[eri];
104
+ if (erRule.pattern && erRule.pattern.test(prompt)) {
105
+ result.agent = erRule.routeName || erRule.agentSlug;
106
+ result.agentSlug = erRule.agentSlug;
107
+ result.confidence = 0.90;
108
+ result.reason = 'Enriched: ' + (erRule.description || erRule.routeName);
109
+ result.enrichedFrom = 'routing-keyword-pre-filter';
110
+ break;
111
+ }
112
+ }
113
+ }
114
+ }
115
+ } catch (e) { /* non-fatal — routing package may not be available */ }
116
+ }
117
+
73
118
  // ── Agent success pattern lookup ──────────────────────────
74
119
  try {
75
120
  var patternDb = hCtx._openMonographDb();
@@ -113,7 +158,7 @@ module.exports = {
113
158
  for (var ri = 0; ri < recentRf.length; ri++) {
114
159
  try {
115
160
  var rfEntry = JSON.parse(recentRf[ri]);
116
- if (rfEntry.suggestedAgent === routedAgent) {
161
+ if (rfEntry.suggestedAgent === routedAgent && typeof rfEntry.intelligenceFeedback === 'boolean') {
117
162
  agentFeedback.push(rfEntry.intelligenceFeedback);
118
163
  }
119
164
  } catch (e) {}
@@ -133,6 +178,23 @@ module.exports = {
133
178
  // recommendations that are no longer injected into context. The statusline
134
179
  // just shows the keyword router's pick; no need for 50 lines of overrides.
135
180
 
181
+ // ── Dispatch dedup: suppress re-recommending the same agent just dispatched ──
182
+ // agent-start-handler writes last-dispatch.json on SubagentStart.
183
+ // If the router picks the same agent within 60s, it's likely the parent re-routing
184
+ // the same prompt — log a note so the LLM can vary its approach.
185
+ try {
186
+ var dispatchPath = path.join(CWD, '.monomind', 'last-dispatch.json');
187
+ var MAX_DISPATCH = 4096;
188
+ if (fs.existsSync(dispatchPath) && fs.statSync(dispatchPath).size <= MAX_DISPATCH) {
189
+ var lastDispatch = JSON.parse(fs.readFileSync(dispatchPath, 'utf-8'));
190
+ var dispatchAge = Date.now() - new Date(lastDispatch.dispatchedAt || 0).getTime();
191
+ if (dispatchAge < 60000 && lastDispatch.agentType === (result.agentSlug || result.agent)) {
192
+ result.recentlyDispatched = true;
193
+ console.log('[DISPATCH_DEDUP] ' + lastDispatch.agentType + ' was dispatched ' + Math.round(dispatchAge / 1000) + 's ago — consider a different specialist or direct implementation');
194
+ }
195
+ }
196
+ } catch (e) { /* non-fatal */ }
197
+
136
198
  var output = [];
137
199
  var conf = result.confidence != null ? result.confidence : 0;
138
200
 
@@ -226,12 +288,74 @@ module.exports = {
226
288
  console.log('[SECURITY] ' + secData.findings.length + ' findings from background scan. Review .monomind/metrics/security-audit.json');
227
289
  }
228
290
  }
229
- // Codebase map hotspots
291
+ // Codebase map top files (high-centrality god nodes from monograph)
230
292
  var mapFile = path.join(metricsDir, 'codebase-map.json');
231
293
  if (fs.existsSync(mapFile) && fs.statSync(mapFile).size < 32768) {
232
294
  var mapData = JSON.parse(fs.readFileSync(mapFile, 'utf-8'));
233
- if (mapData && mapData.hotspots && mapData.hotspots.length > 0) {
234
- console.log('[CODEBASE] ' + mapData.hotspots.length + ' hotspots detected. Top: ' + (mapData.hotspots[0].file || mapData.hotspots[0].name || 'unknown'));
295
+ if (mapData && mapData.topFiles && mapData.topFiles.length > 0) {
296
+ console.log('[CODEBASE] ' + mapData.topFiles.length + ' high-centrality files. Top: ' + (mapData.topFiles[0].ref || 'unknown') + ' (degree ' + (mapData.topFiles[0].degree || '?') + ')');
297
+ }
298
+ if (mapData && mapData.graphStaleness && mapData.graphStaleness.commitsBehind > 10) {
299
+ console.log('[CODEBASE] Graph index ' + mapData.graphStaleness.commitsBehind + ' commits behind HEAD — run monograph build');
300
+ }
301
+ }
302
+ // Deep dive findings (god nodes, high-degree files from background analysis)
303
+ var deepdiveFile = path.join(metricsDir, 'deepdive.json');
304
+ if (fs.existsSync(deepdiveFile) && fs.statSync(deepdiveFile).size < 32768) {
305
+ var ddData = JSON.parse(fs.readFileSync(deepdiveFile, 'utf-8'));
306
+ if (ddData && ddData.findings && ddData.findings.length > 0) {
307
+ for (var di = 0; di < ddData.findings.length; di++) {
308
+ var finding = ddData.findings[di];
309
+ if (finding.category === 'god_nodes' && finding.items && finding.items.length > 0) {
310
+ var topGod = finding.items[0];
311
+ console.log('[DEEPDIVE] ' + finding.items.length + ' god nodes. Top: ' + (topGod.name || 'unknown') + ' (degree ' + (topGod.degree || '?') + ') in ' + (topGod.file || 'unknown'));
312
+ }
313
+ }
314
+ }
315
+ }
316
+ // Ultralearn insights (bridge nodes crossing community boundaries)
317
+ var ultralearnFile = path.join(metricsDir, 'ultralearn.json');
318
+ if (fs.existsSync(ultralearnFile) && fs.statSync(ultralearnFile).size < 32768) {
319
+ var ulData = JSON.parse(fs.readFileSync(ultralearnFile, 'utf-8'));
320
+ if (ulData && ulData.insightsGained && ulData.insightsGained.length > 0) {
321
+ for (var ui = 0; ui < ulData.insightsGained.length; ui++) {
322
+ var insight = ulData.insightsGained[ui];
323
+ if (insight.category === 'bridge_nodes' && insight.items && insight.items.length > 0) {
324
+ var topBridge = insight.items[0];
325
+ console.log('[ARCHITECTURE] ' + insight.items.length + ' bridge nodes crossing community boundaries. Top: ' + (topBridge.name || 'unknown') + ' (' + (topBridge.crossCommunityEdges || '?') + ' cross-edges) in ' + (topBridge.location || 'unknown'));
326
+ }
327
+ }
328
+ }
329
+ }
330
+ // Performance metrics (daemon optimize worker)
331
+ var perfFile = path.join(metricsDir, 'performance.json');
332
+ if (fs.existsSync(perfFile) && fs.statSync(perfFile).size < 32768) {
333
+ var perfData = JSON.parse(fs.readFileSync(perfFile, 'utf-8'));
334
+ if (perfData && perfData.memoryUsage) {
335
+ var rssBytes = perfData.memoryUsage.rss || 0;
336
+ var rssMB = Math.round(rssBytes / (1024 * 1024));
337
+ if (rssMB > 512) {
338
+ console.log('[PERF] Daemon RSS ' + rssMB + 'MB (>512MB threshold). Consider restarting daemon or reducing worker concurrency');
339
+ }
340
+ }
341
+ }
342
+ // Memory consolidation health
343
+ var consolFile = path.join(metricsDir, 'consolidation.json');
344
+ if (fs.existsSync(consolFile) && fs.statSync(consolFile).size < 32768) {
345
+ var consolData = JSON.parse(fs.readFileSync(consolFile, 'utf-8'));
346
+ if (consolData && consolData.patternsConsolidated > 0) {
347
+ console.log('[MEMORY] ' + consolData.patternsConsolidated + ' patterns consolidated into ' + consolData.clustersCreated + ' RAPTOR clusters');
348
+ }
349
+ }
350
+ // Benchmark worker RSS (manual-trigger `daemon trigger -w benchmark`)
351
+ var benchFile = path.join(metricsDir, 'benchmark.json');
352
+ if (fs.existsSync(benchFile) && fs.statSync(benchFile).size < 32768) {
353
+ var benchData = JSON.parse(fs.readFileSync(benchFile, 'utf-8'));
354
+ if (benchData && benchData.benchmarks && benchData.benchmarks.memoryUsage) {
355
+ var benchRssMB = Math.round((benchData.benchmarks.memoryUsage.rss || 0) / (1024 * 1024));
356
+ if (benchRssMB > 512) {
357
+ console.log('[PERF] Benchmark snapshot RSS ' + benchRssMB + 'MB (>512MB threshold) at last `daemon trigger -w benchmark` run');
358
+ }
235
359
  }
236
360
  }
237
361
  } catch (e) { /* non-fatal */ }
@@ -248,6 +372,15 @@ module.exports = {
248
372
  var promptTokens = promptLower.match(/[a-z][a-z0-9_-]{2,}/g) || [];
249
373
  if (promptTokens.length > 0) {
250
374
  var matches = [];
375
+ // Truncate at the last space before maxLen so fragments never
376
+ // end mid-word (falls back to a hard cut for space-less text).
377
+ var truncAtWord = function(s, maxLen) {
378
+ s = String(s || '');
379
+ if (s.length <= maxLen) return s;
380
+ var cut = s.slice(0, maxLen);
381
+ var sp = cut.lastIndexOf(' ');
382
+ return sp > 40 ? cut.slice(0, sp) : cut;
383
+ };
251
384
  // Only search last 200 episodes
252
385
  var searchEps = epRaw.slice(-200);
253
386
  for (var ei = 0; ei < searchEps.length; ei++) {
@@ -264,14 +397,23 @@ module.exports = {
264
397
  }
265
398
  var relevance = promptTokens.length > 0 ? hits / promptTokens.length : 0;
266
399
  if (relevance >= 0.3 && hits >= 2) {
267
- matches.push({ summary: (ep.summary || '').slice(0, 120), relevance: relevance, ts: ep.endedAt || 0 });
400
+ matches.push({ summary: truncAtWord(ep.summary || '', 120), relevance: relevance, ts: ep.endedAt || 0 });
268
401
  }
269
402
  } catch (e) {}
270
403
  }
271
- // Show top 2 most relevant matches
404
+ // Show top 2 most relevant matches — dedupe by fragment text so
405
+ // two episodes from the same conversation don't inject the same
406
+ // truncated snippet twice.
272
407
  if (matches.length > 0) {
273
408
  matches.sort(function(a, b) { return b.relevance - a.relevance; });
274
- var topMatches = matches.slice(0, 2);
409
+ var topMatches = [];
410
+ var seenFrags = {};
411
+ for (var tmi = 0; tmi < matches.length && topMatches.length < 2; tmi++) {
412
+ var frag = matches[tmi].summary.replace(/\n/g, ' ').trim();
413
+ if (seenFrags[frag]) continue;
414
+ seenFrags[frag] = true;
415
+ topMatches.push(matches[tmi]);
416
+ }
275
417
  var memLines = ['[MEMORY] Relevant past sessions:'];
276
418
  for (var mi = 0; mi < topMatches.length; mi++) {
277
419
  var ago = topMatches[mi].ts ? Math.round((Date.now() - topMatches[mi].ts) / 3600000) + 'h ago' : '';
@@ -33,7 +33,7 @@ module.exports = {
33
33
  // sessionSuccess is derived from intelligence-outcomes.jsonl entries written
34
34
  // during this session (last 30 minutes). A session is marked failed when the
35
35
  // majority of feedback() calls carried success=false in that window.
36
- var sessionSuccess = true; // optimistic default when no signal exists
36
+ var sessionSuccess = null; // null = no evidence; only set to a boolean from real signals
37
37
  try {
38
38
  var feedbackPath = path.join(CWD, '.monomind', 'routing-feedback.jsonl');
39
39
  var lastRoutePath = path.join(CWD, '.monomind', 'last-route.json');
@@ -68,35 +68,41 @@ module.exports = {
68
68
  }
69
69
  }
70
70
  }
71
- // else: modified files exist, keep optimistic default (true)
71
+ // else: modified files exist — work in progress, not evidence either way (leave null)
72
72
  }
73
- } catch (e) { /* non-critical — keep optimistic default */ }
73
+ } catch (e) { /* non-critical — leave null (no evidence) */ }
74
74
 
75
75
  // Record session-end feedback WITH recentEdits (before consolidate clears them)
76
- if (intelligence && intelligence.feedback) {
76
+ if (intelligence && intelligence.feedback && typeof sessionSuccess === 'boolean') {
77
77
  try { intelligence.feedback(sessionSuccess); } catch (e) { /* non-fatal */ }
78
78
  }
79
- var feedbackEntry = {
80
- timestamp: new Date().toISOString(),
81
- suggestedAgent: lastRoute.agent,
82
- confidence: lastRoute.confidence,
83
- sessionId: String(hookInput.sessionId || hookInput.session_id || '').slice(0, 128),
84
- intelligenceFeedback: sessionSuccess,
85
- };
86
- fs.appendFileSync(feedbackPath, JSON.stringify(feedbackEntry) + '\n', 'utf-8');
87
- // Rotate: keep last 1000 lines to prevent unbounded growth
88
- try {
89
- var MAX_FEEDBACK = 512 * 1024; // 512 KiB
90
- if (fs.existsSync(feedbackPath) && fs.statSync(feedbackPath).size > MAX_FEEDBACK) {
91
- // File too large — emergency trim without full read
92
- throw new Error('skip-rotation');
93
- }
94
- var raw = fs.readFileSync(feedbackPath, 'utf-8');
95
- var lines = raw.split('\n').filter(Boolean);
96
- if (lines.length > 1000) {
97
- fs.writeFileSync(feedbackPath, lines.slice(-1000).join('\n') + '\n', 'utf-8');
98
- }
99
- } catch (e2) { /* rotation is best-effort */ }
79
+ // Normalize agent label to a lowercase slug ("Coder" → "coder", "backend dev" → "backend-dev")
80
+ var agentSlug = String(lastRoute.agent || '').trim().toLowerCase().replace(/\s+/g, '-');
81
+ // Skip non-agent placeholders — "AI selecting" etc. carry no routing signal
82
+ if (agentSlug && agentSlug !== 'ai-selecting' && agentSlug !== 'unknown') {
83
+ var feedbackEntry = {
84
+ timestamp: new Date().toISOString(),
85
+ suggestedAgent: agentSlug,
86
+ confidence: lastRoute.confidence,
87
+ sessionId: String(hookInput.sessionId || hookInput.session_id || '').slice(0, 128),
88
+ };
89
+ // Only write the success flag when derived from actual evidence (commits, outcomes)
90
+ if (typeof sessionSuccess === 'boolean') feedbackEntry.intelligenceFeedback = sessionSuccess;
91
+ fs.appendFileSync(feedbackPath, JSON.stringify(feedbackEntry) + '\n', 'utf-8');
92
+ // Rotate: keep last 1000 lines to prevent unbounded growth
93
+ try {
94
+ var MAX_FEEDBACK = 512 * 1024; // 512 KiB
95
+ if (fs.existsSync(feedbackPath) && fs.statSync(feedbackPath).size > MAX_FEEDBACK) {
96
+ // File too large — emergency trim without full read
97
+ throw new Error('skip-rotation');
98
+ }
99
+ var raw = fs.readFileSync(feedbackPath, 'utf-8');
100
+ var lines = raw.split('\n').filter(Boolean);
101
+ if (lines.length > 1000) {
102
+ fs.writeFileSync(feedbackPath, lines.slice(-1000).join('\n') + '\n', 'utf-8');
103
+ }
104
+ } catch (e2) { /* rotation is best-effort */ }
105
+ }
100
106
  }
101
107
  } catch (e) { /* non-fatal */ }
102
108
 
@@ -117,6 +123,22 @@ module.exports = {
117
123
  }
118
124
  } catch (e) { console.log('[WARN] Session end failed: ' + e.message); }
119
125
 
126
+ // Bridge to @monomind/hooks registry — fires SessionEnd hooks (episode-binner closeEpisode, observability bus).
127
+ // Each hook event runs in a fresh process, so hCtx._hooksModule set by session-restore in an
128
+ // earlier invocation is never visible here — must (re)load lazily via _ensureHooksModule().
129
+ var _hooksModule = hCtx._hooksModule || (hCtx._ensureHooksModule ? await hCtx._ensureHooksModule() : null);
130
+ if (_hooksModule && _hooksModule.executeHooks && _hooksModule.HookEvent) {
131
+ try {
132
+ await _hooksModule.executeHooks(_hooksModule.HookEvent.SessionEnd, {
133
+ session: {
134
+ id: String(hookInput.sessionId || hookInput.session_id || ''),
135
+ startedAt: new Date(),
136
+ },
137
+ success: sessionSuccess !== false, // null (no evidence) still counts as non-failure here
138
+ }, { continueOnError: true, timeout: 2000 });
139
+ } catch (e) { /* non-fatal */ }
140
+ }
141
+
120
142
  // Memory Palace tombstone writes removed — redundant with raw session JSONL
121
143
 
122
144
  // ── Context Persistence Auto-Archive ─────────────────────────────────