monomind 1.18.13 → 1.19.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 -1
- package/.claude/agents/github/multi-repo-swarm.md +1 -1
- package/.claude/agents/github/pr-manager.md +1 -1
- 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 +1 -1
- 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 -1
- 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/mastermind/_repeat.md +22 -3
- package/.claude/commands/mastermind/architect.md +1 -1
- package/.claude/commands/mastermind/autodev.md +1 -1
- package/.claude/commands/mastermind/build.md +1 -1
- package/.claude/commands/mastermind/code-review.md +5 -5
- package/.claude/commands/mastermind/debug.md +1 -1
- package/.claude/commands/mastermind/help.md +2 -2
- package/.claude/commands/mastermind/idea.md +1 -1
- package/.claude/commands/mastermind/improve.md +1 -1
- package/.claude/commands/mastermind/okf-export.md +14 -0
- package/.claude/commands/mastermind/okf-import.md +15 -0
- package/.claude/commands/mastermind/plan.md +1 -1
- package/.claude/commands/mastermind/research.md +1 -1
- package/.claude/commands/mastermind/review.md +12 -1
- package/.claude/commands/mastermind/runorg.md +1 -1
- package/.claude/commands/mastermind/taskdev.md +1 -1
- package/.claude/commands/mastermind/tdd.md +1 -1
- package/.claude/commands/mastermind/verify.md +1 -1
- package/.claude/helpers/graphify-freshen.cjs +16 -20
- package/.claude/helpers/handlers/agent-start-handler.cjs +11 -36
- package/.claude/helpers/handlers/capture-handler.cjs +110 -0
- package/.claude/helpers/handlers/route-handler.cjs +180 -256
- package/.claude/helpers/handlers/session-handler.cjs +139 -142
- package/.claude/helpers/handlers/session-restore-handler.cjs +15 -10
- package/.claude/helpers/handlers/task-handler.cjs +8 -155
- package/.claude/helpers/hook-handler.cjs +89 -5
- package/.claude/helpers/intelligence.cjs +164 -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 +47 -9
- package/.claude/helpers/utils/monograph.cjs +37 -20
- package/.claude/settings.json +0 -20
- package/.claude/skills/mastermind-skills/_repeat.md +29 -4
- package/.claude/skills/mastermind-skills/architect.md +5 -6
- package/.claude/skills/mastermind-skills/autodev.md +8 -5
- package/.claude/skills/mastermind-skills/review.md +25 -11
- package/.claude/skills/mastermind-skills/techport.md +37 -3
- 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/package.json +1 -1
- package/packages/@monomind/cli/.claude/agents/core/researcher.md +29 -24
- package/packages/@monomind/cli/.claude/agents/github/code-review-swarm.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/github-modes.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/issue-tracker.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/multi-repo-swarm.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/pr-manager.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/project-board-sync.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/release-manager.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/repo-architect.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/swarm-issue.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/swarm-pr.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/sync-coordinator.md +1 -1
- package/packages/@monomind/cli/.claude/agents/github/workflow-automation.md +1 -1
- package/packages/@monomind/cli/.claude/agents/goal/goal-planner.md +1 -1
- package/packages/@monomind/cli/.claude/agents/specialized/specialized-workflow-architect.md +11 -14
- package/packages/@monomind/cli/.claude/agents/testing/production-validator.md +8 -7
- package/packages/@monomind/cli/.claude/agents/testing/testing-evidence-collector.md +3 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/_repeat.md +22 -3
- package/packages/@monomind/cli/.claude/commands/mastermind/architect.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/autodev.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/build.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/code-review.md +5 -5
- package/packages/@monomind/cli/.claude/commands/mastermind/debug.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/help.md +2 -2
- package/packages/@monomind/cli/.claude/commands/mastermind/idea.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/improve.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/okf-export.md +14 -0
- package/packages/@monomind/cli/.claude/commands/mastermind/okf-import.md +15 -0
- package/packages/@monomind/cli/.claude/commands/mastermind/plan.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/research.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/review.md +12 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/runorg.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/taskdev.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/tdd.md +1 -1
- package/packages/@monomind/cli/.claude/commands/mastermind/verify.md +1 -1
- package/packages/@monomind/cli/.claude/helpers/graphify-freshen.cjs +16 -20
- package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +11 -36
- package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +110 -0
- package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +180 -256
- package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +139 -142
- package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +15 -10
- package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +8 -155
- package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +89 -5
- package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +164 -15
- package/packages/@monomind/cli/.claude/helpers/learning-service.mjs +1 -0
- package/packages/@monomind/cli/.claude/helpers/mastermind-activate.cjs +33 -51
- package/packages/@monomind/cli/.claude/helpers/monolean-activate.cjs +13 -3
- package/packages/@monomind/cli/.claude/helpers/monolean-propagate.cjs +7 -3
- package/packages/@monomind/cli/.claude/helpers/router.cjs +47 -9
- package/packages/@monomind/cli/.claude/helpers/utils/monograph.cjs +37 -20
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/_repeat.md +29 -4
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/architect.md +5 -6
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/autodev.md +8 -5
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/review.md +25 -11
- package/packages/@monomind/cli/.claude/skills/mastermind-skills/techport.md +37 -3
- package/packages/@monomind/cli/.claude/skills/monodesign/document.md +9 -6
- package/packages/@monomind/cli/.claude/skills/monodesign/extract.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/document.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monodesign/reference/live.md +1 -1
- package/packages/@monomind/cli/.claude/skills/monolean/SKILL.md +1 -1
- package/packages/@monomind/cli/bin/mcp-server.js +11 -1
- package/packages/@monomind/cli/dist/src/commands/agent-ops.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/agent-ops.js +1 -59
- package/packages/@monomind/cli/dist/src/commands/agent.js +2 -3
- package/packages/@monomind/cli/dist/src/commands/analyze-diff.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/browse-action.js +94 -2
- package/packages/@monomind/cli/dist/src/commands/completions.js +11 -56
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/hive-mind-helpers.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.d.ts +1 -3
- package/packages/@monomind/cli/dist/src/commands/hive-mind-ops.js +2 -116
- package/packages/@monomind/cli/dist/src/commands/hive-mind.js +2 -5
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +8 -7
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-routing.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/commands/hooks-extended-commands.js +0 -307
- package/packages/@monomind/cli/dist/src/commands/hooks.js +1 -12
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +3 -51
- package/packages/@monomind/cli/dist/src/commands/index.js +36 -184
- package/packages/@monomind/cli/dist/src/commands/init-wizard.js +2 -4
- package/packages/@monomind/cli/dist/src/commands/mcp.js +32 -4
- package/packages/@monomind/cli/dist/src/commands/memory-admin.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/memory-admin.js +1 -118
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +5 -171
- package/packages/@monomind/cli/dist/src/commands/memory.js +3 -6
- package/packages/@monomind/cli/dist/src/commands/neural-core.d.ts +3 -1
- package/packages/@monomind/cli/dist/src/commands/neural-core.js +145 -6
- package/packages/@monomind/cli/dist/src/commands/neural-optimize.js +4 -4
- package/packages/@monomind/cli/dist/src/commands/neural-registry.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/neural-registry.js +4 -4
- package/packages/@monomind/cli/dist/src/commands/neural.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/neural.js +6 -6
- package/packages/@monomind/cli/dist/src/commands/performance.js +68 -58
- package/packages/@monomind/cli/dist/src/commands/providers.js +2 -131
- package/packages/@monomind/cli/dist/src/commands/security-misc.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/commands/security-misc.js +69 -45
- package/packages/@monomind/cli/dist/src/commands/security.js +2 -4
- package/packages/@monomind/cli/dist/src/commands/session.js +1 -285
- package/packages/@monomind/cli/dist/src/commands/start.js +2 -41
- package/packages/@monomind/cli/dist/src/commands/status.js +18 -29
- package/packages/@monomind/cli/dist/src/commands/swarm.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/task.js +2 -49
- package/packages/@monomind/cli/dist/src/commands/workflow.js +2 -104
- package/packages/@monomind/cli/dist/src/index.js +7 -0
- package/packages/@monomind/cli/dist/src/init/executor.js +3 -14
- package/packages/@monomind/cli/dist/src/init/helpers-generator.js +2 -22
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +0 -1
- package/packages/@monomind/cli/dist/src/init/types.d.ts +1 -3
- package/packages/@monomind/cli/dist/src/init/types.js +0 -2
- package/packages/@monomind/cli/dist/src/mcp-client.js +0 -6
- package/packages/@monomind/cli/dist/src/mcp-server.js +16 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +0 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/causal-infer.d.ts +5 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/causal-infer.js +32 -46
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/consensus-verify.d.ts +2 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/consensus-verify.js +22 -20
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/memory-gate.d.ts +3 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/memory-gate.js +32 -19
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/quantum-topology.d.ts +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/quantum-topology.js +11 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/spectral-analyze.d.ts +2 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/spectral-analyze.js +51 -32
- package/packages/@monomind/cli/dist/src/mcp-tools/coherence/types.d.ts +5 -9
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +25 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-routing.js +45 -159
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +1 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +24 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +452 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +4 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +28 -54
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +5 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.d.ts +7 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/quality-tools.js +7 -257
- package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +7 -8
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +15 -16
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +37 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +3 -21
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +13 -80
- package/packages/@monomind/cli/dist/src/suggest.js +0 -5
- package/packages/@monomind/cli/package.json +1 -1
- package/packages/@monomind/guidance/README.md +49 -1153
- package/packages/@monomind/guidance/package.json +1 -74
- package/.claude/helpers/auto-memory-hook.mjs +0 -503
- package/packages/@monomind/cli/.claude/helpers/auto-memory-hook.mjs +0 -503
- package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/deployment.js +0 -706
|
@@ -59,8 +59,7 @@ function getStatsPath() {
|
|
|
59
59
|
const DEFAULT_SONA_CONFIG = {
|
|
60
60
|
instantLoopEnabled: true,
|
|
61
61
|
backgroundLoopEnabled: false,
|
|
62
|
-
|
|
63
|
-
loraRank: 8,
|
|
62
|
+
confidenceLearningRate: 0.001,
|
|
64
63
|
ewcLambda: 0.4,
|
|
65
64
|
maxTrajectorySize: 100,
|
|
66
65
|
patternThreshold: 0.7,
|
|
@@ -148,7 +147,7 @@ class LocalSonaCoordinator {
|
|
|
148
147
|
}
|
|
149
148
|
}
|
|
150
149
|
/**
|
|
151
|
-
* End the current trajectory with a verdict and apply
|
|
150
|
+
* End the current trajectory with a verdict and apply confidence updates.
|
|
152
151
|
* Reward mapping: success=1.0, partial=0.5, failure=-0.5
|
|
153
152
|
*
|
|
154
153
|
* For successful/partial trajectories, boosts confidence of similar patterns
|
|
@@ -198,10 +197,10 @@ class LocalSonaCoordinator {
|
|
|
198
197
|
}
|
|
199
198
|
/**
|
|
200
199
|
* Distill learning from recent successful trajectories.
|
|
201
|
-
* Applies
|
|
200
|
+
* Applies incremental confidence updates and integrates EWC consolidation.
|
|
202
201
|
*
|
|
203
202
|
* For each successful trajectory step with high confidence,
|
|
204
|
-
* increases the pattern's stored confidence by
|
|
203
|
+
* increases the pattern's stored confidence by confidenceLearningRate * reward.
|
|
205
204
|
* Before applying updates, checks EWC penalty to prevent catastrophic forgetting.
|
|
206
205
|
*/
|
|
207
206
|
async distillLearning(bank) {
|
|
@@ -249,13 +248,13 @@ class LocalSonaCoordinator {
|
|
|
249
248
|
// Check EWC penalty before applying update
|
|
250
249
|
if (ewcConsolidator) {
|
|
251
250
|
const oldWeights = [oldConfidence];
|
|
252
|
-
const proposedConfidence = Math.min(1.0, oldConfidence + this.config.
|
|
251
|
+
const proposedConfidence = Math.min(1.0, oldConfidence + this.config.confidenceLearningRate * reward);
|
|
253
252
|
const newWeights = [proposedConfidence];
|
|
254
253
|
const penalty = ewcConsolidator.getPenalty(oldWeights, newWeights);
|
|
255
254
|
totalEwcPenalty += penalty;
|
|
256
255
|
// If penalty is too high, reduce the update magnitude
|
|
257
256
|
if (penalty > this.config.ewcLambda) {
|
|
258
|
-
const dampedDelta = (this.config.
|
|
257
|
+
const dampedDelta = (this.config.confidenceLearningRate * reward) / (1 + penalty);
|
|
259
258
|
pattern.confidence = Math.max(0.0, Math.min(1.0, oldConfidence + dampedDelta));
|
|
260
259
|
}
|
|
261
260
|
else {
|
|
@@ -263,8 +262,8 @@ class LocalSonaCoordinator {
|
|
|
263
262
|
}
|
|
264
263
|
}
|
|
265
264
|
else {
|
|
266
|
-
// No
|
|
267
|
-
pattern.confidence = Math.max(0.0, Math.min(1.0, oldConfidence + this.config.
|
|
265
|
+
// No consolidation guard available: apply the full confidence update
|
|
266
|
+
pattern.confidence = Math.max(0.0, Math.min(1.0, oldConfidence + this.config.confidenceLearningRate * reward));
|
|
268
267
|
}
|
|
269
268
|
pattern.lastUsedAt = Date.now();
|
|
270
269
|
patternsDistilled++;
|
|
@@ -612,7 +611,7 @@ async function _doInitializeIntelligence(config) {
|
|
|
612
611
|
});
|
|
613
612
|
// Load persisted stats if available
|
|
614
613
|
loadPersistedStats();
|
|
615
|
-
// Seed neural learned patterns from
|
|
614
|
+
// Seed neural learned patterns from pattern store.
|
|
616
615
|
// This is the A→B bridge reader: connects the automatic learning loop to routing.
|
|
617
616
|
const neuralPatternsPath = join(getDataDir(), 'patterns.json');
|
|
618
617
|
if (existsSync(neuralPatternsPath) && statSync(neuralPatternsPath).size <= 50 * 1024 * 1024) {
|
|
@@ -756,7 +755,7 @@ export async function recordStep(step) {
|
|
|
756
755
|
metadata: step.metadata,
|
|
757
756
|
timestamp: step.timestamp || Date.now()
|
|
758
757
|
});
|
|
759
|
-
// Add to current trajectory for
|
|
758
|
+
// Add to current trajectory for outcome tracking
|
|
760
759
|
const stepWithEmbedding = { ...step, embedding };
|
|
761
760
|
sonaCoordinator.addTrajectoryStep(stepWithEmbedding);
|
|
762
761
|
// Store in ReasoningBank for retrieval
|
|
@@ -770,7 +769,7 @@ export async function recordStep(step) {
|
|
|
770
769
|
metadata: step.metadata
|
|
771
770
|
});
|
|
772
771
|
}
|
|
773
|
-
// When a 'result' step arrives, end the trajectory and run
|
|
772
|
+
// When a 'result' step arrives, end the trajectory and run the confidence-update loop
|
|
774
773
|
if (step.type === 'result' && reasoningBank) {
|
|
775
774
|
// Determine verdict from metadata or default to 'partial'
|
|
776
775
|
const verdict = step.metadata?.verdict || 'partial';
|
|
@@ -801,7 +800,7 @@ export async function recordTrajectory(steps, verdict) {
|
|
|
801
800
|
verdict,
|
|
802
801
|
timestamp: Date.now()
|
|
803
802
|
});
|
|
804
|
-
//
|
|
803
|
+
// Update pattern confidences based on verdict
|
|
805
804
|
if (reasoningBank) {
|
|
806
805
|
// Load steps into the coordinator for endTrajectory processing
|
|
807
806
|
for (const step of steps) {
|
|
@@ -904,8 +903,8 @@ export function getReasoningBank() {
|
|
|
904
903
|
return reasoningBank;
|
|
905
904
|
}
|
|
906
905
|
/**
|
|
907
|
-
* End the current trajectory with a verdict and apply
|
|
908
|
-
* This is the public API for the SONA
|
|
906
|
+
* End the current trajectory with a verdict and apply confidence updates.
|
|
907
|
+
* This is the public API for the SONA feedback loop.
|
|
909
908
|
*
|
|
910
909
|
* @param verdict - 'success' (reward=1.0), 'partial' (0.5), or 'failure' (-0.5)
|
|
911
910
|
* @returns Update statistics or null if not initialized
|
|
@@ -928,7 +927,7 @@ export async function endTrajectoryWithVerdict(verdict) {
|
|
|
928
927
|
}
|
|
929
928
|
/**
|
|
930
929
|
* Distill learning from recent successful trajectories.
|
|
931
|
-
* Applies
|
|
930
|
+
* Applies incremental confidence updates with EWC consolidation protection.
|
|
932
931
|
*
|
|
933
932
|
* @returns Distillation statistics or null if not initialized
|
|
934
933
|
*/
|
|
@@ -88,6 +88,25 @@ function getDbPath(customPath) {
|
|
|
88
88
|
return resolved;
|
|
89
89
|
return defaultDir;
|
|
90
90
|
}
|
|
91
|
+
function getAutomemConfig() {
|
|
92
|
+
const defaults = { dedupThreshold: 0.85, staleDays: 7 };
|
|
93
|
+
try {
|
|
94
|
+
const configPath = path.join(process.cwd(), '.monomind', 'automem-config.json');
|
|
95
|
+
if (!fs.existsSync(configPath))
|
|
96
|
+
return defaults;
|
|
97
|
+
const stat = fs.statSync(configPath);
|
|
98
|
+
if (stat.size > 64 * 1024)
|
|
99
|
+
return defaults;
|
|
100
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
101
|
+
return {
|
|
102
|
+
dedupThreshold: typeof config?.scaffold?.dedupThreshold === 'number' ? config.scaffold.dedupThreshold : defaults.dedupThreshold,
|
|
103
|
+
staleDays: typeof config?.scaffold?.staleDays === 'number' ? config.scaffold.staleDays : defaults.staleDays,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return defaults;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
91
110
|
function generateId(prefix) {
|
|
92
111
|
return `${prefix}_${Date.now()}_${crypto.randomBytes(8).toString('hex')}`;
|
|
93
112
|
}
|
|
@@ -212,6 +231,17 @@ export async function bridgeStoreEntry(options) {
|
|
|
212
231
|
}
|
|
213
232
|
catch { /* non-fatal */ }
|
|
214
233
|
}
|
|
234
|
+
// Dedup gate: skip if a near-duplicate already exists
|
|
235
|
+
const automemCfg = getAutomemConfig();
|
|
236
|
+
if (embedding && !options.upsert) {
|
|
237
|
+
try {
|
|
238
|
+
const similar = await backend.search(embedding, { k: 1, threshold: automemCfg.dedupThreshold });
|
|
239
|
+
if (similar.length > 0 && similar[0].score >= automemCfg.dedupThreshold) {
|
|
240
|
+
return { success: true, id: similar[0].entry.id, duplicate: true };
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch { /* non-fatal — store anyway */ }
|
|
244
|
+
}
|
|
215
245
|
await backend.store(entry);
|
|
216
246
|
return { success: true, id, embedding: embeddingInfo };
|
|
217
247
|
}
|
|
@@ -245,6 +275,7 @@ export async function bridgeSearchEntries(options) {
|
|
|
245
275
|
score: r.score,
|
|
246
276
|
namespace: r.entry.namespace,
|
|
247
277
|
provenance: `semantic:${r.score.toFixed(3)}`,
|
|
278
|
+
_createdAt: r.entry.createdAt || 0,
|
|
248
279
|
}));
|
|
249
280
|
searchMethod = 'semantic';
|
|
250
281
|
}
|
|
@@ -269,9 +300,15 @@ export async function bridgeSearchEntries(options) {
|
|
|
269
300
|
score: 0.5,
|
|
270
301
|
namespace: e.namespace,
|
|
271
302
|
provenance: 'keyword',
|
|
303
|
+
_createdAt: e.createdAt || 0,
|
|
272
304
|
}));
|
|
273
305
|
searchMethod = 'keyword';
|
|
274
306
|
}
|
|
307
|
+
// Filter stale entries based on automem config
|
|
308
|
+
const { staleDays } = getAutomemConfig();
|
|
309
|
+
const staleCutoff = Date.now() - staleDays * 86400000;
|
|
310
|
+
results = results.filter((r) => !r._createdAt || r._createdAt > staleCutoff);
|
|
311
|
+
results.forEach((r) => delete r._createdAt);
|
|
275
312
|
return {
|
|
276
313
|
success: true,
|
|
277
314
|
results,
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* - audit: Security analysis (10 min interval)
|
|
8
8
|
* - optimize: Performance optimization (15 min interval)
|
|
9
9
|
* - consolidate: Memory consolidation (30 min interval)
|
|
10
|
-
* - testgaps
|
|
10
|
+
* - testgaps, predict, document, refactor, preload: no local-mode
|
|
11
|
+
* implementation — real work only happens in headless mode via
|
|
12
|
+
* HeadlessWorkerExecutor (Claude Code CLI required)
|
|
11
13
|
*/
|
|
12
14
|
import { EventEmitter } from 'events';
|
|
13
15
|
import { HeadlessWorkerExecutor } from './headless-worker-executor.js';
|
|
@@ -183,26 +185,10 @@ export declare class WorkerDaemon extends EventEmitter {
|
|
|
183
185
|
*/
|
|
184
186
|
private runOptimizeWorkerLocal;
|
|
185
187
|
private runConsolidateWorker;
|
|
186
|
-
/**
|
|
187
|
-
* Local testgaps worker (fallback when headless unavailable)
|
|
188
|
-
*/
|
|
189
|
-
private runTestGapsWorkerLocal;
|
|
190
|
-
/**
|
|
191
|
-
* Local predict worker (fallback when headless unavailable)
|
|
192
|
-
*/
|
|
193
|
-
private runPredictWorkerLocal;
|
|
194
|
-
/**
|
|
195
|
-
* Local document worker (fallback when headless unavailable)
|
|
196
|
-
*/
|
|
197
|
-
private runDocumentWorkerLocal;
|
|
198
188
|
/**
|
|
199
189
|
* Local ultralearn worker (fallback when headless unavailable)
|
|
200
190
|
*/
|
|
201
191
|
private runUltralearnWorkerLocal;
|
|
202
|
-
/**
|
|
203
|
-
* Local refactor worker (fallback when headless unavailable)
|
|
204
|
-
*/
|
|
205
|
-
private runRefactorWorkerLocal;
|
|
206
192
|
/**
|
|
207
193
|
* Local deepdive worker (fallback when headless unavailable)
|
|
208
194
|
*/
|
|
@@ -211,10 +197,6 @@ export declare class WorkerDaemon extends EventEmitter {
|
|
|
211
197
|
* Local benchmark worker
|
|
212
198
|
*/
|
|
213
199
|
private runBenchmarkWorkerLocal;
|
|
214
|
-
/**
|
|
215
|
-
* Local preload worker
|
|
216
|
-
*/
|
|
217
|
-
private runPreloadWorkerLocal;
|
|
218
200
|
/**
|
|
219
201
|
* Manually trigger a worker
|
|
220
202
|
*/
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* - audit: Security analysis (10 min interval)
|
|
8
8
|
* - optimize: Performance optimization (15 min interval)
|
|
9
9
|
* - consolidate: Memory consolidation (30 min interval)
|
|
10
|
-
* - testgaps
|
|
10
|
+
* - testgaps, predict, document, refactor, preload: no local-mode
|
|
11
|
+
* implementation — real work only happens in headless mode via
|
|
12
|
+
* HeadlessWorkerExecutor (Claude Code CLI required)
|
|
11
13
|
*/
|
|
12
14
|
import { EventEmitter } from 'events';
|
|
13
15
|
import { existsSync, mkdirSync, writeFileSync, renameSync, readFileSync, appendFileSync, unlinkSync, statSync } from 'fs';
|
|
@@ -723,22 +725,23 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
723
725
|
return this.runOptimizeWorkerLocal();
|
|
724
726
|
case 'consolidate':
|
|
725
727
|
return this.runConsolidateWorker();
|
|
726
|
-
case 'testgaps':
|
|
727
|
-
return this.runTestGapsWorkerLocal();
|
|
728
|
-
case 'predict':
|
|
729
|
-
return this.runPredictWorkerLocal();
|
|
730
|
-
case 'document':
|
|
731
|
-
return this.runDocumentWorkerLocal();
|
|
732
728
|
case 'ultralearn':
|
|
733
729
|
return this.runUltralearnWorkerLocal();
|
|
734
|
-
case 'refactor':
|
|
735
|
-
return this.runRefactorWorkerLocal();
|
|
736
730
|
case 'deepdive':
|
|
737
731
|
return this.runDeepdiveWorkerLocal();
|
|
738
732
|
case 'benchmark':
|
|
739
733
|
return this.runBenchmarkWorkerLocal();
|
|
734
|
+
// testgaps/predict/document/refactor/preload have no real local-mode
|
|
735
|
+
// implementation — they only do real work in headless mode (see
|
|
736
|
+
// HeadlessWorkerExecutor). Without Claude Code CLI available there is
|
|
737
|
+
// nothing meaningful to run locally, so report that plainly instead of
|
|
738
|
+
// faking a result with hardcoded empty JSON (monolean).
|
|
739
|
+
case 'testgaps':
|
|
740
|
+
case 'predict':
|
|
741
|
+
case 'document':
|
|
742
|
+
case 'refactor':
|
|
740
743
|
case 'preload':
|
|
741
|
-
return this
|
|
744
|
+
return { mode: 'local', note: 'Install Claude Code CLI for AI-powered analysis — no local implementation exists for this worker' };
|
|
742
745
|
default:
|
|
743
746
|
return { status: 'unknown worker type', mode: 'local' };
|
|
744
747
|
}
|
|
@@ -991,53 +994,6 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
991
994
|
renameSync(consolidateFileTmp, consolidateFile);
|
|
992
995
|
return result;
|
|
993
996
|
}
|
|
994
|
-
/**
|
|
995
|
-
* Local testgaps worker (fallback when headless unavailable)
|
|
996
|
-
*/
|
|
997
|
-
async runTestGapsWorkerLocal() {
|
|
998
|
-
// Check for test coverage gaps
|
|
999
|
-
const testGapsFile = join(this.projectRoot, '.monomind', 'metrics', 'test-gaps.json');
|
|
1000
|
-
const metricsDir = join(this.projectRoot, '.monomind', 'metrics');
|
|
1001
|
-
if (!existsSync(metricsDir)) {
|
|
1002
|
-
mkdirSync(metricsDir, { recursive: true });
|
|
1003
|
-
}
|
|
1004
|
-
const result = {
|
|
1005
|
-
timestamp: new Date().toISOString(),
|
|
1006
|
-
mode: 'local',
|
|
1007
|
-
hasTestDir: existsSync(join(this.projectRoot, 'tests')) || existsSync(join(this.projectRoot, '__tests__')),
|
|
1008
|
-
estimatedCoverage: 'unknown',
|
|
1009
|
-
gaps: [],
|
|
1010
|
-
note: 'Install Claude Code CLI for AI-powered test gap analysis',
|
|
1011
|
-
};
|
|
1012
|
-
const testGapsFileTmp = testGapsFile + '.tmp';
|
|
1013
|
-
writeFileSync(testGapsFileTmp, JSON.stringify(result, null, 2));
|
|
1014
|
-
renameSync(testGapsFileTmp, testGapsFile);
|
|
1015
|
-
return result;
|
|
1016
|
-
}
|
|
1017
|
-
/**
|
|
1018
|
-
* Local predict worker (fallback when headless unavailable)
|
|
1019
|
-
*/
|
|
1020
|
-
async runPredictWorkerLocal() {
|
|
1021
|
-
return {
|
|
1022
|
-
timestamp: new Date().toISOString(),
|
|
1023
|
-
mode: 'local',
|
|
1024
|
-
predictions: [],
|
|
1025
|
-
preloaded: [],
|
|
1026
|
-
note: 'Install Claude Code CLI for AI-powered predictions',
|
|
1027
|
-
};
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* Local document worker (fallback when headless unavailable)
|
|
1031
|
-
*/
|
|
1032
|
-
async runDocumentWorkerLocal() {
|
|
1033
|
-
return {
|
|
1034
|
-
timestamp: new Date().toISOString(),
|
|
1035
|
-
mode: 'local',
|
|
1036
|
-
filesDocumented: 0,
|
|
1037
|
-
suggestedDocs: [],
|
|
1038
|
-
note: 'Install Claude Code CLI for AI-powered documentation generation',
|
|
1039
|
-
};
|
|
1040
|
-
}
|
|
1041
997
|
/**
|
|
1042
998
|
* Local ultralearn worker (fallback when headless unavailable)
|
|
1043
999
|
*/
|
|
@@ -1132,18 +1088,6 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
1132
1088
|
catch { /* monograph unavailable — return minimal result */ }
|
|
1133
1089
|
return result;
|
|
1134
1090
|
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Local refactor worker (fallback when headless unavailable)
|
|
1137
|
-
*/
|
|
1138
|
-
async runRefactorWorkerLocal() {
|
|
1139
|
-
return {
|
|
1140
|
-
timestamp: new Date().toISOString(),
|
|
1141
|
-
mode: 'local',
|
|
1142
|
-
suggestions: [],
|
|
1143
|
-
duplicatesFound: 0,
|
|
1144
|
-
note: 'Install Claude Code CLI for AI-powered refactoring suggestions',
|
|
1145
|
-
};
|
|
1146
|
-
}
|
|
1147
1091
|
/**
|
|
1148
1092
|
* Local deepdive worker (fallback when headless unavailable)
|
|
1149
1093
|
*/
|
|
@@ -1272,17 +1216,6 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
1272
1216
|
renameSync(benchmarkFileTmp, benchmarkFile);
|
|
1273
1217
|
return result;
|
|
1274
1218
|
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Local preload worker
|
|
1277
|
-
*/
|
|
1278
|
-
async runPreloadWorkerLocal() {
|
|
1279
|
-
return {
|
|
1280
|
-
timestamp: new Date().toISOString(),
|
|
1281
|
-
mode: 'local',
|
|
1282
|
-
resourcesPreloaded: 0,
|
|
1283
|
-
cacheStatus: 'active',
|
|
1284
|
-
};
|
|
1285
|
-
}
|
|
1286
1219
|
/**
|
|
1287
1220
|
* Manually trigger a worker
|
|
1288
1221
|
*/
|
|
@@ -125,16 +125,11 @@ export const COMMON_TYPOS = {
|
|
|
125
125
|
'hive': 'hive-mind',
|
|
126
126
|
'hivemind': 'hive-mind',
|
|
127
127
|
'hive_mind': 'hive-mind',
|
|
128
|
-
'neurl': 'neural',
|
|
129
|
-
'nueral': 'neural',
|
|
130
128
|
'securty': 'security',
|
|
131
129
|
'sec': 'security',
|
|
132
130
|
'perf': 'performance',
|
|
133
131
|
'performace': 'performance',
|
|
134
132
|
'provider': 'providers',
|
|
135
|
-
'dep': 'deployment',
|
|
136
|
-
'depoly': 'deployment',
|
|
137
|
-
'deploy': 'deployment',
|
|
138
133
|
'claim': 'claims',
|
|
139
134
|
'embed': 'embeddings',
|
|
140
135
|
'embeding': 'embeddings',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|