moflo 4.8.13 → 4.8.14

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.
@@ -4,6 +4,6 @@
4
4
  "memorySearched": false,
5
5
  "sessionStart": "2026-03-23T02:45:57.764Z",
6
6
  "memoryRequired": true,
7
- "interactionCount": 24,
7
+ "interactionCount": 34,
8
8
  "lastBlockedAt": "2026-03-23T04:05:05.816Z"
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.8.13",
3
+ "version": "4.8.14",
4
4
  "description": "MoFlo — AI agent orchestration for Claude Code. Forked from ruflo/claude-flow with patches applied to source, plus feature-level orchestration.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -83,7 +83,7 @@
83
83
  "@types/bcrypt": "^5.0.2",
84
84
  "@types/node": "^20.19.37",
85
85
  "eslint": "^8.0.0",
86
- "moflo": "^4.8.11",
86
+ "moflo": "^4.8.13",
87
87
  "tsx": "^4.21.0",
88
88
  "typescript": "^5.9.3",
89
89
  "vitest": "^4.0.0"
@@ -336,11 +336,11 @@ const routeCommand = {
336
336
  { command: 'claude-flow hooks route -t "Optimize database queries" -K 5', description: 'Get top 5 suggestions' }
337
337
  ],
338
338
  action: async (ctx) => {
339
- const task = ctx.args[0] || ctx.flags.task;
339
+ const task = ctx.args[0] || ctx.flags.task || process.env.CLAUDE_USER_PROMPT || '';
340
340
  const topK = ctx.flags.topK || 3;
341
341
  if (!task) {
342
- output.printError('Task description is required. Use --task or -t flag.');
343
- return { success: false, exitCode: 1 };
342
+ // No task available (e.g. called from UserPromptSubmit hook with no prompt) — exit cleanly
343
+ return { success: true };
344
344
  }
345
345
  output.printInfo(`Routing task: ${output.highlight(task)}`);
346
346
  try {
@@ -52,13 +52,21 @@ const TASK_PATTERNS = [
52
52
  * Checked first — if matched, memory gate is skipped regardless of task patterns.
53
53
  */
54
54
  const DIRECTIVE_PATTERNS = [
55
- /^(yes|no|yeah|yep|nope|sure|ok|okay|correct|right|exactly|perfect)\b/i,
55
+ // Confirmations and short answers
56
+ /^(yes|no|yeah|yep|nope|sure|ok|okay|correct|right|exactly|perfect|thanks|thank you|got it|sounds good|go ahead|do it|lgtm)\b/i,
57
+ // Git and package management
56
58
  /\b(commit|push|pull|merge|rebase|cherry-pick)\b/,
59
+ /\bpublish\b/, /\bversion\b/, /\bnpm\b/, /\byarn\b/, /\bpnpm\b/,
60
+ // File management directives
57
61
  /\b(rename|move|delete|remove)\b/,
58
62
  /^(show|read|open|cat|look at|check)\s/,
59
63
  /^(run|execute|start|stop|kill|restart)\s/,
60
- /\bpublish\b/, /\bversion\b/, /\bnpm\b/,
61
64
  /^let'?s\s+(commit|push|publish|deploy|ship|merge)/i,
65
+ // Short follow-ups that reference the current conversation (not new tasks)
66
+ // These are anchored to start-of-string to avoid matching mid-sentence task words
67
+ /^(do the same|same for|same thing)\b/i,
68
+ /^(also|too|and also)\s+(for|with|on)\b/i,
69
+ /^(what about|how about)\s+(the\s+)?(other|rest|same)\b/i,
62
70
  ];
63
71
  const BRACKET_MESSAGES = {
64
72
  MODERATE: 'Context: MODERATE. Re-state goal before architectural decisions. Use agents for >300 LOC.',
@@ -304,78 +312,98 @@ export class WorkflowGateService {
304
312
  * Used by hooks.mjs dispatcher.
305
313
  */
306
314
  export function processGateCommand(command, env = process.env) {
307
- const gate = new WorkflowGateService();
308
- switch (command) {
309
- case 'check-before-agent': {
310
- const result = gate.checkBeforeAgent();
311
- if (!result.allowed) {
312
- if (result.message)
313
- process.stderr.write(result.message + '\n');
314
- process.exit(2); // Exit 2 = block tool call in Claude Code
315
- }
316
- process.exit(0);
317
- }
318
- case 'check-before-scan': {
319
- const result = gate.checkBeforeScan(env.TOOL_INPUT_pattern, env.TOOL_INPUT_path);
320
- if (!result.allowed) {
321
- if (result.message)
322
- process.stderr.write(result.message + '\n');
323
- process.exit(2);
315
+ // Gate commands (check-before-*) are STRICT — errors propagate, exit 2 blocks.
316
+ // Non-gate commands (record-*, prompt-reminder, etc.) are FAULT-TOLERANT —
317
+ // they catch errors and exit 0 so classification failures never surface as
318
+ // "hook error" to the user while gates remain fully enforced.
319
+ // --- STRICT GATE COMMANDS (must block on failure) ---
320
+ if (command.startsWith('check-before-') || command === 'check-dangerous-command') {
321
+ const gate = new WorkflowGateService();
322
+ switch (command) {
323
+ case 'check-before-agent': {
324
+ const result = gate.checkBeforeAgent();
325
+ if (!result.allowed) {
326
+ if (result.message)
327
+ process.stderr.write(result.message + '\n');
328
+ process.exit(2); // Exit 2 = block tool call in Claude Code
329
+ }
330
+ process.exit(0);
324
331
  }
325
- process.exit(0);
326
- }
327
- case 'check-before-read': {
328
- const result = gate.checkBeforeRead(env.TOOL_INPUT_file_path);
329
- if (!result.allowed) {
330
- if (result.message)
331
- process.stderr.write(result.message + '\n');
332
- process.exit(2);
332
+ case 'check-before-scan': {
333
+ const result = gate.checkBeforeScan(env.TOOL_INPUT_pattern, env.TOOL_INPUT_path);
334
+ if (!result.allowed) {
335
+ if (result.message)
336
+ process.stderr.write(result.message + '\n');
337
+ process.exit(2);
338
+ }
339
+ process.exit(0);
333
340
  }
334
- process.exit(0);
335
- }
336
- case 'record-task-created':
337
- gate.recordTaskCreated();
338
- process.exit(0);
339
- case 'check-bash-memory':
340
- gate.checkBashMemory(env.TOOL_INPUT_command || '');
341
- process.exit(0);
342
- case 'record-memory-searched':
343
- gate.recordMemorySearched();
344
- process.exit(0);
345
- case 'prompt-reminder': {
346
- const userPrompt = env.CLAUDE_USER_PROMPT || '';
347
- const { reminder, bracket } = gate.promptReminder(userPrompt);
348
- if (reminder)
349
- console.log(reminder);
350
- if (bracket)
351
- console.log(bracket);
352
- process.exit(0);
353
- }
354
- case 'compact-guidance': {
355
- console.log('Pre-Compact Guidance:');
356
- console.log('IMPORTANT: Before compacting, preserve key context:');
357
- console.log(' - Check CLAUDE.md for project rules and architecture');
358
- console.log(' - Memory namespaces: guidance, code-map, patterns, knowledge');
359
- console.log(' - Use memory search to recover context after compact');
360
- console.log(' - Batch all operations in single messages (GOLDEN RULE)');
361
- process.exit(0);
362
- }
363
- case 'check-dangerous-command': {
364
- const cmd = (env.TOOL_INPUT_command || '').toLowerCase();
365
- const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:', 'mkfs.', '> /dev/sda'];
366
- for (const pattern of dangerous) {
367
- if (cmd.includes(pattern)) {
368
- process.stderr.write(`[BLOCKED] Dangerous command detected: ${pattern}\n`);
341
+ case 'check-before-read': {
342
+ const result = gate.checkBeforeRead(env.TOOL_INPUT_file_path);
343
+ if (!result.allowed) {
344
+ if (result.message)
345
+ process.stderr.write(result.message + '\n');
369
346
  process.exit(2);
370
347
  }
348
+ process.exit(0);
349
+ }
350
+ case 'check-dangerous-command': {
351
+ const cmd = (env.TOOL_INPUT_command || '').toLowerCase();
352
+ const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:', 'mkfs.', '> /dev/sda'];
353
+ for (const pattern of dangerous) {
354
+ if (cmd.includes(pattern)) {
355
+ process.stderr.write(`[BLOCKED] Dangerous command detected: ${pattern}\n`);
356
+ process.exit(2);
357
+ }
358
+ }
359
+ process.exit(0);
360
+ }
361
+ default:
362
+ process.exit(0);
363
+ }
364
+ }
365
+ // --- FAULT-TOLERANT COMMANDS (never surface errors to user) ---
366
+ try {
367
+ const gate = new WorkflowGateService();
368
+ switch (command) {
369
+ case 'record-task-created':
370
+ gate.recordTaskCreated();
371
+ process.exit(0);
372
+ case 'check-bash-memory':
373
+ gate.checkBashMemory(env.TOOL_INPUT_command || '');
374
+ process.exit(0);
375
+ case 'record-memory-searched':
376
+ gate.recordMemorySearched();
377
+ process.exit(0);
378
+ case 'prompt-reminder': {
379
+ const userPrompt = env.CLAUDE_USER_PROMPT || '';
380
+ const { reminder, bracket } = gate.promptReminder(userPrompt);
381
+ if (reminder)
382
+ console.log(reminder);
383
+ if (bracket)
384
+ console.log(bracket);
385
+ process.exit(0);
371
386
  }
372
- process.exit(0);
387
+ case 'compact-guidance': {
388
+ console.log('Pre-Compact Guidance:');
389
+ console.log('IMPORTANT: Before compacting, preserve key context:');
390
+ console.log(' - Check CLAUDE.md for project rules and architecture');
391
+ console.log(' - Memory namespaces: guidance, code-map, patterns, knowledge');
392
+ console.log(' - Use memory search to recover context after compact');
393
+ console.log(' - Batch all operations in single messages (GOLDEN RULE)');
394
+ process.exit(0);
395
+ }
396
+ case 'session-reset':
397
+ gate.sessionReset();
398
+ process.exit(0);
399
+ default:
400
+ process.exit(0);
373
401
  }
374
- case 'session-reset':
375
- gate.sessionReset();
376
- process.exit(0);
377
- default:
378
- process.exit(0);
402
+ }
403
+ catch (err) {
404
+ // Non-gate commands must never crash — log for debugging but exit clean
405
+ process.stderr.write(`[gate:${command}] ${err.message ?? err}\n`);
406
+ process.exit(0);
379
407
  }
380
408
  }
381
409
  //# sourceMappingURL=workflow-gate.js.map
@@ -1,106 +1,106 @@
1
- {
2
- "name": "@moflo/cli",
3
- "version": "4.8.13",
4
- "type": "module",
5
- "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
- "main": "dist/src/index.js",
7
- "types": "dist/src/index.d.ts",
8
- "sideEffects": false,
9
- "bin": {
10
- "cli": "./bin/cli.js",
11
- "claude-flow": "./bin/cli.js",
12
- "claude-flow-mcp": "./bin/mcp-server.js"
13
- },
14
- "homepage": "https://github.com/eric-cielo/moflo#readme",
15
- "bugs": {
16
- "url": "https://github.com/eric-cielo/moflo/issues"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "https://github.com/eric-cielo/moflo.git",
21
- "directory": "v3/@claude-flow/cli"
22
- },
23
- "keywords": [
24
- "claude",
25
- "claude-code",
26
- "anthropic",
27
- "ai-agents",
28
- "multi-agent",
29
- "swarm",
30
- "mcp",
31
- "model-context-protocol",
32
- "llm",
33
- "cli",
34
- "orchestration",
35
- "automation",
36
- "developer-tools",
37
- "coding-assistant",
38
- "vector-database",
39
- "embeddings",
40
- "self-learning",
41
- "enterprise"
42
- ],
43
- "author": {
44
- "name": "Eric Cielo",
45
- "email": "eric@motailz.com",
46
- "url": "https://github.com/eric-cielo"
47
- },
48
- "license": "MIT",
49
- "exports": {
50
- ".": {
51
- "types": "./dist/src/index.d.ts",
52
- "import": "./dist/src/index.js"
53
- },
54
- "./ruvector": {
55
- "types": "./dist/src/ruvector/index.d.ts",
56
- "import": "./dist/src/ruvector/index.js"
57
- },
58
- "./ruvector/*": {
59
- "types": "./dist/src/ruvector/*.d.ts",
60
- "import": "./dist/src/ruvector/*.js"
61
- },
62
- "./mcp-tools": {
63
- "types": "./dist/src/mcp-tools/index.d.ts",
64
- "import": "./dist/src/mcp-tools/index.js"
65
- }
66
- },
67
- "files": [
68
- "dist",
69
- "bin",
70
- ".claude",
71
- "README.md"
72
- ],
73
- "scripts": {
74
- "build": "tsc",
75
- "test": "vitest run",
76
- "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
77
- "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
78
- "preinstall": "node bin/preinstall.cjs || true",
79
- "prepublishOnly": "cp ../../../README.md ./README.md",
80
- "release": "npm version prerelease --preid=alpha && npm run publish:all",
81
- "publish:all": "./scripts/publish.sh"
82
- },
83
- "devDependencies": {
84
- "typescript": "^5.3.0"
85
- },
86
- "dependencies": {
87
- "@noble/ed25519": "^2.1.0",
88
- "semver": "^7.6.0"
89
- },
90
- "optionalDependencies": {
91
- "@claude-flow/aidefence": "file:../aidefence",
92
- "@claude-flow/embeddings": "file:../embeddings",
93
- "@claude-flow/guidance": "file:../guidance",
94
- "@claude-flow/memory": "file:../memory",
95
- "@claude-flow/plugin-gastown-bridge": "^0.1.3",
96
- "agentic-flow": "^2.0.7",
97
- "@ruvector/attention": "^0.1.4",
98
- "@ruvector/learning-wasm": "^0.1.29",
99
- "@ruvector/router": "^0.1.27",
100
- "@ruvector/sona": "^0.1.5"
101
- },
102
- "publishConfig": {
103
- "access": "public",
104
- "tag": "latest"
105
- }
106
- }
1
+ {
2
+ "name": "@moflo/cli",
3
+ "version": "4.8.14",
4
+ "type": "module",
5
+ "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "sideEffects": false,
9
+ "bin": {
10
+ "cli": "./bin/cli.js",
11
+ "claude-flow": "./bin/cli.js",
12
+ "claude-flow-mcp": "./bin/mcp-server.js"
13
+ },
14
+ "homepage": "https://github.com/eric-cielo/moflo#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/eric-cielo/moflo/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/eric-cielo/moflo.git",
21
+ "directory": "v3/@claude-flow/cli"
22
+ },
23
+ "keywords": [
24
+ "claude",
25
+ "claude-code",
26
+ "anthropic",
27
+ "ai-agents",
28
+ "multi-agent",
29
+ "swarm",
30
+ "mcp",
31
+ "model-context-protocol",
32
+ "llm",
33
+ "cli",
34
+ "orchestration",
35
+ "automation",
36
+ "developer-tools",
37
+ "coding-assistant",
38
+ "vector-database",
39
+ "embeddings",
40
+ "self-learning",
41
+ "enterprise"
42
+ ],
43
+ "author": {
44
+ "name": "Eric Cielo",
45
+ "email": "eric@motailz.com",
46
+ "url": "https://github.com/eric-cielo"
47
+ },
48
+ "license": "MIT",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./dist/src/index.d.ts",
52
+ "import": "./dist/src/index.js"
53
+ },
54
+ "./ruvector": {
55
+ "types": "./dist/src/ruvector/index.d.ts",
56
+ "import": "./dist/src/ruvector/index.js"
57
+ },
58
+ "./ruvector/*": {
59
+ "types": "./dist/src/ruvector/*.d.ts",
60
+ "import": "./dist/src/ruvector/*.js"
61
+ },
62
+ "./mcp-tools": {
63
+ "types": "./dist/src/mcp-tools/index.d.ts",
64
+ "import": "./dist/src/mcp-tools/index.js"
65
+ }
66
+ },
67
+ "files": [
68
+ "dist",
69
+ "bin",
70
+ ".claude",
71
+ "README.md"
72
+ ],
73
+ "scripts": {
74
+ "build": "tsc",
75
+ "test": "vitest run",
76
+ "test:plugin-store": "npx tsx src/plugins/tests/standalone-test.ts",
77
+ "test:pattern-store": "npx tsx src/transfer/store/tests/standalone-test.ts",
78
+ "preinstall": "node bin/preinstall.cjs || true",
79
+ "prepublishOnly": "cp ../../../README.md ./README.md",
80
+ "release": "npm version prerelease --preid=alpha && npm run publish:all",
81
+ "publish:all": "./scripts/publish.sh"
82
+ },
83
+ "devDependencies": {
84
+ "typescript": "^5.3.0"
85
+ },
86
+ "dependencies": {
87
+ "@noble/ed25519": "^2.1.0",
88
+ "semver": "^7.6.0"
89
+ },
90
+ "optionalDependencies": {
91
+ "@claude-flow/aidefence": "file:../aidefence",
92
+ "@claude-flow/embeddings": "file:../embeddings",
93
+ "@claude-flow/guidance": "file:../guidance",
94
+ "@claude-flow/memory": "file:../memory",
95
+ "@claude-flow/plugin-gastown-bridge": "^0.1.3",
96
+ "agentic-flow": "^2.0.7",
97
+ "@ruvector/attention": "^0.1.4",
98
+ "@ruvector/learning-wasm": "^0.1.29",
99
+ "@ruvector/router": "^0.1.27",
100
+ "@ruvector/sona": "^0.1.5"
101
+ },
102
+ "publishConfig": {
103
+ "access": "public",
104
+ "tag": "latest"
105
+ }
106
+ }