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

rUv381cd614eacb
diff --git a/v3/@claude-flow/cli/src/init/statusline-generator.ts b/v3/@claude-flow/cli/src/init/statusline-generator.ts
index 17c24862e9..4fa77d3685 100644
--- a/v3/@claude-flow/cli/src/init/statusline-generator.ts
+++ b/v3/@claude-flow/cli/src/init/statusline-generator.ts
@@ -151,51 +151,107 @@ function getUserInfo() {
return { name, gitBranch, modelName };
}
-// Get learning stats from memory database
+// Get learning stats from intelligence loop data (ADR-050)
function getLearningStats() {
- const memoryPaths = [
- path.join(process.cwd(), '.swarm', 'memory.db'),
- path.join(process.cwd(), '.claude-flow', 'memory.db'),
- path.join(process.cwd(), '.claude', 'memory.db'),
- path.join(process.cwd(), 'data', 'memory.db'),
- path.join(process.cwd(), 'memory.db'),
- path.join(process.cwd(), '.agentdb', 'memory.db'),
- ];
-
let patterns = 0;
let sessions = 0;
let trajectories = 0;
+ let edges = 0;
+ let confidenceMean = 0;
+ let accessedCount = 0;
+ let trend = 'STABLE';
+
+ // PRIMARY: Read from intelligence loop data files
+ const dataDir = path.join(process.cwd(), '.claude-flow', 'data');
+
+ // 1. graph-state.json — authoritative node/edge counts
+ const graphPath = path.join(dataDir, 'graph-state.json');
+ if (fs.existsSync(graphPath)) {
+ try {
+ const graph = JSON.parse(fs.readFileSync(graphPath, 'utf-8'));
+ patterns = graph.nodes ? Object.keys(graph.nodes).length : 0;
+ edges = Array.isArray(graph.edges) ? graph.edges.length : 0;
+ } catch (e) { /* ignore */ }
+ }
+
+ // 2. ranked-context.json — confidence and access data
+ const rankedPath = path.join(dataDir, 'ranked-context.json');
+ if (fs.existsSync(rankedPath)) {
+ try {
+ const ranked = JSON.parse(fs.readFileSync(rankedPath, 'utf-8'));
+ if (ranked.entries && ranked.entries.length > 0) {
+ patterns = Math.max(patterns, ranked.entries.length);
+ let confSum = 0;
+ let accCount = 0;
+ for (let i = 0; i < ranked.entries.length; i++) {
+ confSum += (ranked.entries[i].confidence || 0);
+ if ((ranked.entries[i].accessCount || 0) > 0) accCount++;
+ }
+ confidenceMean = confSum / ranked.entries.length;
+ accessedCount = accCount;
+ }
+ } catch (e) { /* ignore */ }
+ }
- // Try to read from sqlite database
- for (const dbPath of memoryPaths) {
- if (fs.existsSync(dbPath)) {
+ // 3. intelligence-snapshot.json — trend history
+ const snapshotPath = path.join(dataDir, 'intelligence-snapshot.json');
+ if (fs.existsSync(snapshotPath)) {
+ try {
+ const snapshot = JSON.parse(fs.readFileSync(snapshotPath, 'utf-8'));
+ if (snapshot.history && snapshot.history.length >= 2) {
+ const first = snapshot.history[0];
+ const last = snapshot.history[snapshot.history.length - 1];
+ const confDrift = (last.confidenceMean || 0) - (first.confidenceMean || 0);
+ trend = confDrift > 0.01 ? 'IMPROVING' : confDrift < -0.01 ? 'DECLINING' : 'STABLE';
+ sessions = Math.max(sessions, snapshot.history.length);
+ }
+ } catch (e) { /* ignore */ }
+ }
+
+ // 4. auto-memory-store.json — fallback entry count
+ if (patterns === 0) {
+ const autoMemPath = path.join(dataDir, 'auto-memory-store.json');
+ if (fs.existsSync(autoMemPath)) {
try {
- // Count entries in memory file (rough estimate from file size)
- const stats = fs.statSync(dbPath);
- const sizeKB = stats.size / 1024;
- // Estimate: ~2KB per pattern on average
- patterns = Math.floor(sizeKB / 2);
- sessions = Math.max(1, Math.floor(patterns / 10));
- trajectories = Math.floor(patterns / 5);
- break;
- } catch (e) {
- // Ignore
+ const data = JSON.parse(fs.readFileSync(autoMemPath, 'utf-8'));
+ patterns = Array.isArray(data) ? data.length : (data.entries ? data.entries.length : 0);
+ } catch (e) { /* ignore */ }
+ }
+ }
+
+ // FALLBACK: Legacy memory.db file-size estimation
+ if (patterns === 0) {
+ const memoryPaths = [
+ path.join(process.cwd(), '.swarm', 'memory.db'),
+ path.join(process.cwd(), '.claude-flow', 'memory.db'),
+ path.join(process.cwd(), '.claude', 'memory.db'),
+ path.join(process.cwd(), 'data', 'memory.db'),
+ path.join(process.cwd(), 'memory.db'),
+ path.join(process.cwd(), '.agentdb', 'memory.db'),
+ ];
+ for (let j = 0; j < memoryPaths.length; j++) {
+ if (fs.existsSync(memoryPaths[j])) {
+ try {
+ const dbStats = fs.statSync(memoryPaths[j]);
+ patterns = Math.floor(dbStats.size / 1024 / 2);
+ break;
+ } catch (e) { /* ignore */ }
}
}
}
- // Also check for session files
+ // Session count from session files
const sessionsPath = path.join(process.cwd(), '.claude', 'sessions');
if (fs.existsSync(sessionsPath)) {
try {
const sessionFiles = fs.readdirSync(sessionsPath).filter(f => f.endsWith('.json'));
sessions = Math.max(sessions, sessionFiles.length);
- } catch (e) {
- // Ignore
- }
+ } catch (e) { /* ignore */ }
}
- return { patterns, sessions, trajectories };
+ trajectories = Math.floor(patterns / 5);
+
+ return { patterns, sessions, trajectories, edges, confidenceMean, accessedCount, trend };
}
// Get V3 progress from REAL metrics files