@monoes/monomindcli 2.7.2 → 2.7.4

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 (590) hide show
  1. package/.claude/agents/architecture/system-design/arch-system-design.md +0 -0
  2. package/.claude/agents/consensus/crdt-synchronizer.md +0 -0
  3. package/.claude/agents/consensus/quorum-manager.md +0 -0
  4. package/.claude/agents/consensus/security-manager.md +0 -0
  5. package/.claude/agents/core/coder.md +0 -0
  6. package/.claude/agents/core/coordinator.md +0 -0
  7. package/.claude/agents/core/planner.md +0 -0
  8. package/.claude/agents/core/researcher.md +0 -0
  9. package/.claude/agents/core/reviewer.md +0 -0
  10. package/.claude/agents/core/tester.md +0 -0
  11. package/.claude/agents/design/design-monodesign.md +0 -0
  12. package/.claude/agents/engineering/engineering-ai-data-remediation-engineer.md +0 -0
  13. package/.claude/agents/engineering/engineering-ai-engineer.md +0 -0
  14. package/.claude/agents/engineering/engineering-autonomous-optimization-architect.md +0 -0
  15. package/.claude/agents/engineering/engineering-backend-architect.md +0 -0
  16. package/.claude/agents/engineering/engineering-code-reviewer.md +0 -0
  17. package/.claude/agents/engineering/engineering-data-engineer.md +0 -0
  18. package/.claude/agents/engineering/engineering-database-optimizer.md +0 -0
  19. package/.claude/agents/engineering/engineering-devops-automator.md +0 -0
  20. package/.claude/agents/engineering/engineering-embedded-firmware-engineer.md +0 -0
  21. package/.claude/agents/engineering/engineering-feishu-integration-developer.md +0 -0
  22. package/.claude/agents/engineering/engineering-frontend-developer.md +0 -0
  23. package/.claude/agents/engineering/engineering-git-workflow-master.md +0 -0
  24. package/.claude/agents/engineering/engineering-incident-response-commander.md +0 -0
  25. package/.claude/agents/engineering/engineering-mobile-app-builder.md +0 -0
  26. package/.claude/agents/engineering/engineering-rapid-prototyper.md +0 -0
  27. package/.claude/agents/engineering/engineering-security-engineer.md +0 -0
  28. package/.claude/agents/engineering/engineering-senior-developer.md +0 -0
  29. package/.claude/agents/engineering/engineering-software-architect.md +0 -0
  30. package/.claude/agents/engineering/engineering-solidity-smart-contract-engineer.md +0 -0
  31. package/.claude/agents/engineering/engineering-sre.md +0 -0
  32. package/.claude/agents/engineering/engineering-technical-writer.md +0 -0
  33. package/.claude/agents/engineering/engineering-threat-detection-engineer.md +0 -0
  34. package/.claude/agents/engineering/engineering-wechat-mini-program-developer.md +0 -0
  35. package/.claude/agents/github/code-review-swarm.md +0 -0
  36. package/.claude/agents/github/github-modes.md +0 -0
  37. package/.claude/agents/github/issue-tracker.md +0 -0
  38. package/.claude/agents/github/multi-repo-swarm.md +0 -0
  39. package/.claude/agents/github/pr-manager.md +0 -0
  40. package/.claude/agents/github/project-board-sync.md +0 -0
  41. package/.claude/agents/github/release-manager.md +0 -0
  42. package/.claude/agents/github/repo-architect.md +0 -0
  43. package/.claude/agents/github/swarm-issue.md +0 -0
  44. package/.claude/agents/github/swarm-pr.md +0 -0
  45. package/.claude/agents/github/sync-coordinator.md +0 -0
  46. package/.claude/agents/github/workflow-automation.md +0 -0
  47. package/.claude/agents/goal/goal-planner.md +0 -0
  48. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -0
  49. package/.claude/agents/hive-mind/queen-coordinator.md +0 -0
  50. package/.claude/agents/hive-mind/scout-explorer.md +0 -0
  51. package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -0
  52. package/.claude/agents/hive-mind/worker-specialist.md +0 -0
  53. package/.claude/agents/marketing/marketing-competitive-content.md +0 -0
  54. package/.claude/agents/marketing/marketing-cro-specialist.md +0 -0
  55. package/.claude/agents/marketing/marketing-email-specialist.md +0 -0
  56. package/.claude/agents/marketing/marketing-launch-strategist.md +0 -0
  57. package/.claude/agents/marketing/marketing-pricing-strategist.md +0 -0
  58. package/.claude/agents/optimization/benchmark-suite.md +0 -0
  59. package/.claude/agents/optimization/load-balancer.md +0 -0
  60. package/.claude/agents/optimization/performance-monitor.md +0 -0
  61. package/.claude/agents/optimization/resource-allocator.md +0 -0
  62. package/.claude/agents/optimization/topology-optimizer.md +0 -0
  63. package/.claude/agents/schemas/architecture-output.json +0 -0
  64. package/.claude/agents/schemas/code-review-output.json +0 -0
  65. package/.claude/agents/schemas/generic-task-input.json +0 -0
  66. package/.claude/agents/schemas/implementation-output.json +0 -0
  67. package/.claude/agents/schemas/research-output.json +0 -0
  68. package/.claude/agents/schemas/security-audit-output.json +0 -0
  69. package/.claude/agents/schemas/test-report-output.json +0 -0
  70. package/.claude/agents/specialists/integration-architect.md +0 -0
  71. package/.claude/agents/specialized/agentic-identity-trust.md +0 -0
  72. package/.claude/agents/specialized/agents-orchestrator.md +0 -0
  73. package/.claude/agents/specialized/automation-governance-architect.md +0 -0
  74. package/.claude/agents/specialized/blockchain-security-auditor.md +0 -0
  75. package/.claude/agents/specialized/compliance-auditor.md +0 -0
  76. package/.claude/agents/specialized/identity-graph-operator.md +0 -0
  77. package/.claude/agents/specialized/lsp-index-engineer.md +0 -0
  78. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -0
  79. package/.claude/agents/specialized/specialized-cultural-intelligence-strategist.md +0 -0
  80. package/.claude/agents/specialized/specialized-developer-advocate.md +0 -0
  81. package/.claude/agents/specialized/specialized-document-generator.md +0 -0
  82. package/.claude/agents/specialized/specialized-mcp-builder.md +0 -0
  83. package/.claude/agents/specialized/specialized-model-qa.md +0 -0
  84. package/.claude/agents/specialized/specialized-workflow-architect.md +0 -0
  85. package/.claude/agents/specialized/zk-steward.md +0 -0
  86. package/.claude/agents/swarm/mesh-coordinator.md +0 -0
  87. package/.claude/agents/templates/automation-smart-agent.md +0 -0
  88. package/.claude/agents/templates/coordinator-swarm-init.md +0 -0
  89. package/.claude/agents/testing/production-validator.md +0 -0
  90. package/.claude/agents/testing/tdd-london-swarm.md +0 -0
  91. package/.claude/agents/testing/testing-accessibility-auditor.md +0 -0
  92. package/.claude/agents/testing/testing-api-tester.md +0 -0
  93. package/.claude/agents/testing/testing-evidence-collector.md +0 -0
  94. package/.claude/agents/testing/testing-performance-benchmarker.md +0 -0
  95. package/.claude/agents/testing/testing-test-results-analyzer.md +0 -0
  96. package/.claude/agents/testing/testing-tool-evaluator.md +0 -0
  97. package/.claude/agents/testing/testing-workflow-optimizer.md +0 -0
  98. package/.claude/commands/agents/README.md +0 -0
  99. package/.claude/commands/agents/agent-capabilities.md +0 -0
  100. package/.claude/commands/agents/agent-coordination.md +0 -0
  101. package/.claude/commands/agents/agent-spawning.md +0 -0
  102. package/.claude/commands/agents/agent-types.md +0 -0
  103. package/.claude/commands/analysis/README.md +0 -0
  104. package/.claude/commands/analysis/bottleneck-detect.md +0 -0
  105. package/.claude/commands/analysis/performance-bottlenecks.md +0 -0
  106. package/.claude/commands/analysis/performance-report.md +0 -0
  107. package/.claude/commands/analysis/token-usage.md +0 -0
  108. package/.claude/commands/automation/README.md +0 -0
  109. package/.claude/commands/automation/auto-agent.md +0 -0
  110. package/.claude/commands/automation/self-healing.md +0 -0
  111. package/.claude/commands/automation/session-memory.md +0 -0
  112. package/.claude/commands/automation/smart-agents.md +0 -0
  113. package/.claude/commands/automation/smart-spawn.md +0 -0
  114. package/.claude/commands/automation/workflow-select.md +0 -0
  115. package/.claude/commands/coordination/README.md +0 -0
  116. package/.claude/commands/coordination/agent-spawn.md +0 -0
  117. package/.claude/commands/coordination/swarm-init.md +0 -0
  118. package/.claude/commands/coordination/task-orchestrate.md +0 -0
  119. package/.claude/commands/github/README.md +0 -0
  120. package/.claude/commands/github/github-modes.md +0 -0
  121. package/.claude/commands/github/issue-tracker.md +0 -0
  122. package/.claude/commands/github/pr-manager.md +0 -0
  123. package/.claude/commands/github/release-manager.md +0 -0
  124. package/.claude/commands/github/repo-architect.md +0 -0
  125. package/.claude/commands/github/sync-coordinator.md +0 -0
  126. package/.claude/commands/hive-mind/README.md +0 -0
  127. package/.claude/commands/hive-mind/hive-mind-consensus.md +0 -0
  128. package/.claude/commands/hive-mind/hive-mind-init.md +0 -0
  129. package/.claude/commands/hive-mind/hive-mind-memory.md +0 -0
  130. package/.claude/commands/hive-mind/hive-mind-spawn.md +0 -0
  131. package/.claude/commands/hive-mind/hive-mind-status.md +0 -0
  132. package/.claude/commands/hive-mind/hive-mind-stop.md +0 -0
  133. package/.claude/commands/hive-mind/hive-mind.md +0 -0
  134. package/.claude/commands/hooks/README.md +0 -0
  135. package/.claude/commands/hooks/overview.md +0 -0
  136. package/.claude/commands/hooks/post-edit.md +0 -0
  137. package/.claude/commands/hooks/post-task.md +0 -0
  138. package/.claude/commands/hooks/pre-edit.md +0 -0
  139. package/.claude/commands/hooks/pre-task.md +0 -0
  140. package/.claude/commands/hooks/session-end.md +0 -0
  141. package/.claude/commands/hooks/setup.md +0 -0
  142. package/.claude/commands/mastermind/_repeat.md +0 -0
  143. package/.claude/commands/mastermind/_taskfile.md +0 -0
  144. package/.claude/commands/mastermind/adr.md +0 -0
  145. package/.claude/commands/mastermind/approvev1.md +0 -0
  146. package/.claude/commands/mastermind/architect.md +0 -0
  147. package/.claude/commands/mastermind/autodev.md +0 -0
  148. package/.claude/commands/mastermind/brain.md +0 -0
  149. package/.claude/commands/mastermind/budget.md +0 -0
  150. package/.claude/commands/mastermind/build.md +0 -0
  151. package/.claude/commands/mastermind/code-review.md +0 -0
  152. package/.claude/commands/mastermind/content.md +0 -0
  153. package/.claude/commands/mastermind/createorg.md +0 -0
  154. package/.claude/commands/mastermind/createtask.md +0 -0
  155. package/.claude/commands/mastermind/debug.md +0 -0
  156. package/.claude/commands/mastermind/design.md +0 -0
  157. package/.claude/commands/mastermind/do.md +0 -0
  158. package/.claude/commands/mastermind/execute.md +0 -0
  159. package/.claude/commands/mastermind/finance.md +0 -0
  160. package/.claude/commands/mastermind/finish.md +0 -0
  161. package/.claude/commands/mastermind/graph-status.md +0 -0
  162. package/.claude/commands/mastermind/help.md +0 -0
  163. package/.claude/commands/mastermind/idea.md +0 -0
  164. package/.claude/commands/mastermind/ideate.md +0 -0
  165. package/.claude/commands/mastermind/improve.md +0 -0
  166. package/.claude/commands/mastermind/loops.md +0 -0
  167. package/.claude/commands/mastermind/marketing.md +0 -0
  168. package/.claude/commands/mastermind/master.md +0 -0
  169. package/.claude/commands/mastermind/memory.md +0 -0
  170. package/.claude/commands/mastermind/okf-export.md +0 -0
  171. package/.claude/commands/mastermind/okf-import.md +0 -0
  172. package/.claude/commands/mastermind/ops.md +0 -0
  173. package/.claude/commands/mastermind/orgs.md +0 -0
  174. package/.claude/commands/mastermind/orgstatus.md +0 -0
  175. package/.claude/commands/mastermind/plan.md +0 -0
  176. package/.claude/commands/mastermind/receive-review.md +0 -0
  177. package/.claude/commands/mastermind/references/antigravity-tools.md +0 -0
  178. package/.claude/commands/mastermind/references/claude-code-tools.md +0 -0
  179. package/.claude/commands/mastermind/references/codex-tools.md +0 -0
  180. package/.claude/commands/mastermind/references/copilot-tools.md +0 -0
  181. package/.claude/commands/mastermind/references/gemini-tools.md +0 -0
  182. package/.claude/commands/mastermind/references/pi-tools.md +0 -0
  183. package/.claude/commands/mastermind/release.md +0 -0
  184. package/.claude/commands/mastermind/repeat.md +0 -0
  185. package/.claude/commands/mastermind/research.md +0 -0
  186. package/.claude/commands/mastermind/review.md +0 -0
  187. package/.claude/commands/mastermind/runorg.md +0 -0
  188. package/.claude/commands/mastermind/runorgv1.md +0 -0
  189. package/.claude/commands/mastermind/sales.md +0 -0
  190. package/.claude/commands/mastermind/skill-builder.md +0 -0
  191. package/.claude/commands/mastermind/specialagents.md +0 -0
  192. package/.claude/commands/mastermind/stoporg.md +0 -0
  193. package/.claude/commands/mastermind/swarm.md +0 -0
  194. package/.claude/commands/mastermind/taskdev.md +0 -0
  195. package/.claude/commands/mastermind/tdd.md +0 -0
  196. package/.claude/commands/mastermind/techport.md +0 -0
  197. package/.claude/commands/mastermind/topology.md +0 -0
  198. package/.claude/commands/mastermind/understand.md +0 -0
  199. package/.claude/commands/mastermind/verify.md +0 -0
  200. package/.claude/commands/mastermind/worktree.md +0 -0
  201. package/.claude/commands/mastermind.md +0 -0
  202. package/.claude/commands/memory/README.md +0 -0
  203. package/.claude/commands/memory/memory-search.md +0 -0
  204. package/.claude/commands/monitoring/README.md +0 -0
  205. package/.claude/commands/monitoring/agent-metrics.md +0 -0
  206. package/.claude/commands/monitoring/agents.md +0 -0
  207. package/.claude/commands/monitoring/status.md +0 -0
  208. package/.claude/commands/monobrowse.md +0 -0
  209. package/.claude/commands/monoes/README.md +0 -0
  210. package/.claude/commands/monoes/install.md +0 -0
  211. package/.claude/commands/monoes/monoagent.md +0 -0
  212. package/.claude/commands/monoes/monoclip.md +0 -0
  213. package/.claude/commands/monoes/monotask.md +0 -0
  214. package/.claude/commands/monograph/README.md +0 -0
  215. package/.claude/commands/monograph/monograph-build.md +0 -0
  216. package/.claude/commands/monograph/monograph-search.md +0 -0
  217. package/.claude/commands/monograph/monograph-stats.md +0 -0
  218. package/.claude/commands/monograph/monograph-watch.md +0 -0
  219. package/.claude/commands/monograph/monograph-wiki.md +0 -0
  220. package/.claude/commands/optimization/auto-topology.md +0 -0
  221. package/.claude/commands/optimization/performance-optimize.md +0 -0
  222. package/.claude/commands/pair/README.md +0 -0
  223. package/.claude/commands/pair/examples.md +0 -0
  224. package/.claude/commands/pair/modes.md +0 -0
  225. package/.claude/commands/pair/session.md +0 -0
  226. package/.claude/commands/stream-chain/pipeline.md +0 -0
  227. package/.claude/commands/stream-chain/run.md +0 -0
  228. package/.claude/commands/swarm/README.md +0 -0
  229. package/.claude/commands/swarm/analysis.md +0 -0
  230. package/.claude/commands/swarm/development.md +0 -0
  231. package/.claude/commands/swarm/examples.md +0 -0
  232. package/.claude/commands/swarm/maintenance.md +0 -0
  233. package/.claude/commands/swarm/optimization.md +0 -0
  234. package/.claude/commands/swarm/research.md +0 -0
  235. package/.claude/commands/swarm/swarm.md +0 -0
  236. package/.claude/commands/swarm/testing.md +0 -0
  237. package/.claude/commands/tokens.md +0 -0
  238. package/.claude/commands/truth/start.md +0 -0
  239. package/.claude/commands/ts.md +0 -0
  240. package/.claude/commands/workflows/README.md +0 -0
  241. package/.claude/commands/workflows/development.md +0 -0
  242. package/.claude/commands/workflows/research.md +0 -0
  243. package/.claude/commands/workflows/workflow-create.md +0 -0
  244. package/.claude/commands/workflows/workflow-execute.md +0 -0
  245. package/.claude/commands/workflows/workflow-export.md +0 -0
  246. package/.claude/helpers/control-start.cjs +0 -0
  247. package/.claude/helpers/control-stop.cjs +0 -0
  248. package/.claude/helpers/event-logger.cjs +0 -0
  249. package/.claude/helpers/extras-registry.json +0 -0
  250. package/.claude/helpers/graphify-freshen.cjs +0 -0
  251. package/.claude/helpers/handlers/adr-draft-handler.cjs +0 -0
  252. package/.claude/helpers/handlers/agent-start-handler.cjs +0 -0
  253. package/.claude/helpers/handlers/budget-status-handler.cjs +0 -0
  254. package/.claude/helpers/handlers/capture-handler.cjs +0 -0
  255. package/.claude/helpers/handlers/compact-handler.cjs +0 -0
  256. package/.claude/helpers/handlers/edit-handler.cjs +0 -0
  257. package/.claude/helpers/handlers/gates-handler.cjs +0 -0
  258. package/.claude/helpers/handlers/graph-status-handler.cjs +0 -0
  259. package/.claude/helpers/handlers/loops-status-handler.cjs +0 -0
  260. package/.claude/helpers/handlers/route-handler.cjs +0 -0
  261. package/.claude/helpers/handlers/session-handler.cjs +0 -0
  262. package/.claude/helpers/handlers/session-restore-handler.cjs +0 -0
  263. package/.claude/helpers/handlers/stats-handler.cjs +0 -0
  264. package/.claude/helpers/handlers/task-handler.cjs +0 -0
  265. package/.claude/helpers/intelligence.cjs +0 -0
  266. package/.claude/helpers/learning-service.mjs +0 -0
  267. package/.claude/helpers/loop-tracker.cjs +0 -0
  268. package/.claude/helpers/mastermind-activate.cjs +0 -0
  269. package/.claude/helpers/memory-palace.cjs +0 -0
  270. package/.claude/helpers/memory.cjs +0 -0
  271. package/.claude/helpers/metrics-db.mjs +0 -0
  272. package/.claude/helpers/monolean-activate.cjs +0 -0
  273. package/.claude/helpers/monolean-config.cjs +0 -0
  274. package/.claude/helpers/monolean-instructions.cjs +0 -0
  275. package/.claude/helpers/monolean-propagate.cjs +0 -0
  276. package/.claude/helpers/monolean-tracker.cjs +0 -0
  277. package/.claude/helpers/router.cjs +0 -0
  278. package/.claude/helpers/session.cjs +0 -0
  279. package/.claude/helpers/skill-registry.json +0 -0
  280. package/.claude/helpers/statusline.cjs +0 -0
  281. package/.claude/helpers/toggle-statusline.cjs +0 -0
  282. package/.claude/helpers/token-tracker.cjs +0 -0
  283. package/.claude/helpers/utils/agent-registrations.cjs +0 -0
  284. package/.claude/helpers/utils/fs-helpers.cjs +0 -0
  285. package/.claude/helpers/utils/micro-agents.cjs +0 -0
  286. package/.claude/helpers/utils/monograph.cjs +0 -0
  287. package/.claude/helpers/utils/system-pressure.cjs +0 -0
  288. package/.claude/helpers/utils/telemetry.cjs +0 -0
  289. package/.claude/settings.json +0 -0
  290. package/.claude/skills/agent-browser-testing/SKILL.md +0 -0
  291. package/.claude/skills/agentic-jujutsu/SKILL.md +0 -0
  292. package/.claude/skills/github-issue-triage/SKILL.md +0 -0
  293. package/.claude/skills/github-repo-recap/SKILL.md +0 -0
  294. package/.claude/skills/hive-mind-advanced/SKILL.md +0 -0
  295. package/.claude/skills/hooks-automation/SKILL.md +0 -0
  296. package/.claude/skills/mastermind-access/SKILL.md +0 -0
  297. package/.claude/skills/mastermind-activity/SKILL.md +0 -0
  298. package/.claude/skills/mastermind-adapter-manager/SKILL.md +0 -0
  299. package/.claude/skills/mastermind-adapters/SKILL.md +0 -0
  300. package/.claude/skills/mastermind-agent-detail/SKILL.md +0 -0
  301. package/.claude/skills/mastermind-agent-select/SKILL.md +0 -0
  302. package/.claude/skills/mastermind-agents/SKILL.md +0 -0
  303. package/.claude/skills/mastermind-approval-detail/SKILL.md +0 -0
  304. package/.claude/skills/mastermind-approvev1/SKILL.md +0 -0
  305. package/.claude/skills/mastermind-architect/SKILL.md +0 -0
  306. package/.claude/skills/mastermind-autodev/SKILL.md +0 -0
  307. package/.claude/skills/mastermind-backup/SKILL.md +0 -0
  308. package/.claude/skills/mastermind-bootstrap/SKILL.md +0 -0
  309. package/.claude/skills/mastermind-budgets/SKILL.md +0 -0
  310. package/.claude/skills/mastermind-build/SKILL.md +0 -0
  311. package/.claude/skills/mastermind-companies/SKILL.md +0 -0
  312. package/.claude/skills/mastermind-content/SKILL.md +0 -0
  313. package/.claude/skills/mastermind-costs/SKILL.md +0 -0
  314. package/.claude/skills/mastermind-createorg/SKILL.md +0 -0
  315. package/.claude/skills/mastermind-debug/SKILL.md +0 -0
  316. package/.claude/skills/mastermind-delegation/SKILL.md +0 -0
  317. package/.claude/skills/mastermind-design/SKILL.md +0 -0
  318. package/.claude/skills/mastermind-diagnose/SKILL.md +0 -0
  319. package/.claude/skills/mastermind-env/SKILL.md +0 -0
  320. package/.claude/skills/mastermind-environments/SKILL.md +0 -0
  321. package/.claude/skills/mastermind-execute/SKILL.md +0 -0
  322. package/.claude/skills/mastermind-export/SKILL.md +0 -0
  323. package/.claude/skills/mastermind-finance/SKILL.md +0 -0
  324. package/.claude/skills/mastermind-finish/SKILL.md +0 -0
  325. package/.claude/skills/mastermind-goal-detail/SKILL.md +0 -0
  326. package/.claude/skills/mastermind-goals/SKILL.md +0 -0
  327. package/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -0
  328. package/.claude/skills/mastermind-idea/SKILL.md +0 -0
  329. package/.claude/skills/mastermind-import/SKILL.md +0 -0
  330. package/.claude/skills/mastermind-inbox/SKILL.md +0 -0
  331. package/.claude/skills/mastermind-instance/SKILL.md +0 -0
  332. package/.claude/skills/mastermind-instance-settings/SKILL.md +0 -0
  333. package/.claude/skills/mastermind-intake/SKILL.md +0 -0
  334. package/.claude/skills/mastermind-invite-landing/SKILL.md +0 -0
  335. package/.claude/skills/mastermind-invites/SKILL.md +0 -0
  336. package/.claude/skills/mastermind-issue-detail/SKILL.md +0 -0
  337. package/.claude/skills/mastermind-issues/SKILL.md +0 -0
  338. package/.claude/skills/mastermind-join-queue/SKILL.md +0 -0
  339. package/.claude/skills/mastermind-liveness/SKILL.md +0 -0
  340. package/.claude/skills/mastermind-marketing/SKILL.md +0 -0
  341. package/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -0
  342. package/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -0
  343. package/.claude/skills/mastermind-memory/SKILL.md +0 -0
  344. package/.claude/skills/mastermind-monitor/SKILL.md +0 -0
  345. package/.claude/skills/mastermind-monotask/SKILL.md +0 -0
  346. package/.claude/skills/mastermind-my-issues/SKILL.md +0 -0
  347. package/.claude/skills/mastermind-new-agent/SKILL.md +0 -0
  348. package/.claude/skills/mastermind-ops/SKILL.md +0 -0
  349. package/.claude/skills/mastermind-org-chart/SKILL.md +0 -0
  350. package/.claude/skills/mastermind-org-settings/SKILL.md +0 -0
  351. package/.claude/skills/mastermind-orgs/SKILL.md +0 -0
  352. package/.claude/skills/mastermind-orgstatus/SKILL.md +0 -0
  353. package/.claude/skills/mastermind-plan/SKILL.md +0 -0
  354. package/.claude/skills/mastermind-plan-to-tasks/SKILL.md +0 -0
  355. package/.claude/skills/mastermind-plugin-manager/SKILL.md +0 -0
  356. package/.claude/skills/mastermind-plugin-settings/SKILL.md +0 -0
  357. package/.claude/skills/mastermind-plugins/SKILL.md +0 -0
  358. package/.claude/skills/mastermind-profile/SKILL.md +0 -0
  359. package/.claude/skills/mastermind-project-detail/SKILL.md +0 -0
  360. package/.claude/skills/mastermind-project-workspace/SKILL.md +0 -0
  361. package/.claude/skills/mastermind-projects/SKILL.md +0 -0
  362. package/.claude/skills/mastermind-protocol/SKILL.md +0 -0
  363. package/.claude/skills/mastermind-receive-review/SKILL.md +0 -0
  364. package/.claude/skills/mastermind-release/SKILL.md +0 -0
  365. package/.claude/skills/mastermind-repeat/SKILL.md +0 -0
  366. package/.claude/skills/mastermind-research/SKILL.md +0 -0
  367. package/.claude/skills/mastermind-review/SKILL.md +0 -0
  368. package/.claude/skills/mastermind-routine-detail/SKILL.md +0 -0
  369. package/.claude/skills/mastermind-routines/SKILL.md +0 -0
  370. package/.claude/skills/mastermind-runorg/SKILL.md +0 -0
  371. package/.claude/skills/mastermind-runorgv1/SKILL.md +0 -0
  372. package/.claude/skills/mastermind-sales/SKILL.md +0 -0
  373. package/.claude/skills/mastermind-search/SKILL.md +0 -0
  374. package/.claude/skills/mastermind-secrets/SKILL.md +0 -0
  375. package/.claude/skills/mastermind-skill-builder/SKILL.md +0 -0
  376. package/.claude/skills/mastermind-skills/SKILL.md +0 -0
  377. package/.claude/skills/mastermind-stoporg/SKILL.md +0 -0
  378. package/.claude/skills/mastermind-taskdev/SKILL.md +0 -0
  379. package/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -0
  380. package/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -0
  381. package/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -0
  382. package/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -0
  383. package/.claude/skills/mastermind-tasks/SKILL.md +0 -0
  384. package/.claude/skills/mastermind-tdd/SKILL.md +0 -0
  385. package/.claude/skills/mastermind-techport/SKILL.md +0 -0
  386. package/.claude/skills/mastermind-threads/SKILL.md +0 -0
  387. package/.claude/skills/mastermind-tree-control/SKILL.md +0 -0
  388. package/.claude/skills/mastermind-verify/SKILL.md +0 -0
  389. package/.claude/skills/mastermind-wiki/SKILL.md +0 -0
  390. package/.claude/skills/mastermind-workspace-detail/SKILL.md +0 -0
  391. package/.claude/skills/mastermind-workspaces/SKILL.md +0 -0
  392. package/.claude/skills/mastermind-worktree/SKILL.md +0 -0
  393. package/.claude/skills/monodesign/SKILL.md +0 -0
  394. package/.claude/skills/monodesign/adapt.md +0 -0
  395. package/.claude/skills/monodesign/agents/monodesign-asset-producer.md +0 -0
  396. package/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +0 -0
  397. package/.claude/skills/monodesign/animate.md +0 -0
  398. package/.claude/skills/monodesign/audit.md +0 -0
  399. package/.claude/skills/monodesign/bolder.md +0 -0
  400. package/.claude/skills/monodesign/clarify.md +0 -0
  401. package/.claude/skills/monodesign/colorize.md +0 -0
  402. package/.claude/skills/monodesign/craft.md +0 -0
  403. package/.claude/skills/monodesign/critique.md +0 -0
  404. package/.claude/skills/monodesign/delight.md +0 -0
  405. package/.claude/skills/monodesign/distill.md +0 -0
  406. package/.claude/skills/monodesign/document.md +0 -0
  407. package/.claude/skills/monodesign/extract.md +0 -0
  408. package/.claude/skills/monodesign/harden.md +0 -0
  409. package/.claude/skills/monodesign/init.md +0 -0
  410. package/.claude/skills/monodesign/layout.md +0 -0
  411. package/.claude/skills/monodesign/live.md +0 -0
  412. package/.claude/skills/monodesign/onboard.md +0 -0
  413. package/.claude/skills/monodesign/optimize.md +0 -0
  414. package/.claude/skills/monodesign/overdrive.md +0 -0
  415. package/.claude/skills/monodesign/polish.md +0 -0
  416. package/.claude/skills/monodesign/quieter.md +0 -0
  417. package/.claude/skills/monodesign/reference/adapt.md +0 -0
  418. package/.claude/skills/monodesign/reference/adapt.native.md +0 -0
  419. package/.claude/skills/monodesign/reference/android.md +0 -0
  420. package/.claude/skills/monodesign/reference/animate.md +0 -0
  421. package/.claude/skills/monodesign/reference/antipatterns-catalog.md +0 -0
  422. package/.claude/skills/monodesign/reference/audit.md +0 -0
  423. package/.claude/skills/monodesign/reference/audit.native.md +0 -0
  424. package/.claude/skills/monodesign/reference/bolder.md +0 -0
  425. package/.claude/skills/monodesign/reference/brand-workflow.md +0 -0
  426. package/.claude/skills/monodesign/reference/brand.md +0 -0
  427. package/.claude/skills/monodesign/reference/clarify.md +0 -0
  428. package/.claude/skills/monodesign/reference/codex.md +0 -0
  429. package/.claude/skills/monodesign/reference/cognitive-load.md +0 -0
  430. package/.claude/skills/monodesign/reference/color-and-contrast.md +0 -0
  431. package/.claude/skills/monodesign/reference/colorize.md +0 -0
  432. package/.claude/skills/monodesign/reference/component-specs.md +0 -0
  433. package/.claude/skills/monodesign/reference/component-states.md +0 -0
  434. package/.claude/skills/monodesign/reference/component-system.md +0 -0
  435. package/.claude/skills/monodesign/reference/copy-formulas.md +0 -0
  436. package/.claude/skills/monodesign/reference/craft.md +0 -0
  437. package/.claude/skills/monodesign/reference/critique.md +0 -0
  438. package/.claude/skills/monodesign/reference/delight.md +0 -0
  439. package/.claude/skills/monodesign/reference/design-principles.md +0 -0
  440. package/.claude/skills/monodesign/reference/distill.md +0 -0
  441. package/.claude/skills/monodesign/reference/document.md +0 -0
  442. package/.claude/skills/monodesign/reference/extract.md +0 -0
  443. package/.claude/skills/monodesign/reference/harden.md +0 -0
  444. package/.claude/skills/monodesign/reference/heuristics-scoring.md +0 -0
  445. package/.claude/skills/monodesign/reference/hooks.md +0 -0
  446. package/.claude/skills/monodesign/reference/image-prompts.md +0 -0
  447. package/.claude/skills/monodesign/reference/init.md +0 -0
  448. package/.claude/skills/monodesign/reference/interaction-design.md +0 -0
  449. package/.claude/skills/monodesign/reference/ios.md +0 -0
  450. package/.claude/skills/monodesign/reference/layout.md +0 -0
  451. package/.claude/skills/monodesign/reference/live.md +0 -0
  452. package/.claude/skills/monodesign/reference/motion-design.md +0 -0
  453. package/.claude/skills/monodesign/reference/onboard.md +0 -0
  454. package/.claude/skills/monodesign/reference/optimize.md +0 -0
  455. package/.claude/skills/monodesign/reference/overdrive.md +0 -0
  456. package/.claude/skills/monodesign/reference/personas.md +0 -0
  457. package/.claude/skills/monodesign/reference/polish.md +0 -0
  458. package/.claude/skills/monodesign/reference/pre-delivery-checklist.md +0 -0
  459. package/.claude/skills/monodesign/reference/product.md +0 -0
  460. package/.claude/skills/monodesign/reference/quieter.md +0 -0
  461. package/.claude/skills/monodesign/reference/responsive-design.md +0 -0
  462. package/.claude/skills/monodesign/reference/shape.md +0 -0
  463. package/.claude/skills/monodesign/reference/spatial-design.md +0 -0
  464. package/.claude/skills/monodesign/reference/teach.md +0 -0
  465. package/.claude/skills/monodesign/reference/token-architecture.md +0 -0
  466. package/.claude/skills/monodesign/reference/typeset.md +0 -0
  467. package/.claude/skills/monodesign/reference/typography.md +0 -0
  468. package/.claude/skills/monodesign/reference/ux-research.md +0 -0
  469. package/.claude/skills/monodesign/reference/ux-rules.md +0 -0
  470. package/.claude/skills/monodesign/reference/ux-writing.md +0 -0
  471. package/.claude/skills/monodesign/scripts/command-metadata.json +0 -0
  472. package/.claude/skills/monodesign/scripts/context-signals.mjs +0 -0
  473. package/.claude/skills/monodesign/scripts/context.mjs +0 -0
  474. package/.claude/skills/monodesign/scripts/critique-storage.mjs +0 -0
  475. package/.claude/skills/monodesign/scripts/detect-csp.mjs +0 -0
  476. package/.claude/skills/monodesign/scripts/detect.mjs +0 -0
  477. package/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +0 -0
  478. package/.claude/skills/monodesign/scripts/detector/cli/main.mjs +0 -0
  479. package/.claude/skills/monodesign/scripts/detector/design-system.mjs +0 -0
  480. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +0 -0
  481. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +0 -0
  482. package/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +0 -0
  483. package/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +0 -0
  484. package/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +0 -0
  485. package/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +0 -0
  486. package/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +0 -0
  487. package/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -0
  488. package/.claude/skills/monodesign/scripts/detector/findings.mjs +0 -0
  489. package/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +0 -0
  490. package/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +0 -0
  491. package/.claude/skills/monodesign/scripts/detector/fix/index.mjs +0 -0
  492. package/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +0 -0
  493. package/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +0 -0
  494. package/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +0 -0
  495. package/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +0 -0
  496. package/.claude/skills/monodesign/scripts/detector/shared/color.mjs +0 -0
  497. package/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +0 -0
  498. package/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +0 -0
  499. package/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +0 -0
  500. package/.claude/skills/monodesign/scripts/detector/shared/page.mjs +0 -0
  501. package/.claude/skills/monodesign/scripts/hook-admin.mjs +0 -0
  502. package/.claude/skills/monodesign/scripts/hook-before-edit.mjs +0 -0
  503. package/.claude/skills/monodesign/scripts/hook-lib.mjs +0 -0
  504. package/.claude/skills/monodesign/scripts/hook.mjs +0 -0
  505. package/.claude/skills/monodesign/scripts/lib/design-parser.mjs +0 -0
  506. package/.claude/skills/monodesign/scripts/lib/is-generated.mjs +0 -0
  507. package/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +0 -0
  508. package/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +0 -0
  509. package/.claude/skills/monodesign/scripts/lib/provider.mjs +0 -0
  510. package/.claude/skills/monodesign/scripts/lib/target-args.mjs +0 -0
  511. package/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +0 -0
  512. package/.claude/skills/monodesign/scripts/live/completion.mjs +0 -0
  513. package/.claude/skills/monodesign/scripts/live/event-validation.mjs +0 -0
  514. package/.claude/skills/monodesign/scripts/live/insert-ui.mjs +0 -0
  515. package/.claude/skills/monodesign/scripts/live/manual-apply.mjs +0 -0
  516. package/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +0 -0
  517. package/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +0 -0
  518. package/.claude/skills/monodesign/scripts/live/session-store.mjs +0 -0
  519. package/.claude/skills/monodesign/scripts/live/svelte-component.mjs +0 -0
  520. package/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +0 -0
  521. package/.claude/skills/monodesign/scripts/live/ui-core.mjs +0 -0
  522. package/.claude/skills/monodesign/scripts/live/vocabulary.mjs +0 -0
  523. package/.claude/skills/monodesign/scripts/live-accept.mjs +0 -0
  524. package/.claude/skills/monodesign/scripts/live-browser-dom.js +0 -0
  525. package/.claude/skills/monodesign/scripts/live-browser-session.js +0 -0
  526. package/.claude/skills/monodesign/scripts/live-browser.js +0 -0
  527. package/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +0 -0
  528. package/.claude/skills/monodesign/scripts/live-complete.mjs +0 -0
  529. package/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +0 -0
  530. package/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +0 -0
  531. package/.claude/skills/monodesign/scripts/live-inject.mjs +0 -0
  532. package/.claude/skills/monodesign/scripts/live-insert.mjs +0 -0
  533. package/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +0 -0
  534. package/.claude/skills/monodesign/scripts/live-poll.mjs +0 -0
  535. package/.claude/skills/monodesign/scripts/live-resume.mjs +0 -0
  536. package/.claude/skills/monodesign/scripts/live-server.mjs +0 -0
  537. package/.claude/skills/monodesign/scripts/live-status.mjs +0 -0
  538. package/.claude/skills/monodesign/scripts/live-target.mjs +0 -0
  539. package/.claude/skills/monodesign/scripts/live-wrap.mjs +0 -0
  540. package/.claude/skills/monodesign/scripts/live.mjs +0 -0
  541. package/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +0 -0
  542. package/.claude/skills/monodesign/scripts/palette.mjs +0 -0
  543. package/.claude/skills/monodesign/scripts/pin.mjs +0 -0
  544. package/.claude/skills/monodesign/shape.md +0 -0
  545. package/.claude/skills/monodesign/teach.md +0 -0
  546. package/.claude/skills/monodesign/typeset.md +0 -0
  547. package/.claude/skills/monolean/SKILL.md +0 -0
  548. package/.claude/skills/monolean-audit/SKILL.md +0 -0
  549. package/.claude/skills/monolean-debt/SKILL.md +0 -0
  550. package/.claude/skills/monolean-help/SKILL.md +0 -0
  551. package/.claude/skills/monolean-review/SKILL.md +0 -0
  552. package/.claude/skills/monomind/browse-agentcore.md +0 -0
  553. package/.claude/skills/monomind/browse-electron.md +0 -0
  554. package/.claude/skills/monomind/browse-qa.md +0 -0
  555. package/.claude/skills/monomind/browse-references/authentication.md +0 -0
  556. package/.claude/skills/monomind/browse-references/trust-boundaries.md +0 -0
  557. package/.claude/skills/monomind/browse-references/video-recording.md +0 -0
  558. package/.claude/skills/monomind/browse-slack.md +0 -0
  559. package/.claude/skills/monomind/browse-vercel.md +0 -0
  560. package/.claude/skills/monomind/browse.md +0 -0
  561. package/.claude/skills/monomotion/SKILL.md +0 -0
  562. package/.claude/skills/monomotion/rules/api-control.md +0 -0
  563. package/.claude/skills/monomotion/rules/effects.md +0 -0
  564. package/.claude/skills/monomotion/rules/integration.md +0 -0
  565. package/.claude/skills/monomotion/rules/scroll.md +0 -0
  566. package/.claude/skills/monomotion/rules/sequencing.md +0 -0
  567. package/.claude/skills/monomotion/rules/svg.md +0 -0
  568. package/.claude/skills/monomotion/rules/text.md +0 -0
  569. package/.claude/skills/pair-programming/SKILL.md +0 -0
  570. package/.claude/skills/performance-analysis/SKILL.md +0 -0
  571. package/.claude/skills/skill-builder/SKILL.md +0 -0
  572. package/.claude/skills/specialagent/SKILL.md +0 -0
  573. package/.claude/skills/stop-slop/SKILL.md +0 -0
  574. package/.claude/skills/stop-slop/references/examples.md +0 -0
  575. package/.claude/skills/stop-slop/references/phrases.md +0 -0
  576. package/.claude/skills/stop-slop/references/structures.md +0 -0
  577. package/.claude/skills/swarm-advanced/SKILL.md +0 -0
  578. package/.claude/skills/swarm-orchestration/SKILL.md +0 -0
  579. package/.claude/skills/verification-quality/SKILL.md +0 -0
  580. package/README.md +0 -0
  581. package/bin/preinstall.cjs +0 -0
  582. package/dist/src/ui/dashboard.html +666 -177
  583. package/dist/src/ui/server.mjs +275 -0
  584. package/dist/tsconfig.tsbuildinfo +1 -1
  585. package/package.json +2 -2
  586. package/scripts/deploy-ipfs-node.sh +0 -0
  587. package/scripts/setup-ipfs-registry.md +0 -0
  588. package/scripts/understand-analyze.mjs +0 -0
  589. package/.claude/skills/github-toolkit/SKILL.md +0 -60
  590. package/.claude/skills/memory-toolkit/SKILL.md +0 -75
@@ -1874,6 +1874,22 @@ export async function startServer({ port = 4242, projectDir, openBrowser = true
1874
1874
  return;
1875
1875
  }
1876
1876
 
1877
+ // GET /api/adr-file?file=<name>&dir=<dir> — read a single ADR markdown file
1878
+ if (req.method === 'GET' && url === '/api/adr-file') {
1879
+ try {
1880
+ const qs = new URL(req.url, 'http://localhost').searchParams;
1881
+ const dir = qs.get('dir') || projectDir || process.cwd();
1882
+ const fname = (qs.get('file') || '').replace(/[/\\]/g, '');
1883
+ if (!fname || !fname.endsWith('.md')) { res.writeHead(400); res.end('{"error":"invalid file"}'); return; }
1884
+ const fpath = path.join(path.resolve(dir), 'docs', 'adrs', fname);
1885
+ if (!fs.existsSync(fpath)) { res.writeHead(404); res.end('{"error":"not found"}'); return; }
1886
+ const content = fs.readFileSync(fpath, 'utf8');
1887
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
1888
+ res.end(JSON.stringify({ file: fname, content }));
1889
+ } catch (err) { res.writeHead(500); res.end(JSON.stringify({ error: err.message })); }
1890
+ return;
1891
+ }
1892
+
1877
1893
  // ------------------------------------------------------- GET /api/memory-files
1878
1894
  if (req.method === 'GET' && url === '/api/memory-files') {
1879
1895
  try {
@@ -6315,6 +6331,265 @@ new Sigma(g,document.getElementById('g'),{renderEdgeLabels:false,labelColor:{col
6315
6331
  return;
6316
6332
  }
6317
6333
 
6334
+ // GET /api/second-brain-metrics — aggregated injection analytics from second-brain.jsonl
6335
+ if (req.method === 'GET' && url === '/api/second-brain-metrics') {
6336
+ try {
6337
+ const metricsFile = path.join(projectDir || process.cwd(), '.monomind', 'metrics', 'second-brain.jsonl');
6338
+ if (!fs.existsSync(metricsFile)) {
6339
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6340
+ res.end(JSON.stringify({ total: 0, injected: 0, hitRate: 0, methods: {}, avgScore: 0, sparkline: [], scores: [] }));
6341
+ return;
6342
+ }
6343
+ const raw = fs.readFileSync(metricsFile, 'utf8');
6344
+ const entries = raw.split('\n').filter(Boolean).map(l => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean);
6345
+ const total = entries.length;
6346
+ const injectedCount = entries.filter(e => e.injected).length;
6347
+ const hitRate = total > 0 ? injectedCount / total : 0;
6348
+ // Method distribution
6349
+ const methods = {};
6350
+ for (const e of entries) { const m = e.method || 'unknown'; methods[m] = (methods[m] || 0) + 1; }
6351
+ // Average top score (only for entries with hits)
6352
+ const withScores = entries.filter(e => typeof e.topScore === 'number' && e.topScore !== null);
6353
+ const avgScore = withScores.length > 0 ? withScores.reduce((s, e) => s + e.topScore, 0) / withScores.length : 0;
6354
+ // Score distribution buckets
6355
+ const scoreBuckets = [0, 0, 0, 0, 0]; // <0.3, 0.3-0.5, 0.5-0.7, 0.7-0.9, 0.9+
6356
+ for (const e of withScores) {
6357
+ const s = e.topScore;
6358
+ if (s < 0.3) scoreBuckets[0]++;
6359
+ else if (s < 0.5) scoreBuckets[1]++;
6360
+ else if (s < 0.7) scoreBuckets[2]++;
6361
+ else if (s < 0.9) scoreBuckets[3]++;
6362
+ else scoreBuckets[4]++;
6363
+ }
6364
+ // Sparkline: group by hour for last 24h, then by day for older
6365
+ const now = Date.now();
6366
+ const h24 = now - 86400000;
6367
+ const sparkline = [];
6368
+ // Last 24 hours in 2h buckets
6369
+ for (let t = h24; t < now; t += 7200000) {
6370
+ const bucket = entries.filter(e => e.ts >= t && e.ts < t + 7200000);
6371
+ const inj = bucket.filter(e => e.injected).length;
6372
+ sparkline.push({ t, total: bucket.length, injected: inj });
6373
+ }
6374
+ // Top sources from recent entries (last 200)
6375
+ const recentSlice = entries.slice(-200);
6376
+ const misses = recentSlice.filter(e => !e.injected).length;
6377
+ // Route overrides (misroute counts)
6378
+ let routeOverrides = {};
6379
+ try {
6380
+ const overridesFile = path.join(projectDir || process.cwd(), '.monomind', 'metrics', 'route-overrides.json');
6381
+ if (fs.existsSync(overridesFile)) routeOverrides = JSON.parse(fs.readFileSync(overridesFile, 'utf8'));
6382
+ } catch {}
6383
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6384
+ res.end(JSON.stringify({ total, injected: injectedCount, hitRate: +hitRate.toFixed(3), methods, avgScore: +avgScore.toFixed(3), sparkline, scoreBuckets, recentMisses: misses, recentTotal: recentSlice.length, routeOverrides }));
6385
+ } catch (err) {
6386
+ res.writeHead(500, { 'Content-Type': 'application/json' });
6387
+ res.end(JSON.stringify({ error: err.message }));
6388
+ }
6389
+ return;
6390
+ }
6391
+
6392
+ // POST /api/second-brain-route — show query router decision for a given query
6393
+ if (req.method === 'POST' && url === '/api/second-brain-route') {
6394
+ let body = '';
6395
+ req.on('data', c => { body += c; if (body.length > 65536) { req.destroy(); return; } });
6396
+ req.on('end', async () => {
6397
+ try {
6398
+ const { query } = JSON.parse(body || '{}');
6399
+ if (!query) { res.writeHead(400, { 'Content-Type': 'application/json' }); res.end('{"error":"query required"}'); return; }
6400
+ const routerMod = await import('../memory/query-router.js');
6401
+ const route = routerMod.routeQuery(String(query).slice(0, 2000));
6402
+ const overrides = routerMod.getRouteOverrides(true);
6403
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6404
+ res.end(JSON.stringify({ route, overrides }));
6405
+ } catch (err) {
6406
+ res.writeHead(500, { 'Content-Type': 'application/json' });
6407
+ res.end(JSON.stringify({ error: err.message }));
6408
+ }
6409
+ });
6410
+ return;
6411
+ }
6412
+
6413
+ // GET/PUT /api/second-brain-config — read/write Second Brain config (.monomind/second-brain.json)
6414
+ if ((req.method === 'GET' || req.method === 'PUT') && url === '/api/second-brain-config') {
6415
+ const configFile = path.join(projectDir || process.cwd(), '.monomind', 'second-brain.json');
6416
+ if (req.method === 'GET') {
6417
+ try {
6418
+ let config = { relevanceFloor: 0.35, injectionLimit: 5 };
6419
+ try { config = { ...config, ...JSON.parse(fs.readFileSync(configFile, 'utf8')) }; } catch {}
6420
+ // Auto-tune suggestion: analyze telemetry to suggest optimal floor
6421
+ let suggestion = null;
6422
+ try {
6423
+ const metricsFile = path.join(projectDir || process.cwd(), '.monomind', 'metrics', 'second-brain.jsonl');
6424
+ if (fs.existsSync(metricsFile)) {
6425
+ const entries = fs.readFileSync(metricsFile, 'utf8').split('\n').filter(Boolean)
6426
+ .map(l => { try { return JSON.parse(l); } catch { return null; } }).filter(Boolean);
6427
+ const withScores = entries.filter(e => typeof e.topScore === 'number' && e.topScore !== null);
6428
+ if (withScores.length >= 20) {
6429
+ const scores = withScores.map(e => e.topScore).sort((a, b) => a - b);
6430
+ const p25 = scores[Math.floor(scores.length * 0.25)];
6431
+ const hitRate = entries.filter(e => e.injected).length / entries.length;
6432
+ // If hit rate is very low (<30%), suggest lowering floor
6433
+ // If hit rate is very high (>80%) with low avg scores, suggest raising
6434
+ if (hitRate < 0.3 && p25 > 0.2) suggestion = { floor: +(p25 - 0.05).toFixed(2), reason: 'Low hit rate (' + (hitRate * 100).toFixed(0) + '%) — lowering floor may surface more relevant results' };
6435
+ else if (hitRate > 0.8 && scores[Math.floor(scores.length * 0.1)] < 0.35) suggestion = { floor: 0.4, reason: 'High hit rate with low-quality matches — raising floor filters noise' };
6436
+ }
6437
+ }
6438
+ } catch {}
6439
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6440
+ res.end(JSON.stringify({ config, suggestion }));
6441
+ } catch (err) {
6442
+ res.writeHead(500, { 'Content-Type': 'application/json' });
6443
+ res.end(JSON.stringify({ error: err.message }));
6444
+ }
6445
+ return;
6446
+ }
6447
+ if (req.method === 'PUT') {
6448
+ let body = '';
6449
+ req.on('data', c => { body += c; if (body.length > 4096) { req.destroy(); return; } });
6450
+ req.on('end', () => {
6451
+ try {
6452
+ const raw = JSON.parse(body || '{}');
6453
+ const updates = {};
6454
+ if (typeof raw.relevanceFloor === 'number' && raw.relevanceFloor >= 0 && raw.relevanceFloor <= 1) updates.relevanceFloor = raw.relevanceFloor;
6455
+ if (typeof raw.injectionLimit === 'number' && raw.injectionLimit >= 1 && raw.injectionLimit <= 50) updates.injectionLimit = Math.floor(raw.injectionLimit);
6456
+ if (Object.keys(updates).length === 0) { res.writeHead(400, { 'Content-Type': 'application/json' }); res.end('{"error":"no valid fields to update"}'); return; }
6457
+ let config = {};
6458
+ try { config = JSON.parse(fs.readFileSync(configFile, 'utf8')); } catch {}
6459
+ config = { ...config, ...updates };
6460
+ fs.mkdirSync(path.dirname(configFile), { recursive: true });
6461
+ fs.writeFileSync(configFile, JSON.stringify(config, null, 2));
6462
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6463
+ res.end(JSON.stringify({ ok: true, config }));
6464
+ } catch (err) {
6465
+ res.writeHead(500, { 'Content-Type': 'application/json' });
6466
+ res.end(JSON.stringify({ error: err.message }));
6467
+ }
6468
+ });
6469
+ return;
6470
+ }
6471
+ }
6472
+
6473
+ // GET /api/second-brain-docs — document-level view from doc-metadata.jsonl
6474
+ if (req.method === 'GET' && url === '/api/second-brain-docs') {
6475
+ try {
6476
+ const d = path.resolve(projectDir || process.cwd());
6477
+ const metaFile = path.join(d, '.monomind', 'knowledge', 'doc-metadata.jsonl');
6478
+ // Also check global brain
6479
+ const globalDir = process.env.MONOMIND_GLOBAL_BRAIN_DIR || path.join(os.homedir(), '.monomind', 'global-brain');
6480
+ const globalMetaFile = path.join(globalDir, '.monomind', 'knowledge', 'doc-metadata.jsonl');
6481
+ const docs = [];
6482
+ let totalSize = 0, totalChunks = 0;
6483
+ for (const [file, scope] of [[metaFile, 'project'], [globalMetaFile, 'global']]) {
6484
+ if (!fs.existsSync(file)) continue;
6485
+ const latest = new Map();
6486
+ for (const l of fs.readFileSync(file, 'utf8').split('\n')) {
6487
+ if (!l.trim()) continue;
6488
+ try {
6489
+ const m = JSON.parse(l);
6490
+ latest.set(m.filePath + ' ' + m.scope, m);
6491
+ } catch {}
6492
+ }
6493
+ for (const m of latest.values()) {
6494
+ if (m.chunkCount < 0) continue;
6495
+ const exists = fs.existsSync(m.filePath);
6496
+ docs.push({ ...m, brainScope: scope, exists, name: path.basename(m.filePath) });
6497
+ totalSize += m.size || 0;
6498
+ totalChunks += m.chunkCount || 0;
6499
+ }
6500
+ }
6501
+ docs.sort((a, b) => (b.indexedAt || '').localeCompare(a.indexedAt || ''));
6502
+ const globalCount = docs.filter(d => d.brainScope === 'global').length;
6503
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6504
+ res.end(JSON.stringify({ docs, totalDocs: docs.length, totalSize, totalChunks, globalCount, projectCount: docs.length - globalCount }));
6505
+ } catch (err) {
6506
+ res.writeHead(500, { 'Content-Type': 'application/json' });
6507
+ res.end(JSON.stringify({ error: err.message }));
6508
+ }
6509
+ return;
6510
+ }
6511
+
6512
+ // GET /api/second-brain-ingest-stream — SSE stream tailing doc-metadata.jsonl for live ingest events
6513
+ if (req.method === 'GET' && url === '/api/second-brain-ingest-stream') {
6514
+ res.writeHead(200, {
6515
+ 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive',
6516
+ ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {})
6517
+ });
6518
+ res.write('data: {"type":"connected"}\n\n');
6519
+ const metaFile = path.join(projectDir || process.cwd(), '.monomind', 'knowledge', 'doc-metadata.jsonl');
6520
+ let lastSize = 0;
6521
+ try { lastSize = fs.statSync(metaFile).size; } catch {}
6522
+ function _sseTailFile(filePath, lastSizeRef, eventType, transform) {
6523
+ try {
6524
+ const stat = fs.statSync(filePath);
6525
+ if (stat.size < lastSizeRef.v) { lastSizeRef.v = 0; }
6526
+ if (stat.size > lastSizeRef.v) {
6527
+ let fd;
6528
+ try {
6529
+ fd = fs.openSync(filePath, 'r');
6530
+ const buf = Buffer.alloc(stat.size - lastSizeRef.v);
6531
+ fs.readSync(fd, buf, 0, buf.length, lastSizeRef.v);
6532
+ lastSizeRef.v = stat.size;
6533
+ const lines = buf.toString('utf8').split('\n').filter(Boolean);
6534
+ for (const l of lines) {
6535
+ try { const parsed = JSON.parse(l); res.write('data: ' + JSON.stringify(transform(parsed)) + '\n\n'); } catch {}
6536
+ }
6537
+ } finally { if (fd !== undefined) fs.closeSync(fd); }
6538
+ }
6539
+ } catch {}
6540
+ }
6541
+ const metaSize = { v: lastSize };
6542
+ const interval = setInterval(() => _sseTailFile(metaFile, metaSize, 'ingest', m => ({ type: 'ingest', doc: { ...m, name: path.basename(m.filePath || '') } })), 2000);
6543
+ const metricsFile = path.join(projectDir || process.cwd(), '.monomind', 'metrics', 'second-brain.jsonl');
6544
+ const metricsSize = { v: 0 };
6545
+ try { metricsSize.v = fs.statSync(metricsFile).size; } catch {}
6546
+ const metricsInterval = setInterval(() => _sseTailFile(metricsFile, metricsSize, 'injection', e => ({ type: 'injection', event: e })), 3000);
6547
+ req.on('close', () => { clearInterval(interval); clearInterval(metricsInterval); });
6548
+ return;
6549
+ }
6550
+
6551
+ // GET /api/second-brain-kg — knowledge graph triplets + stats for the KG explorer
6552
+ if (req.method === 'GET' && url === '/api/second-brain-kg') {
6553
+ try {
6554
+ const qs = new URL(req.url, 'http://localhost').searchParams;
6555
+ const query = (qs.get('q') || '').slice(0, 200);
6556
+ const limit = Math.min(parseInt(qs.get('limit') || '50', 10), 200);
6557
+ const monoDir = path.join(projectDir || process.cwd(), '.monomind');
6558
+ const dbPath = path.join(monoDir, 'memory');
6559
+ let stats = { nodes: 0, edges: 0 }, triplets = [], glossary = [];
6560
+ try {
6561
+ const kg = await import('../memory/memory-kg.js');
6562
+ stats = await kg.kgStats({ dbPath });
6563
+ glossary = await kg.kgGlossary({ dbPath, limit: 30 });
6564
+ if (query) {
6565
+ const searchResult = await kg.kgSearch({ query, limit, dbPath });
6566
+ triplets = searchResult.triplets || searchResult || [];
6567
+ } else {
6568
+ const searchResult = await kg.kgSearch({ query: '*', limit, dbPath }).catch(() => null);
6569
+ triplets = searchResult ? (searchResult.triplets || searchResult) : [];
6570
+ }
6571
+ } catch {}
6572
+ // Also check palace kg.json as fallback
6573
+ if (triplets.length === 0) {
6574
+ try {
6575
+ const palaceDir = path.join(monoDir, 'palace');
6576
+ const kgData = JSON.parse(fs.readFileSync(path.join(palaceDir, 'kg.json'), 'utf8'));
6577
+ if (Array.isArray(kgData)) {
6578
+ triplets = kgData.slice(0, limit);
6579
+ stats.nodes = new Set(kgData.flatMap(t => [t.subject || t.s, t.object || t.o])).size;
6580
+ stats.edges = kgData.length;
6581
+ }
6582
+ } catch {}
6583
+ }
6584
+ res.writeHead(200, { 'Content-Type': 'application/json', ...(corsOrigin ? { 'Access-Control-Allow-Origin': corsOrigin } : {}) });
6585
+ res.end(JSON.stringify({ stats, triplets, glossary }));
6586
+ } catch (err) {
6587
+ res.writeHead(500, { 'Content-Type': 'application/json' });
6588
+ res.end(JSON.stringify({ error: err.message }));
6589
+ }
6590
+ return;
6591
+ }
6592
+
6318
6593
  // GET /api/mastermind/metrics — aggregate system metrics from token-summary and swarm-activity
6319
6594
  if (req.method === 'GET' && url === '/api/mastermind/metrics') {
6320
6595
  try {