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

feat(ruflo-console): the MetaHarness page folds its sections and lab groups

ruv06a978d92e61
diff --git a/plugins/ruflo-console/hooks/views/metaharness.ts b/plugins/ruflo-console/hooks/views/metaharness.ts
index 4f2b9ca682..1a3785e2ed 100644
--- a/plugins/ruflo-console/hooks/views/metaharness.ts
+++ b/plugins/ruflo-console/hooks/views/metaharness.ts
@@ -1,53 +1,59 @@
import type { RenderElement } from 'claude-code'
import type { Flywheel, HarnessScore } from '../data/cli'
-import { ago, col, kv, live, picture, rule, sourceLine, text, THEME, type Ctx } from './common'
+import { ago, col, kv, live, picture, section, sourceLine, text, THEME, type Ctx } from './common'
import { labRows } from './mh-lab'
/**
* MetaHarness is optional (ADR-150): every line here degrades to "unavailable" with the CLI's reason, and nothing in
- * the console depends on it. Score and flywheel come from the ruflo CLI; the active policy from disk.
+ * the console depends on it. Score and flywheel come from the ruflo CLI; the active policy from disk. Readiness and the
+ * flywheel stay open; the policy and audit trend fold away, and the lab below folds by group.
*/
export function metaharnessView(ctx: Ctx): RenderElement {
const { state, nowMs } = ctx
const score = live<HarnessScore>(state.probes.get('metaharness'))
const flywheel = live<Flywheel>(state.probes.get('flywheel'))
const policy = state.snapshot?.harnessPolicy ?? null
- const rows: RenderElement[] = [rule(ctx, 'Readiness', score?.archetype ?? 'metaharness score')]
+ const readiness: RenderElement[] = []
+ const ledger: RenderElement[] = []
+ const trend: RenderElement[] = []
if (score === null) {
const line = sourceLine(state.probes.get('metaharness'), nowMs, 'MetaHarness')
- rows.push(text(ctx, state.probes.get('metaharness')?.error !== null && state.probes.get('metaharness')?.error !== undefined ? `${line.text} — optional (ADR-150), the console works without it` : line.text, { dimColor: true }))
+ readiness.push(text(ctx, state.probes.get('metaharness')?.error !== null && state.probes.get('metaharness')?.error !== undefined ? `${line.text} — optional (ADR-150), the console works without it` : line.text, { dimColor: true }))
} else {
- rows.push(picture(ctx, 'radar', score.dims.map(dim => `${dim.name} ${dim.value}`).join(' · ')))
- rows.push(
+ readiness.push(picture(ctx, 'radar', score.dims.map(dim => `${dim.name} ${dim.value}`).join(' · ')))
+ readiness.push(
kv(
ctx,
'est. cost/run',
`${score.costUsd === undefined ? 'n/a' : `$${score.costUsd.toFixed(3)}`} · hard constraints ${score.constraints ?? 'n/a'} · scaffold ${score.scaffoldReady === undefined ? 'n/a' : score.scaffoldReady ? 'ready' : 'not ready'} · scored ${ago(score.atMs, nowMs)}`,
),
)
- rows.push(text(ctx, 'static readiness heuristics from `metaharness score`, 0-100 per axis; the radar growing in is decoration', { dimColor: true }))
+ readiness.push(text(ctx, 'static readiness heuristics from `metaharness score`, 0-100 per axis; the radar growing in is decoration', { dimColor: true }))
}
- rows.push(rule(ctx, 'Flywheel', 'receipts ledger'))
-
if (flywheel === null) {
- rows.push(text(ctx, sourceLine(state.probes.get('flywheel'), nowMs, 'flywheel').text, { dimColor: true }))
+ ledger.push(text(ctx, sourceLine(state.probes.get('flywheel'), nowMs, 'flywheel').text, { dimColor: true }))
} else {
- rows.push(kv(ctx, 'ledger', `${flywheel.isLedgerValid ? 'valid' : 'INVALID'} · ${flywheel.commits} commits · ${flywheel.receipts} receipts`, flywheel.isLedgerValid ? THEME.ok : THEME.bad))
- rows.push(kv(ctx, 'champion', flywheel.champion ?? 'none promoted', flywheel.champion !== undefined ? THEME.info : undefined))
- rows.push(kv(ctx, 'serving epoch', flywheel.epoch === undefined ? 'n/a' : String(flywheel.epoch)))
+ ledger.push(kv(ctx, 'ledger', `${flywheel.isLedgerValid ? 'valid' : 'INVALID'} · ${flywheel.commits} commits · ${flywheel.receipts} receipts`, flywheel.isLedgerValid ? THEME.ok : THEME.bad))
+ ledger.push(kv(ctx, 'champion', flywheel.champion ?? 'none promoted', flywheel.champion !== undefined ? THEME.info : undefined))
+ ledger.push(kv(ctx, 'serving epoch', flywheel.epoch === undefined ? 'n/a' : String(flywheel.epoch)))
- for (const error of flywheel.errors) rows.push(text(ctx, `ledger: ${error}`, { color: THEME.bad }))
+ for (const error of flywheel.errors) ledger.push(text(ctx, `ledger: ${error}`, { color: THEME.bad }))
}
- rows.push(kv(ctx, 'active policy', policy === null ? 'n/a — no .claude-flow/harness-active-policy.json' : `${policy.champion.slice(0, 22)}… · ${policy.tier ?? 'n/a'} · ${policy.layer ?? 'n/a'} · applied ${ago(policy.appliedAtMs, nowMs)}`))
- rows.push(rule(ctx, 'Audit trend', 'worst severity per stored audit'))
- rows.push(picture(ctx, 'trend', 'audit trend needs a terminal'))
- rows.push(text(ctx, 'from `metaharness audit-list` (memory namespace metaharness-audit) · ▸ OIA AUDIT below adds one', { dimColor: true }))
- rows.push(...labRows(ctx))
+ trend.push(kv(ctx, 'active policy', policy === null ? 'n/a — no .claude-flow/harness-active-policy.json' : `${policy.champion.slice(0, 22)}… · ${policy.tier ?? 'n/a'} · ${policy.layer ?? 'n/a'} · applied ${ago(policy.appliedAtMs, nowMs)}`))
+ trend.push(picture(ctx, 'trend', 'audit trend needs a terminal'))
+ trend.push(text(ctx, 'from `metaharness audit-list` (memory namespace metaharness-audit) · ▸ OIA AUDIT below adds one', { dimColor: true }))
+
+ const rows: RenderElement[] = [
+ ...section(ctx, 'mh-readiness', 'Readiness', score?.archetype ?? 'metaharness score', readiness, true),
+ ...section(ctx, 'mh-flywheel', 'Flywheel', 'receipts ledger', ledger, true),
+ ...section(ctx, 'mh-trend', 'Policy and audit trend', 'worst severity per stored audit', trend, false),
+ ...labRows(ctx),
+ ]
return col(ctx, rows, 'metaharness')
}
diff --git a/plugins/ruflo-console/hooks/views/mh-lab.ts b/plugins/ruflo-console/hooks/views/mh-lab.ts
index 2097467a55..2d112dbb73 100644
--- a/plugins/ruflo-console/hooks/views/mh-lab.ts
+++ b/plugins/ruflo-console/hooks/views/mh-lab.ts
@@ -2,7 +2,7 @@ import type { RenderElement } from 'claude-code'
import { LAB, LAB_GROUPS, labSpec, PROMOTE_COMMAND, type LabCost, type LabEntry } from '../mh-lab'
import { slot } from './attention'
-import { ago, button, clip, row, rule, text, THEME, type Ctx } from './common'
+import { ago, button, clip, row, rule, section, text, THEME, type Ctx } from './common'
/** Result lines in view at once; j/k scroll the rest. */
export const LAB_ROWS = 14
@@ -83,18 +83,29 @@ export function labRows(ctx: Ctx): RenderElement[] {
const lead = Math.max(14, Math.min(19, ctx.columns - 40))
const rows: RenderElement[] = []
+ // Each group folds: the read-only inspect verbs open, the groups that write or spend fold away, each header naming its cost.
for (const group of LAB_GROUPS) {
- rows.push(rule(ctx, group.title, group.right))
+ const entries = LAB.filter(candidate => candidate.group === group.id)
- for (const entry of LAB.filter(candidate => candidate.group === group.id)) rows.push(entryRow(ctx, entry, lead))
+ rows.push(...section(ctx, `mh-${group.id}`, group.title, `${entries.length} · ${group.right}`, entries.map(entry => entryRow(ctx, entry, lead)), group.id === 'inspect'))
}
rows.push(text(ctx, ' $0 read, runs at once · wr writes · cpu minutes of local work · $$ may spend: each of these asks, its cost on the confirm row', { dimColor: true }))
rows.push(...resultRows(ctx))
- rows.push(rule(ctx, 'Promote', 'a policy act · never from this pane'))
- rows.push(text(ctx, ' Promotion needs a receipt id, an approved Ed25519 public key and --confirm, and passes the policy gate:', { color: THEME.info }))
- rows.push(text(ctx, ` ${PROMOTE_COMMAND}`, { bold: true, color: THEME.warn }))
- rows.push(text(ctx, ' Review the receipt (â–¸ RECEIPTS), then run it yourself in a terminal. The console proposes and evaluates; it never promotes.', { dimColor: true }))
+ rows.push(
+ ...section(
+ ctx,
+ 'mh-promote',
+ 'Promote',
+ 'a policy act · never from this pane',
+ [
+ text(ctx, ' Promotion needs a receipt id, an approved Ed25519 public key and --confirm, and passes the policy gate:', { color: THEME.info }),
+ text(ctx, ` ${PROMOTE_COMMAND}`, { bold: true, color: THEME.warn }),
+ text(ctx, ' Review the receipt (â–¸ RECEIPTS), then run it yourself in a terminal. The console proposes and evaluates; it never promotes.', { dimColor: true }),
+ ],
+ false,
+ ),
+ )
return rows
}