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

rUv4ae40d527d70
diff --git a/v3/@claude-flow/cli/src/ruvector/q-learning-router.ts b/v3/@claude-flow/cli/src/ruvector/q-learning-router.ts
index b304cfad35..347efb7be8 100644
--- a/v3/@claude-flow/cli/src/ruvector/q-learning-router.ts
+++ b/v3/@claude-flow/cli/src/ruvector/q-learning-router.ts
@@ -4,9 +4,19 @@
* Uses reinforcement learning to optimize task routing decisions
* based on historical performance and context.
*
+ * Features:
+ * - Caching for repeated task patterns (LRU cache)
+ * - Optimized state space with feature hashing
+ * - Epsilon decay with exponential annealing
+ * - Experience replay buffer for stable learning
+ * - Model persistence to .swarm/q-learning-model.json
+ *
* @module q-learning-router
*/
+import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
+import { dirname, join } from 'path';
+
/**
* Q-Learning Router Configuration
*/
@@ -21,10 +31,28 @@ export interface QLearningRouterConfig {
explorationFinal: number;
/** Exploration decay steps (default: 10000) */
explorationDecay: number;
+ /** Exploration decay type (default: 'exponential') */
+ explorationDecayType: 'linear' | 'exponential' | 'cosine';
/** Maximum states in Q-table (default: 10000) */
maxStates: number;
/** Number of actions/routes (default: 8) */
numActions: number;
+ /** Experience replay buffer size (default: 1000) */
+ replayBufferSize: number;
+ /** Mini-batch size for replay (default: 32) */
+ replayBatchSize: number;
+ /** Enable experience replay (default: true) */
+ enableReplay: boolean;
+ /** Route cache size (default: 256) */
+ cacheSize: number;
+ /** Cache TTL in milliseconds (default: 300000 = 5 minutes) */
+ cacheTTL: number;
+ /** Model persistence path (default: '.swarm/q-learning-model.json') */
+ modelPath: string;
+ /** Auto-save interval in updates (default: 100) */
+ autoSaveInterval: number;
+ /** State space dimensionality for feature hashing (default: 64) */
+ stateSpaceDim: number;
}
/**