Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUv98ed12963d16
diff --git a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
index c435dccc99..009597d20b 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts
@@ -655,18 +655,20 @@ export const hooksList: MCPTool = {
export const hooksPreTask: MCPTool = {
name: 'hooks/pre-task',
- description: 'Record task start and get agent suggestions',
+ description: 'Record task start and get agent suggestions with intelligent model routing (ADR-026)',
inputSchema: {
type: 'object',
properties: {
taskId: { type: 'string', description: 'Task identifier' },
description: { type: 'string', description: 'Task description' },
+ filePath: { type: 'string', description: 'Optional file path for AST analysis' },
},
required: ['taskId', 'description'],
},
handler: async (params: Record<string, unknown>) => {
const taskId = params.taskId as string;
const description = params.description as string;
+ const filePath = params.filePath as string | undefined;
const suggestion = suggestAgentsForTask(description);
// Determine complexity
@@ -677,6 +679,43 @@ export const hooksPreTask: MCPTool = {
? 'low'
: 'medium';
+ // Enhanced model routing with Agent Booster AST (ADR-026)
+ let modelRouting: Record<string, unknown> | undefined;
+ try {
+ const { getEnhancedModelRouter } = await import('../ruvector/enhanced-model-router.js');
+ const router = getEnhancedModelRouter();
+ const routeResult = await router.route(description, { filePath });
+
+ if (routeResult.tier === 1) {
+ // Agent Booster can handle this task
+ modelRouting = {
+ tier: 1,
+ handler: 'agent-booster',
+ canSkipLLM: true,
+ agentBoosterIntent: routeResult.agentBoosterIntent?.type,
+ intentDescription: routeResult.agentBoosterIntent?.description,
+ confidence: routeResult.confidence,
+ estimatedLatencyMs: routeResult.estimatedLatencyMs,
+ estimatedCost: routeResult.estimatedCost,
+ recommendation: `[AGENT_BOOSTER_AVAILABLE] Skip LLM - use Agent Booster for "${routeResult.agentBoosterIntent?.type}"`,
+ };
+ } else {
+ // LLM required
+ modelRouting = {
+ tier: routeResult.tier,
+ handler: routeResult.handler,
+ model: routeResult.model,
+ complexity: routeResult.complexity,
+ confidence: routeResult.confidence,
+ estimatedLatencyMs: routeResult.estimatedLatencyMs,
+ estimatedCost: routeResult.estimatedCost,
+ recommendation: `[TASK_MODEL_RECOMMENDATION] Use model="${routeResult.model}" for this task`,
+ };
+ }
+ } catch {
+ // Enhanced router not available
+ }
+
return {
taskId,
description,
@@ -694,6 +733,7 @@ export const hooksPreTask: MCPTool = {
`Use ${suggestion.agents[0]} as primary agent`,
suggestion.agents.length > 2 ? 'Consider using swarm coordination' : 'Single agent recommended',
],
+ modelRouting,
timestamp: new Date().toISOString(),
};
},