monomind 2.7.11 → 2.7.13
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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/cli.js +55 -4
- package/package.json +4 -47
- package/bin/npx-safe-launch.js +0 -9
- package/packages/@monomind/cli/.claude/agents/architecture/system-design/arch-system-design.md +0 -54
- package/packages/@monomind/cli/.claude/agents/consensus/crdt-synchronizer.md +0 -977
- package/packages/@monomind/cli/.claude/agents/consensus/quorum-manager.md +0 -106
- package/packages/@monomind/cli/.claude/agents/consensus/security-manager.md +0 -602
- package/packages/@monomind/cli/.claude/agents/core/coder.md +0 -271
- package/packages/@monomind/cli/.claude/agents/core/coordinator.md +0 -133
- package/packages/@monomind/cli/.claude/agents/core/planner.md +0 -179
- package/packages/@monomind/cli/.claude/agents/core/researcher.md +0 -197
- package/packages/@monomind/cli/.claude/agents/core/reviewer.md +0 -336
- package/packages/@monomind/cli/.claude/agents/core/tester.md +0 -326
- package/packages/@monomind/cli/.claude/agents/design/design-monodesign.md +0 -121
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-ai-data-remediation-engineer.md +0 -212
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-ai-engineer.md +0 -165
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-autonomous-optimization-architect.md +0 -108
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-backend-architect.md +0 -254
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-code-reviewer.md +0 -95
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-data-engineer.md +0 -307
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-database-optimizer.md +0 -200
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-devops-automator.md +0 -430
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-embedded-firmware-engineer.md +0 -174
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-feishu-integration-developer.md +0 -607
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-frontend-developer.md +0 -249
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-git-workflow-master.md +0 -108
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-incident-response-commander.md +0 -482
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-mobile-app-builder.md +0 -499
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-rapid-prototyper.md +0 -463
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-security-engineer.md +0 -303
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-senior-developer.md +0 -195
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-software-architect.md +0 -100
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-solidity-smart-contract-engineer.md +0 -528
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-sre.md +0 -114
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-technical-writer.md +0 -412
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-threat-detection-engineer.md +0 -540
- package/packages/@monomind/cli/.claude/agents/engineering/engineering-wechat-mini-program-developer.md +0 -351
- package/packages/@monomind/cli/.claude/agents/github/code-review-swarm.md +0 -557
- package/packages/@monomind/cli/.claude/agents/github/github-modes.md +0 -154
- package/packages/@monomind/cli/.claude/agents/github/issue-tracker.md +0 -297
- package/packages/@monomind/cli/.claude/agents/github/multi-repo-swarm.md +0 -525
- package/packages/@monomind/cli/.claude/agents/github/pr-manager.md +0 -161
- package/packages/@monomind/cli/.claude/agents/github/project-board-sync.md +0 -478
- package/packages/@monomind/cli/.claude/agents/github/release-manager.md +0 -296
- package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +0 -351
- package/packages/@monomind/cli/.claude/agents/github/swarm-issue.md +0 -548
- package/packages/@monomind/cli/.claude/agents/github/swarm-pr.md +0 -427
- package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +0 -355
- package/packages/@monomind/cli/.claude/agents/github/workflow-automation.md +0 -640
- package/packages/@monomind/cli/.claude/agents/goal/goal-planner.md +0 -167
- package/packages/@monomind/cli/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -93
- package/packages/@monomind/cli/.claude/agents/hive-mind/scout-explorer.md +0 -241
- package/packages/@monomind/cli/.claude/agents/hive-mind/swarm-memory-manager.md +0 -192
- package/packages/@monomind/cli/.claude/agents/hive-mind/worker-specialist.md +0 -216
- package/packages/@monomind/cli/.claude/agents/marketing/marketing-competitive-content.md +0 -155
- package/packages/@monomind/cli/.claude/agents/marketing/marketing-cro-specialist.md +0 -147
- package/packages/@monomind/cli/.claude/agents/marketing/marketing-email-specialist.md +0 -90
- package/packages/@monomind/cli/.claude/agents/marketing/marketing-launch-strategist.md +0 -129
- package/packages/@monomind/cli/.claude/agents/marketing/marketing-pricing-strategist.md +0 -127
- package/packages/@monomind/cli/.claude/agents/optimization/benchmark-suite.md +0 -665
- package/packages/@monomind/cli/.claude/agents/optimization/load-balancer.md +0 -431
- package/packages/@monomind/cli/.claude/agents/optimization/performance-monitor.md +0 -672
- package/packages/@monomind/cli/.claude/agents/optimization/resource-allocator.md +0 -674
- package/packages/@monomind/cli/.claude/agents/optimization/topology-optimizer.md +0 -808
- package/packages/@monomind/cli/.claude/agents/schemas/architecture-output.json +0 -43
- package/packages/@monomind/cli/.claude/agents/schemas/code-review-output.json +0 -28
- package/packages/@monomind/cli/.claude/agents/schemas/generic-task-input.json +0 -12
- package/packages/@monomind/cli/.claude/agents/schemas/implementation-output.json +0 -18
- package/packages/@monomind/cli/.claude/agents/schemas/research-output.json +0 -31
- package/packages/@monomind/cli/.claude/agents/schemas/security-audit-output.json +0 -29
- package/packages/@monomind/cli/.claude/agents/schemas/test-report-output.json +0 -29
- package/packages/@monomind/cli/.claude/agents/specialists/integration-architect.md +0 -94
- package/packages/@monomind/cli/.claude/agents/specialized/agentic-identity-trust.md +0 -388
- package/packages/@monomind/cli/.claude/agents/specialized/agents-orchestrator.md +0 -368
- package/packages/@monomind/cli/.claude/agents/specialized/automation-governance-architect.md +0 -217
- package/packages/@monomind/cli/.claude/agents/specialized/blockchain-security-auditor.md +0 -497
- package/packages/@monomind/cli/.claude/agents/specialized/compliance-auditor.md +0 -159
- package/packages/@monomind/cli/.claude/agents/specialized/identity-graph-operator.md +0 -261
- package/packages/@monomind/cli/.claude/agents/specialized/lsp-index-engineer.md +0 -315
- package/packages/@monomind/cli/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -89
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-cultural-intelligence-strategist.md +0 -89
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-developer-advocate.md +0 -318
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-document-generator.md +0 -56
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-mcp-builder.md +0 -64
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-model-qa.md +0 -489
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-workflow-architect.md +0 -595
- package/packages/@monomind/cli/.claude/agents/specialized/zk-steward.md +0 -212
- package/packages/@monomind/cli/.claude/agents/swarm/mesh-coordinator.md +0 -97
- package/packages/@monomind/cli/.claude/agents/templates/automation-smart-agent.md +0 -185
- package/packages/@monomind/cli/.claude/agents/templates/coordinator-swarm-init.md +0 -83
- package/packages/@monomind/cli/.claude/agents/testing/production-validator.md +0 -375
- package/packages/@monomind/cli/.claude/agents/testing/tdd-london-swarm.md +0 -241
- package/packages/@monomind/cli/.claude/agents/testing/testing-accessibility-auditor.md +0 -322
- package/packages/@monomind/cli/.claude/agents/testing/testing-api-tester.md +0 -307
- package/packages/@monomind/cli/.claude/agents/testing/testing-evidence-collector.md +0 -213
- package/packages/@monomind/cli/.claude/agents/testing/testing-performance-benchmarker.md +0 -269
- package/packages/@monomind/cli/.claude/agents/testing/testing-test-results-analyzer.md +0 -306
- package/packages/@monomind/cli/.claude/agents/testing/testing-tool-evaluator.md +0 -395
- package/packages/@monomind/cli/.claude/agents/testing/testing-workflow-optimizer.md +0 -451
- package/packages/@monomind/cli/.claude/commands/agents/README.md +0 -14
- package/packages/@monomind/cli/.claude/commands/agents/agent-capabilities.md +0 -25
- package/packages/@monomind/cli/.claude/commands/agents/agent-coordination.md +0 -32
- package/packages/@monomind/cli/.claude/commands/agents/agent-spawning.md +0 -32
- package/packages/@monomind/cli/.claude/commands/agents/agent-types.md +0 -30
- package/packages/@monomind/cli/.claude/commands/analysis/README.md +0 -18
- package/packages/@monomind/cli/.claude/commands/analysis/bottleneck-detect.md +0 -69
- package/packages/@monomind/cli/.claude/commands/analysis/performance-bottlenecks.md +0 -59
- package/packages/@monomind/cli/.claude/commands/analysis/performance-report.md +0 -52
- package/packages/@monomind/cli/.claude/commands/analysis/token-usage.md +0 -47
- package/packages/@monomind/cli/.claude/commands/automation/README.md +0 -19
- package/packages/@monomind/cli/.claude/commands/automation/auto-agent.md +0 -86
- package/packages/@monomind/cli/.claude/commands/automation/self-healing.md +0 -108
- package/packages/@monomind/cli/.claude/commands/automation/session-memory.md +0 -89
- package/packages/@monomind/cli/.claude/commands/automation/smart-agents.md +0 -81
- package/packages/@monomind/cli/.claude/commands/automation/smart-spawn.md +0 -66
- package/packages/@monomind/cli/.claude/commands/automation/workflow-select.md +0 -60
- package/packages/@monomind/cli/.claude/commands/coordination/README.md +0 -13
- package/packages/@monomind/cli/.claude/commands/coordination/agent-spawn.md +0 -69
- package/packages/@monomind/cli/.claude/commands/coordination/swarm-init.md +0 -82
- package/packages/@monomind/cli/.claude/commands/coordination/task-orchestrate.md +0 -79
- package/packages/@monomind/cli/.claude/commands/github/README.md +0 -24
- package/packages/@monomind/cli/.claude/commands/github/github-modes.md +0 -151
- package/packages/@monomind/cli/.claude/commands/github/issue-tracker.md +0 -291
- package/packages/@monomind/cli/.claude/commands/github/pr-manager.md +0 -171
- package/packages/@monomind/cli/.claude/commands/github/release-manager.md +0 -343
- package/packages/@monomind/cli/.claude/commands/github/repo-architect.md +0 -372
- package/packages/@monomind/cli/.claude/commands/github/sync-coordinator.md +0 -297
- package/packages/@monomind/cli/.claude/commands/hive-mind/README.md +0 -42
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-consensus.md +0 -72
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-init.md +0 -68
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-memory.md +0 -73
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-spawn.md +0 -82
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-status.md +0 -56
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind-stop.md +0 -55
- package/packages/@monomind/cli/.claude/commands/hive-mind/hive-mind.md +0 -87
- package/packages/@monomind/cli/.claude/commands/hooks/README.md +0 -66
- package/packages/@monomind/cli/.claude/commands/hooks/overview.md +0 -112
- package/packages/@monomind/cli/.claude/commands/hooks/post-edit.md +0 -78
- package/packages/@monomind/cli/.claude/commands/hooks/post-task.md +0 -62
- package/packages/@monomind/cli/.claude/commands/hooks/pre-edit.md +0 -81
- package/packages/@monomind/cli/.claude/commands/hooks/pre-task.md +0 -73
- package/packages/@monomind/cli/.claude/commands/hooks/session-end.md +0 -82
- package/packages/@monomind/cli/.claude/commands/hooks/setup.md +0 -132
- package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +0 -492
- package/packages/@monomind/cli/.claude/commands/mastermind/_taskfile.md +0 -232
- package/packages/@monomind/cli/.claude/commands/mastermind/adr.md +0 -9
- package/packages/@monomind/cli/.claude/commands/mastermind/approvev1.md +0 -94
- package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +0 -52
- package/packages/@monomind/cli/.claude/commands/mastermind/autodev.md +0 -28
- package/packages/@monomind/cli/.claude/commands/mastermind/brain.md +0 -99
- package/packages/@monomind/cli/.claude/commands/mastermind/budget.md +0 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/build.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +0 -314
- package/packages/@monomind/cli/.claude/commands/mastermind/content.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/createorg.md +0 -143
- package/packages/@monomind/cli/.claude/commands/mastermind/createtask.md +0 -372
- package/packages/@monomind/cli/.claude/commands/mastermind/debug.md +0 -19
- package/packages/@monomind/cli/.claude/commands/mastermind/design.md +0 -17
- package/packages/@monomind/cli/.claude/commands/mastermind/do.md +0 -525
- package/packages/@monomind/cli/.claude/commands/mastermind/execute.md +0 -17
- package/packages/@monomind/cli/.claude/commands/mastermind/finance.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/finish.md +0 -17
- package/packages/@monomind/cli/.claude/commands/mastermind/graph-status.md +0 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/help.md +0 -133
- package/packages/@monomind/cli/.claude/commands/mastermind/idea.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/ideate.md +0 -258
- package/packages/@monomind/cli/.claude/commands/mastermind/improve.md +0 -342
- package/packages/@monomind/cli/.claude/commands/mastermind/loops.md +0 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/marketing.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/master.md +0 -1140
- package/packages/@monomind/cli/.claude/commands/mastermind/memory.md +0 -227
- package/packages/@monomind/cli/.claude/commands/mastermind/okf-export.md +0 -14
- package/packages/@monomind/cli/.claude/commands/mastermind/okf-import.md +0 -15
- package/packages/@monomind/cli/.claude/commands/mastermind/ops.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/orgs.md +0 -18
- package/packages/@monomind/cli/.claude/commands/mastermind/orgstatus.md +0 -56
- package/packages/@monomind/cli/.claude/commands/mastermind/plan.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/receive-review.md +0 -17
- package/packages/@monomind/cli/.claude/commands/mastermind/references/antigravity-tools.md +0 -60
- package/packages/@monomind/cli/.claude/commands/mastermind/references/claude-code-tools.md +0 -50
- package/packages/@monomind/cli/.claude/commands/mastermind/references/codex-tools.md +0 -64
- package/packages/@monomind/cli/.claude/commands/mastermind/references/copilot-tools.md +0 -49
- package/packages/@monomind/cli/.claude/commands/mastermind/references/gemini-tools.md +0 -63
- package/packages/@monomind/cli/.claude/commands/mastermind/references/pi-tools.md +0 -28
- package/packages/@monomind/cli/.claude/commands/mastermind/release.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/repeat.md +0 -254
- package/packages/@monomind/cli/.claude/commands/mastermind/research.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/review.md +0 -34
- package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +0 -71
- package/packages/@monomind/cli/.claude/commands/mastermind/runorgv1.md +0 -159
- package/packages/@monomind/cli/.claude/commands/mastermind/sales.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/skill-builder.md +0 -17
- package/packages/@monomind/cli/.claude/commands/mastermind/specialagents.md +0 -122
- package/packages/@monomind/cli/.claude/commands/mastermind/stoporg.md +0 -78
- package/packages/@monomind/cli/.claude/commands/mastermind/swarm.md +0 -158
- package/packages/@monomind/cli/.claude/commands/mastermind/taskdev.md +0 -23
- package/packages/@monomind/cli/.claude/commands/mastermind/tdd.md +0 -19
- package/packages/@monomind/cli/.claude/commands/mastermind/techport.md +0 -27
- package/packages/@monomind/cli/.claude/commands/mastermind/topology.md +0 -121
- package/packages/@monomind/cli/.claude/commands/mastermind/understand.md +0 -136
- package/packages/@monomind/cli/.claude/commands/mastermind/verify.md +0 -19
- package/packages/@monomind/cli/.claude/commands/mastermind/worktree.md +0 -17
- package/packages/@monomind/cli/.claude/commands/mastermind.md +0 -140
- package/packages/@monomind/cli/.claude/commands/memory/README.md +0 -79
- package/packages/@monomind/cli/.claude/commands/memory/memory-search.md +0 -77
- package/packages/@monomind/cli/.claude/commands/monitoring/README.md +0 -69
- package/packages/@monomind/cli/.claude/commands/monitoring/agent-metrics.md +0 -65
- package/packages/@monomind/cli/.claude/commands/monitoring/agents.md +0 -71
- package/packages/@monomind/cli/.claude/commands/monitoring/status.md +0 -108
- package/packages/@monomind/cli/.claude/commands/monobrowse.md +0 -21
- package/packages/@monomind/cli/.claude/commands/monoes/README.md +0 -30
- package/packages/@monomind/cli/.claude/commands/monoes/install.md +0 -163
- package/packages/@monomind/cli/.claude/commands/monoes/monoagent.md +0 -148
- package/packages/@monomind/cli/.claude/commands/monoes/monoclip.md +0 -64
- package/packages/@monomind/cli/.claude/commands/monoes/monotask.md +0 -137
- package/packages/@monomind/cli/.claude/commands/monograph/README.md +0 -102
- package/packages/@monomind/cli/.claude/commands/monograph/monograph-build.md +0 -79
- package/packages/@monomind/cli/.claude/commands/monograph/monograph-search.md +0 -96
- package/packages/@monomind/cli/.claude/commands/monograph/monograph-stats.md +0 -53
- package/packages/@monomind/cli/.claude/commands/monograph/monograph-watch.md +0 -63
- package/packages/@monomind/cli/.claude/commands/monograph/monograph-wiki.md +0 -91
- package/packages/@monomind/cli/.claude/commands/optimization/auto-topology.md +0 -85
- package/packages/@monomind/cli/.claude/commands/optimization/performance-optimize.md +0 -79
- package/packages/@monomind/cli/.claude/commands/pair/README.md +0 -79
- package/packages/@monomind/cli/.claude/commands/pair/examples.md +0 -156
- package/packages/@monomind/cli/.claude/commands/pair/modes.md +0 -122
- package/packages/@monomind/cli/.claude/commands/pair/session.md +0 -124
- package/packages/@monomind/cli/.claude/commands/stream-chain/pipeline.md +0 -116
- package/packages/@monomind/cli/.claude/commands/stream-chain/run.md +0 -156
- package/packages/@monomind/cli/.claude/commands/swarm/README.md +0 -40
- package/packages/@monomind/cli/.claude/commands/swarm/analysis.md +0 -73
- package/packages/@monomind/cli/.claude/commands/swarm/development.md +0 -72
- package/packages/@monomind/cli/.claude/commands/swarm/examples.md +0 -103
- package/packages/@monomind/cli/.claude/commands/swarm/maintenance.md +0 -75
- package/packages/@monomind/cli/.claude/commands/swarm/optimization.md +0 -84
- package/packages/@monomind/cli/.claude/commands/swarm/research.md +0 -76
- package/packages/@monomind/cli/.claude/commands/swarm/swarm.md +0 -79
- package/packages/@monomind/cli/.claude/commands/swarm/testing.md +0 -80
- package/packages/@monomind/cli/.claude/commands/tokens.md +0 -18
- package/packages/@monomind/cli/.claude/commands/truth/start.md +0 -121
- package/packages/@monomind/cli/.claude/commands/ts.md +0 -14
- package/packages/@monomind/cli/.claude/commands/workflows/README.md +0 -64
- package/packages/@monomind/cli/.claude/commands/workflows/development.md +0 -86
- package/packages/@monomind/cli/.claude/commands/workflows/research.md +0 -89
- package/packages/@monomind/cli/.claude/commands/workflows/workflow-create.md +0 -83
- package/packages/@monomind/cli/.claude/commands/workflows/workflow-execute.md +0 -101
- package/packages/@monomind/cli/.claude/commands/workflows/workflow-export.md +0 -88
- package/packages/@monomind/cli/.claude/helpers/build-skill-registry.cjs +0 -323
- package/packages/@monomind/cli/.claude/helpers/control-start.cjs +0 -327
- package/packages/@monomind/cli/.claude/helpers/control-stop.cjs +0 -95
- package/packages/@monomind/cli/.claude/helpers/event-logger.cjs +0 -266
- package/packages/@monomind/cli/.claude/helpers/graphify-freshen.cjs +0 -148
- package/packages/@monomind/cli/.claude/helpers/handlers/adr-draft-handler.cjs +0 -78
- package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +0 -132
- package/packages/@monomind/cli/.claude/helpers/handlers/budget-status-handler.cjs +0 -14
- package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +0 -736
- package/packages/@monomind/cli/.claude/helpers/handlers/compact-handler.cjs +0 -35
- package/packages/@monomind/cli/.claude/helpers/handlers/edit-handler.cjs +0 -178
- package/packages/@monomind/cli/.claude/helpers/handlers/gates-handler.cjs +0 -494
- package/packages/@monomind/cli/.claude/helpers/handlers/graph-status-handler.cjs +0 -45
- package/packages/@monomind/cli/.claude/helpers/handlers/loops-status-handler.cjs +0 -48
- package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +0 -770
- package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +0 -286
- package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +0 -573
- package/packages/@monomind/cli/.claude/helpers/handlers/stats-handler.cjs +0 -14
- package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +0 -241
- package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +0 -951
- package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +0 -510
- package/packages/@monomind/cli/.claude/helpers/learning-service.mjs +0 -61
- package/packages/@monomind/cli/.claude/helpers/loop-tracker.cjs +0 -119
- package/packages/@monomind/cli/.claude/helpers/mastermind-activate.cjs +0 -35
- package/packages/@monomind/cli/.claude/helpers/memory-palace.cjs +0 -461
- package/packages/@monomind/cli/.claude/helpers/memory.cjs +0 -193
- package/packages/@monomind/cli/.claude/helpers/metrics-db.mjs +0 -87
- package/packages/@monomind/cli/.claude/helpers/monolean-activate.cjs +0 -30
- package/packages/@monomind/cli/.claude/helpers/monolean-config.cjs +0 -76
- package/packages/@monomind/cli/.claude/helpers/monolean-instructions.cjs +0 -109
- package/packages/@monomind/cli/.claude/helpers/monolean-propagate.cjs +0 -13
- package/packages/@monomind/cli/.claude/helpers/monolean-tracker.cjs +0 -18
- package/packages/@monomind/cli/.claude/helpers/router.cjs +0 -571
- package/packages/@monomind/cli/.claude/helpers/session.cjs +0 -145
- package/packages/@monomind/cli/.claude/helpers/skill-registry.json +0 -4948
- package/packages/@monomind/cli/.claude/helpers/statusline.cjs +0 -1368
- package/packages/@monomind/cli/.claude/helpers/toggle-statusline.cjs +0 -73
- package/packages/@monomind/cli/.claude/helpers/token-tracker.cjs +0 -1034
- package/packages/@monomind/cli/.claude/helpers/utils/agent-registrations.cjs +0 -41
- package/packages/@monomind/cli/.claude/helpers/utils/fs-helpers.cjs +0 -183
- package/packages/@monomind/cli/.claude/helpers/utils/micro-agents.cjs +0 -358
- package/packages/@monomind/cli/.claude/helpers/utils/monograph.cjs +0 -692
- package/packages/@monomind/cli/.claude/helpers/utils/system-pressure.cjs +0 -46
- package/packages/@monomind/cli/.claude/helpers/utils/telemetry.cjs +0 -162
- package/packages/@monomind/cli/.claude/settings.json +0 -448
- package/packages/@monomind/cli/.claude/skills/agent-browser-testing/SKILL.md +0 -964
- package/packages/@monomind/cli/.claude/skills/agentic-jujutsu/SKILL.md +0 -645
- package/packages/@monomind/cli/.claude/skills/github-issue-triage/SKILL.md +0 -354
- package/packages/@monomind/cli/.claude/skills/github-repo-recap/SKILL.md +0 -207
- package/packages/@monomind/cli/.claude/skills/hive-mind-advanced/SKILL.md +0 -694
- package/packages/@monomind/cli/.claude/skills/hooks-automation/SKILL.md +0 -1192
- package/packages/@monomind/cli/.claude/skills/mastermind-access/SKILL.md +0 -236
- package/packages/@monomind/cli/.claude/skills/mastermind-activity/SKILL.md +0 -191
- package/packages/@monomind/cli/.claude/skills/mastermind-adapter-manager/SKILL.md +0 -259
- package/packages/@monomind/cli/.claude/skills/mastermind-adapters/SKILL.md +0 -204
- package/packages/@monomind/cli/.claude/skills/mastermind-agent-detail/SKILL.md +0 -242
- package/packages/@monomind/cli/.claude/skills/mastermind-agent-select/SKILL.md +0 -132
- package/packages/@monomind/cli/.claude/skills/mastermind-agents/SKILL.md +0 -182
- package/packages/@monomind/cli/.claude/skills/mastermind-approval-detail/SKILL.md +0 -259
- package/packages/@monomind/cli/.claude/skills/mastermind-approvev1/SKILL.md +0 -191
- package/packages/@monomind/cli/.claude/skills/mastermind-architect/SKILL.md +0 -862
- package/packages/@monomind/cli/.claude/skills/mastermind-autodev/SKILL.md +0 -360
- package/packages/@monomind/cli/.claude/skills/mastermind-backup/SKILL.md +0 -197
- package/packages/@monomind/cli/.claude/skills/mastermind-bootstrap/SKILL.md +0 -190
- package/packages/@monomind/cli/.claude/skills/mastermind-budgets/SKILL.md +0 -237
- package/packages/@monomind/cli/.claude/skills/mastermind-build/SKILL.md +0 -169
- package/packages/@monomind/cli/.claude/skills/mastermind-companies/SKILL.md +0 -256
- package/packages/@monomind/cli/.claude/skills/mastermind-content/SKILL.md +0 -197
- package/packages/@monomind/cli/.claude/skills/mastermind-costs/SKILL.md +0 -151
- package/packages/@monomind/cli/.claude/skills/mastermind-createorg/SKILL.md +0 -247
- package/packages/@monomind/cli/.claude/skills/mastermind-debug/SKILL.md +0 -277
- package/packages/@monomind/cli/.claude/skills/mastermind-delegation/SKILL.md +0 -83
- package/packages/@monomind/cli/.claude/skills/mastermind-design/SKILL.md +0 -190
- package/packages/@monomind/cli/.claude/skills/mastermind-diagnose/SKILL.md +0 -249
- package/packages/@monomind/cli/.claude/skills/mastermind-env/SKILL.md +0 -203
- package/packages/@monomind/cli/.claude/skills/mastermind-environments/SKILL.md +0 -250
- package/packages/@monomind/cli/.claude/skills/mastermind-execute/SKILL.md +0 -104
- package/packages/@monomind/cli/.claude/skills/mastermind-export/SKILL.md +0 -333
- package/packages/@monomind/cli/.claude/skills/mastermind-finance/SKILL.md +0 -166
- package/packages/@monomind/cli/.claude/skills/mastermind-finish/SKILL.md +0 -251
- package/packages/@monomind/cli/.claude/skills/mastermind-goal-detail/SKILL.md +0 -255
- package/packages/@monomind/cli/.claude/skills/mastermind-goals/SKILL.md +0 -149
- package/packages/@monomind/cli/.claude/skills/mastermind-heartbeatv1/SKILL.md +0 -167
- package/packages/@monomind/cli/.claude/skills/mastermind-idea/SKILL.md +0 -1142
- package/packages/@monomind/cli/.claude/skills/mastermind-import/SKILL.md +0 -281
- package/packages/@monomind/cli/.claude/skills/mastermind-inbox/SKILL.md +0 -226
- package/packages/@monomind/cli/.claude/skills/mastermind-instance/SKILL.md +0 -235
- package/packages/@monomind/cli/.claude/skills/mastermind-instance-settings/SKILL.md +0 -315
- package/packages/@monomind/cli/.claude/skills/mastermind-intake/SKILL.md +0 -83
- package/packages/@monomind/cli/.claude/skills/mastermind-invite-landing/SKILL.md +0 -227
- package/packages/@monomind/cli/.claude/skills/mastermind-invites/SKILL.md +0 -254
- package/packages/@monomind/cli/.claude/skills/mastermind-issue-detail/SKILL.md +0 -291
- package/packages/@monomind/cli/.claude/skills/mastermind-issues/SKILL.md +0 -235
- package/packages/@monomind/cli/.claude/skills/mastermind-join-queue/SKILL.md +0 -170
- package/packages/@monomind/cli/.claude/skills/mastermind-liveness/SKILL.md +0 -392
- package/packages/@monomind/cli/.claude/skills/mastermind-marketing/SKILL.md +0 -228
- package/packages/@monomind/cli/.claude/skills/mastermind-marketing/references/copywriting-frameworks.md +0 -181
- package/packages/@monomind/cli/.claude/skills/mastermind-marketing/references/persuasion-psychology.md +0 -158
- package/packages/@monomind/cli/.claude/skills/mastermind-memory/SKILL.md +0 -321
- package/packages/@monomind/cli/.claude/skills/mastermind-monitor/SKILL.md +0 -1284
- package/packages/@monomind/cli/.claude/skills/mastermind-monotask/SKILL.md +0 -350
- package/packages/@monomind/cli/.claude/skills/mastermind-my-issues/SKILL.md +0 -146
- package/packages/@monomind/cli/.claude/skills/mastermind-new-agent/SKILL.md +0 -241
- package/packages/@monomind/cli/.claude/skills/mastermind-ops/SKILL.md +0 -168
- package/packages/@monomind/cli/.claude/skills/mastermind-org-chart/SKILL.md +0 -209
- package/packages/@monomind/cli/.claude/skills/mastermind-org-settings/SKILL.md +0 -274
- package/packages/@monomind/cli/.claude/skills/mastermind-orgs/SKILL.md +0 -120
- package/packages/@monomind/cli/.claude/skills/mastermind-orgstatus/SKILL.md +0 -254
- package/packages/@monomind/cli/.claude/skills/mastermind-plan/SKILL.md +0 -217
- package/packages/@monomind/cli/.claude/skills/mastermind-plan-to-tasks/SKILL.md +0 -136
- package/packages/@monomind/cli/.claude/skills/mastermind-plugin-manager/SKILL.md +0 -241
- package/packages/@monomind/cli/.claude/skills/mastermind-plugin-settings/SKILL.md +0 -273
- package/packages/@monomind/cli/.claude/skills/mastermind-plugins/SKILL.md +0 -190
- package/packages/@monomind/cli/.claude/skills/mastermind-profile/SKILL.md +0 -187
- package/packages/@monomind/cli/.claude/skills/mastermind-project-detail/SKILL.md +0 -249
- package/packages/@monomind/cli/.claude/skills/mastermind-project-workspace/SKILL.md +0 -244
- package/packages/@monomind/cli/.claude/skills/mastermind-projects/SKILL.md +0 -167
- package/packages/@monomind/cli/.claude/skills/mastermind-protocol/SKILL.md +0 -404
- package/packages/@monomind/cli/.claude/skills/mastermind-receive-review/SKILL.md +0 -213
- package/packages/@monomind/cli/.claude/skills/mastermind-release/SKILL.md +0 -168
- package/packages/@monomind/cli/.claude/skills/mastermind-repeat/SKILL.md +0 -171
- package/packages/@monomind/cli/.claude/skills/mastermind-research/SKILL.md +0 -168
- package/packages/@monomind/cli/.claude/skills/mastermind-review/SKILL.md +0 -233
- package/packages/@monomind/cli/.claude/skills/mastermind-routine-detail/SKILL.md +0 -253
- package/packages/@monomind/cli/.claude/skills/mastermind-routines/SKILL.md +0 -203
- package/packages/@monomind/cli/.claude/skills/mastermind-runorg/SKILL.md +0 -43
- package/packages/@monomind/cli/.claude/skills/mastermind-runorgv1/SKILL.md +0 -731
- package/packages/@monomind/cli/.claude/skills/mastermind-sales/SKILL.md +0 -170
- package/packages/@monomind/cli/.claude/skills/mastermind-search/SKILL.md +0 -186
- package/packages/@monomind/cli/.claude/skills/mastermind-secrets/SKILL.md +0 -199
- package/packages/@monomind/cli/.claude/skills/mastermind-skill-builder/SKILL.md +0 -447
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/SKILL.md +0 -156
- package/packages/@monomind/cli/.claude/skills/mastermind-stoporg/SKILL.md +0 -147
- package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/SKILL.md +0 -377
- package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/code-quality-reviewer-prompt.md +0 -60
- package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/final-reviewer-prompt.md +0 -144
- package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/implementer-prompt.md +0 -114
- package/packages/@monomind/cli/.claude/skills/mastermind-taskdev/spec-reviewer-prompt.md +0 -80
- package/packages/@monomind/cli/.claude/skills/mastermind-tasks/SKILL.md +0 -152
- package/packages/@monomind/cli/.claude/skills/mastermind-tdd/SKILL.md +0 -424
- package/packages/@monomind/cli/.claude/skills/mastermind-techport/SKILL.md +0 -777
- package/packages/@monomind/cli/.claude/skills/mastermind-threads/SKILL.md +0 -259
- package/packages/@monomind/cli/.claude/skills/mastermind-tree-control/SKILL.md +0 -250
- package/packages/@monomind/cli/.claude/skills/mastermind-verify/SKILL.md +0 -196
- package/packages/@monomind/cli/.claude/skills/mastermind-wiki/SKILL.md +0 -314
- package/packages/@monomind/cli/.claude/skills/mastermind-workspace-detail/SKILL.md +0 -317
- package/packages/@monomind/cli/.claude/skills/mastermind-workspaces/SKILL.md +0 -261
- package/packages/@monomind/cli/.claude/skills/mastermind-worktree/SKILL.md +0 -215
- package/packages/@monomind/cli/.claude/skills/monolean/SKILL.md +0 -118
- package/packages/@monomind/cli/.claude/skills/monolean-audit/SKILL.md +0 -41
- package/packages/@monomind/cli/.claude/skills/monolean-debt/SKILL.md +0 -46
- package/packages/@monomind/cli/.claude/skills/monolean-help/SKILL.md +0 -60
- package/packages/@monomind/cli/.claude/skills/monolean-review/SKILL.md +0 -57
- package/packages/@monomind/cli/.claude/skills/monomind/browse-agentcore.md +0 -115
- package/packages/@monomind/cli/.claude/skills/monomind/browse-electron.md +0 -188
- package/packages/@monomind/cli/.claude/skills/monomind/browse-qa.md +0 -228
- package/packages/@monomind/cli/.claude/skills/monomind/browse-references/authentication.md +0 -161
- package/packages/@monomind/cli/.claude/skills/monomind/browse-references/trust-boundaries.md +0 -40
- package/packages/@monomind/cli/.claude/skills/monomind/browse-references/video-recording.md +0 -83
- package/packages/@monomind/cli/.claude/skills/monomind/browse-slack.md +0 -188
- package/packages/@monomind/cli/.claude/skills/monomind/browse-vercel.md +0 -239
- package/packages/@monomind/cli/.claude/skills/monomind/browse.md +0 -724
- package/packages/@monomind/cli/.claude/skills/monomotion/SKILL.md +0 -145
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/api-control.md +0 -139
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/effects.md +0 -109
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/integration.md +0 -140
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/scroll.md +0 -131
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/sequencing.md +0 -105
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/svg.md +0 -101
- package/packages/@monomind/cli/.claude/skills/monomotion/rules/text.md +0 -119
- package/packages/@monomind/cli/.claude/skills/pair-programming/SKILL.md +0 -1202
- package/packages/@monomind/cli/.claude/skills/performance-analysis/SKILL.md +0 -560
- package/packages/@monomind/cli/.claude/skills/skill-builder/SKILL.md +0 -910
- package/packages/@monomind/cli/.claude/skills/specialagent/SKILL.md +0 -206
- package/packages/@monomind/cli/.claude/skills/stop-slop/SKILL.md +0 -67
- package/packages/@monomind/cli/.claude/skills/stop-slop/references/examples.md +0 -61
- package/packages/@monomind/cli/.claude/skills/stop-slop/references/phrases.md +0 -130
- package/packages/@monomind/cli/.claude/skills/stop-slop/references/structures.md +0 -136
- package/packages/@monomind/cli/.claude/skills/swarm-advanced/SKILL.md +0 -936
- package/packages/@monomind/cli/.claude/skills/swarm-orchestration/SKILL.md +0 -179
- package/packages/@monomind/cli/.claude/skills/verification-quality/SKILL.md +0 -674
- package/packages/@monomind/cli/README.md +0 -414
- package/packages/@monomind/cli/bin/cli.js +0 -379
- package/packages/@monomind/cli/bin/mcp-server.js +0 -208
- package/packages/@monomind/cli/bin/preinstall.cjs +0 -2
- package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +0 -64
- package/packages/@monomind/cli/dist/src/agents/registry-builder.js +0 -228
- package/packages/@monomind/cli/dist/src/autopilot-state.d.ts +0 -77
- package/packages/@monomind/cli/dist/src/autopilot-state.js +0 -336
- package/packages/@monomind/cli/dist/src/browser/action-builder/analyzer.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/browser/action-builder/analyzer.js +0 -64
- package/packages/@monomind/cli/dist/src/browser/action-builder/types.d.ts +0 -47
- package/packages/@monomind/cli/dist/src/browser/action-builder/types.js +0 -2
- package/packages/@monomind/cli/dist/src/browser/adapters/gemini.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/browser/adapters/gemini.js +0 -16
- package/packages/@monomind/cli/dist/src/browser/adapters/index.d.ts +0 -19
- package/packages/@monomind/cli/dist/src/browser/adapters/index.js +0 -23
- package/packages/@monomind/cli/dist/src/browser/adapters/instagram.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/browser/adapters/instagram.js +0 -17
- package/packages/@monomind/cli/dist/src/browser/adapters/linkedin.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/browser/adapters/linkedin.js +0 -19
- package/packages/@monomind/cli/dist/src/browser/adapters/x.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/browser/adapters/x.js +0 -19
- package/packages/@monomind/cli/dist/src/browser/dashboard/server.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/browser/dashboard/server.js +0 -215
- package/packages/@monomind/cli/dist/src/browser/dashboard/ui.html +0 -261
- package/packages/@monomind/cli/dist/src/browser/workflow/engine.d.ts +0 -15
- package/packages/@monomind/cli/dist/src/browser/workflow/engine.js +0 -127
- package/packages/@monomind/cli/dist/src/browser/workflow/expression.d.ts +0 -4
- package/packages/@monomind/cli/dist/src/browser/workflow/expression.js +0 -64
- package/packages/@monomind/cli/dist/src/browser/workflow/store.d.ts +0 -24
- package/packages/@monomind/cli/dist/src/browser/workflow/store.js +0 -145
- package/packages/@monomind/cli/dist/src/browser/workflow/types.d.ts +0 -48
- package/packages/@monomind/cli/dist/src/browser/workflow/types.js +0 -2
- package/packages/@monomind/cli/dist/src/capabilities/cap-code.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/capabilities/cap-code.js +0 -20
- package/packages/@monomind/cli/dist/src/capabilities/cap-data.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/capabilities/cap-data.js +0 -165
- package/packages/@monomind/cli/dist/src/capabilities/cap-documents.d.ts +0 -5
- package/packages/@monomind/cli/dist/src/capabilities/cap-documents.js +0 -139
- package/packages/@monomind/cli/dist/src/capabilities/cap-graph.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/capabilities/cap-graph.js +0 -84
- package/packages/@monomind/cli/dist/src/capabilities/cap-media.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/capabilities/cap-media.js +0 -147
- package/packages/@monomind/cli/dist/src/capabilities/cap-timeline.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/capabilities/cap-timeline.js +0 -90
- package/packages/@monomind/cli/dist/src/capabilities/index.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/capabilities/index.js +0 -18
- package/packages/@monomind/cli/dist/src/capabilities/manager.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/capabilities/manager.js +0 -79
- package/packages/@monomind/cli/dist/src/capabilities/scanner.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/capabilities/scanner.js +0 -125
- package/packages/@monomind/cli/dist/src/capabilities/types.d.ts +0 -64
- package/packages/@monomind/cli/dist/src/capabilities/types.js +0 -2
- package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.d.ts +0 -17
- package/packages/@monomind/cli/dist/src/commands/agent-lifecycle.js +0 -346
- package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/agent-ops.js +0 -277
- package/packages/@monomind/cli/dist/src/commands/agent.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/agent.js +0 -40
- package/packages/@monomind/cli/dist/src/commands/analyze-ast.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/commands/analyze-ast.js +0 -284
- package/packages/@monomind/cli/dist/src/commands/analyze-diff.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +0 -395
- package/packages/@monomind/cli/dist/src/commands/analyze-imports.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/analyze-imports.js +0 -287
- package/packages/@monomind/cli/dist/src/commands/analyze-symbols.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/commands/analyze-symbols.js +0 -302
- package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +0 -53
- package/packages/@monomind/cli/dist/src/commands/analyze.js +0 -217
- package/packages/@monomind/cli/dist/src/commands/autopilot.d.ts +0 -15
- package/packages/@monomind/cli/dist/src/commands/autopilot.js +0 -370
- package/packages/@monomind/cli/dist/src/commands/browse-action.d.ts +0 -4
- package/packages/@monomind/cli/dist/src/commands/browse-action.js +0 -244
- package/packages/@monomind/cli/dist/src/commands/browse-platform.d.ts +0 -4
- package/packages/@monomind/cli/dist/src/commands/browse-platform.js +0 -117
- package/packages/@monomind/cli/dist/src/commands/browse-workflow.d.ts +0 -4
- package/packages/@monomind/cli/dist/src/commands/browse-workflow.js +0 -183
- package/packages/@monomind/cli/dist/src/commands/browse.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/commands/browse.js +0 -17
- package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +0 -45
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +0 -581
- package/packages/@monomind/cli/dist/src/commands/completions.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/completions.js +0 -261
- package/packages/@monomind/cli/dist/src/commands/config.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/config.js +0 -462
- package/packages/@monomind/cli/dist/src/commands/crash-reporting.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/crash-reporting.js +0 -50
- package/packages/@monomind/cli/dist/src/commands/design-detect.d.ts +0 -27
- package/packages/@monomind/cli/dist/src/commands/design-detect.js +0 -220
- package/packages/@monomind/cli/dist/src/commands/design-palette.d.ts +0 -21
- package/packages/@monomind/cli/dist/src/commands/design-palette.js +0 -538
- package/packages/@monomind/cli/dist/src/commands/doc.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/commands/doc.js +0 -268
- package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/commands/doctor-env-checks.js +0 -194
- package/packages/@monomind/cli/dist/src/commands/doctor-monoes-checks.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/commands/doctor-monoes-checks.js +0 -160
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +0 -46
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +0 -764
- package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/doctor.js +0 -232
- package/packages/@monomind/cli/dist/src/commands/guidance.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/commands/guidance.js +0 -163
- package/packages/@monomind/cli/dist/src/commands/hooks-core-commands.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/hooks-core-commands.js +0 -377
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +0 -417
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +0 -219
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +0 -399
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-utils.d.ts +0 -42
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-utils.js +0 -220
- package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.js +0 -243
- package/packages/@monomind/cli/dist/src/commands/hooks-formatting.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/commands/hooks-formatting.js +0 -25
- package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.d.ts +0 -15
- package/packages/@monomind/cli/dist/src/commands/hooks-routing-commands.js +0 -725
- package/packages/@monomind/cli/dist/src/commands/hooks-workers.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/commands/hooks-workers.js +0 -547
- package/packages/@monomind/cli/dist/src/commands/hooks.d.ts +0 -16
- package/packages/@monomind/cli/dist/src/commands/hooks.js +0 -497
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -65
- package/packages/@monomind/cli/dist/src/commands/index.js +0 -236
- package/packages/@monomind/cli/dist/src/commands/init-subcommands.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/init-subcommands.js +0 -156
- package/packages/@monomind/cli/dist/src/commands/init-upgrade.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/commands/init-upgrade.js +0 -203
- package/packages/@monomind/cli/dist/src/commands/init-wizard.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/commands/init-wizard.js +0 -244
- package/packages/@monomind/cli/dist/src/commands/init.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/init.js +0 -411
- package/packages/@monomind/cli/dist/src/commands/mcp.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/mcp.js +0 -747
- package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/commands/memory-admin.js +0 -345
- package/packages/@monomind/cli/dist/src/commands/memory-crud.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/commands/memory-crud.js +0 -389
- package/packages/@monomind/cli/dist/src/commands/memory-list.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/memory-list.js +0 -321
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +0 -199
- package/packages/@monomind/cli/dist/src/commands/memory.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/commands/memory.js +0 -282
- package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/monograph.js +0 -548
- package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/neural-core.js +0 -413
- package/packages/@monomind/cli/dist/src/commands/neural-optimize.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +0 -330
- package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +0 -7
- package/packages/@monomind/cli/dist/src/commands/neural-registry.js +0 -290
- package/packages/@monomind/cli/dist/src/commands/org-observe.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/commands/org-observe.js +0 -353
- package/packages/@monomind/cli/dist/src/commands/org.d.ts +0 -25
- package/packages/@monomind/cli/dist/src/commands/org.js +0 -860
- package/packages/@monomind/cli/dist/src/commands/performance.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/performance.js +0 -656
- package/packages/@monomind/cli/dist/src/commands/platforms.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/platforms.js +0 -600
- package/packages/@monomind/cli/dist/src/commands/providers.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/providers.js +0 -351
- package/packages/@monomind/cli/dist/src/commands/report-crash.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/report-crash.js +0 -66
- package/packages/@monomind/cli/dist/src/commands/route.d.ts +0 -16
- package/packages/@monomind/cli/dist/src/commands/route.js +0 -944
- package/packages/@monomind/cli/dist/src/commands/search-universal.d.ts +0 -19
- package/packages/@monomind/cli/dist/src/commands/search-universal.js +0 -151
- package/packages/@monomind/cli/dist/src/commands/security-cve.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/commands/security-cve.js +0 -308
- package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/security-misc.js +0 -336
- package/packages/@monomind/cli/dist/src/commands/security-scan.d.ts +0 -47
- package/packages/@monomind/cli/dist/src/commands/security-scan.js +0 -447
- package/packages/@monomind/cli/dist/src/commands/security.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/security.js +0 -41
- package/packages/@monomind/cli/dist/src/commands/session.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/session.js +0 -660
- package/packages/@monomind/cli/dist/src/commands/start.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/start.js +0 -490
- package/packages/@monomind/cli/dist/src/commands/status.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/status.js +0 -642
- package/packages/@monomind/cli/dist/src/commands/swarm.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/swarm.js +0 -906
- package/packages/@monomind/cli/dist/src/commands/task.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/task.js +0 -639
- package/packages/@monomind/cli/dist/src/commands/tokens.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/tokens.js +0 -206
- package/packages/@monomind/cli/dist/src/commands/update.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/update.js +0 -288
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.d.ts +0 -77
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +0 -196
- package/packages/@monomind/cli/dist/src/consensus/tally.d.ts +0 -19
- package/packages/@monomind/cli/dist/src/consensus/tally.js +0 -34
- package/packages/@monomind/cli/dist/src/index.d.ts +0 -81
- package/packages/@monomind/cli/dist/src/index.js +0 -574
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.d.ts +0 -25
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +0 -624
- package/packages/@monomind/cli/dist/src/init/executor.d.ts +0 -47
- package/packages/@monomind/cli/dist/src/init/executor.js +0 -2387
- package/packages/@monomind/cli/dist/src/init/helpers-generator.d.ts +0 -73
- package/packages/@monomind/cli/dist/src/init/helpers-generator.js +0 -1335
- package/packages/@monomind/cli/dist/src/init/index.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/init/index.js +0 -15
- package/packages/@monomind/cli/dist/src/init/mcp-generator.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/init/mcp-generator.js +0 -107
- package/packages/@monomind/cli/dist/src/init/settings-generator.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -487
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.d.ts +0 -38
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +0 -602
- package/packages/@monomind/cli/dist/src/init/statusline-generator.d.ts +0 -25
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +0 -1358
- package/packages/@monomind/cli/dist/src/init/types.d.ts +0 -308
- package/packages/@monomind/cli/dist/src/init/types.js +0 -247
- package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.d.ts +0 -75
- package/packages/@monomind/cli/dist/src/knowledge/document-pipeline.js +0 -556
- package/packages/@monomind/cli/dist/src/mcp-client.d.ts +0 -64
- package/packages/@monomind/cli/dist/src/mcp-client.js +0 -338
- package/packages/@monomind/cli/dist/src/mcp-server.d.ts +0 -170
- package/packages/@monomind/cli/dist/src/mcp-server.js +0 -964
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +0 -30
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -603
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.d.ts +0 -38
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +0 -389
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +0 -75
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +0 -125
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +0 -237
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +0 -1111
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +0 -827
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +0 -447
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +0 -866
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +0 -582
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +0 -58
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.d.ts +0 -15
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +0 -634
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +0 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +0 -1237
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.d.ts +0 -161
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-embedding.js +0 -516
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.d.ts +0 -22
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-intelligence.js +0 -888
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +0 -1582
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +0 -51
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -31
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -31
- package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.js +0 -156
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +0 -35
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +0 -776
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +0 -136
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +0 -27
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +0 -2443
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +0 -15
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +0 -506
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.d.ts +0 -16
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +0 -680
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.d.ts +0 -261
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +0 -423
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +0 -137
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js +0 -383
- package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.js +0 -58
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.d.ts +0 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +0 -44
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +0 -576
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +0 -431
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +0 -411
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +0 -561
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +0 -28
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +0 -514
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +0 -397
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.d.ts +0 -27
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +0 -76
- package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +0 -58
- package/packages/@monomind/cli/dist/src/mcp-tools/types.js +0 -98
- package/packages/@monomind/cli/dist/src/memory/embedding-operations.d.ts +0 -58
- package/packages/@monomind/cli/dist/src/memory/embedding-operations.js +0 -262
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.d.ts +0 -319
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +0 -698
- package/packages/@monomind/cli/dist/src/memory/hnsw-operations.d.ts +0 -142
- package/packages/@monomind/cli/dist/src/memory/hnsw-operations.js +0 -465
- package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +0 -368
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +0 -1456
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +0 -333
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +0 -1104
- package/packages/@monomind/cli/dist/src/memory/memory-crud.d.ts +0 -67
- package/packages/@monomind/cli/dist/src/memory/memory-crud.js +0 -454
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.d.ts +0 -101
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +0 -431
- package/packages/@monomind/cli/dist/src/memory/memory-kg.d.ts +0 -186
- package/packages/@monomind/cli/dist/src/memory/memory-kg.js +0 -450
- package/packages/@monomind/cli/dist/src/memory/memory-migrations.d.ts +0 -30
- package/packages/@monomind/cli/dist/src/memory/memory-migrations.js +0 -136
- package/packages/@monomind/cli/dist/src/memory/memory-read.d.ts +0 -87
- package/packages/@monomind/cli/dist/src/memory/memory-read.js +0 -333
- package/packages/@monomind/cli/dist/src/memory/memory-schema.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/memory/memory-schema.js +0 -167
- package/packages/@monomind/cli/dist/src/memory/query-router.d.ts +0 -44
- package/packages/@monomind/cli/dist/src/memory/query-router.js +0 -113
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +0 -237
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +0 -647
- package/packages/@monomind/cli/dist/src/monovector/command-outcomes.d.ts +0 -37
- package/packages/@monomind/cli/dist/src/monovector/command-outcomes.js +0 -126
- package/packages/@monomind/cli/dist/src/monovector/coverage-router.d.ts +0 -103
- package/packages/@monomind/cli/dist/src/monovector/coverage-router.js +0 -341
- package/packages/@monomind/cli/dist/src/monovector/coverage-tools.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/monovector/coverage-tools.js +0 -115
- package/packages/@monomind/cli/dist/src/monovector/diff-classifier.d.ts +0 -174
- package/packages/@monomind/cli/dist/src/monovector/diff-classifier.js +0 -738
- package/packages/@monomind/cli/dist/src/monovector/index.d.ts +0 -54
- package/packages/@monomind/cli/dist/src/monovector/index.js +0 -55
- package/packages/@monomind/cli/dist/src/monovector/init-state.d.ts +0 -35
- package/packages/@monomind/cli/dist/src/monovector/init-state.js +0 -36
- package/packages/@monomind/cli/dist/src/monovector/route-outcomes.d.ts +0 -56
- package/packages/@monomind/cli/dist/src/monovector/route-outcomes.js +0 -189
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +0 -40
- package/packages/@monomind/cli/dist/src/observability/replay-reader.js +0 -138
- package/packages/@monomind/cli/dist/src/orgrt/broker.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/orgrt/broker.js +0 -73
- package/packages/@monomind/cli/dist/src/orgrt/bus.d.ts +0 -27
- package/packages/@monomind/cli/dist/src/orgrt/bus.js +0 -71
- package/packages/@monomind/cli/dist/src/orgrt/daemon.d.ts +0 -175
- package/packages/@monomind/cli/dist/src/orgrt/daemon.js +0 -965
- package/packages/@monomind/cli/dist/src/orgrt/forwarder.d.ts +0 -16
- package/packages/@monomind/cli/dist/src/orgrt/forwarder.js +0 -171
- package/packages/@monomind/cli/dist/src/orgrt/inbox.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/orgrt/inbox.js +0 -91
- package/packages/@monomind/cli/dist/src/orgrt/mailbox.d.ts +0 -49
- package/packages/@monomind/cli/dist/src/orgrt/mailbox.js +0 -75
- package/packages/@monomind/cli/dist/src/orgrt/migrate.d.ts +0 -26
- package/packages/@monomind/cli/dist/src/orgrt/migrate.js +0 -118
- package/packages/@monomind/cli/dist/src/orgrt/policy.d.ts +0 -28
- package/packages/@monomind/cli/dist/src/orgrt/policy.js +0 -146
- package/packages/@monomind/cli/dist/src/orgrt/provider.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/orgrt/provider.js +0 -55
- package/packages/@monomind/cli/dist/src/orgrt/reporting.d.ts +0 -40
- package/packages/@monomind/cli/dist/src/orgrt/reporting.js +0 -134
- package/packages/@monomind/cli/dist/src/orgrt/scheduler.d.ts +0 -13
- package/packages/@monomind/cli/dist/src/orgrt/scheduler.js +0 -48
- package/packages/@monomind/cli/dist/src/orgrt/server.d.ts +0 -9
- package/packages/@monomind/cli/dist/src/orgrt/server.js +0 -88
- package/packages/@monomind/cli/dist/src/orgrt/session.d.ts +0 -62
- package/packages/@monomind/cli/dist/src/orgrt/session.js +0 -157
- package/packages/@monomind/cli/dist/src/orgrt/templates.d.ts +0 -17
- package/packages/@monomind/cli/dist/src/orgrt/templates.js +0 -62
- package/packages/@monomind/cli/dist/src/orgrt/test-loop.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/orgrt/test-loop.js +0 -108
- package/packages/@monomind/cli/dist/src/orgrt/types.d.ts +0 -910
- package/packages/@monomind/cli/dist/src/orgrt/types.js +0 -57
- package/packages/@monomind/cli/dist/src/output.d.ts +0 -133
- package/packages/@monomind/cli/dist/src/output.js +0 -529
- package/packages/@monomind/cli/dist/src/parser.d.ts +0 -93
- package/packages/@monomind/cli/dist/src/parser.js +0 -651
- package/packages/@monomind/cli/dist/src/pricing/model-pricing.d.ts +0 -41
- package/packages/@monomind/cli/dist/src/pricing/model-pricing.js +0 -61
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.d.ts +0 -121
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +0 -262
- package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +0 -119
- package/packages/@monomind/cli/dist/src/production/error-handler.js +0 -324
- package/packages/@monomind/cli/dist/src/production/index.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/production/index.js +0 -6
- package/packages/@monomind/cli/dist/src/production/monitoring.d.ts +0 -181
- package/packages/@monomind/cli/dist/src/production/monitoring.js +0 -375
- package/packages/@monomind/cli/dist/src/production/rate-limiter.d.ts +0 -125
- package/packages/@monomind/cli/dist/src/production/rate-limiter.js +0 -218
- package/packages/@monomind/cli/dist/src/production/retry.d.ts +0 -48
- package/packages/@monomind/cli/dist/src/production/retry.js +0 -189
- package/packages/@monomind/cli/dist/src/prompt.d.ts +0 -44
- package/packages/@monomind/cli/dist/src/prompt.js +0 -501
- package/packages/@monomind/cli/dist/src/routing/embed-worker.d.ts +0 -2
- package/packages/@monomind/cli/dist/src/routing/embed-worker.js +0 -79
- package/packages/@monomind/cli/dist/src/routing/embedder.d.ts +0 -31
- package/packages/@monomind/cli/dist/src/routing/embedder.js +0 -0
- package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +0 -24
- package/packages/@monomind/cli/dist/src/routing/llm-caller.js +0 -134
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.d.ts +0 -24
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +0 -239
- package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +0 -80
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +0 -401
- package/packages/@monomind/cli/dist/src/services/crash-reporter.d.ts +0 -42
- package/packages/@monomind/cli/dist/src/services/crash-reporter.js +0 -374
- package/packages/@monomind/cli/dist/src/suggest.d.ts +0 -53
- package/packages/@monomind/cli/dist/src/suggest.js +0 -197
- package/packages/@monomind/cli/dist/src/sync/checker.d.ts +0 -12
- package/packages/@monomind/cli/dist/src/sync/checker.js +0 -26
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +0 -22
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +0 -192
- package/packages/@monomind/cli/dist/src/transfer/types.d.ts +0 -245
- package/packages/@monomind/cli/dist/src/transfer/types.js +0 -6
- package/packages/@monomind/cli/dist/src/types.d.ts +0 -190
- package/packages/@monomind/cli/dist/src/types.js +0 -20
- package/packages/@monomind/cli/dist/src/ui/collector.mjs +0 -879
- package/packages/@monomind/cli/dist/src/ui/dashboard.html +0 -13949
- package/packages/@monomind/cli/dist/src/ui/data/agent-avatars.html +0 -763
- package/packages/@monomind/cli/dist/src/ui/data/agent-avatars.json +0 -966
- package/packages/@monomind/cli/dist/src/ui/data/avatars/account-strategist.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/accounts-payable.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/adaptive-coordinator.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/adaptive-coordinator2.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/ai-citation.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/ai-engineer.svg +0 -61
- package/packages/@monomind/cli/dist/src/ui/data/avatars/analytics-reporter.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/api-tester.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/architecture.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/automation-governance.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/backend-dev.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/benchmarker.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/blockchain-auditor.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/byzantine-coord.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/case-analyst.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/cicd-engineer.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/cloud-architect.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/code-review-swarm.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/coder-v119.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/coder.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/collective-coord.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/compliance-auditor.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/consensus-coordinator.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/content-creator.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/crdt-synchronizer.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/cro-specialist.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/data-consolidator.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/data-engineer.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/database-optimizer.svg +0 -61
- package/packages/@monomind/cli/dist/src/ui/data/avatars/deal-strategist.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/defender.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/devops-automator.svg +0 -56
- package/packages/@monomind/cli/dist/src/ui/data/avatars/discovery-coach.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/email-marketing.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/embedded-firmware.svg +0 -61
- package/packages/@monomind/cli/dist/src/ui/data/avatars/evidence-collector.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/experiment-tracker.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/feedback-synthesizer.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/finance-tracker.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/frontend-developer.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/game-audio-engineer.svg +0 -59
- package/packages/@monomind/cli/dist/src/ui/data/avatars/game-designer.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/gossip-coordinator.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/hierarchical-coord.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/incident-commander.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/infrastructure.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/input-validator.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/ios-developer.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/issue-tracker.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/judge.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/launch-strategist.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/legal-compliance.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/level-designer.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/load-balancer.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/mcp-builder.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/memory-coordinator.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/mesh-coordinator.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/ml-developer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/mobile-app-builder.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/mobile-dev.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/model-qa.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/narrative-designer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/outbound-strategist.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/path-validator.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/payment-agent.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/perf-analyzer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/pipeline-analyst.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/planner.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/pr-manager.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/pricing-strategist.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/product-manager.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/production-validator.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/project-shepherd.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/proposal-strategist.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/prosecutor.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/pseudocode.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/queen-coordinator.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/quorum-manager.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/raft-manager.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/reality-checker.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/recruitment.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/refinement.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/release-manager.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/repo-architect.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/researcher.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/resource-allocator.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/reviewer.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/safe-executor.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/sales-coach.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/sales-engineer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/scout-explorer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/security-architect.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/security-auditor.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/senior-developer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/senior-pm.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/seo-specialist.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/social-media.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/solidity-engineer.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/sparc-coder.svg +0 -58
- package/packages/@monomind/cli/dist/src/ui/data/avatars/sparc-coord.svg +0 -56
- package/packages/@monomind/cli/dist/src/ui/data/avatars/specification.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/sprint-prioritizer.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/sre.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/studio-operations.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/studio-producer.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/support-responder.svg +0 -56
- package/packages/@monomind/cli/dist/src/ui/data/avatars/system-architect.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/task-orchestrator.svg +0 -56
- package/packages/@monomind/cli/dist/src/ui/data/avatars/technical-artist.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/technical-writer.svg +0 -59
- package/packages/@monomind/cli/dist/src/ui/data/avatars/tester.svg +0 -53
- package/packages/@monomind/cli/dist/src/ui/data/avatars/threat-detection.svg +0 -61
- package/packages/@monomind/cli/dist/src/ui/data/avatars/trend-researcher.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/trial-director.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/unity-architect.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/visionos-engineer.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/worker-specialist.svg +0 -55
- package/packages/@monomind/cli/dist/src/ui/data/avatars/workflow-architect.svg +0 -57
- package/packages/@monomind/cli/dist/src/ui/data/avatars/workflow-automation.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/data/avatars/zk-steward.svg +0 -54
- package/packages/@monomind/cli/dist/src/ui/mastermind-diagram-fallback.html +0 -1069
- package/packages/@monomind/cli/dist/src/ui/orgs-files.js +0 -192
- package/packages/@monomind/cli/dist/src/ui/orgs.html +0 -2513
- package/packages/@monomind/cli/dist/src/ui/server.mjs +0 -7256
- package/packages/@monomind/cli/dist/src/ui/sse-manager.mjs +0 -119
- package/packages/@monomind/cli/dist/src/update/checker.d.ts +0 -34
- package/packages/@monomind/cli/dist/src/update/checker.js +0 -278
- package/packages/@monomind/cli/dist/src/update/executor.d.ts +0 -32
- package/packages/@monomind/cli/dist/src/update/executor.js +0 -235
- package/packages/@monomind/cli/dist/src/update/index.d.ts +0 -43
- package/packages/@monomind/cli/dist/src/update/index.js +0 -108
- package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +0 -37
- package/packages/@monomind/cli/dist/src/update/rate-limiter.js +0 -190
- package/packages/@monomind/cli/dist/src/update/validator.d.ts +0 -17
- package/packages/@monomind/cli/dist/src/update/validator.js +0 -166
- package/packages/@monomind/cli/dist/src/utils/cosine-similarity.d.ts +0 -22
- package/packages/@monomind/cli/dist/src/utils/cosine-similarity.js +0 -38
- package/packages/@monomind/cli/dist/src/utils/input-guards.d.ts +0 -66
- package/packages/@monomind/cli/dist/src/utils/input-guards.js +0 -263
- package/packages/@monomind/cli/dist/src/utils/json-file.d.ts +0 -33
- package/packages/@monomind/cli/dist/src/utils/json-file.js +0 -57
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +0 -6
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +0 -22
- package/packages/@monomind/cli/dist/src/utils/resource-governor.d.ts +0 -32
- package/packages/@monomind/cli/dist/src/utils/resource-governor.js +0 -115
- package/packages/@monomind/cli/package.json +0 -127
- package/packages/@monomind/cli/scripts/deploy-ipfs-node.sh +0 -153
- package/packages/@monomind/cli/scripts/publish.sh +0 -61
- package/packages/@monomind/cli/scripts/sync-claude-assets.sh +0 -19
- package/packages/@monomind/cli/scripts/understand-analyze.mjs +0 -1078
- package/scripts/build-fs.mjs +0 -75
- package/scripts/build-monovector.sh +0 -10
- package/scripts/generate-agent-avatars.mjs +0 -492
- package/scripts/generate-channel-profile-assets.sh +0 -67
- package/scripts/growth-content-calendar.mjs +0 -260
- package/scripts/growth-profile-kit.mjs +0 -156
- package/scripts/install.sh +0 -392
- package/scripts/publish-monovector.sh +0 -20
- package/scripts/ua-enrich.mjs +0 -229
- package/scripts/ua-import.mjs +0 -288
- package/scripts/verify-appliance.sh +0 -571
|
@@ -1,2387 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Init Executor
|
|
3
|
-
* Main execution logic for V1 initialization
|
|
4
|
-
*/
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
8
|
-
import { createRequire } from 'module';
|
|
9
|
-
import { dirname } from 'path';
|
|
10
|
-
// ESM-compatible __dirname
|
|
11
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
-
const __dirname = dirname(__filename);
|
|
13
|
-
const MAX_EXEC_FILE_BYTES = 10 * 1024 * 1024; // 10 MB
|
|
14
|
-
/**
|
|
15
|
-
* Probe whether an optionalDependency actually resolved in this install
|
|
16
|
-
* (npm silently skips optionalDependencies it can't satisfy — see
|
|
17
|
-
* docs/AUDIT-BACKLOG.md P1-1/P1-23). Used to caveat generated docs instead
|
|
18
|
-
* of presenting these features as unconditionally working.
|
|
19
|
-
*/
|
|
20
|
-
function _isOptionalPackageResolvable(pkg) {
|
|
21
|
-
try {
|
|
22
|
-
const req = createRequire(import.meta.url);
|
|
23
|
-
req.resolve(pkg);
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Atomic write helper — writes to a sibling .tmp file then renames into place.
|
|
32
|
-
* SIGINT or crash during a partial write would otherwise corrupt user-critical
|
|
33
|
-
* files (.claude/settings.json, .mcp.json, helper scripts that Claude Code
|
|
34
|
-
* executes on every hook). Without atomicity a half-written settings.json or
|
|
35
|
-
* a zero-byte hook-handler.cjs disables Claude Code's protections silently.
|
|
36
|
-
*/
|
|
37
|
-
function atomicWriteFile(target, content, encoding) {
|
|
38
|
-
const tmp = `${target}.${process.pid}.tmp`;
|
|
39
|
-
if (encoding && typeof content === 'string') {
|
|
40
|
-
fs.writeFileSync(tmp, content, encoding);
|
|
41
|
-
}
|
|
42
|
-
else if (typeof content === 'string') {
|
|
43
|
-
fs.writeFileSync(tmp, content, 'utf-8');
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
fs.writeFileSync(tmp, content);
|
|
47
|
-
}
|
|
48
|
-
fs.renameSync(tmp, target);
|
|
49
|
-
}
|
|
50
|
-
import { detectPlatform, DEFAULT_INIT_OPTIONS } from './types.js';
|
|
51
|
-
import { writeSharedInstructions } from './shared-instructions-generator.js';
|
|
52
|
-
import { generateSettingsJson, generateSettings } from './settings-generator.js';
|
|
53
|
-
import { generateMCPJson } from './mcp-generator.js';
|
|
54
|
-
import { generateStatuslineScript } from './statusline-generator.js';
|
|
55
|
-
import { FORCE_SYNC_HELPERS, FORCE_SYNC_GENERATORS, INIT_FALLBACK_HELPERS, } from './helpers-generator.js';
|
|
56
|
-
import { generateClaudeMd } from './claudemd-generator.js';
|
|
57
|
-
/**
|
|
58
|
-
* Skills to copy based on configuration
|
|
59
|
-
*/
|
|
60
|
-
const SKILLS_MAP = {
|
|
61
|
-
core: [
|
|
62
|
-
'swarm-orchestration',
|
|
63
|
-
'swarm-advanced',
|
|
64
|
-
'hooks-automation',
|
|
65
|
-
'pair-programming',
|
|
66
|
-
'verification-quality',
|
|
67
|
-
'skill-builder',
|
|
68
|
-
'specialagent',
|
|
69
|
-
'monodesign',
|
|
70
|
-
'monomotion',
|
|
71
|
-
'monolean',
|
|
72
|
-
'monolean-review',
|
|
73
|
-
'monolean-audit',
|
|
74
|
-
'monolean-debt',
|
|
75
|
-
'monolean-help',
|
|
76
|
-
'hive-mind-advanced',
|
|
77
|
-
// The mastermind command files installed by init invoke
|
|
78
|
-
// Skill("mastermind-<name>") at runtime — one top-level
|
|
79
|
-
// mastermind-<name>/SKILL.md directory per skill. The glob expands in
|
|
80
|
-
// copySkills against the source tree, so newly added mastermind skills
|
|
81
|
-
// ship automatically; without them those references break in user projects.
|
|
82
|
-
'mastermind-*',
|
|
83
|
-
],
|
|
84
|
-
browser: ['agent-browser-testing'],
|
|
85
|
-
// NOTE: memory-toolkit and github-toolkit are single consolidated skills
|
|
86
|
-
// (not one skill per capability) — see .claude/skills/memory-toolkit and
|
|
87
|
-
// .claude/skills/github-toolkit. The finer-grained names previously listed
|
|
88
|
-
// here (memory-advanced, github-code-review, etc.) never had matching
|
|
89
|
-
// source directories and silently copied nothing.
|
|
90
|
-
memory: ['memory-toolkit'],
|
|
91
|
-
github: ['github-toolkit'],
|
|
92
|
-
advanced: [
|
|
93
|
-
'agentic-jujutsu',
|
|
94
|
-
'performance-analysis',
|
|
95
|
-
],
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Commands to copy based on configuration
|
|
99
|
-
*/
|
|
100
|
-
const COMMANDS_MAP = {
|
|
101
|
-
core: [
|
|
102
|
-
'mastermind.md', 'tokens.md', 'monobrowse.md', 'ts.md',
|
|
103
|
-
],
|
|
104
|
-
agents: ['agents'],
|
|
105
|
-
analysis: ['analysis'],
|
|
106
|
-
automation: ['automation'],
|
|
107
|
-
coordination: ['coordination'],
|
|
108
|
-
github: ['github'],
|
|
109
|
-
hiveMind: ['hive-mind'],
|
|
110
|
-
hooks: ['hooks'],
|
|
111
|
-
mastermind: ['mastermind'],
|
|
112
|
-
memory: ['memory'],
|
|
113
|
-
monitoring: ['monitoring'],
|
|
114
|
-
monograph: ['monograph'],
|
|
115
|
-
monomind: ['mastermind'],
|
|
116
|
-
optimization: ['optimization'],
|
|
117
|
-
pair: ['pair'],
|
|
118
|
-
streamChain: ['stream-chain'],
|
|
119
|
-
swarm: ['swarm'],
|
|
120
|
-
training: ['training'],
|
|
121
|
-
truth: ['truth'],
|
|
122
|
-
verify: ['verify'],
|
|
123
|
-
workflows: ['workflows'],
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Agents to copy based on configuration
|
|
127
|
-
*/
|
|
128
|
-
const AGENTS_MAP = {
|
|
129
|
-
academic: ['academic'],
|
|
130
|
-
analysis: ['analysis'],
|
|
131
|
-
architecture: ['architecture'],
|
|
132
|
-
consensus: ['consensus'],
|
|
133
|
-
core: ['core'],
|
|
134
|
-
data: ['data'],
|
|
135
|
-
design: ['design'],
|
|
136
|
-
development: ['development'],
|
|
137
|
-
devops: ['devops'],
|
|
138
|
-
documentation: ['documentation'],
|
|
139
|
-
engineering: ['engineering'],
|
|
140
|
-
gameDevelopment: ['game-development'],
|
|
141
|
-
github: ['github'],
|
|
142
|
-
goal: ['goal'],
|
|
143
|
-
hiveMind: ['hive-mind'],
|
|
144
|
-
marketing: ['marketing'],
|
|
145
|
-
neural: ['neural'],
|
|
146
|
-
optimization: ['optimization'],
|
|
147
|
-
paidMedia: ['paid-media'],
|
|
148
|
-
payments: ['payments'],
|
|
149
|
-
product: ['product'],
|
|
150
|
-
projectManagement: ['project-management'],
|
|
151
|
-
reasoning: ['reasoning'],
|
|
152
|
-
sales: ['sales'],
|
|
153
|
-
schemas: ['schemas'],
|
|
154
|
-
sona: ['sona'],
|
|
155
|
-
spatialComputing: ['spatial-computing'],
|
|
156
|
-
specialists: ['specialists'],
|
|
157
|
-
specialized: ['specialized'],
|
|
158
|
-
sublinear: ['sublinear'],
|
|
159
|
-
support: ['support'],
|
|
160
|
-
swarm: ['swarm'],
|
|
161
|
-
templates: ['templates'],
|
|
162
|
-
testing: ['testing'],
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Directory structure to create
|
|
166
|
-
*/
|
|
167
|
-
const DIRECTORIES = {
|
|
168
|
-
claude: [
|
|
169
|
-
'.claude',
|
|
170
|
-
'.claude/skills',
|
|
171
|
-
'.claude/commands',
|
|
172
|
-
'.claude/agents',
|
|
173
|
-
'.claude/helpers',
|
|
174
|
-
],
|
|
175
|
-
runtime: [
|
|
176
|
-
'.monomind',
|
|
177
|
-
'.monomind/data',
|
|
178
|
-
'.monomind/logs',
|
|
179
|
-
'.monomind/sessions',
|
|
180
|
-
'.monomind/hooks',
|
|
181
|
-
'.monomind/agents',
|
|
182
|
-
'.monomind/workflows',
|
|
183
|
-
],
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* Execute initialization
|
|
187
|
-
*/
|
|
188
|
-
export async function executeInit(options) {
|
|
189
|
-
// Detect platform
|
|
190
|
-
const platform = detectPlatform();
|
|
191
|
-
const result = {
|
|
192
|
-
success: true,
|
|
193
|
-
platform,
|
|
194
|
-
created: {
|
|
195
|
-
directories: [],
|
|
196
|
-
files: [],
|
|
197
|
-
},
|
|
198
|
-
updated: [],
|
|
199
|
-
skipped: [],
|
|
200
|
-
errors: [],
|
|
201
|
-
summary: {
|
|
202
|
-
skillsCount: 0,
|
|
203
|
-
commandsCount: 0,
|
|
204
|
-
agentsCount: 0,
|
|
205
|
-
hooksEnabled: 0,
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
const targetDir = options.targetDir;
|
|
209
|
-
try {
|
|
210
|
-
// Create directory structure
|
|
211
|
-
await createDirectories(targetDir, options, result);
|
|
212
|
-
// Scan directory and save fingerprint (non-fatal if failed)
|
|
213
|
-
let capMgr = null;
|
|
214
|
-
try {
|
|
215
|
-
const { scanDirectory, saveFingerprint, CapabilityManager, codeCapability, documentsCapability, mediaCapability, timelineCapability, graphCapability, dataCapability } = await import('../capabilities/index.js');
|
|
216
|
-
const scan = await scanDirectory(targetDir);
|
|
217
|
-
const monomindDir = path.join(targetDir, '.monomind');
|
|
218
|
-
await saveFingerprint(scan, monomindDir);
|
|
219
|
-
// Activate capabilities
|
|
220
|
-
capMgr = new CapabilityManager();
|
|
221
|
-
capMgr.register(codeCapability);
|
|
222
|
-
capMgr.register(documentsCapability);
|
|
223
|
-
capMgr.register(mediaCapability);
|
|
224
|
-
capMgr.register(timelineCapability);
|
|
225
|
-
capMgr.register(graphCapability);
|
|
226
|
-
capMgr.register(dataCapability);
|
|
227
|
-
await capMgr.activateFromScan(scan, targetDir);
|
|
228
|
-
// Print capability-aware messaging (always show active capabilities,
|
|
229
|
-
// regardless of whether 'code' is also active, so mixed projects get feedback)
|
|
230
|
-
console.log('\nActivating capabilities:');
|
|
231
|
-
for (const cap of capMgr.getActive()) {
|
|
232
|
-
console.log(` ✓ ${cap.name}`);
|
|
233
|
-
}
|
|
234
|
-
// Second Brain: if documents capability is active, index documents
|
|
235
|
-
const activeNames = capMgr.getActive().map((c) => c.name);
|
|
236
|
-
if (activeNames.includes('documents')) {
|
|
237
|
-
try {
|
|
238
|
-
const { ingestDirectory } = await import('../knowledge/document-pipeline.js');
|
|
239
|
-
console.log('\nIndexing documents for Second Brain...');
|
|
240
|
-
const docResult = await ingestDirectory(targetDir, 'shared', { rootDir: targetDir });
|
|
241
|
-
if (docResult.filesProcessed > 0) {
|
|
242
|
-
console.log(` ✓ ${docResult.totalChunks} chunks from ${docResult.filesProcessed} documents`);
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
console.log(' ✓ Knowledge base initialized (no new documents to index)');
|
|
246
|
-
}
|
|
247
|
-
result.created.files.push('.monomind/knowledge/');
|
|
248
|
-
}
|
|
249
|
-
catch (docErr) {
|
|
250
|
-
result.skipped.push(`knowledge indexing: ${docErr instanceof Error ? docErr.message : String(docErr)}`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
catch (scanError) {
|
|
255
|
-
// Scanner/fingerprint/activation failed — non-fatal, continue without capabilities
|
|
256
|
-
result.skipped.push(`directory scan: ${scanError instanceof Error ? scanError.message : String(scanError)}`);
|
|
257
|
-
}
|
|
258
|
-
// Generate and write settings.json
|
|
259
|
-
if (options.components.settings) {
|
|
260
|
-
await writeSettings(targetDir, options, result);
|
|
261
|
-
}
|
|
262
|
-
// Generate and write .mcp.json
|
|
263
|
-
if (options.components.mcp) {
|
|
264
|
-
await writeMCPConfig(targetDir, options, result);
|
|
265
|
-
}
|
|
266
|
-
// Copy skills
|
|
267
|
-
if (options.components.skills) {
|
|
268
|
-
await copySkills(targetDir, options, result);
|
|
269
|
-
}
|
|
270
|
-
// Copy commands
|
|
271
|
-
if (options.components.commands) {
|
|
272
|
-
await copyCommands(targetDir, options, result);
|
|
273
|
-
}
|
|
274
|
-
// Copy agents
|
|
275
|
-
if (options.components.agents) {
|
|
276
|
-
await copyAgents(targetDir, options, result);
|
|
277
|
-
}
|
|
278
|
-
// Generate helpers
|
|
279
|
-
if (options.components.helpers) {
|
|
280
|
-
await writeHelpers(targetDir, options, result);
|
|
281
|
-
}
|
|
282
|
-
// Generate statusline
|
|
283
|
-
if (options.components.statusline) {
|
|
284
|
-
await writeStatusline(targetDir, options, result);
|
|
285
|
-
}
|
|
286
|
-
// Generate runtime config
|
|
287
|
-
if (options.components.runtime) {
|
|
288
|
-
await writeRuntimeConfig(targetDir, options, result);
|
|
289
|
-
}
|
|
290
|
-
// Create initial metrics for statusline (prevents "all zeros" display)
|
|
291
|
-
if (options.components.statusline) {
|
|
292
|
-
await writeInitialMetrics(targetDir, options, result);
|
|
293
|
-
}
|
|
294
|
-
// Generate CLAUDE.md
|
|
295
|
-
if (options.components.claudeMd) {
|
|
296
|
-
await writeClaudeMd(targetDir, options, result);
|
|
297
|
-
}
|
|
298
|
-
// Generate .agents/shared_instructions.md + seed project memory
|
|
299
|
-
writeSharedInstructions(targetDir, options.force, result);
|
|
300
|
-
// Count enabled hooks
|
|
301
|
-
result.summary.hooksEnabled = countEnabledHooks(options);
|
|
302
|
-
// Build knowledge graph in background (non-blocking) — code-project only
|
|
303
|
-
if (options.components.graphify && (capMgr === null || capMgr.isActive('code'))) {
|
|
304
|
-
await initKnowledgeGraph(targetDir, result);
|
|
305
|
-
}
|
|
306
|
-
else if (options.components.graphify) {
|
|
307
|
-
result.skipped.push('knowledge graph: not a code project (skipping monograph indexing)');
|
|
308
|
-
}
|
|
309
|
-
// Run doctor auto-fix (non-blocking, best-effort)
|
|
310
|
-
await runDoctorFix(targetDir, result);
|
|
311
|
-
// Register this project in ~/.monomind-projects.json so upgrade --all finds it
|
|
312
|
-
_registerMonomindProject(targetDir);
|
|
313
|
-
}
|
|
314
|
-
catch (error) {
|
|
315
|
-
result.success = false;
|
|
316
|
-
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
317
|
-
}
|
|
318
|
-
return result;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Initialize the Monograph knowledge graph.
|
|
322
|
-
* Spawns buildAsync as a detached child process to avoid SQLite lock contention.
|
|
323
|
-
* Uses the same build.lock file as graphify-freshen.cjs — if a session-start
|
|
324
|
-
* hook build is already running, we skip to avoid SQLITE_BUSY.
|
|
325
|
-
*/
|
|
326
|
-
async function initKnowledgeGraph(targetDir, result) {
|
|
327
|
-
const outputDir = path.join(targetDir, '.monomind', 'graph');
|
|
328
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
329
|
-
const lockPath = path.join(outputDir, 'build.lock');
|
|
330
|
-
const now = Date.now();
|
|
331
|
-
// If graphify-freshen.cjs (session-start hook) already holds a fresh lock, skip.
|
|
332
|
-
try {
|
|
333
|
-
const stat = fs.statSync(lockPath);
|
|
334
|
-
if (now - stat.mtimeMs < 5 * 60 * 1000) {
|
|
335
|
-
result.skipped.push('knowledge graph build: already in progress (session-start hook running)');
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
fs.unlinkSync(lockPath);
|
|
339
|
-
}
|
|
340
|
-
catch { /* no lock — proceed */ }
|
|
341
|
-
// Resolve @monoes/monograph from the CLI package's own node_modules first
|
|
342
|
-
// (correct for npm/npx installs), then fall back to user project node_modules.
|
|
343
|
-
let entryPoint = null;
|
|
344
|
-
try {
|
|
345
|
-
const cliRequire = createRequire(import.meta.url);
|
|
346
|
-
entryPoint = cliRequire.resolve('@monoes/monograph/dist/src/index.js');
|
|
347
|
-
}
|
|
348
|
-
catch {
|
|
349
|
-
const fallback = path.join(targetDir, 'node_modules', '@monoes', 'monograph', 'dist', 'src', 'index.js');
|
|
350
|
-
if (fs.existsSync(fallback))
|
|
351
|
-
entryPoint = fallback;
|
|
352
|
-
}
|
|
353
|
-
if (!entryPoint) {
|
|
354
|
-
// Auto-install @monoes/monograph and retry before giving up
|
|
355
|
-
try {
|
|
356
|
-
const { execSync } = await import('child_process');
|
|
357
|
-
execSync('npm install @monoes/monograph', { cwd: targetDir, stdio: 'ignore', timeout: 60000 });
|
|
358
|
-
try {
|
|
359
|
-
const cliRequire2 = createRequire(import.meta.url);
|
|
360
|
-
entryPoint = cliRequire2.resolve('@monoes/monograph/dist/src/index.js');
|
|
361
|
-
}
|
|
362
|
-
catch {
|
|
363
|
-
const fallback2 = path.join(targetDir, 'node_modules', '@monoes', 'monograph', 'dist', 'src', 'index.js');
|
|
364
|
-
if (fs.existsSync(fallback2))
|
|
365
|
-
entryPoint = fallback2;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
catch { /* install failed, fall through */ }
|
|
369
|
-
if (!entryPoint) {
|
|
370
|
-
result.skipped.push('knowledge graph: @monoes/monograph not found (auto-install failed)');
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
result.created.files.push('@monoes/monograph (auto-installed for knowledge graph)');
|
|
374
|
-
}
|
|
375
|
-
// Acquire lock before spawning so graphify-freshen.cjs sees it and skips
|
|
376
|
-
try {
|
|
377
|
-
fs.writeFileSync(lockPath, String(process.pid));
|
|
378
|
-
}
|
|
379
|
-
catch { /* non-fatal */ }
|
|
380
|
-
const { spawn } = await import('child_process');
|
|
381
|
-
const logPath = path.join(outputDir, 'build.log');
|
|
382
|
-
let logFd = 'ignore';
|
|
383
|
-
try {
|
|
384
|
-
logFd = fs.openSync(logPath, 'a');
|
|
385
|
-
}
|
|
386
|
-
catch { /* non-fatal */ }
|
|
387
|
-
const script = `
|
|
388
|
-
import { buildAsync } from ${JSON.stringify(pathToFileURL(entryPoint).href)};
|
|
389
|
-
import { unlinkSync } from 'fs';
|
|
390
|
-
try { await buildAsync(${JSON.stringify(targetDir)}); } finally {
|
|
391
|
-
try { unlinkSync(${JSON.stringify(lockPath)}); } catch {}
|
|
392
|
-
}`;
|
|
393
|
-
const child = spawn(process.execPath, ['--input-type=module', '--eval', script], {
|
|
394
|
-
detached: true,
|
|
395
|
-
stdio: ['ignore', logFd, logFd],
|
|
396
|
-
cwd: targetDir,
|
|
397
|
-
});
|
|
398
|
-
child.unref();
|
|
399
|
-
// Close the parent's copy of the fd — the child has its own inherited copy
|
|
400
|
-
if (typeof logFd === 'number') {
|
|
401
|
-
try {
|
|
402
|
-
fs.closeSync(logFd);
|
|
403
|
-
}
|
|
404
|
-
catch { /* non-fatal */ }
|
|
405
|
-
}
|
|
406
|
-
result.created.files.push('.monomind/graph/ (knowledge graph building in background)');
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Run doctor --install to auto-fix any remaining issues.
|
|
410
|
-
* Non-fatal: best-effort health check and auto-install.
|
|
411
|
-
*/
|
|
412
|
-
async function runDoctorFix(targetDir, result) {
|
|
413
|
-
// Run the doctor THIS binary ships, in-process.
|
|
414
|
-
//
|
|
415
|
-
// This used to be `execSync('npx monomind@latest doctor --install')`, which
|
|
416
|
-
// was wrong in three ways at once: it downloaded and ran a DIFFERENT version
|
|
417
|
-
// than the one the user deliberately invoked (so `monomind@2.7.0 init` was
|
|
418
|
-
// finished by whatever `latest` happened to be), it silently required network
|
|
419
|
-
// — on a machine without it, the 120s timeout elapsed and init reported
|
|
420
|
-
// "skipped" with no explanation — and `stdio: 'ignore'` discarded everything
|
|
421
|
-
// it said, so a failed health check looked identical to a passing one.
|
|
422
|
-
try {
|
|
423
|
-
const { doctorCommand } = await import('../commands/doctor.js');
|
|
424
|
-
if (!doctorCommand.action) {
|
|
425
|
-
result.skipped.push('doctor: auto-fix unavailable (run: monomind doctor --install)');
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
const res = await doctorCommand.action({
|
|
429
|
-
args: [],
|
|
430
|
-
flags: { install: true },
|
|
431
|
-
cwd: targetDir,
|
|
432
|
-
});
|
|
433
|
-
// Report what actually happened rather than asserting success either way.
|
|
434
|
-
if (res && res.success === false) {
|
|
435
|
-
result.skipped.push('doctor: reported issues (run: monomind doctor for details)');
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
result.created.files.push('doctor --install (health check + auto-fix)');
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
catch (err) {
|
|
442
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
443
|
-
result.skipped.push(`doctor: auto-fix failed (${detail}) — run: monomind doctor --install`);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Merge new settings into existing settings.json
|
|
448
|
-
* Preserves user customizations while adding new features like Agent Teams
|
|
449
|
-
* Uses platform-specific commands for Mac, Linux, and Windows
|
|
450
|
-
*/
|
|
451
|
-
function mergeSettingsForUpgrade(existing) {
|
|
452
|
-
const merged = { ...existing };
|
|
453
|
-
const platform = detectPlatform();
|
|
454
|
-
const isWindows = platform.os === 'windows';
|
|
455
|
-
// Platform-specific command wrappers
|
|
456
|
-
// Windows: Use PowerShell-compatible commands
|
|
457
|
-
// Mac/Linux: Use bash-compatible commands with 2>/dev/null
|
|
458
|
-
// NOTE: teammateIdleCmd and taskCompletedCmd were removed.
|
|
459
|
-
// TeammateIdle/TaskCompleted are not valid Claude Code hook events and caused warnings.
|
|
460
|
-
// Agent Teams hook config lives in monomind.agentTeams.hooks instead.
|
|
461
|
-
// 1. Merge env vars (preserve existing, add new)
|
|
462
|
-
const existingEnv = existing.env || {};
|
|
463
|
-
merged.env = {
|
|
464
|
-
...existingEnv,
|
|
465
|
-
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1',
|
|
466
|
-
MONOMIND_V1_ENABLED: existingEnv.MONOMIND_V1_ENABLED || 'true',
|
|
467
|
-
MONOMIND_HOOKS_ENABLED: existingEnv.MONOMIND_HOOKS_ENABLED || 'true',
|
|
468
|
-
};
|
|
469
|
-
// 2. Merge hooks (preserve existing, add new Agent Teams + auto-memory hooks)
|
|
470
|
-
const existingHooks = existing.hooks || {};
|
|
471
|
-
merged.hooks = { ...existingHooks };
|
|
472
|
-
// Cross-platform auto-memory hook commands that resolve paths via git root.
|
|
473
|
-
// Uses node -e with git rev-parse so hooks work regardless of CWD (#1259, #1284).
|
|
474
|
-
const gitRootResolver = "var c=require('child_process'),p=require('path'),u=require('url'),r;"
|
|
475
|
-
+ "try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}"
|
|
476
|
-
+ 'catch(e){r=process.cwd()}';
|
|
477
|
-
const autoMemoryScript = '.claude/helpers/auto-memory-hook.mjs';
|
|
478
|
-
const autoMemoryImportCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" import`;
|
|
479
|
-
const autoMemorySyncCmd = `node -e "${gitRootResolver}var f=p.join(r,'${autoMemoryScript}');import(u.pathToFileURL(f).href)" sync`;
|
|
480
|
-
// Add auto-memory import to SessionStart (if not already present)
|
|
481
|
-
const sessionStartHooks = existingHooks.SessionStart;
|
|
482
|
-
const hasAutoMemoryImport = sessionStartHooks?.some(group => group.hooks?.some(h => h.command?.includes('auto-memory-hook')));
|
|
483
|
-
if (!hasAutoMemoryImport) {
|
|
484
|
-
const startHooks = merged.hooks;
|
|
485
|
-
if (!startHooks.SessionStart) {
|
|
486
|
-
startHooks.SessionStart = [{ hooks: [] }];
|
|
487
|
-
}
|
|
488
|
-
const startGroup = startHooks.SessionStart[0];
|
|
489
|
-
if (!startGroup.hooks)
|
|
490
|
-
startGroup.hooks = [];
|
|
491
|
-
startGroup.hooks.push({
|
|
492
|
-
type: 'command',
|
|
493
|
-
command: autoMemoryImportCmd,
|
|
494
|
-
timeout: 6000,
|
|
495
|
-
continueOnError: true,
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
// Add auto-memory sync to SessionEnd (if not already present)
|
|
499
|
-
const sessionEndHooks = existingHooks.SessionEnd;
|
|
500
|
-
const hasAutoMemorySync = sessionEndHooks?.some(group => group.hooks?.some(h => h.command?.includes('auto-memory-hook')));
|
|
501
|
-
if (!hasAutoMemorySync) {
|
|
502
|
-
const endHooks = merged.hooks;
|
|
503
|
-
if (!endHooks.SessionEnd) {
|
|
504
|
-
endHooks.SessionEnd = [{ hooks: [] }];
|
|
505
|
-
}
|
|
506
|
-
const endGroup = endHooks.SessionEnd[0];
|
|
507
|
-
if (!endGroup.hooks)
|
|
508
|
-
endGroup.hooks = [];
|
|
509
|
-
// Insert at beginning so sync runs before other cleanup
|
|
510
|
-
endGroup.hooks.unshift({
|
|
511
|
-
type: 'command',
|
|
512
|
-
command: autoMemorySyncCmd,
|
|
513
|
-
timeout: 8000,
|
|
514
|
-
continueOnError: true,
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
// NOTE: TeammateIdle and TaskCompleted are NOT valid Claude Code hook events.
|
|
518
|
-
// They cause warnings when present in settings.json hooks.
|
|
519
|
-
// Remove them if they exist from a previous init.
|
|
520
|
-
delete merged.hooks.TeammateIdle;
|
|
521
|
-
delete merged.hooks.TaskCompleted;
|
|
522
|
-
// Their configuration lives in monomind.agentTeams.hooks instead.
|
|
523
|
-
// 3. Fix statusLine config (remove invalid fields, ensure correct format)
|
|
524
|
-
// Claude Code only supports: type, command, padding
|
|
525
|
-
const existingStatusLine = existing.statusLine;
|
|
526
|
-
if (existingStatusLine) {
|
|
527
|
-
merged.statusLine = {
|
|
528
|
-
type: 'command',
|
|
529
|
-
command: existingStatusLine.command || `node -e "var c=require('child_process'),p=require('path'),r;try{r=c.execSync('git rev-parse --show-toplevel',{encoding:'utf8'}).trim()}catch(e){r=process.cwd()}var s=p.join(r,'.claude/helpers/statusline.cjs');process.argv.splice(1,0,s);require(s)"`,
|
|
530
|
-
// Remove invalid fields: refreshMs, enabled (not supported by Claude Code)
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
// 4. Merge monomind settings (preserve existing, add agentTeams + memory)
|
|
534
|
-
const existingMonomind = existing.monomind || {};
|
|
535
|
-
const existingMemory = existingMonomind.memory || {};
|
|
536
|
-
merged.monomind = {
|
|
537
|
-
...existingMonomind,
|
|
538
|
-
version: existingMonomind.version || '3.0.0',
|
|
539
|
-
enabled: existingMonomind.enabled !== false,
|
|
540
|
-
agentTeams: {
|
|
541
|
-
enabled: true,
|
|
542
|
-
teammateMode: 'auto',
|
|
543
|
-
taskListEnabled: true,
|
|
544
|
-
mailboxEnabled: true,
|
|
545
|
-
coordination: {
|
|
546
|
-
autoAssignOnIdle: true,
|
|
547
|
-
trainPatternsOnComplete: true,
|
|
548
|
-
notifyLeadOnComplete: true,
|
|
549
|
-
sharedMemoryNamespace: 'agent-teams',
|
|
550
|
-
},
|
|
551
|
-
hooks: {
|
|
552
|
-
teammateIdle: { enabled: true, autoAssign: true, checkTaskList: true },
|
|
553
|
-
taskCompleted: { enabled: true, trainPatterns: true, notifyLead: true },
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
memory: {
|
|
557
|
-
...existingMemory,
|
|
558
|
-
learningBridge: existingMemory.learningBridge ?? { enabled: true },
|
|
559
|
-
memoryGraph: existingMemory.memoryGraph ?? { enabled: true },
|
|
560
|
-
agentScopes: existingMemory.agentScopes ?? { enabled: true },
|
|
561
|
-
},
|
|
562
|
-
};
|
|
563
|
-
return merged;
|
|
564
|
-
}
|
|
565
|
-
/**
|
|
566
|
-
* Execute upgrade - updates helpers and creates missing metrics without losing data
|
|
567
|
-
* This is safe for existing users who want the latest statusline fixes
|
|
568
|
-
* @param targetDir - Target directory
|
|
569
|
-
* @param upgradeSettings - If true, merge new settings into existing settings.json
|
|
570
|
-
*/
|
|
571
|
-
export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
572
|
-
const result = {
|
|
573
|
-
success: true,
|
|
574
|
-
updated: [],
|
|
575
|
-
created: [],
|
|
576
|
-
preserved: [],
|
|
577
|
-
errors: [],
|
|
578
|
-
settingsUpdated: [],
|
|
579
|
-
};
|
|
580
|
-
try {
|
|
581
|
-
// Ensure required directories exist
|
|
582
|
-
const dirs = [
|
|
583
|
-
'.claude/helpers',
|
|
584
|
-
'.monomind/metrics',
|
|
585
|
-
'.monomind/security',
|
|
586
|
-
'.monomind/learning',
|
|
587
|
-
];
|
|
588
|
-
for (const dir of dirs) {
|
|
589
|
-
const fullPath = path.join(targetDir, dir);
|
|
590
|
-
if (!fs.existsSync(fullPath)) {
|
|
591
|
-
fs.mkdirSync(fullPath, { recursive: true });
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
// 0. ALWAYS update critical helpers + subdirectories (force overwrite)
|
|
595
|
-
const sourceHelpersForUpgrade = findSourceHelpersDir();
|
|
596
|
-
if (sourceHelpersForUpgrade) {
|
|
597
|
-
const destHelpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
598
|
-
// Copy top-level critical files atomically. Membership and fallback
|
|
599
|
-
// generators come from the shared HELPER_FILES registry (helpers-generator.ts)
|
|
600
|
-
// rather than a hardcoded list here — see that file's comment for why.
|
|
601
|
-
const criticalHelpers = FORCE_SYNC_HELPERS;
|
|
602
|
-
// Generated fallback for any critical helper missing from the source dir itself
|
|
603
|
-
// (e.g. the published npm template lacking auto-memory-hook.mjs).
|
|
604
|
-
const criticalGenerators = FORCE_SYNC_GENERATORS;
|
|
605
|
-
for (const helperName of criticalHelpers) {
|
|
606
|
-
const targetPath = path.join(destHelpersDir, helperName);
|
|
607
|
-
const sourcePath = path.join(sourceHelpersForUpgrade, helperName);
|
|
608
|
-
if (fs.existsSync(sourcePath)) {
|
|
609
|
-
if (fs.existsSync(targetPath)) {
|
|
610
|
-
result.updated.push(`.claude/helpers/${helperName}`);
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
result.created.push(`.claude/helpers/${helperName}`);
|
|
614
|
-
}
|
|
615
|
-
// Atomic copy-via-rename so a partial write can't leave a broken hook
|
|
616
|
-
const tmp = targetPath + '.tmp';
|
|
617
|
-
fs.copyFileSync(sourcePath, tmp);
|
|
618
|
-
try {
|
|
619
|
-
fs.chmodSync(tmp, 0o755);
|
|
620
|
-
}
|
|
621
|
-
catch { }
|
|
622
|
-
fs.renameSync(tmp, targetPath);
|
|
623
|
-
}
|
|
624
|
-
else if (!fs.existsSync(targetPath) && criticalGenerators[helperName]) {
|
|
625
|
-
const content = criticalGenerators[helperName]();
|
|
626
|
-
const tmp = `${targetPath}.${process.pid}.tmp`;
|
|
627
|
-
fs.writeFileSync(tmp, content, 'utf-8');
|
|
628
|
-
try {
|
|
629
|
-
fs.chmodSync(tmp, 0o755);
|
|
630
|
-
}
|
|
631
|
-
catch { }
|
|
632
|
-
fs.renameSync(tmp, targetPath);
|
|
633
|
-
result.created.push(`.claude/helpers/${helperName}`);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
// Always recursively sync subdirectories (utils/, handlers/) — required by hook-handler.cjs.
|
|
637
|
-
// Uses recursive copy so any future nested subdirs are also covered.
|
|
638
|
-
for (const subdir of ['utils', 'handlers']) {
|
|
639
|
-
const srcSubdir = path.join(sourceHelpersForUpgrade, subdir);
|
|
640
|
-
const destSubdir = path.join(destHelpersDir, subdir);
|
|
641
|
-
if (fs.existsSync(srcSubdir)) {
|
|
642
|
-
copyDirRecursive(srcSubdir, destSubdir);
|
|
643
|
-
result.updated.push(`.claude/helpers/${subdir}/`);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
// Source not found (npx with broken paths) — use generated fallbacks
|
|
649
|
-
// for every force-synced helper that has one (see HELPER_FILES registry).
|
|
650
|
-
const generatedCritical = Object.fromEntries(Object.entries(FORCE_SYNC_GENERATORS).map(([name, generate]) => [name, generate()]));
|
|
651
|
-
for (const [helperName, content] of Object.entries(generatedCritical)) {
|
|
652
|
-
const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
653
|
-
if (fs.existsSync(targetPath)) {
|
|
654
|
-
result.updated.push(`.claude/helpers/${helperName}`);
|
|
655
|
-
}
|
|
656
|
-
else {
|
|
657
|
-
result.created.push(`.claude/helpers/${helperName}`);
|
|
658
|
-
}
|
|
659
|
-
// Atomic write (PID-suffixed) so a partial hook-handler.cjs cannot
|
|
660
|
-
// ship if init is interrupted, and concurrent inits don't collide on
|
|
661
|
-
// the same .tmp filename.
|
|
662
|
-
const tmp = `${targetPath}.${process.pid}.tmp`;
|
|
663
|
-
fs.writeFileSync(tmp, content, 'utf-8');
|
|
664
|
-
try {
|
|
665
|
-
fs.chmodSync(tmp, 0o755);
|
|
666
|
-
}
|
|
667
|
-
catch { }
|
|
668
|
-
fs.renameSync(tmp, targetPath);
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
// 1. Statusline fallback — only generate if source copy above didn't cover it
|
|
672
|
-
const statuslinePath = path.join(targetDir, '.claude', 'helpers', 'statusline.cjs');
|
|
673
|
-
if (!sourceHelpersForUpgrade || !fs.existsSync(path.join(sourceHelpersForUpgrade, 'statusline.cjs'))) {
|
|
674
|
-
const upgradeOptions = {
|
|
675
|
-
...DEFAULT_INIT_OPTIONS,
|
|
676
|
-
targetDir,
|
|
677
|
-
force: true,
|
|
678
|
-
statusline: {
|
|
679
|
-
...DEFAULT_INIT_OPTIONS.statusline,
|
|
680
|
-
refreshInterval: 5000,
|
|
681
|
-
},
|
|
682
|
-
};
|
|
683
|
-
const statuslineContent = generateStatuslineScript(upgradeOptions);
|
|
684
|
-
if (fs.existsSync(statuslinePath)) {
|
|
685
|
-
result.updated.push('.claude/helpers/statusline.cjs');
|
|
686
|
-
}
|
|
687
|
-
else {
|
|
688
|
-
result.created.push('.claude/helpers/statusline.cjs');
|
|
689
|
-
}
|
|
690
|
-
atomicWriteFile(statuslinePath, statuslineContent);
|
|
691
|
-
}
|
|
692
|
-
// 2. Create MISSING metrics files only (preserve existing data)
|
|
693
|
-
const metricsDir = path.join(targetDir, '.monomind', 'metrics');
|
|
694
|
-
const securityDir = path.join(targetDir, '.monomind', 'security');
|
|
695
|
-
// v1-progress.json
|
|
696
|
-
const progressPath = path.join(metricsDir, 'v1-progress.json');
|
|
697
|
-
if (!fs.existsSync(progressPath)) {
|
|
698
|
-
const progress = {
|
|
699
|
-
version: '3.0.0',
|
|
700
|
-
initialized: new Date().toISOString(),
|
|
701
|
-
domains: { completed: 0, total: 5, status: 'INITIALIZING' },
|
|
702
|
-
ddd: { progress: 0, modules: 0, totalFiles: 0, totalLines: 0 },
|
|
703
|
-
swarm: { activeAgents: 0, maxAgents: 15, topology: 'hierarchical-mesh' },
|
|
704
|
-
learning: { status: 'READY', patternsLearned: 0, sessionsCompleted: 0 },
|
|
705
|
-
_note: 'Metrics will update as you use Monomind'
|
|
706
|
-
};
|
|
707
|
-
atomicWriteFile(progressPath, JSON.stringify(progress, null, 2));
|
|
708
|
-
result.created.push('.monomind/metrics/v1-progress.json');
|
|
709
|
-
}
|
|
710
|
-
else {
|
|
711
|
-
result.preserved.push('.monomind/metrics/v1-progress.json');
|
|
712
|
-
}
|
|
713
|
-
// swarm-activity.json
|
|
714
|
-
const activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
715
|
-
if (!fs.existsSync(activityPath)) {
|
|
716
|
-
const activity = {
|
|
717
|
-
timestamp: new Date().toISOString(),
|
|
718
|
-
processes: { mcp_server: 0, estimated_agents: 0 },
|
|
719
|
-
swarm: { active: false, agent_count: 0, coordination_active: false },
|
|
720
|
-
integration: { mcp_active: false },
|
|
721
|
-
_initialized: true
|
|
722
|
-
};
|
|
723
|
-
atomicWriteFile(activityPath, JSON.stringify(activity, null, 2));
|
|
724
|
-
result.created.push('.monomind/metrics/swarm-activity.json');
|
|
725
|
-
}
|
|
726
|
-
else {
|
|
727
|
-
result.preserved.push('.monomind/metrics/swarm-activity.json');
|
|
728
|
-
}
|
|
729
|
-
// learning.json
|
|
730
|
-
const learningPath = path.join(metricsDir, 'learning.json');
|
|
731
|
-
if (!fs.existsSync(learningPath)) {
|
|
732
|
-
const learning = {
|
|
733
|
-
initialized: new Date().toISOString(),
|
|
734
|
-
routing: { accuracy: 0, decisions: 0 },
|
|
735
|
-
patterns: { shortTerm: 0, longTerm: 0, quality: 0 },
|
|
736
|
-
sessions: { total: 0, current: null },
|
|
737
|
-
_note: 'Intelligence grows as you use Monomind'
|
|
738
|
-
};
|
|
739
|
-
atomicWriteFile(learningPath, JSON.stringify(learning, null, 2));
|
|
740
|
-
result.created.push('.monomind/metrics/learning.json');
|
|
741
|
-
}
|
|
742
|
-
else {
|
|
743
|
-
result.preserved.push('.monomind/metrics/learning.json');
|
|
744
|
-
}
|
|
745
|
-
// audit-status.json
|
|
746
|
-
const auditPath = path.join(securityDir, 'audit-status.json');
|
|
747
|
-
if (!fs.existsSync(auditPath)) {
|
|
748
|
-
const audit = {
|
|
749
|
-
initialized: new Date().toISOString(),
|
|
750
|
-
status: 'PENDING',
|
|
751
|
-
cvesFixed: 0,
|
|
752
|
-
totalCves: 3,
|
|
753
|
-
lastScan: null,
|
|
754
|
-
_note: 'Run: npx monomind@latest security scan'
|
|
755
|
-
};
|
|
756
|
-
atomicWriteFile(auditPath, JSON.stringify(audit, null, 2));
|
|
757
|
-
result.created.push('.monomind/security/audit-status.json');
|
|
758
|
-
}
|
|
759
|
-
else {
|
|
760
|
-
result.preserved.push('.monomind/security/audit-status.json');
|
|
761
|
-
}
|
|
762
|
-
// 3. Merge settings if requested
|
|
763
|
-
if (upgradeSettings) {
|
|
764
|
-
const settingsPath = path.join(targetDir, '.claude', 'settings.json');
|
|
765
|
-
if (fs.existsSync(settingsPath) && fs.statSync(settingsPath).size <= MAX_EXEC_FILE_BYTES) {
|
|
766
|
-
try {
|
|
767
|
-
const existingSettings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
768
|
-
const mergedSettings = mergeSettingsForUpgrade(existingSettings);
|
|
769
|
-
atomicWriteFile(settingsPath, JSON.stringify(mergedSettings, null, 2));
|
|
770
|
-
result.updated.push('.claude/settings.json');
|
|
771
|
-
result.settingsUpdated = [
|
|
772
|
-
'env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS',
|
|
773
|
-
'hooks.SessionStart (auto-memory import)',
|
|
774
|
-
'hooks.SessionEnd (auto-memory sync)',
|
|
775
|
-
'hooks.TeammateIdle (removed — not a valid Claude Code hook)',
|
|
776
|
-
'hooks.TaskCompleted (removed — not a valid Claude Code hook)',
|
|
777
|
-
'monomind.agentTeams',
|
|
778
|
-
'monomind.memory (learningBridge, memoryGraph, agentScopes)',
|
|
779
|
-
];
|
|
780
|
-
}
|
|
781
|
-
catch (settingsError) {
|
|
782
|
-
result.errors.push(`Settings merge failed: ${settingsError instanceof Error ? settingsError.message : String(settingsError)}`);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
else {
|
|
786
|
-
// Create new settings.json with defaults
|
|
787
|
-
const defaultSettings = generateSettings(DEFAULT_INIT_OPTIONS);
|
|
788
|
-
atomicWriteFile(settingsPath, JSON.stringify(defaultSettings, null, 2));
|
|
789
|
-
result.created.push('.claude/settings.json');
|
|
790
|
-
result.settingsUpdated = ['Created new settings.json with Agent Teams'];
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
catch (error) {
|
|
795
|
-
result.success = false;
|
|
796
|
-
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
797
|
-
}
|
|
798
|
-
return result;
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Execute upgrade with --add-missing flag
|
|
802
|
-
* Adds any new skills, agents, and commands that don't exist yet
|
|
803
|
-
* @param targetDir - Target directory
|
|
804
|
-
* @param upgradeSettings - If true, merge new settings into existing settings.json
|
|
805
|
-
*/
|
|
806
|
-
export async function executeUpgradeWithMissing(targetDir, upgradeSettings = false) {
|
|
807
|
-
// First do the normal upgrade (pass through upgradeSettings)
|
|
808
|
-
const result = await executeUpgrade(targetDir, upgradeSettings);
|
|
809
|
-
if (!result.success) {
|
|
810
|
-
return result;
|
|
811
|
-
}
|
|
812
|
-
// Initialize tracking arrays
|
|
813
|
-
result.addedSkills = [];
|
|
814
|
-
result.addedAgents = [];
|
|
815
|
-
result.addedCommands = [];
|
|
816
|
-
try {
|
|
817
|
-
// Ensure target directories exist
|
|
818
|
-
const skillsDir = path.join(targetDir, '.claude', 'skills');
|
|
819
|
-
const agentsDir = path.join(targetDir, '.claude', 'agents');
|
|
820
|
-
const commandsDir = path.join(targetDir, '.claude', 'commands');
|
|
821
|
-
for (const dir of [skillsDir, agentsDir, commandsDir]) {
|
|
822
|
-
if (!fs.existsSync(dir)) {
|
|
823
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
// Find source directories
|
|
827
|
-
const sourceSkillsDir = findSourceDir('skills');
|
|
828
|
-
const sourceAgentsDir = findSourceDir('agents');
|
|
829
|
-
const sourceCommandsDir = findSourceDir('commands');
|
|
830
|
-
// Debug: Log source directories found
|
|
831
|
-
if (process.env.DEBUG || process.env.MONOMIND_DEBUG) {
|
|
832
|
-
console.log('[DEBUG] Source directories:');
|
|
833
|
-
console.log(` Skills: ${sourceSkillsDir || 'NOT FOUND'}`);
|
|
834
|
-
console.log(` Agents: ${sourceAgentsDir || 'NOT FOUND'}`);
|
|
835
|
-
console.log(` Commands: ${sourceCommandsDir || 'NOT FOUND'}`);
|
|
836
|
-
}
|
|
837
|
-
// Add missing skills
|
|
838
|
-
if (sourceSkillsDir) {
|
|
839
|
-
const allSkills = Object.values(SKILLS_MAP).flat();
|
|
840
|
-
const debugMode = process.env.DEBUG || process.env.MONOMIND_DEBUG;
|
|
841
|
-
if (debugMode) {
|
|
842
|
-
console.log(`[DEBUG] Checking ${allSkills.length} skills from SKILLS_MAP`);
|
|
843
|
-
}
|
|
844
|
-
for (const skillName of [...new Set(allSkills)]) {
|
|
845
|
-
const sourcePath = path.join(sourceSkillsDir, skillName);
|
|
846
|
-
const targetPath = path.join(skillsDir, skillName);
|
|
847
|
-
const sourceExists = fs.existsSync(sourcePath);
|
|
848
|
-
const targetExists = fs.existsSync(targetPath);
|
|
849
|
-
if (debugMode) {
|
|
850
|
-
console.log(`[DEBUG] Skill '${skillName}': source=${sourceExists}, target=${targetExists}`);
|
|
851
|
-
}
|
|
852
|
-
if (sourceExists && !targetExists) {
|
|
853
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
854
|
-
result.addedSkills.push(skillName);
|
|
855
|
-
result.created.push(`.claude/skills/${skillName}`);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
// Add missing agents
|
|
860
|
-
if (sourceAgentsDir) {
|
|
861
|
-
const allAgents = Object.values(AGENTS_MAP).flat();
|
|
862
|
-
for (const agentCategory of [...new Set(allAgents)]) {
|
|
863
|
-
const sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
864
|
-
const targetPath = path.join(agentsDir, agentCategory);
|
|
865
|
-
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
866
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
867
|
-
result.addedAgents.push(agentCategory);
|
|
868
|
-
result.created.push(`.claude/agents/${agentCategory}`);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
// Add missing commands
|
|
873
|
-
if (sourceCommandsDir) {
|
|
874
|
-
const allCommands = Object.values(COMMANDS_MAP).flat();
|
|
875
|
-
for (const cmdName of [...new Set(allCommands)]) {
|
|
876
|
-
const sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
877
|
-
const targetPath = path.join(commandsDir, cmdName);
|
|
878
|
-
if (fs.existsSync(sourcePath) && !fs.existsSync(targetPath)) {
|
|
879
|
-
if (fs.statSync(sourcePath).isDirectory()) {
|
|
880
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
881
|
-
}
|
|
882
|
-
else {
|
|
883
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
884
|
-
}
|
|
885
|
-
result.addedCommands.push(cmdName);
|
|
886
|
-
result.created.push(`.claude/commands/${cmdName}`);
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
catch (error) {
|
|
892
|
-
result.errors.push(`Add missing failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
893
|
-
}
|
|
894
|
-
return result;
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* Create directory structure
|
|
898
|
-
*/
|
|
899
|
-
async function createDirectories(targetDir, options, result) {
|
|
900
|
-
const dirs = [
|
|
901
|
-
...DIRECTORIES.claude,
|
|
902
|
-
...(options.components.runtime ? DIRECTORIES.runtime : []),
|
|
903
|
-
];
|
|
904
|
-
for (const dir of dirs) {
|
|
905
|
-
const fullPath = path.join(targetDir, dir);
|
|
906
|
-
if (!fs.existsSync(fullPath)) {
|
|
907
|
-
fs.mkdirSync(fullPath, { recursive: true });
|
|
908
|
-
result.created.directories.push(dir);
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
/**
|
|
913
|
-
* Write settings.json
|
|
914
|
-
*/
|
|
915
|
-
async function writeSettings(targetDir, options, result) {
|
|
916
|
-
const settingsPath = path.join(targetDir, '.claude', 'settings.json');
|
|
917
|
-
const generated = JSON.parse(generateSettingsJson(options));
|
|
918
|
-
if (fs.existsSync(settingsPath) && !options.force && fs.statSync(settingsPath).size <= MAX_EXEC_FILE_BYTES) {
|
|
919
|
-
// Merge hooks/env/permissions into existing settings instead of skipping
|
|
920
|
-
try {
|
|
921
|
-
const existing = JSON.parse(fs.readFileSync(settingsPath, 'utf-8'));
|
|
922
|
-
let merged = false;
|
|
923
|
-
// Merge hooks (the critical missing piece — #1484)
|
|
924
|
-
if (generated.hooks && !existing.hooks) {
|
|
925
|
-
existing.hooks = generated.hooks;
|
|
926
|
-
merged = true;
|
|
927
|
-
}
|
|
928
|
-
// Merge env vars (for CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS etc.)
|
|
929
|
-
if (generated.env) {
|
|
930
|
-
existing.env = { ...(existing.env || {}), ...generated.env };
|
|
931
|
-
merged = true;
|
|
932
|
-
}
|
|
933
|
-
// Merge permissions (add monomind allow rules)
|
|
934
|
-
if (generated.permissions?.allow) {
|
|
935
|
-
const existingAllow = existing.permissions?.allow || [];
|
|
936
|
-
const newRules = generated.permissions.allow.filter((r) => !existingAllow.includes(r));
|
|
937
|
-
if (newRules.length > 0) {
|
|
938
|
-
existing.permissions = existing.permissions || {};
|
|
939
|
-
existing.permissions.allow = [...existingAllow, ...newRules];
|
|
940
|
-
merged = true;
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
if (merged) {
|
|
944
|
-
atomicWriteFile(settingsPath, JSON.stringify(existing, null, 2));
|
|
945
|
-
result.created.files.push('.claude/settings.json (merged hooks)');
|
|
946
|
-
}
|
|
947
|
-
else {
|
|
948
|
-
result.skipped.push('.claude/settings.json');
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
catch (e) {
|
|
952
|
-
// Existing file is corrupt — overwrite
|
|
953
|
-
if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
|
|
954
|
-
console.error('[writeSettings] existing settings.json unparseable, overwriting with generated defaults:', e);
|
|
955
|
-
atomicWriteFile(settingsPath, JSON.stringify(generated, null, 2));
|
|
956
|
-
result.created.files.push('.claude/settings.json');
|
|
957
|
-
}
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
atomicWriteFile(settingsPath, JSON.stringify(generated, null, 2));
|
|
961
|
-
result.created.files.push('.claude/settings.json');
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* Write .mcp.json
|
|
965
|
-
*/
|
|
966
|
-
async function writeMCPConfig(targetDir, options, result) {
|
|
967
|
-
const mcpPath = path.join(targetDir, '.mcp.json');
|
|
968
|
-
if (fs.existsSync(mcpPath) && !options.force) {
|
|
969
|
-
result.skipped.push('.mcp.json');
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
const content = generateMCPJson(options);
|
|
973
|
-
atomicWriteFile(mcpPath, content);
|
|
974
|
-
result.created.files.push('.mcp.json');
|
|
975
|
-
}
|
|
976
|
-
/**
|
|
977
|
-
* Provenance manifest for generated .claude content.
|
|
978
|
-
*
|
|
979
|
-
* init used to "clean stale" entries by deleting every name under
|
|
980
|
-
* .claude/{skills,commands,agents} that was absent from the current version's
|
|
981
|
-
* SKILLS_MAP/COMMANDS_MAP/AGENTS_MAP. Every user-authored command and skill is
|
|
982
|
-
* absent from those maps, so that pass deleted user content on the very first
|
|
983
|
-
* run — unrecoverable data loss.
|
|
984
|
-
*
|
|
985
|
-
* The manifest records exactly which entries *this tool* wrote, so the stale
|
|
986
|
-
* sweep can be restricted to those. Anything init did not write is never
|
|
987
|
-
* removed. Projects initialised by an older version have no manifest, so their
|
|
988
|
-
* first run under the fix deletes nothing and seeds the manifest instead;
|
|
989
|
-
* stale generated content may survive one extra run, which is the correct
|
|
990
|
-
* trade (preserving stale generated content is recoverable, deleting user
|
|
991
|
-
* content is not).
|
|
992
|
-
*/
|
|
993
|
-
const INIT_MANIFEST_REL = path.join('.monomind', 'init-manifest.json');
|
|
994
|
-
/**
|
|
995
|
-
* Read the provenance manifest. Returns null when absent or unreadable —
|
|
996
|
-
* callers must treat that as "provenance unknown", i.e. delete nothing.
|
|
997
|
-
*/
|
|
998
|
-
function readInitManifest(targetDir) {
|
|
999
|
-
const manifestPath = path.join(targetDir, INIT_MANIFEST_REL);
|
|
1000
|
-
try {
|
|
1001
|
-
if (!fs.existsSync(manifestPath))
|
|
1002
|
-
return null;
|
|
1003
|
-
const parsed = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
1004
|
-
if (!parsed || typeof parsed !== 'object')
|
|
1005
|
-
return null;
|
|
1006
|
-
return {
|
|
1007
|
-
version: typeof parsed.version === 'number' ? parsed.version : 1,
|
|
1008
|
-
skills: Array.isArray(parsed.skills) ? parsed.skills.filter((s) => typeof s === 'string') : [],
|
|
1009
|
-
commands: Array.isArray(parsed.commands) ? parsed.commands.filter((s) => typeof s === 'string') : [],
|
|
1010
|
-
agents: Array.isArray(parsed.agents) ? parsed.agents.filter((s) => typeof s === 'string') : [],
|
|
1011
|
-
};
|
|
1012
|
-
}
|
|
1013
|
-
catch {
|
|
1014
|
-
return null;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Names init previously generated in one section. Empty set when no manifest
|
|
1019
|
-
* exists — which makes the stale sweep a no-op rather than a delete-everything.
|
|
1020
|
-
*/
|
|
1021
|
-
function previouslyGenerated(targetDir, section) {
|
|
1022
|
-
return new Set(readInitManifest(targetDir)?.[section] ?? []);
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* Record the entries init just wrote for one section, merging into any
|
|
1026
|
-
* existing manifest so a partial run (e.g. --only-claude, or a section whose
|
|
1027
|
-
* source dir was missing) never drops provenance for the other sections.
|
|
1028
|
-
*/
|
|
1029
|
-
function recordGenerated(targetDir, section, entries) {
|
|
1030
|
-
const manifestPath = path.join(targetDir, INIT_MANIFEST_REL);
|
|
1031
|
-
const existing = readInitManifest(targetDir);
|
|
1032
|
-
const manifest = existing ?? { version: 1, skills: [], commands: [], agents: [] };
|
|
1033
|
-
manifest.version = 1;
|
|
1034
|
-
manifest[section] = [...new Set(entries)].sort();
|
|
1035
|
-
try {
|
|
1036
|
-
fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
|
|
1037
|
-
atomicWriteFile(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
|
|
1038
|
-
}
|
|
1039
|
-
catch {
|
|
1040
|
-
// Non-fatal: without a manifest the next run simply deletes nothing.
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Copy skills from source
|
|
1045
|
-
*/
|
|
1046
|
-
async function copySkills(targetDir, options, result) {
|
|
1047
|
-
const skillsConfig = options.skills;
|
|
1048
|
-
const targetSkillsDir = path.join(targetDir, '.claude', 'skills');
|
|
1049
|
-
// Determine which skills to copy
|
|
1050
|
-
const skillsToCopy = [];
|
|
1051
|
-
if (skillsConfig.all) {
|
|
1052
|
-
// Copy all available skills
|
|
1053
|
-
Object.values(SKILLS_MAP).forEach(skills => skillsToCopy.push(...skills));
|
|
1054
|
-
}
|
|
1055
|
-
else {
|
|
1056
|
-
if (skillsConfig.core)
|
|
1057
|
-
skillsToCopy.push(...SKILLS_MAP.core);
|
|
1058
|
-
if (skillsConfig.memory)
|
|
1059
|
-
skillsToCopy.push(...SKILLS_MAP.memory);
|
|
1060
|
-
if (skillsConfig.github)
|
|
1061
|
-
skillsToCopy.push(...SKILLS_MAP.github);
|
|
1062
|
-
if (skillsConfig.browser)
|
|
1063
|
-
skillsToCopy.push(...SKILLS_MAP.browser);
|
|
1064
|
-
if (skillsConfig.advanced)
|
|
1065
|
-
skillsToCopy.push(...SKILLS_MAP.advanced);
|
|
1066
|
-
}
|
|
1067
|
-
// Find source skills directory
|
|
1068
|
-
const sourceSkillsDir = findSourceDir('skills', options.sourceBaseDir);
|
|
1069
|
-
if (!sourceSkillsDir) {
|
|
1070
|
-
result.errors.push('Could not find source skills directory');
|
|
1071
|
-
return;
|
|
1072
|
-
}
|
|
1073
|
-
// Expand glob-style entries ('mastermind-*') against the source tree.
|
|
1074
|
-
// Only directories that actually contain a SKILL.md count — this also
|
|
1075
|
-
// filters exFAT AppleDouble junk (._mastermind-…).
|
|
1076
|
-
for (const entry of skillsToCopy.filter(e => e.endsWith('*'))) {
|
|
1077
|
-
const prefix = entry.slice(0, -1);
|
|
1078
|
-
skillsToCopy.splice(skillsToCopy.indexOf(entry), 1);
|
|
1079
|
-
skillsToCopy.push(...fs.readdirSync(sourceSkillsDir).filter(n => n.startsWith(prefix) &&
|
|
1080
|
-
fs.existsSync(path.join(sourceSkillsDir, n, 'SKILL.md'))));
|
|
1081
|
-
}
|
|
1082
|
-
// Remove stale skill directories that a PREVIOUS init generated and this
|
|
1083
|
-
// version no longer ships. Entries init never wrote (user-authored skills,
|
|
1084
|
-
// skills installed by other tools) are left untouched — see readInitManifest.
|
|
1085
|
-
const knownSkills = new Set([...new Set(skillsToCopy)]);
|
|
1086
|
-
const priorSkills = previouslyGenerated(targetDir, 'skills');
|
|
1087
|
-
if (fs.existsSync(targetSkillsDir)) {
|
|
1088
|
-
for (const existing of fs.readdirSync(targetSkillsDir)) {
|
|
1089
|
-
if (!knownSkills.has(existing) && priorSkills.has(existing)) {
|
|
1090
|
-
const stalePath = path.join(targetSkillsDir, existing);
|
|
1091
|
-
fs.rmSync(stalePath, { recursive: true, force: true });
|
|
1092
|
-
result.created.files.push(`[cleaned] .claude/skills/${existing} (stale)`);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
// Always copy/overwrite skills (never skip — ensures new version content lands)
|
|
1097
|
-
const writtenSkills = [];
|
|
1098
|
-
for (const skillName of knownSkills) {
|
|
1099
|
-
const sourcePath = path.join(sourceSkillsDir, skillName);
|
|
1100
|
-
const targetPath = path.join(targetSkillsDir, skillName);
|
|
1101
|
-
if (fs.existsSync(sourcePath)) {
|
|
1102
|
-
// Deliberately NOT rmSync'd first. copyDirRecursive overwrites every
|
|
1103
|
-
// file it ships, so wiping the directory adds nothing except destroying
|
|
1104
|
-
// anything the user put inside it — notes beside a shipped skill, an
|
|
1105
|
-
// extra command in a shipped folder. `init --force` did exactly that.
|
|
1106
|
-
// The cost of not wiping is that a file removed from a newer version
|
|
1107
|
-
// lingers; the cost of wiping is silent data loss, which is worse.
|
|
1108
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
1109
|
-
writtenSkills.push(skillName);
|
|
1110
|
-
result.created.files.push(`.claude/skills/${skillName}`);
|
|
1111
|
-
result.summary.skillsCount++;
|
|
1112
|
-
}
|
|
1113
|
-
else {
|
|
1114
|
-
// A skill referenced in SKILLS_MAP has no matching source directory —
|
|
1115
|
-
// surface this instead of silently copying nothing, so drift between
|
|
1116
|
-
// SKILLS_MAP and the actual .claude/skills/ tree gets caught.
|
|
1117
|
-
result.errors.push(`Skill '${skillName}' listed in SKILLS_MAP has no source directory at ${sourcePath} — skipped`);
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
// Record provenance so the next run can distinguish "we wrote this" from
|
|
1121
|
-
// "the user wrote this". Keep entries this run did not re-write but that a
|
|
1122
|
-
// previous run generated and that still exist, so provenance is not lost
|
|
1123
|
-
// when a section is partially skipped.
|
|
1124
|
-
const retainedSkills = [...priorSkills].filter(n => !writtenSkills.includes(n) && fs.existsSync(path.join(targetSkillsDir, n)));
|
|
1125
|
-
recordGenerated(targetDir, 'skills', [...writtenSkills, ...retainedSkills]);
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Copy commands from source
|
|
1129
|
-
*/
|
|
1130
|
-
async function copyCommands(targetDir, options, result) {
|
|
1131
|
-
const commandsConfig = options.commands;
|
|
1132
|
-
const targetCommandsDir = path.join(targetDir, '.claude', 'commands');
|
|
1133
|
-
// Determine which commands to copy
|
|
1134
|
-
const commandsToCopy = [];
|
|
1135
|
-
if (commandsConfig.all) {
|
|
1136
|
-
Object.values(COMMANDS_MAP).forEach(cmds => commandsToCopy.push(...cmds));
|
|
1137
|
-
}
|
|
1138
|
-
else {
|
|
1139
|
-
if (commandsConfig.core)
|
|
1140
|
-
commandsToCopy.push(...COMMANDS_MAP.core);
|
|
1141
|
-
if (commandsConfig.agents)
|
|
1142
|
-
commandsToCopy.push(...(COMMANDS_MAP.agents || []));
|
|
1143
|
-
if (commandsConfig.analysis)
|
|
1144
|
-
commandsToCopy.push(...COMMANDS_MAP.analysis);
|
|
1145
|
-
if (commandsConfig.automation)
|
|
1146
|
-
commandsToCopy.push(...COMMANDS_MAP.automation);
|
|
1147
|
-
if (commandsConfig.coordination)
|
|
1148
|
-
commandsToCopy.push(...(COMMANDS_MAP.coordination || []));
|
|
1149
|
-
if (commandsConfig.github)
|
|
1150
|
-
commandsToCopy.push(...COMMANDS_MAP.github);
|
|
1151
|
-
if (commandsConfig.hiveMind)
|
|
1152
|
-
commandsToCopy.push(...(COMMANDS_MAP.hiveMind || []));
|
|
1153
|
-
if (commandsConfig.hooks)
|
|
1154
|
-
commandsToCopy.push(...COMMANDS_MAP.hooks);
|
|
1155
|
-
if (commandsConfig.mastermind)
|
|
1156
|
-
commandsToCopy.push(...(COMMANDS_MAP.mastermind || []));
|
|
1157
|
-
if (commandsConfig.memory)
|
|
1158
|
-
commandsToCopy.push(...(COMMANDS_MAP.memory || []));
|
|
1159
|
-
if (commandsConfig.monitoring)
|
|
1160
|
-
commandsToCopy.push(...COMMANDS_MAP.monitoring);
|
|
1161
|
-
if (commandsConfig.monograph)
|
|
1162
|
-
commandsToCopy.push(...(COMMANDS_MAP.monograph || []));
|
|
1163
|
-
if (commandsConfig.monomind)
|
|
1164
|
-
commandsToCopy.push(...(COMMANDS_MAP.monomind || []));
|
|
1165
|
-
if (commandsConfig.optimization)
|
|
1166
|
-
commandsToCopy.push(...COMMANDS_MAP.optimization);
|
|
1167
|
-
if (commandsConfig.pair)
|
|
1168
|
-
commandsToCopy.push(...(COMMANDS_MAP.pair || []));
|
|
1169
|
-
if (commandsConfig.streamChain)
|
|
1170
|
-
commandsToCopy.push(...(COMMANDS_MAP.streamChain || []));
|
|
1171
|
-
if (commandsConfig.swarm)
|
|
1172
|
-
commandsToCopy.push(...(COMMANDS_MAP.swarm || []));
|
|
1173
|
-
if (commandsConfig.training)
|
|
1174
|
-
commandsToCopy.push(...(COMMANDS_MAP.training || []));
|
|
1175
|
-
if (commandsConfig.truth)
|
|
1176
|
-
commandsToCopy.push(...(COMMANDS_MAP.truth || []));
|
|
1177
|
-
if (commandsConfig.verify)
|
|
1178
|
-
commandsToCopy.push(...(COMMANDS_MAP.verify || []));
|
|
1179
|
-
if (commandsConfig.workflows)
|
|
1180
|
-
commandsToCopy.push(...(COMMANDS_MAP.workflows || []));
|
|
1181
|
-
}
|
|
1182
|
-
// Find source commands directory
|
|
1183
|
-
const sourceCommandsDir = findSourceDir('commands', options.sourceBaseDir);
|
|
1184
|
-
if (!sourceCommandsDir) {
|
|
1185
|
-
result.errors.push('Could not find source commands directory');
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
// Remove stale command files/directories that a PREVIOUS init generated and
|
|
1189
|
-
// this version no longer ships. User-authored commands are never touched.
|
|
1190
|
-
const knownCommands = new Set([...new Set(commandsToCopy)]);
|
|
1191
|
-
const priorCommands = previouslyGenerated(targetDir, 'commands');
|
|
1192
|
-
if (fs.existsSync(targetCommandsDir)) {
|
|
1193
|
-
for (const existing of fs.readdirSync(targetCommandsDir)) {
|
|
1194
|
-
if (!knownCommands.has(existing) && priorCommands.has(existing)) {
|
|
1195
|
-
const stalePath = path.join(targetCommandsDir, existing);
|
|
1196
|
-
fs.rmSync(stalePath, { recursive: true, force: true });
|
|
1197
|
-
result.created.files.push(`[cleaned] .claude/commands/${existing} (stale)`);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
// Always copy/overwrite commands (never skip — ensures new version content lands)
|
|
1202
|
-
const writtenCommands = [];
|
|
1203
|
-
for (const cmdName of knownCommands) {
|
|
1204
|
-
const sourcePath = path.join(sourceCommandsDir, cmdName);
|
|
1205
|
-
const targetPath = path.join(targetCommandsDir, cmdName);
|
|
1206
|
-
if (fs.existsSync(sourcePath)) {
|
|
1207
|
-
// No pre-copy rmSync — see the note in copySkills. Both branches below
|
|
1208
|
-
// overwrite what they ship, so wiping first only destroys files the user
|
|
1209
|
-
// added inside a shipped command directory.
|
|
1210
|
-
if (fs.statSync(sourcePath).isDirectory()) {
|
|
1211
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
1212
|
-
}
|
|
1213
|
-
else {
|
|
1214
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
1215
|
-
}
|
|
1216
|
-
writtenCommands.push(cmdName);
|
|
1217
|
-
result.created.files.push(`.claude/commands/${cmdName}`);
|
|
1218
|
-
result.summary.commandsCount++;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
const retainedCommands = [...priorCommands].filter(n => !writtenCommands.includes(n) && fs.existsSync(path.join(targetCommandsDir, n)));
|
|
1222
|
-
recordGenerated(targetDir, 'commands', [...writtenCommands, ...retainedCommands]);
|
|
1223
|
-
}
|
|
1224
|
-
/**
|
|
1225
|
-
* Copy agents from source
|
|
1226
|
-
*/
|
|
1227
|
-
async function copyAgents(targetDir, options, result) {
|
|
1228
|
-
const agentsConfig = options.agents;
|
|
1229
|
-
const targetAgentsDir = path.join(targetDir, '.claude', 'agents');
|
|
1230
|
-
// Determine which agents to copy
|
|
1231
|
-
const agentsToCopy = [];
|
|
1232
|
-
if (agentsConfig.all) {
|
|
1233
|
-
Object.values(AGENTS_MAP).forEach(agents => agentsToCopy.push(...agents));
|
|
1234
|
-
}
|
|
1235
|
-
else {
|
|
1236
|
-
if (agentsConfig.core)
|
|
1237
|
-
agentsToCopy.push(...AGENTS_MAP.core);
|
|
1238
|
-
if (agentsConfig.consensus)
|
|
1239
|
-
agentsToCopy.push(...AGENTS_MAP.consensus);
|
|
1240
|
-
if (agentsConfig.github)
|
|
1241
|
-
agentsToCopy.push(...AGENTS_MAP.github);
|
|
1242
|
-
if (agentsConfig.hiveMind)
|
|
1243
|
-
agentsToCopy.push(...AGENTS_MAP.hiveMind);
|
|
1244
|
-
if (agentsConfig.swarm)
|
|
1245
|
-
agentsToCopy.push(...AGENTS_MAP.swarm);
|
|
1246
|
-
if (agentsConfig.optimization)
|
|
1247
|
-
agentsToCopy.push(...(AGENTS_MAP.optimization || []));
|
|
1248
|
-
if (agentsConfig.testing)
|
|
1249
|
-
agentsToCopy.push(...(AGENTS_MAP.testing || []));
|
|
1250
|
-
}
|
|
1251
|
-
// Find source agents directory
|
|
1252
|
-
const sourceAgentsDir = findSourceDir('agents', options.sourceBaseDir);
|
|
1253
|
-
if (!sourceAgentsDir) {
|
|
1254
|
-
result.errors.push('Could not find source agents directory');
|
|
1255
|
-
return;
|
|
1256
|
-
}
|
|
1257
|
-
// Remove stale agent category directories that a PREVIOUS init generated and
|
|
1258
|
-
// this version no longer ships. User-authored agent dirs are never touched.
|
|
1259
|
-
const knownAgents = new Set([...new Set(agentsToCopy)]);
|
|
1260
|
-
const priorAgents = previouslyGenerated(targetDir, 'agents');
|
|
1261
|
-
if (fs.existsSync(targetAgentsDir)) {
|
|
1262
|
-
for (const existing of fs.readdirSync(targetAgentsDir)) {
|
|
1263
|
-
if (!knownAgents.has(existing) && priorAgents.has(existing)) {
|
|
1264
|
-
const stalePath = path.join(targetAgentsDir, existing);
|
|
1265
|
-
fs.rmSync(stalePath, { recursive: true, force: true });
|
|
1266
|
-
result.created.files.push(`[cleaned] .claude/agents/${existing} (stale)`);
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
// Always copy/overwrite agents (never skip — ensures new version content lands)
|
|
1271
|
-
const writtenAgents = [];
|
|
1272
|
-
for (const agentCategory of knownAgents) {
|
|
1273
|
-
const sourcePath = path.join(sourceAgentsDir, agentCategory);
|
|
1274
|
-
const targetPath = path.join(targetAgentsDir, agentCategory);
|
|
1275
|
-
if (fs.existsSync(sourcePath)) {
|
|
1276
|
-
// Deliberately NOT rmSync'd first. copyDirRecursive overwrites every
|
|
1277
|
-
// file it ships, so wiping the directory adds nothing except destroying
|
|
1278
|
-
// anything the user put inside it — notes beside a shipped skill, an
|
|
1279
|
-
// extra command in a shipped folder. `init --force` did exactly that.
|
|
1280
|
-
// The cost of not wiping is that a file removed from a newer version
|
|
1281
|
-
// lingers; the cost of wiping is silent data loss, which is worse.
|
|
1282
|
-
copyDirRecursive(sourcePath, targetPath);
|
|
1283
|
-
// Count agent files (.md only — .yaml agents were migrated to .md)
|
|
1284
|
-
const mdFiles = countFiles(sourcePath, '.md');
|
|
1285
|
-
result.summary.agentsCount += mdFiles;
|
|
1286
|
-
writtenAgents.push(agentCategory);
|
|
1287
|
-
result.created.files.push(`.claude/agents/${agentCategory}`);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
const retainedAgents = [...priorAgents].filter(n => !writtenAgents.includes(n) && fs.existsSync(path.join(targetAgentsDir, n)));
|
|
1291
|
-
recordGenerated(targetDir, 'agents', [...writtenAgents, ...retainedAgents]);
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Find source helpers directory.
|
|
1295
|
-
* Validates that the directory contains hook-handler.cjs AND its required
|
|
1296
|
-
* subdirectory files (utils/telemetry.cjs etc.) to avoid accepting a partial
|
|
1297
|
-
* or corrupted source that would reproduce the missing-utils/ bug class.
|
|
1298
|
-
*/
|
|
1299
|
-
function findSourceHelpersDir(sourceBaseDir) {
|
|
1300
|
-
const possiblePaths = [];
|
|
1301
|
-
// All sentinel files must exist — hook-handler.cjs requires these at startup
|
|
1302
|
-
const SENTINEL_FILES = [
|
|
1303
|
-
'hook-handler.cjs',
|
|
1304
|
-
path.join('utils', 'telemetry.cjs'),
|
|
1305
|
-
path.join('utils', 'monograph.cjs'),
|
|
1306
|
-
path.join('utils', 'micro-agents.cjs'),
|
|
1307
|
-
];
|
|
1308
|
-
// If explicit source base directory is provided, check it first
|
|
1309
|
-
if (sourceBaseDir) {
|
|
1310
|
-
possiblePaths.push(path.join(sourceBaseDir, '.claude', 'helpers'));
|
|
1311
|
-
}
|
|
1312
|
-
// Strategy 1: require.resolve to find package root (most reliable for npx)
|
|
1313
|
-
// Try both published package names (@monoes/monomindcli is the scoped CLI package,
|
|
1314
|
-
// monomind is the umbrella — neither is @monomind/cli which is the monorepo name only)
|
|
1315
|
-
for (const pkgName of ['@monoes/monomindcli/package.json', 'monomind/packages/@monomind/cli/package.json', '@monomind/cli/package.json']) {
|
|
1316
|
-
try {
|
|
1317
|
-
const esmRequire = createRequire(import.meta.url);
|
|
1318
|
-
const pkgJsonPath = esmRequire.resolve(pkgName);
|
|
1319
|
-
const pkgRoot = path.dirname(pkgJsonPath);
|
|
1320
|
-
possiblePaths.push(path.join(pkgRoot, '.claude', 'helpers'));
|
|
1321
|
-
break;
|
|
1322
|
-
}
|
|
1323
|
-
catch {
|
|
1324
|
-
// Not installed under this name — try next
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
// Strategy 2: __dirname-based (dist/src/init -> package root)
|
|
1328
|
-
const packageRoot = path.resolve(__dirname, '..', '..', '..');
|
|
1329
|
-
const packageHelpers = path.join(packageRoot, '.claude', 'helpers');
|
|
1330
|
-
possiblePaths.push(packageHelpers);
|
|
1331
|
-
// Strategy 3: Walk up from __dirname looking for package root
|
|
1332
|
-
let currentDir = __dirname;
|
|
1333
|
-
for (let i = 0; i < 10; i++) {
|
|
1334
|
-
const parentDir = path.dirname(currentDir);
|
|
1335
|
-
if (parentDir === currentDir)
|
|
1336
|
-
break; // hit filesystem root
|
|
1337
|
-
const helpersPath = path.join(parentDir, '.claude', 'helpers');
|
|
1338
|
-
possiblePaths.push(helpersPath);
|
|
1339
|
-
currentDir = parentDir;
|
|
1340
|
-
}
|
|
1341
|
-
// NOTE: deliberately no cwd-ancestor-search fallback here (removed — see
|
|
1342
|
-
// docs/AUDIT-BACKLOG.md P3-25). Searching process.cwd() and its parents for
|
|
1343
|
-
// ".claude/helpers" could pick up an unrelated project's own helper scripts
|
|
1344
|
-
// (stale, customized, or untrusted) when `monomind init` is run from a
|
|
1345
|
-
// nested subdirectory of some other checkout. Helper source resolution is
|
|
1346
|
-
// restricted to the package's own bundled location(s) above; if none of
|
|
1347
|
-
// those are found, callers should treat it as a corrupt install rather than
|
|
1348
|
-
// silently falling back to scanning ancestor directories for someone else's
|
|
1349
|
-
// files.
|
|
1350
|
-
// Return first path that exists AND contains ALL sentinel files
|
|
1351
|
-
for (const p of possiblePaths) {
|
|
1352
|
-
if (fs.existsSync(p) && SENTINEL_FILES.every(f => fs.existsSync(path.join(p, f)))) {
|
|
1353
|
-
return p;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
return null;
|
|
1357
|
-
}
|
|
1358
|
-
/**
|
|
1359
|
-
* Write helper scripts
|
|
1360
|
-
*/
|
|
1361
|
-
async function writeHelpers(targetDir, options, result) {
|
|
1362
|
-
const helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
1363
|
-
// Find source helpers directory (works for npm package and local dev)
|
|
1364
|
-
const sourceHelpersDir = findSourceHelpersDir(options.sourceBaseDir);
|
|
1365
|
-
// Try to copy existing helpers from source first (recursive — includes utils/ and handlers/)
|
|
1366
|
-
if (sourceHelpersDir && fs.existsSync(sourceHelpersDir)) {
|
|
1367
|
-
const copyRecursive = (srcDir, destDir, relBase) => {
|
|
1368
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
1369
|
-
for (const entry of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
1370
|
-
// Skip exFAT/macOS AppleDouble junk files (e.g. "._foo.cjs").
|
|
1371
|
-
if (entry.name.startsWith('._'))
|
|
1372
|
-
continue;
|
|
1373
|
-
const srcPath = path.join(srcDir, entry.name);
|
|
1374
|
-
const destPath = path.join(destDir, entry.name);
|
|
1375
|
-
const relPath = relBase ? `${relBase}/${entry.name}` : entry.name;
|
|
1376
|
-
if (entry.isDirectory()) {
|
|
1377
|
-
copyRecursive(srcPath, destPath, relPath);
|
|
1378
|
-
}
|
|
1379
|
-
else {
|
|
1380
|
-
if (!fs.existsSync(destPath) || options.force) {
|
|
1381
|
-
fs.copyFileSync(srcPath, destPath);
|
|
1382
|
-
if (entry.name.endsWith('.sh') || entry.name.endsWith('.mjs')) {
|
|
1383
|
-
fs.chmodSync(destPath, '755');
|
|
1384
|
-
}
|
|
1385
|
-
result.created.files.push(`.claude/helpers/${relPath}`);
|
|
1386
|
-
}
|
|
1387
|
-
else {
|
|
1388
|
-
result.skipped.push(`.claude/helpers/${relPath}`);
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
copyRecursive(sourceHelpersDir, helpersDir, '');
|
|
1394
|
-
}
|
|
1395
|
-
// Always run the fallback generator too — it only fills in files still missing
|
|
1396
|
-
// after the source copy above (it no-ops on anything the copy already wrote).
|
|
1397
|
-
// Without this, a source dir that's present but incomplete (e.g. missing
|
|
1398
|
-
// auto-memory-hook.mjs) silently ships a project wired to hooks that reference
|
|
1399
|
-
// a file that was never installed.
|
|
1400
|
-
const helpers = Object.fromEntries(Object.entries(INIT_FALLBACK_HELPERS).map(([name, generate]) => [name, generate()]));
|
|
1401
|
-
for (const [name, content] of Object.entries(helpers)) {
|
|
1402
|
-
const filePath = path.join(helpersDir, name);
|
|
1403
|
-
// If the source dir has this file, copyRecursive above already applied
|
|
1404
|
-
// the correct (force-aware) copy — never let this generated fallback
|
|
1405
|
-
// clobber it with a bare-bones stub. Only step in when source truly
|
|
1406
|
-
// doesn't have the file, regardless of `force`.
|
|
1407
|
-
const inSource = !!(sourceHelpersDir && fs.existsSync(path.join(sourceHelpersDir, name)));
|
|
1408
|
-
if (inSource)
|
|
1409
|
-
continue;
|
|
1410
|
-
if (!fs.existsSync(filePath) || options.force) {
|
|
1411
|
-
atomicWriteFile(filePath, content);
|
|
1412
|
-
// Make shell scripts executable
|
|
1413
|
-
if (!name.endsWith('.js')) {
|
|
1414
|
-
fs.chmodSync(filePath, '755');
|
|
1415
|
-
}
|
|
1416
|
-
result.created.files.push(`.claude/helpers/${name}`);
|
|
1417
|
-
}
|
|
1418
|
-
else {
|
|
1419
|
-
result.skipped.push(`.claude/helpers/${name}`);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* Find source .claude directory for statusline files
|
|
1425
|
-
*/
|
|
1426
|
-
function findSourceClaudeDir(sourceBaseDir) {
|
|
1427
|
-
const possiblePaths = [];
|
|
1428
|
-
// If explicit source base directory is provided, check it first
|
|
1429
|
-
if (sourceBaseDir) {
|
|
1430
|
-
possiblePaths.push(path.join(sourceBaseDir, '.claude'));
|
|
1431
|
-
}
|
|
1432
|
-
// IMPORTANT: Check the package's own .claude directory
|
|
1433
|
-
// Go up 3 levels: dist/src/init -> dist/src -> dist -> root
|
|
1434
|
-
const packageRoot = path.resolve(__dirname, '..', '..', '..');
|
|
1435
|
-
const packageClaude = path.join(packageRoot, '.claude');
|
|
1436
|
-
if (fs.existsSync(packageClaude)) {
|
|
1437
|
-
possiblePaths.unshift(packageClaude); // Add to beginning (highest priority)
|
|
1438
|
-
}
|
|
1439
|
-
// From dist/src/init -> go up to project root
|
|
1440
|
-
let currentDir = __dirname;
|
|
1441
|
-
for (let i = 0; i < 10; i++) {
|
|
1442
|
-
const parentDir = path.dirname(currentDir);
|
|
1443
|
-
const claudePath = path.join(parentDir, '.claude');
|
|
1444
|
-
if (fs.existsSync(claudePath)) {
|
|
1445
|
-
possiblePaths.push(claudePath);
|
|
1446
|
-
}
|
|
1447
|
-
currentDir = parentDir;
|
|
1448
|
-
}
|
|
1449
|
-
for (const p of possiblePaths) {
|
|
1450
|
-
if (fs.existsSync(p)) {
|
|
1451
|
-
return p;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
return null;
|
|
1455
|
-
}
|
|
1456
|
-
/**
|
|
1457
|
-
* Write statusline configuration
|
|
1458
|
-
*/
|
|
1459
|
-
async function writeStatusline(targetDir, options, result) {
|
|
1460
|
-
const claudeDir = path.join(targetDir, '.claude');
|
|
1461
|
-
const helpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
1462
|
-
// Find source .claude directory (works for npm package and local dev)
|
|
1463
|
-
const sourceClaudeDir = findSourceClaudeDir(options.sourceBaseDir);
|
|
1464
|
-
// Try to copy existing advanced statusline files from source
|
|
1465
|
-
const advancedStatuslineFiles = [
|
|
1466
|
-
{ src: 'statusline.sh', dest: 'statusline.sh', dir: claudeDir },
|
|
1467
|
-
{ src: 'statusline.mjs', dest: 'statusline.mjs', dir: claudeDir },
|
|
1468
|
-
];
|
|
1469
|
-
if (sourceClaudeDir) {
|
|
1470
|
-
for (const file of advancedStatuslineFiles) {
|
|
1471
|
-
const sourcePath = path.join(sourceClaudeDir, file.src);
|
|
1472
|
-
const destPath = path.join(file.dir, file.dest);
|
|
1473
|
-
if (fs.existsSync(sourcePath)) {
|
|
1474
|
-
if (!fs.existsSync(destPath) || options.force) {
|
|
1475
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
1476
|
-
// Make shell scripts and mjs executable
|
|
1477
|
-
if (file.src.endsWith('.sh') || file.src.endsWith('.mjs')) {
|
|
1478
|
-
fs.chmodSync(destPath, '755');
|
|
1479
|
-
}
|
|
1480
|
-
result.created.files.push(`.claude/${file.dest}`);
|
|
1481
|
-
}
|
|
1482
|
-
else {
|
|
1483
|
-
result.skipped.push(`.claude/${file.dest}`);
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
// ALWAYS generate statusline.cjs — the generated version includes
|
|
1489
|
-
// vectors/size, tests, ADRs, hooks, and integration stats that the
|
|
1490
|
-
// pre-installed static copy in the npm package lacks.
|
|
1491
|
-
// This must overwrite any copy from writeHelpers() which copies the legacy file.
|
|
1492
|
-
const statuslineScript = generateStatuslineScript(options);
|
|
1493
|
-
const statuslinePath = path.join(helpersDir, 'statusline.cjs');
|
|
1494
|
-
atomicWriteFile(statuslinePath, statuslineScript);
|
|
1495
|
-
result.created.files.push('.claude/helpers/statusline.cjs');
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Write runtime configuration (.monomind/)
|
|
1499
|
-
*/
|
|
1500
|
-
async function writeRuntimeConfig(targetDir, options, result) {
|
|
1501
|
-
const configPath = path.join(targetDir, '.monomind', 'config.yaml');
|
|
1502
|
-
if (fs.existsSync(configPath) && !options.force) {
|
|
1503
|
-
result.skipped.push('.monomind/config.yaml');
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
const config = `# Monomind Runtime Configuration
|
|
1507
|
-
# Generated: ${new Date().toISOString()}
|
|
1508
|
-
|
|
1509
|
-
version: "3.0.0"
|
|
1510
|
-
|
|
1511
|
-
swarm:
|
|
1512
|
-
topology: ${options.runtime.topology}
|
|
1513
|
-
maxAgents: ${options.runtime.maxAgents}
|
|
1514
|
-
autoScale: true
|
|
1515
|
-
coordinationStrategy: consensus
|
|
1516
|
-
|
|
1517
|
-
memory:
|
|
1518
|
-
backend: ${options.runtime.memoryBackend}
|
|
1519
|
-
enableHNSW: ${options.runtime.enableHNSW}
|
|
1520
|
-
persistPath: .monomind/data
|
|
1521
|
-
cacheSize: 100
|
|
1522
|
-
# ADR-049: Self-Learning Memory
|
|
1523
|
-
learningBridge:
|
|
1524
|
-
enabled: ${options.runtime.enableLearningBridge ?? options.runtime.enableNeural}
|
|
1525
|
-
confidenceDecayRate: 0.005
|
|
1526
|
-
accessBoostAmount: 0.03
|
|
1527
|
-
consolidationThreshold: 10
|
|
1528
|
-
agentScopes:
|
|
1529
|
-
enabled: ${options.runtime.enableAgentScopes ?? true}
|
|
1530
|
-
defaultScope: project
|
|
1531
|
-
|
|
1532
|
-
neural:
|
|
1533
|
-
enabled: ${options.runtime.enableNeural}
|
|
1534
|
-
modelPath: .monomind/neural
|
|
1535
|
-
|
|
1536
|
-
hooks:
|
|
1537
|
-
enabled: true
|
|
1538
|
-
autoExecute: true
|
|
1539
|
-
|
|
1540
|
-
mcp:
|
|
1541
|
-
autoStart: ${options.mcp.autoStart}
|
|
1542
|
-
port: ${options.mcp.port}
|
|
1543
|
-
`;
|
|
1544
|
-
atomicWriteFile(configPath, config);
|
|
1545
|
-
result.created.files.push('.monomind/config.yaml');
|
|
1546
|
-
// Write .monomind/.gitignore — commit config/knowledge/metrics, exclude sensitive data
|
|
1547
|
-
const gitignorePath = path.join(targetDir, '.monomind', '.gitignore');
|
|
1548
|
-
const gitignore = `# Monomind — exclude files that may contain secrets or sensitive prompt data
|
|
1549
|
-
# Sessions contain conversation history (prompts, code snippets, user data)
|
|
1550
|
-
sessions/
|
|
1551
|
-
# Security scan results may expose vulnerability details
|
|
1552
|
-
security/
|
|
1553
|
-
# Temporary and machine-specific files
|
|
1554
|
-
*.tmp
|
|
1555
|
-
*.log
|
|
1556
|
-
daemon.pid
|
|
1557
|
-
# Never commit credentials or keys
|
|
1558
|
-
*.key
|
|
1559
|
-
*.token
|
|
1560
|
-
*.secret
|
|
1561
|
-
.env
|
|
1562
|
-
`;
|
|
1563
|
-
if (!fs.existsSync(gitignorePath) || options.force) {
|
|
1564
|
-
atomicWriteFile(gitignorePath, gitignore);
|
|
1565
|
-
result.created.files.push('.monomind/.gitignore');
|
|
1566
|
-
}
|
|
1567
|
-
// Ensure the project-level .gitignore does NOT blanket-ignore .monomind/
|
|
1568
|
-
// A blanket ignore prevents config, metrics, and knowledge graph from being committed.
|
|
1569
|
-
// We remove any bare `.monomind/` or `**/.monomind/` lines and add specific excludes instead.
|
|
1570
|
-
const projectGitignorePath = path.join(targetDir, '.gitignore');
|
|
1571
|
-
if (fs.existsSync(projectGitignorePath) && fs.statSync(projectGitignorePath).size <= MAX_EXEC_FILE_BYTES) {
|
|
1572
|
-
const existing = fs.readFileSync(projectGitignorePath, 'utf-8');
|
|
1573
|
-
const blanketPattern = /^(\*\*\/)?\.monomind\/?\s*$/gm;
|
|
1574
|
-
if (blanketPattern.test(existing)) {
|
|
1575
|
-
const fixed = existing
|
|
1576
|
-
.split('\n')
|
|
1577
|
-
.filter(line => !/^(\*\*\/)?\.monomind\/?\s*$/.test(line))
|
|
1578
|
-
.join('\n');
|
|
1579
|
-
const specificExcludes = [
|
|
1580
|
-
'# monomind runtime — exclude sensitive and machine-specific data',
|
|
1581
|
-
'.monomind/sessions/',
|
|
1582
|
-
'.monomind/security/',
|
|
1583
|
-
'.monomind/*.tmp',
|
|
1584
|
-
'.monomind/*.log',
|
|
1585
|
-
'.monomind/daemon.pid',
|
|
1586
|
-
'.monomind/*.db',
|
|
1587
|
-
'.monomind/*.db-wal',
|
|
1588
|
-
'.monomind/*.db-shm',
|
|
1589
|
-
].join('\n');
|
|
1590
|
-
atomicWriteFile(projectGitignorePath, fixed.trimEnd() + '\n' + specificExcludes + '\n');
|
|
1591
|
-
result.updated.push('.gitignore (replaced blanket .monomind/ ignore with specific excludes)');
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
// Write CAPABILITIES.md with full system overview
|
|
1595
|
-
await writeCapabilitiesDoc(targetDir, options, result);
|
|
1596
|
-
}
|
|
1597
|
-
/**
|
|
1598
|
-
* Write initial metrics files for statusline
|
|
1599
|
-
* Creates baseline data so statusline shows meaningful state instead of all zeros
|
|
1600
|
-
*/
|
|
1601
|
-
async function writeInitialMetrics(targetDir, options, result) {
|
|
1602
|
-
const metricsDir = path.join(targetDir, '.monomind', 'metrics');
|
|
1603
|
-
const learningDir = path.join(targetDir, '.monomind', 'learning');
|
|
1604
|
-
const securityDir = path.join(targetDir, '.monomind', 'security');
|
|
1605
|
-
// Ensure directories exist
|
|
1606
|
-
for (const dir of [metricsDir, learningDir, securityDir]) {
|
|
1607
|
-
if (!fs.existsSync(dir)) {
|
|
1608
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
// Create initial v1-progress.json
|
|
1612
|
-
const progressPath = path.join(metricsDir, 'v1-progress.json');
|
|
1613
|
-
if (!fs.existsSync(progressPath) || options.force) {
|
|
1614
|
-
const progress = {
|
|
1615
|
-
version: '3.0.0',
|
|
1616
|
-
initialized: new Date().toISOString(),
|
|
1617
|
-
domains: {
|
|
1618
|
-
completed: 0,
|
|
1619
|
-
total: 5,
|
|
1620
|
-
status: 'INITIALIZING'
|
|
1621
|
-
},
|
|
1622
|
-
ddd: {
|
|
1623
|
-
progress: 0,
|
|
1624
|
-
modules: 0,
|
|
1625
|
-
totalFiles: 0,
|
|
1626
|
-
totalLines: 0
|
|
1627
|
-
},
|
|
1628
|
-
swarm: {
|
|
1629
|
-
activeAgents: 0,
|
|
1630
|
-
maxAgents: options.runtime.maxAgents,
|
|
1631
|
-
topology: options.runtime.topology
|
|
1632
|
-
},
|
|
1633
|
-
learning: {
|
|
1634
|
-
status: 'READY',
|
|
1635
|
-
patternsLearned: 0,
|
|
1636
|
-
sessionsCompleted: 0
|
|
1637
|
-
},
|
|
1638
|
-
_note: 'Metrics will update as you use Monomind (workers refresh at session start).'
|
|
1639
|
-
};
|
|
1640
|
-
atomicWriteFile(progressPath, JSON.stringify(progress, null, 2));
|
|
1641
|
-
result.created.files.push('.monomind/metrics/v1-progress.json');
|
|
1642
|
-
}
|
|
1643
|
-
// Create initial swarm-activity.json
|
|
1644
|
-
const activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
1645
|
-
if (!fs.existsSync(activityPath) || options.force) {
|
|
1646
|
-
const activity = {
|
|
1647
|
-
timestamp: new Date().toISOString(),
|
|
1648
|
-
processes: {
|
|
1649
|
-
mcp_server: 0,
|
|
1650
|
-
estimated_agents: 0
|
|
1651
|
-
},
|
|
1652
|
-
swarm: {
|
|
1653
|
-
active: false,
|
|
1654
|
-
agent_count: 0,
|
|
1655
|
-
coordination_active: false
|
|
1656
|
-
},
|
|
1657
|
-
integration: {
|
|
1658
|
-
mcp_active: false
|
|
1659
|
-
},
|
|
1660
|
-
_initialized: true
|
|
1661
|
-
};
|
|
1662
|
-
atomicWriteFile(activityPath, JSON.stringify(activity, null, 2));
|
|
1663
|
-
result.created.files.push('.monomind/metrics/swarm-activity.json');
|
|
1664
|
-
}
|
|
1665
|
-
// Create initial learning.json
|
|
1666
|
-
const learningPath = path.join(metricsDir, 'learning.json');
|
|
1667
|
-
if (!fs.existsSync(learningPath) || options.force) {
|
|
1668
|
-
const learning = {
|
|
1669
|
-
initialized: new Date().toISOString(),
|
|
1670
|
-
routing: {
|
|
1671
|
-
accuracy: 0,
|
|
1672
|
-
decisions: 0
|
|
1673
|
-
},
|
|
1674
|
-
patterns: {
|
|
1675
|
-
shortTerm: 0,
|
|
1676
|
-
longTerm: 0,
|
|
1677
|
-
quality: 0
|
|
1678
|
-
},
|
|
1679
|
-
sessions: {
|
|
1680
|
-
total: 0,
|
|
1681
|
-
current: null
|
|
1682
|
-
},
|
|
1683
|
-
_note: 'Intelligence grows as you use Monomind'
|
|
1684
|
-
};
|
|
1685
|
-
atomicWriteFile(learningPath, JSON.stringify(learning, null, 2));
|
|
1686
|
-
result.created.files.push('.monomind/metrics/learning.json');
|
|
1687
|
-
}
|
|
1688
|
-
// Create initial audit-status.json
|
|
1689
|
-
const auditPath = path.join(securityDir, 'audit-status.json');
|
|
1690
|
-
if (!fs.existsSync(auditPath) || options.force) {
|
|
1691
|
-
const audit = {
|
|
1692
|
-
initialized: new Date().toISOString(),
|
|
1693
|
-
status: 'PENDING',
|
|
1694
|
-
cvesFixed: 0,
|
|
1695
|
-
totalCves: 3,
|
|
1696
|
-
lastScan: null,
|
|
1697
|
-
_note: 'Run: npx monomind@latest security scan'
|
|
1698
|
-
};
|
|
1699
|
-
atomicWriteFile(auditPath, JSON.stringify(audit, null, 2));
|
|
1700
|
-
result.created.files.push('.monomind/security/audit-status.json');
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
/**
|
|
1704
|
-
* Write CAPABILITIES.md - comprehensive overview of all Monomind features
|
|
1705
|
-
*/
|
|
1706
|
-
async function writeCapabilitiesDoc(targetDir, options, result) {
|
|
1707
|
-
const capabilitiesPath = path.join(targetDir, '.monomind', 'CAPABILITIES.md');
|
|
1708
|
-
if (fs.existsSync(capabilitiesPath) && !options.force) {
|
|
1709
|
-
result.skipped.push('.monomind/CAPABILITIES.md');
|
|
1710
|
-
return;
|
|
1711
|
-
}
|
|
1712
|
-
const hooksAvailable = _isOptionalPackageResolvable('@monoes/hooks');
|
|
1713
|
-
const capabilities = `# Monomind - Complete Capabilities Reference
|
|
1714
|
-
> Generated: ${new Date().toISOString()}
|
|
1715
|
-
> Full documentation: https://github.com/monoes/monomind
|
|
1716
|
-
|
|
1717
|
-
## 📋 Table of Contents
|
|
1718
|
-
|
|
1719
|
-
1. [Overview](#overview)
|
|
1720
|
-
2. [Swarm Orchestration](#swarm-orchestration)
|
|
1721
|
-
3. [Available Agents (60+)](#available-agents)
|
|
1722
|
-
4. [CLI Commands](#cli-commands)
|
|
1723
|
-
5. [Hooks System (29 Hook Subcommands + 15 Background Workers)](#hooks-system)
|
|
1724
|
-
6. [Memory & Intelligence](#memory--intelligence)
|
|
1725
|
-
7. [Hive-Mind Consensus](#hive-mind-consensus)
|
|
1726
|
-
8. [Performance Targets](#performance-targets)
|
|
1727
|
-
9. [Integration Ecosystem](#integration-ecosystem)
|
|
1728
|
-
|
|
1729
|
-
---
|
|
1730
|
-
|
|
1731
|
-
## Overview
|
|
1732
|
-
|
|
1733
|
-
Monomind is a domain-driven design architecture for multi-agent AI coordination with:
|
|
1734
|
-
|
|
1735
|
-
- **15-Agent Swarm Coordination** with hierarchical and mesh topologies
|
|
1736
|
-
- **ANN Vector Search** - indexed pattern retrieval via SQLite (better-sqlite3, sql.js WASM fallback)
|
|
1737
|
-
- **Keyword Routing** - deterministic task→agent routing with outcome measurement
|
|
1738
|
-
- **Byzantine Fault Tolerance** - Queen-led consensus mechanisms
|
|
1739
|
-
- **MCP Server Integration** - Model Context Protocol support
|
|
1740
|
-
|
|
1741
|
-
### Current Configuration
|
|
1742
|
-
| Setting | Value |
|
|
1743
|
-
|---------|-------|
|
|
1744
|
-
| Topology | ${options.runtime.topology} |
|
|
1745
|
-
| Max Agents | ${options.runtime.maxAgents} |
|
|
1746
|
-
| Memory Backend | ${options.runtime.memoryBackend} |
|
|
1747
|
-
| HNSW Indexing | ${options.runtime.enableHNSW ? 'Enabled' : 'Disabled'} |
|
|
1748
|
-
| Neural Learning | ${options.runtime.enableNeural ? 'Enabled' : 'Disabled'} |
|
|
1749
|
-
| Learning | ${options.runtime.enableLearningBridge ? 'Enabled' : 'Disabled'} |
|
|
1750
|
-
| Agent Scopes | ${options.runtime.enableAgentScopes ? 'Enabled (project/local/user)' : 'Disabled'} |
|
|
1751
|
-
|
|
1752
|
-
---
|
|
1753
|
-
|
|
1754
|
-
## Swarm Orchestration
|
|
1755
|
-
|
|
1756
|
-
### Topologies
|
|
1757
|
-
| Topology | Description | Best For |
|
|
1758
|
-
|----------|-------------|----------|
|
|
1759
|
-
| \`hierarchical\` | Queen controls workers directly | Anti-drift, tight control |
|
|
1760
|
-
| \`mesh\` | Fully connected peer network | Distributed tasks |
|
|
1761
|
-
| \`hierarchical-mesh\` | V1 hybrid (recommended) | 10+ agents |
|
|
1762
|
-
| \`ring\` | Circular communication | Sequential workflows |
|
|
1763
|
-
| \`star\` | Central coordinator | Simple coordination |
|
|
1764
|
-
| \`adaptive\` | Dynamic based on load | Variable workloads |
|
|
1765
|
-
|
|
1766
|
-
### Strategies
|
|
1767
|
-
- \`balanced\` - Even distribution across agents
|
|
1768
|
-
- \`specialized\` - Clear roles, no overlap (anti-drift)
|
|
1769
|
-
- \`adaptive\` - Dynamic task routing
|
|
1770
|
-
|
|
1771
|
-
### Quick Commands
|
|
1772
|
-
\`\`\`bash
|
|
1773
|
-
# Initialize swarm
|
|
1774
|
-
npx monomind@latest swarm init --topology hierarchical --max-agents 8 --strategy specialized
|
|
1775
|
-
|
|
1776
|
-
# Check status
|
|
1777
|
-
npx monomind@latest swarm status
|
|
1778
|
-
|
|
1779
|
-
# Monitor activity
|
|
1780
|
-
npx monomind@latest swarm monitor
|
|
1781
|
-
\`\`\`
|
|
1782
|
-
|
|
1783
|
-
---
|
|
1784
|
-
|
|
1785
|
-
## Available Agents
|
|
1786
|
-
|
|
1787
|
-
### Core Development (5)
|
|
1788
|
-
\`coder\`, \`reviewer\`, \`tester\`, \`planner\`, \`researcher\`
|
|
1789
|
-
|
|
1790
|
-
### V1 Specialized (4)
|
|
1791
|
-
\`security-architect\`, \`security-auditor\`, \`memory-specialist\`, \`performance-engineer\`
|
|
1792
|
-
|
|
1793
|
-
### Swarm Coordination (5)
|
|
1794
|
-
\`hierarchical-coordinator\`, \`mesh-coordinator\`, \`adaptive-coordinator\`, \`collective-intelligence-coordinator\`, \`swarm-memory-manager\`
|
|
1795
|
-
|
|
1796
|
-
### Consensus & Distributed (7)
|
|
1797
|
-
\`byzantine-coordinator\`, \`raft-manager\`, \`gossip-coordinator\`, \`consensus-builder\`, \`crdt-synchronizer\`, \`quorum-manager\`, \`security-manager\`
|
|
1798
|
-
|
|
1799
|
-
### Performance & Optimization (5)
|
|
1800
|
-
\`perf-analyzer\`, \`performance-benchmarker\`, \`task-orchestrator\`, \`memory-coordinator\`, \`smart-agent\`
|
|
1801
|
-
|
|
1802
|
-
### GitHub & Repository (9)
|
|
1803
|
-
\`github-modes\`, \`pr-manager\`, \`code-review-swarm\`, \`issue-tracker\`, \`release-manager\`, \`workflow-automation\`, \`project-board-sync\`, \`repo-architect\`, \`multi-repo-swarm\`
|
|
1804
|
-
|
|
1805
|
-
### Specialized Development (8)
|
|
1806
|
-
\`backend-dev\`, \`mobile-dev\`, \`ml-developer\`, \`cicd-engineer\`, \`api-docs\`, \`system-architect\`, \`code-analyzer\`, \`base-template-generator\`
|
|
1807
|
-
|
|
1808
|
-
### Testing & Validation (2)
|
|
1809
|
-
\`tdd-london-swarm\`, \`production-validator\`
|
|
1810
|
-
|
|
1811
|
-
### Agent Routing by Task
|
|
1812
|
-
| Task Type | Recommended Agents | Topology |
|
|
1813
|
-
|-----------|-------------------|----------|
|
|
1814
|
-
| Bug Fix | researcher, coder, tester | mesh |
|
|
1815
|
-
| New Feature | coordinator, architect, coder, tester, reviewer | hierarchical |
|
|
1816
|
-
| Refactoring | architect, coder, reviewer | mesh |
|
|
1817
|
-
| Performance | researcher, perf-engineer, coder | hierarchical |
|
|
1818
|
-
| Security | security-architect, auditor, reviewer | hierarchical |
|
|
1819
|
-
| Docs | researcher, api-docs | mesh |
|
|
1820
|
-
|
|
1821
|
-
---
|
|
1822
|
-
|
|
1823
|
-
## CLI Commands
|
|
1824
|
-
|
|
1825
|
-
### Core Commands
|
|
1826
|
-
| Command | Subcommands | Description |
|
|
1827
|
-
|---------|-------------|-------------|
|
|
1828
|
-
| \`init\` | 5 | Project initialization |
|
|
1829
|
-
| \`agent\` | 7 | Agent lifecycle management |
|
|
1830
|
-
| \`swarm\` | 6 | Multi-agent coordination |
|
|
1831
|
-
| \`memory\` | 12 | SQLite with ANN vector search |
|
|
1832
|
-
| \`mcp\` | 9 | MCP server management |
|
|
1833
|
-
| \`task\` | 5 | Task assignment |
|
|
1834
|
-
| \`session\` | 6 | Session persistence |
|
|
1835
|
-
| \`config\` | 7 | Configuration |
|
|
1836
|
-
| \`status\` | 3 | System monitoring |
|
|
1837
|
-
| \`hooks\` | 29 | Self-learning hooks + 15 background workers${hooksAvailable ? '' : ' (background workers unavailable in this install)'} |
|
|
1838
|
-
|
|
1839
|
-
> Note: there is no \`hive-mind\`, \`workflow\`, \`neural\`, \`embeddings\`, \`claims\`, \`migrate\`, or \`process\` CLI command.
|
|
1840
|
-
> Hive-Mind consensus (byzantine/raft/quorum) is available exclusively via MCP tools, not the CLI.
|
|
1841
|
-
> Neural pattern learning was merged into \`hooks intelligence\`.
|
|
1842
|
-
|
|
1843
|
-
### Advanced Commands
|
|
1844
|
-
| Command | Subcommands | Description |
|
|
1845
|
-
|---------|-------------|-------------|
|
|
1846
|
-
| \`security\` | 6 | Security scanning |
|
|
1847
|
-
| \`performance\` | 4 | Profiling & benchmarks |
|
|
1848
|
-
| \`providers\` | 4 | AI provider config |
|
|
1849
|
-
| \`guidance\` | 1 | Governance gate setup |
|
|
1850
|
-
| \`doctor\` | 1 | Health diagnostics |
|
|
1851
|
-
| \`completions\` | 4 | Shell completions |
|
|
1852
|
-
|
|
1853
|
-
### Example Commands
|
|
1854
|
-
\`\`\`bash
|
|
1855
|
-
# Initialize
|
|
1856
|
-
npx monomind@latest init --wizard
|
|
1857
|
-
|
|
1858
|
-
# Spawn agent
|
|
1859
|
-
npx monomind@latest agent spawn -t coder --name my-coder
|
|
1860
|
-
|
|
1861
|
-
# Memory operations
|
|
1862
|
-
npx monomind@latest memory store --key "pattern" --value "data" --namespace patterns
|
|
1863
|
-
npx monomind@latest memory search --query "authentication"
|
|
1864
|
-
|
|
1865
|
-
# Diagnostics
|
|
1866
|
-
npx monomind@latest doctor --fix
|
|
1867
|
-
\`\`\`
|
|
1868
|
-
|
|
1869
|
-
---
|
|
1870
|
-
|
|
1871
|
-
## Hooks System
|
|
1872
|
-
|
|
1873
|
-
### 29 Available Hook Subcommands${hooksAvailable ? '' : ' — background workers unavailable in this install (@monoes/hooks did not resolve)'}
|
|
1874
|
-
|
|
1875
|
-
#### Core Hooks (6)
|
|
1876
|
-
| Hook | Description |
|
|
1877
|
-
|------|-------------|
|
|
1878
|
-
| \`pre-edit\` | Context before file edits |
|
|
1879
|
-
| \`post-edit\` | Record edit outcomes |
|
|
1880
|
-
| \`pre-command\` | Risk assessment |
|
|
1881
|
-
| \`post-command\` | Command metrics |
|
|
1882
|
-
| \`pre-task\` | Task start + agent suggestions |
|
|
1883
|
-
| \`post-task\` | Task completion learning |
|
|
1884
|
-
|
|
1885
|
-
#### Session Hooks (4)
|
|
1886
|
-
| Hook | Description |
|
|
1887
|
-
|------|-------------|
|
|
1888
|
-
| \`session-start\` | Start/restore session |
|
|
1889
|
-
| \`session-end\` | Persist state |
|
|
1890
|
-
| \`session-restore\` | Restore previous |
|
|
1891
|
-
| \`notify\` | Cross-agent notifications |
|
|
1892
|
-
|
|
1893
|
-
#### Intelligence Hooks (5)
|
|
1894
|
-
| Hook | Description |
|
|
1895
|
-
|------|-------------|
|
|
1896
|
-
| \`route\` | Optimal agent routing |
|
|
1897
|
-
| \`explain\` | Routing decisions |
|
|
1898
|
-
| \`pretrain\` | Bootstrap intelligence |
|
|
1899
|
-
| \`build-agents\` | Generate configs |
|
|
1900
|
-
| \`transfer\` | Pattern transfer |
|
|
1901
|
-
|
|
1902
|
-
#### Coverage Hooks (3)
|
|
1903
|
-
| Hook | Description |
|
|
1904
|
-
|------|-------------|
|
|
1905
|
-
| \`coverage-route\` | Coverage-based routing |
|
|
1906
|
-
| \`coverage-suggest\` | Improvement suggestions |
|
|
1907
|
-
| \`coverage-gaps\` | Gap analysis |
|
|
1908
|
-
|
|
1909
|
-
### 15 Background Workers (@monoes/hooks, run in-process)
|
|
1910
|
-
| Worker | Priority | Purpose |
|
|
1911
|
-
|--------|----------|---------|
|
|
1912
|
-
| \`performance\` | normal | Benchmark performance |
|
|
1913
|
-
| \`health\` | high | System health monitoring |
|
|
1914
|
-
| \`swarm\` | high | Swarm activity monitoring |
|
|
1915
|
-
| \`git\` | normal | Branch/change tracking |
|
|
1916
|
-
| \`learning\` | normal | Learning optimization |
|
|
1917
|
-
| \`adr\` | low | ADR compliance |
|
|
1918
|
-
| \`ddd\` | low | DDD progress |
|
|
1919
|
-
| \`security\` | high | Secret/vulnerability scan |
|
|
1920
|
-
| \`patterns\` | normal | Pattern consolidation |
|
|
1921
|
-
| \`cache\` | background | Cache cleanup |
|
|
1922
|
-
| \`progress\` | normal | Progress tracking |
|
|
1923
|
-
| \`map\` | normal | Codebase mapping |
|
|
1924
|
-
| \`audit\` | high | Security audit metrics |
|
|
1925
|
-
| \`optimize\` | normal | Performance snapshot |
|
|
1926
|
-
| \`consolidate\` | low | Memory consolidation |
|
|
1927
|
-
|
|
1928
|
-
Metrics-producing workers (ddd, map, audit, optimize, consolidate) refresh at
|
|
1929
|
-
session start when their output is >6h old; run on demand with
|
|
1930
|
-
\`monomind hooks worker run <name>\`.
|
|
1931
|
-
|
|
1932
|
-
---
|
|
1933
|
-
|
|
1934
|
-
## Memory & Intelligence
|
|
1935
|
-
|
|
1936
|
-
### Intelligence System
|
|
1937
|
-
- **Keyword routing**: Deterministic task→agent routing with outcome measurement
|
|
1938
|
-
- **ANN pattern search**: Indexed vector search via SQLite
|
|
1939
|
-
- **ReasoningBank**: Stores learned patterns and trajectories for retrieval
|
|
1940
|
-
- **Int8 Quantization**: ~4x memory reduction for stored embeddings
|
|
1941
|
-
|
|
1942
|
-
Routing and learning are JS-only — no native neural engine is required. Route
|
|
1943
|
-
and command outcomes are recorded and scored so routing quality is measured.
|
|
1944
|
-
|
|
1945
|
-
### Self-Learning Memory (ADR-049)
|
|
1946
|
-
|
|
1947
|
-
| Component | Status | Description |
|
|
1948
|
-
|-----------|--------|-------------|
|
|
1949
|
-
| **Learning** | ${options.runtime.enableLearningBridge ? '✅ Enabled' : '⏸ Disabled'} | Connects insights to the pattern store |
|
|
1950
|
-
| **AgentMemoryScope** | ${options.runtime.enableAgentScopes ? '✅ Enabled' : '⏸ Disabled'} | 3-scope agent memory (project/local/user) |
|
|
1951
|
-
|
|
1952
|
-
**Learning** — Insights trigger learning trajectories. Confidence evolves: +0.03 on access, -0.005/hour decay.
|
|
1953
|
-
|
|
1954
|
-
**AgentMemoryScope** - Maps Claude Code 3-scope directories:
|
|
1955
|
-
- \`project\`: \`<gitRoot>/.claude/agent-memory/<agent>/\`
|
|
1956
|
-
- \`local\`: \`<gitRoot>/.claude/agent-memory-local/<agent>/\`
|
|
1957
|
-
- \`user\`: \`~/.claude/agent-memory/<agent>/\`
|
|
1958
|
-
|
|
1959
|
-
High-confidence insights (>0.8) can transfer between agents.
|
|
1960
|
-
|
|
1961
|
-
### Memory Commands
|
|
1962
|
-
\`\`\`bash
|
|
1963
|
-
# Store pattern
|
|
1964
|
-
npx monomind@latest memory store --key "name" --value "data" --namespace patterns
|
|
1965
|
-
|
|
1966
|
-
# Semantic search
|
|
1967
|
-
npx monomind@latest memory search --query "authentication"
|
|
1968
|
-
|
|
1969
|
-
# List entries
|
|
1970
|
-
npx monomind@latest memory list --namespace patterns
|
|
1971
|
-
|
|
1972
|
-
# Initialize database
|
|
1973
|
-
npx monomind@latest memory init --force
|
|
1974
|
-
\`\`\`
|
|
1975
|
-
|
|
1976
|
-
---
|
|
1977
|
-
|
|
1978
|
-
## Hive-Mind Consensus
|
|
1979
|
-
|
|
1980
|
-
> **Experimental, MCP-only.** There is no \`hive-mind\` CLI command — this is
|
|
1981
|
-
> single-process vote counting exposed exclusively via MCP tools
|
|
1982
|
-
> (\`hive-mind-tools.ts\`), not distributed networking. Reach it through the
|
|
1983
|
-
> MCP server (\`npx monomind@latest mcp start\`) once connected to an MCP client.
|
|
1984
|
-
|
|
1985
|
-
### Queen Types
|
|
1986
|
-
| Type | Role |
|
|
1987
|
-
|------|------|
|
|
1988
|
-
| Strategic Queen | Long-term planning |
|
|
1989
|
-
| Tactical Queen | Execution coordination |
|
|
1990
|
-
| Adaptive Queen | Dynamic optimization |
|
|
1991
|
-
|
|
1992
|
-
### Worker Types (8)
|
|
1993
|
-
\`researcher\`, \`coder\`, \`analyst\`, \`tester\`, \`architect\`, \`reviewer\`, \`optimizer\`, \`documenter\`
|
|
1994
|
-
|
|
1995
|
-
### Consensus Mechanisms
|
|
1996
|
-
| Mechanism | Fault Tolerance | Status |
|
|
1997
|
-
|-----------|-----------------|--------|
|
|
1998
|
-
| \`byzantine\` / \`bft\` | f < n/3 faulty | Implemented (vote counting) |
|
|
1999
|
-
| \`raft\` | f < n/2 failed | Implemented (vote counting) |
|
|
2000
|
-
| \`quorum\` | Configurable | Implemented |
|
|
2001
|
-
| \`gossip\` | Eventually consistent | Planned — not implemented, rejected by \`hive_mind_init\` |
|
|
2002
|
-
| \`crdt\` | Conflict-free | Planned — not implemented, rejected by \`hive_mind_init\` |
|
|
2003
|
-
|
|
2004
|
-
---
|
|
2005
|
-
|
|
2006
|
-
## Performance Targets
|
|
2007
|
-
|
|
2008
|
-
| Metric | Target | Status |
|
|
2009
|
-
|--------|--------|--------|
|
|
2010
|
-
| ANN Search | Indexed vector search | ✅ Implemented (SQLite) |
|
|
2011
|
-
| Memory Reduction | 50-75% | ✅ Implemented (~4x via Int8 quantization) |
|
|
2012
|
-
| Pattern Learning | Recorded + retrievable | ✅ Implemented (ReasoningBank) |
|
|
2013
|
-
| MCP Response | <100ms | ✅ Achieved |
|
|
2014
|
-
| CLI Startup | <500ms | ✅ Achieved |
|
|
2015
|
-
| Graph Build (1k) | <200ms | ✅ 2.78ms (71.9x headroom) |
|
|
2016
|
-
| PageRank (1k) | <100ms | ✅ 12.21ms (8.2x headroom) |
|
|
2017
|
-
| Insight Recording | <5ms/each | ✅ 0.12ms (41x headroom) |
|
|
2018
|
-
| Consolidation | <500ms | ✅ 0.26ms (1,955x headroom) |
|
|
2019
|
-
| Knowledge Transfer | <100ms | ✅ 1.25ms (80x headroom) |
|
|
2020
|
-
|
|
2021
|
-
---
|
|
2022
|
-
|
|
2023
|
-
## Integration Ecosystem
|
|
2024
|
-
|
|
2025
|
-
### Integrated Packages
|
|
2026
|
-
| Package | Version | Purpose |
|
|
2027
|
-
|---------|---------|---------|
|
|
2028
|
-
| better-sqlite3 (sql.js WASM fallback) | latest | SQLite vector database (ANN search) |
|
|
2029
|
-
|
|
2030
|
-
### Optional Integrations
|
|
2031
|
-
| Package | Command |
|
|
2032
|
-
|---------|---------|
|
|
2033
|
-
| agentic-jujutsu | \`npx agentic-jujutsu@latest\` |
|
|
2034
|
-
|
|
2035
|
-
### MCP Server Setup
|
|
2036
|
-
\`\`\`bash
|
|
2037
|
-
# Add Monomind MCP
|
|
2038
|
-
claude mcp add monomind -- npx -y monomind@latest mcp start
|
|
2039
|
-
\`\`\`
|
|
2040
|
-
|
|
2041
|
-
---
|
|
2042
|
-
|
|
2043
|
-
## Quick Reference
|
|
2044
|
-
|
|
2045
|
-
### Essential Commands
|
|
2046
|
-
\`\`\`bash
|
|
2047
|
-
# Setup
|
|
2048
|
-
npx monomind@latest init --wizard
|
|
2049
|
-
npx monomind@latest doctor --fix
|
|
2050
|
-
|
|
2051
|
-
# Swarm
|
|
2052
|
-
npx monomind@latest swarm init --topology hierarchical --max-agents 8
|
|
2053
|
-
npx monomind@latest swarm status
|
|
2054
|
-
|
|
2055
|
-
# Agents
|
|
2056
|
-
npx monomind@latest agent spawn -t coder
|
|
2057
|
-
npx monomind@latest agent list
|
|
2058
|
-
|
|
2059
|
-
# Memory
|
|
2060
|
-
npx monomind@latest memory search --query "patterns"
|
|
2061
|
-
|
|
2062
|
-
# Hooks
|
|
2063
|
-
npx monomind@latest hooks pre-task --description "task"
|
|
2064
|
-
npx monomind@latest hooks worker run optimize
|
|
2065
|
-
\`\`\`
|
|
2066
|
-
|
|
2067
|
-
### File Structure
|
|
2068
|
-
\`\`\`
|
|
2069
|
-
.monomind/
|
|
2070
|
-
├── config.yaml # Runtime configuration
|
|
2071
|
-
├── CAPABILITIES.md # This file
|
|
2072
|
-
├── data/ # Memory storage
|
|
2073
|
-
├── logs/ # Operation logs
|
|
2074
|
-
├── sessions/ # Session state
|
|
2075
|
-
├── hooks/ # Custom hooks
|
|
2076
|
-
├── agents/ # Agent configs
|
|
2077
|
-
└── workflows/ # Workflow templates
|
|
2078
|
-
\`\`\`
|
|
2079
|
-
|
|
2080
|
-
---
|
|
2081
|
-
|
|
2082
|
-
**Full Documentation**: https://github.com/monoes/monomind
|
|
2083
|
-
**Issues**: https://github.com/monoes/monomind/issues
|
|
2084
|
-
`;
|
|
2085
|
-
atomicWriteFile(capabilitiesPath, capabilities);
|
|
2086
|
-
result.created.files.push('.monomind/CAPABILITIES.md');
|
|
2087
|
-
}
|
|
2088
|
-
/**
|
|
2089
|
-
* Write CLAUDE.md with swarm guidance
|
|
2090
|
-
*/
|
|
2091
|
-
async function writeClaudeMd(targetDir, options, result) {
|
|
2092
|
-
const claudeMdPath = path.join(targetDir, 'CLAUDE.md');
|
|
2093
|
-
if (fs.existsSync(claudeMdPath) && !options.force) {
|
|
2094
|
-
result.skipped.push('CLAUDE.md');
|
|
2095
|
-
}
|
|
2096
|
-
else {
|
|
2097
|
-
// Determine template: explicit option > infer from components > 'standard'
|
|
2098
|
-
const inferredTemplate = (!options.components.commands && !options.components.agents) ? 'minimal' : undefined;
|
|
2099
|
-
const content = generateClaudeMd(options, inferredTemplate);
|
|
2100
|
-
atomicWriteFile(claudeMdPath, content);
|
|
2101
|
-
result.created.files.push('CLAUDE.md');
|
|
2102
|
-
}
|
|
2103
|
-
// Also write/append global ~/.claude/CLAUDE.md so monomind tools are used automatically (#1497)
|
|
2104
|
-
const homeDir = process.env.HOME || process.env.USERPROFILE || '';
|
|
2105
|
-
if (homeDir) {
|
|
2106
|
-
const globalClaudeDir = path.join(homeDir, '.claude');
|
|
2107
|
-
const globalClaudeMd = path.join(globalClaudeDir, 'CLAUDE.md');
|
|
2108
|
-
const monomindBlock = [
|
|
2109
|
-
'',
|
|
2110
|
-
'# Monomind Integration (auto-generated by monomind init)',
|
|
2111
|
-
'When working on multi-file tasks or complex features, use ToolSearch to find and invoke monomind MCP tools.',
|
|
2112
|
-
'Key tools: memory_store, memory_search, hooks_route, swarm_init, agent_spawn.',
|
|
2113
|
-
'**Code navigation**: ALWAYS call `mcp__monomind__monograph_query` BEFORE grep/rg/find for code exploration — it returns file path + line number from a pre-built knowledge graph. Call `mcp__monomind__monograph_suggest` with a task description for multi-file tasks. Only fall back to grep if monograph returns 0 results or the DB is not built.',
|
|
2114
|
-
'Check system-reminder tags for [INTELLIGENCE] pattern suggestions and [MONOGRAPH] context before starting work.',
|
|
2115
|
-
'',
|
|
2116
|
-
].join('\n');
|
|
2117
|
-
try {
|
|
2118
|
-
if (!fs.existsSync(globalClaudeDir)) {
|
|
2119
|
-
fs.mkdirSync(globalClaudeDir, { recursive: true });
|
|
2120
|
-
}
|
|
2121
|
-
if (fs.existsSync(globalClaudeMd) && fs.statSync(globalClaudeMd).size <= MAX_EXEC_FILE_BYTES) {
|
|
2122
|
-
const existing = fs.readFileSync(globalClaudeMd, 'utf-8');
|
|
2123
|
-
if (!existing.includes('Monomind Integration')) {
|
|
2124
|
-
fs.appendFileSync(globalClaudeMd, monomindBlock);
|
|
2125
|
-
result.created.files.push('~/.claude/CLAUDE.md (appended monomind block)');
|
|
2126
|
-
}
|
|
2127
|
-
else if (!existing.includes('monograph_query')) {
|
|
2128
|
-
// Upgrade existing block to include monograph instructions
|
|
2129
|
-
const updated = existing.replace(/# Monomind Integration[^\n]*\n(?:(?!^#).+\n)*/m, monomindBlock.trimStart() + '\n');
|
|
2130
|
-
atomicWriteFile(globalClaudeMd, updated);
|
|
2131
|
-
result.created.files.push('~/.claude/CLAUDE.md (upgraded monomind block)');
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
else {
|
|
2135
|
-
atomicWriteFile(globalClaudeMd, monomindBlock.trimStart());
|
|
2136
|
-
result.created.files.push('~/.claude/CLAUDE.md');
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
catch (e) {
|
|
2140
|
-
// Non-critical — global CLAUDE.md is best-effort
|
|
2141
|
-
if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
|
|
2142
|
-
console.error('[writeClaudeMd] failed to write/append ~/.claude/CLAUDE.md:', e);
|
|
2143
|
-
}
|
|
2144
|
-
// Also inject the token-display hook into ~/.claude/settings.json
|
|
2145
|
-
const globalSettingsPath = path.join(globalClaudeDir, 'settings.json');
|
|
2146
|
-
try {
|
|
2147
|
-
if (!fs.existsSync(globalClaudeDir)) {
|
|
2148
|
-
fs.mkdirSync(globalClaudeDir, { recursive: true });
|
|
2149
|
-
}
|
|
2150
|
-
let globalSettings = {};
|
|
2151
|
-
if (fs.existsSync(globalSettingsPath) && fs.statSync(globalSettingsPath).size <= MAX_EXEC_FILE_BYTES) {
|
|
2152
|
-
try {
|
|
2153
|
-
globalSettings = JSON.parse(fs.readFileSync(globalSettingsPath, 'utf-8'));
|
|
2154
|
-
}
|
|
2155
|
-
catch (e) {
|
|
2156
|
-
// malformed JSON — start fresh
|
|
2157
|
-
if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
|
|
2158
|
-
console.error('[writeClaudeMd] ~/.claude/settings.json unparseable, starting fresh:', e);
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
// Inject SessionStart token hook if not already present
|
|
2162
|
-
const hooks = globalSettings.hooks ?? {};
|
|
2163
|
-
const sessionStartHooks = hooks['SessionStart'] ?? [];
|
|
2164
|
-
const tokenHookCommand = 'npx --yes monomind@latest tokens today';
|
|
2165
|
-
const alreadyPresent = sessionStartHooks.some(entry => Array.isArray(entry.hooks) && entry.hooks.some(h => h.command === tokenHookCommand));
|
|
2166
|
-
if (!alreadyPresent) {
|
|
2167
|
-
sessionStartHooks.push({
|
|
2168
|
-
hooks: [{ type: 'command', command: tokenHookCommand, timeout: 10000 }],
|
|
2169
|
-
});
|
|
2170
|
-
hooks['SessionStart'] = sessionStartHooks;
|
|
2171
|
-
globalSettings.hooks = hooks;
|
|
2172
|
-
atomicWriteFile(globalSettingsPath, JSON.stringify(globalSettings, null, 2));
|
|
2173
|
-
result.created.files.push('~/.claude/settings.json (added token hook)');
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
catch (e) {
|
|
2177
|
-
// Non-critical — global settings hook is best-effort
|
|
2178
|
-
if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
|
|
2179
|
-
console.error('[writeClaudeMd] failed to inject token hook into ~/.claude/settings.json:', e);
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Find source directory for skills/commands/agents
|
|
2185
|
-
*/
|
|
2186
|
-
function findSourceDir(type, sourceBaseDir) {
|
|
2187
|
-
// Build list of possible paths to check
|
|
2188
|
-
const possiblePaths = [];
|
|
2189
|
-
// If explicit source base directory is provided, use it first
|
|
2190
|
-
if (sourceBaseDir) {
|
|
2191
|
-
possiblePaths.push(path.join(sourceBaseDir, '.claude', type));
|
|
2192
|
-
}
|
|
2193
|
-
// IMPORTANT: Check the package's own .claude directory first
|
|
2194
|
-
// This is the primary path when running as an npm package
|
|
2195
|
-
// __dirname is typically /path/to/node_modules/@monomind/cli/dist/src/init
|
|
2196
|
-
// We need to go up 3 levels to reach the package root (dist/src/init -> dist/src -> dist -> root)
|
|
2197
|
-
const packageRoot = path.resolve(__dirname, '..', '..', '..');
|
|
2198
|
-
const packageDotClaude = path.join(packageRoot, '.claude', type);
|
|
2199
|
-
if (fs.existsSync(packageDotClaude)) {
|
|
2200
|
-
possiblePaths.unshift(packageDotClaude); // Add to beginning (highest priority)
|
|
2201
|
-
}
|
|
2202
|
-
// From dist/src/init -> go up to project root
|
|
2203
|
-
const distPath = __dirname;
|
|
2204
|
-
// Try to find the project root by looking for .claude directory
|
|
2205
|
-
let currentDir = distPath;
|
|
2206
|
-
for (let i = 0; i < 10; i++) {
|
|
2207
|
-
const parentDir = path.dirname(currentDir);
|
|
2208
|
-
const dotClaudePath = path.join(parentDir, '.claude', type);
|
|
2209
|
-
if (fs.existsSync(dotClaudePath)) {
|
|
2210
|
-
possiblePaths.push(dotClaudePath);
|
|
2211
|
-
}
|
|
2212
|
-
currentDir = parentDir;
|
|
2213
|
-
}
|
|
2214
|
-
// Also check relative to process.cwd() for development
|
|
2215
|
-
const cwdBased = [
|
|
2216
|
-
path.join(process.cwd(), '.claude', type),
|
|
2217
|
-
path.join(process.cwd(), '..', '.claude', type),
|
|
2218
|
-
path.join(process.cwd(), '..', '..', '.claude', type),
|
|
2219
|
-
];
|
|
2220
|
-
possiblePaths.push(...cwdBased);
|
|
2221
|
-
// Check v2 directory for agents
|
|
2222
|
-
if (type === 'agents') {
|
|
2223
|
-
possiblePaths.push(path.join(process.cwd(), 'v2', '.claude', type), path.join(process.cwd(), '..', 'v2', '.claude', type));
|
|
2224
|
-
}
|
|
2225
|
-
// Plugin directory
|
|
2226
|
-
possiblePaths.push(path.join(process.cwd(), 'plugin', type), path.join(process.cwd(), '..', 'plugin', type));
|
|
2227
|
-
for (const p of possiblePaths) {
|
|
2228
|
-
if (fs.existsSync(p)) {
|
|
2229
|
-
return p;
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
return null;
|
|
2233
|
-
}
|
|
2234
|
-
/**
|
|
2235
|
-
* Copy directory recursively
|
|
2236
|
-
*/
|
|
2237
|
-
function copyDirRecursive(src, dest) {
|
|
2238
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
2239
|
-
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
2240
|
-
for (const entry of entries) {
|
|
2241
|
-
// Skip exFAT/macOS AppleDouble junk files (e.g. "._foo.js") so they don't
|
|
2242
|
-
// get perpetuated into every newly-initialized project.
|
|
2243
|
-
if (entry.name.startsWith('._'))
|
|
2244
|
-
continue;
|
|
2245
|
-
const srcPath = path.join(src, entry.name);
|
|
2246
|
-
const destPath = path.join(dest, entry.name);
|
|
2247
|
-
if (entry.isDirectory()) {
|
|
2248
|
-
copyDirRecursive(srcPath, destPath);
|
|
2249
|
-
}
|
|
2250
|
-
else {
|
|
2251
|
-
fs.copyFileSync(srcPath, destPath);
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
/**
|
|
2256
|
-
* Count files with extension in directory
|
|
2257
|
-
*/
|
|
2258
|
-
function countFiles(dir, ext) {
|
|
2259
|
-
let count = 0;
|
|
2260
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
2261
|
-
for (const entry of entries) {
|
|
2262
|
-
const fullPath = path.join(dir, entry.name);
|
|
2263
|
-
if (entry.isDirectory()) {
|
|
2264
|
-
count += countFiles(fullPath, ext);
|
|
2265
|
-
}
|
|
2266
|
-
else if (entry.name.endsWith(ext)) {
|
|
2267
|
-
count++;
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
return count;
|
|
2271
|
-
}
|
|
2272
|
-
/**
|
|
2273
|
-
* Count enabled hooks
|
|
2274
|
-
*/
|
|
2275
|
-
function countEnabledHooks(options) {
|
|
2276
|
-
const hooks = options.hooks;
|
|
2277
|
-
let count = 0;
|
|
2278
|
-
if (hooks.preToolUse)
|
|
2279
|
-
count++;
|
|
2280
|
-
if (hooks.postToolUse)
|
|
2281
|
-
count++;
|
|
2282
|
-
if (hooks.userPromptSubmit)
|
|
2283
|
-
count++;
|
|
2284
|
-
if (hooks.sessionStart)
|
|
2285
|
-
count++;
|
|
2286
|
-
if (hooks.stop)
|
|
2287
|
-
count++;
|
|
2288
|
-
if (hooks.preCompact)
|
|
2289
|
-
count++;
|
|
2290
|
-
if (hooks.notification)
|
|
2291
|
-
count++;
|
|
2292
|
-
return count;
|
|
2293
|
-
}
|
|
2294
|
-
/**
|
|
2295
|
-
* Register a project directory in ~/.monomind-projects.json so that
|
|
2296
|
-
* `monomind init upgrade --all` can find it without doing a directory scan.
|
|
2297
|
-
* Best-effort: failures are silently swallowed.
|
|
2298
|
-
*/
|
|
2299
|
-
function _registerMonomindProject(dir) {
|
|
2300
|
-
try {
|
|
2301
|
-
const esmReq = createRequire(import.meta.url);
|
|
2302
|
-
const os = esmReq('os');
|
|
2303
|
-
const registryPath = path.join(os.homedir(), '.monomind-projects.json');
|
|
2304
|
-
let reg = { projects: [] };
|
|
2305
|
-
try {
|
|
2306
|
-
if (fs.existsSync(registryPath) && fs.statSync(registryPath).size <= MAX_EXEC_FILE_BYTES) {
|
|
2307
|
-
reg = JSON.parse(fs.readFileSync(registryPath, 'utf-8'));
|
|
2308
|
-
}
|
|
2309
|
-
}
|
|
2310
|
-
catch (e) {
|
|
2311
|
-
// Unparseable registry — proceeding with an empty list will overwrite it below, losing previously registered projects
|
|
2312
|
-
if (process.env.DEBUG || process.env.MONOMIND_DEBUG)
|
|
2313
|
-
console.error('[_registerMonomindProject] ~/.monomind-projects.json unparseable, resetting:', e);
|
|
2314
|
-
}
|
|
2315
|
-
if (!Array.isArray(reg.projects))
|
|
2316
|
-
reg.projects = [];
|
|
2317
|
-
const abs = path.resolve(dir);
|
|
2318
|
-
if (!reg.projects.includes(abs)) {
|
|
2319
|
-
reg.projects.push(abs);
|
|
2320
|
-
fs.writeFileSync(registryPath, JSON.stringify(reg, null, 2), 'utf-8');
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
catch { /* non-fatal */ }
|
|
2324
|
-
}
|
|
2325
|
-
/**
|
|
2326
|
-
* Scan common locations for directories that have monomind installed
|
|
2327
|
-
* (presence of .claude/helpers/hook-handler.cjs is the definitive signal).
|
|
2328
|
-
* Searches up to maxDepth directory levels below each search root.
|
|
2329
|
-
*/
|
|
2330
|
-
export function findMonomindProjects(maxDepth = 3) {
|
|
2331
|
-
const esmReq = createRequire(import.meta.url);
|
|
2332
|
-
const os = esmReq('os');
|
|
2333
|
-
const home = os.homedir();
|
|
2334
|
-
const searchRoots = [
|
|
2335
|
-
path.join(home, 'Desktop'),
|
|
2336
|
-
path.join(home, 'projects'),
|
|
2337
|
-
path.join(home, 'code'),
|
|
2338
|
-
path.join(home, 'work'),
|
|
2339
|
-
path.join(home, 'dev'),
|
|
2340
|
-
path.join(home, 'repos'),
|
|
2341
|
-
path.join(home, 'src'),
|
|
2342
|
-
].filter(r => fs.existsSync(r));
|
|
2343
|
-
// Also check known-projects registry if it exists
|
|
2344
|
-
const registryPath = path.join(home, '.monomind-projects.json');
|
|
2345
|
-
if (fs.existsSync(registryPath) && fs.statSync(registryPath).size <= MAX_EXEC_FILE_BYTES) {
|
|
2346
|
-
try {
|
|
2347
|
-
const reg = JSON.parse(fs.readFileSync(registryPath, 'utf-8'));
|
|
2348
|
-
if (Array.isArray(reg.projects)) {
|
|
2349
|
-
for (const p of reg.projects) {
|
|
2350
|
-
if (!searchRoots.includes(p) && fs.existsSync(p))
|
|
2351
|
-
searchRoots.push(p);
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
catch { }
|
|
2356
|
-
}
|
|
2357
|
-
const found = new Set();
|
|
2358
|
-
function walk(dir, depth) {
|
|
2359
|
-
if (depth > maxDepth)
|
|
2360
|
-
return;
|
|
2361
|
-
const marker = path.join(dir, '.claude', 'helpers', 'hook-handler.cjs');
|
|
2362
|
-
if (fs.existsSync(marker)) {
|
|
2363
|
-
found.add(dir);
|
|
2364
|
-
return;
|
|
2365
|
-
} // don't recurse into a monomind project
|
|
2366
|
-
let entries;
|
|
2367
|
-
try {
|
|
2368
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
2369
|
-
}
|
|
2370
|
-
catch {
|
|
2371
|
-
return;
|
|
2372
|
-
}
|
|
2373
|
-
for (const e of entries) {
|
|
2374
|
-
if (!e.isDirectory())
|
|
2375
|
-
continue;
|
|
2376
|
-
if (e.name.startsWith('.') || e.name === 'node_modules')
|
|
2377
|
-
continue;
|
|
2378
|
-
walk(path.join(dir, e.name), depth + 1);
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
for (const root of searchRoots) {
|
|
2382
|
-
walk(root, 0);
|
|
2383
|
-
}
|
|
2384
|
-
return [...found];
|
|
2385
|
-
}
|
|
2386
|
-
export default executeInit;
|
|
2387
|
-
//# sourceMappingURL=executor.js.map
|