🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
feat(ruflo-console): the Learning page and the Learning Lab fold their sections
ruva6c70b974ea6
diff --git a/plugins/ruflo-console/hooks/views/learning.ts b/plugins/ruflo-console/hooks/views/learning.tsindex c401c94141..ac5b28e095 100644--- a/plugins/ruflo-console/hooks/views/learning.ts+++ b/plugins/ruflo-console/hooks/views/learning.ts@@ -1,7 +1,7 @@import type { RenderElement } from 'claude-code'import type { Intelligence } from '../data/cli'-import { ago, col, count, kv, live, pct, picture, row, rule, section, sourceLine, starts, text, THEME, type Ctx } from './common'+import { ago, col, count, kv, live, pct, picture, row, section, sourceLine, starts, text, THEME, type Ctx } from './common'import { stagesOf } from './frames'import { settingsOf } from '../settings'import { resultRows } from './automate'@@ -45,12 +45,13 @@ function configRows(ctx: Ctx): RenderElement[] {/** The Learning Lab's actions on this page, folded: what was learned, training, pretrain, consolidate, the pattern store, the router. */function actionRows(ctx: Ctx): RenderElement[] {- return section(ctx, 'learn-actions', 'Self-learning actions', 'train, pretrain, consolidate, teach a pattern, route: the answer opens under the button', neuralActionRows(ctx), false)+ return section(ctx, 'learn-actions', 'Self-learning actions', 'train, pretrain, consolidate, teach a pattern, route: the answer opens under the button', neuralActionRows(ctx, true), false)}/*** What ruflo has learned, from its own stores: the router's last pick and how routed tasks turned out, the model tier- * router's tallies, and SONA's trajectory and pattern counts. A rate always carries its N.+ * router's tallies, and SONA's trajectory and pattern counts. A rate always carries its N. The router stays open; the pipeline+ * and SONA fold away, each header saying what it reads.*/export function learningView(ctx: Ctx): RenderElement {const { state, nowMs } = ctx@@ -60,9 +61,7 @@ export function learningView(ctx: Ctx): RenderElement {const router = snap?.router ?? nullconst neural = snap?.neural ?? nullconst intel = live<Intelligence>(state.probes.get('intelligence'))- const rows: RenderElement[] = [rule(ctx, 'Router', 'ruflo-mods · routing-outcomes.json')]-- rows.push(+ const routerRows: RenderElement[] = [kv(ctx,'last pick',@@ -72,8 +71,6 @@ export function learningView(ctx: Ctx): RenderElement {? 'n/a — ruflo-mods not seated, so no in-process route': 'n/a — no prompt routed yet this session',),- )- rows.push(kv(ctx,'routed outcomes',@@ -82,10 +79,8 @@ export function learningView(ctx: Ctx): RenderElement {: `${outcomes.successes}/${outcomes.total} succeeded (${pct(outcomes.successes / outcomes.total)} success rate, N=${outcomes.total}) · last ${ago(outcomes.points[outcomes.points.length - 1]?.atMs, nowMs)}`,outcomes !== null && outcomes.total > 0 ? THEME.info : undefined,),- )- rows.push(picture(ctx, 'curve', `running success rate over ${outcomes?.total ?? 0} outcomes`))- rows.push(text(ctx, 'running success rate of routed tasks, oldest left (router accuracy over N outcomes); new outcomes draw in', { dimColor: true }))- rows.push(+ picture(ctx, 'curve', `running success rate over ${outcomes?.total ?? 0} outcomes`),+ text(ctx, 'running success rate of routed tasks, oldest left (router accuracy over N outcomes); new outcomes draw in', { dimColor: true }),kv(ctx,'model router',@@ -93,19 +88,18 @@ export function learningView(ctx: Ctx): RenderElement {? 'n/a — no .swarm/model-router-state.json': `${count(router.decisions)} decisions · ${router.distribution.filter(entry => entry.count > 0).map(entry => `${entry.model} ${entry.count}`).join(' · ') || 'none'} · avg confidence ${router.avgConfidence === undefined ? 'n/a' : router.avgConfidence.toFixed(2)} · ${ago(router.updatedMs, nowMs)}`,),- )-- rows.push(rule(ctx, 'Pipeline', 'RETRIEVE → JUDGE → DISTILL → CONSOLIDATE'))- rows.push(picture(ctx, 'pipeline', stagesOf(state).map(stage => `${stage.name} ${stage.count ?? 'n/a'}`).join(' → ')))- for (const stage of stagesOf(state)) rows.push(text(ctx, ` ${stage.name.toLowerCase()}: ${stage.source}`, { dimColor: true }))- rows.push(picture(ctx, 'patterns', `patterns since load: ${state.history.patterns.map(sample => sample.value).join(' ') || 'n/a'}`))- rows.push(rule(ctx, 'SONA · ReasoningBank', 'neural/stats.json'))- rows.push(kv(ctx, 'trajectories', neural === null ? 'n/a — no .claude-flow/neural/stats.json' : count(neural.trajectories)))- rows.push(kv(ctx, 'patterns learned', neural === null ? 'n/a' : count(neural.patterns)))- rows.push(kv(ctx, 'signals', neural === null ? 'n/a' : count(neural.signals)))- rows.push(kv(ctx, 'last learned', neural?.lastAdaptationMs !== undefined ? ago(neural.lastAdaptationMs, nowMs) : 'n/a', THEME.info))- rows.push(kv(ctx, 'SONA patterns', snap?.sona === null || snap?.sona === undefined ? 'n/a — no .swarm/sona-patterns.json' : String(snap.sona.patterns)))- rows.push(+ ]+ const pipelineRows: RenderElement[] = [+ picture(ctx, 'pipeline', stagesOf(state).map(stage => `${stage.name} ${stage.count ?? 'n/a'}`).join(' → ')),+ ...stagesOf(state).map(stage => text(ctx, ` ${stage.name.toLowerCase()}: ${stage.source}`, { dimColor: true })),+ picture(ctx, 'patterns', `patterns since load: ${state.history.patterns.map(sample => sample.value).join(' ') || 'n/a'}`),+ ]+ const sonaRows: RenderElement[] = [+ kv(ctx, 'trajectories', neural === null ? 'n/a — no .claude-flow/neural/stats.json' : count(neural.trajectories)),+ kv(ctx, 'patterns learned', neural === null ? 'n/a' : count(neural.patterns)),+ kv(ctx, 'signals', neural === null ? 'n/a' : count(neural.signals)),+ kv(ctx, 'last learned', neural?.lastAdaptationMs !== undefined ? ago(neural.lastAdaptationMs, nowMs) : 'n/a', THEME.info),+ kv(ctx, 'SONA patterns', snap?.sona === null || snap?.sona === undefined ? 'n/a — no .swarm/sona-patterns.json' : String(snap.sona.patterns)),kv(ctx,'live engine',@@ -113,8 +107,13 @@ export function learningView(ctx: Ctx): RenderElement {? sourceLine(state.probes.get('intelligence'), nowMs, 'n/a').text: `${count(intel.trajectories)} trajectories · ${count(intel.patterns)} patterns · MoE ${count(intel.moeDecisions)} decisions · EWC ${count(intel.ewcConsolidations)} consolidations · neural router ${intel.neuralRouter ?? 'n/a'}`,),- )- rows.push(text(ctx, 'live engine: hooks_intelligence_stats in a fresh CLI process, so in-memory counters start at zero there', { dimColor: true }))+ text(ctx, 'live engine: hooks_intelligence_stats in a fresh CLI process, so in-memory counters start at zero there', { dimColor: true }),+ ]+ const rows: RenderElement[] = [+ ...section(ctx, 'learn-router', 'Router', 'ruflo-mods · routing-outcomes.json', routerRows, true),+ ...section(ctx, 'learn-pipeline', 'Pipeline', 'RETRIEVE → JUDGE → DISTILL → CONSOLIDATE', pipelineRows, false),+ ...section(ctx, 'learn-sona', 'SONA · ReasoningBank', 'neural/stats.json', sonaRows, false),+ ]// Nothing learned yet: the loop starts from the repository itself.if ((snap?.sona === null || snap?.sona === undefined) && (neural === null || neural === undefined) && snap?.isRufloProject === true) rows.push(starts(ctx, 'Nothing learned yet in this project.', ['pretrain']))diff --git a/plugins/ruflo-console/hooks/views/neural.ts b/plugins/ruflo-console/hooks/views/neural.tsindex 1fa888981a..d3f5a6102a 100644--- a/plugins/ruflo-console/hooks/views/neural.ts+++ b/plugins/ruflo-console/hooks/views/neural.ts@@ -2,7 +2,8 @@ import type { RenderElement } from 'claude-code'import { EPOCHS, PATTERNS, sparkline } from '../data/automate'import { field, resultRows, strip } from './automate'-import { ago, col, count, kv, row, rule, text, THEME, type Ctx } from './common'+import { spinAt } from '../spinner'+import { ago, col, count, kv, row, section, text, THEME, type Ctx } from './common'const BAR = 24@@ -10,7 +11,7 @@ const BAR = 24function intelligenceRows(ctx: Ctx): RenderElement[] {const { state, nowMs } = ctxconst neural = state.snapshot?.neural ?? null- const rows: RenderElement[] = [rule(ctx, 'Intelligence', neural === null ? 'no .claude-flow/neural/stats.json' : 'neural/stats.json')]+ const rows: RenderElement[] = []rows.push(kv(ctx, 'trajectories', count(neural?.trajectories)))rows.push(kv(ctx, 'patterns learned', count(neural?.patterns)))@@ -32,14 +33,14 @@ function trainingRows(ctx: Ctx): RenderElement[] {const last = trains[trains.length - 1]const losses = trains.flatMap(run => (run.loss === undefined ? [] : [run.loss]))const running = state.lab.running?.id.startsWith('nn-train') === true ? state.lab.running : null- const rows: RenderElement[] = [rule(ctx, 'Training', `${trains.length} run${trains.length === 1 ? '' : 's'} this session`)]+ const rows: RenderElement[] = []if (running !== null) {const at = Math.floor((nowMs - running.startedAtMs) / 250) % (BAR * 2)const head = at < BAR ? at : BAR * 2 - at - 1const bar = Array.from({ length: BAR }, (_, i) => (Math.abs(i - head) <= 2 ? '█' : '░')).join('')- rows.push(text(ctx, ` ▸ ${running.label} [${bar}] ${Math.round((nowMs - running.startedAtMs) / 1000)}s`, { bold: true, color: THEME.warn }))+ rows.push(text(ctx, ` ${spinAt(nowMs)} ${running.label} [${bar}] ${Math.round((nowMs - running.startedAtMs) / 1000)}s`, { bold: true, color: THEME.warn }))}rows.push(@@ -74,7 +75,6 @@ function trainingRows(ctx: Ctx): RenderElement[] {/** Bootstrap, consolidate, and the pattern store: the learning loop's own actions. */function selfLearnRows(ctx: Ctx): RenderElement[] {return [- rule(ctx, 'Self-learning', 'bootstrap, consolidate and teach the ReasoningBank · local, no model calls'),strip(ctx, 'nn-pretrain', [{ id: 'nn-pretrain-shallow', label: 'pretrain: shallow', cost: 'local' }, { id: 'nn-pretrain-medium', label: 'medium', cost: 'local' }, { id: 'nn-pretrain-deep', label: 'deep', cost: 'local' }]),strip(ctx, 'nn-consolidate', [{ id: 'nn-consolidate', label: 'consolidate retained memories', cost: 'local' }]),field(ctx, 'nn-pattern-search', 'pattern search', 'what the stored patterns should be searched for, in words', 'search'),@@ -84,15 +84,30 @@ function selfLearnRows(ctx: Ctx): RenderElement[] {function routerRows(ctx: Ctx): RenderElement[] {return [- rule(ctx, 'Router', 'which agent for this task? · $0, local'),field(ctx, 'nn-route', 'route', 'a task: fix the login bug in auth.ts', 'route'),field(ctx, 'nn-explain', 'explain', 'a task, to see why the router picks its agent', 'explain'),field(ctx, 'nn-predict', 'predict', 'text for the trained models’ top predictions', 'predict'),]}-/** Everything the Learning Lab does, as rows: what was learned, training, self-learning actions and the router. Also drawn, folded, on the Learning page. */-export const neuralActionRows = (ctx: Ctx): RenderElement[] => [...intelligenceRows(ctx), ...trainingRows(ctx), ...selfLearnRows(ctx), ...routerRows(ctx)]+/**+ * Everything the Learning Lab does, as folded sections: what was learned and the router open; training open only while a run is+ * out (so its bar is never hidden) and folded otherwise; the self-learning actions folded. Also drawn, folded, on the Learning page.+ */+export const neuralActionRows = (ctx: Ctx, nested = false): RenderElement[] => {+ const { state } = ctx+ const neural = state.snapshot?.neural ?? null+ const trains = state.auto.trains+ const isTraining = state.lab.running?.id.startsWith('nn-train') === true++ // Nested under the Learning page's own fold, the sections start open, so there is one fold to open, not two.+ return [+ ...section(ctx, 'nn-intel', 'Intelligence', neural === null ? 'no .claude-flow/neural/stats.json' : 'neural/stats.json', intelligenceRows(ctx), true),+ ...section(ctx, 'nn-train', 'Training', `${trains.length} run${trains.length === 1 ? '' : 's'} this session${isTraining ? ' · running' : ''}`, trainingRows(ctx), nested || isTraining),+ ...section(ctx, 'nn-self', 'Self-learning', 'bootstrap, consolidate and teach the ReasoningBank · local, no model calls', selfLearnRows(ctx), nested),+ ...section(ctx, 'nn-router', 'Router', 'which agent for this task? · $0, local', routerRows(ctx), true),+ ]+}/*** The Learning Lab: what ruflo has learned (from its own files), training with a loss sparkline, and the router's