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

rUvcf0759f73ca3
diff --git a/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts
index 7e9dd15bea..497c327d40 100644
--- a/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts
+++ b/v3/@claude-flow/cli/src/mcp-tools/agent-tools.ts
@@ -104,9 +104,9 @@ async function getModelRouter() {
}
/**
- * Determine model for agent based on:
+ * Determine model for agent based on (ADR-026 3-tier routing):
* 1. Explicit model in config
- * 2. Task-based routing (if task provided)
+ * 2. Enhanced task-based routing with Agent Booster AST (if task provided)
* 3. Agent type defaults
* 4. Fallback to sonnet
*/
@@ -114,21 +114,52 @@ async function determineAgentModel(
agentType: string,
config: Record<string, unknown>,
task?: string
-): Promise<{ model: ClaudeModel; routedBy: 'explicit' | 'router' | 'default' }> {
+): Promise<{
+ model: ClaudeModel;
+ routedBy: 'explicit' | 'router' | 'agent-booster' | 'default';
+ canSkipLLM?: boolean;
+ agentBoosterIntent?: string;
+ tier?: 1 | 2 | 3;
+}> {
// 1. Explicit model in config
if (config.model && ['haiku', 'sonnet', 'opus', 'inherit'].includes(config.model as string)) {
return { model: config.model as ClaudeModel, routedBy: 'explicit' };
}
- // 2. Task-based routing
+ // 2. Enhanced task-based routing with Agent Booster AST
if (task) {
- const router = await getModelRouter();
- if (router) {
- try {
- const result = await router.route(task);
- return { model: result.model, routedBy: 'router' };
- } catch {
- // Fall through to defaults on router error
+ try {
+ // Try enhanced router first (includes Agent Booster detection)
+ const { getEnhancedModelRouter } = await import('../ruvector/enhanced-model-router.js');
+ const enhancedRouter = getEnhancedModelRouter();
+ const routeResult = await enhancedRouter.route(task, { filePath: config.filePath as string });
+
+ if (routeResult.tier === 1 && routeResult.canSkipLLM) {
+ // Agent Booster can handle this task
+ return {
+ model: 'haiku', // Use haiku as fallback if AB fails
+ routedBy: 'agent-booster',
+ canSkipLLM: true,
+ agentBoosterIntent: routeResult.agentBoosterIntent?.type,
+ tier: 1,
+ };
+ }
+
+ return {
+ model: routeResult.model!,
+ routedBy: 'router',
+ tier: routeResult.tier,
+ };
+ } catch {
+ // Enhanced router not available, try basic router
+ const router = await getModelRouter();
+ if (router) {
+ try {
+ const result = await router.route(task);
+ return { model: result.model, routedBy: 'router' };
+ } catch {
+ // Fall through to defaults on router error
+ }
}
}
}