monomind 1.11.5 → 1.11.7
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/README.md +0 -1
- package/package.json +11 -4
- package/packages/@monomind/cli/README.md +0 -1
- package/packages/@monomind/cli/dist/src/commands/agent.js +8 -1
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +17 -45
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -2
- package/packages/@monomind/cli/dist/src/commands/index.js +0 -7
- package/packages/@monomind/cli/dist/src/commands/monograph.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/plugins.js +1 -2
- package/packages/@monomind/cli/dist/src/commands/route.js +27 -36
- package/packages/@monomind/cli/dist/src/index.js +6 -26
- package/packages/@monomind/cli/dist/src/mcp-server.js +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +0 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +2 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.d.ts +4 -313
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +11 -1051
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +25 -25
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +4 -30
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +1 -2
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +7 -115
- package/packages/@monomind/cli/dist/src/monovector/index.d.ts +1 -8
- package/packages/@monomind/cli/dist/src/monovector/index.js +1 -13
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +0 -33
- package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/routing/llm-caller.js +109 -0
- package/packages/@monomind/cli/dist/src/update/checker.js +0 -1
- package/packages/@monomind/cli/dist/src/update/validator.js +0 -10
- package/packages/@monomind/cli/package.json +4 -11
- package/packages/@monomind/guidance/package.json +1 -2
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js +0 -73
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +0 -120
- package/packages/@monomind/cli/bundled-graph/package.json +0 -57
- package/packages/@monomind/cli/dist/src/commands/embeddings.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/commands/embeddings.js +0 -1628
package/README.md
CHANGED
|
@@ -342,7 +342,6 @@ The workspace ships 16 `@monomind/*` packages:
|
|
|
342
342
|
| `@monomind/security` | Input validation, prompt injection detection, CVE remediation, gVisor sandbox |
|
|
343
343
|
| `@monomind/mcp` | MCP server transport (stdio / http / WebSocket) |
|
|
344
344
|
| `@monomind/routing` | Two-stage LLM + keyword agent routing, confidence scoring |
|
|
345
|
-
| `@monomind/embeddings` | Vector embedding generation and management |
|
|
346
345
|
| `@monomind/performance` | Profiling, benchmarking, latency tracking |
|
|
347
346
|
| `@monomind/plugins` | IPFS/Pinata plugin registry, install/create/list |
|
|
348
347
|
| `@monomind/claims` | Claims-based authorization for agent actions |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monomind",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"description": "Monomind - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"test": "vitest",
|
|
52
52
|
"test:ui": "vitest --ui",
|
|
53
53
|
"test:security": "vitest run packages/__tests__/security/",
|
|
54
|
-
"lint": "cd packages/@monomind/cli && npm run lint || true",
|
|
55
54
|
"security:audit": "npm audit --audit-level high",
|
|
56
55
|
"security:fix": "npm audit fix",
|
|
57
56
|
"security:test": "npm run test:security",
|
|
@@ -66,10 +65,18 @@
|
|
|
66
65
|
"overrides": {
|
|
67
66
|
"hono": ">=4.11.4"
|
|
68
67
|
},
|
|
68
|
+
"pnpm": {
|
|
69
|
+
"peerDependencyRules": {
|
|
70
|
+
"allowedVersions": {
|
|
71
|
+
"tree-sitter": "0.22.4",
|
|
72
|
+
"marked": "16",
|
|
73
|
+
"@vitest/coverage-v8": "4.1.8",
|
|
74
|
+
"vitest": "4.1.4"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
69
78
|
"devDependencies": {
|
|
70
|
-
"@types/bcrypt": "^5.0.2",
|
|
71
79
|
"@types/node": "^20.0.0",
|
|
72
|
-
"eslint": "^8.0.0",
|
|
73
80
|
"tsx": "^4.21.0",
|
|
74
81
|
"typescript": "^5.0.0",
|
|
75
82
|
"vitest": "^4.1.4",
|
|
@@ -342,7 +342,6 @@ The workspace ships 16 `@monomind/*` packages:
|
|
|
342
342
|
| `@monomind/security` | Input validation, prompt injection detection, CVE remediation, gVisor sandbox |
|
|
343
343
|
| `@monomind/mcp` | MCP server transport (stdio / http / WebSocket) |
|
|
344
344
|
| `@monomind/routing` | Two-stage LLM + keyword agent routing, confidence scoring |
|
|
345
|
-
| `@monomind/embeddings` | Vector embedding generation and management |
|
|
346
345
|
| `@monomind/performance` | Profiling, benchmarking, latency tracking |
|
|
347
346
|
| `@monomind/plugins` | IPFS/Pinata plugin registry, install/create/list |
|
|
348
347
|
| `@monomind/claims` | Claims-based authorization for agent actions |
|
|
@@ -127,7 +127,14 @@ const spawnCommand = {
|
|
|
127
127
|
if (!agentType && taskDescription) {
|
|
128
128
|
try {
|
|
129
129
|
const { RouteLayer, ALL_ROUTES } = await import('@monomind/routing');
|
|
130
|
-
|
|
130
|
+
// Delegate low-confidence fallback to a headless Claude Code (Haiku)
|
|
131
|
+
// agent when `claude` is available — no API key required.
|
|
132
|
+
const { createClaudeLLMCaller } = await import('../routing/llm-caller.js');
|
|
133
|
+
const llmCaller = createClaudeLLMCaller({ model: 'haiku' });
|
|
134
|
+
const layer = new RouteLayer({
|
|
135
|
+
routes: ALL_ROUTES,
|
|
136
|
+
...(llmCaller ? { llmFallback: { llmCaller, model: 'haiku' } } : {}),
|
|
137
|
+
});
|
|
131
138
|
const routeResult = await layer.route(taskDescription);
|
|
132
139
|
agentType = routeResult.agentSlug;
|
|
133
140
|
process.stderr.write(`[route] ${routeResult.method}: "${agentType}" (confidence: ${(routeResult.confidence * 100).toFixed(1)}%)\n`);
|
|
@@ -32,46 +32,18 @@ const pretrainCommand = {
|
|
|
32
32
|
const outputFormat = ctx.flags.output || 'text';
|
|
33
33
|
const saveFile = ctx.flags.save;
|
|
34
34
|
const verbose = ctx.flags.verbose === true;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Save to file if requested
|
|
48
|
-
if (saveFile) {
|
|
49
|
-
const resultsDir = join(process.cwd(), '.monomind', 'benchmarks');
|
|
50
|
-
if (!existsSync(resultsDir)) {
|
|
51
|
-
mkdirSync(resultsDir, { recursive: true });
|
|
52
|
-
}
|
|
53
|
-
const savePath = saveFile.startsWith('/') ? saveFile : join(resultsDir, saveFile);
|
|
54
|
-
const saveTmp = savePath + '.tmp';
|
|
55
|
-
writeFileSync(saveTmp, JSON.stringify(results, null, 2));
|
|
56
|
-
renameSync(saveTmp, savePath);
|
|
57
|
-
output.writeln(output.success(`Results saved to ${savePath}`));
|
|
58
|
-
}
|
|
59
|
-
const allPassed = results.results.every(r => r.targetMet);
|
|
60
|
-
return {
|
|
61
|
-
success: true,
|
|
62
|
-
message: allPassed
|
|
63
|
-
? 'All benchmark targets met!'
|
|
64
|
-
: `${results.results.filter(r => r.targetMet).length}/${results.results.length} targets met`,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
69
|
-
output.writeln(output.error(`Benchmark failed: ${errorMsg}`));
|
|
70
|
-
return {
|
|
71
|
-
success: false,
|
|
72
|
-
message: `Benchmark failed: ${errorMsg}`,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
35
|
+
void iterations;
|
|
36
|
+
void warmup;
|
|
37
|
+
void verbose;
|
|
38
|
+
void outputFormat;
|
|
39
|
+
void saveFile;
|
|
40
|
+
output.writeln();
|
|
41
|
+
output.writeln(output.bold('Pattern-Learning Benchmark'));
|
|
42
|
+
output.writeln(output.dim('─'.repeat(50)));
|
|
43
|
+
output.writeln(output.dim(' The native SONA/EWC++/MoE pre-training benchmark was removed in the lean build.'));
|
|
44
|
+
output.writeln(output.dim(' Use "monomind benchmark neural" to benchmark the active pure-JS intelligence layer.'));
|
|
45
|
+
output.writeln();
|
|
46
|
+
return { success: true };
|
|
75
47
|
},
|
|
76
48
|
};
|
|
77
49
|
// ============================================================================
|
|
@@ -79,7 +51,7 @@ const pretrainCommand = {
|
|
|
79
51
|
// ============================================================================
|
|
80
52
|
const neuralCommand = {
|
|
81
53
|
name: 'neural',
|
|
82
|
-
description: 'Benchmark neural operations (embeddings,
|
|
54
|
+
description: 'Benchmark neural operations (embeddings, HNSW, cosine similarity)',
|
|
83
55
|
options: [
|
|
84
56
|
{ name: 'iterations', short: 'i', type: 'number', description: 'Benchmark iterations', default: '100' },
|
|
85
57
|
{ name: 'dimension', short: 'd', type: 'number', description: 'Embedding dimension', default: '384' },
|
|
@@ -182,8 +154,8 @@ const neuralCommand = {
|
|
|
182
154
|
target: 5.0,
|
|
183
155
|
met: cosineMean <= 5.0,
|
|
184
156
|
});
|
|
185
|
-
// 3.
|
|
186
|
-
spinner.setText('Benchmarking
|
|
157
|
+
// 3. Softmax-weighted top-K search (pure-JS)
|
|
158
|
+
spinner.setText('Benchmarking softmax top-K search...');
|
|
187
159
|
const flashTimes = [];
|
|
188
160
|
try {
|
|
189
161
|
const memory = await import('../memory/memory-initializer.js');
|
|
@@ -196,13 +168,13 @@ const neuralCommand = {
|
|
|
196
168
|
}
|
|
197
169
|
}
|
|
198
170
|
catch {
|
|
199
|
-
//
|
|
171
|
+
// not available
|
|
200
172
|
}
|
|
201
173
|
if (flashTimes.length > 0) {
|
|
202
174
|
const flashMean = flashTimes.reduce((a, b) => a + b, 0) / flashTimes.length;
|
|
203
175
|
const flashSorted = [...flashTimes].sort((a, b) => a - b);
|
|
204
176
|
results.push({
|
|
205
|
-
name: '
|
|
177
|
+
name: 'Softmax Top-K Search',
|
|
206
178
|
mean: flashMean,
|
|
207
179
|
p95: percentile(flashSorted, 95),
|
|
208
180
|
p99: percentile(flashSorted, 99),
|
|
@@ -21,7 +21,6 @@ export { mcpCommand } from './mcp.js';
|
|
|
21
21
|
export { hooksCommand } from './hooks.js';
|
|
22
22
|
export { daemonCommand } from './daemon.js';
|
|
23
23
|
export { doctorCommand } from './doctor.js';
|
|
24
|
-
export { embeddingsCommand } from './embeddings.js';
|
|
25
24
|
export { neuralCommand } from './neural.js';
|
|
26
25
|
export { performanceCommand } from './performance.js';
|
|
27
26
|
export { securityCommand } from './security.js';
|
|
@@ -46,7 +45,6 @@ export declare function getProvidersCommand(): Promise<Command | undefined>;
|
|
|
46
45
|
export declare function getPluginsCommand(): Promise<Command | undefined>;
|
|
47
46
|
export declare function getDeploymentCommand(): Promise<Command | undefined>;
|
|
48
47
|
export declare function getClaimsCommand(): Promise<Command | undefined>;
|
|
49
|
-
export declare function getEmbeddingsCommand(): Promise<Command | undefined>;
|
|
50
48
|
export declare function getCompletionsCommand(): Promise<Command | undefined>;
|
|
51
49
|
export declare function getAnalyzeCommand(): Promise<Command | undefined>;
|
|
52
50
|
export declare function getRouteCommand(): Promise<Command | undefined>;
|
|
@@ -39,7 +39,6 @@ const commandLoaders = {
|
|
|
39
39
|
plugins: () => import('./plugins.js'),
|
|
40
40
|
deployment: () => import('./deployment.js'),
|
|
41
41
|
claims: () => import('./claims.js'),
|
|
42
|
-
embeddings: () => import('./embeddings.js'),
|
|
43
42
|
// P0 Commands
|
|
44
43
|
completions: () => import('./completions.js'),
|
|
45
44
|
doctor: () => import('./doctor.js'),
|
|
@@ -114,7 +113,6 @@ import { mcpCommand } from './mcp.js';
|
|
|
114
113
|
import { hooksCommand } from './hooks.js';
|
|
115
114
|
import { daemonCommand } from './daemon.js';
|
|
116
115
|
import { doctorCommand } from './doctor.js';
|
|
117
|
-
import { embeddingsCommand } from './embeddings.js';
|
|
118
116
|
import { neuralCommand } from './neural.js';
|
|
119
117
|
import { performanceCommand } from './performance.js';
|
|
120
118
|
import { securityCommand } from './security.js';
|
|
@@ -157,7 +155,6 @@ loadedCommands.set('mcp', mcpCommand);
|
|
|
157
155
|
loadedCommands.set('hooks', hooksCommand);
|
|
158
156
|
loadedCommands.set('daemon', daemonCommand);
|
|
159
157
|
loadedCommands.set('doctor', doctorCommand);
|
|
160
|
-
loadedCommands.set('embeddings', embeddingsCommand);
|
|
161
158
|
loadedCommands.set('neural', neuralCommand);
|
|
162
159
|
loadedCommands.set('performance', performanceCommand);
|
|
163
160
|
loadedCommands.set('security', securityCommand);
|
|
@@ -188,7 +185,6 @@ export { mcpCommand } from './mcp.js';
|
|
|
188
185
|
export { hooksCommand } from './hooks.js';
|
|
189
186
|
export { daemonCommand } from './daemon.js';
|
|
190
187
|
export { doctorCommand } from './doctor.js';
|
|
191
|
-
export { embeddingsCommand } from './embeddings.js';
|
|
192
188
|
export { neuralCommand } from './neural.js';
|
|
193
189
|
export { performanceCommand } from './performance.js';
|
|
194
190
|
export { securityCommand } from './security.js';
|
|
@@ -214,7 +210,6 @@ export async function getProvidersCommand() { return loadCommand('providers'); }
|
|
|
214
210
|
export async function getPluginsCommand() { return loadCommand('plugins'); }
|
|
215
211
|
export async function getDeploymentCommand() { return loadCommand('deployment'); }
|
|
216
212
|
export async function getClaimsCommand() { return loadCommand('claims'); }
|
|
217
|
-
export async function getEmbeddingsCommand() { return loadCommand('embeddings'); }
|
|
218
213
|
export async function getCompletionsCommand() { return loadCommand('completions'); }
|
|
219
214
|
export async function getAnalyzeCommand() { return loadCommand('analyze'); }
|
|
220
215
|
export async function getRouteCommand() { return loadCommand('route'); }
|
|
@@ -243,7 +238,6 @@ export const commands = [
|
|
|
243
238
|
hooksCommand,
|
|
244
239
|
daemonCommand,
|
|
245
240
|
doctorCommand,
|
|
246
|
-
embeddingsCommand,
|
|
247
241
|
neuralCommand,
|
|
248
242
|
performanceCommand,
|
|
249
243
|
securityCommand,
|
|
@@ -275,7 +269,6 @@ export const commandsByCategory = {
|
|
|
275
269
|
neuralCommand,
|
|
276
270
|
securityCommand,
|
|
277
271
|
performanceCommand,
|
|
278
|
-
embeddingsCommand,
|
|
279
272
|
hiveMindCommand,
|
|
280
273
|
monovectorCommand,
|
|
281
274
|
guidanceCommand,
|
|
@@ -278,7 +278,7 @@ const searchCommand = {
|
|
|
278
278
|
// At @monoes/monograph@1.1.0, semanticSearch is not exported. Import from compat.
|
|
279
279
|
// With no embeddings at 1.1.0, --mode semantic and --mode hybrid both degrade to BM25
|
|
280
280
|
// (the RRF block merges bm25 with a sem list that is itself BM25 — harmless).
|
|
281
|
-
const { semanticSearch } = await import('
|
|
281
|
+
const { hybridSearch: semanticSearch } = await import('@monoes/monograph');
|
|
282
282
|
const db = openDb(dbPath);
|
|
283
283
|
let results = [];
|
|
284
284
|
const K = 60;
|
|
@@ -705,7 +705,7 @@ const rateCommand = {
|
|
|
705
705
|
{ name: 'rating', short: 'r', type: 'number', description: 'Rating (1-5)', required: true },
|
|
706
706
|
],
|
|
707
707
|
examples: [
|
|
708
|
-
{ command: 'monomind plugins rate -n
|
|
708
|
+
{ command: 'monomind plugins rate -n my-plugin -r 5', description: 'Rate 5 stars' },
|
|
709
709
|
{ command: 'monomind plugins rate -n my-plugin -r 4', description: 'Rate 4 stars' },
|
|
710
710
|
],
|
|
711
711
|
action: async (ctx) => {
|
|
@@ -780,7 +780,6 @@ export const pluginsCommand = {
|
|
|
780
780
|
output.writeln(output.bold('Official Plugins:'));
|
|
781
781
|
output.printList([
|
|
782
782
|
'@monomind/security - Security scanning and CVE detection',
|
|
783
|
-
'@monomind/embeddings - Vector embeddings with hyperbolic support',
|
|
784
783
|
'@monomind/claims - Claims-based authorization',
|
|
785
784
|
'@monomind/performance - Performance profiling and benchmarks',
|
|
786
785
|
'@monomind/plugin-gastown-bridge - Gas Town orchestrator integration (WASM-accelerated)',
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* github.com/nokhodian/monomind
|
|
12
12
|
*/
|
|
13
13
|
import { output } from '../output.js';
|
|
14
|
-
import { createKeywordRouter,
|
|
14
|
+
import { createKeywordRouter, } from '../monovector/index.js';
|
|
15
15
|
/**
|
|
16
16
|
* Available agent types for routing
|
|
17
17
|
*/
|
|
@@ -86,7 +86,7 @@ const routeTaskCommand = {
|
|
|
86
86
|
],
|
|
87
87
|
examples: [
|
|
88
88
|
{ command: 'monomind route task "implement authentication"', description: 'Route task to best agent' },
|
|
89
|
-
{ command: 'monomind route task "write unit tests" --q-learning', description: 'Use
|
|
89
|
+
{ command: 'monomind route task "write unit tests" --q-learning', description: 'Use keyword-based routing' },
|
|
90
90
|
{ command: 'monomind route task "review code" --agent reviewer', description: 'Force specific agent' },
|
|
91
91
|
],
|
|
92
92
|
action: async (ctx) => {
|
|
@@ -103,7 +103,7 @@ const routeTaskCommand = {
|
|
|
103
103
|
spinner.start();
|
|
104
104
|
try {
|
|
105
105
|
if (forceAgent) {
|
|
106
|
-
//
|
|
106
|
+
// Use specified agent directly
|
|
107
107
|
const agent = getAgentType(forceAgent) ||
|
|
108
108
|
AGENT_TYPES.find(a => a.name.toLowerCase() === forceAgent.toLowerCase());
|
|
109
109
|
if (!agent) {
|
|
@@ -134,7 +134,7 @@ const routeTaskCommand = {
|
|
|
134
134
|
}
|
|
135
135
|
return { success: true, data: { agentId: agent.id, agentName: agent.name } };
|
|
136
136
|
}
|
|
137
|
-
// Use
|
|
137
|
+
// Use keyword-based routing
|
|
138
138
|
const router = await getRouter();
|
|
139
139
|
const result = await router.route(taskDescription, useExploration);
|
|
140
140
|
const agent = getAgentType(result.route) || AGENT_TYPES[0];
|
|
@@ -177,7 +177,7 @@ const routeTaskCommand = {
|
|
|
177
177
|
``,
|
|
178
178
|
`Description: ${agent.description}`,
|
|
179
179
|
`Capabilities: ${capabilities.join(', ')}`,
|
|
180
|
-
].join('\n'), '
|
|
180
|
+
].join('\n'), 'Keyword Routing');
|
|
181
181
|
if (alternatives.length > 0) {
|
|
182
182
|
output.writeln();
|
|
183
183
|
output.writeln(output.bold('Alternatives:'));
|
|
@@ -263,7 +263,7 @@ const listAgentsCommand = {
|
|
|
263
263
|
// ============================================================================
|
|
264
264
|
const statsCommand = {
|
|
265
265
|
name: 'stats',
|
|
266
|
-
description: 'Show
|
|
266
|
+
description: 'Show keyword router statistics',
|
|
267
267
|
options: [
|
|
268
268
|
{
|
|
269
269
|
name: 'json',
|
|
@@ -281,18 +281,12 @@ const statsCommand = {
|
|
|
281
281
|
try {
|
|
282
282
|
const router = await getRouter();
|
|
283
283
|
const stats = router.getStats();
|
|
284
|
-
const monovectorAvailable = await isMonovectorAvailable();
|
|
285
|
-
const monovectorStatus = {
|
|
286
|
-
available: monovectorAvailable,
|
|
287
|
-
wasmAccelerated: stats.useNative === 1,
|
|
288
|
-
backend: stats.useNative === 1 ? 'monovector-native' : 'fallback',
|
|
289
|
-
};
|
|
290
284
|
if (jsonOutput) {
|
|
291
|
-
output.printJson({ stats,
|
|
285
|
+
output.printJson({ stats, backend: 'keyword-routing-js' });
|
|
292
286
|
}
|
|
293
287
|
else {
|
|
294
288
|
output.writeln();
|
|
295
|
-
output.writeln(output.bold('
|
|
289
|
+
output.writeln(output.bold('Keyword Router Statistics'));
|
|
296
290
|
output.writeln();
|
|
297
291
|
output.printTable({
|
|
298
292
|
columns: [
|
|
@@ -301,22 +295,13 @@ const statsCommand = {
|
|
|
301
295
|
],
|
|
302
296
|
data: [
|
|
303
297
|
{ metric: 'Update Count', value: String(stats.updateCount) },
|
|
304
|
-
{ metric: '
|
|
298
|
+
{ metric: 'Pattern Count', value: String(stats.qTableSize) },
|
|
305
299
|
{ metric: 'Step Count', value: String(stats.stepCount) },
|
|
306
|
-
{ metric: '
|
|
307
|
-
{ metric: 'Avg TD Error', value: stats.avgTDError.toFixed(4) },
|
|
308
|
-
{ metric: 'Native Backend', value: stats.useNative === 1 ? 'Yes' : 'No' },
|
|
300
|
+
{ metric: 'Backend', value: 'keyword-routing (JS)' },
|
|
309
301
|
],
|
|
310
302
|
});
|
|
311
|
-
output.writeln();
|
|
312
|
-
output.writeln(output.bold('MonoVector Status'));
|
|
313
|
-
output.printList([
|
|
314
|
-
`Available: ${monovectorStatus.available ? output.success('Yes') : output.warning('No (using fallback)')}`,
|
|
315
|
-
`WASM Accelerated: ${monovectorStatus.wasmAccelerated ? output.success('Yes') : 'No'}`,
|
|
316
|
-
`Backend: ${monovectorStatus.backend}`,
|
|
317
|
-
]);
|
|
318
303
|
}
|
|
319
|
-
return { success: true, data: { stats
|
|
304
|
+
return { success: true, data: { stats } };
|
|
320
305
|
}
|
|
321
306
|
catch (error) {
|
|
322
307
|
output.printError(error instanceof Error ? error.message : String(error));
|
|
@@ -406,7 +391,7 @@ const feedbackCommand = {
|
|
|
406
391
|
// ============================================================================
|
|
407
392
|
const resetCommand = {
|
|
408
393
|
name: 'reset',
|
|
409
|
-
description: 'Reset the
|
|
394
|
+
description: 'Reset the keyword router state',
|
|
410
395
|
options: [
|
|
411
396
|
{
|
|
412
397
|
name: 'force',
|
|
@@ -430,7 +415,7 @@ const resetCommand = {
|
|
|
430
415
|
try {
|
|
431
416
|
const router = await getRouter();
|
|
432
417
|
router.reset();
|
|
433
|
-
output.printSuccess('
|
|
418
|
+
output.printSuccess('Keyword router state has been reset');
|
|
434
419
|
return { success: true };
|
|
435
420
|
}
|
|
436
421
|
catch (error) {
|
|
@@ -802,7 +787,15 @@ const semanticRouteCommand = {
|
|
|
802
787
|
spinner.start();
|
|
803
788
|
try {
|
|
804
789
|
const { RouteLayer, ALL_ROUTES } = await import('@monomind/routing');
|
|
805
|
-
|
|
790
|
+
// Delegate low-confidence fallback to a headless Claude Code (Haiku)
|
|
791
|
+
// agent when `claude` is available — no API key required.
|
|
792
|
+
const { createClaudeLLMCaller } = await import('../routing/llm-caller.js');
|
|
793
|
+
const llmCaller = createClaudeLLMCaller({ model: 'haiku' });
|
|
794
|
+
const layer = new RouteLayer({
|
|
795
|
+
routes: ALL_ROUTES,
|
|
796
|
+
debug,
|
|
797
|
+
...(llmCaller ? { llmFallback: { llmCaller, model: 'haiku' } } : {}),
|
|
798
|
+
});
|
|
806
799
|
const result = await layer.route(taskDescription);
|
|
807
800
|
spinner.succeed(`Routed to ${result.agentSlug}`);
|
|
808
801
|
if (jsonOutput) {
|
|
@@ -854,7 +847,7 @@ const semanticRouteCommand = {
|
|
|
854
847
|
// ============================================================================
|
|
855
848
|
export const routeCommand = {
|
|
856
849
|
name: 'route',
|
|
857
|
-
description: 'Intelligent task-to-agent routing using
|
|
850
|
+
description: 'Intelligent task-to-agent routing using keyword matching',
|
|
858
851
|
subcommands: [
|
|
859
852
|
routeTaskCommand,
|
|
860
853
|
semanticRouteCommand,
|
|
@@ -870,7 +863,7 @@ export const routeCommand = {
|
|
|
870
863
|
{
|
|
871
864
|
name: 'q-learning',
|
|
872
865
|
short: 'q',
|
|
873
|
-
description: 'Use
|
|
866
|
+
description: 'Use keyword-based agent selection',
|
|
874
867
|
type: 'boolean',
|
|
875
868
|
default: true,
|
|
876
869
|
},
|
|
@@ -883,7 +876,7 @@ export const routeCommand = {
|
|
|
883
876
|
],
|
|
884
877
|
examples: [
|
|
885
878
|
{ command: 'monomind route "implement feature"', description: 'Route task to best agent' },
|
|
886
|
-
{ command: 'monomind route "write tests" --q-learning', description: 'Use
|
|
879
|
+
{ command: 'monomind route "write tests" --q-learning', description: 'Use keyword-based routing' },
|
|
887
880
|
{ command: 'monomind route --agent coder "fix bug"', description: 'Force specific agent' },
|
|
888
881
|
{ command: 'monomind route list-agents', description: 'List available agents' },
|
|
889
882
|
{ command: 'monomind route stats', description: 'Show routing statistics' },
|
|
@@ -923,12 +916,10 @@ export const routeCommand = {
|
|
|
923
916
|
'Provides confidence scores and alternatives',
|
|
924
917
|
]);
|
|
925
918
|
output.writeln();
|
|
926
|
-
// Show quick status
|
|
927
|
-
const monovectorAvailable = await isMonovectorAvailable();
|
|
928
919
|
output.writeln(output.bold('Backend Status:'));
|
|
929
920
|
output.printList([
|
|
930
|
-
`
|
|
931
|
-
`
|
|
921
|
+
`Routing: ${output.success('keyword-based (JS)')}`,
|
|
922
|
+
`Learning: trajectory recording + outcome correlation`,
|
|
932
923
|
]);
|
|
933
924
|
output.writeln();
|
|
934
925
|
output.writeln(output.dim('Run "monomind route <subcommand> --help" for more info'));
|
|
@@ -490,32 +490,12 @@ export class CLI {
|
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
catch { /* optional */ }
|
|
493
|
-
//
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (process.env.ANTHROPIC_API_KEY) {
|
|
500
|
-
const { default: Anthropic } = await import('@anthropic-ai/sdk');
|
|
501
|
-
const anthropic = new Anthropic();
|
|
502
|
-
routerConfig.llmFallback = {
|
|
503
|
-
llmCaller: async (prompt) => {
|
|
504
|
-
const msg = await anthropic.messages.create({
|
|
505
|
-
model: 'claude-haiku-4-5-20251001',
|
|
506
|
-
max_tokens: 100,
|
|
507
|
-
messages: [{ role: 'user', content: prompt }],
|
|
508
|
-
});
|
|
509
|
-
return msg.content[0].type === 'text' ? msg.content[0].text : '';
|
|
510
|
-
},
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
const routeLayer = new RouteLayer(routerConfig);
|
|
514
|
-
await routeLayer.initialize();
|
|
515
|
-
// Expose for router.cjs via process global (router.cjs already checks __monomindRouteLayer)
|
|
516
|
-
process.__monomindRouteLayer = routeLayer;
|
|
517
|
-
}
|
|
518
|
-
catch { /* optional — @monomind/routing may not be installed */ }
|
|
493
|
+
// NOTE: Semantic routing (@monomind/routing) is constructed on-demand by
|
|
494
|
+
// its consumers — `monomind route` and `monomind agent --task` (see
|
|
495
|
+
// commands/route.ts and commands/agent.ts). It is intentionally NOT
|
|
496
|
+
// eagerly initialized here: building all route centroids and probing for
|
|
497
|
+
// the `claude` CLI on every CLI startup would regress the <500ms startup
|
|
498
|
+
// budget for zero benefit (nothing reads a process-global route layer).
|
|
519
499
|
}
|
|
520
500
|
/**
|
|
521
501
|
* Handle errors
|
|
@@ -533,7 +533,7 @@ export class MCPServerManager extends EventEmitter {
|
|
|
533
533
|
try {
|
|
534
534
|
const { join } = await import('path');
|
|
535
535
|
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
536
|
-
const { getProcessesResource, getCommunitiesResource, getSchemaResource, getGraphResource } = await import('
|
|
536
|
+
const { getProcessesResource, getCommunitiesResource, getSchemaResource, getGraphResource } = await import('@monoes/monograph');
|
|
537
537
|
const projectCwd = process.env['MONOMIND_CWD'] || process.cwd();
|
|
538
538
|
const dbPath = join(projectCwd, '.monomind', 'monograph.db');
|
|
539
539
|
const resDb = openDb(dbPath);
|
|
@@ -50,10 +50,6 @@ export declare const OPTIONAL_PACKAGES: {
|
|
|
50
50
|
readonly description: "AI manipulation defense (prompt injection, PII detection)";
|
|
51
51
|
readonly tools: readonly ["aidefence_scan", "aidefence_analyze", "aidefence_stats", "aidefence_learn"];
|
|
52
52
|
};
|
|
53
|
-
readonly '@monomind/embeddings': {
|
|
54
|
-
readonly description: "Vector embeddings with ONNX support";
|
|
55
|
-
readonly tools: readonly ["embeddings_generate", "embeddings_search", "embeddings_batch"];
|
|
56
|
-
};
|
|
57
53
|
readonly 'onnxruntime-node': {
|
|
58
54
|
readonly description: "ONNX runtime for neural network inference";
|
|
59
55
|
readonly tools: readonly ["neural_*"];
|
|
@@ -69,10 +65,6 @@ declare const _default: {
|
|
|
69
65
|
readonly description: "AI manipulation defense (prompt injection, PII detection)";
|
|
70
66
|
readonly tools: readonly ["aidefence_scan", "aidefence_analyze", "aidefence_stats", "aidefence_learn"];
|
|
71
67
|
};
|
|
72
|
-
readonly '@monomind/embeddings': {
|
|
73
|
-
readonly description: "Vector embeddings with ONNX support";
|
|
74
|
-
readonly tools: readonly ["embeddings_generate", "embeddings_search", "embeddings_batch"];
|
|
75
|
-
};
|
|
76
68
|
readonly 'onnxruntime-node': {
|
|
77
69
|
readonly description: "ONNX runtime for neural network inference";
|
|
78
70
|
readonly tools: readonly ["neural_*"];
|
|
@@ -110,10 +110,6 @@ export const OPTIONAL_PACKAGES = {
|
|
|
110
110
|
description: 'AI manipulation defense (prompt injection, PII detection)',
|
|
111
111
|
tools: ['aidefence_scan', 'aidefence_analyze', 'aidefence_stats', 'aidefence_learn'],
|
|
112
112
|
},
|
|
113
|
-
'@monomind/embeddings': {
|
|
114
|
-
description: 'Vector embeddings with ONNX support',
|
|
115
|
-
tools: ['embeddings_generate', 'embeddings_search', 'embeddings_batch'],
|
|
116
|
-
},
|
|
117
113
|
'onnxruntime-node': {
|
|
118
114
|
description: 'ONNX runtime for neural network inference',
|
|
119
115
|
tools: ['neural_*'],
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { mkdirSync, writeFileSync, renameSync, existsSync, readFileSync, statSync, unlinkSync, readdirSync } from 'fs';
|
|
6
6
|
import { dirname, join, resolve, sep } from 'path';
|
|
7
7
|
import { getProjectCwd } from './types.js';
|
|
8
|
-
import { getCapabilities } from '../monovector/capabilities.js';
|
|
9
8
|
import { randomUUID } from 'node:crypto';
|
|
10
9
|
import { recordRoute, joinOutcome, joinLatestUnresolved } from '../monovector/route-outcomes.js';
|
|
11
10
|
import { recordCommand, deriveRecentSuccess } from '../monovector/command-outcomes.js';
|
|
@@ -706,8 +705,6 @@ export const hooksRoute = {
|
|
|
706
705
|
const agentdbConfidence = Math.round(agentdbRoute.confidence * 100) / 100;
|
|
707
706
|
// Record the route recommendation so post-task can join the actual outcome
|
|
708
707
|
const routeId = randomUUID();
|
|
709
|
-
const caps = await getCapabilities();
|
|
710
|
-
const learningMode = (caps.sona || caps.router === 'native' || caps.attention) ? 'native' : 'js';
|
|
711
708
|
await recordRoute(getRouteOutcomesBaseDir(), {
|
|
712
709
|
routeId,
|
|
713
710
|
ts: Date.now(),
|
|
@@ -715,7 +712,7 @@ export const hooksRoute = {
|
|
|
715
712
|
recommendedAgent: agents[0],
|
|
716
713
|
routingMethod: agentdbMethod,
|
|
717
714
|
confidence: agentdbConfidence,
|
|
718
|
-
learningMode,
|
|
715
|
+
learningMode: 'js',
|
|
719
716
|
});
|
|
720
717
|
return {
|
|
721
718
|
routeId,
|
|
@@ -797,8 +794,6 @@ export const hooksRoute = {
|
|
|
797
794
|
const primaryConfidence = Math.round(confidence * 100) / 100;
|
|
798
795
|
// Record the route recommendation so post-task can join the actual outcome
|
|
799
796
|
const routeId = randomUUID();
|
|
800
|
-
const caps = await getCapabilities();
|
|
801
|
-
const learningMode = (caps.sona || caps.router === 'native' || caps.attention) ? 'native' : 'js';
|
|
802
797
|
await recordRoute(getRouteOutcomesBaseDir(), {
|
|
803
798
|
routeId,
|
|
804
799
|
ts: Date.now(),
|
|
@@ -806,7 +801,7 @@ export const hooksRoute = {
|
|
|
806
801
|
recommendedAgent: agents[0],
|
|
807
802
|
routingMethod,
|
|
808
803
|
confidence: primaryConfidence,
|
|
809
|
-
learningMode,
|
|
804
|
+
learningMode: 'js',
|
|
810
805
|
});
|
|
811
806
|
return {
|
|
812
807
|
routeId,
|