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

fix: patch deployed statusline.cjs — remove all fake heuristics

Reuven774dbc3fd606
diff --git a/.claude/helpers/statusline.cjs b/.claude/helpers/statusline.cjs
index 57c351fcba..174ac10f1f 100644
--- a/.claude/helpers/statusline.cjs
+++ b/.claude/helpers/statusline.cjs
@@ -177,28 +177,43 @@ function getModelName() {
// Get learning stats from memory database (pure stat calls)
function getLearningStats() {
- const memoryPaths = [
- path.join(CWD, '.swarm', 'memory.db'),
- path.join(CWD, '.claude-flow', 'memory.db'),
- path.join(CWD, '.claude', 'memory.db'),
- path.join(CWD, 'data', 'memory.db'),
- path.join(CWD, '.agentdb', 'memory.db'),
- ];
+ let patterns = 0;
+ let sessions = 0;
- for (const dbPath of memoryPaths) {
- const stat = safeStat(dbPath);
- if (stat) {
- const sizeKB = stat.size / 1024;
- const patterns = Math.floor(sizeKB / 2);
- return {
- patterns,
- sessions: Math.max(1, Math.floor(patterns / 10)),
- };
+ // 1. Count real patterns from pattern store
+ const patternStorePath = path.join(CWD, '.claude-flow', 'data', 'patterns.json');
+ try {
+ if (fs.existsSync(patternStorePath)) {
+ const data = JSON.parse(fs.readFileSync(patternStorePath, 'utf-8'));
+ if (Array.isArray(data)) patterns = data.length;
+ else if (data && data.patterns) patterns = Array.isArray(data.patterns) ? data.patterns.length : Object.keys(data.patterns).length;
}
+ } catch { /* ignore */ }
+
+ // 2. Count from auto-memory-store (real entries)
+ if (patterns === 0) {
+ const autoStorePath = path.join(CWD, '.claude-flow', 'data', 'auto-memory-store.json');
+ try {
+ if (fs.existsSync(autoStorePath)) {
+ const data = JSON.parse(fs.readFileSync(autoStorePath, 'utf-8'));
+ if (Array.isArray(data)) patterns = data.length;
+ else if (data && data.entries) patterns = data.entries.length;
+ }
+ } catch { /* ignore */ }
}
- // Check session files count
- let sessions = 0;
+ // 3. Count from hooks memory store
+ if (patterns === 0) {
+ const hooksStorePath = path.join(CWD, '.claude-flow', 'memory', 'store.json');
+ try {
+ if (fs.existsSync(hooksStorePath)) {
+ const data = JSON.parse(fs.readFileSync(hooksStorePath, 'utf-8'));
+ if (data && data.entries) patterns = Object.keys(data.entries).length;
+ }
+ } catch { /* ignore */ }
+ }
+
+ // 4. Count real session files
try {
const sessDir = path.join(CWD, '.claude', 'sessions');
if (fs.existsSync(sessDir)) {
@@ -206,7 +221,16 @@ function getLearningStats() {
}
} catch { /* ignore */ }
- return { patterns: 0, sessions };
+ if (sessions === 0) {
+ try {
+ const cfSessDir = path.join(CWD, '.claude-flow', 'sessions');
+ if (fs.existsSync(cfSessDir)) {
+ sessions = fs.readdirSync(cfSessDir).filter(f => f.endsWith('.json')).length;
+ }
+ } catch { /* ignore */ }
+ }
+
+ return { patterns, sessions };
}
// V3 progress from metrics files (pure file reads)
@@ -219,11 +243,7 @@ function getV3Progress() {
let domainsCompleted = Math.min(5, Math.floor(dddProgress / 20));
if (dddProgress === 0 && learning.patterns > 0) {
- if (learning.patterns >= 500) domainsCompleted = 5;
- else if (learning.patterns >= 200) domainsCompleted = 4;
- else if (learning.patterns >= 100) domainsCompleted = 3;
- else if (learning.patterns >= 50) domainsCompleted = 2;
- else if (learning.patterns >= 10) domainsCompleted = 1;
+ domainsCompleted = Math.min(5, Math.floor(learning.patterns / 100));
dddProgress = Math.floor((domainsCompleted / totalDomains) * 100);
}
@@ -323,18 +343,7 @@ function getSystemMetrics() {
intelligencePct = Math.max(fromPatterns, fromVectors);
}
- // Maturity fallback (pure fs checks, no git exec)
- if (intelligencePct === 0) {
- let score = 0;
- if (fs.existsSync(path.join(CWD, '.claude'))) score += 15;
- const srcDirs = ['src', 'lib', 'app', 'packages', 'v3'];
- for (const d of srcDirs) { if (fs.existsSync(path.join(CWD, d))) { score += 15; break; } }
- const testDirs = ['tests', 'test', '__tests__', 'spec'];
- for (const d of testDirs) { if (fs.existsSync(path.join(CWD, d))) { score += 10; break; } }
- const cfgFiles = ['package.json', 'tsconfig.json', 'pyproject.toml', 'Cargo.toml', 'go.mod'];
- for (const f of cfgFiles) { if (fs.existsSync(path.join(CWD, f))) { score += 5; break; } }
- intelligencePct = Math.min(100, score);
- }
+ // No fake fallback — 0% means no real learning data exists
if (learningData?.sessions?.total !== undefined) {
contextPct = Math.min(100, learningData.sessions.total * 5);
@@ -424,7 +433,22 @@ function getAgentDBStats() {
const store = JSON.parse(fs.readFileSync(storePath, 'utf-8'));
if (Array.isArray(store)) vectorCount += store.length;
else if (store?.entries) vectorCount += store.entries.length;
- } catch { /* fall back to size estimate */ }
+ } catch { /* ignore */ }
+ }
+
+ // 1b. Count entries from hooks memory store
+ const hooksStorePath = path.join(CWD, '.claude-flow', 'memory', 'store.json');
+ const hooksStoreStat = safeStat(hooksStorePath);
+ if (hooksStoreStat) {
+ dbSizeKB += hooksStoreStat.size / 1024;
+ try {
+ const store = JSON.parse(fs.readFileSync(hooksStorePath, 'utf-8'));
+ if (store?.entries) {
+ const entryCount = Object.keys(store.entries).length;
+ vectorCount = Math.max(vectorCount, entryCount);
+ if (entryCount > 0) namespaces++;
+ }
+ } catch { /* ignore */ }
}
// 2. Count entries from ranked-context.json