@monoes/monomindcli 2.9.21 → 2.9.23

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 (505) hide show
  1. package/.claude/agents/consensus/quorum-manager.md +35 -54
  2. package/.claude/agents/core/coordinator.md +14 -18
  3. package/.claude/agents/core/researcher.md +1 -1
  4. package/.claude/agents/github/issue-tracker.md +3 -3
  5. package/.claude/agents/github/{code-review-swarm.md → monoswarm-code-review.md} +1 -1
  6. package/.claude/agents/github/{swarm-issue.md → monoswarm-issue.md} +1 -1
  7. package/.claude/agents/github/{multi-repo-swarm.md → monoswarm-multi-repo.md} +1 -1
  8. package/.claude/agents/github/{swarm-pr.md → monoswarm-pr.md} +1 -1
  9. package/.claude/agents/github/pr-manager.md +1 -1
  10. package/.claude/agents/github/release-manager.md +1 -1
  11. package/.claude/agents/github/repo-architect.md +1 -1
  12. package/.claude/agents/github/sync-coordinator.md +4 -4
  13. package/.claude/agents/{hive-mind → monoswarm}/collective-intelligence-coordinator.md +9 -16
  14. package/.claude/agents/{swarm → monoswarm}/mesh-coordinator.md +19 -24
  15. package/.claude/agents/{hive-mind/swarm-memory-manager.md → monoswarm/monoswarm-memory-manager.md} +1 -1
  16. package/.claude/agents/templates/{coordinator-swarm-init.md → coordinator-monoswarm-init.md} +1 -1
  17. package/.claude/agents/testing/{tdd-london-swarm.md → tdd-london-monoswarm.md} +2 -2
  18. package/.claude/commands/agents/agent-coordination.md +3 -3
  19. package/.claude/commands/agents/agent-types.md +1 -1
  20. package/.claude/commands/automation/self-healing.md +1 -1
  21. package/.claude/commands/automation/smart-spawn.md +1 -1
  22. package/.claude/commands/coordination/README.md +1 -1
  23. package/.claude/commands/coordination/{swarm-init.md → monoswarm-init.md} +2 -2
  24. package/.claude/commands/coordination/task-orchestrate.md +4 -4
  25. package/.claude/commands/github/README.md +1 -1
  26. package/.claude/commands/github/issue-tracker.md +2 -2
  27. package/.claude/commands/github/pr-manager.md +1 -1
  28. package/.claude/commands/github/release-manager.md +1 -1
  29. package/.claude/commands/github/repo-architect.md +1 -1
  30. package/.claude/commands/github/sync-coordinator.md +2 -2
  31. package/.claude/commands/hooks/README.md +1 -2
  32. package/.claude/commands/hooks/overview.md +1 -2
  33. package/.claude/commands/hooks/setup.md +0 -3
  34. package/.claude/commands/mastermind/createtask.md +2 -2
  35. package/.claude/commands/mastermind/do.md +3 -3
  36. package/.claude/commands/mastermind/help.md +2 -2
  37. package/.claude/commands/mastermind/ideate.md +1 -1
  38. package/.claude/commands/mastermind/improve.md +1 -1
  39. package/.claude/commands/mastermind/memory.md +2 -2
  40. package/.claude/commands/mastermind/{swarm.md → monoswarm.md} +13 -26
  41. package/.claude/commands/mastermind/topology.md +1 -1
  42. package/.claude/commands/memory/README.md +2 -2
  43. package/.claude/commands/memory/memory-search.md +1 -1
  44. package/.claude/commands/monoswarm/README.md +59 -0
  45. package/.claude/commands/monoswarm/consensus.md +61 -0
  46. package/.claude/commands/monoswarm/init.md +68 -0
  47. package/.claude/commands/monoswarm/memory.md +55 -0
  48. package/.claude/commands/monoswarm/monoswarm.md +139 -0
  49. package/.claude/commands/{swarm → monoswarm}/research.md +2 -2
  50. package/.claude/commands/monoswarm/spawn.md +49 -0
  51. package/.claude/commands/monoswarm/status.md +48 -0
  52. package/.claude/commands/monoswarm/stop.md +46 -0
  53. package/.claude/commands/optimization/auto-topology.md +9 -9
  54. package/.claude/commands/stream-chain/run.md +1 -1
  55. package/.claude/commands/workflows/development.md +1 -1
  56. package/.claude/commands/workflows/research.md +2 -2
  57. package/.claude/helpers/audit-log-writer.cjs +72 -0
  58. package/.claude/helpers/control-start.cjs +84 -26
  59. package/.claude/helpers/handlers/agent-start-handler.cjs +5 -5
  60. package/.claude/helpers/handlers/gates-handler.cjs +31 -10
  61. package/.claude/helpers/handlers/session-restore-handler.cjs +1 -1
  62. package/.claude/helpers/handlers/task-handler.cjs +4 -4
  63. package/.claude/helpers/skill-registry.json +4718 -3669
  64. package/.claude/helpers/statusline.cjs +21 -21
  65. package/.claude/helpers/token-tracker.cjs +0 -6
  66. package/.claude/settings.json +2 -3
  67. package/.claude/skills/hooks-automation/SKILL.md +5 -5
  68. package/.claude/skills/mastermind-createorg/SKILL.md +26 -3
  69. package/.claude/skills/mastermind-protocol/SKILL.md +3 -3
  70. package/.claude/skills/memory-toolkit/SKILL.md +2 -2
  71. package/.claude/skills/{swarm-orchestration → monoswarm}/SKILL.md +106 -42
  72. package/.claude/skills/specialagent/SKILL.md +1 -1
  73. package/README.md +31 -12
  74. package/dist/src/autopilot-state.d.ts +0 -16
  75. package/dist/src/autopilot-state.d.ts.map +1 -1
  76. package/dist/src/autopilot-state.js +0 -15
  77. package/dist/src/autopilot-state.js.map +1 -1
  78. package/dist/src/browser/dashboard/server.js +3 -3
  79. package/dist/src/browser/dashboard/server.js.map +1 -1
  80. package/dist/src/browser/dashboard/ui.html +2 -2
  81. package/dist/src/capabilities/cap-documents.d.ts.map +1 -1
  82. package/dist/src/capabilities/cap-documents.js +49 -38
  83. package/dist/src/capabilities/cap-documents.js.map +1 -1
  84. package/dist/src/commands/agent-lifecycle.d.ts.map +1 -1
  85. package/dist/src/commands/agent-lifecycle.js +4 -9
  86. package/dist/src/commands/agent-lifecycle.js.map +1 -1
  87. package/dist/src/commands/agent-ops.d.ts.map +1 -1
  88. package/dist/src/commands/agent-ops.js +37 -24
  89. package/dist/src/commands/agent-ops.js.map +1 -1
  90. package/dist/src/commands/analyze-ast.d.ts +1 -1
  91. package/dist/src/commands/analyze-ast.d.ts.map +1 -1
  92. package/dist/src/commands/analyze-ast.js +8 -27
  93. package/dist/src/commands/analyze-ast.js.map +1 -1
  94. package/dist/src/commands/analyze-imports.d.ts.map +1 -1
  95. package/dist/src/commands/analyze-imports.js +18 -17
  96. package/dist/src/commands/analyze-imports.js.map +1 -1
  97. package/dist/src/commands/analyze-symbols.d.ts.map +1 -1
  98. package/dist/src/commands/analyze-symbols.js +10 -24
  99. package/dist/src/commands/analyze-symbols.js.map +1 -1
  100. package/dist/src/commands/analyze.d.ts +19 -6
  101. package/dist/src/commands/analyze.d.ts.map +1 -1
  102. package/dist/src/commands/analyze.js +61 -15
  103. package/dist/src/commands/analyze.js.map +1 -1
  104. package/dist/src/commands/autopilot.d.ts.map +1 -1
  105. package/dist/src/commands/autopilot.js +4 -89
  106. package/dist/src/commands/autopilot.js.map +1 -1
  107. package/dist/src/commands/browse.d.ts +1 -1
  108. package/dist/src/commands/cleanup.d.ts.map +1 -1
  109. package/dist/src/commands/cleanup.js +4 -2
  110. package/dist/src/commands/cleanup.js.map +1 -1
  111. package/dist/src/commands/completions.d.ts.map +1 -1
  112. package/dist/src/commands/completions.js +0 -1
  113. package/dist/src/commands/completions.js.map +1 -1
  114. package/dist/src/commands/config.js +7 -7
  115. package/dist/src/commands/config.js.map +1 -1
  116. package/dist/src/commands/doctor-project-checks.d.ts +7 -0
  117. package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
  118. package/dist/src/commands/doctor-project-checks.js +37 -5
  119. package/dist/src/commands/doctor-project-checks.js.map +1 -1
  120. package/dist/src/commands/doctor.d.ts.map +1 -1
  121. package/dist/src/commands/doctor.js +9 -3
  122. package/dist/src/commands/doctor.js.map +1 -1
  123. package/dist/src/commands/events.d.ts +9 -0
  124. package/dist/src/commands/events.d.ts.map +1 -0
  125. package/dist/src/commands/events.js +89 -0
  126. package/dist/src/commands/events.js.map +1 -0
  127. package/dist/src/commands/hooks-routing-commands.d.ts +1 -2
  128. package/dist/src/commands/hooks-routing-commands.d.ts.map +1 -1
  129. package/dist/src/commands/hooks-routing-commands.js +1 -101
  130. package/dist/src/commands/hooks-routing-commands.js.map +1 -1
  131. package/dist/src/commands/hooks-workers.d.ts.map +1 -1
  132. package/dist/src/commands/hooks-workers.js +19 -71
  133. package/dist/src/commands/hooks-workers.js.map +1 -1
  134. package/dist/src/commands/hooks.d.ts +1 -1
  135. package/dist/src/commands/hooks.d.ts.map +1 -1
  136. package/dist/src/commands/hooks.js +4 -7
  137. package/dist/src/commands/hooks.js.map +1 -1
  138. package/dist/src/commands/index.d.ts +2 -2
  139. package/dist/src/commands/index.d.ts.map +1 -1
  140. package/dist/src/commands/index.js +4 -3
  141. package/dist/src/commands/index.js.map +1 -1
  142. package/dist/src/commands/init-subcommands.d.ts.map +1 -1
  143. package/dist/src/commands/init-subcommands.js +4 -0
  144. package/dist/src/commands/init-subcommands.js.map +1 -1
  145. package/dist/src/commands/init-wizard.d.ts.map +1 -1
  146. package/dist/src/commands/init-wizard.js +0 -8
  147. package/dist/src/commands/init-wizard.js.map +1 -1
  148. package/dist/src/commands/init.d.ts.map +1 -1
  149. package/dist/src/commands/init.js +53 -23
  150. package/dist/src/commands/init.js.map +1 -1
  151. package/dist/src/commands/mcp.d.ts +1 -0
  152. package/dist/src/commands/mcp.d.ts.map +1 -1
  153. package/dist/src/commands/mcp.js +111 -60
  154. package/dist/src/commands/mcp.js.map +1 -1
  155. package/dist/src/commands/memory-crud.d.ts.map +1 -1
  156. package/dist/src/commands/memory-crud.js +33 -20
  157. package/dist/src/commands/memory-crud.js.map +1 -1
  158. package/dist/src/commands/monoswarm.d.ts +8 -0
  159. package/dist/src/commands/monoswarm.d.ts.map +1 -0
  160. package/dist/src/commands/{swarm.js → monoswarm.js} +83 -297
  161. package/dist/src/commands/monoswarm.js.map +1 -0
  162. package/dist/src/commands/neural-core.d.ts.map +1 -1
  163. package/dist/src/commands/neural-core.js +9 -1
  164. package/dist/src/commands/neural-core.js.map +1 -1
  165. package/dist/src/commands/neural-optimize.d.ts.map +1 -1
  166. package/dist/src/commands/neural-optimize.js +30 -110
  167. package/dist/src/commands/neural-optimize.js.map +1 -1
  168. package/dist/src/commands/neural-registry.d.ts +1 -2
  169. package/dist/src/commands/neural-registry.d.ts.map +1 -1
  170. package/dist/src/commands/neural-registry.js +21 -168
  171. package/dist/src/commands/neural-registry.js.map +1 -1
  172. package/dist/src/commands/org-observe.d.ts +34 -3
  173. package/dist/src/commands/org-observe.d.ts.map +1 -1
  174. package/dist/src/commands/org-observe.js +213 -45
  175. package/dist/src/commands/org-observe.js.map +1 -1
  176. package/dist/src/commands/org.d.ts +14 -0
  177. package/dist/src/commands/org.d.ts.map +1 -1
  178. package/dist/src/commands/org.js +118 -20
  179. package/dist/src/commands/org.js.map +1 -1
  180. package/dist/src/commands/performance.d.ts.map +1 -1
  181. package/dist/src/commands/performance.js +38 -31
  182. package/dist/src/commands/performance.js.map +1 -1
  183. package/dist/src/commands/security-misc.d.ts.map +1 -1
  184. package/dist/src/commands/security-misc.js +220 -90
  185. package/dist/src/commands/security-misc.js.map +1 -1
  186. package/dist/src/commands/security-scan.d.ts +13 -0
  187. package/dist/src/commands/security-scan.d.ts.map +1 -1
  188. package/dist/src/commands/security-scan.js +96 -27
  189. package/dist/src/commands/security-scan.js.map +1 -1
  190. package/dist/src/commands/security.js +1 -1
  191. package/dist/src/commands/security.js.map +1 -1
  192. package/dist/src/commands/start.d.ts.map +1 -1
  193. package/dist/src/commands/start.js +17 -96
  194. package/dist/src/commands/start.js.map +1 -1
  195. package/dist/src/commands/status.d.ts.map +1 -1
  196. package/dist/src/commands/status.js +72 -64
  197. package/dist/src/commands/status.js.map +1 -1
  198. package/dist/src/commands/tokens.d.ts.map +1 -1
  199. package/dist/src/commands/tokens.js +4 -5
  200. package/dist/src/commands/tokens.js.map +1 -1
  201. package/dist/src/consensus/audit-writer.d.ts +2 -2
  202. package/dist/src/consensus/audit-writer.d.ts.map +1 -1
  203. package/dist/src/consensus/audit-writer.js +1 -1
  204. package/dist/src/index.d.ts +2 -2
  205. package/dist/src/index.d.ts.map +1 -1
  206. package/dist/src/index.js +12 -10
  207. package/dist/src/index.js.map +1 -1
  208. package/dist/src/init/claudemd-generator.d.ts.map +1 -1
  209. package/dist/src/init/claudemd-generator.js +32 -31
  210. package/dist/src/init/claudemd-generator.js.map +1 -1
  211. package/dist/src/init/codex-generator.d.ts +10 -0
  212. package/dist/src/init/codex-generator.d.ts.map +1 -0
  213. package/dist/src/init/codex-generator.js +67 -0
  214. package/dist/src/init/codex-generator.js.map +1 -0
  215. package/dist/src/init/copy-assets.d.ts.map +1 -1
  216. package/dist/src/init/copy-assets.js +4 -8
  217. package/dist/src/init/copy-assets.js.map +1 -1
  218. package/dist/src/init/executor.d.ts.map +1 -1
  219. package/dist/src/init/executor.js +9 -2
  220. package/dist/src/init/executor.js.map +1 -1
  221. package/dist/src/init/helpers-generator.js +1 -1
  222. package/dist/src/init/index.d.ts +1 -0
  223. package/dist/src/init/index.d.ts.map +1 -1
  224. package/dist/src/init/index.js +1 -0
  225. package/dist/src/init/index.js.map +1 -1
  226. package/dist/src/init/opencode-generator.js +2 -2
  227. package/dist/src/init/opencode-generator.js.map +1 -1
  228. package/dist/src/init/settings-generator.d.ts.map +1 -1
  229. package/dist/src/init/settings-generator.js +1 -2
  230. package/dist/src/init/settings-generator.js.map +1 -1
  231. package/dist/src/init/shared.d.ts.map +1 -1
  232. package/dist/src/init/shared.js +3 -7
  233. package/dist/src/init/shared.js.map +1 -1
  234. package/dist/src/init/statusline-generator.js +19 -19
  235. package/dist/src/init/types.d.ts +9 -10
  236. package/dist/src/init/types.d.ts.map +1 -1
  237. package/dist/src/init/types.js +8 -6
  238. package/dist/src/init/types.js.map +1 -1
  239. package/dist/src/init/upgrade.js +5 -5
  240. package/dist/src/init/upgrade.js.map +1 -1
  241. package/dist/src/init/write-capabilities.d.ts.map +1 -1
  242. package/dist/src/init/write-capabilities.js +36 -49
  243. package/dist/src/init/write-capabilities.js.map +1 -1
  244. package/dist/src/init/write-claude.js +1 -1
  245. package/dist/src/init/write-claude.js.map +1 -1
  246. package/dist/src/init/write-codex.d.ts +4 -0
  247. package/dist/src/init/write-codex.d.ts.map +1 -0
  248. package/dist/src/init/write-codex.js +57 -0
  249. package/dist/src/init/write-codex.js.map +1 -0
  250. package/dist/src/init/write-runtime-config.d.ts.map +1 -1
  251. package/dist/src/init/write-runtime-config.js +4 -5
  252. package/dist/src/init/write-runtime-config.js.map +1 -1
  253. package/dist/src/knowledge/eval/golden-set.js +15 -15
  254. package/dist/src/knowledge/eval/golden-set.js.map +1 -1
  255. package/dist/src/mcp-client.d.ts.map +1 -1
  256. package/dist/src/mcp-client.js +1 -2
  257. package/dist/src/mcp-client.js.map +1 -1
  258. package/dist/src/mcp-server.js +1 -1
  259. package/dist/src/mcp-server.js.map +1 -1
  260. package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
  261. package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
  262. package/dist/src/mcp-tools/agent-tools.js +3 -3
  263. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  264. package/dist/src/mcp-tools/autopilot-tools.d.ts +1 -1
  265. package/dist/src/mcp-tools/autopilot-tools.d.ts.map +1 -1
  266. package/dist/src/mcp-tools/autopilot-tools.js +4 -62
  267. package/dist/src/mcp-tools/autopilot-tools.js.map +1 -1
  268. package/dist/src/mcp-tools/guidance-tools.d.ts.map +1 -1
  269. package/dist/src/mcp-tools/guidance-tools.js +21 -31
  270. package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
  271. package/dist/src/mcp-tools/hooks-intelligence.d.ts +0 -1
  272. package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
  273. package/dist/src/mcp-tools/hooks-intelligence.js +56 -103
  274. package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
  275. package/dist/src/mcp-tools/hooks-routing.d.ts +1 -2
  276. package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
  277. package/dist/src/mcp-tools/hooks-routing.js +78 -152
  278. package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
  279. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  280. package/dist/src/mcp-tools/hooks-tools.js +2 -4
  281. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  282. package/dist/src/mcp-tools/index.d.ts +1 -2
  283. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  284. package/dist/src/mcp-tools/index.js +1 -2
  285. package/dist/src/mcp-tools/index.js.map +1 -1
  286. package/dist/src/mcp-tools/memory-tools.js +10 -10
  287. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  288. package/dist/src/mcp-tools/monograph/query-tools.js +9 -9
  289. package/dist/src/mcp-tools/monograph/query-tools.js.map +1 -1
  290. package/dist/src/mcp-tools/monoswarm-tools.d.ts +17 -0
  291. package/dist/src/mcp-tools/monoswarm-tools.d.ts.map +1 -0
  292. package/dist/src/mcp-tools/monoswarm-tools.js +1153 -0
  293. package/dist/src/mcp-tools/monoswarm-tools.js.map +1 -0
  294. package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
  295. package/dist/src/mcp-tools/performance-tools.js +32 -25
  296. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  297. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  298. package/dist/src/mcp-tools/system-tools.js +30 -13
  299. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  300. package/dist/src/mcp-tools/transfer-tools.d.ts +8 -12
  301. package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -1
  302. package/dist/src/mcp-tools/transfer-tools.js +9 -13
  303. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  304. package/dist/src/memory/embedding-operations.d.ts.map +1 -1
  305. package/dist/src/memory/embedding-operations.js +0 -37
  306. package/dist/src/memory/embedding-operations.js.map +1 -1
  307. package/dist/src/memory/hnsw-operations.d.ts +14 -74
  308. package/dist/src/memory/hnsw-operations.d.ts.map +1 -1
  309. package/dist/src/memory/hnsw-operations.js +22 -262
  310. package/dist/src/memory/hnsw-operations.js.map +1 -1
  311. package/dist/src/memory/intelligence.d.ts +2 -2
  312. package/dist/src/memory/intelligence.d.ts.map +1 -1
  313. package/dist/src/memory/intelligence.js +8 -7
  314. package/dist/src/memory/intelligence.js.map +1 -1
  315. package/dist/src/memory/memory-bridge.d.ts +24 -24
  316. package/dist/src/memory/memory-bridge.d.ts.map +1 -1
  317. package/dist/src/memory/memory-bridge.js +33 -34
  318. package/dist/src/memory/memory-bridge.js.map +1 -1
  319. package/dist/src/memory/memory-crud.d.ts.map +1 -1
  320. package/dist/src/memory/memory-crud.js +0 -20
  321. package/dist/src/memory/memory-crud.js.map +1 -1
  322. package/dist/src/memory/memory-initializer.d.ts +2 -3
  323. package/dist/src/memory/memory-initializer.d.ts.map +1 -1
  324. package/dist/src/memory/memory-initializer.js +2 -3
  325. package/dist/src/memory/memory-initializer.js.map +1 -1
  326. package/dist/src/memory/memory-read.d.ts.map +1 -1
  327. package/dist/src/memory/memory-read.js +5 -14
  328. package/dist/src/memory/memory-read.js.map +1 -1
  329. package/dist/src/memory/sona-optimizer.d.ts +1 -1
  330. package/dist/src/memory/sona-optimizer.js +1 -1
  331. package/dist/src/monovector/model-outcomes.d.ts +25 -0
  332. package/dist/src/monovector/model-outcomes.d.ts.map +1 -0
  333. package/dist/src/monovector/model-outcomes.js +113 -0
  334. package/dist/src/monovector/model-outcomes.js.map +1 -0
  335. package/dist/src/orgrt/agent-runner.d.ts +8 -2
  336. package/dist/src/orgrt/agent-runner.d.ts.map +1 -1
  337. package/dist/src/orgrt/agent-runner.js.map +1 -1
  338. package/dist/src/orgrt/antigravity-runner.d.ts +25 -2
  339. package/dist/src/orgrt/antigravity-runner.d.ts.map +1 -1
  340. package/dist/src/orgrt/antigravity-runner.js +265 -124
  341. package/dist/src/orgrt/antigravity-runner.js.map +1 -1
  342. package/dist/src/orgrt/approvals.d.ts +16 -1
  343. package/dist/src/orgrt/approvals.d.ts.map +1 -1
  344. package/dist/src/orgrt/approvals.js +47 -2
  345. package/dist/src/orgrt/approvals.js.map +1 -1
  346. package/dist/src/orgrt/checkpoint-ops.d.ts +10 -16
  347. package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -1
  348. package/dist/src/orgrt/checkpoint-ops.js +12 -18
  349. package/dist/src/orgrt/checkpoint-ops.js.map +1 -1
  350. package/dist/src/orgrt/checkpoint.d.ts +12 -1
  351. package/dist/src/orgrt/checkpoint.d.ts.map +1 -1
  352. package/dist/src/orgrt/checkpoint.js +19 -3
  353. package/dist/src/orgrt/checkpoint.js.map +1 -1
  354. package/dist/src/orgrt/codex-runner.d.ts +26 -2
  355. package/dist/src/orgrt/codex-runner.d.ts.map +1 -1
  356. package/dist/src/orgrt/codex-runner.js +359 -128
  357. package/dist/src/orgrt/codex-runner.js.map +1 -1
  358. package/dist/src/orgrt/copilot-runner.d.ts +14 -0
  359. package/dist/src/orgrt/copilot-runner.d.ts.map +1 -0
  360. package/dist/src/orgrt/copilot-runner.js +260 -0
  361. package/dist/src/orgrt/copilot-runner.js.map +1 -0
  362. package/dist/src/orgrt/cross-org.d.ts.map +1 -1
  363. package/dist/src/orgrt/cross-org.js +11 -0
  364. package/dist/src/orgrt/cross-org.js.map +1 -1
  365. package/dist/src/orgrt/crush-runner.d.ts +27 -0
  366. package/dist/src/orgrt/crush-runner.d.ts.map +1 -0
  367. package/dist/src/orgrt/crush-runner.js +263 -0
  368. package/dist/src/orgrt/crush-runner.js.map +1 -0
  369. package/dist/src/orgrt/daemon.d.ts +68 -16
  370. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  371. package/dist/src/orgrt/daemon.js +212 -29
  372. package/dist/src/orgrt/daemon.js.map +1 -1
  373. package/dist/src/orgrt/decisions.d.ts +1 -0
  374. package/dist/src/orgrt/decisions.d.ts.map +1 -1
  375. package/dist/src/orgrt/decisions.js +20 -0
  376. package/dist/src/orgrt/decisions.js.map +1 -1
  377. package/dist/src/orgrt/grok-runner.d.ts +18 -0
  378. package/dist/src/orgrt/grok-runner.d.ts.map +1 -0
  379. package/dist/src/orgrt/grok-runner.js +348 -0
  380. package/dist/src/orgrt/grok-runner.js.map +1 -0
  381. package/dist/src/orgrt/kimicode-runner.d.ts +53 -7
  382. package/dist/src/orgrt/kimicode-runner.d.ts.map +1 -1
  383. package/dist/src/orgrt/kimicode-runner.js +246 -144
  384. package/dist/src/orgrt/kimicode-runner.js.map +1 -1
  385. package/dist/src/orgrt/mailbox.d.ts +26 -1
  386. package/dist/src/orgrt/mailbox.d.ts.map +1 -1
  387. package/dist/src/orgrt/mailbox.js +74 -2
  388. package/dist/src/orgrt/mailbox.js.map +1 -1
  389. package/dist/src/orgrt/pi-rpc-runner.d.ts +68 -0
  390. package/dist/src/orgrt/pi-rpc-runner.d.ts.map +1 -0
  391. package/dist/src/orgrt/pi-rpc-runner.js +385 -0
  392. package/dist/src/orgrt/pi-rpc-runner.js.map +1 -0
  393. package/dist/src/orgrt/pi-runner.d.ts +16 -0
  394. package/dist/src/orgrt/pi-runner.d.ts.map +1 -0
  395. package/dist/src/orgrt/pi-runner.js +264 -0
  396. package/dist/src/orgrt/pi-runner.js.map +1 -0
  397. package/dist/src/orgrt/policy.d.ts +11 -0
  398. package/dist/src/orgrt/policy.d.ts.map +1 -1
  399. package/dist/src/orgrt/policy.js +25 -2
  400. package/dist/src/orgrt/policy.js.map +1 -1
  401. package/dist/src/orgrt/provider.d.ts +29 -1
  402. package/dist/src/orgrt/provider.d.ts.map +1 -1
  403. package/dist/src/orgrt/provider.js +62 -2
  404. package/dist/src/orgrt/provider.js.map +1 -1
  405. package/dist/src/orgrt/qwen-rpc-runner.d.ts +56 -0
  406. package/dist/src/orgrt/qwen-rpc-runner.d.ts.map +1 -0
  407. package/dist/src/orgrt/qwen-rpc-runner.js +346 -0
  408. package/dist/src/orgrt/qwen-rpc-runner.js.map +1 -0
  409. package/dist/src/orgrt/qwen-runner.d.ts +18 -0
  410. package/dist/src/orgrt/qwen-runner.d.ts.map +1 -0
  411. package/dist/src/orgrt/qwen-runner.js +270 -0
  412. package/dist/src/orgrt/qwen-runner.js.map +1 -0
  413. package/dist/src/orgrt/scheduler-integration.d.ts.map +1 -1
  414. package/dist/src/orgrt/scheduler-integration.js +7 -0
  415. package/dist/src/orgrt/scheduler-integration.js.map +1 -1
  416. package/dist/src/orgrt/session.d.ts +29 -1
  417. package/dist/src/orgrt/session.d.ts.map +1 -1
  418. package/dist/src/orgrt/session.js +87 -18
  419. package/dist/src/orgrt/session.js.map +1 -1
  420. package/dist/src/orgrt/task-dag.d.ts +29 -1
  421. package/dist/src/orgrt/task-dag.d.ts.map +1 -1
  422. package/dist/src/orgrt/task-dag.js +54 -0
  423. package/dist/src/orgrt/task-dag.js.map +1 -1
  424. package/dist/src/orgrt/test-loop.d.ts.map +1 -1
  425. package/dist/src/orgrt/test-loop.js +86 -9
  426. package/dist/src/orgrt/test-loop.js.map +1 -1
  427. package/dist/src/orgrt/tool-fence.d.ts.map +1 -1
  428. package/dist/src/orgrt/tool-fence.js +15 -0
  429. package/dist/src/orgrt/tool-fence.js.map +1 -1
  430. package/dist/src/orgrt/types.d.ts +50 -1
  431. package/dist/src/orgrt/types.d.ts.map +1 -1
  432. package/dist/src/orgrt/types.js +47 -4
  433. package/dist/src/orgrt/types.js.map +1 -1
  434. package/dist/src/orgrt/usage-proxy.d.ts +32 -0
  435. package/dist/src/orgrt/usage-proxy.d.ts.map +1 -0
  436. package/dist/src/orgrt/usage-proxy.js +226 -0
  437. package/dist/src/orgrt/usage-proxy.js.map +1 -0
  438. package/dist/src/pricing/model-pricing.d.ts.map +1 -1
  439. package/dist/src/pricing/model-pricing.js +0 -4
  440. package/dist/src/pricing/model-pricing.js.map +1 -1
  441. package/dist/src/security/audit-log.d.ts +47 -0
  442. package/dist/src/security/audit-log.d.ts.map +1 -0
  443. package/dist/src/security/audit-log.js +84 -0
  444. package/dist/src/security/audit-log.js.map +1 -0
  445. package/dist/src/services/config-file-manager.d.ts +2 -2
  446. package/dist/src/services/config-file-manager.d.ts.map +1 -1
  447. package/dist/src/services/config-file-manager.js +6 -7
  448. package/dist/src/services/config-file-manager.js.map +1 -1
  449. package/dist/src/suggest.d.ts.map +1 -1
  450. package/dist/src/suggest.js +4 -5
  451. package/dist/src/suggest.js.map +1 -1
  452. package/dist/src/transfer/anonymization/index.d.ts +1 -1
  453. package/dist/src/transfer/anonymization/index.js +1 -1
  454. package/dist/src/types.d.ts +3 -3
  455. package/dist/src/types.d.ts.map +1 -1
  456. package/dist/src/ui/collector.mjs +9 -13
  457. package/dist/src/ui/dashboard.html +93 -10
  458. package/dist/src/ui/data/agent-avatars.html +0 -12
  459. package/dist/src/ui/data/agent-avatars.json +10 -26
  460. package/dist/src/ui/orgs.html +8 -1
  461. package/dist/src/ui/routes-org.mjs +85 -16
  462. package/dist/src/ui/server.mjs +50 -23
  463. package/dist/src/utils/json-file.d.ts +12 -0
  464. package/dist/src/utils/json-file.d.ts.map +1 -1
  465. package/dist/src/utils/json-file.js +11 -0
  466. package/dist/src/utils/json-file.js.map +1 -1
  467. package/dist/tsconfig.tsbuildinfo +1 -1
  468. package/package.json +5 -5
  469. package/.claude/agents/consensus/crdt-synchronizer.md +0 -977
  470. package/.claude/commands/hive-mind/README.md +0 -42
  471. package/.claude/commands/hive-mind/hive-mind-consensus.md +0 -72
  472. package/.claude/commands/hive-mind/hive-mind-init.md +0 -68
  473. package/.claude/commands/hive-mind/hive-mind-memory.md +0 -73
  474. package/.claude/commands/hive-mind/hive-mind-spawn.md +0 -82
  475. package/.claude/commands/hive-mind/hive-mind-status.md +0 -56
  476. package/.claude/commands/hive-mind/hive-mind-stop.md +0 -55
  477. package/.claude/commands/hive-mind/hive-mind.md +0 -87
  478. package/.claude/commands/swarm/README.md +0 -40
  479. package/.claude/commands/swarm/swarm.md +0 -79
  480. package/.claude/skills/hive-mind-advanced/SKILL.md +0 -347
  481. package/.claude/skills/swarm-advanced/SKILL.md +0 -936
  482. package/dist/src/commands/swarm.d.ts +0 -8
  483. package/dist/src/commands/swarm.d.ts.map +0 -1
  484. package/dist/src/commands/swarm.js.map +0 -1
  485. package/dist/src/mcp-tools/hive-mind-tools.d.ts +0 -17
  486. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +0 -1
  487. package/dist/src/mcp-tools/hive-mind-tools.js +0 -1239
  488. package/dist/src/mcp-tools/hive-mind-tools.js.map +0 -1
  489. package/dist/src/mcp-tools/swarm-tools.d.ts +0 -9
  490. package/dist/src/mcp-tools/swarm-tools.d.ts.map +0 -1
  491. package/dist/src/mcp-tools/swarm-tools.js +0 -411
  492. package/dist/src/mcp-tools/swarm-tools.js.map +0 -1
  493. package/dist/src/ui/data/avatars/crdt-synchronizer.svg +0 -53
  494. package/dist/src/ui/data/avatars/gossip-coordinator.svg +0 -54
  495. package/scripts/deploy-ipfs-node.sh +0 -153
  496. package/scripts/setup-ipfs-registry.md +0 -365
  497. /package/.claude/agents/{hive-mind → monoswarm}/scout-explorer.md +0 -0
  498. /package/.claude/agents/{hive-mind → monoswarm}/worker-specialist.md +0 -0
  499. /package/.claude/commands/{swarm → monoswarm}/analysis.md +0 -0
  500. /package/.claude/commands/{swarm → monoswarm}/development.md +0 -0
  501. /package/.claude/commands/{swarm → monoswarm}/examples.md +0 -0
  502. /package/.claude/commands/{swarm → monoswarm}/maintenance.md +0 -0
  503. /package/.claude/commands/{swarm → monoswarm}/optimization.md +0 -0
  504. /package/.claude/commands/{swarm → monoswarm}/testing.md +0 -0
  505. /package/dist/src/ui/data/avatars/{code-review-swarm.svg → monoswarm-code-review.svg} +0 -0
@@ -55,14 +55,14 @@ mcp__monomind__agent_spawn({ type: "documenter", capabilities: ["synthesis", "te
55
55
 
56
56
  ```javascript
57
57
  // Store research findings for future sessions
58
- mcp__monomind__memory_store({
58
+ mcp__monomind__memory_pattern-store({
59
59
  key: "research-findings",
60
60
  value: "summary of findings",
61
61
  namespace: "research"
62
62
  })
63
63
 
64
64
  // Search existing research
65
- mcp__monomind__memory_search({
65
+ mcp__monomind__memory_pattern-search({
66
66
  query: "topic X",
67
67
  namespace: "research",
68
68
  limit: 20
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: monoswarm:spawn
3
+ ---
4
+
5
+ # monoswarm spawn
6
+
7
+ Write worker agent records into the agent store and register their ids on
8
+ the monoswarm state file (combines `agent_spawn` + `monoswarm_join`).
9
+
10
+ There is no `npx monomind monoswarm spawn` CLI command, and no `--claude`
11
+ flag that launches Claude Code as a lead process — this tool creates
12
+ bookkeeping entries only. No process, thread, or agent is started; real
13
+ concurrency comes from Claude Code's Task tool.
14
+
15
+ ## MCP Tool
16
+
17
+ ```javascript
18
+ mcp__monomind__monoswarm_agent_add({
19
+ count: 5,
20
+ role: "specialist",
21
+ agentType: "coder",
22
+ prefix: "monoswarm-worker"
23
+ })
24
+ ```
25
+
26
+ ## Parameters
27
+
28
+ | Param | Type | Default | Description |
29
+ |---|---|---|---|
30
+ | `count` | number | `1` | Number of workers to add (capped at 20 per call) |
31
+ | `role` | string | `worker` | Worker role: `worker`, `specialist`, `scout` |
32
+ | `agentType` | string | `worker` | Agent type for spawned workers (matches agent registry types) |
33
+ | `prefix` | string | `monoswarm-worker` | Prefix for generated worker IDs |
34
+
35
+ ## Examples
36
+
37
+ ```javascript
38
+ // Add 5 default workers
39
+ mcp__monomind__monoswarm_agent_add({ count: 5 })
40
+
41
+ // Add 3 specialists
42
+ mcp__monomind__monoswarm_agent_add({ count: 3, role: "specialist" })
43
+
44
+ // Add a coder-type worker with a custom ID prefix
45
+ mcp__monomind__monoswarm_agent_add({ agentType: "coder", prefix: "my-coder" })
46
+ ```
47
+
48
+ Requires the run to already be initialized via `monoswarm_init` — the
49
+ handler returns `{ success: false }` otherwise.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: monoswarm:status
3
+ ---
4
+
5
+ # monoswarm status
6
+
7
+ Show monoswarm status: agent roster, task metrics, and (if voting is in
8
+ use) pending/history proposals.
9
+
10
+ ```bash
11
+ npx monomind@latest swarm status
12
+ ```
13
+
14
+ Or, for the fuller vote/consensus view, as an MCP tool call:
15
+
16
+ ```javascript
17
+ mcp__monomind__monoswarm_status({ verbose: true })
18
+ ```
19
+
20
+ ## Parameters
21
+
22
+ | Param | Type | Default | Description |
23
+ |---|---|---|---|
24
+ | `verbose` | boolean | `false` | Include worker id list, recent vote history, and full shared-memory contents |
25
+
26
+ ## Examples
27
+
28
+ ```javascript
29
+ // Basic status
30
+ mcp__monomind__monoswarm_status({})
31
+
32
+ // Verbose: adds workerDetails, voteHistory, sharedMemory
33
+ mcp__monomind__monoswarm_status({ verbose: true })
34
+ ```
35
+
36
+ ## Output
37
+
38
+ Basic status includes:
39
+ - `runId`, `status` (`active` / `offline`), `topology`, `voteStrategy`
40
+ - `lead`: id, status, load, queued task count, elected-at, term
41
+ - `workers`: array of `{ id, type, status, tasksCompleted }` (`currentTask` is always `null` — the agent store has no such field)
42
+ - `metrics`: total/completed/active/pending task counts (real, sourced from the task store), `voteRounds`, `memoryUsage`
43
+ - `health`: overall/lead/workers/votes/memory status labels
44
+
45
+ `verbose: true` adds:
46
+ - `workerDetails` — raw worker id list
47
+ - `voteHistory` — last 10 vote decisions
48
+ - `sharedMemory` — full shared-memory object
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: monoswarm:stop
3
+ ---
4
+
5
+ # monoswarm shutdown
6
+
7
+ Clear monoswarm workers from the shared agent store and reset run state.
8
+
9
+ ```bash
10
+ npx monomind@latest swarm stop
11
+ ```
12
+
13
+ Or, as a direct MCP tool call (needed to also clear vote/consensus state):
14
+
15
+ ```javascript
16
+ mcp__monomind__monoswarm_shutdown({ graceful: true, force: false })
17
+ ```
18
+
19
+ ## Parameters
20
+
21
+ | Param | Type | Default | Description |
22
+ |---|---|---|---|
23
+ | `graceful` | boolean | `true` | If pending vote items exist, refuse to shut down unless `force: true` |
24
+ | `force` | boolean | `false` | Override the graceful refusal above |
25
+
26
+ There is no interactive confirmation prompt (this is a direct tool call, not
27
+ a CLI), and no `saveState` option — vote history is always kept, shared
28
+ memory is always cleared.
29
+
30
+ ## Examples
31
+
32
+ ```javascript
33
+ // Graceful shutdown — fails if there are pending vote items
34
+ mcp__monomind__monoswarm_shutdown({})
35
+
36
+ // Force shutdown even with pending vote items
37
+ mcp__monomind__monoswarm_shutdown({ force: true })
38
+ ```
39
+
40
+ ## Behavior
41
+
42
+ Removes all worker ids from the agent store, then resets run state:
43
+ `initialized: false`, no lead, empty worker list, cleared pending votes
44
+ and shared memory. Vote history is retained on the state file. The
45
+ response includes `workersTerminated`, `previousLead`, `votesCleared`,
46
+ and a summary `message`.
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: optimization:auto-topology
3
- description: Automatically select the optimal swarm topology based on task complexity — use pre-task hook recommendations, swarm init flags, and performance optimize CLI
3
+ description: Automatically select the optimal monoswarm topology based on task complexity — use pre-task hook recommendations, monoswarm init flags, and performance optimize CLI
4
4
  ---
5
5
 
6
6
  # Auto Topology Selection
7
7
 
8
- Automatically select the optimal swarm topology based on task complexity so you don't have to configure it manually.
8
+ Automatically select the optimal monoswarm topology based on task complexity so you don't have to configure it manually.
9
9
 
10
10
  ## How It Works
11
11
 
@@ -19,29 +19,29 @@ npx monomind hooks pre-task -d "Refactor authentication system with JWT, add tes
19
19
 
20
20
  Output includes agent and topology suggestions.
21
21
 
22
- ### 2. Initialize the Swarm With the Recommended Topology
22
+ ### 2. Initialize the Monoswarm With the Recommended Topology
23
23
 
24
24
  ```bash
25
25
  # Simple/medium tasks — hierarchical (anti-drift, tight control)
26
- npx monomind swarm init --topology hierarchical --max-agents 6 --strategy specialized
26
+ npx monomind monoswarm init --topology hierarchical --max-agents 6 --strategy specialized
27
27
 
28
28
  # Complex multi-domain tasks — hierarchical-mesh (peer communication + queen)
29
- npx monomind swarm init --topology hierarchical-mesh --max-agents 12 --strategy specialized
29
+ npx monomind monoswarm init --topology hierarchical-mesh --max-agents 12 --strategy specialized
30
30
  ```
31
31
 
32
32
  ### Topology Selection Guide
33
33
 
34
34
  | Complexity | Agents Needed | Recommended Topology |
35
35
  |---|---|---|
36
- | Simple (single file) | 1–2 | `star` — skip swarm, use Edit tool directly |
36
+ | Simple (single file) | 1–2 | `star` — skip monoswarm, use Edit tool directly |
37
37
  | Medium | 3–5 | `hierarchical` |
38
38
  | Complex (multi-module) | 6–8 | `hierarchical` |
39
39
  | Large (10+ agents) | 10–15 | `hierarchical-mesh` |
40
40
  | Sequential pipeline | any | `ring` |
41
41
 
42
- ## Optimize Existing Swarm Topology
42
+ ## Optimize Existing Monoswarm Topology
43
43
 
44
- If a swarm is already running, optimize its topology via the coordination MCP tool:
44
+ If a monoswarm is already running, optimize its topology via the coordination MCP tool:
45
45
 
46
46
  ```javascript
47
47
  mcp__monomind__coordination_topology({
@@ -80,6 +80,6 @@ npx monomind performance optimize --target all --apply
80
80
 
81
81
  ## See Also
82
82
 
83
- - `swarm init` — initialize swarm with explicit topology
83
+ - `monoswarm init` — initialize monoswarm with explicit topology
84
84
  - `performance optimize` — system-level performance tuning
85
85
  - `hooks pre-task` — get routing and topology recommendations
@@ -142,7 +142,7 @@ Then direct the stream chain:
142
142
  Use memory tools to persist chain results for future sessions:
143
143
 
144
144
  ```javascript
145
- mcp__monomind__memory_store({
145
+ mcp__monomind__memory_pattern-store({
146
146
  key: "stream-chain-result",
147
147
  value: "summary of findings",
148
148
  namespace: "stream-chain"
@@ -62,7 +62,7 @@ mcp__monomind__workflow_run({
62
62
  mcp__monomind__workflow_status({ workflowId: "wf-123" })
63
63
 
64
64
  // Store findings for future sessions
65
- mcp__monomind__memory_store({
65
+ mcp__monomind__memory_pattern-store({
66
66
  key: "dev-pattern-rest-api",
67
67
  value: "JWT auth + Express + Zod validation worked well",
68
68
  namespace: "patterns"
@@ -58,14 +58,14 @@ mcp__monomind__workflow_run({
58
58
  })
59
59
 
60
60
  // Store research findings in memory
61
- mcp__monomind__memory_store({
61
+ mcp__monomind__memory_pattern-store({
62
62
  key: "research-web-frameworks-2026",
63
63
  value: "React/Next.js leads for SSR; Astro for static; Svelte for performance",
64
64
  namespace: "research"
65
65
  })
66
66
 
67
67
  // Search past research before starting
68
- mcp__monomind__memory_search({
68
+ mcp__monomind__memory_pattern-search({
69
69
  query: "web framework performance analysis",
70
70
  namespace: "research",
71
71
  limit: 5
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Security audit log writer — shared by gates-handler.cjs (plain CJS hook
3
+ * code, no package import) and any other hook-tree script that needs to
4
+ * persist a security decision.
5
+ *
6
+ * Writes JSONL to <monomind-data-root>/security/audit-events.jsonl. The data
7
+ * root resolution mirrors getMonomindDataRoot() in
8
+ * packages/@monomind/cli/src/utils/paths.ts (and _getGitMonomindDir() in
9
+ * server.mjs) so this lands in the same branch-agnostic, worktree-shared
10
+ * location as every other monomind data file — deliberately duplicated here
11
+ * rather than imported, since this file must stay dependency-free and fast
12
+ * on every PreToolUse invocation.
13
+ *
14
+ * Separate from event-logger.cjs's high-volume general event log (5-9MB/day
15
+ * of debug telemetry) so `security audit --action clear` can truncate this
16
+ * log without collaterally wiping unrelated data.
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ const fs = require('fs');
22
+ const path = require('path');
23
+
24
+ const MAX_AUDIT_LOG_BYTES = 25 * 1024 * 1024;
25
+
26
+ function getMonoDir(workDir) {
27
+ try {
28
+ const gitEntry = path.join(workDir, '.git');
29
+ const st = fs.statSync(gitEntry);
30
+ if (st.isDirectory()) return path.join(gitEntry, 'monomind');
31
+ if (st.isFile()) {
32
+ const m = fs.readFileSync(gitEntry, 'utf8').match(/^gitdir:\s*(.+)/m);
33
+ if (m) {
34
+ const worktreeDir = path.resolve(workDir, m[1].trim());
35
+ return path.join(path.dirname(path.dirname(worktreeDir)), 'monomind');
36
+ }
37
+ }
38
+ } catch { /* fall through to default below */ }
39
+ return path.join(workDir, '.monomind');
40
+ }
41
+
42
+ /** Resolve the audit log's directory + file path for a given cwd. */
43
+ function resolveAuditLogPaths(cwd) {
44
+ const workDir = cwd || process.env.MONOMIND_CWD || process.cwd();
45
+ const monoDir = process.env.MONOMIND_DATA_DIR || getMonoDir(workDir);
46
+ const dir = path.join(monoDir, 'security');
47
+ return { dir, file: path.join(dir, 'audit-events.jsonl') };
48
+ }
49
+
50
+ /**
51
+ * Append one audit event. Never throws — a logging failure must not break
52
+ * the gate it's recording. Rotates (archive + truncate) when the log grows
53
+ * past MAX_AUDIT_LOG_BYTES rather than growing unbounded.
54
+ *
55
+ * event: { source, decision, tool?, reason?, path? }
56
+ */
57
+ function appendAuditEvent(event, cwd) {
58
+ try {
59
+ const { dir, file } = resolveAuditLogPaths(cwd);
60
+ fs.mkdirSync(dir, { recursive: true });
61
+ try {
62
+ const st = fs.statSync(file);
63
+ if (st.size > MAX_AUDIT_LOG_BYTES) {
64
+ fs.renameSync(file, `${file}.${Date.now()}.bak`);
65
+ }
66
+ } catch { /* file doesn't exist yet — nothing to rotate */ }
67
+ const entry = Object.assign({ timestamp: new Date().toISOString() }, event);
68
+ fs.appendFileSync(file, `${JSON.stringify(entry)}\n`);
69
+ } catch { /* never let audit logging break the caller */ }
70
+ }
71
+
72
+ module.exports = { appendAuditEvent, resolveAuditLogPaths, getMonoDir };
@@ -154,6 +154,42 @@ function probePort(p) {
154
154
  });
155
155
  }
156
156
 
157
+ // Resolves a foreign dashboard server's real pid + project directory without
158
+ // shelling out to `lsof` (Unix-only — unavailable on Windows, which left the
159
+ // pairing step below permanently broken there: control.json stuck at pid:0
160
+ // forever, dashboard-token never refreshed after the shared server restarts).
161
+ // GET / is an intentionally-open route that embeds the live auth token in a
162
+ // <meta name="mm-token"> tag for exactly this same-machine, loopback-trusted
163
+ // purpose; re-using it here to authenticate a follow-up GET /api/status call
164
+ // gets both the pid and the project `dir` in one portable HTTP round trip —
165
+ // no OS-specific process inspection needed on any platform.
166
+ function fetchForeignServerInfo(p) {
167
+ const http = require('http');
168
+ const getBody = (reqPath, headers) => new Promise((resolve) => {
169
+ const req = http.get({ hostname: 'localhost', port: p, path: reqPath, timeout: 1500, headers }, (res) => {
170
+ let body = '';
171
+ res.on('data', (c) => { if (body.length < 65536) body += c; });
172
+ res.on('end', () => resolve({ statusCode: res.statusCode, body }));
173
+ });
174
+ req.on('error', () => resolve(null));
175
+ req.on('timeout', () => { req.destroy(); resolve(null); });
176
+ });
177
+ return (async () => {
178
+ const home = await getBody('/');
179
+ if (!home) return null;
180
+ const m = home.body.match(/name="mm-token" content="([^"]*)"/);
181
+ const token = m ? m[1] : null;
182
+ if (!token) return null;
183
+ const status = await getBody('/api/status', { 'x-monomind-token': token });
184
+ if (!status) return null;
185
+ try {
186
+ const parsed = JSON.parse(status.body);
187
+ if (typeof parsed.pid !== 'number' || typeof parsed.dir !== 'string') return null;
188
+ return { pid: parsed.pid, dir: parsed.dir, token };
189
+ } catch { return null; }
190
+ })();
191
+ }
192
+
157
193
  const LOCK_FILE = path.join(CWD, '.monomind', 'control.lock');
158
194
 
159
195
  /**
@@ -252,8 +288,14 @@ async function runConfirm({ childPid, port: defaultPort, boundReportPath, isNpxF
252
288
  // and kill our redundant child.
253
289
  try { process.kill(childPid, 'SIGTERM'); } catch { /* already gone */ }
254
290
  if (String(process.env.MONOMIND_HOOK_QUIET || "") !== "1") process.stdout.write(`[control] port ${defaultPort} is served by another project's control server — reusing it (killed redundant child)\n`);
255
- let foreignPid = await probePort(defaultPort);
291
+ // Primary: authenticate via the foreign server's own open "/" route (see
292
+ // fetchForeignServerInfo doc comment) to get its real pid + project dir
293
+ // in one portable HTTP round trip — works on every platform, no `lsof`.
294
+ const foreignInfo = await fetchForeignServerInfo(defaultPort);
295
+ let foreignPid = foreignInfo ? foreignInfo.pid : await probePort(defaultPort);
256
296
  if (typeof foreignPid !== 'number' || foreignPid <= 0) {
297
+ // Last-resort fallback for exotic setups where the HTTP path above
298
+ // failed (e.g. a pre-token-route legacy server) — Unix-only.
257
299
  try {
258
300
  const { execFileSync } = require('child_process');
259
301
  const lsofOut = execFileSync('lsof', ['-ti', `:${defaultPort}`, '-sTCP:LISTEN'], { encoding: 'utf8', timeout: 3000 }).trim();
@@ -262,34 +304,50 @@ async function runConfirm({ childPid, port: defaultPort, boundReportPath, isNpxF
262
304
  } catch { /* ignore */ }
263
305
  }
264
306
  writeStatus(typeof foreignPid === 'number' ? foreignPid : 0, defaultPort);
265
- // Pair with the foreign server: resolve its project dir from its pid,
266
- // copy its dashboard-token beside OUR control.json (ingest is
267
- // default-deny — without this every event from this project 401s
268
- // silently), and self-register in its known-projects so future token
269
- // rotations propagate back here on server restart.
307
+ // Pair with the foreign server: copy its dashboard-token beside OUR
308
+ // control.json (ingest is default-deny — without this every event from
309
+ // this project 401s silently), and self-register in its known-projects
310
+ // so future token rotations propagate back here on server restart.
270
311
  try {
271
- if (typeof foreignPid === 'number' && foreignPid > 0) {
272
- const { execFileSync } = require('child_process');
273
- const out = execFileSync('lsof', ['-a', '-p', String(foreignPid), '-d', 'cwd', '-Fn'], { encoding: 'utf8', timeout: 3000 });
274
- const nLine = out.split('\n').find((l) => l.startsWith('n'));
275
- const serverHome = nLine ? nLine.slice(1) : null;
276
- if (serverHome) {
277
- const srcTok = path.join(serverHome, '.monomind', 'dashboard-token');
278
- const dstTok = path.join(CWD, '.monomind', 'dashboard-token');
279
- if (fs.existsSync(srcTok)) {
280
- fs.copyFileSync(srcTok, dstTok);
281
- fs.chmodSync(dstTok, 0o600);
312
+ if (foreignInfo) {
313
+ const dstTok = path.join(CWD, '.monomind', 'dashboard-token');
314
+ fs.mkdirSync(path.dirname(dstTok), { recursive: true });
315
+ fs.writeFileSync(dstTok, foreignInfo.token, { mode: 0o600 });
316
+ const kpFile = path.join(foreignInfo.dir, 'data', 'known-projects.json');
317
+ try {
318
+ const kp = fs.existsSync(kpFile) ? JSON.parse(fs.readFileSync(kpFile, 'utf8')) : [];
319
+ if (Array.isArray(kp) && !kp.includes(CWD)) {
320
+ kp.push(CWD);
321
+ fs.writeFileSync(kpFile, JSON.stringify(kp));
282
322
  }
283
- const kpFile = path.join(serverHome, 'data', 'known-projects.json');
284
- try {
285
- const kp = fs.existsSync(kpFile) ? JSON.parse(fs.readFileSync(kpFile, 'utf8')) : [];
286
- if (Array.isArray(kp) && !kp.includes(CWD)) {
287
- kp.push(CWD);
288
- fs.writeFileSync(kpFile, JSON.stringify(kp));
323
+ } catch { /* registry unreadable — token copy alone still unblocks events */ }
324
+ process.stdout.write('[control] paired dashboard token and registered this project with the shared server\n');
325
+ } else if (typeof foreignPid === 'number' && foreignPid > 0) {
326
+ // lsof gave us a pid but not a dir (it only resolves TCP listeners,
327
+ // not cwd) — fall back to its cwd resolution for the dir we need.
328
+ try {
329
+ const { execFileSync } = require('child_process');
330
+ const out = execFileSync('lsof', ['-a', '-p', String(foreignPid), '-d', 'cwd', '-Fn'], { encoding: 'utf8', timeout: 3000 });
331
+ const nLine = out.split('\n').find((l) => l.startsWith('n'));
332
+ const serverHome = nLine ? nLine.slice(1) : null;
333
+ if (serverHome) {
334
+ const srcTok = path.join(serverHome, '.monomind', 'dashboard-token');
335
+ const dstTok = path.join(CWD, '.monomind', 'dashboard-token');
336
+ if (fs.existsSync(srcTok)) {
337
+ fs.copyFileSync(srcTok, dstTok);
338
+ fs.chmodSync(dstTok, 0o600);
289
339
  }
290
- } catch { /* registry unreadable — token copy alone still unblocks events */ }
291
- process.stdout.write('[control] paired dashboard token and registered this project with the shared server\n');
292
- }
340
+ const kpFile = path.join(serverHome, 'data', 'known-projects.json');
341
+ try {
342
+ const kp = fs.existsSync(kpFile) ? JSON.parse(fs.readFileSync(kpFile, 'utf8')) : [];
343
+ if (Array.isArray(kp) && !kp.includes(CWD)) {
344
+ kp.push(CWD);
345
+ fs.writeFileSync(kpFile, JSON.stringify(kp));
346
+ }
347
+ } catch { /* registry unreadable — token copy alone still unblocks events */ }
348
+ process.stdout.write('[control] paired dashboard token and registered this project with the shared server\n');
349
+ }
350
+ } catch { /* pairing is best-effort; propagation-on-restart is the fallback */ }
293
351
  }
294
352
  } catch { /* pairing is best-effort; propagation-on-restart is the fallback */ }
295
353
  return;
@@ -38,16 +38,16 @@ module.exports = {
38
38
  // on TeammateIdle/TaskCompleted (task-handler.cjs) — since sessions that
39
39
  // never emit those events would otherwise leak registrations forever.
40
40
  const activeAfterPurge = purgeStaleRegistrations(regDir);
41
- // Refresh swarm-activity.json within the 5-min staleness window.
41
+ // Refresh monoswarm-activity.json within the 5-min staleness window.
42
42
  const activityDir = path.join(CWD, '.monomind', 'metrics');
43
43
  fs.mkdirSync(activityDir, { recursive: true });
44
- const activityPath = path.join(activityDir, 'swarm-activity.json');
44
+ const activityPath = path.join(activityDir, 'monoswarm-activity.json');
45
45
  const MAX_AGENTS = 1000;
46
46
  const active = Math.min(
47
47
  activeAfterPurge != null ? activeAfterPurge : cleanEntries(regDir, f => f.endsWith('.json')).length,
48
48
  MAX_AGENTS
49
49
  );
50
- // P2-21: swarm-activity.json is written by both this handler and
50
+ // P2-21: monoswarm-activity.json is written by both this handler and
51
51
  // task-handler.cjs's handlePostTask, concurrently (Claude Code fires
52
52
  // hook events for parallel tool calls in one message). The old
53
53
  // read-prevLastActive-then-write was a lost-update race — two
@@ -62,12 +62,12 @@ module.exports = {
62
62
  const MAX_ACTIVITY = 64 * 1024; // 64 KiB
63
63
  var actStat = fs.statSync(activityPath);
64
64
  if (actStat.size <= MAX_ACTIVITY) {
65
- prevLastActive = (JSON.parse(fs.readFileSync(activityPath, 'utf-8'))?.swarm?.lastActive) || 0;
65
+ prevLastActive = (JSON.parse(fs.readFileSync(activityPath, 'utf-8'))?.monoswarm?.lastActive) || 0;
66
66
  }
67
67
  } catch { /* ignore */ }
68
68
  atomicWriteFileSync(activityPath, JSON.stringify({
69
69
  timestamp: new Date().toISOString(),
70
- swarm: {
70
+ monoswarm: {
71
71
  active: active > 0,
72
72
  agent_count: active,
73
73
  coordination_active: active > 0,
@@ -18,6 +18,7 @@
18
18
 
19
19
  const fs = require('fs');
20
20
  const path = require('path');
21
+ const { appendAuditEvent } = require('../audit-log-writer.cjs');
21
22
 
22
23
  // ─── monofence-ai integration (additional layer on top of regex gates) ───────
23
24
  //
@@ -343,10 +344,26 @@ function checkSecrets(content, patterns) {
343
344
  * a diagnostic printed on stdout can be mistaken for hook output (and, worse,
344
345
  * read as an *allow*). Keeping every gate message on stderr removes that
345
346
  * ambiguity entirely.
347
+ *
348
+ * Also persists the decision to the security audit log (audit-log-writer.cjs)
349
+ * so `monomind security audit` reflects real block decisions instead of
350
+ * inferring synthetic events from unrelated file mtimes. Logging never blocks
351
+ * or throws — a failure here must not affect the actual gate decision.
352
+ *
353
+ * meta: { source, tool?, cwd?, path? } — source names which gate fired
354
+ * (destructive-ops / secrets / monofence-command / monofence-write / <gate>).
346
355
  */
347
- function emitBlock(reason) {
356
+ function emitBlock(reason, meta) {
348
357
  process.stderr.write(JSON.stringify({ decision: 'block', reason: reason }) + '\n');
349
358
  process.exitCode = 2;
359
+ meta = meta || {};
360
+ appendAuditEvent({
361
+ source: meta.source || 'gates',
362
+ decision: 'block',
363
+ tool: meta.tool,
364
+ reason: reason,
365
+ path: meta.path,
366
+ }, meta.cwd);
350
367
  }
351
368
 
352
369
  /**
@@ -371,12 +388,13 @@ function emitBlock(reason) {
371
388
  * hints, telemetry) stays fail-open: it has no security value and its
372
389
  * failure must never stop the user from working.
373
390
  */
374
- function failClosed(gateName, err) {
391
+ function failClosed(gateName, err, meta) {
375
392
  var msg = (err && err.message) ? err.message : String(err);
376
393
  emitBlock(
377
394
  '[gates] ' + gateName + ' gate failed to evaluate (' + msg + '). Failing CLOSED: a security ' +
378
395
  'gate that cannot run must not silently allow the operation. Fix the gate (or the project ' +
379
- 'override at .monomind/guidance/active-gates.json) and retry.'
396
+ 'override at .monomind/guidance/active-gates.json) and retry.',
397
+ Object.assign({ source: gateName }, meta)
380
398
  );
381
399
  }
382
400
 
@@ -396,11 +414,11 @@ async function handlePreBash(hCtx) {
396
414
  var config = loadCompiledConfig(hCtx.CWD);
397
415
  result = checkDestructive(cmd, config.destructivePatterns);
398
416
  } catch (e) {
399
- failClosed('destructive-ops', e);
417
+ failClosed('destructive-ops', e, { tool: hCtx.toolName, cwd: hCtx.CWD });
400
418
  return;
401
419
  }
402
420
  if (result.triggered) {
403
- emitBlock('[gates] ' + result.reason);
421
+ emitBlock('[gates] ' + result.reason, { source: 'destructive-ops', tool: hCtx.toolName, cwd: hCtx.CWD });
404
422
  return;
405
423
  }
406
424
 
@@ -410,7 +428,8 @@ async function handlePreBash(hCtx) {
410
428
  var worst = monofenceWorstThreat(mf, cmd);
411
429
  if (worst) {
412
430
  emitBlock('[monofence] Threat detected in command — ' + worst.type +
413
- ' (confidence ' + Math.round(worst.confidence * 100) + '%): ' + worst.description);
431
+ ' (confidence ' + Math.round(worst.confidence * 100) + '%): ' + worst.description,
432
+ { source: 'monofence-command', tool: hCtx.toolName, cwd: hCtx.CWD });
414
433
  }
415
434
  }
416
435
 
@@ -444,11 +463,12 @@ function extractWriteContent(toolInput) {
444
463
  */
445
464
  async function handlePreWrite(hCtx) {
446
465
  var toolInput = hCtx.toolInput || {};
466
+ var writePath = toolInput.file_path || toolInput.path;
447
467
  var content;
448
468
  try {
449
469
  content = extractWriteContent(toolInput);
450
470
  } catch (e) {
451
- failClosed('secrets', e);
471
+ failClosed('secrets', e, { tool: hCtx.toolName, cwd: hCtx.CWD, path: writePath });
452
472
  return;
453
473
  }
454
474
  if (!content) return;
@@ -461,11 +481,11 @@ async function handlePreWrite(hCtx) {
461
481
  var config = loadCompiledConfig(hCtx.CWD);
462
482
  result = checkSecrets(content, config.secretPatterns);
463
483
  } catch (e) {
464
- failClosed('secrets', e);
484
+ failClosed('secrets', e, { tool: hCtx.toolName, cwd: hCtx.CWD, path: writePath });
465
485
  return;
466
486
  }
467
487
  if (result.triggered) {
468
- emitBlock('[gates] ' + result.reason);
488
+ emitBlock('[gates] ' + result.reason, { source: 'secrets', tool: hCtx.toolName, cwd: hCtx.CWD, path: writePath });
469
489
  return;
470
490
  }
471
491
 
@@ -475,7 +495,8 @@ async function handlePreWrite(hCtx) {
475
495
  var worst = monofenceWorstThreat(mf, content);
476
496
  if (worst) {
477
497
  emitBlock('[monofence] Threat detected in written content — ' + worst.type +
478
- ' (confidence ' + Math.round(worst.confidence * 100) + '%): ' + worst.description);
498
+ ' (confidence ' + Math.round(worst.confidence * 100) + '%): ' + worst.description,
499
+ { source: 'monofence-write', tool: hCtx.toolName, cwd: hCtx.CWD, path: writePath });
479
500
  }
480
501
  }
481
502
 
@@ -353,7 +353,7 @@ module.exports = {
353
353
  : 'project context general';
354
354
 
355
355
  var memoryMod = null;
356
- try { memoryMod = await import('@monomind/memory'); } catch (e) {}
356
+ try { memoryMod = await import('@monoes/memory'); } catch (e) {}
357
357
 
358
358
  if (memoryMod && memoryMod.KnowledgeStore && memoryMod.KnowledgeRetriever) {
359
359
  var kStore = new memoryMod.KnowledgeStore(knowledgeDir);
@@ -93,17 +93,17 @@ module.exports = {
93
93
  }
94
94
  // Also purge any stragglers older than 30 min (shared with agent-start-handler.cjs)
95
95
  const remaining = purgeStaleRegistrations(regDir) || 0;
96
- // P2-21: shares a lock with agent-start-handler.cjs's swarm-activity.json
96
+ // P2-21: shares a lock with agent-start-handler.cjs's monoswarm-activity.json
97
97
  // writer (same path + '.lock') so the read-prevLastActive-then-write
98
98
  // cycle can't race with that handler's concurrent write and silently
99
99
  // drop whichever one wrote last — see that file for full rationale.
100
- const _actPath = path.join(CWD, '.monomind', 'metrics', 'swarm-activity.json');
100
+ const _actPath = path.join(CWD, '.monomind', 'metrics', 'monoswarm-activity.json');
101
101
  withLock(_actPath + '.lock', function() {
102
102
  let _prevLastActive = 0;
103
- try { var _actSt = fs.statSync(_actPath); if (_actSt.size < 65536) { _prevLastActive = (JSON.parse(fs.readFileSync(_actPath, 'utf-8'))?.swarm?.lastActive) || 0; } } catch { /* ignore */ }
103
+ try { var _actSt = fs.statSync(_actPath); if (_actSt.size < 65536) { _prevLastActive = (JSON.parse(fs.readFileSync(_actPath, 'utf-8'))?.monoswarm?.lastActive) || 0; } } catch { /* ignore */ }
104
104
  atomicWriteFileSync(_actPath, JSON.stringify({
105
105
  timestamp: new Date().toISOString(),
106
- swarm: {
106
+ monoswarm: {
107
107
  active: remaining > 0,
108
108
  agent_count: remaining,
109
109
  coordination_active: remaining > 0,