@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
|
@@ -22,12 +22,14 @@ const STORE_FILE = path.join(DATA_DIR, 'auto-memory-store.json');
|
|
|
22
22
|
const RANKED_FILE = path.join(DATA_DIR, 'ranked-context.json');
|
|
23
23
|
const PENDING_FILE = path.join(DATA_DIR, 'pending-insights.jsonl');
|
|
24
24
|
const OUTCOMES_FILE = path.join(DATA_DIR, 'intelligence-outcomes.jsonl');
|
|
25
|
+
const RECENT_EDITS_FILE = path.join(DATA_DIR, 'recent-edits.jsonl');
|
|
25
26
|
|
|
26
27
|
const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MiB guard
|
|
27
28
|
const RING_BUFFER_MAX = 50;
|
|
28
29
|
|
|
29
30
|
var _entries = []; // deduplicated memory entries loaded from store
|
|
30
|
-
var _recentEdits = []; // ring buffer of recently edited paths
|
|
31
|
+
var _recentEdits = []; // ring buffer of recently edited paths (in-memory, may be empty across subprocesses)
|
|
32
|
+
var _lastContext = null; // last non-null context returned by getContext()
|
|
31
33
|
|
|
32
34
|
function ensureDataDir() {
|
|
33
35
|
try { fs.mkdirSync(DATA_DIR, { recursive: true }); } catch (_) {}
|
|
@@ -70,6 +72,8 @@ function init() {
|
|
|
70
72
|
return true;
|
|
71
73
|
});
|
|
72
74
|
|
|
75
|
+
// Bootstrap from monograph when store is sparse — called externally via bootstrapFromDb(db)
|
|
76
|
+
|
|
73
77
|
// Write ranked-context.json (sorted by confidence desc) with version envelope
|
|
74
78
|
var ranked = _entries.slice().sort(function(a, b) {
|
|
75
79
|
return (b.confidence || 0) - (a.confidence || 0);
|
|
@@ -87,28 +91,50 @@ function getContext(prompt) {
|
|
|
87
91
|
if (!prompt || typeof prompt !== 'string' || prompt.trim() === '') return null;
|
|
88
92
|
if (_entries.length === 0) return null;
|
|
89
93
|
|
|
90
|
-
var promptWords = prompt.toLowerCase().split(/\W+/).filter(
|
|
94
|
+
var promptWords = prompt.toLowerCase().split(/\W+/).filter(function(w) { return w.length >= 3; });
|
|
91
95
|
var promptSet = new Set(promptWords);
|
|
96
|
+
if (promptSet.size < 2) return null; // need at least 2 meaningful words
|
|
92
97
|
|
|
93
|
-
var
|
|
98
|
+
var scored = [];
|
|
99
|
+
for (var i = 0; i < _entries.length; i++) {
|
|
100
|
+
var e = _entries[i];
|
|
94
101
|
var content = ((e.content || '') + ' ' + (e.summary || '')).toLowerCase();
|
|
95
|
-
var words = content.split(/\W+/).filter(
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
var words = content.split(/\W+/).filter(function(w) { return w.length >= 3; });
|
|
103
|
+
var hits = 0;
|
|
104
|
+
for (var j = 0; j < words.length; j++) {
|
|
105
|
+
if (promptSet.has(words[j])) hits++;
|
|
106
|
+
}
|
|
107
|
+
// Require at least 2 distinct word matches to reduce false positives
|
|
108
|
+
if (hits >= 2) {
|
|
109
|
+
scored.push({ entry: e, hits: hits });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
98
112
|
|
|
99
|
-
if (
|
|
113
|
+
if (scored.length === 0) return null;
|
|
100
114
|
|
|
101
|
-
|
|
102
|
-
|
|
115
|
+
// Sort by hit count descending, then by confidence
|
|
116
|
+
scored.sort(function(a, b) {
|
|
117
|
+
if (b.hits !== a.hits) return b.hits - a.hits;
|
|
118
|
+
return (b.entry.confidence || 0) - (a.entry.confidence || 0);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
var top = scored[0].entry;
|
|
122
|
+
var result = '[INTELLIGENCE] ' + (top.summary || top.content || top.id || 'context match');
|
|
123
|
+
_lastContext = result;
|
|
124
|
+
return result;
|
|
103
125
|
}
|
|
104
126
|
|
|
105
127
|
// ── recordEdit ────────────────────────────────────────────────────────────────
|
|
106
128
|
|
|
107
129
|
function recordEdit(filePath) {
|
|
108
|
-
|
|
130
|
+
var entry = { path: String(filePath || ''), ts: Date.now() };
|
|
131
|
+
_recentEdits.push(entry);
|
|
109
132
|
if (_recentEdits.length > RING_BUFFER_MAX) {
|
|
110
133
|
_recentEdits = _recentEdits.slice(-RING_BUFFER_MAX);
|
|
111
134
|
}
|
|
135
|
+
// Persist to disk so other subprocesses (e.g. feedback()) can read edits
|
|
136
|
+
ensureDataDir();
|
|
137
|
+
try { fs.appendFileSync(RECENT_EDITS_FILE, JSON.stringify(entry) + '\n', 'utf-8'); } catch (_) {}
|
|
112
138
|
}
|
|
113
139
|
|
|
114
140
|
// ── consolidate ───────────────────────────────────────────────────────────────
|
|
@@ -121,18 +147,194 @@ function consolidate() {
|
|
|
121
147
|
// Clear the pending file
|
|
122
148
|
try { fs.writeFileSync(PENDING_FILE, '', 'utf-8'); } catch (_) {}
|
|
123
149
|
|
|
124
|
-
|
|
150
|
+
// Read accumulated session edits (not yet consumed by feedback)
|
|
151
|
+
var sessionEdits = [];
|
|
152
|
+
var editLines = safeReadLines(RECENT_EDITS_FILE);
|
|
153
|
+
for (var ei = 0; ei < editLines.length; ei++) {
|
|
154
|
+
try { sessionEdits.push(JSON.parse(editLines[ei])); } catch (_) {}
|
|
155
|
+
}
|
|
156
|
+
// Clear recent-edits after consolidation (session boundary)
|
|
157
|
+
try { fs.writeFileSync(RECENT_EDITS_FILE, '', 'utf-8'); } catch (_) {}
|
|
158
|
+
|
|
159
|
+
// Load session episodes (written by session-handler.cjs into the same
|
|
160
|
+
// .monomind dir) so patterns can carry real semantic content — the user's
|
|
161
|
+
// prompt snippet and commit subjects — instead of just file basenames.
|
|
162
|
+
var episodes = [];
|
|
163
|
+
var episodeLines = safeReadLines(path.join(CWD, '.monomind', 'episodic', 'episodes.jsonl'));
|
|
164
|
+
for (var epi = 0; epi < episodeLines.length; epi++) {
|
|
165
|
+
try { episodes.push(JSON.parse(episodeLines[epi])); } catch (_) {}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Build-noise artifacts that say nothing about what the task actually was.
|
|
169
|
+
function isNoisePath(p) {
|
|
170
|
+
var base = path.basename(p);
|
|
171
|
+
if (base === 'tsconfig.tsbuildinfo' || base === 'coverage.json') return true;
|
|
172
|
+
if (/\.map$/.test(base)) return true;
|
|
173
|
+
if (/(^|\/)dist\//.test(p)) return true;
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Nearest episode whose end time is within 30 minutes of the outcome.
|
|
178
|
+
function findEpisodeNear(ts) {
|
|
179
|
+
var best = null;
|
|
180
|
+
var bestDelta = 30 * 60 * 1000;
|
|
181
|
+
for (var ki = 0; ki < episodes.length; ki++) {
|
|
182
|
+
var cand = episodes[ki];
|
|
183
|
+
var delta = Math.abs((cand.endedAt || 0) - ts);
|
|
184
|
+
if (delta <= bestDelta) { bestDelta = delta; best = cand; }
|
|
185
|
+
}
|
|
186
|
+
return best;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Synthesize successful patterns from outcomes into auto-memory-store.json
|
|
190
|
+
var outcomeLines = safeReadLines(OUTCOMES_FILE);
|
|
191
|
+
var newStoreEntries = [];
|
|
192
|
+
for (var i = 0; i < outcomeLines.length; i++) {
|
|
193
|
+
try {
|
|
194
|
+
var outcome = JSON.parse(outcomeLines[i]);
|
|
195
|
+
if (!outcome.success) continue;
|
|
196
|
+
// Use outcome's own edits if present, otherwise use session-level edits
|
|
197
|
+
var edits = (Array.isArray(outcome.recentEdits) && outcome.recentEdits.length > 0)
|
|
198
|
+
? outcome.recentEdits
|
|
199
|
+
: sessionEdits;
|
|
200
|
+
if (edits.length === 0) continue;
|
|
201
|
+
var editPaths = edits.map(function(e) {
|
|
202
|
+
// e is either { path: '...', ts: ... } or a raw string
|
|
203
|
+
if (typeof e === 'string') return e;
|
|
204
|
+
// Use e.path if it's a non-empty string; skip objects without a valid path
|
|
205
|
+
return (e && typeof e.path === 'string' && e.path.length > 0) ? e.path : null;
|
|
206
|
+
}).filter(function(p) { return p !== null; });
|
|
207
|
+
// Deduplicate paths, dropping build-noise artifacts (tsbuildinfo,
|
|
208
|
+
// sourcemaps, coverage output, dist/ bundles) so the pattern describes
|
|
209
|
+
// real source work.
|
|
210
|
+
var uniquePaths = [];
|
|
211
|
+
var pathSeen = {};
|
|
212
|
+
for (var pi = 0; pi < editPaths.length; pi++) {
|
|
213
|
+
var p = String(editPaths[pi]);
|
|
214
|
+
if (isNoisePath(p)) continue;
|
|
215
|
+
if (!pathSeen[p]) { pathSeen[p] = true; uniquePaths.push(p); }
|
|
216
|
+
}
|
|
217
|
+
if (uniquePaths.length === 0) continue;
|
|
218
|
+
var baseNames = uniquePaths.slice(0, 5).map(function(bp) { return path.basename(bp); });
|
|
219
|
+
|
|
220
|
+
// Prefer real semantic content for the summary: outcome.context (rare —
|
|
221
|
+
// only set when getContext matched in the same process), else the
|
|
222
|
+
// matching episode's prompt snippet + first commit subject.
|
|
223
|
+
var summary = outcome.context || null;
|
|
224
|
+
var hasCommits = false;
|
|
225
|
+
var ep = findEpisodeNear(outcome.ts || Date.now());
|
|
226
|
+
if (ep && ep.summary) {
|
|
227
|
+
// Episode summaries are newline-joined parts written by
|
|
228
|
+
// session-handler: prompt snippet, "Commits: ...", "Modified: ...",
|
|
229
|
+
// "Outcome: ...".
|
|
230
|
+
var epParts = String(ep.summary).split('\n');
|
|
231
|
+
var promptSnippet = '';
|
|
232
|
+
var commitSubject = '';
|
|
233
|
+
for (var si = 0; si < epParts.length; si++) {
|
|
234
|
+
var part = epParts[si].trim();
|
|
235
|
+
if (!part) continue;
|
|
236
|
+
if (part.indexOf('Commits: ') === 0) {
|
|
237
|
+
if (!commitSubject) commitSubject = part.slice(9).split(';')[0].trim();
|
|
238
|
+
} else if (part.indexOf('Modified: ') !== 0 && part.indexOf('Outcome: ') !== 0 && !promptSnippet) {
|
|
239
|
+
promptSnippet = part.slice(0, 160);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
hasCommits = commitSubject.length > 0;
|
|
243
|
+
if (!summary) {
|
|
244
|
+
var bits = [];
|
|
245
|
+
if (promptSnippet) bits.push(promptSnippet);
|
|
246
|
+
if (commitSubject) bits.push('commit: ' + commitSubject);
|
|
247
|
+
if (bits.length > 0) summary = bits.join(' — ') + ' (files: ' + baseNames.join(', ') + ')';
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (!summary) summary = 'Successful task editing ' + uniquePaths.length + ' files: ' + baseNames.join(', ');
|
|
251
|
+
|
|
252
|
+
// Confidence from evidence rather than a hardcoded constant:
|
|
253
|
+
// 0.5 base for any successful outcome
|
|
254
|
+
// +0.2 when commits back the session (strongest success signal)
|
|
255
|
+
// +0.1 when test files were part of the edit set
|
|
256
|
+
var confidence = 0.5;
|
|
257
|
+
if (hasCommits) confidence += 0.2;
|
|
258
|
+
var touchedTests = uniquePaths.some(function(tp) {
|
|
259
|
+
return /(^|\/)(tests?|__tests__)\//.test(tp) || /\.(test|spec)\.[cm]?[jt]sx?$/.test(tp);
|
|
260
|
+
});
|
|
261
|
+
if (touchedTests) confidence += 0.1;
|
|
262
|
+
confidence = Math.round(confidence * 100) / 100; // avoid FP artifacts like 0.7999…
|
|
263
|
+
|
|
264
|
+
newStoreEntries.push({
|
|
265
|
+
id: 'auto-' + (outcome.ts || Date.now()) + '-' + i,
|
|
266
|
+
type: 'pattern',
|
|
267
|
+
content: 'Successful edit pattern: ' + uniquePaths.map(function(cp) { return path.basename(cp); }).join(', '),
|
|
268
|
+
summary: summary,
|
|
269
|
+
confidence: confidence,
|
|
270
|
+
files: uniquePaths,
|
|
271
|
+
ts: outcome.ts || Date.now(),
|
|
272
|
+
});
|
|
273
|
+
} catch (_) {}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (newStoreEntries.length > 0) {
|
|
277
|
+
// Merge with existing store entries
|
|
278
|
+
var existing = safeReadJson(STORE_FILE);
|
|
279
|
+
var store = Array.isArray(existing) ? existing : [];
|
|
280
|
+
var existingIds = new Set(store.map(function(e) { return e && e.id; }));
|
|
281
|
+
// Skip near-identical patterns: same summary text or same file set as an
|
|
282
|
+
// entry already in the store (or one added earlier in this batch).
|
|
283
|
+
var fileSetKey = function(e) { return (e.files || []).slice().sort().join('|'); };
|
|
284
|
+
var seenSummaries = new Set(store.map(function(e) { return e && e.summary; }));
|
|
285
|
+
var seenFileSets = new Set(store.filter(function(e) { return e && Array.isArray(e.files) && e.files.length > 0; }).map(fileSetKey));
|
|
286
|
+
var addedCount = 0;
|
|
287
|
+
for (var j = 0; j < newStoreEntries.length; j++) {
|
|
288
|
+
var ne = newStoreEntries[j];
|
|
289
|
+
if (existingIds.has(ne.id)) continue;
|
|
290
|
+
if (seenSummaries.has(ne.summary)) continue;
|
|
291
|
+
if (ne.files && ne.files.length > 0 && seenFileSets.has(fileSetKey(ne))) continue;
|
|
292
|
+
store.push(ne);
|
|
293
|
+
seenSummaries.add(ne.summary);
|
|
294
|
+
if (ne.files && ne.files.length > 0) seenFileSets.add(fileSetKey(ne));
|
|
295
|
+
addedCount++;
|
|
296
|
+
}
|
|
297
|
+
// Cap store at 200 entries to prevent unbounded growth
|
|
298
|
+
if (store.length > 200) {
|
|
299
|
+
store.sort(function(a, b) { return (b.ts || 0) - (a.ts || 0); });
|
|
300
|
+
store = store.slice(0, 200);
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
fs.writeFileSync(STORE_FILE, JSON.stringify(store, null, 2), 'utf-8');
|
|
304
|
+
} catch (_) {}
|
|
305
|
+
count += addedCount;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Rotate outcomes: keep last 500 lines to prevent unbounded growth
|
|
309
|
+
if (outcomeLines.length > 500) {
|
|
310
|
+
try {
|
|
311
|
+
fs.writeFileSync(OUTCOMES_FILE, outcomeLines.slice(-500).join('\n') + '\n', 'utf-8');
|
|
312
|
+
} catch (_) {}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return { entries: count, edges: 0, newEntries: addedCount || 0 };
|
|
125
316
|
}
|
|
126
317
|
|
|
127
318
|
// ── feedback ──────────────────────────────────────────────────────────────────
|
|
128
319
|
|
|
129
320
|
function feedback(success) {
|
|
130
321
|
ensureDataDir();
|
|
322
|
+
// Read persisted edits from disk (survives subprocess boundaries).
|
|
323
|
+
// We intentionally do NOT clear recent-edits.jsonl here — that is done by
|
|
324
|
+
// consolidate() at session-end. This prevents post-task (subagent completion)
|
|
325
|
+
// from clearing edits that belong to the broader session's work.
|
|
326
|
+
var diskEdits = [];
|
|
327
|
+
var diskLines = safeReadLines(RECENT_EDITS_FILE);
|
|
328
|
+
for (var i = 0; i < diskLines.length; i++) {
|
|
329
|
+
try { diskEdits.push(JSON.parse(diskLines[i])); } catch (_) {}
|
|
330
|
+
}
|
|
331
|
+
// Use disk edits if available, fall back to in-memory buffer
|
|
332
|
+
var edits = diskEdits.length > 0 ? diskEdits.slice(-RING_BUFFER_MAX) : _recentEdits.slice();
|
|
131
333
|
var record = JSON.stringify({
|
|
132
334
|
ts: Date.now(),
|
|
133
335
|
success: !!success,
|
|
134
|
-
context:
|
|
135
|
-
recentEdits:
|
|
336
|
+
context: _lastContext,
|
|
337
|
+
recentEdits: edits,
|
|
136
338
|
}) + '\n';
|
|
137
339
|
try { fs.appendFileSync(OUTCOMES_FILE, record, 'utf-8'); } catch (_) {}
|
|
138
340
|
}
|
|
@@ -161,7 +363,8 @@ function storePattern(pattern) {
|
|
|
161
363
|
void pattern;
|
|
162
364
|
}
|
|
163
365
|
|
|
164
|
-
// ── AutoMem bridges
|
|
366
|
+
// ── AutoMem bridges — lazy-load the compiled intelligence module and expose ──
|
|
367
|
+
// ── its pattern-recall/decision-recording helpers to the .cjs hook handlers ──
|
|
165
368
|
|
|
166
369
|
var _intelligenceMod = null;
|
|
167
370
|
|
|
@@ -186,4 +389,41 @@ async function recordMemoryDecision(input) {
|
|
|
186
389
|
if (mod && mod.recordMemoryDecision) return mod.recordMemoryDecision(input);
|
|
187
390
|
}
|
|
188
391
|
|
|
189
|
-
|
|
392
|
+
// Bootstrap intelligence store from an already-open monograph DB handle.
|
|
393
|
+
// Called from route-handler on first prompt when store is sparse.
|
|
394
|
+
function bootstrapFromDb(db) {
|
|
395
|
+
if (!db || _entries.length >= 5) return 0;
|
|
396
|
+
try {
|
|
397
|
+
var hubs = db.prepare(
|
|
398
|
+
"SELECT n.name, n.label, n.file, COUNT(e.id) AS deg " +
|
|
399
|
+
"FROM nodes n JOIN edges e ON (e.source = n.id OR e.target = n.id) " +
|
|
400
|
+
"WHERE n.label IN ('File','Function','Class') AND n.file NOT LIKE '%node_modules%' AND n.file NOT LIKE '%dist/%' " +
|
|
401
|
+
"GROUP BY n.id ORDER BY deg DESC LIMIT 10"
|
|
402
|
+
).all();
|
|
403
|
+
if (hubs.length === 0) return 0;
|
|
404
|
+
var existingIds = new Set(_entries.map(function(e) { return e.id; }));
|
|
405
|
+
var added = 0;
|
|
406
|
+
for (var hi = 0; hi < hubs.length; hi++) {
|
|
407
|
+
var h = hubs[hi];
|
|
408
|
+
var bId = 'bootstrap-hub-' + hi;
|
|
409
|
+
if (existingIds.has(bId)) continue;
|
|
410
|
+
_entries.push({
|
|
411
|
+
id: bId,
|
|
412
|
+
type: 'hub',
|
|
413
|
+
content: h.name + ' (' + h.label + ') — ' + (h.file || '').replace(CWD + '/', '') + ' (' + h.deg + ' connections)',
|
|
414
|
+
summary: 'Key codebase hub: ' + h.name + ' with ' + h.deg + ' dependencies',
|
|
415
|
+
confidence: 0.4,
|
|
416
|
+
files: h.file ? [h.file] : [],
|
|
417
|
+
ts: Date.now(),
|
|
418
|
+
});
|
|
419
|
+
added++;
|
|
420
|
+
}
|
|
421
|
+
if (added > 0) {
|
|
422
|
+
ensureDataDir();
|
|
423
|
+
try { fs.writeFileSync(STORE_FILE, JSON.stringify(_entries, null, 2), 'utf-8'); } catch (_) {}
|
|
424
|
+
}
|
|
425
|
+
return added;
|
|
426
|
+
} catch (_) { return 0; }
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
module.exports = { init, getContext, recordEdit, consolidate, feedback, stats, logTrajectory, storePattern, findSimilarPatterns, recordMemoryDecision, bootstrapFromDb };
|
|
@@ -1,53 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// monolean: 207-line protocol replaced with compact routing table.
|
|
3
|
+
// The enforcement prose, anti-drift guards, iron laws, and mandatory patterns
|
|
4
|
+
// are redundant with using-superpowers skill and add ~4K tokens per session.
|
|
5
|
+
// The routing table is the unique value — tells Claude which skill for which task.
|
|
6
|
+
// Full protocol loads on-demand via /mastermind.
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const masterPath = findMasterPath();
|
|
36
|
-
if (!masterPath) {
|
|
37
|
-
process.stderr.write('[mastermind-activate] master.md not found — skipping injection\n');
|
|
38
|
-
process.exit(0);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let raw;
|
|
42
|
-
try {
|
|
43
|
-
raw = fs.readFileSync(masterPath, 'utf8');
|
|
44
|
-
} catch (e) {
|
|
45
|
-
process.stderr.write('[mastermind-activate] Could not read master.md: ' + e.message + '\n');
|
|
46
|
-
process.exit(0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Strip YAML frontmatter
|
|
50
|
-
const body = raw.replace(/^---[\s\S]*?---\s*/, '');
|
|
51
|
-
const protocol = extractProtocol(body);
|
|
52
|
-
|
|
53
|
-
process.stdout.write(protocol + '\n');
|
|
8
|
+
process.stdout.write(
|
|
9
|
+
'## Mastermind Skill Router\n\n' +
|
|
10
|
+
'Invoke the matching skill BEFORE responding. If unsure, check — invoking and finding it irrelevant costs less than skipping it.\n\n' +
|
|
11
|
+
'| Task | Skill |\n|---|---|\n' +
|
|
12
|
+
'| Debug/fix bug | `mastermind:debug` |\n' +
|
|
13
|
+
'| Verify claim/test/fix | `mastermind:verify` |\n' +
|
|
14
|
+
'| TDD (red-green-refactor) | `mastermind:tdd` |\n' +
|
|
15
|
+
'| Write implementation plan | `mastermind:plan` |\n' +
|
|
16
|
+
'| Execute a plan | `mastermind:execute` |\n' +
|
|
17
|
+
'| Subagent-driven plan execution | `mastermind:taskdev` |\n' +
|
|
18
|
+
'| Ingest spec → agent tasks | `mastermind:createtask` |\n' +
|
|
19
|
+
'| Execute task file/board | `mastermind:do` |\n' +
|
|
20
|
+
'| Design before code | `mastermind:design` |\n' +
|
|
21
|
+
'| Build feature/fix | `mastermind:build` |\n' +
|
|
22
|
+
'| Code/content review | `mastermind:review` |\n' +
|
|
23
|
+
'| Apply received review | `mastermind:receive-review` |\n' +
|
|
24
|
+
'| Architecture/DDD | `mastermind:architect` |\n' +
|
|
25
|
+
'| Research/analysis | `mastermind:research` |\n' +
|
|
26
|
+
'| Ideation | `mastermind:idea` / `mastermind:ideate` |\n' +
|
|
27
|
+
'| Improvement analysis | `mastermind:improve` |\n' +
|
|
28
|
+
'| Marketing/sales/content | `mastermind:marketing` / `mastermind:sales` / `mastermind:content` |\n' +
|
|
29
|
+
'| Release/finish branch | `mastermind:release` / `mastermind:finish` |\n' +
|
|
30
|
+
'| Autonomous build+review | `mastermind:autodev` |\n' +
|
|
31
|
+
'| Isolated work | `mastermind:worktree` |\n' +
|
|
32
|
+
'| Brain/memory inspect | `mastermind:brain` |\n\n' +
|
|
33
|
+
'Process skills (debug, idea, architect, research) set the approach. Execution skills (build, review, release) carry it out.\n' +
|
|
34
|
+
'Subagents with `<SUBAGENT-STOP>` gate skip this routing.\n'
|
|
35
|
+
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const { getDefaultMode, setMode, clearMode } = require('./monolean-config.cjs');
|
|
3
|
-
const { getMonoleanInstructions } = require('./monolean-instructions.cjs');
|
|
4
3
|
const fs = require('fs');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
|
|
@@ -16,5 +15,16 @@ try {
|
|
|
16
15
|
fs.writeFileSync(path.join(metricsDir, 'monolean-mode.json'), JSON.stringify({ mode, ts: Date.now() }));
|
|
17
16
|
} catch {}
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
// monolean: compact session-start directive. The full SKILL.md loads on-demand
|
|
19
|
+
// via /monolean — session context just needs the core rules.
|
|
20
|
+
process.stdout.write(
|
|
21
|
+
'MONOLEAN MODE ACTIVE — level: ' + mode + '\n\n' +
|
|
22
|
+
'Lazy senior dev mode. Lazy = efficient. Best code = code never written.\n' +
|
|
23
|
+
'The ladder (stop at first rung that holds): ' +
|
|
24
|
+
'1) YAGNI 2) Already in codebase? Reuse 3) Stdlib 4) Native platform 5) Installed dep 6) One line 7) Minimum code.\n' +
|
|
25
|
+
'Read the code first, trace the real flow, THEN climb the ladder.\n' +
|
|
26
|
+
'Bug fix = root cause fix. No unrequested abstractions. Deletion > addition. Fewest files. Code first, 3 lines max explanation.\n' +
|
|
27
|
+
'Never lean away: trust-boundary validation, data-loss prevention, security, accessibility, explicit user requests.\n' +
|
|
28
|
+
'Mark deliberate simplifications: `// monolean: [ceiling] — [upgrade path]`\n' +
|
|
29
|
+
'Off: "stop monolean". Switch: `/monolean lite|full|ultra`.\n'
|
|
30
|
+
);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const { readMode } = require('./monolean-config.cjs');
|
|
3
|
-
const { getMonoleanInstructions } = require('./monolean-instructions.cjs');
|
|
4
3
|
|
|
5
4
|
const mode = readMode();
|
|
6
5
|
if (!mode || mode === 'off') process.exit(0);
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
// monolean: full manifesto replaced with compact directive. Subagents get a
|
|
8
|
+
// focused task — they don't need 100 lines of philosophy to write lean code.
|
|
9
|
+
process.stdout.write(
|
|
10
|
+
'MONOLEAN MODE ACTIVE — level: ' + mode + '. ' +
|
|
11
|
+
'Write the minimum code that works. Stdlib over deps. Delete over add. ' +
|
|
12
|
+
'No unrequested abstractions, no scaffolding, no boilerplate.\n'
|
|
13
|
+
);
|
|
@@ -159,12 +159,102 @@ var MARKETING_OPTIN = /\b(marketing|seo|social media|advertising|campaign|conten
|
|
|
159
159
|
// ── Skills registry ────────────────────────────────────────────────────────────
|
|
160
160
|
|
|
161
161
|
var SKILLS = [
|
|
162
|
-
{ skill: 'mastermind', invoke: '/mastermind', description: 'Select swarm topology',
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{ skill: '
|
|
162
|
+
{ skill: 'mastermind', invoke: '/mastermind', description: 'Select swarm topology',
|
|
163
|
+
keywords: /\b(swarm|topology|hive|mastermind|multi.agent)\b/ig,
|
|
164
|
+
_terms: ['swarm','topology','hive','mastermind','multi-agent','multi agent'] },
|
|
165
|
+
{ skill: 'monodesign', invoke: '/monodesign', description: 'Frontend design and UI',
|
|
166
|
+
keywords: /\b(design|ui|ux|component|visual|layout|css|theme)\b/ig,
|
|
167
|
+
_terms: ['design','ui','ux','component','visual','layout','css','theme'] },
|
|
168
|
+
{ skill: 'monomotion', invoke: '/monomotion', description: 'Web animations and motion',
|
|
169
|
+
keywords: /\b(animate|animation|motion|gsap|transition|scroll)\b/ig,
|
|
170
|
+
_terms: ['animate','animation','motion','gsap','transition','scroll'] },
|
|
171
|
+
{ skill: 'graphify', invoke: '/graphify', description: 'Input to knowledge graph',
|
|
172
|
+
keywords: /\b(graph|knowledge|monograph|node|edge|visualize)\b/ig,
|
|
173
|
+
_terms: ['graph','knowledge','monograph','node','edge','visualize'] },
|
|
174
|
+
{ skill: 'monobrowse', invoke: '/monobrowse', description: 'Browser automation via CDP',
|
|
175
|
+
keywords: /\b(browse|browser|webpage|screenshot|navigate|selenium|puppeteer|cdp)\b/ig,
|
|
176
|
+
_terms: ['browse','browser','webpage','screenshot','navigate','selenium','puppeteer','cdp'] },
|
|
177
|
+
{ skill: 'tokens', invoke: '/tokens', description: 'Token usage and cost tracking',
|
|
178
|
+
keywords: /\b(tokens|token.usage|cost|spending|budget)\b/ig,
|
|
179
|
+
_terms: ['tokens','token-usage','cost','spending','budget'] },
|
|
166
180
|
];
|
|
167
181
|
|
|
182
|
+
// ── Feedback weight system ────────────────────────────────────────────────────
|
|
183
|
+
// Reads routing-feedback.jsonl (written by session-handler at session-end) and
|
|
184
|
+
// computes per-agent success rates. Adjusts routing confidence by up to +/-0.10
|
|
185
|
+
// so agents with proven track records get a slight boost and poor performers get
|
|
186
|
+
// dampened. Cached with a 60-second TTL to avoid repeated disk reads.
|
|
187
|
+
|
|
188
|
+
var _feedbackWeightsCache = null;
|
|
189
|
+
var _feedbackWeightsCacheTs = 0;
|
|
190
|
+
var FEEDBACK_TTL_MS = 60000;
|
|
191
|
+
|
|
192
|
+
function loadFeedbackWeights() {
|
|
193
|
+
var now = Date.now();
|
|
194
|
+
if (_feedbackWeightsCache && (now - _feedbackWeightsCacheTs) < FEEDBACK_TTL_MS) {
|
|
195
|
+
return _feedbackWeightsCache;
|
|
196
|
+
}
|
|
197
|
+
var weights = {};
|
|
198
|
+
try {
|
|
199
|
+
var fs = require('fs');
|
|
200
|
+
var path = require('path');
|
|
201
|
+
var cwd = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
|
202
|
+
var feedbackPath = path.join(cwd, '.monomind', 'routing-feedback.jsonl');
|
|
203
|
+
var MAX_SIZE = 512 * 1024;
|
|
204
|
+
if (!fs.existsSync(feedbackPath)) {
|
|
205
|
+
_feedbackWeightsCache = weights;
|
|
206
|
+
_feedbackWeightsCacheTs = now;
|
|
207
|
+
return weights;
|
|
208
|
+
}
|
|
209
|
+
var stat = fs.statSync(feedbackPath);
|
|
210
|
+
if (stat.size > MAX_SIZE) {
|
|
211
|
+
_feedbackWeightsCache = weights;
|
|
212
|
+
_feedbackWeightsCacheTs = now;
|
|
213
|
+
return weights;
|
|
214
|
+
}
|
|
215
|
+
var lines = fs.readFileSync(feedbackPath, 'utf-8').trim().split('\n').filter(Boolean);
|
|
216
|
+
// Use last 200 entries for weight calculation
|
|
217
|
+
var recent = lines.slice(-200);
|
|
218
|
+
var agentStats = {};
|
|
219
|
+
for (var i = 0; i < recent.length; i++) {
|
|
220
|
+
try {
|
|
221
|
+
var entry = JSON.parse(recent[i]);
|
|
222
|
+
var agent = entry.suggestedAgent;
|
|
223
|
+
if (!agent) continue;
|
|
224
|
+
// Skip no-evidence records (sessionSuccess null/missing) — they carry no signal
|
|
225
|
+
if (typeof entry.intelligenceFeedback !== 'boolean') continue;
|
|
226
|
+
if (!agentStats[agent]) agentStats[agent] = { total: 0, successes: 0 };
|
|
227
|
+
agentStats[agent].total++;
|
|
228
|
+
if (entry.intelligenceFeedback === true) agentStats[agent].successes++;
|
|
229
|
+
} catch (e) {}
|
|
230
|
+
}
|
|
231
|
+
// Compute weight adjustments: agents with >= 5 data points get a weight
|
|
232
|
+
// successRate > 0.7 → positive boost (up to +0.10)
|
|
233
|
+
// successRate < 0.4 → negative dampen (down to -0.10)
|
|
234
|
+
// In between → neutral (0)
|
|
235
|
+
for (var ag in agentStats) {
|
|
236
|
+
var s = agentStats[ag];
|
|
237
|
+
if (s.total < 5) continue;
|
|
238
|
+
var rate = s.successes / s.total;
|
|
239
|
+
if (rate > 0.7) {
|
|
240
|
+
weights[ag] = Math.min(0.10, (rate - 0.7) * 0.33);
|
|
241
|
+
} else if (rate < 0.4) {
|
|
242
|
+
weights[ag] = Math.max(-0.10, (rate - 0.4) * 0.25);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} catch (e) { /* non-fatal */ }
|
|
246
|
+
_feedbackWeightsCache = weights;
|
|
247
|
+
_feedbackWeightsCacheTs = now;
|
|
248
|
+
return weights;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function applyFeedbackWeight(agentSlug, baseConfidence) {
|
|
252
|
+
var weights = loadFeedbackWeights();
|
|
253
|
+
var adj = weights[agentSlug] || weights[TASK_AGENTS[agentSlug]] || 0;
|
|
254
|
+
if (adj === 0) return baseConfidence;
|
|
255
|
+
return Math.max(0, Math.min(1.0, baseConfidence + adj));
|
|
256
|
+
}
|
|
257
|
+
|
|
168
258
|
// ── Utilities ─────────────────────────────────────────────────────────────────
|
|
169
259
|
|
|
170
260
|
var MAX_PROMPT = 2000;
|
|
@@ -188,6 +278,9 @@ function routeTask(prompt) {
|
|
|
188
278
|
|
|
189
279
|
var safePrompt = prompt.slice(0, MAX_PROMPT);
|
|
190
280
|
|
|
281
|
+
// Skills are always checked — they're the primary value of routing now.
|
|
282
|
+
var skills = matchSkills(safePrompt);
|
|
283
|
+
|
|
191
284
|
// Check non-dev domain agents first (only if opt-in keywords match)
|
|
192
285
|
var extras = matchExtras(safePrompt);
|
|
193
286
|
if (extras.length > 0) {
|
|
@@ -195,22 +288,29 @@ function routeTask(prompt) {
|
|
|
195
288
|
return {
|
|
196
289
|
agent: topExtra.name,
|
|
197
290
|
agentSlug: topExtra.slug,
|
|
198
|
-
confidence: 0.80,
|
|
291
|
+
confidence: applyFeedbackWeight(topExtra.slug, 0.80),
|
|
199
292
|
reason: 'Domain: ' + topExtra.category,
|
|
200
293
|
semanticRouting: false,
|
|
201
294
|
specificAgents: extras,
|
|
202
|
-
skillMatches:
|
|
295
|
+
skillMatches: skills,
|
|
203
296
|
extrasMatches: extras,
|
|
204
297
|
};
|
|
205
298
|
}
|
|
206
299
|
|
|
300
|
+
// Check if a skill matched strongly (score >= 2) — if so, skip broad catch-all agents
|
|
301
|
+
var hasStrongSkill = false;
|
|
302
|
+
for (var si = 0; si < skills.length; si++) {
|
|
303
|
+
if (skills[si].score >= 2) { hasStrongSkill = true; break; }
|
|
304
|
+
}
|
|
305
|
+
|
|
207
306
|
// Check dev patterns in priority order
|
|
208
307
|
for (var i = 0; i < DEV_PRIORITY.length; i++) {
|
|
209
308
|
var slug = DEV_PRIORITY[i];
|
|
309
|
+
// Skip the broad "coder" catch-all when a specialized skill matched strongly
|
|
310
|
+
if (slug === 'coder' && hasStrongSkill) continue;
|
|
210
311
|
var pattern = _ROUTING_PATTERNS[slug];
|
|
211
312
|
if (pattern && pattern.test(safePrompt)) {
|
|
212
|
-
var confidence = TASK_CONFIDENCES[slug] || 0.75;
|
|
213
|
-
var skills = matchSkills(safePrompt);
|
|
313
|
+
var confidence = applyFeedbackWeight(slug, TASK_CONFIDENCES[slug] || 0.75);
|
|
214
314
|
return {
|
|
215
315
|
agent: TASK_AGENTS[slug],
|
|
216
316
|
agentSlug: slug,
|
|
@@ -232,7 +332,7 @@ function routeTask(prompt) {
|
|
|
232
332
|
reason: 'Default routing — no strong keyword match',
|
|
233
333
|
semanticRouting: false,
|
|
234
334
|
specificAgents: [],
|
|
235
|
-
skillMatches:
|
|
335
|
+
skillMatches: skills,
|
|
236
336
|
extrasMatches: [],
|
|
237
337
|
};
|
|
238
338
|
}
|
|
@@ -243,13 +343,24 @@ function matchSkills(prompt, topN) {
|
|
|
243
343
|
if (!prompt || typeof prompt !== 'string') return [];
|
|
244
344
|
topN = topN || 5;
|
|
245
345
|
var safePrompt = prompt.slice(0, MAX_PROMPT);
|
|
346
|
+
var promptLower = safePrompt.toLowerCase();
|
|
246
347
|
|
|
247
348
|
var scored = [];
|
|
248
349
|
for (var i = 0; i < SKILLS.length; i++) {
|
|
249
350
|
var s = SKILLS[i];
|
|
250
|
-
|
|
251
|
-
|
|
351
|
+
// Reset regex lastIndex (global flag) before testing
|
|
352
|
+
s.keywords.lastIndex = 0;
|
|
353
|
+
if (!s.keywords.test(safePrompt)) continue;
|
|
354
|
+
|
|
355
|
+
// Count distinct keyword hits for scoring
|
|
356
|
+
var hits = 0;
|
|
357
|
+
var terms = s._terms || [];
|
|
358
|
+
for (var t = 0; t < terms.length; t++) {
|
|
359
|
+
if (promptLower.indexOf(terms[t]) !== -1) hits++;
|
|
252
360
|
}
|
|
361
|
+
// Score: 1 base + 1 per additional keyword hit (min 1, max = term count)
|
|
362
|
+
var score = Math.max(1, hits);
|
|
363
|
+
scored.push({ skill: s.skill, invoke: s.invoke, description: s.description, score: score });
|
|
253
364
|
}
|
|
254
365
|
|
|
255
366
|
scored.sort(function(a, b) { return b.score - a.score; });
|