monomind 1.11.8 → 1.11.10

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 (379) hide show
  1. package/.claude/agents/github/issue-tracker.md +5 -5
  2. package/.claude/agents/github/pr-manager.md +5 -5
  3. package/.claude/agents/github/release-manager.md +3 -3
  4. package/.claude/agents/github/repo-architect.md +3 -3
  5. package/.claude/agents/github/swarm-issue.md +1 -1
  6. package/.claude/agents/github/sync-coordinator.md +1 -1
  7. package/.claude/agents/github/workflow-automation.md +1 -1
  8. package/.claude/commands/github/repo-architect.md +1 -1
  9. package/.claude/commands/github/sync-coordinator.md +1 -1
  10. package/.claude/commands/mastermind/createorg.md +4 -1
  11. package/.claude/commands/mastermind/help.md +2 -2
  12. package/.claude/commands/mastermind/orgs.md +21 -0
  13. package/.claude/commands/mastermind/orgstatus.md +59 -0
  14. package/.claude/commands/mastermind/runorg.md +4 -2
  15. package/.claude/commands/mastermind/stoporg.md +78 -0
  16. package/.claude/commands/mastermind/swarm.md +1 -1
  17. package/.claude/helpers/handlers/gates-handler.cjs +135 -0
  18. package/.claude/helpers/handlers/task-handler.cjs +7 -3
  19. package/.claude/helpers/hook-handler.cjs +11 -2
  20. package/.claude/helpers/intelligence.cjs +87 -0
  21. package/.claude/helpers/learning-service.mjs +60 -0
  22. package/.claude/helpers/memory.cjs +69 -0
  23. package/.claude/helpers/router.cjs +68 -0
  24. package/.claude/helpers/session.cjs +63 -0
  25. package/.claude/helpers/utils/monograph.cjs +4 -2
  26. package/.claude/helpers/utils/telemetry.cjs +3 -2
  27. package/.claude/scheduled_tasks.lock +1 -1
  28. package/.claude/settings.json +12 -2
  29. package/.claude/skills/agentic-jujutsu/SKILL.md +1 -1
  30. package/.claude/skills/hive-mind-advanced/SKILL.md +4 -4
  31. package/.claude/skills/mastermind/_agent-select.md +2 -2
  32. package/.claude/skills/mastermind/access.md +11 -11
  33. package/.claude/skills/mastermind/adapter-manager.md +13 -13
  34. package/.claude/skills/mastermind/adapters.md +7 -7
  35. package/.claude/skills/mastermind/agent-detail.md +1 -1
  36. package/.claude/skills/mastermind/agents.md +5 -5
  37. package/.claude/skills/mastermind/approval-detail.md +6 -6
  38. package/.claude/skills/mastermind/approve.md +9 -10
  39. package/.claude/skills/mastermind/backup.md +2 -2
  40. package/.claude/skills/mastermind/bootstrap.md +2 -2
  41. package/.claude/skills/mastermind/companies.md +7 -7
  42. package/.claude/skills/mastermind/createorg.md +213 -8
  43. package/.claude/skills/mastermind/diagnose.md +4 -4
  44. package/.claude/skills/mastermind/env.md +1 -1
  45. package/.claude/skills/mastermind/environments.md +8 -8
  46. package/.claude/skills/mastermind/export.md +12 -3
  47. package/.claude/skills/mastermind/goal-detail.md +9 -9
  48. package/.claude/skills/mastermind/goals.md +4 -4
  49. package/.claude/skills/mastermind/heartbeat.md +1 -1
  50. package/.claude/skills/mastermind/idea.md +4 -4
  51. package/.claude/skills/mastermind/import.md +8 -8
  52. package/.claude/skills/mastermind/inbox.md +4 -4
  53. package/.claude/skills/mastermind/instance-settings.md +9 -9
  54. package/.claude/skills/mastermind/instance.md +9 -7
  55. package/.claude/skills/mastermind/invite-landing.md +5 -5
  56. package/.claude/skills/mastermind/invites.md +12 -12
  57. package/.claude/skills/mastermind/issue-detail.md +8 -8
  58. package/.claude/skills/mastermind/monitor.md +11 -11
  59. package/.claude/skills/mastermind/my-issues.md +6 -6
  60. package/.claude/skills/mastermind/new-agent.md +4 -4
  61. package/.claude/skills/mastermind/org-chart.md +8 -6
  62. package/.claude/skills/mastermind/org-settings.md +58 -21
  63. package/.claude/skills/mastermind/orgs.md +98 -0
  64. package/.claude/skills/mastermind/orgstatus.md +194 -0
  65. package/.claude/skills/mastermind/plan-to-tasks.md +1 -1
  66. package/.claude/skills/mastermind/plugin-manager.md +12 -12
  67. package/.claude/skills/mastermind/plugin-settings.md +5 -5
  68. package/.claude/skills/mastermind/plugins.md +5 -5
  69. package/.claude/skills/mastermind/profile.md +2 -2
  70. package/.claude/skills/mastermind/project-detail.md +12 -12
  71. package/.claude/skills/mastermind/project-workspace.md +4 -4
  72. package/.claude/skills/mastermind/projects.md +4 -4
  73. package/.claude/skills/mastermind/review.md +50 -0
  74. package/.claude/skills/mastermind/routine-detail.md +3 -3
  75. package/.claude/skills/mastermind/routines.md +7 -6
  76. package/.claude/skills/mastermind/runorg.md +178 -8
  77. package/.claude/skills/mastermind/search.md +6 -6
  78. package/.claude/skills/mastermind/secrets.md +6 -6
  79. package/.claude/skills/mastermind/skills.md +4 -4
  80. package/.claude/skills/mastermind/stoporg.md +138 -0
  81. package/.claude/skills/mastermind/workspace-detail.md +5 -5
  82. package/.claude/skills/mastermind/workspaces.md +9 -9
  83. package/.claude/skills/performance-analysis/SKILL.md +3 -3
  84. package/.claude/skills/sparc-methodology/SKILL.md +2 -2
  85. package/.claude/skills/swarm-advanced/SKILL.md +4 -4
  86. package/.claude-plugin/README.md +10 -10
  87. package/.claude-plugin/docs/INSTALLATION.md +6 -6
  88. package/.claude-plugin/docs/PLUGIN_SUMMARY.md +9 -9
  89. package/.claude-plugin/docs/QUICKSTART.md +2 -2
  90. package/.claude-plugin/docs/STRUCTURE.md +1 -1
  91. package/.claude-plugin/marketplace.json +5 -5
  92. package/.claude-plugin/plugin.json +3 -3
  93. package/README.md +129 -376
  94. package/package.json +4 -8
  95. package/packages/@monomind/cli/README.md +129 -376
  96. package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +27 -1
  97. package/packages/@monomind/cli/dist/src/agents/registry-builder.js +2 -2
  98. package/packages/@monomind/cli/dist/src/commands/agent.js +4 -9
  99. package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +1 -1
  100. package/packages/@monomind/cli/dist/src/commands/analyze.js +1 -1
  101. package/packages/@monomind/cli/dist/src/commands/claims.d.ts +1 -1
  102. package/packages/@monomind/cli/dist/src/commands/claims.js +2 -2
  103. package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +1 -1
  104. package/packages/@monomind/cli/dist/src/commands/cleanup.js +1 -1
  105. package/packages/@monomind/cli/dist/src/commands/completions.d.ts +1 -1
  106. package/packages/@monomind/cli/dist/src/commands/completions.js +1 -1
  107. package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +1 -1
  108. package/packages/@monomind/cli/dist/src/commands/deployment.js +2 -2
  109. package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +1 -1
  110. package/packages/@monomind/cli/dist/src/commands/doctor.js +69 -4
  111. package/packages/@monomind/cli/dist/src/commands/guidance.js +129 -0
  112. package/packages/@monomind/cli/dist/src/commands/index.js +4 -0
  113. package/packages/@monomind/cli/dist/src/commands/init.js +18 -0
  114. package/packages/@monomind/cli/dist/src/commands/monovector/import.d.ts +1 -1
  115. package/packages/@monomind/cli/dist/src/commands/monovector/import.js +1 -1
  116. package/packages/@monomind/cli/dist/src/commands/monovector/index.d.ts +1 -1
  117. package/packages/@monomind/cli/dist/src/commands/monovector/index.js +1 -1
  118. package/packages/@monomind/cli/dist/src/commands/monovector/setup.d.ts +1 -1
  119. package/packages/@monomind/cli/dist/src/commands/monovector/setup.js +2 -2
  120. package/packages/@monomind/cli/dist/src/commands/neural.d.ts +1 -1
  121. package/packages/@monomind/cli/dist/src/commands/neural.js +2 -2
  122. package/packages/@monomind/cli/dist/src/commands/performance.d.ts +1 -1
  123. package/packages/@monomind/cli/dist/src/commands/performance.js +2 -2
  124. package/packages/@monomind/cli/dist/src/commands/platforms.d.ts +1 -1
  125. package/packages/@monomind/cli/dist/src/commands/platforms.js +1 -1
  126. package/packages/@monomind/cli/dist/src/commands/plugins.d.ts +1 -1
  127. package/packages/@monomind/cli/dist/src/commands/plugins.js +2 -4
  128. package/packages/@monomind/cli/dist/src/commands/providers.d.ts +1 -1
  129. package/packages/@monomind/cli/dist/src/commands/providers.js +2 -2
  130. package/packages/@monomind/cli/dist/src/commands/route.d.ts +1 -1
  131. package/packages/@monomind/cli/dist/src/commands/route.js +5 -11
  132. package/packages/@monomind/cli/dist/src/commands/security.d.ts +1 -1
  133. package/packages/@monomind/cli/dist/src/commands/security.js +140 -91
  134. package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.d.ts +7 -1
  135. package/packages/@monomind/cli/dist/src/index.d.ts +1 -1
  136. package/packages/@monomind/cli/dist/src/index.js +10 -26
  137. package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +2 -2
  138. package/packages/@monomind/cli/dist/src/init/executor.js +3 -3
  139. package/packages/@monomind/cli/dist/src/init/settings-generator.js +2 -2
  140. package/packages/@monomind/cli/dist/src/mcp-client.d.ts +5 -0
  141. package/packages/@monomind/cli/dist/src/mcp-client.js +7 -0
  142. package/packages/@monomind/cli/dist/src/mcp-server.js +17 -1
  143. package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.js +6 -6
  144. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +2 -2
  145. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +1 -1
  146. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +1 -52
  147. package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +4 -0
  148. package/packages/@monomind/cli/dist/src/mcp-tools/index.js +4 -0
  149. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +1 -2
  150. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +107 -5
  151. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +6 -6
  152. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +48 -61
  153. package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +0 -1
  154. package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +232 -57
  155. package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +3 -32
  156. package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +0 -69
  157. package/packages/@monomind/cli/dist/src/routing/embed-worker.d.ts +2 -0
  158. package/packages/@monomind/cli/dist/src/routing/embed-worker.js +55 -0
  159. package/packages/@monomind/cli/dist/src/routing/embedder.d.ts +31 -0
  160. package/packages/@monomind/cli/dist/src/routing/embedder.js +0 -0
  161. package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +1 -1
  162. package/packages/@monomind/cli/dist/src/routing/llm-caller.js +18 -3
  163. package/packages/@monomind/cli/dist/src/routing/route-layer-factory.d.ts +9 -0
  164. package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +151 -0
  165. package/packages/@monomind/cli/dist/src/services/worker-daemon.js +0 -1
  166. package/packages/@monomind/cli/dist/src/suggest.d.ts +1 -1
  167. package/packages/@monomind/cli/dist/src/suggest.js +1 -1
  168. package/packages/@monomind/cli/package.json +9 -10
  169. package/packages/@monomind/cli/scripts/understand-analyze.mjs +1 -1
  170. package/packages/@monomind/guidance/README.md +6 -6
  171. package/packages/@monomind/guidance/package.json +9 -1
  172. package/scripts/install.sh +7 -7
  173. package/scripts/ua-enrich.mjs +3 -2
  174. package/packages/@monomind/shared/dist/agent-contract.d.ts +0 -28
  175. package/packages/@monomind/shared/dist/agent-contract.js +0 -57
  176. package/packages/@monomind/shared/dist/agent-error-result.d.ts +0 -17
  177. package/packages/@monomind/shared/dist/agent-error-result.js +0 -23
  178. package/packages/@monomind/shared/dist/core/config/defaults.d.ts +0 -41
  179. package/packages/@monomind/shared/dist/core/config/defaults.js +0 -186
  180. package/packages/@monomind/shared/dist/core/config/index.d.ts +0 -8
  181. package/packages/@monomind/shared/dist/core/config/index.js +0 -12
  182. package/packages/@monomind/shared/dist/core/config/loader.d.ts +0 -45
  183. package/packages/@monomind/shared/dist/core/config/loader.js +0 -238
  184. package/packages/@monomind/shared/dist/core/config/schema.d.ts +0 -324
  185. package/packages/@monomind/shared/dist/core/config/schema.js +0 -160
  186. package/packages/@monomind/shared/dist/core/config/validator.d.ts +0 -92
  187. package/packages/@monomind/shared/dist/core/config/validator.js +0 -147
  188. package/packages/@monomind/shared/dist/core/event-bus.d.ts +0 -31
  189. package/packages/@monomind/shared/dist/core/event-bus.js +0 -197
  190. package/packages/@monomind/shared/dist/core/index.d.ts +0 -15
  191. package/packages/@monomind/shared/dist/core/index.js +0 -19
  192. package/packages/@monomind/shared/dist/core/interfaces/agent.interface.d.ts +0 -200
  193. package/packages/@monomind/shared/dist/core/interfaces/agent.interface.js +0 -6
  194. package/packages/@monomind/shared/dist/core/interfaces/coordinator.interface.d.ts +0 -310
  195. package/packages/@monomind/shared/dist/core/interfaces/coordinator.interface.js +0 -7
  196. package/packages/@monomind/shared/dist/core/interfaces/event.interface.d.ts +0 -224
  197. package/packages/@monomind/shared/dist/core/interfaces/event.interface.js +0 -46
  198. package/packages/@monomind/shared/dist/core/interfaces/index.d.ts +0 -10
  199. package/packages/@monomind/shared/dist/core/interfaces/index.js +0 -15
  200. package/packages/@monomind/shared/dist/core/interfaces/memory.interface.d.ts +0 -298
  201. package/packages/@monomind/shared/dist/core/interfaces/memory.interface.js +0 -7
  202. package/packages/@monomind/shared/dist/core/interfaces/task.interface.d.ts +0 -185
  203. package/packages/@monomind/shared/dist/core/interfaces/task.interface.js +0 -6
  204. package/packages/@monomind/shared/dist/core/orchestrator/event-coordinator.d.ts +0 -35
  205. package/packages/@monomind/shared/dist/core/orchestrator/event-coordinator.js +0 -101
  206. package/packages/@monomind/shared/dist/core/orchestrator/health-monitor.d.ts +0 -60
  207. package/packages/@monomind/shared/dist/core/orchestrator/health-monitor.js +0 -166
  208. package/packages/@monomind/shared/dist/core/orchestrator/index.d.ts +0 -46
  209. package/packages/@monomind/shared/dist/core/orchestrator/index.js +0 -64
  210. package/packages/@monomind/shared/dist/core/orchestrator/lifecycle-manager.d.ts +0 -56
  211. package/packages/@monomind/shared/dist/core/orchestrator/lifecycle-manager.js +0 -195
  212. package/packages/@monomind/shared/dist/core/orchestrator/session-manager.d.ts +0 -83
  213. package/packages/@monomind/shared/dist/core/orchestrator/session-manager.js +0 -193
  214. package/packages/@monomind/shared/dist/core/orchestrator/task-manager.d.ts +0 -49
  215. package/packages/@monomind/shared/dist/core/orchestrator/task-manager.js +0 -253
  216. package/packages/@monomind/shared/dist/events/domain-events.d.ts +0 -282
  217. package/packages/@monomind/shared/dist/events/domain-events.js +0 -165
  218. package/packages/@monomind/shared/dist/events/event-store.d.ts +0 -126
  219. package/packages/@monomind/shared/dist/events/event-store.js +0 -416
  220. package/packages/@monomind/shared/dist/events/event-store.test.d.ts +0 -8
  221. package/packages/@monomind/shared/dist/events/event-store.test.js +0 -293
  222. package/packages/@monomind/shared/dist/events/example-usage.d.ts +0 -10
  223. package/packages/@monomind/shared/dist/events/example-usage.js +0 -193
  224. package/packages/@monomind/shared/dist/events/index.d.ts +0 -21
  225. package/packages/@monomind/shared/dist/events/index.js +0 -22
  226. package/packages/@monomind/shared/dist/events/projections.d.ts +0 -177
  227. package/packages/@monomind/shared/dist/events/projections.js +0 -421
  228. package/packages/@monomind/shared/dist/events/rvf-event-log.d.ts +0 -82
  229. package/packages/@monomind/shared/dist/events/rvf-event-log.js +0 -340
  230. package/packages/@monomind/shared/dist/events/state-reconstructor.d.ts +0 -101
  231. package/packages/@monomind/shared/dist/events/state-reconstructor.js +0 -263
  232. package/packages/@monomind/shared/dist/events.d.ts +0 -80
  233. package/packages/@monomind/shared/dist/events.js +0 -249
  234. package/packages/@monomind/shared/dist/hooks/example-usage.d.ts +0 -42
  235. package/packages/@monomind/shared/dist/hooks/example-usage.js +0 -351
  236. package/packages/@monomind/shared/dist/hooks/executor.d.ts +0 -100
  237. package/packages/@monomind/shared/dist/hooks/executor.js +0 -264
  238. package/packages/@monomind/shared/dist/hooks/hooks.test.d.ts +0 -9
  239. package/packages/@monomind/shared/dist/hooks/hooks.test.js +0 -322
  240. package/packages/@monomind/shared/dist/hooks/index.d.ts +0 -52
  241. package/packages/@monomind/shared/dist/hooks/index.js +0 -51
  242. package/packages/@monomind/shared/dist/hooks/registry.d.ts +0 -133
  243. package/packages/@monomind/shared/dist/hooks/registry.js +0 -277
  244. package/packages/@monomind/shared/dist/hooks/safety/bash-safety.d.ts +0 -105
  245. package/packages/@monomind/shared/dist/hooks/safety/bash-safety.js +0 -481
  246. package/packages/@monomind/shared/dist/hooks/safety/file-organization.d.ts +0 -144
  247. package/packages/@monomind/shared/dist/hooks/safety/file-organization.js +0 -328
  248. package/packages/@monomind/shared/dist/hooks/safety/git-commit.d.ts +0 -158
  249. package/packages/@monomind/shared/dist/hooks/safety/git-commit.js +0 -450
  250. package/packages/@monomind/shared/dist/hooks/safety/index.d.ts +0 -17
  251. package/packages/@monomind/shared/dist/hooks/safety/index.js +0 -17
  252. package/packages/@monomind/shared/dist/hooks/session-hooks.d.ts +0 -234
  253. package/packages/@monomind/shared/dist/hooks/session-hooks.js +0 -334
  254. package/packages/@monomind/shared/dist/hooks/task-hooks.d.ts +0 -163
  255. package/packages/@monomind/shared/dist/hooks/task-hooks.js +0 -326
  256. package/packages/@monomind/shared/dist/hooks/types.d.ts +0 -267
  257. package/packages/@monomind/shared/dist/hooks/types.js +0 -62
  258. package/packages/@monomind/shared/dist/hooks/verify-exports.test.d.ts +0 -9
  259. package/packages/@monomind/shared/dist/hooks/verify-exports.test.js +0 -93
  260. package/packages/@monomind/shared/dist/index.d.ts +0 -46
  261. package/packages/@monomind/shared/dist/index.js +0 -77
  262. package/packages/@monomind/shared/dist/mcp/connection-pool.d.ts +0 -98
  263. package/packages/@monomind/shared/dist/mcp/connection-pool.js +0 -364
  264. package/packages/@monomind/shared/dist/mcp/index.d.ts +0 -69
  265. package/packages/@monomind/shared/dist/mcp/index.js +0 -84
  266. package/packages/@monomind/shared/dist/mcp/server.d.ts +0 -166
  267. package/packages/@monomind/shared/dist/mcp/server.js +0 -593
  268. package/packages/@monomind/shared/dist/mcp/session-manager.d.ts +0 -136
  269. package/packages/@monomind/shared/dist/mcp/session-manager.js +0 -335
  270. package/packages/@monomind/shared/dist/mcp/tool-registry.d.ts +0 -178
  271. package/packages/@monomind/shared/dist/mcp/tool-registry.js +0 -439
  272. package/packages/@monomind/shared/dist/mcp/transport/http.d.ts +0 -104
  273. package/packages/@monomind/shared/dist/mcp/transport/http.js +0 -476
  274. package/packages/@monomind/shared/dist/mcp/transport/index.d.ts +0 -102
  275. package/packages/@monomind/shared/dist/mcp/transport/index.js +0 -238
  276. package/packages/@monomind/shared/dist/mcp/transport/stdio.d.ts +0 -104
  277. package/packages/@monomind/shared/dist/mcp/transport/stdio.js +0 -263
  278. package/packages/@monomind/shared/dist/mcp/transport/websocket.d.ts +0 -133
  279. package/packages/@monomind/shared/dist/mcp/transport/websocket.js +0 -396
  280. package/packages/@monomind/shared/dist/mcp/types.d.ts +0 -438
  281. package/packages/@monomind/shared/dist/mcp/types.js +0 -54
  282. package/packages/@monomind/shared/dist/plugin-interface.d.ts +0 -544
  283. package/packages/@monomind/shared/dist/plugin-interface.js +0 -23
  284. package/packages/@monomind/shared/dist/plugin-loader.d.ts +0 -139
  285. package/packages/@monomind/shared/dist/plugin-loader.js +0 -434
  286. package/packages/@monomind/shared/dist/plugin-registry.d.ts +0 -183
  287. package/packages/@monomind/shared/dist/plugin-registry.js +0 -457
  288. package/packages/@monomind/shared/dist/plugins/index.d.ts +0 -10
  289. package/packages/@monomind/shared/dist/plugins/index.js +0 -10
  290. package/packages/@monomind/shared/dist/plugins/official/hive-mind-plugin.d.ts +0 -106
  291. package/packages/@monomind/shared/dist/plugins/official/hive-mind-plugin.js +0 -241
  292. package/packages/@monomind/shared/dist/plugins/official/index.d.ts +0 -10
  293. package/packages/@monomind/shared/dist/plugins/official/index.js +0 -10
  294. package/packages/@monomind/shared/dist/plugins/official/maestro-plugin.d.ts +0 -121
  295. package/packages/@monomind/shared/dist/plugins/official/maestro-plugin.js +0 -355
  296. package/packages/@monomind/shared/dist/plugins/types.d.ts +0 -93
  297. package/packages/@monomind/shared/dist/plugins/types.js +0 -9
  298. package/packages/@monomind/shared/dist/reducers.d.ts +0 -33
  299. package/packages/@monomind/shared/dist/reducers.js +0 -89
  300. package/packages/@monomind/shared/dist/resilience/bulkhead.d.ts +0 -105
  301. package/packages/@monomind/shared/dist/resilience/bulkhead.js +0 -206
  302. package/packages/@monomind/shared/dist/resilience/circuit-breaker.d.ts +0 -132
  303. package/packages/@monomind/shared/dist/resilience/circuit-breaker.js +0 -233
  304. package/packages/@monomind/shared/dist/resilience/index.d.ts +0 -19
  305. package/packages/@monomind/shared/dist/resilience/index.js +0 -19
  306. package/packages/@monomind/shared/dist/resilience/rate-limiter.d.ts +0 -168
  307. package/packages/@monomind/shared/dist/resilience/rate-limiter.js +0 -314
  308. package/packages/@monomind/shared/dist/resilience/retry.d.ts +0 -91
  309. package/packages/@monomind/shared/dist/resilience/retry.js +0 -159
  310. package/packages/@monomind/shared/dist/retry-policy.d.ts +0 -14
  311. package/packages/@monomind/shared/dist/retry-policy.js +0 -23
  312. package/packages/@monomind/shared/dist/retry-runner.d.ts +0 -21
  313. package/packages/@monomind/shared/dist/retry-runner.js +0 -57
  314. package/packages/@monomind/shared/dist/schema-validator.d.ts +0 -46
  315. package/packages/@monomind/shared/dist/schema-validator.js +0 -133
  316. package/packages/@monomind/shared/dist/scratchpad.d.ts +0 -23
  317. package/packages/@monomind/shared/dist/scratchpad.js +0 -32
  318. package/packages/@monomind/shared/dist/security/index.d.ts +0 -10
  319. package/packages/@monomind/shared/dist/security/index.js +0 -12
  320. package/packages/@monomind/shared/dist/security/input-validation.d.ts +0 -73
  321. package/packages/@monomind/shared/dist/security/input-validation.js +0 -201
  322. package/packages/@monomind/shared/dist/security/secure-random.d.ts +0 -92
  323. package/packages/@monomind/shared/dist/security/secure-random.js +0 -142
  324. package/packages/@monomind/shared/dist/services/index.d.ts +0 -7
  325. package/packages/@monomind/shared/dist/services/index.js +0 -7
  326. package/packages/@monomind/shared/dist/services/progress.service.d.ts +0 -124
  327. package/packages/@monomind/shared/dist/services/progress.service.js +0 -402
  328. package/packages/@monomind/shared/dist/state-manager.d.ts +0 -34
  329. package/packages/@monomind/shared/dist/state-manager.js +0 -73
  330. package/packages/@monomind/shared/dist/state-validator.d.ts +0 -20
  331. package/packages/@monomind/shared/dist/state-validator.js +0 -49
  332. package/packages/@monomind/shared/dist/swarm-state.d.ts +0 -52
  333. package/packages/@monomind/shared/dist/swarm-state.js +0 -18
  334. package/packages/@monomind/shared/dist/testing/fixture-builder.d.ts +0 -14
  335. package/packages/@monomind/shared/dist/testing/fixture-builder.js +0 -32
  336. package/packages/@monomind/shared/dist/testing/index.d.ts +0 -2
  337. package/packages/@monomind/shared/dist/testing/index.js +0 -2
  338. package/packages/@monomind/shared/dist/testing/test-model.d.ts +0 -29
  339. package/packages/@monomind/shared/dist/testing/test-model.js +0 -53
  340. package/packages/@monomind/shared/dist/types/agent-registry.d.ts +0 -62
  341. package/packages/@monomind/shared/dist/types/agent-registry.js +0 -8
  342. package/packages/@monomind/shared/dist/types/agent-version.d.ts +0 -49
  343. package/packages/@monomind/shared/dist/types/agent-version.js +0 -7
  344. package/packages/@monomind/shared/dist/types/agent.types.d.ts +0 -137
  345. package/packages/@monomind/shared/dist/types/agent.types.js +0 -6
  346. package/packages/@monomind/shared/dist/types/benchmark.d.ts +0 -39
  347. package/packages/@monomind/shared/dist/types/benchmark.js +0 -6
  348. package/packages/@monomind/shared/dist/types/communication-flow.d.ts +0 -25
  349. package/packages/@monomind/shared/dist/types/communication-flow.js +0 -7
  350. package/packages/@monomind/shared/dist/types/consensus-audit.d.ts +0 -40
  351. package/packages/@monomind/shared/dist/types/consensus-audit.js +0 -7
  352. package/packages/@monomind/shared/dist/types/dlq.d.ts +0 -40
  353. package/packages/@monomind/shared/dist/types/dlq.js +0 -7
  354. package/packages/@monomind/shared/dist/types/eval.d.ts +0 -59
  355. package/packages/@monomind/shared/dist/types/eval.js +0 -6
  356. package/packages/@monomind/shared/dist/types/index.d.ts +0 -19
  357. package/packages/@monomind/shared/dist/types/index.js +0 -33
  358. package/packages/@monomind/shared/dist/types/mcp.types.d.ts +0 -266
  359. package/packages/@monomind/shared/dist/types/mcp.types.js +0 -7
  360. package/packages/@monomind/shared/dist/types/memory.types.d.ts +0 -236
  361. package/packages/@monomind/shared/dist/types/memory.types.js +0 -7
  362. package/packages/@monomind/shared/dist/types/retry.d.ts +0 -72
  363. package/packages/@monomind/shared/dist/types/retry.js +0 -40
  364. package/packages/@monomind/shared/dist/types/specialization.d.ts +0 -27
  365. package/packages/@monomind/shared/dist/types/specialization.js +0 -8
  366. package/packages/@monomind/shared/dist/types/swarm.types.d.ts +0 -186
  367. package/packages/@monomind/shared/dist/types/swarm.types.js +0 -65
  368. package/packages/@monomind/shared/dist/types/task.types.d.ts +0 -178
  369. package/packages/@monomind/shared/dist/types/task.types.js +0 -32
  370. package/packages/@monomind/shared/dist/types/termination.d.ts +0 -29
  371. package/packages/@monomind/shared/dist/types/termination.js +0 -14
  372. package/packages/@monomind/shared/dist/types/tool-version.d.ts +0 -41
  373. package/packages/@monomind/shared/dist/types/tool-version.js +0 -8
  374. package/packages/@monomind/shared/dist/types/trigger.d.ts +0 -40
  375. package/packages/@monomind/shared/dist/types/trigger.js +0 -8
  376. package/packages/@monomind/shared/dist/types.d.ts +0 -197
  377. package/packages/@monomind/shared/dist/types.js +0 -21
  378. package/packages/@monomind/shared/dist/utils/secure-logger.d.ts +0 -69
  379. package/packages/@monomind/shared/dist/utils/secure-logger.js +0 -208
@@ -84,7 +84,7 @@ echo "────────────────────────
84
84
  defaultAdap=$(jq -r '.default_adapter // "claude-sonnet-4-6"' "$adaptersFile")
85
85
 
86
86
  jq -r --arg def "$defaultAdap" '
87
- .adapters[] |
87
+ (.adapters // [])[] |
88
88
  [.type, (.label // .type), (.source // "built-in"), (.modelsCount // 0 | tostring),
89
89
  (if .disabled then "DISABLED" else "ACTIVE" end),
90
90
  (if .type == $def then " ← default" else "" end)]
@@ -95,7 +95,7 @@ done
95
95
 
96
96
  echo ""
97
97
  echo "Default adapter: $defaultAdap"
98
- echo "External adapters: $(jq '[.adapters[] | select(.source == "external")] | length' "$adaptersFile")"
98
+ echo "External adapters: $(jq '[(.adapters // [])[] | select(.source == "external")] | length' "$adaptersFile")"
99
99
  ```
100
100
 
101
101
  ### enable / disable
@@ -104,7 +104,7 @@ echo "External adapters: $(jq '[.adapters[] | select(.source == "external")] | l
104
104
  action_status=$([ "$action" = "enable" ] && echo "false" || echo "true")
105
105
  tmp="${adaptersFile}.tmp"
106
106
  jq --arg type "$adapter_type" --argjson dis "$action_status" \
107
- '.adapters = [.adapters[] | if .type == $type then .disabled = $dis else . end]' \
107
+ '.adapters = [(.adapters // [])[] | if .type == $type then .disabled = $dis else . end]' \
108
108
  "$adaptersFile" > "$tmp" && mv "$tmp" "$adaptersFile"
109
109
 
110
110
  # If re-enabling, also check org config adapter_config for matching roles
@@ -126,7 +126,7 @@ tmp="${adaptersFile}.tmp"
126
126
  jq --arg type "$adapter_type" \
127
127
  --arg pkg "$package_name" \
128
128
  --argjson local "$isLocal" \
129
- '.adapters = [.adapters[] | select(.type != $type)] +
129
+ '.adapters = [(.adapters // [])[] | select(.type != $type)] +
130
130
  [{"type":$type,"label":$pkg,"source":"external","packageName":$pkg,"isLocalPath":$local,
131
131
  "disabled":false,"modelsCount":0,"installedAt":(now|todate)}]' \
132
132
  "$adaptersFile" > "$tmp" && mv "$tmp" "$adaptersFile"
@@ -151,12 +151,12 @@ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
151
151
  [ -z "$adapter_type" ] && { echo "ERROR: --adapter-type required."; exit 1; }
152
152
 
153
153
  # Verify it's external
154
- src=$(jq -r --arg t "$adapter_type" '.adapters[] | select(.type == $t) | .source' "$adaptersFile" 2>/dev/null)
154
+ src=$(jq -r --arg t "$adapter_type" '(.adapters // [])[] | select(.type == $t) | .source' "$adaptersFile" 2>/dev/null)
155
155
  [ "$src" = "built-in" ] && { echo "ERROR: Cannot remove built-in adapters. Use 'disable' instead."; exit 1; }
156
156
  [ -z "$src" ] && { echo "ERROR: Adapter '$adapter_type' not found."; exit 1; }
157
157
 
158
158
  tmp="${adaptersFile}.tmp"
159
- jq --arg type "$adapter_type" '.adapters = [.adapters[] | select(.type != $type)]' \
159
+ jq --arg type "$adapter_type" '.adapters = [(.adapters // [])[] | select(.type != $type)]' \
160
160
  "$adaptersFile" > "$tmp" && mv "$tmp" "$adaptersFile"
161
161
  echo "Removed adapter: $adapter_type"
162
162
  ```
@@ -180,7 +180,7 @@ Force a reload hint (marks adapter as needing restart):
180
180
  ```bash
181
181
  tmp="${adaptersFile}.tmp"
182
182
  jq --arg type "$adapter_type" --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
183
- '.adapters = [.adapters[] | if .type == $type then .last_reload = $ts else . end]' \
183
+ '.adapters = [(.adapters // [])[] | if .type == $type then .last_reload = $ts else . end]' \
184
184
  "$adaptersFile" > "$tmp" && mv "$tmp" "$adaptersFile"
185
185
  echo "Marked adapter '$adapter_type' for reload. Restart the org run to apply."
186
186
  ```
@@ -34,7 +34,7 @@ If `caller` is not "command", load brain context following _protocol.md Brain Lo
34
34
  orgFile=".monomind/orgs/${org_name}.json"
35
35
  [ ! -f "$orgFile" ] && { echo "ERROR: Org '${org_name}' not found."; exit 1; }
36
36
 
37
- agentDef=$(jq -r --arg id "$agent_id" '.roles[] | select(.id == $id)' "$orgFile")
37
+ agentDef=$(jq -r --arg id "$agent_id" '(.roles // [])[] | select(.id == $id)' "$orgFile")
38
38
  [ -z "$agentDef" ] && { echo "ERROR: Agent '$agent_id' not found in org '$org_name'."; exit 1; }
39
39
 
40
40
  stateFile=".monomind/orgs/${org_name}-state.json"
@@ -32,7 +32,7 @@ If `caller` is not "command", load brain context following _protocol.md Brain Lo
32
32
  If `org_name` is provided, load `.monomind/orgs/<org_name>.json`. Otherwise list all orgs:
33
33
 
34
34
  ```bash
35
- ls .monomind/orgs/*.json 2>/dev/null | xargs -I{} basename {} .json
35
+ ls .monomind/orgs/*.json 2>/dev/null | grep -vE -- '-approvals|-state|-activity|-goals|-routines|-projects|-members|-issues|-workspaces|-worktrees|-environments|-plugins|-adapters|-bootstrap|-threads|-budgets|-project-workspaces|-approval-comments' | xargs -I{} basename {} .json
36
36
  ```
37
37
 
38
38
  If no orgs exist, print: "No orgs found. Run /mastermind:createorg to define one."
@@ -49,7 +49,7 @@ Display all agents in the org with status from state file:
49
49
  orgFile=".monomind/orgs/${org_name}.json"
50
50
  stateFile=".monomind/orgs/${org_name}-state.json"
51
51
 
52
- jq -r '.roles[] | "• [\(.id)] \(.title) agent=\(.agent_type) reports_to=\(.reports_to // "none")"' "$orgFile"
52
+ jq -r '(.roles // [])[] | "• [\(.id)] \(.title) agent=\(.agent_type) reports_to=\(.reports_to // "none")"' "$orgFile"
53
53
 
54
54
  # Overlay runtime status from state file if present
55
55
  if [ -f "$stateFile" ]; then
@@ -76,8 +76,8 @@ reviewer Content Reviewer reviewer waiting 8 min ago
76
76
  Show full config + responsibilities + communication edges for a single agent:
77
77
 
78
78
  ```bash
79
- jq --arg id "$agent_id" '.roles[] | select(.id == $id)' "$orgFile"
80
- jq --arg id "$agent_id" '.communication[] | select(.from == $id or .to == $id)' "$orgFile"
79
+ jq --arg id "$agent_id" '(.roles // [])[] | select(.id == $id)' "$orgFile"
80
+ jq --arg id "$agent_id" '(.communication // [])[] | select(.from == $id or .to == $id)' "$orgFile"
81
81
  ```
82
82
 
83
83
  ### hire
@@ -153,7 +153,7 @@ Confirm with user, then remove role from org config:
153
153
 
154
154
  ```bash
155
155
  tmp="${orgFile}.tmp"
156
- jq --arg id "$agent_id" '.roles = [.roles[] | select(.id != $id)] | .communication = [.communication[] | select(.from != $id and .to != $id)]' \
156
+ jq --arg id "$agent_id" '.roles = [(.roles // [])[] | select(.id != $id)] | .communication = [(.communication // [])[] | select(.from != $id and .to != $id)]' \
157
157
  "$orgFile" > "$tmp" && mv "$tmp" "$orgFile"
158
158
  ```
159
159
 
@@ -63,7 +63,7 @@ approvalsFile=".monomind/orgs/${org_name}-approvals.json"
63
63
 
64
64
  # Find approval by full id or prefix
65
65
  approvalDef=$(jq -r --arg id "$approval_id" \
66
- '.approvals[] | select(.id == $id or (.id | startswith($id)))' \
66
+ '(.approvals // [])[] | select(.id == $id or (.id | startswith($id)))' \
67
67
  "$approvalsFile" | head -1)
68
68
  [ -z "$approvalDef" ] && { echo "ERROR: Approval '${approval_id}' not found."; exit 1; }
69
69
 
@@ -144,7 +144,7 @@ if [ -z "$linkedIds" ]; then
144
144
  else
145
145
  if [ -f "$issuesFile" ]; then
146
146
  echo "$linkedIds" | while read -r iid; do
147
- row=$(jq -r --arg id "$iid" '.issues[] | select(.id == $id) | [.id, (.status // "open"), (.title // "(no title)")] | @tsv' "$issuesFile")
147
+ row=$(jq -r --arg id "$iid" '(.issues // [])[] | select(.id == $id) | [.id, (.status // "open"), (.title // "(no title)")] | @tsv' "$issuesFile")
148
148
  [ -n "$row" ] && echo "$row" | while IFS=$'\t' read -r id st title; do
149
149
  printf "%-24s %-12s %s\n" "$id" "$st" "$title"
150
150
  done || printf "%-24s %-12s %s\n" "$iid" "(unknown)" "(not found)"
@@ -185,7 +185,7 @@ fi
185
185
  ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
186
186
  tmp="${approvalsFile}.tmp"
187
187
  jq --arg id "$approvalId" --arg ts "$ts" \
188
- '.approvals = [.approvals[] | if .id == $id then
188
+ '.approvals = [(.approvals // [])[] | if .id == $id then
189
189
  .status = "approved" | .resolvedAt = $ts | .resolvedBy = "operator"
190
190
  else . end]' \
191
191
  "$approvalsFile" > "$tmp" && mv "$tmp" "$approvalsFile"
@@ -201,7 +201,7 @@ echo " Agent will be notified to proceed."
201
201
  ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
202
202
  tmp="${approvalsFile}.tmp"
203
203
  jq --arg id "$approvalId" --arg ts "$ts" \
204
- '.approvals = [.approvals[] | if .id == $id then
204
+ '.approvals = [(.approvals // [])[] | if .id == $id then
205
205
  .status = "rejected" | .resolvedAt = $ts | .resolvedBy = "operator"
206
206
  else . end]' \
207
207
  "$approvalsFile" > "$tmp" && mv "$tmp" "$approvalsFile"
@@ -216,7 +216,7 @@ echo " Resolved at: $ts"
216
216
  ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
217
217
  tmp="${approvalsFile}.tmp"
218
218
  jq --arg id "$approvalId" --arg ts "$ts" \
219
- '.approvals = [.approvals[] | if .id == $id then
219
+ '.approvals = [(.approvals // [])[] | if .id == $id then
220
220
  .status = "revision_requested" | .revisionRequestedAt = $ts
221
221
  else . end]' \
222
222
  "$approvalsFile" > "$tmp" && mv "$tmp" "$approvalsFile"
@@ -231,7 +231,7 @@ echo " Agent will be notified to revise and resubmit."
231
231
  ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
232
232
  tmp="${approvalsFile}.tmp"
233
233
  jq --arg id "$approvalId" --arg ts "$ts" \
234
- '.approvals = [.approvals[] | if .id == $id then
234
+ '.approvals = [(.approvals // [])[] | if .id == $id then
235
235
  .status = "pending" | .resubmittedAt = $ts
236
236
  else . end]' \
237
237
  "$approvalsFile" > "$tmp" && mv "$tmp" "$approvalsFile"
@@ -48,7 +48,7 @@ Show pending approval requests from agents:
48
48
 
49
49
  ```bash
50
50
  jq -r '
51
- .approvals | map(select(.status == "pending")) |
51
+ (.approvals // []) | map(select(.status == "pending")) |
52
52
  if length == 0 then "No pending approvals." else
53
53
  .[] | "[\(.id)] \(.agent_id): \(.title)\n Action: \(.action)\n Risk: \(.risk_level // "low")\n Requested: \(.requested_at)"
54
54
  end
@@ -77,7 +77,7 @@ PENDING APPROVALS — org: <org_name>
77
77
  Show full details of a single approval request:
78
78
 
79
79
  ```bash
80
- jq --arg id "$approval_id" '.approvals[] | select(.id == $id)' "$approvalsFile"
80
+ jq --arg id "$approval_id" '(.approvals // [])[] | select(.id == $id)' "$approvalsFile"
81
81
  ```
82
82
 
83
83
  Print the agent's requested action, context, and any supporting evidence they provided.
@@ -89,11 +89,11 @@ Update approval status and notify the waiting agent via memory:
89
89
  ```bash
90
90
  tmp="${approvalsFile}.tmp"
91
91
  jq --arg id "$approval_id" \
92
- '.approvals = [.approvals[] | if .id == $id then .status = "approved" | .resolved_at = (now|todate) | .resolved_by = "human" else . end]' \
92
+ '.approvals = [(.approvals // [])[] | if .id == $id then .status = "approved" | .resolved_at = (now|todate) | .resolved_by = "human" else . end]' \
93
93
  "$approvalsFile" > "$tmp" && mv "$tmp" "$approvalsFile"
94
94
 
95
95
  # Notify the agent via memory so it can proceed
96
- approval=$(jq --arg id "$approval_id" '.approvals[] | select(.id == $id)' "$approvalsFile")
96
+ approval=$(jq --arg id "$approval_id" '(.approvals // [])[] | select(.id == $id)' "$approvalsFile")
97
97
  agent_id=$(echo "$approval" | jq -r '.agent_id')
98
98
  memNs="org:${org_name}"
99
99
  npx monomind@latest memory store \
@@ -111,10 +111,10 @@ Emit `org:approval:approved` event to dashboard.
111
111
  ```bash
112
112
  tmp="${approvalsFile}.tmp"
113
113
  jq --arg id "$approval_id" --arg reason "${reason:-No reason given}" \
114
- '.approvals = [.approvals[] | if .id == $id then .status = "rejected" | .resolved_at = (now|todate) | .resolved_by = "human" | .rejection_reason = $reason else . end]' \
114
+ '.approvals = [(.approvals // [])[] | if .id == $id then .status = "rejected" | .resolved_at = (now|todate) | .resolved_by = "human" | .rejection_reason = $reason else . end]' \
115
115
  "$approvalsFile" > "$tmp" && mv "$tmp" "$approvalsFile"
116
116
 
117
- approval=$(jq --arg id "$approval_id" '.approvals[] | select(.id == $id)' "$approvalsFile")
117
+ approval=$(jq --arg id "$approval_id" '(.approvals // [])[] | select(.id == $id)' "$approvalsFile")
118
118
  agent_id=$(echo "$approval" | jq -r '.agent_id')
119
119
  memNs="org:${org_name}"
120
120
  npx monomind@latest memory store \
@@ -137,7 +137,7 @@ Agents that need human approval before a sensitive action should:
137
137
  ```bash
138
138
  approvalsFile=".monomind/orgs/${orgName}-approvals.json"
139
139
  [ ! -f "$approvalsFile" ] && echo '{"approvals":[]}' > "$approvalsFile"
140
- approval_id="req-$(date +%s)"
140
+ approval_id="req-$(date +%s)-$$-$RANDOM"
141
141
  tmp="${approvalsFile}.tmp"
142
142
  jq --arg id "$approval_id" \
143
143
  --arg agent "$role_id" \
@@ -155,10 +155,9 @@ jq --arg id "$approval_id" \
155
155
  approvalsFile=".monomind/orgs/${orgName}-approvals.json"
156
156
  while true; do
157
157
  # Check file first — dashboard approve/reject button only updates the file (not memory)
158
- file_status=$(jq --arg id "$approval_id" '.approvals[] | select(.id == $id) | .status // ""' "$approvalsFile" 2>/dev/null || echo "")
158
+ file_status=$(jq --arg id "$approval_id" '(.approvals // [])[] | select(.id == $id) | .status // ""' "$approvalsFile" 2>/dev/null || echo "")
159
159
  if [ -z "$file_status" ] || [ "$file_status" = '"pending"' ] || [ "$file_status" = "pending" ]; then
160
- mem_result=$(npx monomind@latest memory search --query "approval:${approval_id}" --namespace "${memNs}" 2>/dev/null)
161
- mem_status=$(echo "$mem_result" | jq -r '.[0].value.status // ""' 2>/dev/null)
160
+ mem_status=$(npx monomind@latest memory get --key "approval:${approval_id}" --namespace "${memNs}" 2>/dev/null | jq -r '.status // ""' 2>/dev/null)
162
161
  [ -n "$mem_status" ] && [ "$mem_status" != "pending" ] && file_status="$mem_status"
163
162
  fi
164
163
  # Strip quotes from jq output
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mastermind-backup
3
- description: Mastermind backup — create, list, and restore compressed org backups. Archives org config, state, goals, routines, approvals, projects, and activity log into a timestamped tarball.
3
+ description: Mastermind backup — create, list, and restore compressed org backups. Archives all org data files (config, goals, routines, approvals, projects, members, issues, workspaces, worktrees, environments, plugins, adapters, threads, budgets, bootstrap, and activity log) into a timestamped tarball.
4
4
  type: domain-skill
5
5
  default_mode: confirm
6
6
  ---
@@ -55,7 +55,7 @@ archivePath="${backupDir}/${archiveName}"
55
55
 
56
56
  # Collect files to back up
57
57
  filesToBackup=""
58
- for suffix in "" "-goals" "-routines" "-approvals" "-projects" "-worktrees" "-bootstrap"; do
58
+ for suffix in "" "-goals" "-routines" "-approvals" "-projects" "-members" "-issues" "-workspaces" "-worktrees" "-environments" "-plugins" "-adapters" "-threads" "-budgets" "-project-workspaces" "-approval-comments" "-bootstrap" "-secrets"; do
59
59
  f=".monomind/orgs/${org_name}${suffix}.json"
60
60
  [ -f "$f" ] && filesToBackup="$filesToBackup $f"
61
61
  done
@@ -88,11 +88,11 @@ Initialize org bootstrap: detect boss, generate token, write primer context:
88
88
  ```bash
89
89
  # Auto-detect boss (role with no reports_to or reports_to: null)
90
90
  if [ -z "$boss_role_id" ]; then
91
- boss_role_id=$(jq -r '.roles[] | select(.reports_to == null or .reports_to == "") | .id' "$orgFile" | head -1)
91
+ boss_role_id=$(jq -r '(.roles // [])[] | select(.reports_to == null or .reports_to == "") | .id' "$orgFile" | head -1)
92
92
  fi
93
93
  [ -z "$boss_role_id" ] && { echo "ERROR: Could not detect boss role. Pass --boss-role-id <id>."; exit 1; }
94
94
 
95
- bossConfig=$(jq --arg id "$boss_role_id" '.roles[] | select(.id == $id)' "$orgFile")
95
+ bossConfig=$(jq --arg id "$boss_role_id" '(.roles // [])[] | select(.id == $id)' "$orgFile")
96
96
  bossTitle=$(echo "$bossConfig" | jq -r '.title // "CEO"')
97
97
  orgGoal=$(jq -r '.goal // "No goal set"' "$orgFile")
98
98
  orgTopology=$(jq -r '.topology // "hierarchical"' "$orgFile")
@@ -35,7 +35,7 @@ orgsDir=".monomind/orgs"
35
35
  [ ! -d "$orgsDir" ] && { echo "No orgs directory found. Run /mastermind:createorg to create your first org."; exit 0; }
36
36
 
37
37
  # Collect all org names from .json files (not -members, -issues, etc.)
38
- orgNames=$(ls "$orgsDir"/*.json 2>/dev/null | grep -v '\-' | xargs -I{} basename {} .json | sort)
38
+ orgNames=$(ls "$orgsDir"/*.json 2>/dev/null | grep -vE -- '-approvals|-state|-activity|-goals|-routines|-projects|-members|-issues|-workspaces|-worktrees|-environments|-plugins|-adapters|-bootstrap|-threads|-budgets|-project-workspaces|-approval-comments' | xargs -I{} basename {} .json | sort)
39
39
 
40
40
  # Track active org
41
41
  activeFile=".monomind/active-org"
@@ -61,7 +61,7 @@ echo "$orgNames" | while read -r name; do
61
61
  [ ! -f "$orgFile" ] && continue
62
62
 
63
63
  agents=$(jq -r '(.roles // []) | length' "$orgFile" 2>/dev/null || echo 0)
64
- issues=$([ -f "$orgsDir/${name}-issues.json" ] && jq '[.issues[] | select(.status == "open" or .status == "in_progress")] | length' "$orgsDir/${name}-issues.json" 2>/dev/null || echo 0)
64
+ issues=$([ -f "$orgsDir/${name}-issues.json" ] && jq '[(.issues // [])[] | select(.status == "open" or .status == "in_progress")] | length' "$orgsDir/${name}-issues.json" 2>/dev/null || echo 0)
65
65
  members=$([ -f "$orgsDir/${name}-members.json" ] && jq '.members | length' "$orgsDir/${name}-members.json" 2>/dev/null || echo 0)
66
66
  status=$([ "$name" = "$activeOrg" ] && echo "● ACTIVE" || echo "")
67
67
 
@@ -113,7 +113,7 @@ orgFile="$orgsDir/${org_name}.json"
113
113
  mv "$orgFile" "$orgsDir/${new_name}.json"
114
114
 
115
115
  # Rename all associated files
116
- for suffix in members issues goals projects routines approvals adapters plugins environments workspaces activity threads budgets; do
116
+ for suffix in state members issues goals projects routines approvals adapters plugins environments workspaces worktrees activity threads budgets project-workspaces approval-comments bootstrap secrets; do
117
117
  f="$orgsDir/${org_name}-${suffix}.json"
118
118
  [ -f "$f" ] && mv "$f" "$orgsDir/${new_name}-${suffix}.json"
119
119
  f2="$orgsDir/${org_name}-${suffix}.jsonl"
@@ -152,7 +152,7 @@ fi
152
152
 
153
153
  # Delete all org files
154
154
  rm -f "$orgsDir/${org_name}.json"
155
- for suffix in members issues goals projects routines approvals adapters plugins environments workspaces activity threads budgets project-workspaces approval-comments; do
155
+ for suffix in state members issues goals projects routines approvals adapters plugins environments workspaces worktrees activity threads budgets project-workspaces approval-comments bootstrap secrets; do
156
156
  rm -f "$orgsDir/${org_name}-${suffix}.json"
157
157
  rm -f "$orgsDir/${org_name}-${suffix}.jsonl"
158
158
  done
@@ -184,8 +184,8 @@ echo " Governance: $gov"
184
184
  # Issues
185
185
  if [ -f "$orgsDir/${org_name}-issues.json" ]; then
186
186
  total=$(jq '.issues | length' "$orgsDir/${org_name}-issues.json")
187
- open=$(jq '[.issues[] | select(.status == "open" or .status == "in_progress")] | length' "$orgsDir/${org_name}-issues.json")
188
- done=$(jq '[.issues[] | select(.status == "done")] | length' "$orgsDir/${org_name}-issues.json")
187
+ open=$(jq '[(.issues // [])[] | select(.status == "open" or .status == "in_progress")] | length' "$orgsDir/${org_name}-issues.json")
188
+ done=$(jq '[(.issues // [])[] | select(.status == "done")] | length' "$orgsDir/${org_name}-issues.json")
189
189
  echo " Issues: $total total ($open open, $done done)"
190
190
  fi
191
191
 
@@ -203,7 +203,7 @@ fi
203
203
 
204
204
  # Pending approvals
205
205
  if [ -f "$orgsDir/${org_name}-approvals.json" ]; then
206
- pending=$(jq '[.approvals[] | select(.status == "pending")] | length' "$orgsDir/${org_name}-approvals.json")
206
+ pending=$(jq '[(.approvals // [])[] | select(.status == "pending")] | length' "$orgsDir/${org_name}-approvals.json")
207
207
  echo " Pending approvals: $pending"
208
208
  fi
209
209
  ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mastermind-createorg
3
- description: Mastermind createorg — design, configure, and persist an autonomous agent organization with named roles, hierarchy, and communication topology. Suggests org structure from a goal description and saves the definition for later use with runorg.
3
+ description: Mastermind createorg — design, configure, and persist an autonomous agent organization with named roles, hierarchy, and communication topology. Supports optional --schedule flag for self-scheduling loop orgs.
4
4
  type: domain-skill
5
5
  default_mode: confirm
6
6
  ---
@@ -17,10 +17,32 @@ This skill is invoked by `mastermind:createorg` or directly via `/mastermind:cre
17
17
  - `prompt`: goal and/or role description for this org
18
18
  - `org_name`: desired name for the org (slug, e.g. `content-team`); constrained to `[a-z0-9-]`
19
19
  - `roles_desc`: optional explicit role list from user (e.g. "boss, content writer, reviewer, marketer, designer, middle manager")
20
+ - `schedule`: optional schedule string, e.g. `"every 30 minutes"`, `"every hour"`, `"every 2 hours"`, `"daily"`. When provided, generates a self-scheduling loop org.
20
21
  - `mode`: auto | confirm
21
22
  - `session_id`: session ID passed by command wrapper (snake_case input)
22
23
  - `caller`: command | master
23
24
 
25
+ ### Schedule parsing (when `--schedule` is present)
26
+
27
+ Convert the schedule string to `poll_interval_minutes`:
28
+
29
+ | Schedule string | Minutes |
30
+ |---|---|
31
+ | `every N minutes` | N |
32
+ | `every minute` | 1 |
33
+ | `every hour` | 60 |
34
+ | `every N hours` | N × 60 |
35
+ | `daily` / `every day` | 1440 |
36
+ | `every N days` | N × 1440 |
37
+
38
+ ```bash
39
+ # Example: "every 30 minutes" → poll_interval_minutes=30
40
+ # "every 2 hours" → poll_interval_minutes=120
41
+ # "daily" → poll_interval_minutes=1440
42
+ ```
43
+
44
+ Store the parsed value as `poll_interval_minutes` for use in Steps 4 and 6.7.
45
+
24
46
  ---
25
47
 
26
48
  ## Step 0 — Brain Load (standalone only)
@@ -195,6 +217,7 @@ Ask the user (or infer from prompt) for the optional Paperclip-style fields:
195
217
  "created_at": "<ISO8601>",
196
218
  "mode": "daemon",
197
219
  "topology": "<mesh | star | hierarchical — from Step 3>",
220
+ "status": "<'stopped' if --schedule provided; 'active' otherwise>",
198
221
  "roles": [
199
222
  {
200
223
  "id": "<slug>",
@@ -234,10 +257,27 @@ Ask the user (or infer from prompt) for the optional Paperclip-style fields:
234
257
  "budget_tokens": "<number or 0 for unlimited>",
235
258
  "alert_threshold": 0.8,
236
259
  "ceo_adapter": "<model id>"
260
+ },
261
+ "loop": "<only included when --schedule was provided; see below>"
262
+ }
263
+ ```
264
+
265
+ **If `--schedule` was provided**, include these two additional top-level fields in the org config:
266
+
267
+ ```json
268
+ {
269
+ "status": "stopped",
270
+ "loop": {
271
+ "poll_interval_minutes": "<parsed from schedule string>",
272
+ "last_run": null,
273
+ "next_run": null,
274
+ "run_prompt_file": ".monomind/loops/<org_name>.md"
237
275
  }
238
276
  }
239
277
  ```
240
278
 
279
+ `status` starts as `"stopped"`. The org does not run until `/mastermind:runorg --org <org_name>` is called (which transitions it to `"active"`).
280
+
241
281
  ---
242
282
 
243
283
  ## Step 5 — Show Plan and Confirm (confirm mode)
@@ -277,6 +317,8 @@ SETTINGS
277
317
  Topology: <derived> | Mode: persistent daemon
278
318
  Memory: org:<org_name> | Board: <org_name>/org-tasks
279
319
  Checkpoint every: 30 min | Max agents: 6
320
+ Schedule: <"every <poll_interval_minutes> minutes" if --schedule; otherwise "manual (no auto-schedule)">
321
+ Status: <"stopped (run /mastermind:runorg --org <org_name> to activate)" if --schedule; otherwise "—">
280
322
 
281
323
  Type "go" to save this org, or describe changes.
282
324
  ```
@@ -303,9 +345,10 @@ Write the confirmed org config as JSON using `jq` to guarantee valid encoding:
303
345
  ```bash
304
346
  # Build the config JSON from the confirmed org plan and write atomically.
305
347
  # Set shell variables from the confirmed plan before running this block:
306
- # governance_policy — "auto" | "board" | "strict" (from Step 4)
307
- # budget_tokens_val — integer or 0 for unlimited (from Step 4)
308
- # ceo_adapter — model id string (from Step 4)
348
+ # governance_policy — "auto" | "board" | "strict" (from Step 4)
349
+ # budget_tokens_val — integer or 0 for unlimited (from Step 4)
350
+ # ceo_adapter — model id string (from Step 4)
351
+ # poll_interval_minutes — integer (from --schedule), or "" if no schedule
309
352
  jq -n \
310
353
  --arg name "$org_name" \
311
354
  --arg goal "$goal" \
@@ -315,7 +358,7 @@ jq -n \
315
358
  --arg gov_policy "${governance_policy:-auto}" \
316
359
  --argjson budget_tokens "${budget_tokens_val:-0}" \
317
360
  --arg ceo_adapter "${ceo_adapter:-claude-sonnet-4-6}" \
318
- '{name:$name,goal:$goal,mode:"daemon",topology:$topology,
361
+ '{name:$name,goal:$goal,mode:"daemon",topology:$topology,status:"active",
319
362
  created_at:(now|todate),roles:$roles,communication:$communication,
320
363
  governance:{policy:$gov_policy,approvals_file:(".monomind/orgs/"+$name+"-approvals.json")},
321
364
  board_space:$name,board_name:"org-tasks",
@@ -330,6 +373,26 @@ jq -n \
330
373
  > "${orgJson}.tmp" && mv "${orgJson}.tmp" "$orgJson"
331
374
  ```
332
375
 
376
+ **If `--schedule` was provided**, patch the saved config with `status` and `loop`:
377
+
378
+ ```bash
379
+ # Only run this block when poll_interval_minutes is set (i.e. --schedule was used)
380
+ tmp="${orgJson}.tmp"
381
+ jq \
382
+ --argjson interval "$poll_interval_minutes" \
383
+ --arg run_prompt_file ".monomind/loops/${org_name}.md" \
384
+ '. + {
385
+ status: "stopped",
386
+ loop: {
387
+ poll_interval_minutes: $interval,
388
+ last_run: null,
389
+ next_run: null,
390
+ run_prompt_file: $run_prompt_file
391
+ }
392
+ }' \
393
+ "$orgJson" > "$tmp" && mv "$tmp" "$orgJson"
394
+ ```
395
+
333
396
  Create the monotask space, board, and default columns (space is required — abort before creating board if space fails):
334
397
  ```bash
335
398
  # Step 1 — Space (required first)
@@ -345,9 +408,12 @@ board_id=$(monotask board create "org-tasks" --json | jq -r '.id // empty')
345
408
  monotask space boards add "$space_id" "$board_id" >/dev/null 2>&1 || true
346
409
 
347
410
  # Step 4 — Columns
348
- todo_col_id=$(monotask column create "$board_id" "Todo" --json | jq -r '.id')
349
- doing_col_id=$(monotask column create "$board_id" "Doing" --json | jq -r '.id')
350
- done_col_id=$(monotask column create "$board_id" "Done" --json | jq -r '.id')
411
+ todo_col_id=$(monotask column create "$board_id" "Todo" --json | jq -r '.id // empty')
412
+ doing_col_id=$(monotask column create "$board_id" "Doing" --json | jq -r '.id // empty')
413
+ done_col_id=$(monotask column create "$board_id" "Done" --json | jq -r '.id // empty')
414
+ [ -z "$todo_col_id" ] && { echo "ERROR: Failed to create 'Todo' column on board $board_id"; exit 1; }
415
+ [ -z "$doing_col_id" ] && { echo "ERROR: Failed to create 'Doing' column on board $board_id"; exit 1; }
416
+ [ -z "$done_col_id" ] && { echo "ERROR: Failed to create 'Done' column on board $board_id"; exit 1; }
351
417
  ```
352
418
 
353
419
  Patch the saved org config with the board and column IDs:
@@ -363,6 +429,128 @@ jq --arg board_id "$board_id" \
363
429
 
364
430
  ---
365
431
 
432
+ ## Step 6.7 — Generate Loop Prompt File (scheduled orgs only)
433
+
434
+ **Skip this step if `--schedule` was NOT provided.**
435
+
436
+ If `poll_interval_minutes` is set, generate the self-scheduling loop prompt at `.monomind/loops/<org_name>.md`.
437
+
438
+ This file is the single source of truth for one scheduled iteration. It is passed verbatim as the `prompt` argument to `ScheduleWakeup` at the end of every iteration — the loop is self-perpetuating as long as `status == "active"`.
439
+
440
+ **Loop prompt structure:**
441
+
442
+ The file must follow this exact template (substitute actual values for all `<placeholders>`):
443
+
444
+ ````markdown
445
+ # <org_name> — Loop Prompt
446
+
447
+ **Controlled by:** `.monomind/orgs/<org_name>.json` → `status` field
448
+ **Start:** `/mastermind:runorg --org <org_name>` (sets `status: "active"` and runs first iteration)
449
+ **Stop:** `/mastermind:stoporg --org <org_name>` (sets `status: "stopped"` — next wakeup exits without rescheduling)
450
+ **Pause (HIL):** set `status: "paused"` in `.monomind/orgs/<org_name>.json` — loop keeps waking up but skips work until status returns to `"active"`
451
+
452
+ ---
453
+
454
+ ## Step 0 — Status Gate (REQUIRED FIRST — do not skip)
455
+
456
+ ```bash
457
+ ORG_FILE=".monomind/orgs/<org_name>.json"
458
+ LOOP_STATUS=$(jq -r '.status // "stopped"' "$ORG_FILE" 2>/dev/null || echo "stopped")
459
+ ```
460
+
461
+ - If `LOOP_STATUS == "active"` → continue to Step 1.
462
+ - If `LOOP_STATUS == "paused"` → print "Org '<org_name>' is paused — skipping iteration. Jump directly to Schedule Next." Do NOT run Steps 1–N.
463
+ - If anything else (including `"stopped"`) → print "Org '<org_name>' status is '$LOOP_STATUS' — exiting loop. **Do NOT call ScheduleWakeup.**" and stop.
464
+
465
+ ---
466
+
467
+ ## Step 1 — Record Iteration Start
468
+
469
+ ```bash
470
+ ORG_FILE=".monomind/orgs/<org_name>.json"
471
+ tmp="${ORG_FILE}.tmp"
472
+ jq '.loop.last_run = (now|todate)' "$ORG_FILE" > "$tmp" && mv "$tmp" "$ORG_FILE"
473
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
474
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
475
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
476
+ -H "Content-Type: application/json" \
477
+ -d "$(jq -cn --arg org "<org_name>" --arg proj "$REPO_ROOT" \
478
+ '{type:"org:loop:start",org:$org,project:$proj,ts:(now*1000|floor)}')" || true
479
+ ```
480
+
481
+ ---
482
+
483
+ ## [Org-specific iteration steps]
484
+
485
+ <IMPORTANT: Generate the actual work steps here from the org's goal and roles. These are NOT generic placeholders — write real, actionable steps derived from the org's goal, roles, and communication topology.>
486
+
487
+ <For a GitHub issue-resolver org, these would be: find next issue, claim it, implement, test, deploy, report.>
488
+ <For a content org, these would be: check content calendar, assign writers, review drafts, publish.>
489
+ <Derive from orgConfig.goal and orgConfig.roles[].responsibilities — be specific.>
490
+
491
+ ---
492
+
493
+ ## Schedule Next (ONLY if status is active or paused)
494
+
495
+ Re-check org status before rescheduling:
496
+
497
+ ```bash
498
+ ORG_FILE=".monomind/orgs/<org_name>.json"
499
+ LOOP_STATUS=$(jq -r '.status // "stopped"' "$ORG_FILE" 2>/dev/null || echo "stopped")
500
+ ```
501
+
502
+ If `LOOP_STATUS == "active"` or `LOOP_STATUS == "paused"`:
503
+
504
+ 1. Read this loop prompt file verbatim:
505
+ ```bash
506
+ LOOP_PROMPT=$(cat .monomind/loops/<org_name>.md)
507
+ ```
508
+
509
+ 2. Call `ScheduleWakeup` with:
510
+ - `delaySeconds`: `<poll_interval_minutes * 60>`
511
+ - `reason`: `"<org_name>: next scheduled poll (every <poll_interval_minutes> min)"`
512
+ - `prompt`: the full contents of `$LOOP_PROMPT`
513
+
514
+ 3. Update `next_run` in the org JSON:
515
+ ```bash
516
+ ORG_FILE=".monomind/orgs/<org_name>.json"
517
+ tmp="${ORG_FILE}.tmp"
518
+ next_ts=$(( $(date +%s) + <poll_interval_minutes * 60> ))
519
+ next_iso=$(date -u -r "$next_ts" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null \
520
+ || date -u -d "@$next_ts" +%Y-%m-%dT%H:%M:%SZ 2>/dev/null \
521
+ || python3 -c "import datetime; print(datetime.datetime.utcfromtimestamp($next_ts).strftime('%Y-%m-%dT%H:%M:%SZ'))")
522
+ jq --arg next "$next_iso" '.loop.next_run = $next' "$ORG_FILE" > "$tmp" && mv "$tmp" "$ORG_FILE"
523
+ ```
524
+
525
+ 4. Emit `org:loop:scheduled` event:
526
+ ```bash
527
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
528
+ CTRL_URL=$(jq -r '.url // "http://localhost:4242"' "$REPO_ROOT/.monomind/control.json" 2>/dev/null || echo "http://localhost:4242")
529
+ curl -s -X POST "${CTRL_URL}/api/mastermind/event" \
530
+ -H "Content-Type: application/json" \
531
+ -d "$(jq -cn --arg org "<org_name>" --arg next "$next_iso" --arg proj "$REPO_ROOT" \
532
+ '{type:"org:loop:scheduled",org:$org,next_run:$next,project:$proj,ts:(now*1000|floor)}')" || true
533
+ ```
534
+
535
+ If `LOOP_STATUS` is anything else (e.g. `"stopped"`) → print "Org '<org_name>' loop ended — not rescheduling." and exit.
536
+ ````
537
+
538
+ **Before writing: substitute ALL `<org_name>` tokens with the actual resolved org name string (the value from Step 1, e.g. `research-pod`), and all `<poll_interval_minutes>` tokens with the numeric value. These are template placeholders — the written file must contain no angle-bracket tokens. Every `ORG_FILE=".monomind/orgs/<org_name>.json"` becomes `ORG_FILE=".monomind/orgs/research-pod.json"`, every `cat .monomind/loops/<org_name>.md` becomes `cat .monomind/loops/research-pod.md`, etc. Leaving any `<...>` token unexpanded will cause shell failures at loop execution time.**
539
+
540
+ **Write this file to disk:**
541
+
542
+ ```bash
543
+ mkdir -p .monomind/loops
544
+ # Write the generated loop prompt (with all placeholders substituted)
545
+ # to .monomind/loops/<org_name>.md (← substitute this path too)
546
+ ```
547
+
548
+ Use the Write tool (not Bash echo/cat) to write the file so the content is verbatim.
549
+
550
+ The org-specific iteration steps (the block between Step 1 and "Schedule Next") must be **generated from the actual org** — goal, roles, responsibilities — not left as generic placeholders.
551
+
552
+ ---
553
+
366
554
  ## Step 7 — Emit Dashboard Events
367
555
 
368
556
  Read values from the saved JSON file and emit two events: `domain:complete` (for the session stream) and `org:create` (so the dashboard Orgs panel registers the new org immediately):
@@ -409,6 +597,9 @@ artifacts:
409
597
  - path: .claude/agents/generated/<agent_type>.md
410
598
  type: agent-definition
411
599
  note: "one per role whose agent_type lacked a usable definition (skills, instructions, input/output)"
600
+ - path: .monomind/loops/<org_name>.md
601
+ type: loop-prompt
602
+ note: "only present when --schedule was used; omit otherwise"
412
603
  decisions:
413
604
  - what: "Org <org_name> created with N roles"
414
605
  why: "Role mapping derived from goal and user description"
@@ -420,6 +611,8 @@ lessons:
420
611
  next_actions:
421
612
  - "Run /mastermind:runorg --org <org_name> to start the organization"
422
613
  - "Edit .monomind/orgs/<org_name>.json to customize roles or communication"
614
+ - "[scheduled orgs only] Run /mastermind:stoporg --org <org_name> to stop the loop"
615
+ - "[scheduled orgs only] Run /mastermind:orgs to see all org statuses"
423
616
  board_url: "monotask://<org_name>/org-tasks"
424
617
  run_id: "<current UTC datetime as ISO8601, e.g. via $(date -u +%Y-%m-%dT%H:%M:%SZ)>"
425
618
  ```
@@ -430,6 +623,18 @@ Print confirmation:
430
623
  → Run: /mastermind:runorg --org <org_name>
431
624
  ```
432
625
 
626
+ If `--schedule` was provided, also print:
627
+ ```
628
+ ✓ Loop prompt saved to .monomind/loops/<org_name>.md
629
+ Schedule: every <poll_interval_minutes> minutes
630
+ Status: stopped (org will not run until /mastermind:runorg --org <org_name>)
631
+
632
+ Lifecycle:
633
+ Start: /mastermind:runorg --org <org_name>
634
+ Stop: /mastermind:stoporg --org <org_name>
635
+ List: /mastermind:orgs
636
+ ```
637
+
433
638
  ---
434
639
 
435
640
  ## Step 9 — Brain Write (standalone only)