@monoes/monomindcli 1.18.15 → 2.0.0
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/.claude/agents/core/researcher.md +29 -24
- package/.claude/agents/github/code-review-swarm.md +1 -1
- package/.claude/agents/github/github-modes.md +1 -1
- package/.claude/agents/github/issue-tracker.md +1 -3
- package/.claude/agents/github/multi-repo-swarm.md +1 -1
- package/.claude/agents/github/pr-manager.md +1 -3
- package/.claude/agents/github/project-board-sync.md +1 -1
- package/.claude/agents/github/release-manager.md +1 -1
- package/.claude/agents/github/repo-architect.md +4 -12
- package/.claude/agents/github/swarm-issue.md +1 -1
- package/.claude/agents/github/swarm-pr.md +1 -1
- package/.claude/agents/github/sync-coordinator.md +1 -1
- package/.claude/agents/github/workflow-automation.md +1 -1
- package/.claude/agents/goal/goal-planner.md +1 -2
- package/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
- package/.claude/agents/testing/production-validator.md +8 -7
- package/.claude/agents/testing/testing-evidence-collector.md +3 -1
- package/.claude/commands/github/issue-tracker.md +0 -2
- package/.claude/commands/github/pr-manager.md +0 -2
- package/.claude/commands/github/repo-architect.md +3 -10
- package/.claude/commands/mastermind/code-review.md +4 -4
- package/.claude/commands/mastermind/help.md +5 -5
- package/.claude/commands/mastermind/okf-export.md +14 -0
- package/.claude/commands/mastermind/okf-import.md +15 -0
- package/.claude/commands/workflows/README.md +0 -1
- package/.claude/commands/workflows/workflow-create.md +0 -1
- package/.claude/commands/workflows/workflow-execute.md +1 -3
- package/.claude/commands/workflows/workflow-export.md +0 -2
- package/.claude/helpers/handlers/agent-start-handler.cjs +28 -36
- package/.claude/helpers/handlers/capture-handler.cjs +110 -0
- package/.claude/helpers/handlers/edit-handler.cjs +15 -0
- package/.claude/helpers/handlers/gates-handler.cjs +2 -8
- package/.claude/helpers/handlers/route-handler.cjs +314 -245
- package/.claude/helpers/handlers/session-handler.cjs +182 -163
- package/.claude/helpers/handlers/session-restore-handler.cjs +95 -53
- package/.claude/helpers/handlers/task-handler.cjs +17 -160
- package/.claude/helpers/hook-handler.cjs +153 -16
- package/.claude/helpers/intelligence.cjs +255 -15
- package/.claude/helpers/learning-service.mjs +1 -0
- package/.claude/helpers/mastermind-activate.cjs +33 -51
- package/.claude/helpers/monolean-activate.cjs +13 -3
- package/.claude/helpers/monolean-propagate.cjs +7 -3
- package/.claude/helpers/router.cjs +122 -11
- package/.claude/helpers/skill-registry.json +0 -189
- package/.claude/skills/github-toolkit/SKILL.md +60 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -15
- package/.claude/skills/hooks-automation/SKILL.md +0 -1
- package/.claude/skills/mastermind-skills/_protocol.md +1 -1
- package/.claude/skills/mastermind-skills/architect.md +5 -6
- package/.claude/skills/mastermind-skills/autodev.md +8 -5
- package/.claude/skills/mastermind-skills/build.md +1 -2
- package/.claude/skills/mastermind-skills/review.md +8 -5
- package/.claude/skills/mastermind-skills/techport.md +37 -3
- package/.claude/skills/memory-toolkit/SKILL.md +75 -0
- package/.claude/skills/monodesign/document.md +9 -6
- package/.claude/skills/monodesign/extract.md +1 -1
- package/.claude/skills/monodesign/reference/document.md +1 -1
- package/.claude/skills/monodesign/reference/live.md +1 -1
- package/.claude/skills/monolean/SKILL.md +1 -1
- package/.claude/skills/specialagent/SKILL.md +2 -4
- package/.claude/skills/swarm-advanced/SKILL.md +0 -1
- package/README.md +2 -5
- package/bin/mcp-server.js +11 -1
- package/dist/src/autopilot-state.d.ts.map +1 -1
- package/dist/src/autopilot-state.js +4 -5
- package/dist/src/autopilot-state.js.map +1 -1
- package/dist/src/browser/dashboard/server.d.ts.map +1 -1
- package/dist/src/browser/dashboard/server.js +69 -1
- package/dist/src/browser/dashboard/server.js.map +1 -1
- package/dist/src/browser/dashboard/ui.html +214 -1764
- package/dist/src/capabilities/index.d.ts +0 -2
- package/dist/src/capabilities/index.d.ts.map +1 -1
- package/dist/src/capabilities/index.js +0 -1
- package/dist/src/capabilities/index.js.map +1 -1
- package/dist/src/commands/agent-lifecycle.d.ts.map +1 -1
- package/dist/src/commands/agent-lifecycle.js +2 -6
- package/dist/src/commands/agent-lifecycle.js.map +1 -1
- package/dist/src/commands/agent-ops.d.ts +1 -2
- package/dist/src/commands/agent-ops.d.ts.map +1 -1
- package/dist/src/commands/agent-ops.js +1 -59
- package/dist/src/commands/agent-ops.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +2 -3
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze-diff.js +1 -1
- package/dist/src/commands/analyze-diff.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +0 -4
- package/dist/src/commands/analyze.d.ts.map +1 -1
- package/dist/src/commands/analyze.js +1 -29
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/browse-action.d.ts.map +1 -1
- package/dist/src/commands/browse-action.js +94 -2
- package/dist/src/commands/browse-action.js.map +1 -1
- package/dist/src/commands/completions.d.ts.map +1 -1
- package/dist/src/commands/completions.js +12 -76
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +0 -6
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts +13 -3
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +131 -23
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +6 -5
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/guidance.d.ts +5 -1
- package/dist/src/commands/guidance.d.ts.map +1 -1
- package/dist/src/commands/guidance.js +11 -556
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind-comms.d.ts.map +1 -1
- package/dist/src/commands/hive-mind-comms.js +11 -4
- package/dist/src/commands/hive-mind-comms.js.map +1 -1
- package/dist/src/commands/hive-mind-helpers.js +2 -2
- package/dist/src/commands/hive-mind-helpers.js.map +1 -1
- package/dist/src/commands/hive-mind-ops.d.ts +1 -3
- package/dist/src/commands/hive-mind-ops.d.ts.map +1 -1
- package/dist/src/commands/hive-mind-ops.js +2 -116
- package/dist/src/commands/hive-mind-ops.js.map +1 -1
- package/dist/src/commands/hive-mind.d.ts +4 -4
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +11 -11
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.js +8 -7
- package/dist/src/commands/hooks-coverage-commands.js.map +1 -1
- package/dist/src/commands/hooks-coverage-gaps.js +1 -1
- package/dist/src/commands/hooks-coverage-gaps.js.map +1 -1
- package/dist/src/commands/hooks-coverage-routing.js +2 -2
- package/dist/src/commands/hooks-coverage-routing.js.map +1 -1
- package/dist/src/commands/hooks-extended-commands.d.ts +0 -3
- package/dist/src/commands/hooks-extended-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-extended-commands.js +0 -307
- package/dist/src/commands/hooks-extended-commands.js.map +1 -1
- package/dist/src/commands/hooks-formatting.d.ts +1 -5
- package/dist/src/commands/hooks-formatting.d.ts.map +1 -1
- package/dist/src/commands/hooks-formatting.js +1 -18
- package/dist/src/commands/hooks-formatting.js.map +1 -1
- package/dist/src/commands/hooks-workers.d.ts +1 -1
- package/dist/src/commands/hooks-workers.d.ts.map +1 -1
- package/dist/src/commands/hooks-workers.js +82 -330
- package/dist/src/commands/hooks-workers.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +1 -12
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +2 -55
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +23 -216
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init-wizard.d.ts.map +1 -1
- package/dist/src/commands/init-wizard.js +3 -5
- package/dist/src/commands/init-wizard.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +4 -24
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +32 -4
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory-admin.d.ts +1 -2
- package/dist/src/commands/memory-admin.d.ts.map +1 -1
- package/dist/src/commands/memory-admin.js +1 -118
- package/dist/src/commands/memory-admin.js.map +1 -1
- package/dist/src/commands/memory-transfer.d.ts +1 -2
- package/dist/src/commands/memory-transfer.d.ts.map +1 -1
- package/dist/src/commands/memory-transfer.js +5 -171
- package/dist/src/commands/memory-transfer.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +3 -6
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/neural-core.d.ts +3 -1
- package/dist/src/commands/neural-core.d.ts.map +1 -1
- package/dist/src/commands/neural-core.js +154 -15
- package/dist/src/commands/neural-core.js.map +1 -1
- package/dist/src/commands/neural-optimize.d.ts.map +1 -1
- package/dist/src/commands/neural-optimize.js +13 -15
- package/dist/src/commands/neural-optimize.js.map +1 -1
- package/dist/src/commands/neural-registry.d.ts +1 -1
- package/dist/src/commands/neural-registry.js +14 -14
- package/dist/src/commands/neural-registry.js.map +1 -1
- package/dist/src/commands/neural.d.ts +1 -1
- package/dist/src/commands/neural.js +6 -6
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.d.ts.map +1 -1
- package/dist/src/commands/performance.js +68 -58
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/providers.d.ts.map +1 -1
- package/dist/src/commands/providers.js +77 -117
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/search-universal.d.ts +7 -1
- package/dist/src/commands/search-universal.d.ts.map +1 -1
- package/dist/src/commands/search-universal.js +59 -5
- package/dist/src/commands/search-universal.js.map +1 -1
- package/dist/src/commands/security-cve.d.ts.map +1 -1
- package/dist/src/commands/security-cve.js +3 -5
- package/dist/src/commands/security-cve.js.map +1 -1
- package/dist/src/commands/security-misc.d.ts +0 -1
- package/dist/src/commands/security-misc.d.ts.map +1 -1
- package/dist/src/commands/security-misc.js +69 -45
- package/dist/src/commands/security-misc.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +2 -4
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts.map +1 -1
- package/dist/src/commands/session.js +137 -281
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +2 -59
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +18 -29
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.d.ts.map +1 -1
- package/dist/src/commands/swarm.js +113 -66
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts.map +1 -1
- package/dist/src/commands/task.js +2 -49
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/consensus/audit-writer.d.ts.map +1 -1
- package/dist/src/consensus/audit-writer.js +43 -1
- package/dist/src/consensus/audit-writer.js.map +1 -1
- package/dist/src/consensus/tally.d.ts +19 -0
- package/dist/src/consensus/tally.d.ts.map +1 -0
- package/dist/src/consensus/tally.js +34 -0
- package/dist/src/consensus/tally.js.map +1 -0
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +13 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +10 -14
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +42 -100
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +2 -22
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +0 -13
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +62 -0
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +3 -9
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +0 -5
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/knowledge/document-pipeline.d.ts.map +1 -1
- package/dist/src/knowledge/document-pipeline.js +18 -8
- package/dist/src/knowledge/document-pipeline.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +0 -8
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +14 -0
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +0 -17
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/coherence/causal-infer.d.ts +5 -5
- package/dist/src/mcp-tools/coherence/causal-infer.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/causal-infer.js +32 -46
- package/dist/src/mcp-tools/coherence/causal-infer.js.map +1 -1
- package/dist/src/mcp-tools/coherence/coherence-check.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/coherence-check.js +1 -19
- package/dist/src/mcp-tools/coherence/coherence-check.js.map +1 -1
- package/dist/src/mcp-tools/coherence/consensus-verify.d.ts +2 -3
- package/dist/src/mcp-tools/coherence/consensus-verify.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/consensus-verify.js +22 -20
- package/dist/src/mcp-tools/coherence/consensus-verify.js.map +1 -1
- package/dist/src/mcp-tools/coherence/memory-gate.d.ts +3 -2
- package/dist/src/mcp-tools/coherence/memory-gate.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/memory-gate.js +32 -19
- package/dist/src/mcp-tools/coherence/memory-gate.js.map +1 -1
- package/dist/src/mcp-tools/coherence/quantum-topology.d.ts +4 -4
- package/dist/src/mcp-tools/coherence/quantum-topology.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/quantum-topology.js +11 -17
- package/dist/src/mcp-tools/coherence/quantum-topology.js.map +1 -1
- package/dist/src/mcp-tools/coherence/spectral-analyze.d.ts +2 -3
- package/dist/src/mcp-tools/coherence/spectral-analyze.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/spectral-analyze.js +51 -32
- package/dist/src/mcp-tools/coherence/spectral-analyze.js.map +1 -1
- package/dist/src/mcp-tools/coherence/types.d.ts +8 -11
- package/dist/src/mcp-tools/coherence/types.d.ts.map +1 -1
- package/dist/src/mcp-tools/coherence/types.js +3 -18
- package/dist/src/mcp-tools/coherence/types.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +1 -7
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/graphify-tools.js +2 -2
- package/dist/src/mcp-tools/graphify-tools.js.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.js +9 -19
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +198 -40
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-advanced.d.ts +18 -0
- package/dist/src/mcp-tools/hooks-advanced.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-advanced.js +25 -0
- package/dist/src/mcp-tools/hooks-advanced.js.map +1 -0
- package/dist/src/mcp-tools/hooks-intelligence.d.ts +4 -8
- package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-intelligence.js +33 -482
- package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.d.ts +1 -3
- package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.js +96 -202
- package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
- package/dist/src/mcp-tools/hooks-synthesis.d.ts +31 -0
- package/dist/src/mcp-tools/hooks-synthesis.d.ts.map +1 -0
- package/dist/src/mcp-tools/hooks-synthesis.js +196 -0
- package/dist/src/mcp-tools/hooks-synthesis.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +10 -11
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +0 -3
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +0 -4
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +24 -9
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts +6 -0
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +370 -95
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts +8 -9
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +249 -539
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +5 -17
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +2 -2
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js.map +1 -1
- package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +4 -4
- package/dist/src/mcp-tools/quality-tools.d.ts +7 -2
- package/dist/src/mcp-tools/quality-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/quality-tools.js +7 -257
- package/dist/src/mcp-tools/quality-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +103 -0
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +9 -9
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +71 -59
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +1 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +47 -5
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-read.d.ts.map +1 -1
- package/dist/src/memory/memory-read.js +1 -19
- package/dist/src/memory/memory-read.js.map +1 -1
- package/dist/src/suggest.d.ts.map +1 -1
- package/dist/src/suggest.js +1 -12
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts +3 -2
- package/dist/src/transfer/store/discovery.d.ts.map +1 -1
- package/dist/src/transfer/store/discovery.js +22 -70
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/update/checker.d.ts.map +1 -1
- package/dist/src/update/checker.js +0 -1
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/utils/cosine-similarity.d.ts +22 -0
- package/dist/src/utils/cosine-similarity.d.ts.map +1 -0
- package/dist/src/utils/cosine-similarity.js +38 -0
- package/dist/src/utils/cosine-similarity.js.map +1 -0
- package/dist/src/utils/input-guards.d.ts +51 -0
- package/dist/src/utils/input-guards.d.ts.map +1 -0
- package/dist/src/utils/input-guards.js +223 -0
- package/dist/src/utils/input-guards.js.map +1 -0
- package/dist/src/utils/json-file.d.ts +33 -0
- package/dist/src/utils/json-file.d.ts.map +1 -0
- package/dist/src/utils/json-file.js +57 -0
- package/dist/src/utils/json-file.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -6
- package/scripts/sync-claude-assets.sh +16 -20
- package/.claude/agents/generated/case-analyst.md +0 -50
- package/.claude/agents/generated/channel-intelligence-director.md +0 -87
- package/.claude/agents/generated/chief-growth-officer.md +0 -88
- package/.claude/agents/generated/churn-analyst.md +0 -53
- package/.claude/agents/generated/code-reviewer.md +0 -55
- package/.claude/agents/generated/code-validator.md +0 -57
- package/.claude/agents/generated/complexity-scanner.md +0 -56
- package/.claude/agents/generated/content-seo-strategist.md +0 -90
- package/.claude/agents/generated/copy-editor.md +0 -45
- package/.claude/agents/generated/court-reporter.md +0 -50
- package/.claude/agents/generated/defender.md +0 -51
- package/.claude/agents/generated/devbot-orchestrator.md +0 -58
- package/.claude/agents/generated/devbot-planner.md +0 -63
- package/.claude/agents/generated/developer-community-strategist.md +0 -91
- package/.claude/agents/generated/editor-in-chief.md +0 -45
- package/.claude/agents/generated/fact-checker.md +0 -45
- package/.claude/agents/generated/impact-assessor.md +0 -54
- package/.claude/agents/generated/judge.md +0 -51
- package/.claude/agents/generated/outreach-partnership-strategist.md +0 -90
- package/.claude/agents/generated/prosecutor.md +0 -51
- package/.claude/agents/generated/reporter.md +0 -45
- package/.claude/agents/generated/social-media-strategist.md +0 -91
- package/.claude/agents/generated/video-visual-strategist.md +0 -90
- package/.claude/agents/reengineer-squad/boss.md +0 -113
- package/.claude/agents/reengineer-squad/critic-architect.md +0 -132
- package/.claude/agents/reengineer-squad/git-manager.md +0 -145
- package/.claude/agents/reengineer-squad/idea-generator.md +0 -95
- package/.claude/agents/reengineer-squad/implementer.md +0 -112
- package/.claude/agents/reengineer-squad/integration-planner.md +0 -112
- package/.claude/agents/reengineer-squad/source-analyst.md +0 -103
- package/.claude/agents/reengineer-squad/target-analyst.md +0 -118
- package/.claude/agents/reengineer-squad/tester.md +0 -105
- package/.claude/agents/sparc/architecture.md +0 -453
- package/.claude/agents/sparc/pseudocode.md +0 -299
- package/.claude/agents/sparc/refinement.md +0 -504
- package/.claude/agents/sparc/specification.md +0 -258
- package/.claude/agents/templates/implementer-sparc-coder.md +0 -231
- package/.claude/commands/sparc/analyzer.md +0 -35
- package/.claude/commands/sparc/architect.md +0 -36
- package/.claude/commands/sparc/ask.md +0 -56
- package/.claude/commands/sparc/batch-executor.md +0 -37
- package/.claude/commands/sparc/code.md +0 -48
- package/.claude/commands/sparc/coder.md +0 -37
- package/.claude/commands/sparc/debug.md +0 -42
- package/.claude/commands/sparc/debugger.md +0 -37
- package/.claude/commands/sparc/designer.md +0 -36
- package/.claude/commands/sparc/devops.md +0 -68
- package/.claude/commands/sparc/docs-writer.md +0 -39
- package/.claude/commands/sparc/documenter.md +0 -37
- package/.claude/commands/sparc/innovator.md +0 -37
- package/.claude/commands/sparc/integration.md +0 -42
- package/.claude/commands/sparc/mcp.md +0 -76
- package/.claude/commands/sparc/memory-manager.md +0 -57
- package/.claude/commands/sparc/optimizer.md +0 -37
- package/.claude/commands/sparc/orchestrator.md +0 -70
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -42
- package/.claude/commands/sparc/refinement-optimization-mode.md +0 -42
- package/.claude/commands/sparc/researcher.md +0 -37
- package/.claude/commands/sparc/reviewer.md +0 -37
- package/.claude/commands/sparc/security-review.md +0 -39
- package/.claude/commands/sparc/sparc-modes.md +0 -120
- package/.claude/commands/sparc/sparc.md +0 -71
- package/.claude/commands/sparc/spec-pseudocode.md +0 -39
- package/.claude/commands/sparc/supabase-admin.md +0 -301
- package/.claude/commands/sparc/swarm-coordinator.md +0 -50
- package/.claude/commands/sparc/tdd.md +0 -37
- package/.claude/commands/sparc/tester.md +0 -37
- package/.claude/commands/sparc/tutorial.md +0 -38
- package/.claude/commands/sparc/workflow-manager.md +0 -37
- package/.claude/commands/sparc.md +0 -112
- package/.claude/helpers/auto-memory-hook.mjs +0 -503
- package/.claude/skills/sparc-methodology/SKILL.md +0 -950
- package/dist/src/capabilities/enrichment.d.ts +0 -44
- package/dist/src/capabilities/enrichment.d.ts.map +0 -1
- package/dist/src/capabilities/enrichment.js +0 -141
- package/dist/src/capabilities/enrichment.js.map +0 -1
- package/dist/src/commands/analyze-boundaries.d.ts +0 -14
- package/dist/src/commands/analyze-boundaries.d.ts.map +0 -1
- package/dist/src/commands/analyze-boundaries.js +0 -295
- package/dist/src/commands/analyze-boundaries.js.map +0 -1
- package/dist/src/commands/analyze-graph.d.ts +0 -14
- package/dist/src/commands/analyze-graph.d.ts.map +0 -1
- package/dist/src/commands/analyze-graph.js +0 -304
- package/dist/src/commands/analyze-graph.js.map +0 -1
- package/dist/src/commands/claims.d.ts +0 -10
- package/dist/src/commands/claims.d.ts.map +0 -1
- package/dist/src/commands/claims.js +0 -650
- package/dist/src/commands/claims.js.map +0 -1
- package/dist/src/commands/daemon.d.ts +0 -8
- package/dist/src/commands/daemon.d.ts.map +0 -1
- package/dist/src/commands/daemon.js +0 -681
- package/dist/src/commands/daemon.js.map +0 -1
- package/dist/src/commands/deployment.d.ts +0 -10
- package/dist/src/commands/deployment.d.ts.map +0 -1
- package/dist/src/commands/deployment.js +0 -706
- package/dist/src/commands/deployment.js.map +0 -1
- package/dist/src/commands/enrich.d.ts +0 -10
- package/dist/src/commands/enrich.d.ts.map +0 -1
- package/dist/src/commands/enrich.js +0 -58
- package/dist/src/commands/enrich.js.map +0 -1
- package/dist/src/commands/issues.d.ts +0 -21
- package/dist/src/commands/issues.d.ts.map +0 -1
- package/dist/src/commands/issues.js +0 -575
- package/dist/src/commands/issues.js.map +0 -1
- package/dist/src/commands/workflow.d.ts +0 -8
- package/dist/src/commands/workflow.d.ts.map +0 -1
- package/dist/src/commands/workflow.js +0 -677
- package/dist/src/commands/workflow.js.map +0 -1
- package/dist/src/mcp-tools/workflow-tools.d.ts +0 -8
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/workflow-tools.js +0 -717
- package/dist/src/mcp-tools/workflow-tools.js.map +0 -1
- package/dist/src/services/claim-service.d.ts +0 -198
- package/dist/src/services/claim-service.d.ts.map +0 -1
- package/dist/src/services/claim-service.js +0 -890
- package/dist/src/services/claim-service.js.map +0 -1
- package/dist/src/services/headless-worker-executor.d.ts +0 -311
- package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
- package/dist/src/services/headless-worker-executor.js +0 -1183
- package/dist/src/services/headless-worker-executor.js.map +0 -1
- package/dist/src/services/worker-daemon.d.ts +0 -248
- package/dist/src/services/worker-daemon.d.ts.map +0 -1
- package/dist/src/services/worker-daemon.js +0 -1417
- package/dist/src/services/worker-daemon.js.map +0 -1
- package/dist/src/ui/.monomind/capture/active-run.json +0 -1
- package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/real-events-1782290897.convs.jsonl +0 -3
- package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/real-events-1782290897.jsonl +0 -11
- package/dist/src/ui/.monomind/orgs/system-trial-qa/runs/rigid-qa-restart-1782288201.jsonl +0 -540
- package/dist/src/ui/.monomind/orgs/system-trial-qa-threads.jsonl +0 -3
- package/dist/src/ui/.monomind/orgs/test-event-fix/runs/rigid-qa-restart-1782288201.jsonl +0 -2
|
@@ -18,117 +18,16 @@ module.exports = {
|
|
|
18
18
|
try { session.metric('tasks'); } catch (e) { /* no active session */ }
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
console.log('[OK] Task started');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// AutoMem Phase 1: PLAN routine — consult memory before acting (arXiv:2607.01224)
|
|
35
|
-
if (prompt && typeof prompt === 'string' && prompt.length > 20) {
|
|
36
|
-
try {
|
|
37
|
-
var intelligence = hCtx.intelligence;
|
|
38
|
-
if (intelligence && intelligence.findSimilarPatterns) {
|
|
39
|
-
var memPatterns = await Promise.resolve(intelligence.findSimilarPatterns(prompt, { k: 3, type: 'memory-proficiency' }));
|
|
40
|
-
if (memPatterns && memPatterns.length > 0) {
|
|
41
|
-
console.log('[AUTOMEM_PLAN] Recalled ' + memPatterns.length + ' memory pattern(s): ' + memPatterns.map(function(p) { return p.content.substring(0, 80); }).join(' | '));
|
|
42
|
-
}
|
|
43
|
-
// Also check general patterns for task-relevant memory
|
|
44
|
-
var taskPatterns = await Promise.resolve(intelligence.findSimilarPatterns(prompt, { k: 2 }));
|
|
45
|
-
if (taskPatterns && taskPatterns.length > 0) {
|
|
46
|
-
console.log('[AUTOMEM_CONTEXT] ' + taskPatterns.length + ' relevant pattern(s) from prior sessions');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
} catch (e) { /* non-fatal — PLAN is advisory */ }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Task 24: PromptVersioning — resolve prompt variant before agent spawn
|
|
53
|
-
try {
|
|
54
|
-
var memMod = await import('@monomind/memory');
|
|
55
|
-
if (memMod && memMod.PromptVersionStore) {
|
|
56
|
-
var pvStore = new memMod.PromptVersionStore(path.join(CWD, '.monomind', 'prompt-versions'));
|
|
57
|
-
var pvMod = await import('file://' + path.join(CWD, 'packages/@monomind/cli/dist/src/agents/prompt-experiment.js'));
|
|
58
|
-
if (pvMod && pvMod.PromptExperimentRouter) {
|
|
59
|
-
var pvRouter = new pvMod.PromptExperimentRouter(pvStore);
|
|
60
|
-
var agentSlug24 = hookInput.agentSlug || hookInput.agentType || hookInput.agent_type || 'unknown';
|
|
61
|
-
if (agentSlug24 !== 'unknown') {
|
|
62
|
-
var resolved = pvRouter.resolvePromptForSpawn(agentSlug24);
|
|
63
|
-
if (resolved.version) {
|
|
64
|
-
console.log('[PROMPT_VERSION] ' + agentSlug24 + ' v' + resolved.version + (resolved.isCandidate ? ' (experiment candidate)' : ''));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} catch (e) { /* not available or no experiment */ }
|
|
70
|
-
|
|
71
|
-
// Monograph impact — detect changed files and surface their dependents
|
|
72
|
-
try {
|
|
73
|
-
var mgDbPath1 = path.join(CWD, '.monomind', 'monograph.db');
|
|
74
|
-
if (fs.existsSync(mgDbPath1)) {
|
|
75
|
-
var changedFiles1 = await new Promise(function(resolve) {
|
|
76
|
-
require('child_process').exec(
|
|
77
|
-
'git diff --name-only HEAD 2>/dev/null || git diff --name-only 2>/dev/null',
|
|
78
|
-
{ cwd: CWD, timeout: 3000 },
|
|
79
|
-
function(err, stdout) { resolve(err ? '' : (stdout || '').trim()); }
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
if (changedFiles1) {
|
|
83
|
-
var mgMod1 = null;
|
|
84
|
-
mgMod1 = hCtx._requireMonograph();
|
|
85
|
-
if (mgMod1 && mgMod1.openDb) {
|
|
86
|
-
var db1 = mgMod1.openDb(mgDbPath1);
|
|
87
|
-
try {
|
|
88
|
-
var fileList1 = changedFiles1.split('\n').filter(Boolean).slice(0, 8);
|
|
89
|
-
var impacted1 = [];
|
|
90
|
-
for (var fi = 0; fi < fileList1.length; fi++) {
|
|
91
|
-
var fBase = path.basename(fileList1[fi]);
|
|
92
|
-
var fNode = db1.prepare("SELECT id, name, label FROM nodes WHERE file_path LIKE ? LIMIT 1").get('%' + fBase);
|
|
93
|
-
if (fNode) {
|
|
94
|
-
var fImporters = db1.prepare(
|
|
95
|
-
'SELECT n2.name FROM edges e JOIN nodes n2 ON n2.id = e.source_id WHERE e.target_id = ? LIMIT 5'
|
|
96
|
-
).all(fNode.id);
|
|
97
|
-
var entry = fNode.name + ' (' + fNode.label + ')';
|
|
98
|
-
if (fImporters.length) entry += ' ← ' + fImporters.map(function(i){ return i.name; }).join(', ');
|
|
99
|
-
impacted1.push(entry);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (impacted1.length > 0) {
|
|
103
|
-
console.log('[MONOGRAPH_IMPACT] Changed files and their dependents: ' + impacted1.join(' | '));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Effective blast radius — second pass using first impacted node
|
|
107
|
-
try {
|
|
108
|
-
if (fileList1.length > 0 && mgMod1.effectiveBlastRadius) {
|
|
109
|
-
var firstFile1 = path.basename(fileList1[0]);
|
|
110
|
-
var firstNode1 = db1.prepare("SELECT id, name, label FROM nodes WHERE file_path LIKE ? LIMIT 1").get('%' + firstFile1);
|
|
111
|
-
if (firstNode1) {
|
|
112
|
-
var blastResults1 = mgMod1.effectiveBlastRadius(db1, firstNode1.id, { maxDepth: 4 });
|
|
113
|
-
if (blastResults1 && blastResults1.length > 0) {
|
|
114
|
-
var bwdCount1 = blastResults1.filter(function(r){ return r.direction === 'backward' || r.direction === 'both'; }).length;
|
|
115
|
-
var fwdCount1 = blastResults1.filter(function(r){ return r.direction === 'forward' || r.direction === 'both'; }).length;
|
|
116
|
-
var topBlast1 = blastResults1.slice(0, 8).map(function(r){
|
|
117
|
-
return '[' + r.direction + ':' + r.hops + '] ' + r.nodeName + ' (' + r.nodeLabel + ')';
|
|
118
|
-
});
|
|
119
|
-
console.log('[MONOGRAPH_BLAST_RADIUS] Node: ' + firstNode1.name + ' | forward=' + fwdCount1 + ' backward=' + bwdCount1 + ' | ' + topBlast1.join(', '));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
} catch(blastErr) { /* non-fatal */ }
|
|
124
|
-
} finally { if (mgMod1.closeDb) mgMod1.closeDb(db1); }
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
} catch(e) { /* non-fatal */ }
|
|
129
|
-
|
|
130
|
-
// Bridge to @monomind/hooks registry — fires Tasks 26 (PromptAssembler) and any other PreTask hooks
|
|
131
|
-
var _hooksModule = hCtx._hooksModule;
|
|
21
|
+
// monolean: removed per-subagent redundancies:
|
|
22
|
+
// - Re-routing (already done by route handler on parent prompt)
|
|
23
|
+
// - AUTOMEM pattern recall (marginal value, 2 similarity searches per spawn)
|
|
24
|
+
// - PromptVersioning experiments (unused feature)
|
|
25
|
+
// - Monograph blast radius (already shown by post-edit hook on actual changes)
|
|
26
|
+
|
|
27
|
+
// Bridge to @monomind/hooks registry — fires Tasks 26 (PromptAssembler) and any other PreTask hooks.
|
|
28
|
+
// Each hook event runs in a fresh process, so hCtx._hooksModule set by session-restore in an
|
|
29
|
+
// earlier invocation is never visible here — must (re)load lazily via _ensureHooksModule().
|
|
30
|
+
var _hooksModule = hCtx._hooksModule || (hCtx._ensureHooksModule ? await hCtx._ensureHooksModule() : null);
|
|
132
31
|
if (_hooksModule && _hooksModule.executeHooks && _hooksModule.HookEvent) {
|
|
133
32
|
try {
|
|
134
33
|
await _hooksModule.executeHooks(_hooksModule.HookEvent.PreTask, {
|
|
@@ -148,7 +47,7 @@ module.exports = {
|
|
|
148
47
|
var taskSuccess = hookInput.success !== false && hookInput.status !== 'failed';
|
|
149
48
|
if (intelligence && intelligence.feedback) {
|
|
150
49
|
try {
|
|
151
|
-
intelligence.feedback(
|
|
50
|
+
intelligence.feedback(taskSuccess);
|
|
152
51
|
} catch (e) { /* non-fatal */ }
|
|
153
52
|
}
|
|
154
53
|
// Each TeammateIdle/TaskCompleted = one agent done → remove oldest registration (FIFO)
|
|
@@ -184,8 +83,10 @@ module.exports = {
|
|
|
184
83
|
}
|
|
185
84
|
} catch (e) { /* non-fatal */ }
|
|
186
85
|
|
|
187
|
-
// Bridge to @monomind/hooks registry — fires Tasks 39 (SpecializationScorer) and any other PostTask hooks
|
|
188
|
-
|
|
86
|
+
// Bridge to @monomind/hooks registry — fires Tasks 39 (SpecializationScorer) and any other PostTask hooks.
|
|
87
|
+
// Each hook event runs in a fresh process, so hCtx._hooksModule set by session-restore in an
|
|
88
|
+
// earlier invocation is never visible here — must (re)load lazily via _ensureHooksModule().
|
|
89
|
+
var _hooksModule = hCtx._hooksModule || (hCtx._ensureHooksModule ? await hCtx._ensureHooksModule() : null);
|
|
189
90
|
if (_hooksModule && _hooksModule.executeHooks && _hooksModule.HookEvent) {
|
|
190
91
|
try {
|
|
191
92
|
await _hooksModule.executeHooks(_hooksModule.HookEvent.PostTask, {
|
|
@@ -244,7 +145,8 @@ module.exports = {
|
|
|
244
145
|
}
|
|
245
146
|
} catch (e) { /* non-fatal */ }
|
|
246
147
|
|
|
247
|
-
//
|
|
148
|
+
// Record whether this task's outcome matched a recalled memory pattern,
|
|
149
|
+
// so future pattern recall can be scored for usefulness.
|
|
248
150
|
try {
|
|
249
151
|
var intelligence = hCtx.intelligence;
|
|
250
152
|
if (intelligence && intelligence.recordMemoryDecision) {
|
|
@@ -259,51 +161,6 @@ module.exports = {
|
|
|
259
161
|
}
|
|
260
162
|
} catch (e) { /* non-fatal — LOG is advisory */ }
|
|
261
163
|
|
|
262
|
-
// ── Worker Auto-Dispatch ──────────────────────────────────────────────
|
|
263
|
-
// Auto-dispatch background workers based on task outcome
|
|
264
|
-
try {
|
|
265
|
-
var taskDesc = (typeof prompt === 'string' ? prompt : hookInput.description || '').toLowerCase();
|
|
266
|
-
var workersToDispatch = [];
|
|
267
|
-
|
|
268
|
-
// Always consolidate memory after any task
|
|
269
|
-
workersToDispatch.push('consolidate');
|
|
270
|
-
|
|
271
|
-
// Security-related task → dispatch audit worker
|
|
272
|
-
if (/\b(security|auth|vuln|cve|threat|token|permission|crypto)\b/.test(taskDesc)) {
|
|
273
|
-
workersToDispatch.push('audit');
|
|
274
|
-
}
|
|
275
|
-
// Performance-related → dispatch benchmark worker
|
|
276
|
-
if (/\b(performance|optimiz|benchmark|latency|throughput)\b/.test(taskDesc)) {
|
|
277
|
-
workersToDispatch.push('benchmark');
|
|
278
|
-
}
|
|
279
|
-
// Code changes → dispatch testgaps worker
|
|
280
|
-
if (/\b(implement|feature|refactor|fix|build|add|create|modify)\b/.test(taskDesc)) {
|
|
281
|
-
workersToDispatch.push('testgaps');
|
|
282
|
-
}
|
|
283
|
-
// Any significant task → dispatch map worker for codebase indexing
|
|
284
|
-
if (taskDesc.length > 50) {
|
|
285
|
-
workersToDispatch.push('map');
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Dispatch via @monomind/hooks if available, otherwise write dispatch file
|
|
289
|
-
if (workersToDispatch.length > 0) {
|
|
290
|
-
var dispatchDir = path.join(CWD, '.monomind', 'worker-dispatch');
|
|
291
|
-
fs.mkdirSync(dispatchDir, { recursive: true });
|
|
292
|
-
var dispatchPayload = {
|
|
293
|
-
workers: workersToDispatch,
|
|
294
|
-
trigger: 'post-task',
|
|
295
|
-
taskDesc: taskDesc.substring(0, 100),
|
|
296
|
-
success: taskSuccess,
|
|
297
|
-
timestamp: new Date().toISOString(),
|
|
298
|
-
};
|
|
299
|
-
fs.writeFileSync(
|
|
300
|
-
path.join(dispatchDir, 'pending-' + Date.now() + '-' + Math.random().toString(36).slice(2, 7) + '.json'),
|
|
301
|
-
JSON.stringify(dispatchPayload), 'utf-8'
|
|
302
|
-
);
|
|
303
|
-
console.log('[WORKER_DISPATCH] Queued: ' + workersToDispatch.join(', '));
|
|
304
|
-
}
|
|
305
|
-
} catch (e) { /* non-fatal */ }
|
|
306
|
-
|
|
307
164
|
// ── ADR Auto-Generation ────────────────────────────────────────────────
|
|
308
165
|
// When adr.autoGenerate is true and task involved architect-level work,
|
|
309
166
|
// create an ADR stub in the configured directory
|
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Monomind Hook Handler (Cross-Platform)
|
|
4
4
|
* Dispatches hook events to the appropriate helper modules.
|
|
5
|
+
*
|
|
6
|
+
* ARCHITECTURE NOTE — Two Hook Systems
|
|
7
|
+
* =====================================
|
|
8
|
+
* There are two independent hook systems in this project:
|
|
9
|
+
*
|
|
10
|
+
* 1. .claude/helpers/ CJS handlers (THIS FILE and ./handlers/*.cjs)
|
|
11
|
+
* These are the handlers that actually run via settings.json hook
|
|
12
|
+
* configuration. They are plain CommonJS scripts invoked directly
|
|
13
|
+
* by Claude Code's hook runtime. This is the "live" system.
|
|
14
|
+
*
|
|
15
|
+
* 2. @monomind/hooks TypeScript package (packages/@monomind/hooks/)
|
|
16
|
+
* A full TypeScript package with workers, learning services, and
|
|
17
|
+
* a WorkerManager. It compiles to dist/ but is only loaded
|
|
18
|
+
* optionally, bridged at six lifecycle events: SessionStart (restore),
|
|
19
|
+
* PreTask, PostTask, PostEdit, SessionEnd, and AgentSpawn (agent-start).
|
|
20
|
+
* The CJS handlers in system (1) are the authoritative dispatch path;
|
|
21
|
+
* system (2) provides optional enrichment when the package is
|
|
22
|
+
* installed and built.
|
|
23
|
+
*
|
|
24
|
+
* IMPORTANT: each hook event is dispatched as its OWN fresh `node`
|
|
25
|
+
* process (Claude Code spawns one invocation per event — this file
|
|
26
|
+
* does not stay resident across events). So the @monomind/hooks
|
|
27
|
+
* module, and anything it registers (trace collector spans, episode
|
|
28
|
+
* binner, etc.), cannot be set up once and reused across events —
|
|
29
|
+
* every bridging handler must call hCtx._ensureHooksModule() itself,
|
|
30
|
+
* which lazily imports the package AND calls initDefaultWorkers() in
|
|
31
|
+
* that process before firing executeHooks(). Cross-event state (e.g.
|
|
32
|
+
* correlating a PreTask span to its matching PostTask) is NOT
|
|
33
|
+
* possible via in-memory maps for this reason; only handlers/hooks
|
|
34
|
+
* that persist state to disk (like the daemon workers under
|
|
35
|
+
* .monomind/metrics/) can meaningfully bridge across separate events.
|
|
5
36
|
*/
|
|
6
37
|
|
|
7
38
|
const path = require('path');
|
|
@@ -70,9 +101,43 @@ const session = safeRequire(path.join(helpersDir, 'session.cjs'));
|
|
|
70
101
|
const memory = safeRequire(path.join(helpersDir, 'memory.cjs'));
|
|
71
102
|
const intelligence = safeRequire(path.join(helpersDir, 'intelligence.cjs'));
|
|
72
103
|
|
|
73
|
-
// Module-level reference to @monomind/hooks — populated
|
|
74
|
-
//
|
|
104
|
+
// Module-level reference to @monomind/hooks — populated lazily via
|
|
105
|
+
// _ensureHooksModule(). NOTE: hook-handler.cjs runs as a fresh `node` process
|
|
106
|
+
// per hook event (Claude Code spawns one invocation per event, it does not
|
|
107
|
+
// keep the process alive across events), so a value set during one event
|
|
108
|
+
// (e.g. session-restore) is NOT visible to a later event's process (e.g.
|
|
109
|
+
// pre-task). Each handler that needs the bridge MUST call
|
|
110
|
+
// hCtx._ensureHooksModule() itself rather than reading hCtx._hooksModule
|
|
111
|
+
// directly, or the bridge silently no-ops.
|
|
75
112
|
let _hooksModule = null;
|
|
113
|
+
let _hooksModuleLoadAttempted = false;
|
|
114
|
+
async function _ensureHooksModule() {
|
|
115
|
+
if (_hooksModule) return _hooksModule;
|
|
116
|
+
if (_hooksModuleLoadAttempted) return null; // already tried+failed this process
|
|
117
|
+
_hooksModuleLoadAttempted = true;
|
|
118
|
+
// 1) Bare specifier — works when @monomind/hooks is installed/linked in a
|
|
119
|
+
// node_modules reachable from this file (e.g. an end-user install).
|
|
120
|
+
try {
|
|
121
|
+
_hooksModule = await import('@monomind/hooks');
|
|
122
|
+
} catch (e) {
|
|
123
|
+
_hooksModule = null;
|
|
124
|
+
}
|
|
125
|
+
// 2) Dev-repo fallback — in the monorepo the pnpm workspace link lives under
|
|
126
|
+
// packages/@monomind/cli/node_modules, NOT at the repo root, so the bare
|
|
127
|
+
// specifier never resolves from .claude/helpers. Import the compiled dist
|
|
128
|
+
// entry directly by path (same pattern as session-restore-handler.cjs).
|
|
129
|
+
if (!_hooksModule) {
|
|
130
|
+
try {
|
|
131
|
+
const _distIndex = path.join(CWD, 'packages', '@monomind', 'hooks', 'dist', 'index.js');
|
|
132
|
+
if (fs.existsSync(_distIndex)) {
|
|
133
|
+
_hooksModule = await import('file://' + _distIndex);
|
|
134
|
+
}
|
|
135
|
+
} catch (e) {
|
|
136
|
+
_hooksModule = null; // not built — bridge stays a fail-soft no-op
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return _hooksModule;
|
|
140
|
+
}
|
|
76
141
|
|
|
77
142
|
// ── Intelligence timeout protection (fixes #1530, #1531) ───────────────────
|
|
78
143
|
var INTELLIGENCE_TIMEOUT_MS = 1500;
|
|
@@ -194,9 +259,11 @@ var hCtx = {
|
|
|
194
259
|
intelligence: intelligence,
|
|
195
260
|
getLearningService: getLearningService,
|
|
196
261
|
isSimpleCommand: isSimpleCommand,
|
|
197
|
-
// Module-level singleton (populated by session-restore handler
|
|
262
|
+
// Module-level singleton (populated by session-restore handler, or lazily
|
|
263
|
+
// via _ensureHooksModule() — required since each hook event is a fresh process).
|
|
198
264
|
get _hooksModule() { return _hooksModule; },
|
|
199
265
|
set _hooksModule(v) { _hooksModule = v; },
|
|
266
|
+
_ensureHooksModule: _ensureHooksModule,
|
|
200
267
|
// Utility functions
|
|
201
268
|
_recordRecentEdit: _recordRecentEdit,
|
|
202
269
|
_getRecentEdits: _getRecentEdits,
|
|
@@ -274,9 +341,9 @@ const handlers = {
|
|
|
274
341
|
await h.handle(hCtx, 'auto');
|
|
275
342
|
},
|
|
276
343
|
|
|
277
|
-
'agent-start': () => {
|
|
344
|
+
'agent-start': async () => {
|
|
278
345
|
const h = require('./handlers/agent-start-handler.cjs');
|
|
279
|
-
h.handle(hCtx);
|
|
346
|
+
await h.handle(hCtx);
|
|
280
347
|
},
|
|
281
348
|
|
|
282
349
|
'adr-draft': () => {
|
|
@@ -435,6 +502,44 @@ const handlers = {
|
|
|
435
502
|
}
|
|
436
503
|
}
|
|
437
504
|
}
|
|
505
|
+
|
|
506
|
+
// --- Strategy 9: alternation patterns (TODO\|FIXME, mock\|fake\|stub) ---
|
|
507
|
+
if (!graphAssisted && pattern.indexOf('|') !== -1) {
|
|
508
|
+
var altParts = pattern.split(/\\?\|/).map(function(p) {
|
|
509
|
+
return p.replace(/[^a-zA-Z0-9_$]/g, '');
|
|
510
|
+
}).filter(function(p) {
|
|
511
|
+
return p.length >= 4 && /^[a-zA-Z_$]/.test(p) && !_grepStop[p.toLowerCase()];
|
|
512
|
+
});
|
|
513
|
+
for (var ai = 0; ai < altParts.length && !graphAssisted; ai++) {
|
|
514
|
+
var arow = db.prepare(
|
|
515
|
+
'SELECT n.name, n.file_path, n.start_line FROM nodes n WHERE n.name = ? COLLATE NOCASE AND n.label NOT IN (\'Concept\',\'Community\',\'Folder\') AND n.file_path IS NOT NULL AND n.file_path NOT LIKE \'%.md\' LIMIT 1'
|
|
516
|
+
).get(altParts[ai]);
|
|
517
|
+
if (arow) {
|
|
518
|
+
graphAssisted = true;
|
|
519
|
+
var ahint = arow.file_path + (arow.start_line != null ? ':' + arow.start_line : '');
|
|
520
|
+
console.log('[MONOGRAPH_HINT] ' + arow.name + ' → ' + ahint);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
// --- Strategy 10: grep targeting a known source directory ---
|
|
528
|
+
// Runs outside `if (pattern)` so it works even when pattern extraction fails
|
|
529
|
+
if (!graphAssisted) {
|
|
530
|
+
var db10 = _openMonographDb();
|
|
531
|
+
if (db10) {
|
|
532
|
+
var dirMatch10 = cmdAfterTool.match(/\b(src|packages(?:\/[a-zA-Z0-9_@/-]*)?)\//);
|
|
533
|
+
if (dirMatch10) {
|
|
534
|
+
var dirPath10 = dirMatch10[1].replace(/\/$/, '');
|
|
535
|
+
var drow10 = db10.prepare(
|
|
536
|
+
'SELECT COUNT(*) AS c FROM nodes WHERE label = \'File\' AND file_path LIKE ? LIMIT 1'
|
|
537
|
+
).get('%' + dirPath10 + '/%');
|
|
538
|
+
if (drow10 && drow10.c > 0) {
|
|
539
|
+
graphAssisted = true;
|
|
540
|
+
console.log('[MONOGRAPH_HINT] grep scope ' + dirPath10 + ' has ' + drow10.c + ' indexed files');
|
|
541
|
+
}
|
|
542
|
+
}
|
|
438
543
|
}
|
|
439
544
|
}
|
|
440
545
|
} else {
|
|
@@ -452,6 +557,38 @@ const handlers = {
|
|
|
452
557
|
}
|
|
453
558
|
}
|
|
454
559
|
}
|
|
560
|
+
// find -name "*worker*" — extract core word from wildcard patterns
|
|
561
|
+
if (!graphAssisted) {
|
|
562
|
+
var wm = cmd.match(/-name\s+["'][*]?([a-zA-Z][a-zA-Z0-9_-]{3,})[*]?(?:\.[a-z]+)?["']/);
|
|
563
|
+
if (wm && wm[1]) {
|
|
564
|
+
var db = _openMonographDb();
|
|
565
|
+
if (db) {
|
|
566
|
+
var wrow = db.prepare(
|
|
567
|
+
'SELECT n.name, n.file_path FROM nodes n WHERE n.name LIKE ? AND n.label = \'File\' AND n.file_path NOT LIKE \'%.md\' LIMIT 1'
|
|
568
|
+
).get('%' + wm[1] + '%');
|
|
569
|
+
if (wrow) {
|
|
570
|
+
graphAssisted = true;
|
|
571
|
+
console.log('[MONOGRAPH_HINT] file *' + wm[1] + '* → ' + wrow.file_path);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
// find with -type f in a known directory scope
|
|
577
|
+
if (!graphAssisted) {
|
|
578
|
+
var fdm = cmd.match(/\bfind\s+(\S*(?:src|packages|lib|app)[a-zA-Z0-9_@/-]*)/);
|
|
579
|
+
if (fdm && fdm[1]) {
|
|
580
|
+
var db = _openMonographDb();
|
|
581
|
+
if (db) {
|
|
582
|
+
var fdrow = db.prepare(
|
|
583
|
+
'SELECT COUNT(*) AS c FROM nodes WHERE label = \'File\' AND file_path LIKE ? LIMIT 1'
|
|
584
|
+
).get(fdm[1].replace(/\/$/, '') + '/%');
|
|
585
|
+
if (fdrow && fdrow.c > 0) {
|
|
586
|
+
graphAssisted = true;
|
|
587
|
+
console.log('[MONOGRAPH_HINT] find scope ' + fdm[1] + ' has ' + fdrow.c + ' indexed files');
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
455
592
|
}
|
|
456
593
|
} catch (e) { /* non-fatal */ }
|
|
457
594
|
}
|
|
@@ -647,10 +784,6 @@ const handlers = {
|
|
|
647
784
|
h.handle(hCtx);
|
|
648
785
|
},
|
|
649
786
|
|
|
650
|
-
'status': () => {
|
|
651
|
-
console.log('[OK] Status check');
|
|
652
|
-
},
|
|
653
|
-
|
|
654
787
|
'stats': async () => {
|
|
655
788
|
const h = require('./handlers/stats-handler.cjs');
|
|
656
789
|
await h.handle(hCtx);
|
|
@@ -669,13 +802,17 @@ if (command && handlers[command]) {
|
|
|
669
802
|
} else if (command) {
|
|
670
803
|
console.log('[OK] Hook: ' + command);
|
|
671
804
|
} else {
|
|
672
|
-
console.log('Usage: hook-handler.cjs <route|pre-bash|pre-search|post-edit|post-
|
|
805
|
+
console.log('Usage: hook-handler.cjs <route|pre-bash|pre-search|post-edit|post-graph-tool|session-restore|session-end|pre-task|post-task|compact-manual|compact-auto|stats>');
|
|
673
806
|
}
|
|
674
807
|
}
|
|
675
808
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
})
|
|
809
|
+
// Only run when executed directly (every real hook event spawns this file as a
|
|
810
|
+
// process). A require() — e.g. from tests verifying it loads — must not exit.
|
|
811
|
+
if (require.main === module) {
|
|
812
|
+
main().catch(function(e) {
|
|
813
|
+
console.log('[WARN] Hook handler error: ' + e.message);
|
|
814
|
+
}).finally(function() {
|
|
815
|
+
// Use process.exitCode if a gate set it (exit 2 = block), otherwise clean exit
|
|
816
|
+
process.exit(process.exitCode || 0);
|
|
817
|
+
});
|
|
818
|
+
}
|