UNPKG

claude-flow

Version:

Ruflo - 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

67 lines 2.73 kB
/** * GAIA Mode Router — iter 58 (#2156) * * Rule-based classifier that maps each GAIA question to the appropriate * agent mode. Empirical basis from iter 57: * - ToolCalling (gaia-agent.ts) wins retrieval/attachment questions * - CodeAgent (gaia-claude-p.ts) wins pure-reasoning questions * - Naïve combination regressed by -10q, so routing is required * * Decision rules (evaluated in priority order): * * 1. ATTACHMENT — question has file_name → ToolCalling * CodeAgent struggles with attachment piping; ToolCalling natively * handles XLSX/PPTX/images/audio via attachment tools. * * 2. WEB_RETRIEVAL — question text matches retrieval keywords → * ToolCalling (has WebSearch/WebFetch in the tool catalogue) * * 3. PURE_REASONING — question text matches computation/logic keywords → * CodeAgent (executes arbitrary Python, no web round-trip needed) * * 4. LONG_QUESTION — question length > 400 chars → ToolCalling * Long questions typically involve multi-hop retrieval steps. * * 5. DEFAULT — ToolCalling (higher baseline per iter 56b) * * Each decision is logged with the rule that fired so per-Q audit is trivial. * * Refs: iter 57 architectural finding, iter 58, #2156 */ import type { GaiaQuestion } from './gaia-loader.js'; /** The two agent modes the hybrid router can dispatch to. */ export type GaiaMode = 'ToolCalling' | 'CodeAgent'; /** Routing rule identifiers (used for audit logging). */ export type RoutingRule = 'attachment' | 'web_retrieval' | 'pure_reasoning' | 'long_question' | 'default'; /** Result of classifying a single question. */ export interface RoutingDecision { /** Chosen agent mode. */ mode: GaiaMode; /** The rule that fired and determined the mode. */ rule: RoutingRule; /** Human-readable explanation (suitable for per-Q log). */ reason: string; } /** * Classify a GAIA question into a mode + rule pair. * * Rules are evaluated in strict priority order — the first matching rule wins. */ export declare function routeQuestion(question: GaiaQuestion): RoutingDecision; /** Summary produced by routeQuestions for logging purposes. */ export interface RoutingSummary { total: number; toolCalling: number; codeAgent: number; /** Questions routed to ToolCalling, sorted by rule. */ byRule: Record<RoutingRule, number>; } /** * Route an array of questions and return per-Q decisions plus a summary. * Zero-allocation: decisions array is returned in input order. */ export declare function routeQuestions(questions: GaiaQuestion[]): { decisions: RoutingDecision[]; summary: RoutingSummary; }; //# sourceMappingURL=gaia-mode-router.d.ts.map