monomind 2.7.12 → 2.7.14

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 (1161) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +12 -6
  3. package/bin/cli.js +55 -4
  4. package/package.json +21 -122
  5. package/bin/npx-safe-launch.js +0 -9
  6. package/packages/@monomind/cli/.claude/agents/architecture/system-design/arch-system-design.md +0 -54
  7. package/packages/@monomind/cli/.claude/agents/consensus/crdt-synchronizer.md +0 -977
  8. package/packages/@monomind/cli/.claude/agents/consensus/quorum-manager.md +0 -106
  9. package/packages/@monomind/cli/.claude/agents/consensus/security-manager.md +0 -602
  10. package/packages/@monomind/cli/.claude/agents/core/coder.md +0 -271
  11. package/packages/@monomind/cli/.claude/agents/core/coordinator.md +0 -133
  12. package/packages/@monomind/cli/.claude/agents/core/planner.md +0 -179
  13. package/packages/@monomind/cli/.claude/agents/core/researcher.md +0 -197
  14. package/packages/@monomind/cli/.claude/agents/core/reviewer.md +0 -336
  15. package/packages/@monomind/cli/.claude/agents/core/tester.md +0 -326
  16. package/packages/@monomind/cli/.claude/agents/design/design-monodesign.md +0 -121
  17. package/packages/@monomind/cli/.claude/agents/engineering/engineering-ai-data-remediation-engineer.md +0 -212
  18. package/packages/@monomind/cli/.claude/agents/engineering/engineering-ai-engineer.md +0 -165
  19. package/packages/@monomind/cli/.claude/agents/engineering/engineering-autonomous-optimization-architect.md +0 -108
  20. package/packages/@monomind/cli/.claude/agents/engineering/engineering-backend-architect.md +0 -254
  21. package/packages/@monomind/cli/.claude/agents/engineering/engineering-code-reviewer.md +0 -95
  22. package/packages/@monomind/cli/.claude/agents/engineering/engineering-data-engineer.md +0 -307
  23. package/packages/@monomind/cli/.claude/agents/engineering/engineering-database-optimizer.md +0 -200
  24. package/packages/@monomind/cli/.claude/agents/engineering/engineering-devops-automator.md +0 -430
  25. package/packages/@monomind/cli/.claude/agents/engineering/engineering-embedded-firmware-engineer.md +0 -174
  26. package/packages/@monomind/cli/.claude/agents/engineering/engineering-feishu-integration-developer.md +0 -607
  27. package/packages/@monomind/cli/.claude/agents/engineering/engineering-frontend-developer.md +0 -249
  28. package/packages/@monomind/cli/.claude/agents/engineering/engineering-git-workflow-master.md +0 -108
  29. package/packages/@monomind/cli/.claude/agents/engineering/engineering-incident-response-commander.md +0 -482
  30. package/packages/@monomind/cli/.claude/agents/engineering/engineering-mobile-app-builder.md +0 -499
  31. package/packages/@monomind/cli/.claude/agents/engineering/engineering-rapid-prototyper.md +0 -463
  32. package/packages/@monomind/cli/.claude/agents/engineering/engineering-security-engineer.md +0 -303
  33. package/packages/@monomind/cli/.claude/agents/engineering/engineering-senior-developer.md +0 -195
  34. package/packages/@monomind/cli/.claude/agents/engineering/engineering-software-architect.md +0 -100
  35. package/packages/@monomind/cli/.claude/agents/engineering/engineering-solidity-smart-contract-engineer.md +0 -528
  36. package/packages/@monomind/cli/.claude/agents/engineering/engineering-sre.md +0 -114
  37. package/packages/@monomind/cli/.claude/agents/engineering/engineering-technical-writer.md +0 -412
  38. package/packages/@monomind/cli/.claude/agents/engineering/engineering-threat-detection-engineer.md +0 -540
  39. package/packages/@monomind/cli/.claude/agents/engineering/engineering-wechat-mini-program-developer.md +0 -351
  40. package/packages/@monomind/cli/.claude/agents/github/code-review-swarm.md +0 -557
  41. package/packages/@monomind/cli/.claude/agents/github/github-modes.md +0 -154
  42. package/packages/@monomind/cli/.claude/agents/github/issue-tracker.md +0 -297
  43. package/packages/@monomind/cli/.claude/agents/github/multi-repo-swarm.md +0 -525
  44. package/packages/@monomind/cli/.claude/agents/github/pr-manager.md +0 -161
  45. package/packages/@monomind/cli/.claude/agents/github/project-board-sync.md +0 -478
  46. package/packages/@monomind/cli/.claude/agents/github/release-manager.md +0 -296
  47. package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +0 -351
  48. package/packages/@monomind/cli/.claude/agents/github/swarm-issue.md +0 -548
  49. package/packages/@monomind/cli/.claude/agents/github/swarm-pr.md +0 -427
  50. package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +0 -355
  51. package/packages/@monomind/cli/.claude/agents/github/workflow-automation.md +0 -640
  52. package/packages/@monomind/cli/.claude/agents/goal/goal-planner.md +0 -167
  53. package/packages/@monomind/cli/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -93
  54. package/packages/@monomind/cli/.claude/agents/hive-mind/scout-explorer.md +0 -241
  55. package/packages/@monomind/cli/.claude/agents/hive-mind/swarm-memory-manager.md +0 -192
  56. package/packages/@monomind/cli/.claude/agents/hive-mind/worker-specialist.md +0 -216
  57. package/packages/@monomind/cli/.claude/agents/marketing/marketing-competitive-content.md +0 -155
  58. package/packages/@monomind/cli/.claude/agents/marketing/marketing-cro-specialist.md +0 -147
  59. package/packages/@monomind/cli/.claude/agents/marketing/marketing-email-specialist.md +0 -90
  60. package/packages/@monomind/cli/.claude/agents/marketing/marketing-launch-strategist.md +0 -129
  61. package/packages/@monomind/cli/.claude/agents/marketing/marketing-pricing-strategist.md +0 -127
  62. package/packages/@monomind/cli/.claude/agents/optimization/benchmark-suite.md +0 -665
  63. package/packages/@monomind/cli/.claude/agents/optimization/load-balancer.md +0 -431
  64. package/packages/@monomind/cli/.claude/agents/optimization/performance-monitor.md +0 -672
  65. package/packages/@monomind/cli/.claude/agents/optimization/resource-allocator.md +0 -674
  66. package/packages/@monomind/cli/.claude/agents/optimization/topology-optimizer.md +0 -808
  67. package/packages/@monomind/cli/.claude/agents/schemas/architecture-output.json +0 -43
  68. package/packages/@monomind/cli/.claude/agents/schemas/code-review-output.json +0 -28
  69. package/packages/@monomind/cli/.claude/agents/schemas/generic-task-input.json +0 -12
  70. package/packages/@monomind/cli/.claude/agents/schemas/implementation-output.json +0 -18
  71. package/packages/@monomind/cli/.claude/agents/schemas/research-output.json +0 -31
  72. package/packages/@monomind/cli/.claude/agents/schemas/security-audit-output.json +0 -29
  73. package/packages/@monomind/cli/.claude/agents/schemas/test-report-output.json +0 -29
  74. package/packages/@monomind/cli/.claude/agents/specialists/integration-architect.md +0 -94
  75. package/packages/@monomind/cli/.claude/agents/specialized/agentic-identity-trust.md +0 -388
  76. package/packages/@monomind/cli/.claude/agents/specialized/agents-orchestrator.md +0 -368
  77. package/packages/@monomind/cli/.claude/agents/specialized/automation-governance-architect.md +0 -217
  78. package/packages/@monomind/cli/.claude/agents/specialized/blockchain-security-auditor.md +0 -497
  79. package/packages/@monomind/cli/.claude/agents/specialized/compliance-auditor.md +0 -159
  80. package/packages/@monomind/cli/.claude/agents/specialized/identity-graph-operator.md +0 -261
  81. package/packages/@monomind/cli/.claude/agents/specialized/lsp-index-engineer.md +0 -315
  82. package/packages/@monomind/cli/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -89
  83. package/packages/@monomind/cli/.claude/agents/specialized/specialized-cultural-intelligence-strategist.md +0 -89
  84. package/packages/@monomind/cli/.claude/agents/specialized/specialized-developer-advocate.md +0 -318
  85. package/packages/@monomind/cli/.claude/agents/specialized/specialized-document-generator.md +0 -56
  86. package/packages/@monomind/cli/.claude/agents/specialized/specialized-mcp-builder.md +0 -64
  87. package/packages/@monomind/cli/.claude/agents/specialized/specialized-model-qa.md +0 -489
  88. package/packages/@monomind/cli/.claude/agents/specialized/specialized-workflow-architect.md +0 -595
  89. package/packages/@monomind/cli/.claude/agents/specialized/zk-steward.md +0 -212
  90. package/packages/@monomind/cli/.claude/agents/swarm/mesh-coordinator.md +0 -97
  91. package/packages/@monomind/cli/.claude/agents/templates/automation-smart-agent.md +0 -185
  92. package/packages/@monomind/cli/.claude/agents/templates/coordinator-swarm-init.md +0 -83
  93. package/packages/@monomind/cli/.claude/agents/testing/production-validator.md +0 -375
  94. package/packages/@monomind/cli/.claude/agents/testing/tdd-london-swarm.md +0 -241
  95. package/packages/@monomind/cli/.claude/agents/testing/testing-accessibility-auditor.md +0 -322
  96. package/packages/@monomind/cli/.claude/agents/testing/testing-api-tester.md +0 -307
  97. package/packages/@monomind/cli/.claude/agents/testing/testing-evidence-collector.md +0 -213
  98. package/packages/@monomind/cli/.claude/agents/testing/testing-performance-benchmarker.md +0 -269
  99. package/packages/@monomind/cli/.claude/agents/testing/testing-test-results-analyzer.md +0 -306
  100. package/packages/@monomind/cli/.claude/agents/testing/testing-tool-evaluator.md +0 -395
  101. package/packages/@monomind/cli/.claude/agents/testing/testing-workflow-optimizer.md +0 -451
  102. package/packages/@monomind/cli/.claude/commands/agents/README.md +0 -14
  103. package/packages/@monomind/cli/.claude/commands/agents/agent-capabilities.md +0 -25
  104. package/packages/@monomind/cli/.claude/commands/agents/agent-coordination.md +0 -32
  105. package/packages/@monomind/cli/.claude/commands/agents/agent-spawning.md +0 -32
  106. package/packages/@monomind/cli/.claude/commands/agents/agent-types.md +0 -30
  107. package/packages/@monomind/cli/.claude/commands/analysis/README.md +0 -18
  108. package/packages/@monomind/cli/.claude/commands/analysis/bottleneck-detect.md +0 -69
  109. package/packages/@monomind/cli/.claude/commands/analysis/performance-bottlenecks.md +0 -59
  110. package/packages/@monomind/cli/.claude/commands/analysis/performance-report.md +0 -52
  111. package/packages/@monomind/cli/.claude/commands/analysis/token-usage.md +0 -47
  112. package/packages/@monomind/cli/.claude/commands/automation/README.md +0 -19
  113. package/packages/@monomind/cli/.claude/commands/automation/auto-agent.md +0 -86
  114. package/packages/@monomind/cli/.claude/commands/automation/self-healing.md +0 -108
  115. package/packages/@monomind/cli/.claude/commands/automation/session-memory.md +0 -89
  116. package/packages/@monomind/cli/.claude/commands/automation/smart-agents.md +0 -81
  117. package/packages/@monomind/cli/.claude/commands/automation/smart-spawn.md +0 -66
  118. package/packages/@monomind/cli/.claude/commands/automation/workflow-select.md +0 -60
  119. package/packages/@monomind/cli/.claude/commands/coordination/README.md +0 -13
  120. package/packages/@monomind/cli/.claude/commands/coordination/agent-spawn.md +0 -69
  121. package/packages/@monomind/cli/.claude/commands/coordination/swarm-init.md +0 -82
  122. package/packages/@monomind/cli/.claude/commands/coordination/task-orchestrate.md +0 -79
  123. package/packages/@monomind/cli/.claude/commands/github/README.md +0 -24
  124. package/packages/@monomind/cli/.claude/commands/github/github-modes.md +0 -151
  125. package/packages/@monomind/cli/.claude/commands/github/issue-tracker.md +0 -291
  126. package/packages/@monomind/cli/.claude/commands/github/pr-manager.md +0 -171
  127. package/packages/@monomind/cli/.claude/commands/github/release-manager.md +0 -343
  128. package/packages/@monomind/cli/.claude/commands/github/repo-architect.md +0 -372
  129. package/packages/@monomind/cli/.claude/commands/github/sync-coordinator.md +0 -297
  130. package/packages/@monomind/cli/.claude/commands/hive-mind/README.md +0 -42
  131. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-consensus.md +0 -72
  132. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-init.md +0 -68
  133. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-memory.md +0 -73
  134. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-spawn.md +0 -82
  135. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-status.md +0 -56
  136. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-stop.md +0 -55
  137. package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind.md +0 -87
  138. package/packages/@monomind/cli/.claude/commands/hooks/README.md +0 -66
  139. package/packages/@monomind/cli/.claude/commands/hooks/overview.md +0 -112
  140. package/packages/@monomind/cli/.claude/commands/hooks/post-edit.md +0 -78
  141. package/packages/@monomind/cli/.claude/commands/hooks/post-task.md +0 -62
  142. package/packages/@monomind/cli/.claude/commands/hooks/pre-edit.md +0 -81
  143. package/packages/@monomind/cli/.claude/commands/hooks/pre-task.md +0 -73
  144. package/packages/@monomind/cli/.claude/commands/hooks/session-end.md +0 -82
  145. package/packages/@monomind/cli/.claude/commands/hooks/setup.md +0 -132
  146. package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +0 -492
  147. package/packages/@monomind/cli/.claude/commands/mastermind/_taskfile.md +0 -232
  148. package/packages/@monomind/cli/.claude/commands/mastermind/adr.md +0 -9
  149. package/packages/@monomind/cli/.claude/commands/mastermind/approvev1.md +0 -94
  150. package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +0 -52
  151. package/packages/@monomind/cli/.claude/commands/mastermind/autodev.md +0 -28
  152. package/packages/@monomind/cli/.claude/commands/mastermind/brain.md +0 -99
  153. package/packages/@monomind/cli/.claude/commands/mastermind/budget.md +0 -5
  154. package/packages/@monomind/cli/.claude/commands/mastermind/build.md +0 -23
  155. package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +0 -314
  156. package/packages/@monomind/cli/.claude/commands/mastermind/content.md +0 -23
  157. package/packages/@monomind/cli/.claude/commands/mastermind/createorg.md +0 -143
  158. package/packages/@monomind/cli/.claude/commands/mastermind/createtask.md +0 -372
  159. package/packages/@monomind/cli/.claude/commands/mastermind/debug.md +0 -19
  160. package/packages/@monomind/cli/.claude/commands/mastermind/design.md +0 -17
  161. package/packages/@monomind/cli/.claude/commands/mastermind/do.md +0 -525
  162. package/packages/@monomind/cli/.claude/commands/mastermind/execute.md +0 -17
  163. package/packages/@monomind/cli/.claude/commands/mastermind/finance.md +0 -23
  164. package/packages/@monomind/cli/.claude/commands/mastermind/finish.md +0 -17
  165. package/packages/@monomind/cli/.claude/commands/mastermind/graph-status.md +0 -5
  166. package/packages/@monomind/cli/.claude/commands/mastermind/help.md +0 -133
  167. package/packages/@monomind/cli/.claude/commands/mastermind/idea.md +0 -23
  168. package/packages/@monomind/cli/.claude/commands/mastermind/ideate.md +0 -258
  169. package/packages/@monomind/cli/.claude/commands/mastermind/improve.md +0 -342
  170. package/packages/@monomind/cli/.claude/commands/mastermind/loops.md +0 -5
  171. package/packages/@monomind/cli/.claude/commands/mastermind/marketing.md +0 -23
  172. package/packages/@monomind/cli/.claude/commands/mastermind/master.md +0 -1140
  173. package/packages/@monomind/cli/.claude/commands/mastermind/memory.md +0 -227
  174. package/packages/@monomind/cli/.claude/commands/mastermind/okf-export.md +0 -14
  175. package/packages/@monomind/cli/.claude/commands/mastermind/okf-import.md +0 -15
  176. package/packages/@monomind/cli/.claude/commands/mastermind/ops.md +0 -23
  177. package/packages/@monomind/cli/.claude/commands/mastermind/orgs.md +0 -18
  178. package/packages/@monomind/cli/.claude/commands/mastermind/orgstatus.md +0 -56
  179. package/packages/@monomind/cli/.claude/commands/mastermind/plan.md +0 -23
  180. package/packages/@monomind/cli/.claude/commands/mastermind/receive-review.md +0 -17
  181. package/packages/@monomind/cli/.claude/commands/mastermind/references/antigravity-tools.md +0 -60
  182. package/packages/@monomind/cli/.claude/commands/mastermind/references/claude-code-tools.md +0 -50
  183. package/packages/@monomind/cli/.claude/commands/mastermind/references/codex-tools.md +0 -64
  184. package/packages/@monomind/cli/.claude/commands/mastermind/references/copilot-tools.md +0 -49
  185. package/packages/@monomind/cli/.claude/commands/mastermind/references/gemini-tools.md +0 -63
  186. package/packages/@monomind/cli/.claude/commands/mastermind/references/pi-tools.md +0 -28
  187. package/packages/@monomind/cli/.claude/commands/mastermind/release.md +0 -23
  188. package/packages/@monomind/cli/.claude/commands/mastermind/repeat.md +0 -254
  189. package/packages/@monomind/cli/.claude/commands/mastermind/research.md +0 -23
  190. package/packages/@monomind/cli/.claude/commands/mastermind/review.md +0 -34
  191. package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +0 -71
  192. package/packages/@monomind/cli/.claude/commands/mastermind/runorgv1.md +0 -159
  193. package/packages/@monomind/cli/.claude/commands/mastermind/sales.md +0 -23
  194. package/packages/@monomind/cli/.claude/commands/mastermind/skill-builder.md +0 -17
  195. package/packages/@monomind/cli/.claude/commands/mastermind/specialagents.md +0 -122
  196. package/packages/@monomind/cli/.claude/commands/mastermind/stoporg.md +0 -78
  197. package/packages/@monomind/cli/.claude/commands/mastermind/swarm.md +0 -158
  198. package/packages/@monomind/cli/.claude/commands/mastermind/taskdev.md +0 -23
  199. package/packages/@monomind/cli/.claude/commands/mastermind/tdd.md +0 -19
  200. package/packages/@monomind/cli/.claude/commands/mastermind/techport.md +0 -27
  201. package/packages/@monomind/cli/.claude/commands/mastermind/topology.md +0 -121
  202. package/packages/@monomind/cli/.claude/commands/mastermind/understand.md +0 -136
  203. package/packages/@monomind/cli/.claude/commands/mastermind/verify.md +0 -19
  204. package/packages/@monomind/cli/.claude/commands/mastermind/worktree.md +0 -17
  205. package/packages/@monomind/cli/.claude/commands/mastermind.md +0 -140
  206. package/packages/@monomind/cli/.claude/commands/memory/README.md +0 -79
  207. package/packages/@monomind/cli/.claude/commands/memory/memory-search.md +0 -77
  208. package/packages/@monomind/cli/.claude/commands/monitoring/README.md +0 -69
  209. package/packages/@monomind/cli/.claude/commands/monitoring/agent-metrics.md +0 -65
  210. package/packages/@monomind/cli/.claude/commands/monitoring/agents.md +0 -71
  211. package/packages/@monomind/cli/.claude/commands/monitoring/status.md +0 -108
  212. package/packages/@monomind/cli/.claude/commands/monobrowse.md +0 -21
  213. package/packages/@monomind/cli/.claude/commands/monoes/README.md +0 -30
  214. package/packages/@monomind/cli/.claude/commands/monoes/install.md +0 -163
  215. package/packages/@monomind/cli/.claude/commands/monoes/monoagent.md +0 -148
  216. package/packages/@monomind/cli/.claude/commands/monoes/monoclip.md +0 -64
  217. package/packages/@monomind/cli/.claude/commands/monoes/monotask.md +0 -137
  218. package/packages/@monomind/cli/.claude/commands/monograph/README.md +0 -102
  219. package/packages/@monomind/cli/.claude/commands/monograph/monograph-build.md +0 -79
  220. package/packages/@monomind/cli/.claude/commands/monograph/monograph-search.md +0 -96
  221. package/packages/@monomind/cli/.claude/commands/monograph/monograph-stats.md +0 -53
  222. package/packages/@monomind/cli/.claude/commands/monograph/monograph-watch.md +0 -63
  223. package/packages/@monomind/cli/.claude/commands/monograph/monograph-wiki.md +0 -91
  224. package/packages/@monomind/cli/.claude/commands/optimization/auto-topology.md +0 -85
  225. package/packages/@monomind/cli/.claude/commands/optimization/performance-optimize.md +0 -79
  226. package/packages/@monomind/cli/.claude/commands/pair/README.md +0 -79
  227. package/packages/@monomind/cli/.claude/commands/pair/examples.md +0 -156
  228. package/packages/@monomind/cli/.claude/commands/pair/modes.md +0 -122
  229. package/packages/@monomind/cli/.claude/commands/pair/session.md +0 -124
  230. package/packages/@monomind/cli/.claude/commands/stream-chain/pipeline.md +0 -116
  231. package/packages/@monomind/cli/.claude/commands/stream-chain/run.md +0 -156
  232. package/packages/@monomind/cli/.claude/commands/swarm/README.md +0 -40
  233. package/packages/@monomind/cli/.claude/commands/swarm/analysis.md +0 -73
  234. package/packages/@monomind/cli/.claude/commands/swarm/development.md +0 -72
  235. package/packages/@monomind/cli/.claude/commands/swarm/examples.md +0 -103
  236. package/packages/@monomind/cli/.claude/commands/swarm/maintenance.md +0 -75
  237. package/packages/@monomind/cli/.claude/commands/swarm/optimization.md +0 -84
  238. package/packages/@monomind/cli/.claude/commands/swarm/research.md +0 -76
  239. package/packages/@monomind/cli/.claude/commands/swarm/swarm.md +0 -79
  240. package/packages/@monomind/cli/.claude/commands/swarm/testing.md +0 -80
  241. package/packages/@monomind/cli/.claude/commands/tokens.md +0 -18
  242. package/packages/@monomind/cli/.claude/commands/truth/start.md +0 -121
  243. package/packages/@monomind/cli/.claude/commands/ts.md +0 -14
  244. package/packages/@monomind/cli/.claude/commands/workflows/README.md +0 -64
  245. package/packages/@monomind/cli/.claude/commands/workflows/development.md +0 -86
  246. package/packages/@monomind/cli/.claude/commands/workflows/research.md +0 -89
  247. package/packages/@monomind/cli/.claude/commands/workflows/workflow-create.md +0 -83
  248. package/packages/@monomind/cli/.claude/commands/workflows/workflow-execute.md +0 -101
  249. package/packages/@monomind/cli/.claude/commands/workflows/workflow-export.md +0 -88
  250. package/packages/@monomind/cli/.claude/helpers/build-skill-registry.cjs +0 -323
  251. package/packages/@monomind/cli/.claude/helpers/control-start.cjs +0 -327
  252. package/packages/@monomind/cli/.claude/helpers/control-stop.cjs +0 -95
  253. package/packages/@monomind/cli/.claude/helpers/event-logger.cjs +0 -266
  254. package/packages/@monomind/cli/.claude/helpers/graphify-freshen.cjs +0 -148
  255. package/packages/@monomind/cli/.claude/helpers/handlers/adr-draft-handler.cjs +0 -78
  256. package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +0 -132
  257. package/packages/@monomind/cli/.claude/helpers/handlers/budget-status-handler.cjs +0 -14
  258. package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +0 -736
  259. package/packages/@monomind/cli/.claude/helpers/handlers/compact-handler.cjs +0 -35
  260. package/packages/@monomind/cli/.claude/helpers/handlers/edit-handler.cjs +0 -178
  261. package/packages/@monomind/cli/.claude/helpers/handlers/gates-handler.cjs +0 -494
  262. package/packages/@monomind/cli/.claude/helpers/handlers/graph-status-handler.cjs +0 -45
  263. package/packages/@monomind/cli/.claude/helpers/handlers/loops-status-handler.cjs +0 -48
  264. package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +0 -770
  265. package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +0 -286
  266. package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +0 -573
  267. package/packages/@monomind/cli/.claude/helpers/handlers/stats-handler.cjs +0 -14
  268. package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +0 -241
  269. package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +0 -951
  270. package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +0 -510
  271. package/packages/@monomind/cli/.claude/helpers/learning-service.mjs +0 -61
  272. package/packages/@monomind/cli/.claude/helpers/loop-tracker.cjs +0 -119
  273. package/packages/@monomind/cli/.claude/helpers/mastermind-activate.cjs +0 -35
  274. package/packages/@monomind/cli/.claude/helpers/memory-palace.cjs +0 -461
  275. package/packages/@monomind/cli/.claude/helpers/memory.cjs +0 -193
  276. package/packages/@monomind/cli/.claude/helpers/metrics-db.mjs +0 -87
  277. package/packages/@monomind/cli/.claude/helpers/monolean-activate.cjs +0 -30
  278. package/packages/@monomind/cli/.claude/helpers/monolean-config.cjs +0 -76
  279. package/packages/@monomind/cli/.claude/helpers/monolean-instructions.cjs +0 -109
  280. package/packages/@monomind/cli/.claude/helpers/monolean-propagate.cjs +0 -13
  281. package/packages/@monomind/cli/.claude/helpers/monolean-tracker.cjs +0 -18
  282. package/packages/@monomind/cli/.claude/helpers/router.cjs +0 -571
  283. package/packages/@monomind/cli/.claude/helpers/session.cjs +0 -145
  284. package/packages/@monomind/cli/.claude/helpers/skill-registry.json +0 -4948
  285. package/packages/@monomind/cli/.claude/helpers/statusline.cjs +0 -1368
  286. package/packages/@monomind/cli/.claude/helpers/toggle-statusline.cjs +0 -73
  287. package/packages/@monomind/cli/.claude/helpers/token-tracker.cjs +0 -1034
  288. package/packages/@monomind/cli/.claude/helpers/utils/agent-registrations.cjs +0 -41
  289. package/packages/@monomind/cli/.claude/helpers/utils/fs-helpers.cjs +0 -183
  290. package/packages/@monomind/cli/.claude/helpers/utils/micro-agents.cjs +0 -358
  291. package/packages/@monomind/cli/.claude/helpers/utils/monograph.cjs +0 -707
  292. package/packages/@monomind/cli/.claude/helpers/utils/system-pressure.cjs +0 -46
  293. package/packages/@monomind/cli/.claude/helpers/utils/telemetry.cjs +0 -162
  294. package/packages/@monomind/cli/.claude/settings.json +0 -448
  295. package/packages/@monomind/cli/.claude/skills/agent-browser-testing/SKILL.md +0 -964
  296. package/packages/@monomind/cli/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
  297. package/packages/@monomind/cli/.claude/skills/github-issue-triage/SKILL.md +0 -354
  298. package/packages/@monomind/cli/.claude/skills/github-repo-recap/SKILL.md +0 -207
  299. package/packages/@monomind/cli/.claude/skills/github-toolkit/SKILL.md +0 -60
  300. package/packages/@monomind/cli/.claude/skills/hive-mind-advanced/SKILL.md +0 -694
  301. package/packages/@monomind/cli/.claude/skills/hooks-automation/SKILL.md +0 -1192
  302. package/packages/@monomind/cli/.claude/skills/mastermind-access/SKILL.md +0 -236
  303. package/packages/@monomind/cli/.claude/skills/mastermind-activity/SKILL.md +0 -191
  304. package/packages/@monomind/cli/.claude/skills/mastermind-adapter-manager/SKILL.md +0 -259
  305. package/packages/@monomind/cli/.claude/skills/mastermind-adapters/SKILL.md +0 -204
  306. package/packages/@monomind/cli/.claude/skills/mastermind-agent-detail/SKILL.md +0 -242
  307. package/packages/@monomind/cli/.claude/skills/mastermind-agent-select/SKILL.md +0 -132
  308. package/packages/@monomind/cli/.claude/skills/mastermind-agents/SKILL.md +0 -182
  309. package/packages/@monomind/cli/.claude/skills/mastermind-approval-detail/SKILL.md +0 -259
  310. package/packages/@monomind/cli/.claude/skills/mastermind-approvev1/SKILL.md +0 -191
  311. package/packages/@monomind/cli/.claude/skills/mastermind-architect/SKILL.md +0 -862
  312. package/packages/@monomind/cli/.claude/skills/mastermind-autodev/SKILL.md +0 -360
  313. package/packages/@monomind/cli/.claude/skills/mastermind-backup/SKILL.md +0 -197
  314. package/packages/@monomind/cli/.claude/skills/mastermind-bootstrap/SKILL.md +0 -190
  315. package/packages/@monomind/cli/.claude/skills/mastermind-budgets/SKILL.md +0 -237
  316. package/packages/@monomind/cli/.claude/skills/mastermind-build/SKILL.md +0 -169
  317. package/packages/@monomind/cli/.claude/skills/mastermind-companies/SKILL.md +0 -256
  318. package/packages/@monomind/cli/.claude/skills/mastermind-content/SKILL.md +0 -197
  319. package/packages/@monomind/cli/.claude/skills/mastermind-costs/SKILL.md +0 -151
  320. package/packages/@monomind/cli/.claude/skills/mastermind-createorg/SKILL.md +0 -247
  321. package/packages/@monomind/cli/.claude/skills/mastermind-debug/SKILL.md +0 -277
  322. package/packages/@monomind/cli/.claude/skills/mastermind-delegation/SKILL.md +0 -83
  323. package/packages/@monomind/cli/.claude/skills/mastermind-design/SKILL.md +0 -190
  324. package/packages/@monomind/cli/.claude/skills/mastermind-diagnose/SKILL.md +0 -249
  325. package/packages/@monomind/cli/.claude/skills/mastermind-env/SKILL.md +0 -203
  326. package/packages/@monomind/cli/.claude/skills/mastermind-environments/SKILL.md +0 -250
  327. package/packages/@monomind/cli/.claude/skills/mastermind-execute/SKILL.md +0 -104
  328. package/packages/@monomind/cli/.claude/skills/mastermind-export/SKILL.md +0 -333
  329. package/packages/@monomind/cli/.claude/skills/mastermind-finance/SKILL.md +0 -166
  330. package/packages/@monomind/cli/.claude/skills/mastermind-finish/SKILL.md +0 -251
  331. package/packages/@monomind/cli/.claude/skills/mastermind-goal-detail/SKILL.md +0 -255
  332. package/packages/@monomind/cli/.claude/skills/mastermind-goals/SKILL.md +0 -149
  333. package/packages/@monomind/cli/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -167
  334. package/packages/@monomind/cli/.claude/skills/mastermind-idea/SKILL.md +0 -1142
  335. package/packages/@monomind/cli/.claude/skills/mastermind-import/SKILL.md +0 -281
  336. package/packages/@monomind/cli/.claude/skills/mastermind-inbox/SKILL.md +0 -226
  337. package/packages/@monomind/cli/.claude/skills/mastermind-instance/SKILL.md +0 -235
  338. package/packages/@monomind/cli/.claude/skills/mastermind-instance-settings/SKILL.md +0 -315
  339. package/packages/@monomind/cli/.claude/skills/mastermind-intake/SKILL.md +0 -83
  340. package/packages/@monomind/cli/.claude/skills/mastermind-invite-landing/SKILL.md +0 -227
  341. package/packages/@monomind/cli/.claude/skills/mastermind-invites/SKILL.md +0 -254
  342. package/packages/@monomind/cli/.claude/skills/mastermind-issue-detail/SKILL.md +0 -291
  343. package/packages/@monomind/cli/.claude/skills/mastermind-issues/SKILL.md +0 -235
  344. package/packages/@monomind/cli/.claude/skills/mastermind-join-queue/SKILL.md +0 -170
  345. package/packages/@monomind/cli/.claude/skills/mastermind-liveness/SKILL.md +0 -392
  346. package/packages/@monomind/cli/.claude/skills/mastermind-marketing/SKILL.md +0 -228
  347. package/packages/@monomind/cli/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -181
  348. package/packages/@monomind/cli/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -158
  349. package/packages/@monomind/cli/.claude/skills/mastermind-memory/SKILL.md +0 -321
  350. package/packages/@monomind/cli/.claude/skills/mastermind-monitor/SKILL.md +0 -1284
  351. package/packages/@monomind/cli/.claude/skills/mastermind-monotask/SKILL.md +0 -350
  352. package/packages/@monomind/cli/.claude/skills/mastermind-my-issues/SKILL.md +0 -146
  353. package/packages/@monomind/cli/.claude/skills/mastermind-new-agent/SKILL.md +0 -241
  354. package/packages/@monomind/cli/.claude/skills/mastermind-ops/SKILL.md +0 -168
  355. package/packages/@monomind/cli/.claude/skills/mastermind-org-chart/SKILL.md +0 -209
  356. package/packages/@monomind/cli/.claude/skills/mastermind-org-settings/SKILL.md +0 -274
  357. package/packages/@monomind/cli/.claude/skills/mastermind-orgs/SKILL.md +0 -120
  358. package/packages/@monomind/cli/.claude/skills/mastermind-orgstatus/SKILL.md +0 -254
  359. package/packages/@monomind/cli/.claude/skills/mastermind-plan/SKILL.md +0 -217
  360. package/packages/@monomind/cli/.claude/skills/mastermind-plan-to-tasks/SKILL.md +0 -136
  361. package/packages/@monomind/cli/.claude/skills/mastermind-plugin-manager/SKILL.md +0 -241
  362. package/packages/@monomind/cli/.claude/skills/mastermind-plugin-settings/SKILL.md +0 -273
  363. package/packages/@monomind/cli/.claude/skills/mastermind-plugins/SKILL.md +0 -190
  364. package/packages/@monomind/cli/.claude/skills/mastermind-profile/SKILL.md +0 -187
  365. package/packages/@monomind/cli/.claude/skills/mastermind-project-detail/SKILL.md +0 -249
  366. package/packages/@monomind/cli/.claude/skills/mastermind-project-workspace/SKILL.md +0 -244
  367. package/packages/@monomind/cli/.claude/skills/mastermind-projects/SKILL.md +0 -167
  368. package/packages/@monomind/cli/.claude/skills/mastermind-protocol/SKILL.md +0 -404
  369. package/packages/@monomind/cli/.claude/skills/mastermind-receive-review/SKILL.md +0 -213
  370. package/packages/@monomind/cli/.claude/skills/mastermind-release/SKILL.md +0 -168
  371. package/packages/@monomind/cli/.claude/skills/mastermind-repeat/SKILL.md +0 -171
  372. package/packages/@monomind/cli/.claude/skills/mastermind-research/SKILL.md +0 -168
  373. package/packages/@monomind/cli/.claude/skills/mastermind-review/SKILL.md +0 -233
  374. package/packages/@monomind/cli/.claude/skills/mastermind-routine-detail/SKILL.md +0 -253
  375. package/packages/@monomind/cli/.claude/skills/mastermind-routines/SKILL.md +0 -203
  376. package/packages/@monomind/cli/.claude/skills/mastermind-runorg/SKILL.md +0 -43
  377. package/packages/@monomind/cli/.claude/skills/mastermind-runorgv1/SKILL.md +0 -731
  378. package/packages/@monomind/cli/.claude/skills/mastermind-sales/SKILL.md +0 -170
  379. package/packages/@monomind/cli/.claude/skills/mastermind-search/SKILL.md +0 -186
  380. package/packages/@monomind/cli/.claude/skills/mastermind-secrets/SKILL.md +0 -199
  381. package/packages/@monomind/cli/.claude/skills/mastermind-skill-builder/SKILL.md +0 -447
  382. package/packages/@monomind/cli/.claude/skills/mastermind-skills/SKILL.md +0 -156
  383. package/packages/@monomind/cli/.claude/skills/mastermind-stoporg/SKILL.md +0 -147
  384. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/SKILL.md +0 -377
  385. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -60
  386. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -144
  387. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -114
  388. package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -80
  389. package/packages/@monomind/cli/.claude/skills/mastermind-tasks/SKILL.md +0 -152
  390. package/packages/@monomind/cli/.claude/skills/mastermind-tdd/SKILL.md +0 -424
  391. package/packages/@monomind/cli/.claude/skills/mastermind-techport/SKILL.md +0 -777
  392. package/packages/@monomind/cli/.claude/skills/mastermind-threads/SKILL.md +0 -259
  393. package/packages/@monomind/cli/.claude/skills/mastermind-tree-control/SKILL.md +0 -250
  394. package/packages/@monomind/cli/.claude/skills/mastermind-verify/SKILL.md +0 -196
  395. package/packages/@monomind/cli/.claude/skills/mastermind-wiki/SKILL.md +0 -314
  396. package/packages/@monomind/cli/.claude/skills/mastermind-workspace-detail/SKILL.md +0 -317
  397. package/packages/@monomind/cli/.claude/skills/mastermind-workspaces/SKILL.md +0 -261
  398. package/packages/@monomind/cli/.claude/skills/mastermind-worktree/SKILL.md +0 -215
  399. package/packages/@monomind/cli/.claude/skills/memory-toolkit/SKILL.md +0 -75
  400. package/packages/@monomind/cli/.claude/skills/monodesign/SKILL.md +0 -257
  401. package/packages/@monomind/cli/.claude/skills/monodesign/adapt.md +0 -53
  402. package/packages/@monomind/cli/.claude/skills/monodesign/agents/monodesign-asset-producer.md +0 -100
  403. package/packages/@monomind/cli/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +0 -103
  404. package/packages/@monomind/cli/.claude/skills/monodesign/animate.md +0 -65
  405. package/packages/@monomind/cli/.claude/skills/monodesign/audit.md +0 -89
  406. package/packages/@monomind/cli/.claude/skills/monodesign/bolder.md +0 -50
  407. package/packages/@monomind/cli/.claude/skills/monodesign/clarify.md +0 -64
  408. package/packages/@monomind/cli/.claude/skills/monodesign/colorize.md +0 -68
  409. package/packages/@monomind/cli/.claude/skills/monodesign/craft.md +0 -51
  410. package/packages/@monomind/cli/.claude/skills/monodesign/critique.md +0 -66
  411. package/packages/@monomind/cli/.claude/skills/monodesign/delight.md +0 -47
  412. package/packages/@monomind/cli/.claude/skills/monodesign/distill.md +0 -56
  413. package/packages/@monomind/cli/.claude/skills/monodesign/document.md +0 -83
  414. package/packages/@monomind/cli/.claude/skills/monodesign/extract.md +0 -74
  415. package/packages/@monomind/cli/.claude/skills/monodesign/harden.md +0 -65
  416. package/packages/@monomind/cli/.claude/skills/monodesign/init.md +0 -30
  417. package/packages/@monomind/cli/.claude/skills/monodesign/layout.md +0 -36
  418. package/packages/@monomind/cli/.claude/skills/monodesign/live.md +0 -34
  419. package/packages/@monomind/cli/.claude/skills/monodesign/onboard.md +0 -50
  420. package/packages/@monomind/cli/.claude/skills/monodesign/optimize.md +0 -64
  421. package/packages/@monomind/cli/.claude/skills/monodesign/overdrive.md +0 -56
  422. package/packages/@monomind/cli/.claude/skills/monodesign/polish.md +0 -68
  423. package/packages/@monomind/cli/.claude/skills/monodesign/quieter.md +0 -57
  424. package/packages/@monomind/cli/.claude/skills/monodesign/reference/adapt.md +0 -312
  425. package/packages/@monomind/cli/.claude/skills/monodesign/reference/adapt.native.md +0 -58
  426. package/packages/@monomind/cli/.claude/skills/monodesign/reference/android.md +0 -40
  427. package/packages/@monomind/cli/.claude/skills/monodesign/reference/animate.md +0 -203
  428. package/packages/@monomind/cli/.claude/skills/monodesign/reference/antipatterns-catalog.md +0 -410
  429. package/packages/@monomind/cli/.claude/skills/monodesign/reference/audit.md +0 -135
  430. package/packages/@monomind/cli/.claude/skills/monodesign/reference/audit.native.md +0 -139
  431. package/packages/@monomind/cli/.claude/skills/monodesign/reference/bolder.md +0 -120
  432. package/packages/@monomind/cli/.claude/skills/monodesign/reference/brand-workflow.md +0 -180
  433. package/packages/@monomind/cli/.claude/skills/monodesign/reference/brand.md +0 -108
  434. package/packages/@monomind/cli/.claude/skills/monodesign/reference/clarify.md +0 -288
  435. package/packages/@monomind/cli/.claude/skills/monodesign/reference/codex.md +0 -105
  436. package/packages/@monomind/cli/.claude/skills/monodesign/reference/cognitive-load.md +0 -106
  437. package/packages/@monomind/cli/.claude/skills/monodesign/reference/color-and-contrast.md +0 -105
  438. package/packages/@monomind/cli/.claude/skills/monodesign/reference/colorize.md +0 -257
  439. package/packages/@monomind/cli/.claude/skills/monodesign/reference/component-specs.md +0 -260
  440. package/packages/@monomind/cli/.claude/skills/monodesign/reference/component-states.md +0 -274
  441. package/packages/@monomind/cli/.claude/skills/monodesign/reference/component-system.md +0 -358
  442. package/packages/@monomind/cli/.claude/skills/monodesign/reference/copy-formulas.md +0 -160
  443. package/packages/@monomind/cli/.claude/skills/monodesign/reference/craft.md +0 -123
  444. package/packages/@monomind/cli/.claude/skills/monodesign/reference/critique.md +0 -780
  445. package/packages/@monomind/cli/.claude/skills/monodesign/reference/delight.md +0 -302
  446. package/packages/@monomind/cli/.claude/skills/monodesign/reference/design-principles.md +0 -246
  447. package/packages/@monomind/cli/.claude/skills/monodesign/reference/distill.md +0 -111
  448. package/packages/@monomind/cli/.claude/skills/monodesign/reference/document.md +0 -429
  449. package/packages/@monomind/cli/.claude/skills/monodesign/reference/extract.md +0 -69
  450. package/packages/@monomind/cli/.claude/skills/monodesign/reference/harden.md +0 -347
  451. package/packages/@monomind/cli/.claude/skills/monodesign/reference/heuristics-scoring.md +0 -234
  452. package/packages/@monomind/cli/.claude/skills/monodesign/reference/hooks.md +0 -92
  453. package/packages/@monomind/cli/.claude/skills/monodesign/reference/image-prompts.md +0 -130
  454. package/packages/@monomind/cli/.claude/skills/monodesign/reference/init.md +0 -221
  455. package/packages/@monomind/cli/.claude/skills/monodesign/reference/interaction-design.md +0 -189
  456. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ios.md +0 -45
  457. package/packages/@monomind/cli/.claude/skills/monodesign/reference/layout.md +0 -185
  458. package/packages/@monomind/cli/.claude/skills/monodesign/reference/live.md +0 -710
  459. package/packages/@monomind/cli/.claude/skills/monodesign/reference/motion-design.md +0 -109
  460. package/packages/@monomind/cli/.claude/skills/monodesign/reference/onboard.md +0 -234
  461. package/packages/@monomind/cli/.claude/skills/monodesign/reference/optimize.md +0 -258
  462. package/packages/@monomind/cli/.claude/skills/monodesign/reference/overdrive.md +0 -130
  463. package/packages/@monomind/cli/.claude/skills/monodesign/reference/personas.md +0 -179
  464. package/packages/@monomind/cli/.claude/skills/monodesign/reference/polish.md +0 -241
  465. package/packages/@monomind/cli/.claude/skills/monodesign/reference/pre-delivery-checklist.md +0 -108
  466. package/packages/@monomind/cli/.claude/skills/monodesign/reference/product.md +0 -60
  467. package/packages/@monomind/cli/.claude/skills/monodesign/reference/quieter.md +0 -99
  468. package/packages/@monomind/cli/.claude/skills/monodesign/reference/responsive-design.md +0 -114
  469. package/packages/@monomind/cli/.claude/skills/monodesign/reference/shape.md +0 -165
  470. package/packages/@monomind/cli/.claude/skills/monodesign/reference/spatial-design.md +0 -100
  471. package/packages/@monomind/cli/.claude/skills/monodesign/reference/teach.md +0 -10
  472. package/packages/@monomind/cli/.claude/skills/monodesign/reference/token-architecture.md +0 -222
  473. package/packages/@monomind/cli/.claude/skills/monodesign/reference/typeset.md +0 -301
  474. package/packages/@monomind/cli/.claude/skills/monodesign/reference/typography.md +0 -159
  475. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ux-research.md +0 -143
  476. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ux-rules.md +0 -211
  477. package/packages/@monomind/cli/.claude/skills/monodesign/reference/ux-writing.md +0 -107
  478. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/command-metadata.json +0 -94
  479. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/context-signals.mjs +0 -260
  480. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/context.mjs +0 -1065
  481. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/critique-storage.mjs +0 -416
  482. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detect-csp.mjs +0 -198
  483. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detect.mjs +0 -33
  484. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +0 -1962
  485. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/cli/main.mjs +0 -321
  486. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/design-system.mjs +0 -814
  487. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +0 -5608
  488. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +0 -50
  489. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +0 -259
  490. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +0 -258
  491. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +0 -636
  492. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +0 -1015
  493. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +0 -253
  494. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -198
  495. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/findings.mjs +0 -12
  496. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +0 -181
  497. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +0 -373
  498. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/fix/index.mjs +0 -426
  499. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +0 -198
  500. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +0 -166
  501. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +0 -563
  502. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +0 -3002
  503. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/color.mjs +0 -124
  504. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +0 -101
  505. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +0 -30
  506. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +0 -148
  507. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/detector/shared/page.mjs +0 -7
  508. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-admin.mjs +0 -661
  509. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-before-edit.mjs +0 -516
  510. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook-lib.mjs +0 -1776
  511. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/hook.mjs +0 -61
  512. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/design-parser.mjs +0 -842
  513. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/is-generated.mjs +0 -69
  514. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +0 -640
  515. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +0 -129
  516. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/provider.mjs +0 -4
  517. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/lib/target-args.mjs +0 -42
  518. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +0 -50
  519. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/completion.mjs +0 -19
  520. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/event-validation.mjs +0 -137
  521. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/insert-ui.mjs +0 -458
  522. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-apply.mjs +0 -939
  523. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +0 -357
  524. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +0 -152
  525. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/session-store.mjs +0 -293
  526. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/svelte-component.mjs +0 -826
  527. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +0 -274
  528. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/ui-core.mjs +0 -180
  529. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live/vocabulary.mjs +0 -36
  530. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-accept.mjs +0 -812
  531. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser-dom.js +0 -146
  532. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser-session.js +0 -123
  533. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-browser.js +0 -11240
  534. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +0 -1241
  535. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-complete.mjs +0 -75
  536. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +0 -683
  537. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +0 -51
  538. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-inject.mjs +0 -583
  539. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-insert.mjs +0 -272
  540. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +0 -363
  541. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-poll.mjs +0 -384
  542. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-resume.mjs +0 -94
  543. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-server.mjs +0 -1174
  544. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-status.mjs +0 -61
  545. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-target.mjs +0 -30
  546. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live-wrap.mjs +0 -894
  547. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/live.mjs +0 -297
  548. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +0 -14
  549. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/palette.mjs +0 -633
  550. package/packages/@monomind/cli/.claude/skills/monodesign/scripts/pin.mjs +0 -221
  551. package/packages/@monomind/cli/.claude/skills/monodesign/shape.md +0 -71
  552. package/packages/@monomind/cli/.claude/skills/monodesign/teach.md +0 -18
  553. package/packages/@monomind/cli/.claude/skills/monodesign/typeset.md +0 -59
  554. package/packages/@monomind/cli/.claude/skills/monolean/SKILL.md +0 -118
  555. package/packages/@monomind/cli/.claude/skills/monolean-audit/SKILL.md +0 -41
  556. package/packages/@monomind/cli/.claude/skills/monolean-debt/SKILL.md +0 -46
  557. package/packages/@monomind/cli/.claude/skills/monolean-help/SKILL.md +0 -60
  558. package/packages/@monomind/cli/.claude/skills/monolean-review/SKILL.md +0 -57
  559. package/packages/@monomind/cli/.claude/skills/monomind/browse-agentcore.md +0 -115
  560. package/packages/@monomind/cli/.claude/skills/monomind/browse-electron.md +0 -188
  561. package/packages/@monomind/cli/.claude/skills/monomind/browse-qa.md +0 -228
  562. package/packages/@monomind/cli/.claude/skills/monomind/browse-references/authentication.md +0 -161
  563. package/packages/@monomind/cli/.claude/skills/monomind/browse-references/trust-boundaries.md +0 -40
  564. package/packages/@monomind/cli/.claude/skills/monomind/browse-references/video-recording.md +0 -83
  565. package/packages/@monomind/cli/.claude/skills/monomind/browse-slack.md +0 -188
  566. package/packages/@monomind/cli/.claude/skills/monomind/browse-vercel.md +0 -239
  567. package/packages/@monomind/cli/.claude/skills/monomind/browse.md +0 -724
  568. package/packages/@monomind/cli/.claude/skills/monomotion/SKILL.md +0 -145
  569. package/packages/@monomind/cli/.claude/skills/monomotion/rules/api-control.md +0 -139
  570. package/packages/@monomind/cli/.claude/skills/monomotion/rules/effects.md +0 -109
  571. package/packages/@monomind/cli/.claude/skills/monomotion/rules/integration.md +0 -140
  572. package/packages/@monomind/cli/.claude/skills/monomotion/rules/scroll.md +0 -131
  573. package/packages/@monomind/cli/.claude/skills/monomotion/rules/sequencing.md +0 -105
  574. package/packages/@monomind/cli/.claude/skills/monomotion/rules/svg.md +0 -101
  575. package/packages/@monomind/cli/.claude/skills/monomotion/rules/text.md +0 -119
  576. package/packages/@monomind/cli/.claude/skills/pair-programming/SKILL.md +0 -1202
  577. package/packages/@monomind/cli/.claude/skills/performance-analysis/SKILL.md +0 -560
  578. package/packages/@monomind/cli/.claude/skills/skill-builder/SKILL.md +0 -910
  579. package/packages/@monomind/cli/.claude/skills/specialagent/SKILL.md +0 -206
  580. package/packages/@monomind/cli/.claude/skills/stop-slop/SKILL.md +0 -67
  581. package/packages/@monomind/cli/.claude/skills/stop-slop/references/examples.md +0 -61
  582. package/packages/@monomind/cli/.claude/skills/stop-slop/references/phrases.md +0 -130
  583. package/packages/@monomind/cli/.claude/skills/stop-slop/references/structures.md +0 -136
  584. package/packages/@monomind/cli/.claude/skills/swarm-advanced/SKILL.md +0 -936
  585. package/packages/@monomind/cli/.claude/skills/swarm-orchestration/SKILL.md +0 -179
  586. package/packages/@monomind/cli/.claude/skills/verification-quality/SKILL.md +0 -674
  587. package/packages/@monomind/cli/README.md +0 -414
  588. package/packages/@monomind/cli/bin/cli.js +0 -379
  589. package/packages/@monomind/cli/bin/mcp-server.js +0 -208
  590. package/packages/@monomind/cli/bin/preinstall.cjs +0 -2
  591. package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +0 -64
  592. package/packages/@monomind/cli/dist/src/agents/registry-builder.js +0 -228
  593. package/packages/@monomind/cli/dist/src/autopilot-state.d.ts +0 -77
  594. package/packages/@monomind/cli/dist/src/autopilot-state.js +0 -336
  595. package/packages/@monomind/cli/dist/src/browser/action-builder/analyzer.d.ts +0 -11
  596. package/packages/@monomind/cli/dist/src/browser/action-builder/analyzer.js +0 -64
  597. package/packages/@monomind/cli/dist/src/browser/action-builder/types.d.ts +0 -47
  598. package/packages/@monomind/cli/dist/src/browser/action-builder/types.js +0 -2
  599. package/packages/@monomind/cli/dist/src/browser/adapters/gemini.d.ts +0 -3
  600. package/packages/@monomind/cli/dist/src/browser/adapters/gemini.js +0 -16
  601. package/packages/@monomind/cli/dist/src/browser/adapters/index.d.ts +0 -19
  602. package/packages/@monomind/cli/dist/src/browser/adapters/index.js +0 -23
  603. package/packages/@monomind/cli/dist/src/browser/adapters/instagram.d.ts +0 -3
  604. package/packages/@monomind/cli/dist/src/browser/adapters/instagram.js +0 -17
  605. package/packages/@monomind/cli/dist/src/browser/adapters/linkedin.d.ts +0 -3
  606. package/packages/@monomind/cli/dist/src/browser/adapters/linkedin.js +0 -19
  607. package/packages/@monomind/cli/dist/src/browser/adapters/x.d.ts +0 -3
  608. package/packages/@monomind/cli/dist/src/browser/adapters/x.js +0 -19
  609. package/packages/@monomind/cli/dist/src/browser/dashboard/server.d.ts +0 -9
  610. package/packages/@monomind/cli/dist/src/browser/dashboard/server.js +0 -215
  611. package/packages/@monomind/cli/dist/src/browser/dashboard/ui.html +0 -261
  612. package/packages/@monomind/cli/dist/src/browser/workflow/engine.d.ts +0 -15
  613. package/packages/@monomind/cli/dist/src/browser/workflow/engine.js +0 -127
  614. package/packages/@monomind/cli/dist/src/browser/workflow/expression.d.ts +0 -4
  615. package/packages/@monomind/cli/dist/src/browser/workflow/expression.js +0 -64
  616. package/packages/@monomind/cli/dist/src/browser/workflow/store.d.ts +0 -24
  617. package/packages/@monomind/cli/dist/src/browser/workflow/store.js +0 -145
  618. package/packages/@monomind/cli/dist/src/browser/workflow/types.d.ts +0 -48
  619. package/packages/@monomind/cli/dist/src/browser/workflow/types.js +0 -2
  620. package/packages/@monomind/cli/dist/src/capabilities/cap-code.d.ts +0 -3
  621. package/packages/@monomind/cli/dist/src/capabilities/cap-code.js +0 -20
  622. package/packages/@monomind/cli/dist/src/capabilities/cap-data.d.ts +0 -3
  623. package/packages/@monomind/cli/dist/src/capabilities/cap-data.js +0 -165
  624. package/packages/@monomind/cli/dist/src/capabilities/cap-documents.d.ts +0 -5
  625. package/packages/@monomind/cli/dist/src/capabilities/cap-documents.js +0 -139
  626. package/packages/@monomind/cli/dist/src/capabilities/cap-graph.d.ts +0 -3
  627. package/packages/@monomind/cli/dist/src/capabilities/cap-graph.js +0 -84
  628. package/packages/@monomind/cli/dist/src/capabilities/cap-media.d.ts +0 -3
  629. package/packages/@monomind/cli/dist/src/capabilities/cap-media.js +0 -147
  630. package/packages/@monomind/cli/dist/src/capabilities/cap-timeline.d.ts +0 -3
  631. package/packages/@monomind/cli/dist/src/capabilities/cap-timeline.js +0 -90
  632. package/packages/@monomind/cli/dist/src/capabilities/index.d.ts +0 -10
  633. package/packages/@monomind/cli/dist/src/capabilities/index.js +0 -18
  634. package/packages/@monomind/cli/dist/src/capabilities/manager.d.ts +0 -13
  635. package/packages/@monomind/cli/dist/src/capabilities/manager.js +0 -79
  636. package/packages/@monomind/cli/dist/src/capabilities/scanner.d.ts +0 -10
  637. package/packages/@monomind/cli/dist/src/capabilities/scanner.js +0 -125
  638. package/packages/@monomind/cli/dist/src/capabilities/types.d.ts +0 -64
  639. package/packages/@monomind/cli/dist/src/capabilities/types.js +0 -2
  640. package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.d.ts +0 -17
  641. package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.js +0 -346
  642. package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +0 -8
  643. package/packages/@monomind/cli/dist/src/commands/agent-ops.js +0 -277
  644. package/packages/@monomind/cli/dist/src/commands/agent.d.ts +0 -8
  645. package/packages/@monomind/cli/dist/src/commands/agent.js +0 -40
  646. package/packages/@monomind/cli/dist/src/commands/analyze-ast.d.ts +0 -26
  647. package/packages/@monomind/cli/dist/src/commands/analyze-ast.js +0 -284
  648. package/packages/@monomind/cli/dist/src/commands/analyze-diff.d.ts +0 -8
  649. package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +0 -395
  650. package/packages/@monomind/cli/dist/src/commands/analyze-imports.d.ts +0 -11
  651. package/packages/@monomind/cli/dist/src/commands/analyze-imports.js +0 -287
  652. package/packages/@monomind/cli/dist/src/commands/analyze-symbols.d.ts +0 -14
  653. package/packages/@monomind/cli/dist/src/commands/analyze-symbols.js +0 -302
  654. package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +0 -53
  655. package/packages/@monomind/cli/dist/src/commands/analyze.js +0 -217
  656. package/packages/@monomind/cli/dist/src/commands/autopilot.d.ts +0 -15
  657. package/packages/@monomind/cli/dist/src/commands/autopilot.js +0 -370
  658. package/packages/@monomind/cli/dist/src/commands/browse-action.d.ts +0 -4
  659. package/packages/@monomind/cli/dist/src/commands/browse-action.js +0 -244
  660. package/packages/@monomind/cli/dist/src/commands/browse-platform.d.ts +0 -4
  661. package/packages/@monomind/cli/dist/src/commands/browse-platform.js +0 -117
  662. package/packages/@monomind/cli/dist/src/commands/browse-workflow.d.ts +0 -4
  663. package/packages/@monomind/cli/dist/src/commands/browse-workflow.js +0 -183
  664. package/packages/@monomind/cli/dist/src/commands/browse.d.ts +0 -12
  665. package/packages/@monomind/cli/dist/src/commands/browse.js +0 -17
  666. package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +0 -45
  667. package/packages/@monomind/cli/dist/src/commands/cleanup.js +0 -581
  668. package/packages/@monomind/cli/dist/src/commands/completions.d.ts +0 -10
  669. package/packages/@monomind/cli/dist/src/commands/completions.js +0 -261
  670. package/packages/@monomind/cli/dist/src/commands/config.d.ts +0 -8
  671. package/packages/@monomind/cli/dist/src/commands/config.js +0 -462
  672. package/packages/@monomind/cli/dist/src/commands/crash-reporting.d.ts +0 -8
  673. package/packages/@monomind/cli/dist/src/commands/crash-reporting.js +0 -50
  674. package/packages/@monomind/cli/dist/src/commands/design-detect.d.ts +0 -27
  675. package/packages/@monomind/cli/dist/src/commands/design-detect.js +0 -220
  676. package/packages/@monomind/cli/dist/src/commands/design-palette.d.ts +0 -21
  677. package/packages/@monomind/cli/dist/src/commands/design-palette.js +0 -538
  678. package/packages/@monomind/cli/dist/src/commands/doc.d.ts +0 -7
  679. package/packages/@monomind/cli/dist/src/commands/doc.js +0 -268
  680. package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.d.ts +0 -26
  681. package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.js +0 -194
  682. package/packages/@monomind/cli/dist/src/commands/doctor-monoes-checks.d.ts +0 -12
  683. package/packages/@monomind/cli/dist/src/commands/doctor-monoes-checks.js +0 -160
  684. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +0 -46
  685. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +0 -764
  686. package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +0 -10
  687. package/packages/@monomind/cli/dist/src/commands/doctor.js +0 -232
  688. package/packages/@monomind/cli/dist/src/commands/guidance.d.ts +0 -12
  689. package/packages/@monomind/cli/dist/src/commands/guidance.js +0 -163
  690. package/packages/@monomind/cli/dist/src/commands/hooks-core-commands.d.ts +0 -10
  691. package/packages/@monomind/cli/dist/src/commands/hooks-core-commands.js +0 -377
  692. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.d.ts +0 -11
  693. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +0 -417
  694. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.d.ts +0 -6
  695. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +0 -219
  696. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.d.ts +0 -7
  697. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +0 -399
  698. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-utils.d.ts +0 -42
  699. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-utils.js +0 -220
  700. package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.d.ts +0 -11
  701. package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.js +0 -243
  702. package/packages/@monomind/cli/dist/src/commands/hooks-formatting.d.ts +0 -9
  703. package/packages/@monomind/cli/dist/src/commands/hooks-formatting.js +0 -25
  704. package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.d.ts +0 -15
  705. package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.js +0 -725
  706. package/packages/@monomind/cli/dist/src/commands/hooks-workers.d.ts +0 -9
  707. package/packages/@monomind/cli/dist/src/commands/hooks-workers.js +0 -547
  708. package/packages/@monomind/cli/dist/src/commands/hooks.d.ts +0 -16
  709. package/packages/@monomind/cli/dist/src/commands/hooks.js +0 -497
  710. package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -65
  711. package/packages/@monomind/cli/dist/src/commands/index.js +0 -236
  712. package/packages/@monomind/cli/dist/src/commands/init-subcommands.d.ts +0 -8
  713. package/packages/@monomind/cli/dist/src/commands/init-subcommands.js +0 -156
  714. package/packages/@monomind/cli/dist/src/commands/init-upgrade.d.ts +0 -6
  715. package/packages/@monomind/cli/dist/src/commands/init-upgrade.js +0 -203
  716. package/packages/@monomind/cli/dist/src/commands/init-wizard.d.ts +0 -6
  717. package/packages/@monomind/cli/dist/src/commands/init-wizard.js +0 -244
  718. package/packages/@monomind/cli/dist/src/commands/init.d.ts +0 -8
  719. package/packages/@monomind/cli/dist/src/commands/init.js +0 -411
  720. package/packages/@monomind/cli/dist/src/commands/mcp.d.ts +0 -11
  721. package/packages/@monomind/cli/dist/src/commands/mcp.js +0 -747
  722. package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +0 -9
  723. package/packages/@monomind/cli/dist/src/commands/memory-admin.js +0 -345
  724. package/packages/@monomind/cli/dist/src/commands/memory-crud.d.ts +0 -9
  725. package/packages/@monomind/cli/dist/src/commands/memory-crud.js +0 -389
  726. package/packages/@monomind/cli/dist/src/commands/memory-list.d.ts +0 -10
  727. package/packages/@monomind/cli/dist/src/commands/memory-list.js +0 -321
  728. package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +0 -8
  729. package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +0 -199
  730. package/packages/@monomind/cli/dist/src/commands/memory.d.ts +0 -14
  731. package/packages/@monomind/cli/dist/src/commands/memory.js +0 -282
  732. package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +0 -8
  733. package/packages/@monomind/cli/dist/src/commands/monograph.js +0 -548
  734. package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +0 -10
  735. package/packages/@monomind/cli/dist/src/commands/neural-core.js +0 -413
  736. package/packages/@monomind/cli/dist/src/commands/neural-optimize.d.ts +0 -7
  737. package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +0 -330
  738. package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +0 -7
  739. package/packages/@monomind/cli/dist/src/commands/neural-registry.js +0 -290
  740. package/packages/@monomind/cli/dist/src/commands/org-observe.d.ts +0 -18
  741. package/packages/@monomind/cli/dist/src/commands/org-observe.js +0 -353
  742. package/packages/@monomind/cli/dist/src/commands/org.d.ts +0 -25
  743. package/packages/@monomind/cli/dist/src/commands/org.js +0 -860
  744. package/packages/@monomind/cli/dist/src/commands/performance.d.ts +0 -10
  745. package/packages/@monomind/cli/dist/src/commands/performance.js +0 -656
  746. package/packages/@monomind/cli/dist/src/commands/platforms.d.ts +0 -11
  747. package/packages/@monomind/cli/dist/src/commands/platforms.js +0 -600
  748. package/packages/@monomind/cli/dist/src/commands/providers.d.ts +0 -10
  749. package/packages/@monomind/cli/dist/src/commands/providers.js +0 -351
  750. package/packages/@monomind/cli/dist/src/commands/report-crash.d.ts +0 -10
  751. package/packages/@monomind/cli/dist/src/commands/report-crash.js +0 -66
  752. package/packages/@monomind/cli/dist/src/commands/route.d.ts +0 -16
  753. package/packages/@monomind/cli/dist/src/commands/route.js +0 -944
  754. package/packages/@monomind/cli/dist/src/commands/search-universal.d.ts +0 -19
  755. package/packages/@monomind/cli/dist/src/commands/search-universal.js +0 -151
  756. package/packages/@monomind/cli/dist/src/commands/security-cve.d.ts +0 -6
  757. package/packages/@monomind/cli/dist/src/commands/security-cve.js +0 -308
  758. package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +0 -8
  759. package/packages/@monomind/cli/dist/src/commands/security-misc.js +0 -336
  760. package/packages/@monomind/cli/dist/src/commands/security-scan.d.ts +0 -47
  761. package/packages/@monomind/cli/dist/src/commands/security-scan.js +0 -447
  762. package/packages/@monomind/cli/dist/src/commands/security.d.ts +0 -10
  763. package/packages/@monomind/cli/dist/src/commands/security.js +0 -41
  764. package/packages/@monomind/cli/dist/src/commands/session.d.ts +0 -8
  765. package/packages/@monomind/cli/dist/src/commands/session.js +0 -660
  766. package/packages/@monomind/cli/dist/src/commands/start.d.ts +0 -8
  767. package/packages/@monomind/cli/dist/src/commands/start.js +0 -490
  768. package/packages/@monomind/cli/dist/src/commands/status.d.ts +0 -8
  769. package/packages/@monomind/cli/dist/src/commands/status.js +0 -642
  770. package/packages/@monomind/cli/dist/src/commands/swarm.d.ts +0 -8
  771. package/packages/@monomind/cli/dist/src/commands/swarm.js +0 -906
  772. package/packages/@monomind/cli/dist/src/commands/task.d.ts +0 -8
  773. package/packages/@monomind/cli/dist/src/commands/task.js +0 -639
  774. package/packages/@monomind/cli/dist/src/commands/tokens.d.ts +0 -8
  775. package/packages/@monomind/cli/dist/src/commands/tokens.js +0 -206
  776. package/packages/@monomind/cli/dist/src/commands/update.d.ts +0 -8
  777. package/packages/@monomind/cli/dist/src/commands/update.js +0 -288
  778. package/packages/@monomind/cli/dist/src/consensus/audit-writer.d.ts +0 -77
  779. package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +0 -196
  780. package/packages/@monomind/cli/dist/src/consensus/tally.d.ts +0 -19
  781. package/packages/@monomind/cli/dist/src/consensus/tally.js +0 -34
  782. package/packages/@monomind/cli/dist/src/index.d.ts +0 -81
  783. package/packages/@monomind/cli/dist/src/index.js +0 -574
  784. package/packages/@monomind/cli/dist/src/init/claudemd-generator.d.ts +0 -25
  785. package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +0 -624
  786. package/packages/@monomind/cli/dist/src/init/executor.d.ts +0 -47
  787. package/packages/@monomind/cli/dist/src/init/executor.js +0 -2387
  788. package/packages/@monomind/cli/dist/src/init/helpers-generator.d.ts +0 -73
  789. package/packages/@monomind/cli/dist/src/init/helpers-generator.js +0 -1335
  790. package/packages/@monomind/cli/dist/src/init/index.d.ts +0 -13
  791. package/packages/@monomind/cli/dist/src/init/index.js +0 -15
  792. package/packages/@monomind/cli/dist/src/init/mcp-generator.d.ts +0 -26
  793. package/packages/@monomind/cli/dist/src/init/mcp-generator.js +0 -107
  794. package/packages/@monomind/cli/dist/src/init/settings-generator.d.ts +0 -14
  795. package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -487
  796. package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.d.ts +0 -38
  797. package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +0 -602
  798. package/packages/@monomind/cli/dist/src/init/statusline-generator.d.ts +0 -25
  799. package/packages/@monomind/cli/dist/src/init/statusline-generator.js +0 -1358
  800. package/packages/@monomind/cli/dist/src/init/types.d.ts +0 -308
  801. package/packages/@monomind/cli/dist/src/init/types.js +0 -247
  802. package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.d.ts +0 -75
  803. package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.js +0 -556
  804. package/packages/@monomind/cli/dist/src/mcp-client.d.ts +0 -64
  805. package/packages/@monomind/cli/dist/src/mcp-client.js +0 -338
  806. package/packages/@monomind/cli/dist/src/mcp-server.d.ts +0 -170
  807. package/packages/@monomind/cli/dist/src/mcp-server.js +0 -964
  808. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +0 -30
  809. package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -603
  810. package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.d.ts +0 -38
  811. package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +0 -389
  812. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +0 -75
  813. package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +0 -125
  814. package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.d.ts +0 -12
  815. package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +0 -237
  816. package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.d.ts +0 -11
  817. package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +0 -1111
  818. package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.d.ts +0 -12
  819. package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +0 -827
  820. package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.d.ts +0 -8
  821. package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +0 -447
  822. package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.d.ts +0 -11
  823. package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +0 -866
  824. package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.d.ts +0 -9
  825. package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +0 -582
  826. package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +0 -10
  827. package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +0 -58
  828. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.d.ts +0 -15
  829. package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +0 -634
  830. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +0 -17
  831. package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +0 -1237
  832. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.d.ts +0 -161
  833. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.js +0 -516
  834. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.d.ts +0 -22
  835. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.js +0 -888
  836. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +0 -26
  837. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +0 -1582
  838. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.d.ts +0 -9
  839. package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +0 -51
  840. package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -31
  841. package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -31
  842. package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.d.ts +0 -6
  843. package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.js +0 -156
  844. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +0 -35
  845. package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +0 -776
  846. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.d.ts +0 -26
  847. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +0 -136
  848. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +0 -27
  849. package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +0 -2443
  850. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +0 -15
  851. package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +0 -506
  852. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.d.ts +0 -16
  853. package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +0 -680
  854. package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.d.ts +0 -261
  855. package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +0 -423
  856. package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +0 -137
  857. package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js +0 -383
  858. package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.d.ts +0 -14
  859. package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.js +0 -58
  860. package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.d.ts +0 -17
  861. package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +0 -44
  862. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +0 -18
  863. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +0 -576
  864. package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.d.ts +0 -8
  865. package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +0 -431
  866. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.d.ts +0 -9
  867. package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +0 -411
  868. package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.d.ts +0 -13
  869. package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +0 -561
  870. package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +0 -28
  871. package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +0 -514
  872. package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +0 -10
  873. package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +0 -397
  874. package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.d.ts +0 -27
  875. package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +0 -76
  876. package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +0 -58
  877. package/packages/@monomind/cli/dist/src/mcp-tools/types.js +0 -98
  878. package/packages/@monomind/cli/dist/src/memory/embedding-operations.d.ts +0 -58
  879. package/packages/@monomind/cli/dist/src/memory/embedding-operations.js +0 -262
  880. package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.d.ts +0 -319
  881. package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +0 -698
  882. package/packages/@monomind/cli/dist/src/memory/hnsw-operations.d.ts +0 -142
  883. package/packages/@monomind/cli/dist/src/memory/hnsw-operations.js +0 -465
  884. package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +0 -368
  885. package/packages/@monomind/cli/dist/src/memory/intelligence.js +0 -1456
  886. package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +0 -333
  887. package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +0 -1104
  888. package/packages/@monomind/cli/dist/src/memory/memory-crud.d.ts +0 -67
  889. package/packages/@monomind/cli/dist/src/memory/memory-crud.js +0 -454
  890. package/packages/@monomind/cli/dist/src/memory/memory-initializer.d.ts +0 -101
  891. package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +0 -431
  892. package/packages/@monomind/cli/dist/src/memory/memory-kg.d.ts +0 -186
  893. package/packages/@monomind/cli/dist/src/memory/memory-kg.js +0 -450
  894. package/packages/@monomind/cli/dist/src/memory/memory-migrations.d.ts +0 -30
  895. package/packages/@monomind/cli/dist/src/memory/memory-migrations.js +0 -136
  896. package/packages/@monomind/cli/dist/src/memory/memory-read.d.ts +0 -87
  897. package/packages/@monomind/cli/dist/src/memory/memory-read.js +0 -333
  898. package/packages/@monomind/cli/dist/src/memory/memory-schema.d.ts +0 -13
  899. package/packages/@monomind/cli/dist/src/memory/memory-schema.js +0 -167
  900. package/packages/@monomind/cli/dist/src/memory/query-router.d.ts +0 -44
  901. package/packages/@monomind/cli/dist/src/memory/query-router.js +0 -113
  902. package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +0 -237
  903. package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +0 -647
  904. package/packages/@monomind/cli/dist/src/monovector/command-outcomes.d.ts +0 -37
  905. package/packages/@monomind/cli/dist/src/monovector/command-outcomes.js +0 -126
  906. package/packages/@monomind/cli/dist/src/monovector/coverage-router.d.ts +0 -103
  907. package/packages/@monomind/cli/dist/src/monovector/coverage-router.js +0 -341
  908. package/packages/@monomind/cli/dist/src/monovector/coverage-tools.d.ts +0 -14
  909. package/packages/@monomind/cli/dist/src/monovector/coverage-tools.js +0 -115
  910. package/packages/@monomind/cli/dist/src/monovector/diff-classifier.d.ts +0 -174
  911. package/packages/@monomind/cli/dist/src/monovector/diff-classifier.js +0 -738
  912. package/packages/@monomind/cli/dist/src/monovector/index.d.ts +0 -54
  913. package/packages/@monomind/cli/dist/src/monovector/index.js +0 -55
  914. package/packages/@monomind/cli/dist/src/monovector/init-state.d.ts +0 -35
  915. package/packages/@monomind/cli/dist/src/monovector/init-state.js +0 -36
  916. package/packages/@monomind/cli/dist/src/monovector/route-outcomes.d.ts +0 -56
  917. package/packages/@monomind/cli/dist/src/monovector/route-outcomes.js +0 -189
  918. package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +0 -40
  919. package/packages/@monomind/cli/dist/src/observability/replay-reader.js +0 -138
  920. package/packages/@monomind/cli/dist/src/orgrt/broker.d.ts +0 -26
  921. package/packages/@monomind/cli/dist/src/orgrt/broker.js +0 -73
  922. package/packages/@monomind/cli/dist/src/orgrt/bus.d.ts +0 -27
  923. package/packages/@monomind/cli/dist/src/orgrt/bus.js +0 -71
  924. package/packages/@monomind/cli/dist/src/orgrt/daemon.d.ts +0 -175
  925. package/packages/@monomind/cli/dist/src/orgrt/daemon.js +0 -965
  926. package/packages/@monomind/cli/dist/src/orgrt/forwarder.d.ts +0 -16
  927. package/packages/@monomind/cli/dist/src/orgrt/forwarder.js +0 -171
  928. package/packages/@monomind/cli/dist/src/orgrt/inbox.d.ts +0 -11
  929. package/packages/@monomind/cli/dist/src/orgrt/inbox.js +0 -91
  930. package/packages/@monomind/cli/dist/src/orgrt/mailbox.d.ts +0 -49
  931. package/packages/@monomind/cli/dist/src/orgrt/mailbox.js +0 -75
  932. package/packages/@monomind/cli/dist/src/orgrt/migrate.d.ts +0 -26
  933. package/packages/@monomind/cli/dist/src/orgrt/migrate.js +0 -118
  934. package/packages/@monomind/cli/dist/src/orgrt/policy.d.ts +0 -28
  935. package/packages/@monomind/cli/dist/src/orgrt/policy.js +0 -146
  936. package/packages/@monomind/cli/dist/src/orgrt/provider.d.ts +0 -9
  937. package/packages/@monomind/cli/dist/src/orgrt/provider.js +0 -55
  938. package/packages/@monomind/cli/dist/src/orgrt/reporting.d.ts +0 -40
  939. package/packages/@monomind/cli/dist/src/orgrt/reporting.js +0 -134
  940. package/packages/@monomind/cli/dist/src/orgrt/scheduler.d.ts +0 -13
  941. package/packages/@monomind/cli/dist/src/orgrt/scheduler.js +0 -48
  942. package/packages/@monomind/cli/dist/src/orgrt/server.d.ts +0 -9
  943. package/packages/@monomind/cli/dist/src/orgrt/server.js +0 -88
  944. package/packages/@monomind/cli/dist/src/orgrt/session.d.ts +0 -62
  945. package/packages/@monomind/cli/dist/src/orgrt/session.js +0 -157
  946. package/packages/@monomind/cli/dist/src/orgrt/templates.d.ts +0 -17
  947. package/packages/@monomind/cli/dist/src/orgrt/templates.js +0 -62
  948. package/packages/@monomind/cli/dist/src/orgrt/test-loop.d.ts +0 -12
  949. package/packages/@monomind/cli/dist/src/orgrt/test-loop.js +0 -108
  950. package/packages/@monomind/cli/dist/src/orgrt/types.d.ts +0 -910
  951. package/packages/@monomind/cli/dist/src/orgrt/types.js +0 -57
  952. package/packages/@monomind/cli/dist/src/output.d.ts +0 -133
  953. package/packages/@monomind/cli/dist/src/output.js +0 -529
  954. package/packages/@monomind/cli/dist/src/parser.d.ts +0 -93
  955. package/packages/@monomind/cli/dist/src/parser.js +0 -651
  956. package/packages/@monomind/cli/dist/src/pricing/model-pricing.d.ts +0 -41
  957. package/packages/@monomind/cli/dist/src/pricing/model-pricing.js +0 -61
  958. package/packages/@monomind/cli/dist/src/production/circuit-breaker.d.ts +0 -121
  959. package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +0 -262
  960. package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +0 -119
  961. package/packages/@monomind/cli/dist/src/production/error-handler.js +0 -324
  962. package/packages/@monomind/cli/dist/src/production/index.d.ts +0 -6
  963. package/packages/@monomind/cli/dist/src/production/index.js +0 -6
  964. package/packages/@monomind/cli/dist/src/production/monitoring.d.ts +0 -181
  965. package/packages/@monomind/cli/dist/src/production/monitoring.js +0 -375
  966. package/packages/@monomind/cli/dist/src/production/rate-limiter.d.ts +0 -125
  967. package/packages/@monomind/cli/dist/src/production/rate-limiter.js +0 -218
  968. package/packages/@monomind/cli/dist/src/production/retry.d.ts +0 -48
  969. package/packages/@monomind/cli/dist/src/production/retry.js +0 -189
  970. package/packages/@monomind/cli/dist/src/prompt.d.ts +0 -44
  971. package/packages/@monomind/cli/dist/src/prompt.js +0 -501
  972. package/packages/@monomind/cli/dist/src/routing/embed-worker.d.ts +0 -2
  973. package/packages/@monomind/cli/dist/src/routing/embed-worker.js +0 -79
  974. package/packages/@monomind/cli/dist/src/routing/embedder.d.ts +0 -31
  975. package/packages/@monomind/cli/dist/src/routing/embedder.js +0 -0
  976. package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +0 -24
  977. package/packages/@monomind/cli/dist/src/routing/llm-caller.js +0 -134
  978. package/packages/@monomind/cli/dist/src/routing/route-layer-factory.d.ts +0 -24
  979. package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +0 -239
  980. package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +0 -80
  981. package/packages/@monomind/cli/dist/src/services/config-file-manager.js +0 -401
  982. package/packages/@monomind/cli/dist/src/services/crash-reporter.d.ts +0 -42
  983. package/packages/@monomind/cli/dist/src/services/crash-reporter.js +0 -374
  984. package/packages/@monomind/cli/dist/src/suggest.d.ts +0 -53
  985. package/packages/@monomind/cli/dist/src/suggest.js +0 -197
  986. package/packages/@monomind/cli/dist/src/sync/checker.d.ts +0 -12
  987. package/packages/@monomind/cli/dist/src/sync/checker.js +0 -26
  988. package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +0 -22
  989. package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +0 -192
  990. package/packages/@monomind/cli/dist/src/transfer/types.d.ts +0 -245
  991. package/packages/@monomind/cli/dist/src/transfer/types.js +0 -6
  992. package/packages/@monomind/cli/dist/src/types.d.ts +0 -190
  993. package/packages/@monomind/cli/dist/src/types.js +0 -20
  994. package/packages/@monomind/cli/dist/src/ui/collector.mjs +0 -879
  995. package/packages/@monomind/cli/dist/src/ui/dashboard.html +0 -13949
  996. package/packages/@monomind/cli/dist/src/ui/data/agent-avatars.html +0 -763
  997. package/packages/@monomind/cli/dist/src/ui/data/agent-avatars.json +0 -966
  998. package/packages/@monomind/cli/dist/src/ui/data/avatars/account-strategist.svg +0 -58
  999. package/packages/@monomind/cli/dist/src/ui/data/avatars/accounts-payable.svg +0 -54
  1000. package/packages/@monomind/cli/dist/src/ui/data/avatars/adaptive-coordinator.svg +0 -55
  1001. package/packages/@monomind/cli/dist/src/ui/data/avatars/adaptive-coordinator2.svg +0 -54
  1002. package/packages/@monomind/cli/dist/src/ui/data/avatars/ai-citation.svg +0 -57
  1003. package/packages/@monomind/cli/dist/src/ui/data/avatars/ai-engineer.svg +0 -61
  1004. package/packages/@monomind/cli/dist/src/ui/data/avatars/analytics-reporter.svg +0 -53
  1005. package/packages/@monomind/cli/dist/src/ui/data/avatars/api-tester.svg +0 -53
  1006. package/packages/@monomind/cli/dist/src/ui/data/avatars/architecture.svg +0 -54
  1007. package/packages/@monomind/cli/dist/src/ui/data/avatars/automation-governance.svg +0 -55
  1008. package/packages/@monomind/cli/dist/src/ui/data/avatars/backend-dev.svg +0 -53
  1009. package/packages/@monomind/cli/dist/src/ui/data/avatars/benchmarker.svg +0 -54
  1010. package/packages/@monomind/cli/dist/src/ui/data/avatars/blockchain-auditor.svg +0 -53
  1011. package/packages/@monomind/cli/dist/src/ui/data/avatars/byzantine-coord.svg +0 -57
  1012. package/packages/@monomind/cli/dist/src/ui/data/avatars/case-analyst.svg +0 -57
  1013. package/packages/@monomind/cli/dist/src/ui/data/avatars/cicd-engineer.svg +0 -55
  1014. package/packages/@monomind/cli/dist/src/ui/data/avatars/cloud-architect.svg +0 -54
  1015. package/packages/@monomind/cli/dist/src/ui/data/avatars/code-review-swarm.svg +0 -57
  1016. package/packages/@monomind/cli/dist/src/ui/data/avatars/coder-v119.svg +0 -57
  1017. package/packages/@monomind/cli/dist/src/ui/data/avatars/coder.svg +0 -58
  1018. package/packages/@monomind/cli/dist/src/ui/data/avatars/collective-coord.svg +0 -54
  1019. package/packages/@monomind/cli/dist/src/ui/data/avatars/compliance-auditor.svg +0 -58
  1020. package/packages/@monomind/cli/dist/src/ui/data/avatars/consensus-coordinator.svg +0 -54
  1021. package/packages/@monomind/cli/dist/src/ui/data/avatars/content-creator.svg +0 -54
  1022. package/packages/@monomind/cli/dist/src/ui/data/avatars/crdt-synchronizer.svg +0 -53
  1023. package/packages/@monomind/cli/dist/src/ui/data/avatars/cro-specialist.svg +0 -58
  1024. package/packages/@monomind/cli/dist/src/ui/data/avatars/data-consolidator.svg +0 -54
  1025. package/packages/@monomind/cli/dist/src/ui/data/avatars/data-engineer.svg +0 -53
  1026. package/packages/@monomind/cli/dist/src/ui/data/avatars/database-optimizer.svg +0 -61
  1027. package/packages/@monomind/cli/dist/src/ui/data/avatars/deal-strategist.svg +0 -54
  1028. package/packages/@monomind/cli/dist/src/ui/data/avatars/defender.svg +0 -53
  1029. package/packages/@monomind/cli/dist/src/ui/data/avatars/devops-automator.svg +0 -56
  1030. package/packages/@monomind/cli/dist/src/ui/data/avatars/discovery-coach.svg +0 -54
  1031. package/packages/@monomind/cli/dist/src/ui/data/avatars/email-marketing.svg +0 -57
  1032. package/packages/@monomind/cli/dist/src/ui/data/avatars/embedded-firmware.svg +0 -61
  1033. package/packages/@monomind/cli/dist/src/ui/data/avatars/evidence-collector.svg +0 -57
  1034. package/packages/@monomind/cli/dist/src/ui/data/avatars/experiment-tracker.svg +0 -53
  1035. package/packages/@monomind/cli/dist/src/ui/data/avatars/feedback-synthesizer.svg +0 -54
  1036. package/packages/@monomind/cli/dist/src/ui/data/avatars/finance-tracker.svg +0 -54
  1037. package/packages/@monomind/cli/dist/src/ui/data/avatars/frontend-developer.svg +0 -54
  1038. package/packages/@monomind/cli/dist/src/ui/data/avatars/game-audio-engineer.svg +0 -59
  1039. package/packages/@monomind/cli/dist/src/ui/data/avatars/game-designer.svg +0 -54
  1040. package/packages/@monomind/cli/dist/src/ui/data/avatars/gossip-coordinator.svg +0 -54
  1041. package/packages/@monomind/cli/dist/src/ui/data/avatars/hierarchical-coord.svg +0 -54
  1042. package/packages/@monomind/cli/dist/src/ui/data/avatars/incident-commander.svg +0 -57
  1043. package/packages/@monomind/cli/dist/src/ui/data/avatars/infrastructure.svg +0 -54
  1044. package/packages/@monomind/cli/dist/src/ui/data/avatars/input-validator.svg +0 -53
  1045. package/packages/@monomind/cli/dist/src/ui/data/avatars/ios-developer.svg +0 -54
  1046. package/packages/@monomind/cli/dist/src/ui/data/avatars/issue-tracker.svg +0 -53
  1047. package/packages/@monomind/cli/dist/src/ui/data/avatars/judge.svg +0 -55
  1048. package/packages/@monomind/cli/dist/src/ui/data/avatars/launch-strategist.svg +0 -54
  1049. package/packages/@monomind/cli/dist/src/ui/data/avatars/legal-compliance.svg +0 -53
  1050. package/packages/@monomind/cli/dist/src/ui/data/avatars/level-designer.svg +0 -53
  1051. package/packages/@monomind/cli/dist/src/ui/data/avatars/load-balancer.svg +0 -57
  1052. package/packages/@monomind/cli/dist/src/ui/data/avatars/mcp-builder.svg +0 -53
  1053. package/packages/@monomind/cli/dist/src/ui/data/avatars/memory-coordinator.svg +0 -55
  1054. package/packages/@monomind/cli/dist/src/ui/data/avatars/mesh-coordinator.svg +0 -55
  1055. package/packages/@monomind/cli/dist/src/ui/data/avatars/ml-developer.svg +0 -58
  1056. package/packages/@monomind/cli/dist/src/ui/data/avatars/mobile-app-builder.svg +0 -53
  1057. package/packages/@monomind/cli/dist/src/ui/data/avatars/mobile-dev.svg +0 -54
  1058. package/packages/@monomind/cli/dist/src/ui/data/avatars/model-qa.svg +0 -58
  1059. package/packages/@monomind/cli/dist/src/ui/data/avatars/narrative-designer.svg +0 -58
  1060. package/packages/@monomind/cli/dist/src/ui/data/avatars/outbound-strategist.svg +0 -55
  1061. package/packages/@monomind/cli/dist/src/ui/data/avatars/path-validator.svg +0 -54
  1062. package/packages/@monomind/cli/dist/src/ui/data/avatars/payment-agent.svg +0 -53
  1063. package/packages/@monomind/cli/dist/src/ui/data/avatars/perf-analyzer.svg +0 -58
  1064. package/packages/@monomind/cli/dist/src/ui/data/avatars/pipeline-analyst.svg +0 -54
  1065. package/packages/@monomind/cli/dist/src/ui/data/avatars/planner.svg +0 -55
  1066. package/packages/@monomind/cli/dist/src/ui/data/avatars/pr-manager.svg +0 -54
  1067. package/packages/@monomind/cli/dist/src/ui/data/avatars/pricing-strategist.svg +0 -54
  1068. package/packages/@monomind/cli/dist/src/ui/data/avatars/product-manager.svg +0 -54
  1069. package/packages/@monomind/cli/dist/src/ui/data/avatars/production-validator.svg +0 -54
  1070. package/packages/@monomind/cli/dist/src/ui/data/avatars/project-shepherd.svg +0 -54
  1071. package/packages/@monomind/cli/dist/src/ui/data/avatars/proposal-strategist.svg +0 -54
  1072. package/packages/@monomind/cli/dist/src/ui/data/avatars/prosecutor.svg +0 -57
  1073. package/packages/@monomind/cli/dist/src/ui/data/avatars/pseudocode.svg +0 -53
  1074. package/packages/@monomind/cli/dist/src/ui/data/avatars/queen-coordinator.svg +0 -55
  1075. package/packages/@monomind/cli/dist/src/ui/data/avatars/quorum-manager.svg +0 -53
  1076. package/packages/@monomind/cli/dist/src/ui/data/avatars/raft-manager.svg +0 -53
  1077. package/packages/@monomind/cli/dist/src/ui/data/avatars/reality-checker.svg +0 -58
  1078. package/packages/@monomind/cli/dist/src/ui/data/avatars/recruitment.svg +0 -58
  1079. package/packages/@monomind/cli/dist/src/ui/data/avatars/refinement.svg +0 -53
  1080. package/packages/@monomind/cli/dist/src/ui/data/avatars/release-manager.svg +0 -54
  1081. package/packages/@monomind/cli/dist/src/ui/data/avatars/repo-architect.svg +0 -54
  1082. package/packages/@monomind/cli/dist/src/ui/data/avatars/researcher.svg +0 -58
  1083. package/packages/@monomind/cli/dist/src/ui/data/avatars/resource-allocator.svg +0 -53
  1084. package/packages/@monomind/cli/dist/src/ui/data/avatars/reviewer.svg +0 -53
  1085. package/packages/@monomind/cli/dist/src/ui/data/avatars/safe-executor.svg +0 -53
  1086. package/packages/@monomind/cli/dist/src/ui/data/avatars/sales-coach.svg +0 -53
  1087. package/packages/@monomind/cli/dist/src/ui/data/avatars/sales-engineer.svg +0 -58
  1088. package/packages/@monomind/cli/dist/src/ui/data/avatars/scout-explorer.svg +0 -58
  1089. package/packages/@monomind/cli/dist/src/ui/data/avatars/security-architect.svg +0 -54
  1090. package/packages/@monomind/cli/dist/src/ui/data/avatars/security-auditor.svg +0 -55
  1091. package/packages/@monomind/cli/dist/src/ui/data/avatars/senior-developer.svg +0 -58
  1092. package/packages/@monomind/cli/dist/src/ui/data/avatars/senior-pm.svg +0 -58
  1093. package/packages/@monomind/cli/dist/src/ui/data/avatars/seo-specialist.svg +0 -57
  1094. package/packages/@monomind/cli/dist/src/ui/data/avatars/social-media.svg +0 -54
  1095. package/packages/@monomind/cli/dist/src/ui/data/avatars/solidity-engineer.svg +0 -58
  1096. package/packages/@monomind/cli/dist/src/ui/data/avatars/sparc-coder.svg +0 -58
  1097. package/packages/@monomind/cli/dist/src/ui/data/avatars/sparc-coord.svg +0 -56
  1098. package/packages/@monomind/cli/dist/src/ui/data/avatars/specification.svg +0 -57
  1099. package/packages/@monomind/cli/dist/src/ui/data/avatars/sprint-prioritizer.svg +0 -53
  1100. package/packages/@monomind/cli/dist/src/ui/data/avatars/sre.svg +0 -54
  1101. package/packages/@monomind/cli/dist/src/ui/data/avatars/studio-operations.svg +0 -53
  1102. package/packages/@monomind/cli/dist/src/ui/data/avatars/studio-producer.svg +0 -55
  1103. package/packages/@monomind/cli/dist/src/ui/data/avatars/support-responder.svg +0 -56
  1104. package/packages/@monomind/cli/dist/src/ui/data/avatars/system-architect.svg +0 -54
  1105. package/packages/@monomind/cli/dist/src/ui/data/avatars/task-orchestrator.svg +0 -56
  1106. package/packages/@monomind/cli/dist/src/ui/data/avatars/technical-artist.svg +0 -53
  1107. package/packages/@monomind/cli/dist/src/ui/data/avatars/technical-writer.svg +0 -59
  1108. package/packages/@monomind/cli/dist/src/ui/data/avatars/tester.svg +0 -53
  1109. package/packages/@monomind/cli/dist/src/ui/data/avatars/threat-detection.svg +0 -61
  1110. package/packages/@monomind/cli/dist/src/ui/data/avatars/trend-researcher.svg +0 -54
  1111. package/packages/@monomind/cli/dist/src/ui/data/avatars/trial-director.svg +0 -55
  1112. package/packages/@monomind/cli/dist/src/ui/data/avatars/unity-architect.svg +0 -54
  1113. package/packages/@monomind/cli/dist/src/ui/data/avatars/visionos-engineer.svg +0 -57
  1114. package/packages/@monomind/cli/dist/src/ui/data/avatars/worker-specialist.svg +0 -55
  1115. package/packages/@monomind/cli/dist/src/ui/data/avatars/workflow-architect.svg +0 -57
  1116. package/packages/@monomind/cli/dist/src/ui/data/avatars/workflow-automation.svg +0 -54
  1117. package/packages/@monomind/cli/dist/src/ui/data/avatars/zk-steward.svg +0 -54
  1118. package/packages/@monomind/cli/dist/src/ui/data/known-projects.json +0 -1
  1119. package/packages/@monomind/cli/dist/src/ui/data/mastermind-sessions.json +0 -1
  1120. package/packages/@monomind/cli/dist/src/ui/data/sessions/_index.json +0 -1
  1121. package/packages/@monomind/cli/dist/src/ui/mastermind-diagram-fallback.html +0 -1069
  1122. package/packages/@monomind/cli/dist/src/ui/orgs-files.js +0 -192
  1123. package/packages/@monomind/cli/dist/src/ui/orgs.html +0 -2513
  1124. package/packages/@monomind/cli/dist/src/ui/server.mjs +0 -7256
  1125. package/packages/@monomind/cli/dist/src/ui/sse-manager.mjs +0 -119
  1126. package/packages/@monomind/cli/dist/src/update/checker.d.ts +0 -34
  1127. package/packages/@monomind/cli/dist/src/update/checker.js +0 -278
  1128. package/packages/@monomind/cli/dist/src/update/executor.d.ts +0 -32
  1129. package/packages/@monomind/cli/dist/src/update/executor.js +0 -235
  1130. package/packages/@monomind/cli/dist/src/update/index.d.ts +0 -43
  1131. package/packages/@monomind/cli/dist/src/update/index.js +0 -108
  1132. package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +0 -37
  1133. package/packages/@monomind/cli/dist/src/update/rate-limiter.js +0 -190
  1134. package/packages/@monomind/cli/dist/src/update/validator.d.ts +0 -17
  1135. package/packages/@monomind/cli/dist/src/update/validator.js +0 -166
  1136. package/packages/@monomind/cli/dist/src/utils/cosine-similarity.d.ts +0 -22
  1137. package/packages/@monomind/cli/dist/src/utils/cosine-similarity.js +0 -38
  1138. package/packages/@monomind/cli/dist/src/utils/input-guards.d.ts +0 -66
  1139. package/packages/@monomind/cli/dist/src/utils/input-guards.js +0 -263
  1140. package/packages/@monomind/cli/dist/src/utils/json-file.d.ts +0 -33
  1141. package/packages/@monomind/cli/dist/src/utils/json-file.js +0 -57
  1142. package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +0 -6
  1143. package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +0 -22
  1144. package/packages/@monomind/cli/dist/src/utils/resource-governor.d.ts +0 -32
  1145. package/packages/@monomind/cli/dist/src/utils/resource-governor.js +0 -115
  1146. package/packages/@monomind/cli/package.json +0 -127
  1147. package/packages/@monomind/cli/scripts/deploy-ipfs-node.sh +0 -153
  1148. package/packages/@monomind/cli/scripts/publish.sh +0 -61
  1149. package/packages/@monomind/cli/scripts/sync-claude-assets.sh +0 -19
  1150. package/packages/@monomind/cli/scripts/understand-analyze.mjs +0 -1078
  1151. package/scripts/build-fs.mjs +0 -75
  1152. package/scripts/build-monovector.sh +0 -10
  1153. package/scripts/generate-agent-avatars.mjs +0 -492
  1154. package/scripts/generate-channel-profile-assets.sh +0 -67
  1155. package/scripts/growth-content-calendar.mjs +0 -260
  1156. package/scripts/growth-profile-kit.mjs +0 -156
  1157. package/scripts/install.sh +0 -392
  1158. package/scripts/publish-monovector.sh +0 -20
  1159. package/scripts/ua-enrich.mjs +0 -229
  1160. package/scripts/ua-import.mjs +0 -288
  1161. package/scripts/verify-appliance.sh +0 -571
@@ -1,2443 +0,0 @@
1
- /**
2
- * Monograph MCP Tools
3
- *
4
- * Native TypeScript code intelligence — replaces Python graphify.
5
- * All monograph_* tools are backed by @monoes/monograph package.
6
- */
7
- import { join, resolve, sep } from 'path';
8
- import { execSync } from 'child_process';
9
- import { statSync, readdirSync, existsSync } from 'fs';
10
- import { randomUUID } from 'crypto';
11
- import { getProjectCwd } from './types.js';
12
- let _cachedDbPath;
13
- let _cachedCwd;
14
- function _isValidDb(p) {
15
- try {
16
- return statSync(p).size >= 100;
17
- }
18
- catch {
19
- return false;
20
- }
21
- }
22
- /**
23
- * Resolve the monograph DB path for a given repo root (defaults to project cwd).
24
- * Falls back to searching up to the git root when the DB isn't directly under
25
- * `<cwd>/.monomind` — e.g. when called from a subdirectory of the repo. Only
26
- * the no-arg (project cwd) form is cached; explicit `repoPath` overrides are
27
- * cheap one-off lookups (staleness checks with a user-supplied path) so caching
28
- * them isn't worth the invalidation complexity.
29
- */
30
- function getDbPath(repoPathOverride) {
31
- const cwd = repoPathOverride ?? getProjectCwd();
32
- const useCache = repoPathOverride === undefined;
33
- // Invalidate cache when project root changes (e.g. MONOMIND_CWD set after initialize)
34
- if (useCache && _cachedDbPath && _cachedCwd === cwd)
35
- return _cachedDbPath;
36
- if (useCache) {
37
- _cachedCwd = cwd;
38
- _cachedDbPath = undefined;
39
- }
40
- const direct = join(cwd, '.monomind', 'monograph.db');
41
- if (_isValidDb(direct)) {
42
- if (useCache)
43
- _cachedDbPath = direct;
44
- return direct;
45
- }
46
- try {
47
- const root = execSync('git rev-parse --show-toplevel', { cwd, encoding: 'utf8' }).trim();
48
- const candidate = join(root, '.monomind', 'monograph.db');
49
- if (_isValidDb(candidate)) {
50
- if (useCache)
51
- _cachedDbPath = candidate;
52
- return candidate;
53
- }
54
- }
55
- catch { /* not in a git repo */ }
56
- // Don't cache failures — the DB may be created by a subsequent build
57
- return direct;
58
- }
59
- function text(t) {
60
- return { content: [{ type: 'text', text: t }] };
61
- }
62
- // ── Active watcher registry ──────────────────────────────────────────────────
63
- const _activeWatchers = new Map();
64
- function applyPprRerank(db, seedNodes, damping, maxResults) {
65
- const propagated = new Map();
66
- for (const r of seedNodes) {
67
- propagated.set(r.id, r.score);
68
- }
69
- const neighborStmt = db.prepare('SELECT target_id FROM edges WHERE source_id = @id');
70
- for (const r of seedNodes) {
71
- const neighbors = neighborStmt.all({ id: r.id });
72
- for (const n of neighbors) {
73
- const boost = r.score * damping;
74
- const current = propagated.get(n.target_id) ?? 0;
75
- propagated.set(n.target_id, Math.max(current, boost));
76
- }
77
- }
78
- const seedIds = new Set(seedNodes.map(r => r.id));
79
- const ranked = seedNodes.map(r => ({
80
- ...r,
81
- combinedScore: Math.max(r.score, propagated.get(r.id) ?? 0),
82
- boostedByNeighbors: false,
83
- }));
84
- for (const [id, score] of propagated) {
85
- if (!seedIds.has(id)) {
86
- const node = db.prepare('SELECT id, name, label, file_path, start_line FROM nodes WHERE id = @id').get({ id });
87
- if (node) {
88
- ranked.push({
89
- id: node.id, name: node.name, label: node.label,
90
- filePath: node.file_path, startLine: node.start_line,
91
- score: 0, combinedScore: score, boostedByNeighbors: true,
92
- });
93
- }
94
- }
95
- }
96
- ranked.sort((a, b) => b.combinedScore - a.combinedScore);
97
- return ranked.slice(0, maxResults).map(r => ({
98
- id: r.id, name: r.name, label: r.label,
99
- filePath: r.filePath, startLine: r.startLine,
100
- score: r.combinedScore, boostedByNeighbors: r.boostedByNeighbors,
101
- }));
102
- }
103
- // ── monograph_build ───────────────────────────────────────────────────────────
104
- const monographBuildTool = {
105
- name: 'monograph_build',
106
- description: 'Build (or rebuild) the Monograph knowledge graph for a path. Parses all code via tree-sitter and indexes into SQLite.',
107
- inputSchema: {
108
- type: 'object',
109
- properties: {
110
- path: { type: 'string', description: 'Absolute path to the repo (defaults to project cwd)' },
111
- codeOnly: { type: 'boolean', description: 'Only index code files (skip docs, config)' },
112
- force: { type: 'boolean', description: 'Force full rebuild even if index is fresh' },
113
- incremental: { type: 'boolean', description: 'Skip rebuild when index already matches HEAD (default false). Use when you want a no-op if the graph is fresh.' },
114
- },
115
- },
116
- handler: async (input) => {
117
- const { buildAsync } = await import('@monoes/monograph');
118
- const repoPath = input.path ?? getProjectCwd();
119
- let progressLog = '';
120
- await buildAsync(repoPath, {
121
- codeOnly: input.codeOnly ?? false,
122
- force: input.force ?? false,
123
- incremental: input.incremental ?? false,
124
- onProgress: (p) => { progressLog += `[${p.phase}] ${p.message ?? ''}\n`; },
125
- });
126
- const skipped = progressLog.includes('skipping rebuild');
127
- const summary = skipped ? `Index was already fresh — no rebuild needed for ${repoPath}` : `Monograph build complete for ${repoPath}`;
128
- return text(`${summary}\n${progressLog}`);
129
- },
130
- };
131
- // ── monograph_query ───────────────────────────────────────────────────────────
132
- const monographQueryTool = {
133
- name: 'monograph_query',
134
- description: 'BM25 keyword search across the code knowledge graph. When MONOGRAPH_EMBEDDINGS=true uses hybrid BM25+vector ranking (RRF). Returns nodes with file path and line number.',
135
- inputSchema: {
136
- type: 'object',
137
- properties: {
138
- query: { type: 'string', description: 'Search terms' },
139
- limit: { type: 'number', description: 'Max results (default 20)' },
140
- label: { type: 'string', description: 'Filter by node type: Class, Function, Method, etc.' },
141
- rerank: { type: 'boolean', description: 'Apply HippoRAG-style PPR graph reranking to boost neighbors of top hits (default: true)' },
142
- damping: { type: 'number', description: 'PPR damping factor when rerank=true (0-1, default 0.5)' },
143
- },
144
- required: ['query'],
145
- },
146
- handler: async (input) => {
147
- const dbPath = getDbPath();
148
- if (!_isValidDb(dbPath))
149
- return text('Monograph index not built yet. Run monograph_build first.');
150
- const { openDb, closeDb, ftsSearch } = await import('@monoes/monograph');
151
- const { hybridQuery } = await import('@monoes/monograph');
152
- const db = openDb(dbPath);
153
- try {
154
- // Cap limit: passed directly to SQLite queries and hybridQuery; an
155
- // unlimited value saturates memory with rows.
156
- const MAX_QUERY_LIMIT = 1_000;
157
- const rawLimit = input.limit ?? 20;
158
- const limit = Number.isFinite(rawLimit) && rawLimit > 0
159
- ? Math.min(Math.floor(rawLimit), MAX_QUERY_LIMIT)
160
- : 20;
161
- // Cap query: passed to FTS5 and hybridQuery; very long queries waste
162
- // parse time and can stress the FTS tokenizer.
163
- const MAX_MONOGRAPH_QUERY_LEN = 16 * 1024;
164
- const rawQuery = input.query;
165
- const query = typeof rawQuery === 'string' && rawQuery.length > MAX_MONOGRAPH_QUERY_LEN
166
- ? rawQuery.slice(0, MAX_MONOGRAPH_QUERY_LEN)
167
- : rawQuery;
168
- const label = input.label;
169
- const rerank = input.rerank ?? true;
170
- const damping = input.damping ?? 0.5;
171
- const zeroResultHint = /\s/.test(query) && !/[A-Z]/.test(query.replace(/\s+/g, '').slice(1))
172
- ? ' Hint: monograph indexes identifiers and filenames — try camelCase/PascalCase (e.g. "AgentSpawn") or a filename instead of a phrase.'
173
- : '';
174
- // Lightweight staleness check — fire-and-forget background rebuild;
175
- // append warning to results so the agent knows data may be outdated.
176
- let stalenessNote = '';
177
- const repoPath = getProjectCwd();
178
- const staleness = await computeCommitsBehind(repoPath);
179
- if (staleness && staleness.commitsBehind > 0) {
180
- const triggered = triggerBackgroundBuildIfNeeded(repoPath, staleness.commitsBehind);
181
- stalenessNote = `\n⚠ Index is ${staleness.commitsBehind} commit(s) behind HEAD${triggered ? ' — rebuild triggered' : ''}.`;
182
- }
183
- if (process.env['MONOGRAPH_EMBEDDINGS'] === 'true') {
184
- const results = await hybridQuery(db, query, { limit: rerank ? limit * 2 : limit, label });
185
- if (results.length === 0)
186
- return text('No results found.' + zeroResultHint + stalenessNote);
187
- if (rerank) {
188
- const seeds = results.map(r => ({
189
- id: r.id, name: r.name ?? r.id, label: r.label ?? '?',
190
- filePath: r.filePath ?? '', startLine: r.startLine ?? null,
191
- score: r.score,
192
- }));
193
- const reranked = applyPprRerank(db, seeds, damping, limit);
194
- const lines = reranked.map(r => {
195
- const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
196
- const tag = r.boostedByNeighbors ? ' [PPR-boosted]' : '';
197
- return `[${r.label}] ${r.name} ${loc} (score: ${r.score.toFixed(4)})${tag}`;
198
- });
199
- return text(lines.join('\n') + stalenessNote);
200
- }
201
- const lines = results.map(r => {
202
- const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
203
- return `[${r.label ?? '?'}] ${r.name ?? r.id} ${loc} (score: ${r.score.toFixed(4)})`;
204
- });
205
- return text(lines.join('\n') + stalenessNote);
206
- }
207
- const results = ftsSearch(db, query, rerank ? limit * 2 : limit, label);
208
- if (results.length === 0)
209
- return text('No results found.' + zeroResultHint + stalenessNote);
210
- if (rerank) {
211
- const seeds = results.map(r => ({
212
- id: r.id, name: r.name, label: r.label,
213
- filePath: r.filePath ?? '', startLine: r.startLine ?? null,
214
- score: Math.abs(r.rank),
215
- }));
216
- const reranked = applyPprRerank(db, seeds, damping, limit);
217
- const lines = reranked.map(r => {
218
- const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
219
- const tag = r.boostedByNeighbors ? ' [PPR-boosted]' : '';
220
- return `[${r.label}] ${r.name} ${loc} (score: ${r.score.toFixed(3)})${tag}`;
221
- });
222
- return text(lines.join('\n') + stalenessNote);
223
- }
224
- const lines = results.map(r => {
225
- const loc = r.filePath ? (r.startLine != null ? `${r.filePath}:${r.startLine}` : r.filePath) : '';
226
- return `[${r.label}] ${r.name} ${loc} (score: ${r.rank.toFixed(3)})`;
227
- });
228
- return text(lines.join('\n') + stalenessNote);
229
- }
230
- finally {
231
- closeDb(db);
232
- }
233
- },
234
- };
235
- // ── monograph_stats ───────────────────────────────────────────────────────────
236
- const monographStatsTool = {
237
- name: 'monograph_stats',
238
- description: 'Show node/edge/community counts and index freshness.',
239
- inputSchema: { type: 'object', properties: {} },
240
- handler: async () => {
241
- const dbPath = getDbPath();
242
- if (!_isValidDb(dbPath))
243
- return text('Monograph index not built yet. Run monograph_build first.');
244
- const { openDb, closeDb, countNodes, countEdges } = await import('@monoes/monograph');
245
- const db = openDb(dbPath);
246
- try {
247
- const nodes = countNodes(db);
248
- const edges = countEdges(db);
249
- const meta = db.prepare('SELECT key, value FROM index_meta').all();
250
- const metaStr = meta.map(m => ` ${m.key}: ${m.value}`).join('\n');
251
- return text(`Monograph index stats:\n nodes: ${nodes}\n edges: ${edges}\n${metaStr}`);
252
- }
253
- finally {
254
- closeDb(db);
255
- }
256
- },
257
- };
258
- // ── monograph_health ──────────────────────────────────────────────────────────
259
- const monographHealthTool = {
260
- name: 'monograph_health',
261
- description: 'Check index staleness: compares last indexed git commit vs current HEAD.',
262
- inputSchema: { type: 'object', properties: {} },
263
- handler: async () => {
264
- const { openDb, closeDb } = await import('@monoes/monograph');
265
- const { execSync } = await import('child_process');
266
- const db = openDb(getDbPath());
267
- try {
268
- // The orchestrator writes the key as 'last_commit_hash' (orchestrator.ts:68).
269
- // Fall back to legacy 'lastCommit' for indexes built with older versions.
270
- const meta = db.prepare("SELECT value FROM index_meta WHERE key = 'last_commit_hash'").get() ?? db.prepare("SELECT value FROM index_meta WHERE key = 'lastCommit'").get();
271
- const lastCommit = meta?.value ?? null;
272
- if (!lastCommit) {
273
- // last_commit_hash can be missing even when the index is populated
274
- // (e.g. git rev-parse failed during build). Check actual data before
275
- // claiming "never built".
276
- const nodeCount = db.prepare('SELECT COUNT(*) AS c FROM nodes').get().c;
277
- if (nodeCount > 0) {
278
- const indexedAt = db.prepare("SELECT value FROM index_meta WHERE key = 'indexed_at'").get()?.value;
279
- return text(`Index is built (${nodeCount} nodes${indexedAt ? `, indexed at ${indexedAt}` : ''}) but no commit hash was recorded — staleness tracking unavailable.\n` +
280
- 'Run monograph_build to fix commit tracking.');
281
- }
282
- return text('Index has never been built. Run monograph_build first.');
283
- }
284
- if (!/^[0-9a-f]{7,40}$/i.test(lastCommit)) {
285
- return text('Index metadata is corrupt: invalid commit SHA. Run monograph_build to re-index.');
286
- }
287
- let commitsBehind = 0;
288
- try {
289
- const out = execSync(`git rev-list --count ${lastCommit}..HEAD`, {
290
- cwd: getProjectCwd(), encoding: 'utf-8'
291
- }).trim();
292
- commitsBehind = parseInt(out, 10);
293
- }
294
- catch {
295
- return text('Cannot check staleness: git error');
296
- }
297
- const status = commitsBehind === 0 ? 'FRESH' : `STALE (${commitsBehind} commits behind)`;
298
- return text(`Index status: ${status}\nLast indexed commit: ${lastCommit}`);
299
- }
300
- finally {
301
- closeDb(db);
302
- }
303
- },
304
- };
305
- // ── monograph_god_nodes ───────────────────────────────────────────────────────
306
- const monographGodNodesTool = {
307
- name: 'monograph_god_nodes',
308
- description: 'Return the top-N most connected real code entities (excludes File/Folder/Community nodes).',
309
- inputSchema: {
310
- type: 'object',
311
- properties: { limit: { type: 'number', description: 'Max nodes to return (default 20)' } },
312
- },
313
- handler: async (input) => {
314
- const dbPath = getDbPath();
315
- if (!_isValidDb(dbPath))
316
- return text('Monograph index not built yet. Run monograph_build first.');
317
- const { openDb, closeDb } = await import('@monoes/monograph');
318
- const db = openDb(dbPath);
319
- try {
320
- // Cap limit: passed directly to the SQL LIMIT clause.
321
- const MAX_GOD_NODES_LIMIT = 1_000;
322
- const rawGodLimit = input.limit ?? 20;
323
- const limit = Number.isFinite(rawGodLimit) && rawGodLimit > 0
324
- ? Math.min(Math.floor(rawGodLimit), MAX_GOD_NODES_LIMIT)
325
- : 20;
326
- const excluded = ['File', 'Folder', 'Community', 'Concept'];
327
- const rows = db.prepare(`
328
- SELECT n.id, n.label, n.name, n.file_path, n.start_line,
329
- COUNT(DISTINCT e1.id) + COUNT(DISTINCT e2.id) AS degree,
330
- COUNT(DISTINCT e2.id) AS in_degree,
331
- COUNT(DISTINCT e1.id) AS out_degree
332
- FROM nodes n
333
- LEFT JOIN edges e1 ON e1.source_id = n.id
334
- LEFT JOIN edges e2 ON e2.target_id = n.id
335
- WHERE n.label NOT IN (${excluded.map(() => '?').join(',')})
336
- GROUP BY n.id HAVING degree > 0
337
- ORDER BY degree DESC LIMIT ?
338
- `).all(...excluded, limit);
339
- if (rows.length === 0)
340
- return text('No god nodes found. Run monograph_build first.');
341
- const lines = rows.map(r => {
342
- const loc = r.file_path ? (r.start_line != null ? `${r.file_path}:${r.start_line}` : r.file_path) : '';
343
- return `[${r.label}] ${r.name} degree=${r.degree} (↑${r.out_degree} ↓${r.in_degree}) ${loc}`;
344
- });
345
- return text(lines.join('\n'));
346
- }
347
- finally {
348
- closeDb(db);
349
- }
350
- },
351
- };
352
- // ── monograph_get_node ────────────────────────────────────────────────────────
353
- const monographGetNodeTool = {
354
- name: 'monograph_get_node',
355
- description: 'Get a specific node by exact ID or name.',
356
- inputSchema: {
357
- type: 'object',
358
- properties: {
359
- id: { type: 'string', description: 'Node ID or name to look up' },
360
- },
361
- required: ['id'],
362
- },
363
- handler: async (input) => {
364
- const { openDb, closeDb, getNode } = await import('@monoes/monograph');
365
- const db = openDb(getDbPath());
366
- try {
367
- let node = getNode(db, input.id);
368
- if (!node) {
369
- const row = db.prepare('SELECT * FROM nodes WHERE name = ? LIMIT 1').get(input.id);
370
- if (row)
371
- node = row;
372
- }
373
- if (!node)
374
- return text(`Node not found: ${input.id}`);
375
- return text(JSON.stringify(node, null, 2));
376
- }
377
- finally {
378
- closeDb(db);
379
- }
380
- },
381
- };
382
- // ── monograph_shortest_path ───────────────────────────────────────────────────
383
- const monographShortestPathTool = {
384
- name: 'monograph_shortest_path',
385
- description: 'Find the shortest path between two nodes in the dependency graph.',
386
- inputSchema: {
387
- type: 'object',
388
- properties: {
389
- source: { type: 'string', description: 'Source node ID or name' },
390
- target: { type: 'string', description: 'Target node ID or name' },
391
- maxDepth: { type: 'number', description: 'Max path depth (default 6)' },
392
- },
393
- required: ['source', 'target'],
394
- },
395
- handler: async (input) => {
396
- const { openDb, closeDb, getShortestPath } = await import('@monoes/monograph');
397
- const db = openDb(getDbPath());
398
- try {
399
- const path = getShortestPath(db, input.source, input.target, input.maxDepth ?? 6);
400
- if (!path)
401
- return text(`No path found between ${input.source} and ${input.target}`);
402
- // Enrich each node ID with file:line for direct LLM navigation
403
- const enriched = path.map(nodeId => {
404
- const row = db.prepare('SELECT label, name, file_path, start_line FROM nodes WHERE id = ? OR name = ? LIMIT 1').get(nodeId, nodeId);
405
- if (!row)
406
- return nodeId;
407
- const loc = row.file_path ? (row.start_line != null ? `${row.file_path}:${row.start_line}` : row.file_path) : '';
408
- return loc ? `${row.name ?? nodeId} [${loc}]` : (row.name ?? nodeId);
409
- });
410
- return text(`Path (${path.length - 1} hops):\n${enriched.join(' → ')}`);
411
- }
412
- finally {
413
- closeDb(db);
414
- }
415
- },
416
- };
417
- // ── monograph_community ───────────────────────────────────────────────────────
418
- const monographCommunityTool = {
419
- name: 'monograph_community',
420
- description: 'Get all nodes belonging to a community (by numeric community ID).',
421
- inputSchema: {
422
- type: 'object',
423
- properties: {
424
- id: { type: 'number', description: 'Community ID' },
425
- },
426
- required: ['id'],
427
- },
428
- handler: async (input) => {
429
- // Validate community ID — must be a finite integer. parseInt(NaN) or a float
430
- // would silently become 0 in SQLite (NaN → NULL → 0 coercion), which would
431
- // return all nodes in community 0 instead of an error.
432
- const rawId = typeof input.id === 'number' ? input.id : parseInt(String(input.id), 10);
433
- if (!Number.isFinite(rawId) || rawId !== Math.floor(rawId)) {
434
- return text(`Invalid community ID: ${input.id} (must be an integer)`);
435
- }
436
- const communityId = rawId;
437
- const { openDb, closeDb } = await import('@monoes/monograph');
438
- const db = openDb(getDbPath());
439
- try {
440
- const rows = db.prepare('SELECT id, label, name, file_path, start_line FROM nodes WHERE community_id = ?').all(communityId);
441
- if (rows.length === 0)
442
- return text(`No nodes in community ${communityId}`);
443
- return text(rows.map(r => {
444
- const loc = r.file_path ? (r.start_line != null ? `${r.file_path}:${r.start_line}` : r.file_path) : '';
445
- return `[${r.label}] ${r.name} ${loc}`;
446
- }).join('\n'));
447
- }
448
- finally {
449
- closeDb(db);
450
- }
451
- },
452
- };
453
- // ── monograph_surprises ───────────────────────────────────────────────────────
454
- const monographSurprisesTool = {
455
- name: 'monograph_surprises',
456
- description: 'Show unexpected cross-community or low-confidence edges ranked by surprise score.',
457
- inputSchema: {
458
- type: 'object',
459
- properties: { limit: { type: 'number', description: 'Max results (default 20)' } },
460
- },
461
- handler: async (input) => {
462
- const { openDb, closeDb } = await import('@monoes/monograph');
463
- const db = openDb(getDbPath());
464
- try {
465
- // Cap limit: passed directly to the SQL LIMIT clause.
466
- const MAX_SURPRISES_LIMIT = 1_000;
467
- const rawSurprisesLimit = input.limit ?? 20;
468
- const limit = Number.isFinite(rawSurprisesLimit) && rawSurprisesLimit > 0
469
- ? Math.min(Math.floor(rawSurprisesLimit), MAX_SURPRISES_LIMIT)
470
- : 20;
471
- const rows = db.prepare(`
472
- SELECT e.confidence, e.confidence_score, e.relation,
473
- n1.name as src_name, n1.file_path as src_file, n1.start_line as src_line,
474
- n2.name as tgt_name, n2.file_path as tgt_file, n2.start_line as tgt_line
475
- FROM edges e
476
- JOIN nodes n1 ON n1.id = e.source_id
477
- JOIN nodes n2 ON n2.id = e.target_id
478
- WHERE e.confidence != 'EXTRACTED'
479
- ORDER BY e.confidence_score ASC LIMIT ?
480
- `).all(limit);
481
- if (rows.length === 0)
482
- return text('No surprising connections found.');
483
- return text(rows.map(r => {
484
- const srcLoc = r.src_file ? (r.src_line != null ? `${r.src_file}:${r.src_line}` : r.src_file) : '';
485
- const tgtLoc = r.tgt_file ? (r.tgt_line != null ? `${r.tgt_file}:${r.tgt_line}` : r.tgt_file) : '';
486
- const locHint = srcLoc || tgtLoc ? ` [${srcLoc}${tgtLoc ? ` → ${tgtLoc}` : ''}]` : '';
487
- return `[${r.confidence}] ${r.src_name} --${r.relation}--> ${r.tgt_name} (score: ${r.confidence_score})${locHint}`;
488
- }).join('\n'));
489
- }
490
- finally {
491
- closeDb(db);
492
- }
493
- },
494
- };
495
- // ── monograph_suggest ─────────────────────────────────────────────────────────
496
- /**
497
- * BM25 ranks purely on literal keyword overlap, so a doc/concept node whose
498
- * prose happens to mention task-related words (e.g. a report mentioning
499
- * "retry" constants) can outrank the actual code symbol the task is really
500
- * about, which is conceptually related but lexically different (issue #38).
501
- * Prefer code-symbol hits (Function/Class/Method/...) over doc-type hits
502
- * (Document/Concept/Section/...) when there are any, falling back to the
503
- * full hit list so a genuinely doc-only task still gets results.
504
- */
505
- export function preferSymbolHits(hits, symbolLabels) {
506
- const symbolHits = hits.filter(h => symbolLabels.has(h.label));
507
- return symbolHits.length > 0 ? symbolHits : hits;
508
- }
509
- const monographSuggestTool = {
510
- name: 'monograph_suggest',
511
- description: 'Get graph-topology-derived questions to explore the codebase. Pass task= to score by task relevance via BM25/FTS5.',
512
- inputSchema: {
513
- type: 'object',
514
- properties: {
515
- task: { type: 'string', description: 'Optional task description for task-relevance scoring' },
516
- limit: { type: 'number', description: 'Max questions (default 10)' },
517
- checkStaleness: { type: 'boolean', description: 'Check index staleness first and trigger a background rebuild when the index is behind HEAD. Appends a _staleness annotation to the result. (default true — pass false to skip the git check)' },
518
- },
519
- },
520
- handler: async (input) => {
521
- // Health-aware mode (formerly monograph_suggest_auto): check staleness and
522
- // trigger a background rebuild if the index is behind HEAD. Defaults on
523
- // (opt-out, not opt-in) — a caller that never checked was exactly how a
524
- // stale graph kept serving results silently.
525
- let stalenessAnnotation = '';
526
- if (input.checkStaleness !== false) {
527
- const repoPath = getProjectCwd();
528
- const stalenessResult = await computeCommitsBehind(repoPath);
529
- const commitsBehind = stalenessResult?.commitsBehind ?? 0;
530
- const triggered = triggerBackgroundBuildIfNeeded(repoPath, commitsBehind, STALENESS_THRESHOLD + 1);
531
- const status = triggered ? 'building' : commitsBehind === 0 ? 'fresh' : 'stale';
532
- stalenessAnnotation = `\n_staleness: ${JSON.stringify({ commitsBehind, status, triggered })}`;
533
- }
534
- const dbPath = getDbPath();
535
- if (!_isValidDb(dbPath))
536
- return text('Monograph index not built yet. Run monograph_build first.' + stalenessAnnotation);
537
- const { openDb, closeDb } = await import('@monoes/monograph');
538
- const { hybridQuery } = await import('@monoes/monograph');
539
- const db = openDb(dbPath);
540
- try {
541
- // Cap limit and task: limit is passed directly to SQL LIMIT clause;
542
- // task is forwarded to hybridQuery (embedding path) or FTS.
543
- const MAX_SUGGEST_LIMIT = 1_000;
544
- const MAX_SUGGEST_TASK_LEN = 16 * 1024;
545
- const rawSuggestLimit = input.limit ?? 10;
546
- const limit = Number.isFinite(rawSuggestLimit) && rawSuggestLimit > 0
547
- ? Math.min(Math.floor(rawSuggestLimit), MAX_SUGGEST_LIMIT)
548
- : 10;
549
- const rawTask = input.task ?? '';
550
- const task = typeof rawTask === 'string' && rawTask.length > MAX_SUGGEST_TASK_LEN
551
- ? rawTask.slice(0, MAX_SUGGEST_TASK_LEN)
552
- : rawTask;
553
- // Format a suggestion row as a navigable string for LLM consumption.
554
- // Includes file:line references so the LLM can jump directly to the code.
555
- const formatSuggestion = (r) => {
556
- const srcLoc = r.src_file ? (r.src_line != null ? `${r.src_file}:${r.src_line}` : r.src_file) : '';
557
- const tgtLoc = r.tgt_file ? (r.tgt_line != null ? `${r.tgt_file}:${r.tgt_line}` : r.tgt_file) : '';
558
- const locHint = srcLoc ? ` [${srcLoc}${tgtLoc ? ` → ${tgtLoc}` : ''}]` : '';
559
- return `Why does ${r.src} ${r.relation.toLowerCase()} ${r.tgt}? (${r.confidence})${locHint}`;
560
- };
561
- // When a task is provided, use BM25/FTS5 (via hybridQuery) to find
562
- // relevant nodes and restrict the edge-level questions to them. This
563
- // used to be gated behind MONOGRAPH_EMBEDDINGS=true, but hybridQuery
564
- // is BM25-only now (the embeddings table stayed empty in practice —
565
- // see hybrid-query.ts) so the env var gated nothing and just left this
566
- // better-ranked path off unless a caller happened to know about it.
567
- let hitIds = [];
568
- if (task) {
569
- const hits = await hybridQuery(db, task, { limit: 20 });
570
- const { SYMBOL_NODE_LABELS } = await import('@monoes/monograph');
571
- const relevantHits = preferSymbolHits(hits, SYMBOL_NODE_LABELS);
572
- hitIds = [...new Set(relevantHits.map(h => h.id))];
573
- if (hitIds.length === 0) {
574
- return text('No suggestions for this task. Run monograph_build first or try a different query.' + stalenessAnnotation);
575
- }
576
- }
577
- const taskFilter = hitIds.length
578
- ? `AND (e.source_id IN (${hitIds.map(() => '?').join(',')}) OR e.target_id IN (${hitIds.map(() => '?').join(',')}))`
579
- : '';
580
- const rows = db.prepare(`
581
- SELECT e.relation, e.confidence, n1.name as src, n2.name as tgt,
582
- n1.file_path as src_file, n1.start_line as src_line,
583
- n2.file_path as tgt_file, n2.start_line as tgt_line
584
- FROM edges e
585
- JOIN nodes n1 ON n1.id = e.source_id
586
- JOIN nodes n2 ON n2.id = e.target_id
587
- WHERE e.confidence IN ('AMBIGUOUS', 'INFERRED')
588
- ${taskFilter}
589
- LIMIT 100
590
- `).all(...hitIds, ...hitIds);
591
- const questions = rows.map(formatSuggestion);
592
- const fallback = task ? 'No suggestions for this task. Run monograph_build first.' : 'No suggestions. Run monograph_build first.';
593
- return text((questions.slice(0, limit).join('\n') || fallback) + stalenessAnnotation);
594
- }
595
- finally {
596
- closeDb(db);
597
- }
598
- },
599
- };
600
- // ── monograph_visualize ───────────────────────────────────────────────────────
601
- // Columns needed to render/export the graph — deliberately excludes `embedding`,
602
- // which can be several KB per node (384D vectors) and would otherwise bloat
603
- // tool-result payloads and written files by many MB.
604
- const NODE_RENDER_COLUMNS = 'id, label, name, norm_label, file_path, start_line, end_line, community_id, is_exported, language, properties';
605
- const monographVisualizeTool = {
606
- name: 'monograph_visualize',
607
- description: 'Render the knowledge graph as HTML (default), SVG, or JSON. Writes output to a file under .monomind/visualize/ and returns the file path (output can be multi-MB at the max node count, too large to return inline).',
608
- inputSchema: {
609
- type: 'object',
610
- properties: {
611
- format: { type: 'string', description: 'Output format: html, svg, json (default: html)' },
612
- maxNodes: { type: 'number', description: 'Max nodes to include (default 500)' },
613
- },
614
- },
615
- handler: async (input) => {
616
- const { openDb, closeDb, toJson, toHtml, toSvg } = await import('@monoes/monograph');
617
- const { writeFileSync, mkdirSync } = await import('fs');
618
- const db = openDb(getDbPath());
619
- try {
620
- // Cap maxNodes: passed to SQL LIMIT clause for both nodes (n) and edges
621
- // (n*3). Without a cap an attacker requests all rows from both tables.
622
- const MAX_EXPORT_NODES = 10_000;
623
- const rawMaxNodes = input.maxNodes ?? 500;
624
- const limit = Number.isFinite(rawMaxNodes) && rawMaxNodes > 0
625
- ? Math.min(Math.floor(rawMaxNodes), MAX_EXPORT_NODES)
626
- : 500;
627
- const nodes = db.prepare(`SELECT ${NODE_RENDER_COLUMNS} FROM nodes LIMIT ?`).all(limit);
628
- // Only include edges where both endpoints are in the visible node set
629
- const edges = db.prepare(`
630
- SELECT e.* FROM edges e
631
- WHERE e.source_id IN (SELECT id FROM nodes LIMIT ?)
632
- AND e.target_id IN (SELECT id FROM nodes LIMIT ?)
633
- LIMIT ?
634
- `).all(limit, limit, limit * 3);
635
- const fmt = input.format ?? 'html';
636
- const rendered = fmt === 'json' ? toJson(nodes, edges)
637
- : fmt === 'svg' ? toSvg(nodes, edges)
638
- : toHtml(nodes, edges);
639
- const ext = fmt === 'json' ? 'json' : fmt === 'svg' ? 'svg' : 'html';
640
- const outDir = resolve(join(getProjectCwd(), '.monomind', 'visualize'));
641
- mkdirSync(outDir, { recursive: true });
642
- const outPath = join(outDir, `graph-${Date.now()}.${ext}`);
643
- writeFileSync(outPath, rendered);
644
- return text(`Visualization written to ${outPath} (${nodes.length} nodes, ${edges.length} edges)${ext === 'html' ? '\nNote: HTML uses the vis-network CDN script and requires network access to render.' : ''}`);
645
- }
646
- finally {
647
- closeDb(db);
648
- }
649
- },
650
- };
651
- // ── monograph_watch ───────────────────────────────────────────────────────────
652
- const monographWatchTool = {
653
- name: 'monograph_watch',
654
- description: 'Start incremental file watcher. Rebuilds index on file changes (3s debounce).',
655
- inputSchema: {
656
- type: 'object',
657
- properties: {
658
- path: { type: 'string', description: 'Repo path (defaults to project cwd)' },
659
- },
660
- },
661
- handler: async (input) => {
662
- const { MonographWatcher } = await import('@monoes/monograph');
663
- const repoPath = input.path ?? getProjectCwd();
664
- if (_activeWatchers.has(repoPath)) {
665
- return text(`Monograph watcher already running for ${repoPath}.`);
666
- }
667
- const watcher = new MonographWatcher(repoPath);
668
- watcher.on('monograph:updated', (_paths) => {
669
- import('@monoes/monograph').then(({ buildAsync }) => buildAsync(repoPath)).catch((e) => {
670
- if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
671
- console.error('[monograph_watch] background rebuild failed:', e);
672
- });
673
- });
674
- await watcher.start();
675
- _activeWatchers.set(repoPath, watcher);
676
- return text(`Monograph watcher started for ${repoPath}. Watching for file changes...`);
677
- },
678
- };
679
- // ── monograph_watch_stop ──────────────────────────────────────────────────────
680
- const monographWatchStopTool = {
681
- name: 'monograph_watch_stop',
682
- description: 'Stop the Monograph file watcher.',
683
- inputSchema: {
684
- type: 'object',
685
- properties: {
686
- path: { type: 'string', description: 'Repo path whose watcher to stop (defaults to project cwd)' },
687
- },
688
- },
689
- handler: async (input) => {
690
- const repoPath = input.path ?? getProjectCwd();
691
- const watcher = _activeWatchers.get(repoPath);
692
- if (!watcher) {
693
- return text(`No active watcher found for ${repoPath}.`);
694
- }
695
- await watcher.stop();
696
- _activeWatchers.delete(repoPath);
697
- return text(`Monograph watcher stopped for ${repoPath}.`);
698
- },
699
- };
700
- // ── monograph_report ──────────────────────────────────────────────────────────
701
- const monographReportTool = {
702
- name: 'monograph_report',
703
- description: 'Generate a GRAPH_REPORT.md summarizing the codebase knowledge graph.',
704
- inputSchema: {
705
- type: 'object',
706
- properties: {
707
- path: { type: 'string', description: 'Output path (default: .monomind/GRAPH_REPORT.md)' },
708
- },
709
- },
710
- handler: async (input) => {
711
- const { openDb, closeDb, countNodes, countEdges } = await import('@monoes/monograph');
712
- const { writeFileSync, mkdirSync } = await import('fs');
713
- const db = openDb(getDbPath());
714
- try {
715
- const nodeCount = countNodes(db);
716
- const edgeCount = countEdges(db);
717
- const topNodes = db.prepare(`
718
- SELECT n.name, n.label, n.file_path, n.start_line,
719
- COUNT(DISTINCT e1.id) + COUNT(DISTINCT e2.id) AS degree
720
- FROM nodes n
721
- LEFT JOIN edges e1 ON e1.source_id = n.id
722
- LEFT JOIN edges e2 ON e2.target_id = n.id
723
- WHERE n.label NOT IN ('File','Folder','Community','Concept')
724
- GROUP BY n.id ORDER BY degree DESC LIMIT 10
725
- `).all();
726
- const report = [
727
- '# Graph Report\n',
728
- `**Generated:** ${new Date().toISOString()}`,
729
- `**Nodes:** ${nodeCount} **Edges:** ${edgeCount}\n`,
730
- '## Top 10 Most Connected Entities\n',
731
- ...topNodes.map((n, i) => {
732
- const loc = n.file_path ? (n.start_line != null ? `${n.file_path}:${n.start_line}` : n.file_path) : '';
733
- return `${i + 1}. **${n.name}** (${n.label}) — degree ${n.degree}${loc ? ` \`${loc}\`` : ''}`;
734
- }),
735
- ].join('\n');
736
- const rawOutPath = input.path ?? join(getProjectCwd(), '.monomind', 'GRAPH_REPORT.md');
737
- const outPath = resolve(getProjectCwd(), rawOutPath);
738
- const allowedRoot = resolve(getProjectCwd());
739
- if (outPath !== allowedRoot && !outPath.startsWith(allowedRoot + sep)) {
740
- return text(`Error: path must be within the project directory (${allowedRoot})`);
741
- }
742
- mkdirSync(join(outPath, '..'), { recursive: true });
743
- writeFileSync(outPath, report);
744
- return text(`${report}\n\nReport written to ${outPath}`);
745
- }
746
- finally {
747
- closeDb(db);
748
- }
749
- },
750
- };
751
- // ── Shared staleness helper ───────────────────────────────────────────────────
752
- /** Guard against concurrent background buildAsync calls on the same DB. */
753
- let _buildInProgress = false;
754
- /**
755
- * Compute how many commits the index is behind HEAD.
756
- * Returns { commitsBehind, lastCommit } — or null if the index has never been
757
- * built or git is unavailable.
758
- */
759
- async function computeCommitsBehind(repoPath) {
760
- const { openDb, closeDb } = await import('@monoes/monograph');
761
- const { execSync } = await import('child_process');
762
- const dbPath = getDbPath(repoPath);
763
- if (!_isValidDb(dbPath))
764
- return null;
765
- // openDb's fileMustExist option isn't in the currently-published
766
- // @monoes/monograph release this CLI depends on — _isValidDb above is the
767
- // real guard against openDb silently creating an empty DB at a missing path.
768
- const db = openDb(dbPath);
769
- try {
770
- const meta = db.prepare("SELECT value FROM index_meta WHERE key = 'last_commit_hash'").get() ?? db.prepare("SELECT value FROM index_meta WHERE key = 'lastCommit'").get();
771
- const lastCommit = meta?.value ?? null;
772
- if (!lastCommit || !/^[0-9a-f]{7,40}$/i.test(lastCommit))
773
- return null;
774
- try {
775
- const out = execSync(`git rev-list --count ${lastCommit}..HEAD`, {
776
- cwd: repoPath, encoding: 'utf-8',
777
- }).trim();
778
- return { commitsBehind: parseInt(out, 10), lastCommit };
779
- }
780
- catch {
781
- return null;
782
- }
783
- }
784
- finally {
785
- closeDb(db);
786
- }
787
- }
788
- /**
789
- * Shared staleness threshold: both monograph_staleness and monograph_suggest (checkStaleness)
790
- * trigger a background rebuild only when the index is more than this many commits behind HEAD.
791
- * Using a shared constant prevents conflicting rebuild pressure during active dev sessions.
792
- * Was 10 → 3 → 1. Even 3 let routine small commits accumulate stale results
793
- * silently. At 1 (rebuild triggers at 2+ behind), staleness rarely persists
794
- * across sessions.
795
- */
796
- const STALENESS_THRESHOLD = 1;
797
- /**
798
- * Fire-and-forget background rebuild. Uses a module-level guard so concurrent
799
- * MCP tool calls (e.g. repeated monograph_suggest checkStaleness) don't pile up builds.
800
- * threshold: minimum commitsBehind to trigger (default STALENESS_THRESHOLD + 1).
801
- */
802
- function triggerBackgroundBuildIfNeeded(repoPath, commitsBehind, threshold = STALENESS_THRESHOLD + 1) {
803
- if (commitsBehind < threshold)
804
- return false;
805
- if (_buildInProgress)
806
- return false;
807
- _buildInProgress = true;
808
- void import('@monoes/monograph')
809
- .then(({ buildAsync }) => buildAsync(repoPath, { codeOnly: true }))
810
- .catch((e) => {
811
- if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
812
- console.error('[triggerBackgroundBuildIfNeeded] staleness-triggered rebuild failed:', e);
813
- })
814
- .finally(() => { _buildInProgress = false; });
815
- return true;
816
- }
817
- // ── monograph_staleness ───────────────────────────────────────────────────────
818
- const monographStalenessTool = {
819
- name: 'monograph_staleness',
820
- description: 'Git staleness detection: compares the commit hash at last index build against current HEAD. When the index is more than 3 commits behind HEAD it automatically triggers a background rebuild. Returns { commitsBehind, status, triggered }.',
821
- inputSchema: {
822
- type: 'object',
823
- properties: {
824
- path: { type: 'string', description: 'Absolute path to the repo (defaults to project cwd)' },
825
- },
826
- },
827
- handler: async (input) => {
828
- const repoPath = input.path ?? getProjectCwd();
829
- const result = await computeCommitsBehind(repoPath);
830
- if (!result) {
831
- return text(JSON.stringify({ commitsBehind: 0, status: 'unknown', triggered: false }));
832
- }
833
- const { commitsBehind } = result;
834
- const triggered = triggerBackgroundBuildIfNeeded(repoPath, commitsBehind, STALENESS_THRESHOLD + 1);
835
- const status = triggered ? 'building' : commitsBehind === 0 ? 'fresh' : 'stale';
836
- return text(JSON.stringify({ commitsBehind, status, triggered }));
837
- },
838
- };
839
- // ── monograph_snapshot ────────────────────────────────────────────────────────
840
- const monographSnapshotTool = {
841
- name: 'monograph_snapshot',
842
- description: 'Save current graph state to a named JSON snapshot. Use with monograph_diff to compare before/after changes.',
843
- inputSchema: {
844
- type: 'object',
845
- properties: {
846
- name: { type: 'string', description: 'Snapshot name (default: ISO timestamp). Used as the filename.' },
847
- },
848
- },
849
- handler: async (input) => {
850
- const { openDb, closeDb, snapshotFromDb } = await import('@monoes/monograph');
851
- const { writeFileSync, mkdirSync } = await import('fs');
852
- const { resolve: resolvePath } = await import('path');
853
- const db = openDb(getDbPath());
854
- try {
855
- const snapshot = snapshotFromDb(db);
856
- const rawName = input.name ?? new Date().toISOString().replace(/[:.]/g, '-');
857
- const SAFE_NAME_RE = /^[a-zA-Z0-9_.\-]+$/;
858
- if (!SAFE_NAME_RE.test(rawName))
859
- return text(`Invalid snapshot name: ${rawName}`);
860
- const snapshotDir = resolvePath(join(getProjectCwd(), '.monomind', 'snapshots'));
861
- mkdirSync(snapshotDir, { recursive: true });
862
- const outPath = join(snapshotDir, `${rawName}.json`);
863
- if (!resolvePath(outPath).startsWith(snapshotDir))
864
- return text(`Path traversal detected in snapshot name`);
865
- writeFileSync(outPath, JSON.stringify(snapshot, null, 2));
866
- return text(`Snapshot saved: ${outPath}\n nodes: ${snapshot.nodes.length} edges: ${snapshot.edges.length}`);
867
- }
868
- finally {
869
- closeDb(db);
870
- }
871
- },
872
- };
873
- // ── monograph_diff ────────────────────────────────────────────────────────────
874
- const monographDiffTool = {
875
- name: 'monograph_diff',
876
- description: 'Compare two named graph snapshots (saved via monograph_snapshot). Omit "after" to diff the "before" snapshot against the live graph.',
877
- inputSchema: {
878
- type: 'object',
879
- properties: {
880
- before: { type: 'string', description: 'Name of the before snapshot (without .json extension)' },
881
- after: { type: 'string', description: 'Name of the after snapshot, or omit to compare against the live graph' },
882
- },
883
- required: ['before'],
884
- },
885
- handler: async (input) => {
886
- const { openDb, closeDb, snapshotFromDb, diffSnapshots } = await import('@monoes/monograph');
887
- const { readFileSync, existsSync, statSync: statSyncSnap } = await import('fs');
888
- const { resolve: resolvePath } = await import('path');
889
- const MAX_SNAPSHOT_BYTES = 100 * 1024 * 1024; // 100 MB
890
- const snapshotDir = resolvePath(join(getProjectCwd(), '.monomind', 'snapshots'));
891
- // Reject snapshot names containing path separators or traversal sequences
892
- const SAFE_SNAPSHOT_NAME = /^[a-zA-Z0-9_.\-]+$/;
893
- const beforeName = input.before;
894
- if (!SAFE_SNAPSHOT_NAME.test(beforeName))
895
- return text(`Invalid snapshot name: ${beforeName}`);
896
- const beforePath = join(snapshotDir, `${beforeName}.json`);
897
- if (!resolvePath(beforePath).startsWith(snapshotDir))
898
- return text(`Path traversal detected in snapshot name`);
899
- if (!existsSync(beforePath)) {
900
- return text(`Snapshot not found: ${beforePath}\nCreate one first with monograph_snapshot.`);
901
- }
902
- if (statSyncSnap(beforePath).size > MAX_SNAPSHOT_BYTES) {
903
- return text(`Snapshot too large to diff: ${beforePath}`);
904
- }
905
- const before = JSON.parse(readFileSync(beforePath, 'utf-8'));
906
- let after;
907
- if (input.after) {
908
- const afterName = input.after;
909
- if (!SAFE_SNAPSHOT_NAME.test(afterName))
910
- return text(`Invalid snapshot name: ${afterName}`);
911
- const afterPath = join(snapshotDir, `${afterName}.json`);
912
- if (!resolvePath(afterPath).startsWith(snapshotDir))
913
- return text(`Path traversal detected in snapshot name`);
914
- if (!existsSync(afterPath))
915
- return text(`Snapshot not found: ${afterPath}`);
916
- if (statSyncSnap(afterPath).size > MAX_SNAPSHOT_BYTES)
917
- return text(`Snapshot too large to diff: ${afterPath}`);
918
- after = JSON.parse(readFileSync(afterPath, 'utf-8'));
919
- }
920
- else {
921
- const db = openDb(getDbPath());
922
- try {
923
- after = snapshotFromDb(db);
924
- }
925
- finally {
926
- closeDb(db);
927
- }
928
- }
929
- const diff = diffSnapshots(before, after);
930
- const nodeById = new Map();
931
- const indexNodes = (nodes) => {
932
- for (const n of nodes) {
933
- if (n.id)
934
- nodeById.set(n.id, n);
935
- }
936
- };
937
- indexNodes(before.nodes);
938
- indexNodes(after.nodes);
939
- const resolveEdgeEnd = (id) => {
940
- const ref = nodeById.get(id);
941
- if (!ref)
942
- return id; // fallback to raw id if not found
943
- const loc = ref.filePath ? (ref.startLine != null ? `${ref.filePath}:${ref.startLine}` : ref.filePath) : '';
944
- return loc ? `${ref.name} [${loc}]` : ref.name;
945
- };
946
- const section = (label, items) => items.length > 0 ? `\n${label} (${items.length}):\n${items.slice(0, 10).join('\n')}${items.length > 10 ? `\n … ${items.length - 10} more` : ''}` : '';
947
- const formatNode = (n) => {
948
- const loc = n.filePath ? (n.startLine != null ? `${n.filePath}:${n.startLine}` : n.filePath) : '';
949
- return ` [${n.label ?? '?'}] ${n.name ?? '?'}${loc ? ` ${loc}` : ''}`;
950
- };
951
- const lines = [
952
- `Diff: ${diff.summary}`,
953
- section('New nodes', diff.newNodes.map(n => ` + ${formatNode(n)}`)),
954
- section('Removed nodes', diff.removedNodes.map(n => ` - ${formatNode(n)}`)),
955
- section('New edges', diff.newEdges.map(e => ` + ${resolveEdgeEnd(e.sourceId)} --[${e.relation}]--> ${resolveEdgeEnd(e.targetId)}`)),
956
- section('Removed edges', diff.removedEdges.map(e => ` - ${resolveEdgeEnd(e.sourceId)} --[${e.relation}]--> ${resolveEdgeEnd(e.targetId)}`)),
957
- ].join('');
958
- return text(lines);
959
- },
960
- };
961
- // ── monograph_export ──────────────────────────────────────────────────────────
962
- const monographExportTool = {
963
- name: 'monograph_export',
964
- description: 'Export the knowledge graph in various formats: obsidian, canvas, cypher, graphml, svg, json.',
965
- inputSchema: {
966
- type: 'object',
967
- properties: {
968
- format: { type: 'string', description: 'Format: obsidian, canvas, cypher, graphml, svg, json' },
969
- outputPath: { type: 'string', description: 'Output path' },
970
- },
971
- required: ['format'],
972
- },
973
- handler: async (input) => {
974
- const { openDb, closeDb, toJson, toSvg, toGraphml, toCypher, toObsidian, toCanvas } = await import('@monoes/monograph');
975
- const { writeFileSync, mkdirSync } = await import('fs');
976
- const db = openDb(getDbPath());
977
- try {
978
- // Exclude `embedding` — a several-KB-per-node vector column that would
979
- // otherwise bloat exported files by many MB for no rendering benefit.
980
- const nodes = db.prepare(`SELECT ${NODE_RENDER_COLUMNS} FROM nodes`).all();
981
- const edges = db.prepare('SELECT * FROM edges').all();
982
- const fmt = input.format;
983
- const requestedOut = input.outputPath ?? join(getProjectCwd(), '.monomind', 'export');
984
- const outDir = resolve(getProjectCwd(), requestedOut);
985
- const allowedRoot = resolve(getProjectCwd());
986
- if (outDir !== allowedRoot && !outDir.startsWith(allowedRoot + sep)) {
987
- return text(`Error: outputPath must be within the project directory (${allowedRoot})`);
988
- }
989
- mkdirSync(outDir, { recursive: true });
990
- if (fmt === 'json') {
991
- const p = join(outDir, 'graph.json');
992
- writeFileSync(p, toJson(nodes, edges));
993
- return text(`Exported JSON to ${p}`);
994
- }
995
- if (fmt === 'svg') {
996
- const p = join(outDir, 'graph.svg');
997
- writeFileSync(p, toSvg(nodes, edges));
998
- return text(`Exported SVG to ${p}`);
999
- }
1000
- if (fmt === 'graphml') {
1001
- const p = join(outDir, 'graph.graphml');
1002
- writeFileSync(p, toGraphml(nodes, edges));
1003
- return text(`Exported GraphML to ${p}`);
1004
- }
1005
- if (fmt === 'cypher') {
1006
- const p = join(outDir, 'graph.cypher');
1007
- writeFileSync(p, toCypher(nodes, edges));
1008
- return text(`Exported Cypher to ${p}`);
1009
- }
1010
- if (fmt === 'obsidian') {
1011
- toObsidian(nodes, edges, outDir);
1012
- return text(`Exported Obsidian vault to ${outDir}`);
1013
- }
1014
- if (fmt === 'canvas') {
1015
- const p = join(outDir, 'graph.canvas');
1016
- writeFileSync(p, toCanvas(nodes, edges));
1017
- return text(`Exported Canvas to ${p}`);
1018
- }
1019
- return text(`Format ${fmt} export written to ${outDir}`);
1020
- }
1021
- finally {
1022
- closeDb(db);
1023
- }
1024
- },
1025
- };
1026
- // ── monograph_context ─────────────────────────────────────────────────────────
1027
- const monographContextTool = {
1028
- name: 'monograph_context',
1029
- description: '360° symbol view: callers, callees, imports, importedBy, community, and containing processes for a symbol.',
1030
- inputSchema: {
1031
- type: 'object',
1032
- properties: {
1033
- name: { type: 'string', description: 'Symbol name to look up' },
1034
- filePath: { type: 'string', description: 'Optional file path to disambiguate' },
1035
- },
1036
- required: ['name'],
1037
- },
1038
- handler: async (input) => {
1039
- const { openDb, closeDb } = await import('@monoes/monograph');
1040
- const { getMonographContext } = await import('@monoes/monograph');
1041
- const db = openDb(getDbPath());
1042
- try {
1043
- // Cap name and filePath: forwarded to parameterized SQL via getMonographContext.
1044
- // Very long strings waste memory before the query even executes.
1045
- const MAX_CTX_NAME_LEN = 512;
1046
- const MAX_CTX_PATH_LEN = 4 * 1024;
1047
- const rawCtxName = input.name;
1048
- const ctxName = typeof rawCtxName === 'string' && rawCtxName.length > MAX_CTX_NAME_LEN
1049
- ? rawCtxName.slice(0, MAX_CTX_NAME_LEN) : rawCtxName;
1050
- const rawCtxPath = input.filePath;
1051
- const ctxPath = typeof rawCtxPath === 'string' && rawCtxPath.length > MAX_CTX_PATH_LEN
1052
- ? rawCtxPath.slice(0, MAX_CTX_PATH_LEN) : rawCtxPath;
1053
- const result = getMonographContext(db, {
1054
- name: ctxName,
1055
- filePath: ctxPath,
1056
- });
1057
- if (!result || !result.node)
1058
- return text(`No symbol found: ${ctxName}`);
1059
- // Format context as structured text for direct LLM consumption
1060
- const n = result.node;
1061
- const loc = n.filePath ? (n.startLine != null ? `${n.filePath}:${n.startLine}` : n.filePath) : '';
1062
- const lines = [
1063
- `[${n.label ?? '?'}] ${n.name} ${loc}`,
1064
- '',
1065
- ];
1066
- const formatNodes = (nodes, label) => {
1067
- if (!Array.isArray(nodes) || nodes.length === 0)
1068
- return;
1069
- lines.push(`${label} (${nodes.length}):`);
1070
- for (const node of nodes.slice(0, 20)) {
1071
- const fp = node.filePath ?? node.file_path ?? '';
1072
- const ln = node.startLine ?? node.start_line;
1073
- const nodeLoc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
1074
- lines.push(` [${node.label ?? '?'}] ${node.name ?? node.id} ${nodeLoc}`);
1075
- }
1076
- if (nodes.length > 20)
1077
- lines.push(` … ${nodes.length - 20} more`);
1078
- lines.push('');
1079
- };
1080
- formatNodes(result.callers, 'Callers');
1081
- formatNodes(result.callees, 'Callees');
1082
- formatNodes(result.imports, 'Imports');
1083
- formatNodes(result.importedBy, 'ImportedBy');
1084
- if (result.community != null)
1085
- lines.push(`Community: ${result.community}`);
1086
- if (result.communityName)
1087
- lines.push(`Community name: ${result.communityName}`);
1088
- return text(lines.join('\n').trim());
1089
- }
1090
- finally {
1091
- closeDb(db);
1092
- }
1093
- },
1094
- };
1095
- // ── monograph_impact ──────────────────────────────────────────────────────────
1096
- const monographImpactTool = {
1097
- name: 'monograph_impact',
1098
- description: 'Blast radius analysis: finds all direct and transitive callers of a symbol and computes a risk score.',
1099
- inputSchema: {
1100
- type: 'object',
1101
- properties: {
1102
- name: { type: 'string', description: 'Symbol name to analyze' },
1103
- filePath: { type: 'string', description: 'Optional file path to disambiguate' },
1104
- depth: { type: 'number', description: 'Max BFS depth (default 3, max 6)' },
1105
- },
1106
- required: ['name'],
1107
- },
1108
- handler: async (input) => {
1109
- const { openDb, closeDb } = await import('@monoes/monograph');
1110
- const { getMonographImpact } = await import('@monoes/monograph');
1111
- const db = openDb(getDbPath());
1112
- try {
1113
- // Cap name/filePath; enforce depth ≤ 6 as documented in the schema description.
1114
- const MAX_IMPACT_NAME_LEN = 512;
1115
- const MAX_IMPACT_PATH_LEN = 4 * 1024;
1116
- const rawImpactName = input.name;
1117
- const impactName = typeof rawImpactName === 'string' && rawImpactName.length > MAX_IMPACT_NAME_LEN
1118
- ? rawImpactName.slice(0, MAX_IMPACT_NAME_LEN) : rawImpactName;
1119
- const rawImpactPath = input.filePath;
1120
- const impactPath = typeof rawImpactPath === 'string' && rawImpactPath.length > MAX_IMPACT_PATH_LEN
1121
- ? rawImpactPath.slice(0, MAX_IMPACT_PATH_LEN) : rawImpactPath;
1122
- const rawDepth = input.depth;
1123
- const depth = rawDepth === undefined
1124
- ? undefined
1125
- : (typeof rawDepth === 'number' && Number.isFinite(rawDepth) && rawDepth > 0
1126
- ? Math.min(Math.floor(rawDepth), 6) : 3);
1127
- const result = getMonographImpact(db, {
1128
- name: impactName,
1129
- filePath: impactPath,
1130
- depth,
1131
- });
1132
- if (!result || !result.node)
1133
- return text(`No symbol found: ${impactName}`);
1134
- // Format impact as structured text for direct LLM consumption
1135
- const root = result.node;
1136
- const rootLoc = root.filePath ? (root.startLine != null ? `${root.filePath}:${root.startLine}` : root.filePath) : '';
1137
- const lines = [
1138
- `[${root.label ?? '?'}] ${root.name} ${rootLoc}`,
1139
- '',
1140
- `Blast radius: ${result.affectedFiles?.length ?? 0} symbols affected`,
1141
- ];
1142
- if (result.riskScore != null) {
1143
- const riskLabel = result.riskScore >= 0.8 ? 'HIGH' : result.riskScore >= 0.5 ? 'MEDIUM' : 'LOW';
1144
- lines.push(`Risk score: ${result.riskScore.toFixed(2)} (${riskLabel})`);
1145
- }
1146
- lines.push('');
1147
- const affected = [
1148
- ...(result.directCallers ?? []),
1149
- ...(result.transitiveCallers ?? []).flatMap(t => t.nodes ?? []),
1150
- ];
1151
- if (affected.length > 0) {
1152
- lines.push(`Affected callers (${affected.length}):`);
1153
- for (const sym of affected.slice(0, 20)) {
1154
- const fp = sym.filePath ?? sym.file_path ?? '';
1155
- const ln = sym.startLine ?? sym.start_line;
1156
- const symLoc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
1157
- const depth_marker = sym.depth != null ? ` [depth ${sym.depth}]` : '';
1158
- lines.push(` [${sym.label ?? '?'}] ${sym.name ?? sym.id} ${symLoc}${depth_marker}`);
1159
- }
1160
- if (affected.length > 20)
1161
- lines.push(` … ${affected.length - 20} more`);
1162
- }
1163
- return text(lines.join('\n').trim());
1164
- }
1165
- finally {
1166
- closeDb(db);
1167
- }
1168
- },
1169
- };
1170
- // ── monograph_detect_changes ──────────────────────────────────────────────────
1171
- const monographDetectChangesTool = {
1172
- name: 'monograph_detect_changes',
1173
- description: 'Git diff → affected symbols: identifies which indexed symbols live in files changed since the base branch.',
1174
- inputSchema: {
1175
- type: 'object',
1176
- properties: {
1177
- baseBranch: { type: 'string', description: 'Base branch to diff against (default: main)' },
1178
- includeTests: { type: 'boolean', description: 'Include test files (default: true)' },
1179
- },
1180
- },
1181
- handler: async (input) => {
1182
- const { openDb, closeDb } = await import('@monoes/monograph');
1183
- const { detectMonographChanges } = await import('@monoes/monograph');
1184
- const db = openDb(getDbPath());
1185
- try {
1186
- const result = detectMonographChanges(db, {
1187
- baseBranch: input.baseBranch,
1188
- includeTests: input.includeTests,
1189
- }, getProjectCwd());
1190
- // Format as structured text for direct LLM navigation instead of raw JSON
1191
- const r = result;
1192
- if (!r || (!r.changedFiles?.length && !r.affectedSymbols?.length)) {
1193
- return text('No changed files found relative to the base branch.');
1194
- }
1195
- const lines = [];
1196
- const base = r.baseBranch ?? 'main';
1197
- const changedFiles = r.changedFiles ?? [];
1198
- lines.push(`Changed files vs ${base}: ${changedFiles.length}`);
1199
- if (changedFiles.length > 0) {
1200
- for (const f of changedFiles.slice(0, 20))
1201
- lines.push(` ${f}`);
1202
- if (changedFiles.length > 20)
1203
- lines.push(` … ${changedFiles.length - 20} more`);
1204
- }
1205
- lines.push('');
1206
- const affected = r.affectedSymbols ?? r.affected ?? [];
1207
- if (affected.length > 0) {
1208
- lines.push(`Affected symbols (${affected.length}):`);
1209
- for (const sym of affected.slice(0, 30)) {
1210
- const fp = sym.filePath ?? sym.file_path ?? '';
1211
- const ln = sym.startLine ?? sym.start_line;
1212
- const loc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
1213
- lines.push(` [${sym.label ?? '?'}] ${sym.name ?? sym.id} ${loc}`);
1214
- }
1215
- if (affected.length > 30)
1216
- lines.push(` … ${affected.length - 30} more`);
1217
- }
1218
- return text(lines.join('\n').trim());
1219
- }
1220
- finally {
1221
- closeDb(db);
1222
- }
1223
- },
1224
- };
1225
- // ── monograph_rename ──────────────────────────────────────────────────────────
1226
- const monographRenameTool = {
1227
- name: 'monograph_rename',
1228
- description: 'Dry-run multi-file rename: finds all references to a symbol and shows before/after diffs without writing files.',
1229
- inputSchema: {
1230
- type: 'object',
1231
- properties: {
1232
- oldName: { type: 'string', description: 'Current symbol name' },
1233
- newName: { type: 'string', description: 'New symbol name' },
1234
- filePath: { type: 'string', description: 'Optional file path to disambiguate the symbol' },
1235
- dryRun: { type: 'boolean', description: 'Always true — files are never modified (default: true)' },
1236
- },
1237
- required: ['oldName', 'newName'],
1238
- },
1239
- handler: async (input) => {
1240
- const { openDb, closeDb } = await import('@monoes/monograph');
1241
- const { getMonographRename } = await import('@monoes/monograph');
1242
- const db = openDb(getDbPath());
1243
- try {
1244
- const result = getMonographRename(db, {
1245
- oldName: input.oldName,
1246
- newName: input.newName,
1247
- filePath: input.filePath,
1248
- dryRun: input.dryRun ?? true,
1249
- });
1250
- // Format as structured text for direct LLM navigation instead of raw JSON
1251
- const rn = result;
1252
- if (!rn)
1253
- return text(`Symbol not found: ${input.oldName}`);
1254
- const occurrences = rn.occurrences ?? rn.references ?? [];
1255
- const lines = [
1256
- `Rename: ${input.oldName} → ${input.newName} (dry-run)`,
1257
- `Occurrences: ${occurrences.length}`,
1258
- '',
1259
- ];
1260
- for (const occ of occurrences.slice(0, 30)) {
1261
- const fp = occ.filePath ?? occ.file_path ?? '';
1262
- const ln = occ.line ?? occ.startLine ?? occ.start_line;
1263
- const loc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
1264
- lines.push(` ${loc || occ}`);
1265
- }
1266
- if (occurrences.length > 30)
1267
- lines.push(` … ${occurrences.length - 30} more`);
1268
- return text(lines.join('\n').trim());
1269
- }
1270
- finally {
1271
- closeDb(db);
1272
- }
1273
- },
1274
- };
1275
- // ── monograph_route_map ───────────────────────────────────────────────────────
1276
- const monographRouteMapTool = {
1277
- name: 'monograph_route_map',
1278
- description: 'List all HTTP routes in the codebase with their handler info. Supports filtering by URL prefix or HTTP method.',
1279
- inputSchema: {
1280
- type: 'object',
1281
- properties: {
1282
- prefix: { type: 'string', description: 'Filter routes whose path contains this prefix (e.g. /api)' },
1283
- method: { type: 'string', description: 'Filter by HTTP method: GET, POST, PUT, DELETE, PATCH, ANY' },
1284
- includeMiddleware: { type: 'boolean', description: 'Include middleware/use routes (default: false)' },
1285
- },
1286
- },
1287
- handler: async (input) => {
1288
- const { openDb, closeDb } = await import('@monoes/monograph');
1289
- const { getMonographRouteMap } = await import('@monoes/monograph');
1290
- const db = openDb(getDbPath());
1291
- try {
1292
- const result = getMonographRouteMap(db, {
1293
- prefix: input.prefix,
1294
- method: input.method,
1295
- includeMiddleware: input.includeMiddleware,
1296
- });
1297
- if (result.routes.length === 0)
1298
- return text('No routes found. Run monograph_build first or adjust your filters.');
1299
- const lines = [`Routes (${result.total} total):`];
1300
- for (const r of result.routes) {
1301
- const loc = r.handlerFile
1302
- ? (r.handlerLine != null ? `${r.handlerFile}:${r.handlerLine}` : r.handlerFile)
1303
- : '';
1304
- const mw = r.middlewareChain.length > 0 ? ` middleware: ${r.middlewareChain.join(' → ')}` : '';
1305
- lines.push(` ${r.method} ${r.path}${r.handlerName ? ` → ${r.handlerName}` : ''}${loc ? ` (${loc})` : ''}${mw}`);
1306
- }
1307
- return text(lines.join('\n'));
1308
- }
1309
- finally {
1310
- closeDb(db);
1311
- }
1312
- },
1313
- };
1314
- // ── monograph_api_impact ──────────────────────────────────────────────────────
1315
- const monographApiImpactTool = {
1316
- name: 'monograph_api_impact',
1317
- description: 'Analyze the blast radius of an API route: finds the handler, performs forward BFS through CALLS edges, and computes a risk score.',
1318
- inputSchema: {
1319
- type: 'object',
1320
- properties: {
1321
- routePath: { type: 'string', description: 'Route path to analyze (e.g. /api/users)' },
1322
- method: { type: 'string', description: 'Optional HTTP method filter: GET, POST, etc.' },
1323
- },
1324
- required: ['routePath'],
1325
- },
1326
- handler: async (input) => {
1327
- const { openDb, closeDb } = await import('@monoes/monograph');
1328
- const { getMonographApiImpact } = await import('@monoes/monograph');
1329
- const db = openDb(getDbPath());
1330
- try {
1331
- const result = getMonographApiImpact(db, {
1332
- routePath: input.routePath,
1333
- method: input.method,
1334
- });
1335
- if (!result.route)
1336
- return text(`Route not found: ${input.routePath}. Run monograph_build or check the path.`);
1337
- const riskLabel = result.riskScore >= 0.7 ? 'HIGH' : result.riskScore >= 0.4 ? 'MEDIUM' : 'LOW';
1338
- const lines = [
1339
- `Route: ${result.route.method} ${result.route.path} risk=${riskLabel} (${result.riskScore.toFixed(2)})`,
1340
- ];
1341
- if (result.handler) {
1342
- const hLoc = result.handler.filePath
1343
- ? (result.handler.startLine != null ? `${result.handler.filePath}:${result.handler.startLine}` : result.handler.filePath)
1344
- : '';
1345
- lines.push(`Handler: ${result.handler.name}${hLoc ? ` ${hLoc}` : ''}`);
1346
- }
1347
- if (result.callees.length > 0) {
1348
- lines.push(`Callees (${result.callees.length}):`);
1349
- for (const c of result.callees.slice(0, 15)) {
1350
- const loc = c.node.filePath
1351
- ? (c.node.startLine != null ? `${c.node.filePath}:${c.node.startLine}` : c.node.filePath)
1352
- : '';
1353
- lines.push(` ${' '.repeat(c.depth)}→ ${c.node.name} [${c.node.label}]${loc ? ` ${loc}` : ''}`);
1354
- }
1355
- if (result.callees.length > 15)
1356
- lines.push(` … ${result.callees.length - 15} more`);
1357
- }
1358
- if (result.affectedProcesses.length > 0) {
1359
- lines.push(`Affected processes: ${result.affectedProcesses.map(p => p.name).join(', ')}`);
1360
- }
1361
- return text(lines.join('\n'));
1362
- }
1363
- finally {
1364
- closeDb(db);
1365
- }
1366
- },
1367
- };
1368
- // ── monograph_cypher ──────────────────────────────────────────────────────────
1369
- const monographCypherTool = {
1370
- name: 'monograph_cypher',
1371
- description: 'Execute a restricted read-only Cypher-style MATCH query against the Monograph knowledge graph. Supports node and relationship patterns. Write operations (CREATE, MERGE, SET, DELETE, REMOVE, DROP) are blocked.',
1372
- inputSchema: {
1373
- type: 'object',
1374
- properties: {
1375
- query: {
1376
- type: 'string',
1377
- description: 'Cypher MATCH query. Example: MATCH (a:Function)-[:CALLS]->(b:Function {name: "authenticate"}) RETURN a.name, a.filePath',
1378
- },
1379
- },
1380
- required: ['query'],
1381
- },
1382
- handler: async (input) => {
1383
- const { openDb, closeDb } = await import('@monoes/monograph');
1384
- const { getMonographCypher } = await import('@monoes/monograph');
1385
- const db = openDb(getDbPath());
1386
- try {
1387
- // Cap query: forwarded to the Cypher query engine; very long strings
1388
- // waste parse time and can stress the query compiler.
1389
- const MAX_CYPHER_QUERY_LEN = 16 * 1024;
1390
- const rawCypherQuery = input.query;
1391
- const cypherQuery = typeof rawCypherQuery === 'string' && rawCypherQuery.length > MAX_CYPHER_QUERY_LEN
1392
- ? rawCypherQuery.slice(0, MAX_CYPHER_QUERY_LEN)
1393
- : rawCypherQuery;
1394
- const result = getMonographCypher(db, cypherQuery);
1395
- if (result.error)
1396
- return text(`Error: ${result.error}`);
1397
- if (result.rows.length === 0)
1398
- return text('No results found.');
1399
- const header = Object.keys(result.rows[0]).join('\t');
1400
- const lines = result.rows.map(r => Object.values(r).join('\t'));
1401
- return text([header, ...lines, `\n(${result.rows.length} rows, ${result.queryTime}ms)`].join('\n'));
1402
- }
1403
- finally {
1404
- closeDb(db);
1405
- }
1406
- },
1407
- };
1408
- // ── monograph_group_list ──────────────────────────────────────────────────────
1409
- const monographGroupListTool = {
1410
- name: 'monograph_group_list',
1411
- description: 'List repos in a group.yaml with index metadata (node count and indexed_at timestamp). Useful for checking which repos have been indexed.',
1412
- inputSchema: {
1413
- type: 'object',
1414
- properties: {
1415
- configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
1416
- },
1417
- },
1418
- handler: async (input) => {
1419
- const { getGroupList } = await import('@monoes/monograph');
1420
- const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
1421
- const result = await getGroupList(configPath);
1422
- const firstGroup = result.groups?.[0];
1423
- const allRepos = result.groups?.flatMap((g) => g.repos ?? []) ?? [];
1424
- if (!allRepos.length) {
1425
- return text(`Group: ${firstGroup?.name ?? 'unknown'}\nNo repos configured. Check ${configPath}`);
1426
- }
1427
- const lines = [`Group: ${firstGroup?.name ?? 'unknown'} (${allRepos.length} repos)`];
1428
- for (const r of allRepos) {
1429
- const indexed = r.indexedAt ? r.indexedAt.slice(0, 10) : 'never';
1430
- lines.push(` ${r.name} nodes=${r.nodeCount} indexed=${indexed} ${r.path}`);
1431
- }
1432
- return text(lines.join('\n'));
1433
- },
1434
- };
1435
- // ── monograph_group_query ─────────────────────────────────────────────────────
1436
- const monographGroupQueryTool = {
1437
- name: 'monograph_group_query',
1438
- description: 'BM25 keyword search merged across all repos in a group.yaml using Reciprocal Rank Fusion (RRF). Returns results tagged with which repo they came from.',
1439
- inputSchema: {
1440
- type: 'object',
1441
- properties: {
1442
- query: { type: 'string', description: 'Search terms' },
1443
- configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
1444
- limit: { type: 'number', description: 'Max results (default 20)' },
1445
- },
1446
- required: ['query'],
1447
- },
1448
- handler: async (input) => {
1449
- const { runGroupQuery } = await import('@monoes/monograph');
1450
- const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
1451
- // Cap query and limit forwarded to runGroupQuery.
1452
- const MAX_GROUP_QUERY_LEN = 16 * 1024;
1453
- const MAX_GROUP_LIMIT = 1_000;
1454
- const rawGroupQuery = input.query;
1455
- const groupQuery = typeof rawGroupQuery === 'string' && rawGroupQuery.length > MAX_GROUP_QUERY_LEN
1456
- ? rawGroupQuery.slice(0, MAX_GROUP_QUERY_LEN)
1457
- : rawGroupQuery;
1458
- const rawGroupLimit = input.limit;
1459
- const groupLimit = Number.isFinite(rawGroupLimit) && (rawGroupLimit ?? 0) > 0
1460
- ? Math.min(Math.floor(rawGroupLimit), MAX_GROUP_LIMIT)
1461
- : rawGroupLimit;
1462
- const results = await runGroupQuery(configPath, groupQuery, groupLimit);
1463
- if (results.length === 0)
1464
- return text('No results found.');
1465
- const lines = results.map(r => `[${r.label}] ${r.name} ${r.filePath ?? ''} repo:${r.repo} (score: ${r.score.toFixed(4)})`);
1466
- return text(lines.join('\n'));
1467
- },
1468
- };
1469
- // ── monograph_wiki ────────────────────────────────────────────────────────────
1470
- const monographWikiTool = {
1471
- name: 'monograph_wiki',
1472
- description: 'Retrieve LLM-generated wiki pages for code communities. Returns one page by communityId or all pages if no filter provided.',
1473
- inputSchema: {
1474
- type: 'object',
1475
- properties: {
1476
- communityId: { type: 'string', description: 'Community ID to retrieve (omit to list all pages)' },
1477
- },
1478
- },
1479
- handler: async (input) => {
1480
- const { openDb, closeDb } = await import('@monoes/monograph');
1481
- const { getWikiToolResult } = await import('@monoes/monograph');
1482
- const db = openDb(getDbPath());
1483
- try {
1484
- const result = getWikiToolResult(db, { communityId: input.communityId });
1485
- if (result.pages.length === 0) {
1486
- return text('No wiki pages found. Run monograph_wiki_build to generate community wiki pages.');
1487
- }
1488
- // Return pages as readable prose — content is already LLM-generated markdown.
1489
- const sections = result.pages.map(p => `--- Community ${p.communityId} ---\n${p.content}`);
1490
- return text(sections.join('\n\n'));
1491
- }
1492
- finally {
1493
- closeDb(db);
1494
- }
1495
- },
1496
- };
1497
- // ── monograph_wiki_build ──────────────────────────────────────────────────────
1498
- const monographWikiBuildTool = {
1499
- name: 'monograph_wiki_build',
1500
- description: 'Generate wiki pages for code communities using Claude Code CLI (no API key needed — reuses Claude Code auth).',
1501
- inputSchema: {
1502
- type: 'object',
1503
- properties: {
1504
- communityId: { type: 'string', description: 'Only generate for this community ID (omit for all communities)' },
1505
- force: { type: 'boolean', description: 'Regenerate even if page already exists (default false)' },
1506
- model: { type: 'string', description: 'Anthropic model to use (default: claude-haiku-4-5-20251001)' },
1507
- },
1508
- },
1509
- handler: async (input) => {
1510
- const { openDb, closeDb } = await import('@monoes/monograph');
1511
- const { runWikiBuildTool } = await import('@monoes/monograph');
1512
- const db = openDb(getDbPath());
1513
- try {
1514
- const result = await runWikiBuildTool(db, {
1515
- communityId: input.communityId,
1516
- force: input.force,
1517
- model: input.model,
1518
- });
1519
- if (result.error)
1520
- return text(`Wiki build failed: ${result.error}`);
1521
- const parts = [];
1522
- if (result.generated != null)
1523
- parts.push(`${result.generated} page(s) generated`);
1524
- if (result.skipped != null && result.skipped > 0)
1525
- parts.push(`${result.skipped} skipped (already exist)`);
1526
- if (result.errors != null && result.errors > 0)
1527
- parts.push(`${result.errors} error(s)`);
1528
- return text(`Wiki build complete: ${parts.join(', ') || 'nothing to do'}. Use monograph_wiki to read the pages.`);
1529
- }
1530
- finally {
1531
- closeDb(db);
1532
- }
1533
- },
1534
- };
1535
- // ── monograph_serve ───────────────────────────────────────────────────────────
1536
- const monographServeTool = {
1537
- name: 'monograph_serve',
1538
- description: 'Start a web UI server that visualizes the knowledge graph interactively using Sigma.js. Returns the URL where the dashboard is accessible.',
1539
- inputSchema: {
1540
- type: 'object',
1541
- properties: {
1542
- port: { type: 'number', description: 'Port to listen on (default 7374)' },
1543
- open: { type: 'boolean', description: 'Open the URL in the default browser after starting (default false)' },
1544
- },
1545
- },
1546
- handler: async (input) => {
1547
- const { openDb } = await import('@monoes/monograph');
1548
- const { serveMonograph } = await import('@monoes/monograph');
1549
- const db = openDb(getDbPath());
1550
- const result = await serveMonograph({
1551
- port: input.port ?? 7374,
1552
- open: input.open ?? false,
1553
- db,
1554
- });
1555
- return text(`Monograph web UI ${result.status === 'already_running' ? 'already running' : 'started'} at ${result.url}`);
1556
- },
1557
- };
1558
- // ── monograph_tool_map ────────────────────────────────────────────────────────
1559
- const monographToolMapTool = {
1560
- name: 'monograph_tool_map',
1561
- description: 'List MCP/RPC tool definitions in the knowledge graph with handler associations. Shows which functions handle each tool.',
1562
- inputSchema: {
1563
- type: 'object',
1564
- properties: {
1565
- tool: { type: 'string', description: 'Filter by tool name substring' },
1566
- },
1567
- },
1568
- handler: async (input) => {
1569
- const { openDb, closeDb } = await import('@monoes/monograph');
1570
- const { getToolMap } = await import('@monoes/monograph');
1571
- const db = openDb(getDbPath());
1572
- try {
1573
- const results = getToolMap(db, { tool: input.tool });
1574
- if (results.length === 0)
1575
- return text('No tools found. Run monograph_build first.');
1576
- const lines = results.map(r => {
1577
- const loc = r.handlerFile
1578
- ? (r.handlerLine != null ? `${r.handlerFile}:${r.handlerLine}` : r.handlerFile)
1579
- : (r.filePath ?? '');
1580
- return `${r.name}${r.handlerName ? ` → ${r.handlerName}` : ''}${loc ? ` (${loc})` : ''}`;
1581
- });
1582
- return text(`Tools (${results.length}):\n${lines.join('\n')}`);
1583
- }
1584
- finally {
1585
- closeDb(db);
1586
- }
1587
- },
1588
- };
1589
- // ── monograph_shape_check ─────────────────────────────────────────────────────
1590
- const monographShapeCheckTool = {
1591
- name: 'monograph_shape_check',
1592
- description: 'Validate API route response shapes: checks that handler return keys match consumer property accesses. Detects shape mismatches between producer and consumer.',
1593
- inputSchema: {
1594
- type: 'object',
1595
- properties: {
1596
- route: { type: 'string', description: 'Filter by route path substring (e.g. /api/users)' },
1597
- file: { type: 'string', description: 'Filter by source file path substring' },
1598
- },
1599
- },
1600
- handler: async (input) => {
1601
- const { openDb, closeDb } = await import('@monoes/monograph');
1602
- const { getShapeCheck } = await import('@monoes/monograph');
1603
- const db = openDb(getDbPath());
1604
- const repoPath = getProjectCwd();
1605
- try {
1606
- const result = getShapeCheck(db, repoPath, {
1607
- route: input.route,
1608
- file: input.file,
1609
- });
1610
- // Render as structured text so LLMs can act on it directly without parsing JSON.
1611
- const lines = [];
1612
- lines.push(`Shape check: ${result.message}`);
1613
- if (result.route) {
1614
- const handlerLoc = result.route.handlerFile
1615
- ? ` Handler: ${result.route.handlerName} [${result.route.handlerFile}]`
1616
- : ` Handler: ${result.route.handlerName}`;
1617
- lines.push(`Route: ${result.route.method} ${result.route.path}`);
1618
- lines.push(handlerLoc);
1619
- }
1620
- if (result.shape.returnedKeys.length > 0) {
1621
- lines.push(` Returned keys: ${result.shape.returnedKeys.join(', ')}`);
1622
- }
1623
- if (result.shape.accessedKeys.length > 0) {
1624
- lines.push(` Accessed keys: ${result.shape.accessedKeys.join(', ')}`);
1625
- }
1626
- if (result.shape.mismatches.length > 0) {
1627
- lines.push(` Mismatches (accessed but not returned): ${result.shape.mismatches.join(', ')}`);
1628
- }
1629
- if (result.shape.extra.length > 0) {
1630
- lines.push(` Unused returned keys: ${result.shape.extra.join(', ')}`);
1631
- }
1632
- if (result.consumers.length > 0) {
1633
- lines.push(` Consumers (${result.consumers.length}):`);
1634
- for (const c of result.consumers.slice(0, 10)) {
1635
- lines.push(` - ${c.name} [${c.filePath}]`);
1636
- }
1637
- if (result.consumers.length > 10) {
1638
- lines.push(` … ${result.consumers.length - 10} more`);
1639
- }
1640
- }
1641
- return text(lines.join('\n'));
1642
- }
1643
- finally {
1644
- closeDb(db);
1645
- }
1646
- },
1647
- };
1648
- // ── monograph_group_sync ──────────────────────────────────────────────────────
1649
- const monographGroupSyncTool = {
1650
- name: 'monograph_group_sync',
1651
- description: 'Scan all repos in a group.yaml for Route nodes, detect shared HTTP contracts across repos, and persist the Contract Registry to disk.',
1652
- inputSchema: {
1653
- type: 'object',
1654
- properties: {
1655
- configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
1656
- },
1657
- },
1658
- handler: async (input) => {
1659
- const { runGroupSync } = await import('@monoes/monograph');
1660
- const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
1661
- try {
1662
- const result = await runGroupSync(configPath);
1663
- return text(JSON.stringify(result, null, 2));
1664
- }
1665
- catch (err) {
1666
- const msg = err instanceof Error ? err.message : String(err);
1667
- return text(`Group sync failed: ${msg}`);
1668
- }
1669
- },
1670
- };
1671
- // ── monograph_augment ─────────────────────────────────────────────────────────
1672
- const monographAugmentTool = {
1673
- name: 'monograph_augment',
1674
- description: 'Retrieve relevant code context for a query using graph-RAG. Returns formatted context block for injection into AI prompts.',
1675
- inputSchema: {
1676
- type: 'object',
1677
- properties: {
1678
- query: { type: 'string', description: 'The search query or task description' },
1679
- topK: { type: 'number', description: 'Number of results (default: 10)' },
1680
- format: { type: 'string', enum: ['markdown', 'json'], description: 'Output format (default: markdown)' },
1681
- },
1682
- required: ['query'],
1683
- },
1684
- handler: async (input) => {
1685
- const { augmentContext } = await import('@monoes/monograph');
1686
- const repoPath = getProjectCwd();
1687
- // Cap query (forwarded to FTS/embedding in augmentContext) and topK
1688
- // (controls how many context nodes are retrieved).
1689
- const MAX_AUGMENT_QUERY_LEN = 16 * 1024;
1690
- const MAX_AUGMENT_TOP_K = 100;
1691
- const rawAugmentQuery = input.query;
1692
- const augmentQuery = typeof rawAugmentQuery === 'string' && rawAugmentQuery.length > MAX_AUGMENT_QUERY_LEN
1693
- ? rawAugmentQuery.slice(0, MAX_AUGMENT_QUERY_LEN) : rawAugmentQuery;
1694
- const rawTopK = input.topK ?? 10;
1695
- const topK = Number.isFinite(rawTopK) && rawTopK > 0
1696
- ? Math.min(Math.floor(rawTopK), MAX_AUGMENT_TOP_K) : 10;
1697
- const result = await augmentContext({
1698
- query: augmentQuery,
1699
- repoPath,
1700
- topK,
1701
- format: input.format ?? 'markdown',
1702
- });
1703
- return text(result);
1704
- },
1705
- };
1706
- // ── monograph_inject_context ──────────────────────────────────────────────────
1707
- const monographInjectContextTool = {
1708
- name: 'monograph_inject_context',
1709
- description: 'Inject monograph capabilities description into AGENTS.md or CLAUDE.md for AI agent discovery.',
1710
- inputSchema: {
1711
- type: 'object',
1712
- properties: {
1713
- targets: {
1714
- type: 'array',
1715
- items: { type: 'string', enum: ['claude', 'agents-md'] },
1716
- description: 'Which files to update (default: both)',
1717
- },
1718
- },
1719
- },
1720
- handler: async (input) => {
1721
- const { injectAiContext } = await import('@monoes/monograph');
1722
- const repoPath = getProjectCwd();
1723
- const result = await injectAiContext({
1724
- repoPath,
1725
- targets: input.targets,
1726
- });
1727
- return text(`Injected context into: ${result.updated.join(', ') || 'none'}`);
1728
- },
1729
- };
1730
- // ── monograph_skill_gen ───────────────────────────────────────────────────────
1731
- const monographSkillGenTool = {
1732
- name: 'monograph_skill_gen',
1733
- description: 'Generate per-community skill files summarizing code structure for AI navigation.',
1734
- inputSchema: {
1735
- type: 'object',
1736
- properties: {
1737
- outputDir: { type: 'string', description: 'Output directory for skill files (default: .monomind/skills/)' },
1738
- },
1739
- },
1740
- handler: async (input) => {
1741
- const { generateSkillFiles } = await import('@monoes/monograph');
1742
- const repoPath = getProjectCwd();
1743
- const allowedRoot = resolve(repoPath);
1744
- if (input.outputDir) {
1745
- const outDir = resolve(input.outputDir);
1746
- if (outDir !== allowedRoot && !outDir.startsWith(allowedRoot + sep)) {
1747
- return text(`Error: outputDir must be within the project directory (${allowedRoot})`);
1748
- }
1749
- }
1750
- const result = await generateSkillFiles(repoPath, input.outputDir ? resolve(input.outputDir) : undefined);
1751
- const dir = result.filesWritten.length > 0
1752
- ? result.filesWritten[0].replace(/\/[^/]+$/, '/')
1753
- : join(repoPath, '.monomind', 'skills') + '/';
1754
- return text(`Generated ${result.communityCount} skill files in ${dir}`);
1755
- },
1756
- };
1757
- // ── monograph_install_skills ──────────────────────────────────────────────────
1758
- const monographInstallSkillsTool = {
1759
- name: 'monograph_install_skills',
1760
- description: 'Install monograph skill files for a specific IDE/platform (claude, cursor, vscode, zed).',
1761
- inputSchema: {
1762
- type: 'object',
1763
- properties: {
1764
- platform: {
1765
- type: 'string',
1766
- description: 'Target platform: claude, cursor, vscode, or zed',
1767
- },
1768
- repoPath: {
1769
- type: 'string',
1770
- description: 'Absolute path to the repository (defaults to cwd)',
1771
- },
1772
- },
1773
- required: ['platform'],
1774
- },
1775
- handler: async (input) => {
1776
- const { openDb, closeDb } = await import('@monoes/monograph');
1777
- const { installSkillsForPlatform } = await import('@monoes/monograph');
1778
- const rawRepoPath = input.repoPath ?? getProjectCwd();
1779
- const repoPath = resolve(rawRepoPath);
1780
- const allowedRoot = resolve(getProjectCwd());
1781
- if (repoPath !== allowedRoot && !repoPath.startsWith(allowedRoot + sep)) {
1782
- return text(`Error: repoPath must be within the project directory (${allowedRoot})`);
1783
- }
1784
- const platform = input.platform;
1785
- const validPlatforms = ['claude', 'cursor', 'vscode', 'zed'];
1786
- if (!validPlatforms.includes(platform)) {
1787
- return text(`Invalid platform "${platform}". Must be one of: ${validPlatforms.join(', ')}`);
1788
- }
1789
- // Load community data from graph
1790
- const dbPath = getDbPath(repoPath);
1791
- // openDb's fileMustExist option isn't in the currently-published
1792
- // @monoes/monograph release this CLI depends on — check validity
1793
- // ourselves so a missing DB doesn't get silently auto-created empty.
1794
- if (!_isValidDb(dbPath)) {
1795
- return text('Graph not built yet. Run monograph_build first.');
1796
- }
1797
- let db;
1798
- try {
1799
- db = openDb(dbPath);
1800
- }
1801
- catch {
1802
- return text('Graph not built yet. Run monograph_build first.');
1803
- }
1804
- let communities;
1805
- try {
1806
- // Query distinct community IDs with exported symbols
1807
- const communityIds = db.prepare(`
1808
- SELECT DISTINCT community_id
1809
- FROM nodes
1810
- WHERE community_id IS NOT NULL
1811
- AND label NOT IN ('File', 'Folder', 'Community', 'Concept')
1812
- ORDER BY community_id
1813
- `).all();
1814
- if (communityIds.length === 0) {
1815
- closeDb(db);
1816
- return text('No communities found in graph. Run monograph_build first.');
1817
- }
1818
- communities = communityIds.map(({ community_id }) => {
1819
- // Derive a readable name from folder paths
1820
- const pathRows = db.prepare(`
1821
- SELECT file_path FROM nodes
1822
- WHERE community_id = ? AND file_path IS NOT NULL
1823
- AND label NOT IN ('File', 'Folder', 'Community', 'Concept')
1824
- LIMIT 20
1825
- `).all(community_id);
1826
- let name = `community-${community_id}`;
1827
- const folderCounts = new Map();
1828
- for (const row of pathRows) {
1829
- const parts = row.file_path.replace(/\\/g, '/').split('/').filter(Boolean);
1830
- if (parts.length >= 2) {
1831
- const folder = parts[parts.length - 2].toLowerCase();
1832
- if (!['src', 'lib', 'core', 'utils', 'common', 'shared', 'helpers', 'dist'].includes(folder)) {
1833
- folderCounts.set(folder, (folderCounts.get(folder) ?? 0) + 1);
1834
- }
1835
- }
1836
- }
1837
- let bestCount = 0;
1838
- for (const [folder, count] of folderCounts) {
1839
- if (count > bestCount) {
1840
- bestCount = count;
1841
- name = folder;
1842
- }
1843
- }
1844
- // Collect exported symbol names
1845
- const symbolRows = db.prepare(`
1846
- SELECT name FROM nodes
1847
- WHERE community_id = ? AND is_exported = 1
1848
- AND label NOT IN ('File', 'Folder', 'Community', 'Concept')
1849
- ORDER BY name
1850
- LIMIT 50
1851
- `).all(community_id);
1852
- return { name, symbols: symbolRows.map(r => r.name) };
1853
- });
1854
- }
1855
- catch (err) {
1856
- closeDb(db);
1857
- const msg = err instanceof Error ? err.message : String(err);
1858
- return text(`Failed to query graph: ${msg}`);
1859
- }
1860
- closeDb(db);
1861
- const result = await installSkillsForPlatform(repoPath, communities, {
1862
- platform: platform,
1863
- });
1864
- return text(`Installed ${result.filesWritten.length} skill files for ${result.platform} in ${result.outputDir}`);
1865
- },
1866
- };
1867
- // ── monograph_doctor ──────────────────────────────────────────────────────────
1868
- const monographDoctorTool = {
1869
- name: 'monograph_doctor',
1870
- description: 'Run platform diagnostics — checks Node version, SQLite DB health, node count, disk space.',
1871
- inputSchema: {
1872
- type: 'object',
1873
- properties: {},
1874
- },
1875
- handler: async (_input) => {
1876
- const { runDoctor } = await import('@monoes/monograph');
1877
- const repoPath = getProjectCwd();
1878
- const result = await runDoctor(repoPath);
1879
- const lines = result.checks.map(c => `${c.status === 'ok' ? '✅' : c.status === 'warn' ? '⚠️' : '❌'} ${c.name}: ${c.message}`);
1880
- if (!result.healthy)
1881
- lines.push('\nSome checks failed. Run monograph build to fix.');
1882
- return text(lines.join('\n'));
1883
- },
1884
- };
1885
- // ── monograph_list_repos ──────────────────────────────────────────────────────
1886
- const monographListReposTool = {
1887
- name: 'monograph_list_repos',
1888
- description: 'List all repositories tracked in the global monograph registry (~/.monograph/registry.json).',
1889
- inputSchema: {
1890
- type: 'object',
1891
- properties: {},
1892
- },
1893
- handler: async (_input) => {
1894
- const { listRepos } = await import('@monoes/monograph');
1895
- const repos = listRepos();
1896
- if (repos.length === 0)
1897
- return text('No repositories registered. Run monograph build in a repo to register it.');
1898
- const lines = repos.map(r => `${r.name} — ${r.path}${r.lastIndexed ? ` (indexed ${r.lastIndexed.slice(0, 10)})` : ''}${r.nodeCount != null ? ` [${r.nodeCount} nodes, ${r.edgeCount ?? 0} edges]` : ''}`);
1899
- return text(lines.join('\n'));
1900
- },
1901
- };
1902
- // ── monograph_group_contracts ─────────────────────────────────────────────────
1903
- const monographGroupContractsTool = {
1904
- name: 'monograph_group_contracts',
1905
- description: 'List public API contracts (exported symbols, interfaces, and types) for all groups defined in group.yaml.',
1906
- inputSchema: {
1907
- type: 'object',
1908
- properties: {
1909
- configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
1910
- },
1911
- },
1912
- handler: async (input) => {
1913
- const { getGroupContracts } = await import('./monograph-compat.js');
1914
- const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
1915
- const contracts = await getGroupContracts(configPath);
1916
- if (contracts.length === 0)
1917
- return text(`No contracts found. Ensure groups are defined in ${configPath}.`);
1918
- const lines = contracts.map(c => `[${c.groupName}] ${c.symbol} — ${c.filePath}:${c.line}`);
1919
- return text(lines.join('\n'));
1920
- },
1921
- };
1922
- // ── monograph_group_status ────────────────────────────────────────────────────
1923
- const monographGroupStatusTool = {
1924
- name: 'monograph_group_status',
1925
- description: 'Show health status for all groups: whether each group is indexed, has contracts, and was recently synced.',
1926
- inputSchema: {
1927
- type: 'object',
1928
- properties: {
1929
- configPath: { type: 'string', description: 'Path to group.yaml (defaults to group.yaml in project cwd)' },
1930
- },
1931
- },
1932
- handler: async (input) => {
1933
- const { getGroupStatus } = await import('./monograph-compat.js');
1934
- const configPath = input.configPath ?? join(getProjectCwd(), 'group.yaml');
1935
- const status = await getGroupStatus(configPath);
1936
- const lines = [`Groups: ${status.totalGroups} (${status.indexedGroups} indexed, ${status.stalledGroups} stalled)`];
1937
- for (const g of status.groups) {
1938
- const icon = g.indexed ? (g.stale ? '⚠️' : '✅') : '❌';
1939
- lines.push(`${icon} ${g.name} — ${g.contractCount} contracts${g.lastSync ? ` (synced ${g.lastSync.slice(0, 10)})` : ''}`);
1940
- }
1941
- return text(lines.join('\n'));
1942
- },
1943
- };
1944
- // ── monograph_neighbors ───────────────────────────────────────────────────────
1945
- const monographNeighborsTool = {
1946
- name: 'monograph_neighbors',
1947
- description: 'Show all directly connected nodes for a given symbol — outbound and optionally inbound edges, with relation types.',
1948
- inputSchema: {
1949
- type: 'object',
1950
- properties: {
1951
- name: { type: 'string', description: 'Symbol name to look up' },
1952
- relationFilter: { type: 'string', description: 'Filter by relation type, e.g. IMPORTS, CALLS' },
1953
- includeInbound: { type: 'boolean', description: 'Include inbound edges (default: false)' },
1954
- },
1955
- required: ['name'],
1956
- },
1957
- handler: async (input) => {
1958
- const { openDb, closeDb, getMonographNeighbors } = await import('@monoes/monograph');
1959
- const db = openDb(getDbPath());
1960
- try {
1961
- const result = getMonographNeighbors(db, {
1962
- name: input.name,
1963
- relationFilter: input.relationFilter,
1964
- includeInbound: input.includeInbound ?? false,
1965
- });
1966
- if (!result.node)
1967
- return text(`No node found with name: ${input.name}`);
1968
- const nodeFilePath = result.node.filePath ?? '';
1969
- const nodeStartLine = result.node.startLine ?? result.node.start_line;
1970
- const nodeLoc = nodeFilePath ? (nodeStartLine != null ? `${nodeFilePath}:${nodeStartLine}` : nodeFilePath) : '';
1971
- const lines = [
1972
- `[${result.node.label}] ${result.node.name} ${nodeLoc}`,
1973
- `Neighbors: ${result.neighbors.length}`,
1974
- '',
1975
- ...result.neighbors.map(n => {
1976
- const fp = n.node.filePath ?? n.node.file_path ?? '';
1977
- const ln = n.node.startLine ?? n.node.start_line;
1978
- const loc = fp ? (ln != null ? `${fp}:${ln}` : fp) : '';
1979
- return ` ${n.direction === 'inbound' ? '←' : '→'} [${n.node.label}] ${n.node.name} (${n.relation}) ${loc}`;
1980
- }),
1981
- ];
1982
- return text(lines.join('\n'));
1983
- }
1984
- finally {
1985
- closeDb(db);
1986
- }
1987
- },
1988
- };
1989
- // ── monograph_dead_code ──────────────────────────────────────────────────────
1990
- const monographDeadCodeTool = {
1991
- name: 'monograph_dead_code',
1992
- description: 'Detect dead code: exported functions with zero inbound references, files with no importers, and stale dist build artifacts. Returns structured JSON with candidates grouped by category. Always verify candidates with grep before deleting.',
1993
- inputSchema: {
1994
- type: 'object',
1995
- properties: {
1996
- path: { type: 'string', description: 'Absolute path to the repo (defaults to project cwd)' },
1997
- categories: {
1998
- type: 'array',
1999
- items: { type: 'string', enum: ['dead-functions', 'orphan-files', 'stale-dist'] },
2000
- description: 'Which categories to check (default: all three)',
2001
- },
2002
- },
2003
- },
2004
- handler: async (input) => {
2005
- const { openDb } = await import('@monoes/monograph');
2006
- const repoPath = input.path ?? getProjectCwd();
2007
- const cats = input.categories ?? ['dead-functions', 'orphan-files', 'stale-dist'];
2008
- const result = {};
2009
- const dbPath = getDbPath(repoPath);
2010
- // openDb's fileMustExist option isn't in the currently-published
2011
- // @monoes/monograph release this CLI depends on — check validity
2012
- // ourselves so a missing DB doesn't get silently auto-created empty.
2013
- if (!_isValidDb(dbPath)) {
2014
- return text(JSON.stringify({ error: 'No monograph index found. Run monograph_build first.' }));
2015
- }
2016
- let db = null;
2017
- try {
2018
- db = openDb(dbPath);
2019
- // _isValidDb's size check can't distinguish a real index from an
2020
- // empty-but-schema-migrated DB (better-sqlite3 auto-creates + migrates
2021
- // on open, and other unguarded openDb() call sites in this file can
2022
- // create exactly that as a side effect of an unrelated tool call before
2023
- // monograph_build ever runs). Verify actual content post-open so this
2024
- // reports "never built" instead of a misleading "0 dead functions found".
2025
- const { count } = db.prepare('SELECT COUNT(*) as count FROM nodes').get();
2026
- if (count === 0) {
2027
- return text(JSON.stringify({ error: 'No monograph index found. Run monograph_build first.' }));
2028
- }
2029
- }
2030
- catch {
2031
- return text(JSON.stringify({ error: 'No monograph index found. Run monograph_build first.' }));
2032
- }
2033
- try {
2034
- if (cats.includes('dead-functions')) {
2035
- const { detectDeadCodeNodes } = await import('@monoes/monograph');
2036
- const { readFileSync } = await import('fs');
2037
- const nodes = detectDeadCodeNodes(db);
2038
- // Filter out stale graph nodes: verify the function name actually appears in the source file
2039
- const verified = nodes.filter(n => {
2040
- if (!n.filePath)
2041
- return false;
2042
- try {
2043
- const content = readFileSync(join(repoPath, n.filePath), 'utf-8');
2044
- return content.includes(n.name);
2045
- }
2046
- catch {
2047
- return false;
2048
- }
2049
- });
2050
- const staleCount = nodes.length - verified.length;
2051
- result['dead-functions'] = {
2052
- count: verified.length,
2053
- candidates: verified.map(n => ({
2054
- name: n.name,
2055
- location: n.filePath ? (n.startLine ? `${n.filePath}:${n.startLine}` : n.filePath) : null,
2056
- })),
2057
- ...(staleCount > 0 ? { staleIndexEntries: staleCount, note: 'Some graph entries reference deleted functions. Rebuild the index with monograph_build to clean up.' } : {}),
2058
- };
2059
- }
2060
- if (cats.includes('orphan-files')) {
2061
- const rows = db.prepare(`
2062
- SELECT n.name, n.file_path,
2063
- (SELECT COUNT(*) FROM edges e WHERE e.source_id = n.id AND e.relation = 'IMPORTS') as imports_out,
2064
- (SELECT COUNT(*) FROM edges e WHERE e.target_id = n.id AND e.relation = 'IMPORTS') as imported_by
2065
- FROM nodes n
2066
- WHERE n.label = 'File'
2067
- AND (SELECT COUNT(*) FROM edges e WHERE e.target_id = n.id AND e.relation = 'IMPORTS') = 0
2068
- AND n.file_path NOT LIKE '%/test/%'
2069
- AND n.file_path NOT LIKE '%/tests/%'
2070
- AND n.file_path NOT LIKE '%.test.%'
2071
- AND n.file_path NOT LIKE '%__tests__%'
2072
- AND n.file_path NOT LIKE '%/spec/%'
2073
- AND n.file_path NOT LIKE '%.spec.%'
2074
- AND n.file_path NOT LIKE '%/index.%'
2075
- AND n.file_path NOT LIKE 'bin/%'
2076
- AND n.file_path NOT LIKE 'scripts/%'
2077
- AND n.file_path NOT LIKE '%/cli.ts'
2078
- AND n.file_path NOT LIKE '%/cli.js'
2079
- AND n.file_path NOT LIKE '%/main.ts'
2080
- AND n.file_path NOT LIKE '%/main.js'
2081
- AND n.file_path NOT LIKE '%/dist/%'
2082
- AND n.file_path NOT LIKE '%node_modules%'
2083
- ORDER BY n.file_path
2084
- `).all();
2085
- const withOutbound = rows.filter((r) => r.imports_out > 0);
2086
- const isolated = rows.filter((r) => r.imports_out === 0);
2087
- result['orphan-files'] = {
2088
- count: withOutbound.length,
2089
- note: 'Files that import other modules but nothing imports them. May be lazy-loaded or dynamically imported — verify with grep.',
2090
- candidates: withOutbound.map((r) => ({ file: r.file_path, outboundImports: r.imports_out })),
2091
- ...(isolated.length > 0 ? {
2092
- isolated: {
2093
- count: isolated.length,
2094
- note: 'Files with zero edges in either direction — likely standalone scripts or entry points.',
2095
- files: isolated.map((r) => r.file_path),
2096
- },
2097
- } : {}),
2098
- };
2099
- }
2100
- if (cats.includes('stale-dist')) {
2101
- result['stale-dist'] = findStaleDist(repoPath);
2102
- }
2103
- return text(JSON.stringify(result, null, 2));
2104
- }
2105
- finally {
2106
- db.close();
2107
- }
2108
- },
2109
- };
2110
- function findStaleDist(repoPath) {
2111
- const distSrc = join(repoPath, 'dist', 'src');
2112
- const src = join(repoPath, 'src');
2113
- // Scan a single package for stale dist artifacts
2114
- const scanPkg = (pkgPath, pkgName) => {
2115
- const pkgDistSrc = join(pkgPath, 'dist', 'src');
2116
- const pkgSrc = join(pkgPath, 'src');
2117
- if (!existsSync(pkgDistSrc) || !existsSync(pkgSrc))
2118
- return null;
2119
- const staleDirs = [];
2120
- const staleFiles = [];
2121
- let resourceForks = 0;
2122
- try {
2123
- const distDirs = readdirSync(pkgDistSrc, { withFileTypes: true })
2124
- .filter(d => d.isDirectory() && !d.name.startsWith('.') && !d.name.startsWith('._'));
2125
- const srcDirs = new Set(readdirSync(pkgSrc, { withFileTypes: true })
2126
- .filter(d => d.isDirectory() && !d.name.startsWith('.'))
2127
- .map(d => d.name));
2128
- for (const d of distDirs) {
2129
- if (!srcDirs.has(d.name))
2130
- staleDirs.push(d.name);
2131
- }
2132
- }
2133
- catch { /* skip */ }
2134
- try {
2135
- const distFiles = readdirSync(pkgDistSrc)
2136
- .filter(f => f.endsWith('.js') && !f.startsWith('.') && !f.startsWith('._'));
2137
- for (const f of distFiles) {
2138
- const tsName = f.replace(/\.js$/, '.ts');
2139
- if (!existsSync(join(pkgSrc, tsName)))
2140
- staleFiles.push(f);
2141
- }
2142
- }
2143
- catch { /* skip */ }
2144
- // Count macOS resource fork files
2145
- const countRF = (dir) => {
2146
- try {
2147
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
2148
- if (entry.name.startsWith('._'))
2149
- resourceForks++;
2150
- else if (entry.isDirectory())
2151
- countRF(join(dir, entry.name));
2152
- }
2153
- }
2154
- catch { /* skip */ }
2155
- };
2156
- countRF(pkgDistSrc);
2157
- if (staleDirs.length === 0 && staleFiles.length === 0 && resourceForks === 0)
2158
- return null;
2159
- return {
2160
- package: pkgName,
2161
- staleDirs,
2162
- staleFiles,
2163
- ...(resourceForks > 0 ? { macosResourceForks: resourceForks } : {}),
2164
- };
2165
- };
2166
- // Single-package repo
2167
- if (existsSync(distSrc) && existsSync(src)) {
2168
- const finding = scanPkg(repoPath, '.');
2169
- return {
2170
- count: finding ? finding.staleDirs.length + finding.staleFiles.length : 0,
2171
- note: 'Directories/files in dist/src/ with no corresponding source. Fix: rm -rf dist && npm run build.',
2172
- ...(finding ? { findings: [finding] } : {}),
2173
- };
2174
- }
2175
- // Monorepo: scan all packages
2176
- const packagesDir = join(repoPath, 'packages');
2177
- if (!existsSync(packagesDir))
2178
- return { count: 0, note: 'No dist/src or packages/ found' };
2179
- const findings = [];
2180
- try {
2181
- for (const scope of readdirSync(packagesDir, { withFileTypes: true })) {
2182
- if (!scope.isDirectory())
2183
- continue;
2184
- const scopeDir = join(packagesDir, scope.name);
2185
- if (scope.name.startsWith('@')) {
2186
- for (const pkg of readdirSync(scopeDir, { withFileTypes: true })) {
2187
- if (!pkg.isDirectory())
2188
- continue;
2189
- const f = scanPkg(join(scopeDir, pkg.name), `${scope.name}/${pkg.name}`);
2190
- if (f)
2191
- findings.push(f);
2192
- }
2193
- }
2194
- else {
2195
- const f = scanPkg(scopeDir, scope.name);
2196
- if (f)
2197
- findings.push(f);
2198
- }
2199
- }
2200
- }
2201
- catch { /* skip */ }
2202
- return {
2203
- count: findings.reduce((s, f) => s + (f.staleDirs?.length ?? 0) + (f.staleFiles?.length ?? 0), 0),
2204
- note: 'Directories/files in dist/src/ with no corresponding source. Fix: rm -rf dist && npm run build.',
2205
- findings,
2206
- };
2207
- }
2208
- // ── monograph_agent_history ───────────────────────────────────────────────────
2209
- const monographAgentHistoryTool = {
2210
- name: 'monograph_agent_history',
2211
- description: 'Query past agent interactions by org, type, session, or time range. Returns rows ordered by timestamp descending.',
2212
- inputSchema: {
2213
- type: 'object',
2214
- properties: {
2215
- org_name: { type: 'string', description: 'Filter by org name' },
2216
- agent_type: { type: 'string', description: 'Filter by agent type' },
2217
- session_id: { type: 'string', description: 'Filter by session id' },
2218
- since: { type: 'number', description: 'Unix timestamp (ms) — only interactions after this time' },
2219
- limit: { type: 'number', description: 'Max rows to return (default 50)' },
2220
- },
2221
- },
2222
- handler: async (input) => {
2223
- const { openDb, closeDb } = await import('@monoes/monograph');
2224
- const db = openDb(getDbPath());
2225
- try {
2226
- const conditions = [];
2227
- const params = {};
2228
- if (typeof input.org_name === 'string') {
2229
- conditions.push('org_name = @org_name');
2230
- params.org_name = input.org_name;
2231
- }
2232
- if (typeof input.agent_type === 'string') {
2233
- conditions.push('agent_type = @agent_type');
2234
- params.agent_type = input.agent_type;
2235
- }
2236
- if (typeof input.session_id === 'string') {
2237
- conditions.push('session_id = @session_id');
2238
- params.session_id = input.session_id;
2239
- }
2240
- if (typeof input.since === 'number') {
2241
- conditions.push('timestamp >= @since');
2242
- params.since = input.since;
2243
- }
2244
- const MAX_LIMIT = 1_000;
2245
- const rawLimit = input.limit ?? 50;
2246
- const limit = Number.isFinite(rawLimit) && rawLimit > 0
2247
- ? Math.min(Math.floor(rawLimit), MAX_LIMIT)
2248
- : 50;
2249
- params.limit = limit;
2250
- const where = conditions.length ? `WHERE ${conditions.join(' AND ')}` : '';
2251
- const sql = `SELECT * FROM agent_interactions ${where} ORDER BY timestamp DESC LIMIT @limit`;
2252
- const rows = db.prepare(sql).all(params);
2253
- if (rows.length === 0)
2254
- return text('No agent interactions found.');
2255
- return text(JSON.stringify(rows, null, 2));
2256
- }
2257
- finally {
2258
- closeDb(db);
2259
- }
2260
- },
2261
- };
2262
- // ── monograph_agent_patterns ──────────────────────────────────────────────────
2263
- const monographAgentPatternsTool = {
2264
- name: 'monograph_agent_patterns',
2265
- description: 'Aggregate agent interaction patterns: success rates, costs, and token usage grouped by agent type, org, or session.',
2266
- inputSchema: {
2267
- type: 'object',
2268
- properties: {
2269
- group_by: {
2270
- type: 'string',
2271
- description: "Column to group by: 'agent_type' | 'org_name' | 'session_id'",
2272
- },
2273
- since: { type: 'number', description: 'Unix timestamp (ms) — only interactions after this time' },
2274
- min_count: { type: 'number', description: 'Minimum interaction count to include in results (default 2)' },
2275
- },
2276
- required: ['group_by'],
2277
- },
2278
- handler: async (input) => {
2279
- const groupBy = input.group_by;
2280
- const ALLOWED_GROUP_COLUMNS = new Set(['agent_type', 'org_name', 'session_id']);
2281
- if (!ALLOWED_GROUP_COLUMNS.has(groupBy)) {
2282
- return text(`Invalid group_by: ${groupBy}. Must be one of: agent_type, org_name, session_id`);
2283
- }
2284
- const { openDb, closeDb } = await import('@monoes/monograph');
2285
- const db = openDb(getDbPath());
2286
- try {
2287
- const params = {};
2288
- const conditions = [];
2289
- if (typeof input.since === 'number') {
2290
- conditions.push('timestamp >= @since');
2291
- params.since = input.since;
2292
- }
2293
- const minCount = typeof input.min_count === 'number' && input.min_count > 0
2294
- ? Math.floor(input.min_count)
2295
- : 2;
2296
- params.min_count = minCount;
2297
- const where = conditions.length ? `WHERE ${conditions.join(' AND ')}` : '';
2298
- const sql = `
2299
- SELECT
2300
- ${groupBy} AS group_key,
2301
- COUNT(*) AS interaction_count,
2302
- AVG(success) AS success_rate,
2303
- SUM(tokens_in) AS total_tokens_in,
2304
- SUM(tokens_out) AS total_tokens_out,
2305
- SUM(cost_usd) AS total_cost_usd,
2306
- AVG(duration_ms) AS avg_duration_ms
2307
- FROM agent_interactions
2308
- ${where}
2309
- GROUP BY ${groupBy}
2310
- HAVING COUNT(*) >= @min_count
2311
- ORDER BY interaction_count DESC
2312
- `;
2313
- const rows = db.prepare(sql).all(params);
2314
- if (rows.length === 0)
2315
- return text('No agent interaction patterns found.');
2316
- return text(JSON.stringify(rows, null, 2));
2317
- }
2318
- finally {
2319
- closeDb(db);
2320
- }
2321
- },
2322
- };
2323
- // ── monograph_agent_record ────────────────────────────────────────────────────
2324
- const monographAgentRecordTool = {
2325
- name: 'monograph_agent_record',
2326
- description: 'Record an agent interaction (called by capture hooks).',
2327
- inputSchema: {
2328
- type: 'object',
2329
- properties: {
2330
- session_id: { type: 'string', description: 'Session id' },
2331
- agent_type: { type: 'string', description: 'Agent type' },
2332
- org_name: { type: 'string', description: 'Org name' },
2333
- parent_agent: { type: 'string', description: 'Parent agent name/type, if spawned by another agent' },
2334
- prompt_summary: { type: 'string', description: 'Short summary of the prompt given to the agent' },
2335
- result_summary: { type: 'string', description: 'Short summary of the agent result' },
2336
- tokens_in: { type: 'number', description: 'Input tokens consumed (default 0)' },
2337
- tokens_out: { type: 'number', description: 'Output tokens produced (default 0)' },
2338
- cost_usd: { type: 'number', description: 'Cost in USD (default 0)' },
2339
- success: { type: 'boolean', description: 'Whether the interaction succeeded (default true)' },
2340
- duration_ms: { type: 'number', description: 'Duration in milliseconds (default 0)' },
2341
- },
2342
- required: ['session_id', 'agent_type'],
2343
- },
2344
- handler: async (input) => {
2345
- const { openDb, closeDb } = await import('@monoes/monograph');
2346
- const db = openDb(getDbPath());
2347
- try {
2348
- const id = randomUUID();
2349
- const timestamp = Date.now();
2350
- db.prepare(`
2351
- INSERT INTO agent_interactions (
2352
- id, session_id, org_name, agent_type, parent_agent,
2353
- prompt_summary, result_summary, tokens_in, tokens_out,
2354
- cost_usd, success, duration_ms, timestamp
2355
- ) VALUES (
2356
- @id, @session_id, @org_name, @agent_type, @parent_agent,
2357
- @prompt_summary, @result_summary, @tokens_in, @tokens_out,
2358
- @cost_usd, @success, @duration_ms, @timestamp
2359
- )
2360
- `).run({
2361
- id,
2362
- session_id: input.session_id,
2363
- org_name: input.org_name ?? null,
2364
- agent_type: input.agent_type,
2365
- parent_agent: input.parent_agent ?? null,
2366
- prompt_summary: input.prompt_summary ?? null,
2367
- result_summary: input.result_summary ?? null,
2368
- tokens_in: input.tokens_in ?? 0,
2369
- tokens_out: input.tokens_out ?? 0,
2370
- cost_usd: input.cost_usd ?? 0,
2371
- success: input.success === false ? 0 : 1,
2372
- duration_ms: input.duration_ms ?? 0,
2373
- timestamp,
2374
- });
2375
- return text(`Recorded agent interaction ${id} for ${input.agent_type} at ${timestamp}`);
2376
- }
2377
- finally {
2378
- closeDb(db);
2379
- }
2380
- },
2381
- };
2382
- // Advanced tools are only exposed over MCP when MONOGRAPH_MCP_ADVANCED=1.
2383
- const ADVANCED = process.env['MONOGRAPH_MCP_ADVANCED'] === '1';
2384
- /** Default-exposed core tools (19). */
2385
- const coreMonographTools = [
2386
- monographBuildTool,
2387
- monographQueryTool,
2388
- monographSuggestTool,
2389
- monographImpactTool,
2390
- monographContextTool,
2391
- monographNeighborsTool,
2392
- monographDeadCodeTool,
2393
- monographStatsTool,
2394
- monographHealthTool,
2395
- monographAugmentTool,
2396
- monographGodNodesTool,
2397
- monographDetectChangesTool,
2398
- monographGetNodeTool,
2399
- monographApiImpactTool,
2400
- monographRouteMapTool,
2401
- monographStalenessTool,
2402
- monographWatchTool,
2403
- monographWatchStopTool,
2404
- monographDoctorTool,
2405
- ];
2406
- /** Advanced tools — gated behind MONOGRAPH_MCP_ADVANCED=1. */
2407
- const advancedMonographTools = [
2408
- monographCypherTool,
2409
- monographShortestPathTool,
2410
- monographCommunityTool,
2411
- monographSurprisesTool,
2412
- monographShapeCheckTool,
2413
- monographRenameTool,
2414
- monographToolMapTool,
2415
- monographServeTool,
2416
- monographVisualizeTool,
2417
- monographSnapshotTool,
2418
- monographDiffTool,
2419
- monographReportTool,
2420
- monographExportTool,
2421
- monographWikiTool,
2422
- monographWikiBuildTool,
2423
- monographSkillGenTool,
2424
- monographInstallSkillsTool,
2425
- monographInjectContextTool,
2426
- monographGroupListTool,
2427
- monographGroupQueryTool,
2428
- monographGroupSyncTool,
2429
- monographGroupContractsTool,
2430
- monographGroupStatusTool,
2431
- monographListReposTool,
2432
- monographAgentHistoryTool,
2433
- monographAgentPatternsTool,
2434
- monographAgentRecordTool,
2435
- ];
2436
- /**
2437
- * Full tool list regardless of gating — used by the graphify compat shims,
2438
- * which must resolve targets (e.g. monograph_community) even when the
2439
- * advanced set is not exposed over MCP.
2440
- */
2441
- export const allMonographTools = [...coreMonographTools, ...advancedMonographTools];
2442
- export const monographTools = ADVANCED ? allMonographTools : coreMonographTools;
2443
- //# sourceMappingURL=monograph-tools.js.map