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(ruflo-console): the Security page threw on draw (a missing import); a live run check, a render smoke, and the menu's design through the pages (ADR 431)

ruve3542da7bd1c
diff --git a/plugins/ruflo-console/hooks/menu-colors.ts b/plugins/ruflo-console/hooks/menu-colors.ts
index 4f3e405bdf..4957d46fc6 100644
--- a/plugins/ruflo-console/hooks/menu-colors.ts
+++ b/plugins/ruflo-console/hooks/menu-colors.ts
@@ -38,3 +38,6 @@ export const NAV_ACCENT: Readonly<Record<string, string>> = {
/** The colour of a mission's status line, by tone: running and done green, ready amber, paused cyan, waiting dim. */
export const TONE = { live: '#5fd75f', ready: '#ffaf00', wait: '#8a8a8a', done: '#5fd75f', paused: '#5fd7ff' } as const
+
+/** The ground of a cost chip in a run row, by how much it asks of the person: a read green, local work or a write cyan, the network amber, spending or deleting red. */
+export const COST_CHIP = { ok: '#5fd75f', info: '#5fd7ff', warn: '#ffaf00', bad: '#ff5f5f' } as const
diff --git a/plugins/ruflo-console/hooks/views/automate.ts b/plugins/ruflo-console/hooks/views/automate.ts
index 1d6a6af7e7..e82c55e634 100644
--- a/plugins/ruflo-console/hooks/views/automate.ts
+++ b/plugins/ruflo-console/hooks/views/automate.ts
@@ -7,7 +7,7 @@ import type { LabCost } from '../mh-lab'
import { neuralEntries } from '../neural'
import { slot } from './attention'
import { loopRows } from './loops'
-import { ago, button, clip, col, row, rule, text, THEME, type Ctx } from './common'
+import { ago, button, clip, col, type Ctx, row, rule, tagChip, text, THEME } from './common'
import { selection } from './select'
/** Result lines in view at once; j/k scroll the rest. */
@@ -27,7 +27,7 @@ export type Item = { id: string; label: string; cost: LabCost }
export function strip(ctx: Ctx, key: string, items: readonly Item[]): RenderElement {
return row(
ctx,
- items.flatMap(item => [ctx.kit.Text({ bold: true, color: TAG[item.cost].color(), children: ` ${TAG[item.cost].text}` }), ctx.kit.Button({ key: `run-${item.id}`, label: `â–¸ ${item.label}`, plain: true, onPress: () => void ctx.act.run(item.id) })]),
+ items.flatMap(item => [tagChip(ctx, TAG[item.cost].text, TAG[item.cost].color()), ctx.kit.Button({ key: `run-${item.id}`, label: `â–¸ ${item.label}`, plain: true, onPress: () => void ctx.act.run(item.id) })]),
key,
)
}
diff --git a/plugins/ruflo-console/hooks/views/common.ts b/plugins/ruflo-console/hooks/views/common.ts
index dbbd4c12a2..a27093b0c1 100644
--- a/plugins/ruflo-console/hooks/views/common.ts
+++ b/plugins/ruflo-console/hooks/views/common.ts
@@ -25,6 +25,7 @@ import { START_LABEL, type StartId } from '../starts'
import type { MoreSkillActions } from '../skills-lab'
import { VIEWS, type HarnessId, type NavStyle, type State, type ViewId } from '../state'
import type { UpdatesMode } from '../updates'
+import { COST_CHIP, INK } from '../menu-colors'
import { accentOfView } from '../nav-state'
import type { VectorActions } from '../vector'
@@ -143,6 +144,19 @@ export function setLook(next: Look): void {
export const isBbs = (): boolean => look === 'bbs'
+/**
+ * A cost tag (`$0`, `wr`, `net`, `$$`) on a run row. In the BBS look it is a solid chip, the way the menu draws a key: the ink on a ground
+ * by how much the run asks (a read green, local work or a write cyan, the network amber, spending or deleting red). In the plain look it
+ * is coloured text, as it always was. `color` is the tag's theme colour; a colour that is none of the four stays text.
+ */
+export function tagChip(ctx: Ctx, text: string, color: string): RenderElement {
+ const ground = look !== 'bbs' ? undefined : color === THEME.ok ? COST_CHIP.ok : color === THEME.info ? COST_CHIP.info : color === THEME.warn ? COST_CHIP.warn : color === THEME.bad ? COST_CHIP.bad : undefined
+
+ if (ground === undefined) return ctx.kit.Text({ bold: true, color, children: ` ${text}` })
+
+ return ctx.kit.Box({ flexDirection: 'row', children: [ctx.kit.Text({ children: ' ' }), ctx.kit.Text({ bold: true, color: INK, backgroundColor: ground, children: text })] })
+}
+
export const clip = (text: string, width: number): string => (text.length <= width ? text : `${text.slice(0, Math.max(0, width - 1))}…`)
export function ago(atMs: number | null | undefined, nowMs: number): string {
diff --git a/plugins/ruflo-console/hooks/views/devtools.ts b/plugins/ruflo-console/hooks/views/devtools.ts
index 2c715b0880..54ae759c47 100644
--- a/plugins/ruflo-console/hooks/views/devtools.ts
+++ b/plugins/ruflo-console/hooks/views/devtools.ts
@@ -3,7 +3,7 @@ import type { RenderElement } from 'claude-code'
import type { DevField } from '../data/devtools'
import { DEV, DEV_GROUPS, devSpec, type DevCost, type DevEntry, type DevGroup } from '../devtools'
import { slot } from './attention'
-import { ago, button, clip, col, row, section, text, THEME, type Ctx } from './common'
+import { ago, button, clip, col, type Ctx, row, section, tagChip, text, THEME } from './common'
import { spinAt } from '../spinner'
import { sendResultRow } from './secure'
@@ -50,7 +50,7 @@ function entryRow(ctx: Ctx, entry: DevEntry, lead: number): RenderElement {
return row(
ctx,
[
- ctx.kit.Text({ bold: true, color: isNa ? THEME.info : tag.color(), dimColor: isNa, children: ` ${isNa ? 'n/a ' : tag.text}` }),
+ isNa ? ctx.kit.Text({ bold: true, color: THEME.info, dimColor: true, children: ` ${'n/a '}` }) : tagChip(ctx, tag.text, tag.color()),
ctx.kit.Text({ bold: true, color: entry.cost === 'spends' || entry.cost === 'deletes' ? THEME.warn : THEME.head, dimColor: isNa, children: clip(` ${entry.name} `, lead).padEnd(lead, '.') }),
ctx.kit.Text({ color: THEME.info, dimColor: isNa || isBlocked, wrap: 'truncate-end', children: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 16)) }),
// A blocked row keeps its button: pressing it says which field to fill. The button is primary, the one action on the row.
diff --git a/plugins/ruflo-console/hooks/views/memory-lab.ts b/plugins/ruflo-console/hooks/views/memory-lab.ts
index 53a9cd02df..791396cb1b 100644
--- a/plugins/ruflo-console/hooks/views/memory-lab.ts
+++ b/plugins/ruflo-console/hooks/views/memory-lab.ts
@@ -1,7 +1,7 @@
import type { RenderElement } from 'claude-code'
import { MEM_GROUPS, MEM_LAB, memSpecOf, textOfFields, type MemCost, type MemEntry, type MemField } from '../memory-lab'
-import { ago, button, clip, confirmHere, row, rule, section, text, THEME, type Ctx } from './common'
+import { ago, button, clip, confirmHere, type Ctx, row, rule, section, tagChip, text, THEME } from './common'
/** Result lines in view at once; j/k scroll the rest. */
export const MEM_ROWS = 16
@@ -71,7 +71,7 @@ function entryRow(ctx: Ctx, entry: MemEntry, lead: number): RenderElement {
return row(
ctx,
[
- ctx.kit.Text({ bold: true, color: tag.color(), children: ` ${tag.text}` }),
+ tagChip(ctx, tag.text, tag.color()),
ctx.kit.Text({ bold: true, color: entry.cost === 'deletes' ? THEME.bad : THEME.head, children: ` ${entry.name} `.padEnd(lead, '.') }),
ctx.kit.Text({ color: THEME.info, dimColor: !isReady, wrap: 'truncate-end', children: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 16)) }),
ctx.kit.Button({ key: `mem-lab-${entry.id}`, label: ' â–¸ run', plain: true, dimColor: true, onPress: () => ctx.act.memory.run(entry.id) }),
diff --git a/plugins/ruflo-console/hooks/views/mh-lab.ts b/plugins/ruflo-console/hooks/views/mh-lab.ts
index 0595f57d1e..0be18e348f 100644
--- a/plugins/ruflo-console/hooks/views/mh-lab.ts
+++ b/plugins/ruflo-console/hooks/views/mh-lab.ts
@@ -3,7 +3,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 { sendResultRow } from './secure'
-import { ago, button, clip, row, rule, section, text, THEME, type Ctx } from './common'
+import { ago, button, clip, type Ctx, row, rule, section, tagChip, text, THEME } from './common'
/** Result lines in view at once; j/k scroll the rest. */
export const LAB_ROWS = 14
@@ -26,7 +26,7 @@ function entryRow(ctx: Ctx, entry: LabEntry, lead: number): RenderElement {
return row(
ctx,
[
- ctx.kit.Text({ bold: true, color: tag.color(), children: ` ${tag.text}` }),
+ tagChip(ctx, tag.text, tag.color()),
ctx.kit.Text({ bold: true, color: entry.cost === 'spends' ? THEME.warn : THEME.head, children: ` ${entry.name} `.padEnd(lead, '.') }),
ctx.kit.Text({ color: THEME.info, dimColor: isBlocked, wrap: 'truncate-end', children: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 18)) }),
// A verb that needs a path types its command into the terminal, which asks before it runs.
diff --git a/plugins/ruflo-console/hooks/views/nav.ts b/plugins/ruflo-console/hooks/views/nav.ts
index 966326a432..a11c9ab5b0 100644
--- a/plugins/ruflo-console/hooks/views/nav.ts
+++ b/plugins/ruflo-console/hooks/views/nav.ts
@@ -8,7 +8,9 @@
*/
import type { RenderElement } from 'claude-code'
-import { findPages, NAV_GROUPS, shownGroup } from '../nav-state'
+import { INK, NAV_ACCENT } from '../menu-colors'
+import { badgesOf } from '../menu-style'
+import { accentOfView, findPages, NAV_GROUPS, shownGroup } from '../nav-state'
import { VIEWS, type ViewId } from '../state'
import { CARD_COLUMNS } from './card'
import { isBbs, THEME, type Ctx } from './common'
@@ -29,7 +31,10 @@ export function groupedTabs(ctx: Ctx, hasHotkey: (view: View) => boolean): Rende
// What a page spells: its icon, and from `brief` a short name, from `full` the whole name. The engine puts a hotkey in front ("3: ").
const spell = (view: View, form: string) => (form === 'icons' ? view.icon : form === 'brief' ? `${view.icon} ${view.short}` : `${view.icon} ${view.label}`)
- const cells = (view: View, form: string) => (hasHotkey(view) && view.key !== '' ? 3 : 0) + spell(view, form).length + 3
+ // The same badges the menu carries (approvals waiting, findings, an update ...), so the nav says what is going on behind a page too.
+ const badges = badgesOf(state, ctx.nowMs)
+ const badgeText = (view: View): string => (badges[view.id] === undefined ? '' : ` ${badges[view.id]?.text}`)
+ const cells = (view: View, form: string) => (hasHotkey(view) && view.key !== '' ? 3 : 0) + spell(view, form).length + badgeText(view).length + 3
const widest = (form: string) => Math.max(0, ...pages.map(ids => ids.reduce((sum, id) => sum + (find(id) === undefined ? 0 : cells(find(id) as View, form)), 0)))
// auto: the richest form whose widest row fits the page; the others are the person's choice (Settings).
const form = state.nav === 'auto' ? (['full', 'brief'].find(candidate => widest(candidate) <= inner) ?? 'icons') : state.nav
@@ -39,9 +44,11 @@ export function groupedTabs(ctx: Ctx, hasHotkey: (view: View) => boolean): Rende
const prefix = view.key === '' ? '' : `${view.key}: `
// The open page names itself whatever the style, as the flat tab bar did: [3: 📌 CLAIMS], [0: 📟 MAIN MENU].
- if (view.id === open) return ctx.kit.Box({ key: `tab-${view.id}`, children: [ctx.kit.Text({ bold: true, color: THEME.head, wrap: 'truncate-end', children: isBbs() ? `[${prefix}${view.icon} ${view.label.toUpperCase()}]` : `${prefix}${view.icon} ${view.label}` })] })
+ const accent = isBbs() ? accentOfView(view.id) : null
- return ctx.kit.Button({ key: `tab-${view.id}`, label: ` ${words} `, ...(hasHotkey(view) && view.key !== '' && { hotkey: view.key }), plain: true, dimColor: true, onPress: () => ctx.act.view(view.id) })
+ if (view.id === open) return ctx.kit.Box({ key: `tab-${view.id}`, children: [ctx.kit.Text({ bold: true, color: accent === null ? THEME.head : INK, ...(accent !== null && { backgroundColor: accent }), wrap: 'truncate-end', children: isBbs() ? `[${prefix}${view.icon} ${view.label.toUpperCase()}]` : `${prefix}${view.icon} ${view.label}` })] })
+
+ return ctx.kit.Button({ key: `tab-${view.id}`, label: ` ${words}${badgeText(view)} `, ...(hasHotkey(view) && view.key !== '' && { hotkey: view.key }), plain: true, dimColor: true, onPress: () => ctx.act.view(view.id) })
}
const menu = find('menu')
@@ -51,7 +58,7 @@ export function groupedTabs(ctx: Ctx, hasHotkey: (view: View) => boolean): Rende
const isSearchInline = inner - chipCells >= 28
const chips = NAV_GROUPS.map(group =>
group.title === shown && found === null
- ? ctx.kit.Box({ key: `nav-group-${group.title}`, children: [ctx.kit.Text({ bold: true, color: THEME.head, children: `[${icons ? `${group.icon} ` : ''}${group.title} â–¾]` })] })
+ ? ctx.kit.Box({ key: `nav-group-${group.title}`, children: [ctx.kit.Text({ bold: true, color: isBbs() ? INK : THEME.head, ...(isBbs() && { backgroundColor: NAV_ACCENT[group.title] ?? THEME.head }), children: `[${icons ? `${group.icon} ` : ''}${group.title} â–¾]` })] })
: ctx.kit.Button({ key: `nav-group-${group.title}`, label: ` ${icons ? `${group.icon} ` : ''}${group.title} `, plain: true, dimColor: true, onPress: () => ctx.act.navigator.group(group.title) }),
)
const Input = ctx.kit.Input
diff --git a/plugins/ruflo-console/hooks/views/secure.ts b/plugins/ruflo-console/hooks/views/secure.ts
index 461d8b6bea..b404795dfa 100644
--- a/plugins/ruflo-console/hooks/views/secure.ts
+++ b/plugins/ruflo-console/hooks/views/secure.ts
@@ -3,7 +3,8 @@ import type { RenderElement } from 'claude-code'
import { DOCTOR_COMPONENTS, isSecureResult, SECURE, SECURE_TEXT, secMemo, SEVERITIES, type SecCost, type Severity } from '../secure'
import { slot } from './attention'
import { spinAt } from '../spinner'
-import { ago, button, clip, col, row, rule, section, text, THEME, type Ctx } from './common'
+import { sentryRows } from './sentries'
+import { ago, button, clip, col, type Ctx, row, rule, section, tagChip, text, THEME } from './common'
/** Result lines in view at once; j/k scroll the rest. */
export const RESULT_ROWS = 14
@@ -27,7 +28,7 @@ export function entryRow(ctx: Ctx, entry: { id: string; name: string; about: str
return row(
ctx,
[
- ctx.kit.Text({ bold: true, color: tag.color(), children: ` ${tag.text}` }),
+ tagChip(ctx, tag.text, tag.color()),
ctx.kit.Text({ bold: true, color: THEME.head, children: ` ${entry.name} `.padEnd(lead, '.') }),
ctx.kit.Text({ color: THEME.info, dimColor: waiting, wrap: 'truncate-end', children: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 34)) }),
// The run is the row's one action, so it is a primary button: it is the first thing the eye finds. Waiting on text, it is plain.
diff --git a/plugins/ruflo-console/hooks/views/vector.ts b/plugins/ruflo-console/hooks/views/vector.ts
index 2c6df5632d..d68b24fd9f 100644
--- a/plugins/ruflo-console/hooks/views/vector.ts
+++ b/plugins/ruflo-console/hooks/views/vector.ts
@@ -3,7 +3,7 @@ import type { RenderElement } from 'claude-code'
import { targetOf, type VectorField } from '../data/vector'
import { VEC, VEC_SECTIONS, vecSpec, type VecCost, type VecEntry, type VecSection } from '../vector'
import { slot } from './attention'
-import { ago, button, clip, row, rule, text, THEME, type Ctx } from './common'
+import { ago, button, clip, type Ctx, row, rule, tagChip, text, THEME } from './common'
/** Result lines in view at once; j/k scroll the rest. */
export const VEC_ROWS = 12
@@ -62,7 +62,7 @@ function entryRow(ctx: Ctx, entry: VecEntry, lead: number): RenderElement {
return row(
ctx,
[
- ctx.kit.Text({ bold: true, color: isNa ? THEME.info : tag.color(), dimColor: isNa, children: ` ${isNa ? ' -- ' : tag.text}` }),
+ isNa ? ctx.kit.Text({ bold: true, color: THEME.info, dimColor: true, children: ` ${' -- '}` }) : tagChip(ctx, tag.text, tag.color()),
ctx.kit.Text({ bold: true, color: entry.cost === 'deletes' || entry.cost === 'publish' || entry.cost === 'spends' ? THEME.warn : THEME.head, dimColor: isNa, children: ` ${entry.name} `.padEnd(lead, '.') }),
ctx.kit.Text({ color: THEME.info, dimColor: isNa || isBlocked, wrap: 'truncate-end', children: clip(` ${isNa ? (entry.na ?? '') : entry.about}`, Math.max(4, ctx.columns - lead - 16)) }),
isNa
diff --git a/plugins/ruflo-console/hooks/views/xruv.ts b/plugins/ruflo-console/hooks/views/xruv.ts
index b716d0dd11..4079d6ec7b 100644
--- a/plugins/ruflo-console/hooks/views/xruv.ts
+++ b/plugins/ruflo-console/hooks/views/xruv.ts
@@ -3,7 +3,7 @@ import type { RenderElement } from 'claude-code'
import type { Channels, Registry, Roster } from '../data/cli'
import type { SwarmMessages, WorkClaims } from '../data/xruv'
import { BBS_SERVE_COMMAND, INVITE_COMMAND, UNREGISTER_WHY, XRUV, type XEntry, type XGroup } from '../xruv'
-import { ago, button, clip, col, kv, live, row, rule, sourceLine, text, THEME, type Ctx } from './common'
+import { ago, button, clip, col, type Ctx, kv, live, row, rule, sourceLine, tagChip, text, THEME } from './common'
/** Result lines in view at once; j/k scroll the rest. */
export const XRUV_ROWS = 8
@@ -49,7 +49,7 @@ function entryRow(ctx: Ctx, entry: XEntry, lead: number): RenderElement {
return row(
ctx,
[
- ctx.kit.Text({ bold: true, color: tag.color(), children: ` ${tag.text}` }),
+ tagChip(ctx, tag.text, tag.color()),
ctx.kit.Button({ key: `xr-name-${entry.id}`, label: ` ${entry.name} `.padEnd(lead, '.'), plain: true, onPress: press }),
ctx.kit.Button({ key: `xr-about-${entry.id}`, label: clip(` ${entry.about}`, Math.max(4, ctx.columns - lead - 18)), plain: true, dimColor: true, onPress: press }),
...(action === null ? [] : [action]),
diff --git a/plugins/ruflo-console/tests/design.spec.ts b/plugins/ruflo-console/tests/design.spec.ts
new file mode 100644
index 0000000000..355c2edd6f
--- /dev/null
+++ b/plugins/ruflo-console/tests/design.spec.ts
@@ -0,0 +1,127 @@
+/**
+ * The menu's design carried through the pages, without the Claude Code test kit: a fake kit records what is drawn. A cost tag is a solid
+ * chip in the BBS look and coloured text in the plain one; the nav's open page and group are solid chips in the page's accent, and its
+ * page buttons carry the same badges as the menu, without ever pushing a row past its width. Run with
+ * npx vitest run plugins/ruflo-console/tests/design.spec.ts
+ */
+import { afterEach, describe, expect, it } from 'vitest'
+
+import { COST_CHIP, INK, NAV_ACCENT } from '../hooks/menu-colors'
+import { newState, type State, type ViewId } from '../hooks/state'
+import { CARD_COLUMNS } from '../hooks/views/card'
+import { setLook, tagChip, THEME, type Actions, type Ctx } from '../hooks/views/common'
+import { groupedTabs } from '../hooks/views/nav'
+
+type El = { kind: string; props: Record<string, unknown> }
+
+const kit = { Box: (props: Record<string, unknown>): El => ({ kind: 'Box', props }), Text: (props: Record<string, unknown>): El => ({ kind: 'Text', props }), Button: (props: Record<string, unknown>): El => ({ kind: 'Button', props }), Input: (props: Record<string, unknown>): El => ({ kind: 'Input', props }) }
+const act: Actions = (() => {
+ const proxy: unknown = new Proxy(() => undefined, { get: (_t, key) => (key === 'then' ? undefined : proxy), apply: () => undefined })
+
+ return proxy as Actions
+})()
+const ctxOf = (state: State, columns = 120): Ctx => ({ kit, state, nowMs: 5_000, columns, pictures: new Map(), act, cards: true }) as unknown as Ctx
+const flat = (el: unknown): El[] => {
+ const node = el as El
+
+ if (typeof node !== 'object' || node === null) return []
+
+ const kids = node.props.children
+
+ return [node, ...(Array.isArray(kids) ? kids.flatMap(flat) : typeof kids === 'object' ? flat(kids) : [])]
+}
+const texts = (el: unknown): El[] => flat(el).filter(node => node.kind === 'Text')
+const tab = (el: unknown, view: ViewId): El | undefined => flat(el).find(node => node.props.key === `tab-${view}`)
+
+afterEach(() => setLook('plain'))
+
+describe('a cost tag', () => {
+ const chip = (color: string): El => tagChip(ctxOf(newState({})), ' $0 ', color) as unknown as El
+
+ it('is a solid chip in the BBS look, on a ground by how much the run asks', () => {
+ setLook('bbs')
+
+ for (const [color, ground] of [[THEME.ok, COST_CHIP.ok], [THEME.info, COST_CHIP.info], [THEME.warn, COST_CHIP.warn], [THEME.bad, COST_CHIP.bad]] as const) {
+ const shown = texts(chip(color)).find(node => node.props.backgroundColor !== undefined)
+
+ expect(shown?.props, color).toMatchObject({ backgroundColor: ground, color: INK, bold: true, children: ' $0 ' })
+ }
+ })
+
+ it('stays coloured text in the plain look, as it always was, and a colour that is none of the four is text in either', () => {
+ setLook('plain')
+ expect(chip(THEME.ok)).toMatchObject({ kind: 'Text', props: { color: THEME.ok, children: ' $0 ' } })
+ expect(flat(chip(THEME.ok)).some(node => node.props.backgroundColor !== undefined)).toBe(false)
+
+ setLook('bbs')
+ expect(chip(THEME.head)).toMatchObject({ kind: 'Text' })
+ })
+})
+
+describe('the nav card', () => {
+ const open = (view: ViewId, columns = 120, mutate: (state: State) => void = () => undefined): { card: El; state: State } => {
+ const state = newState({})
+
+ state.view = view
+ mutate(state)
+
+ return { card: groupedTabs(ctxOf(state, columns), () => true) as unknown as El, state }
+ }
+
+ it('draws the open page as a solid chip in its group\'s accent in the BBS look, and as text in the plain one', () => {
+ setLook('bbs')
+
+ const bbs = tab(open('secure').card, 'secure')
+ const chipText = texts(bbs).find(node => String(node.props.children).includes('SECURITY & DOCTOR'))
+
+ expect(chipText?.props).toMatchObject({ backgroundColor: NAV_ACCENT.SAFETY, color: INK, bold: true, children: '[u: 🔒 SECURITY & DOCTOR]' })
+
+ setLook('plain')
+
+ const plain = texts(tab(open('secure').card, 'secure')).find(node => String(node.props.children).includes('Security & Doctor'))
+
+ expect(plain?.props.backgroundColor).toBeUndefined()
+ expect(plain?.props.children).toBe('u: 🔒 Security & Doctor')
+ })
+
+ it('draws the open group as a solid chip in its accent', () => {
+ setLook('bbs')
+
+ const group = texts(open('secure').card).find(node => String(node.props.children).includes('SAFETY â–¾'))
+
+ expect(group?.props).toMatchObject({ backgroundColor: NAV_ACCENT.SAFETY, color: INK })
+ })
+
+ it('puts the menu\'s badges on the page buttons: spend on Cost, an update on Settings', () => {
+ const cost = open('learning', 140, state => {
+ state.usage = { costUsd: 19.81 }
+ })
+ const settings = open('terminal', 140, state => {
+ state.updateAvailable = '0.27.0'
+ })
+
+ expect(String(tab(cost.card, 'cost')?.props.label)).toContain('$19.81')
+ expect(String(tab(settings.card, 'settings')?.props.label)).toContain('⬆ 0.27.0')
+ // And none where there is nothing to say.
+ expect(String(tab(open('learning', 140).card, 'cost')?.props.label)).not.toMatch(/\$\d/)
+ })
+
+ it('never lets a badge push a row of pages past the width, at any width the nav draws', () => {
+ // Every width, not a few: the auto form is chosen by whether the widest row fits, so an uncounted badge only overruns in the narrow
+ // window of widths where that choice is on the edge.
+ for (let columns = 50; columns <= 200; columns++) {
+ const { card } = open('learning', columns, state => {
+ state.usage = { costUsd: 1234.5 }
+ state.updateAvailable = '10.20.30'
+ })
+ const inner = columns - CARD_COLUMNS
+
+ for (const row of flat(card).filter(node => String(node.props.key).startsWith('tabs-row-'))) {
+ // A button draws its label with a space of gap beside it, and the engine puts "k: " in front of one that has a hotkey.
+ const used = flat(row).reduce((sum, node) => sum + (node.kind === 'Button' ? String(node.props.label).length + (node.props.hotkey === undefined ? 0 : 3) + 1 : node.kind === 'Text' && typeof node.props.children === 'string' ? node.props.children.length + 1 : 0), 0)
+
+ expect(used, `${columns} columns, ${String(row.props.key)}`).toBeLessThanOrEqual(inner)
+ }
+ }
+ })
+})
diff --git a/plugins/ruflo-console/tests/live-read.spec.ts b/plugins/ruflo-console/tests/live-read.spec.ts
new file mode 100644
index 0000000000..90b70804fd
--- /dev/null
+++ b/plugins/ruflo-console/tests/live-read.spec.ts
@@ -0,0 +1,157 @@
+/**
+ * Live: every read-only run button, against the real CLI. The self-check (tests/self-check.spec.ts) proves each command is built right;
+ * this proves it runs. It takes every runnable id the palette lists (the same catalog a button press resolves through), keeps the ones
+ * that are read-only ($0, local, run at once without a confirm), runs each exactly as a press would (the console's default `npx
+ * --offline -y @claude-flow/cli@latest`) in a scratch directory, and applies the entry's own reader to what it printed.
+ *
+ * A pass is an exit 0 with lines to show. A warning is a non-zero exit that still printed something readable: many verbs exit 1 when they
+ * find something, and the console shows that output. A failure is the CLI not knowing the command (the registry has drifted from it), a
+ * reader that throws, a hang, or nothing printed at all. It is off by default (it starts a process per command), so run it with
+ * RUFLO_LIVE=1 npx vitest run plugins/ruflo-console/tests/live-read.spec.ts
+ */
+import { execFile } from 'node:child_process'
+import { mkdtempSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+
+import { describe, expect, it } from 'vitest'
+
+import type { ActionSpec } from '../hooks/actions'
+import { labLines } from '../hooks/mh-lab'
+import { paletteEntries } from '../hooks/palette'
+import { CLI_PREFIXES, newState } from '../hooks/state'
+
+const LIVE = process.env.RUFLO_LIVE === '1'
+const CONCURRENCY = 8
+const CAP_MS = 60_000
+/** Free text, an action type, a ref, a word, a pattern and an epoch count: the first that builds a command for a verb that takes text. */
+const SAMPLES = ['hello world', 'deploy', 'HEAD', 'auth', 'coordination 3']
+/** What the CLI says when it does not know a command or an option: the registry has drifted from it. */
+const UNKNOWN = /\b(unknown (command|option|argument|subcommand)|unrecognized (command|option|argument)|invalid (command|subcommand)|command not found|no such command|did you mean|required option|missing required|unexpected argument|too many arguments)\b/i
+
+type Found = { id: string; spec: ActionSpec }
+type Outcome = { id: string; grade: 'pass' | 'warn' | 'fail'; detail: string; ms: number }
+
+/** Every read-only spec the palette offers, through the same call a press makes; a verb that takes text is tried with each sample. */
+function readOnlySpecs(): { found: Found[]; skipped: { id: string; why: string }[] } {
+ const state = newState({})
+ const found = new Map<string, Found>()
+ const skipped: { id: string; why: string }[] = []
+
+ for (const entry of paletteEntries(state, Date.now())) {
+ const run = entry.run
+ const spec = run.kind === 'spec' ? run.spec : run.kind === 'text' ? SAMPLES.map(sample => run.make(sample)).find(made => made !== null) ?? null : null
+
+ if (spec === null || spec === undefined) continue
+ if (spec.isReadOnly !== true) continue
+ // Not a ruflo CLI call (a fixed command, or a closure that does its own thing): not what this checks.
+ if (spec.argv !== undefined || spec.run !== undefined || spec.args.length === 0) {
+ skipped.push({ id: entry.id, why: spec.argv !== undefined ? 'a fixed command outside ruflo' : 'runs its own code' })
+
+ continue
+ }
+
+ found.set(entry.id, { id: entry.id, spec })
+ }
+
+ return { found: [...found.values()], skipped }
+}
+
+function execute(argv: readonly string[], cwd: string, timeoutMs: number, stdin?: string): Promise<{ code: number | null; stdout: string; stderr: string; timedOut: boolean; spawnError: string | null }> {
+ return new Promise(resolve => {
+ const [file, ...rest] = argv as [string, ...string[]]
+ const child = execFile(file, rest, { cwd, timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024, env: { ...process.env, NO_COLOR: '1', CI: '1', FORCE_COLOR: '0' } }, (error, stdout, stderr) => {
+ const failure = error as (Error & { code?: number | string; killed?: boolean }) | null
+
+ resolve({ code: failure === null ? 0 : typeof failure.code === 'number' ? failure.code : null, stdout, stderr, timedOut: failure?.killed === true, spawnError: failure !== null && typeof failure.code === 'string' ? failure.code : null })
+ })
+
+ if (stdin !== undefined) child.stdin?.end(stdin)
+ })
+}
+
+async function grade({ id, spec }: Found, cwd: string): Promise<Outcome> {
+ const started = Date.now()
+ const argv = [...CLI_PREFIXES['npx-offline'], ...spec.args]
+ const done = (g: Outcome['grade'], detail: string): Outcome => ({ id, grade: g, detail, ms: Date.now() - started })
+ const ran = await execute(argv, cwd, Math.min(spec.timeoutMs ?? 90_000, CAP_MS), spec.stdin)
+ const text = `${ran.stdout}\n${ran.stderr}`
+
+ if (ran.spawnError !== null) return done('fail', `could not start: ${ran.spawnError}`)
+ if (ran.timedOut) return done('fail', `no answer in ${Math.round(Math.min(spec.timeoutMs ?? 90_000, CAP_MS) / 1000)} s`)
+ if (UNKNOWN.test(text)) return done('fail', `the CLI does not know this: ${(text.split('\n').find(line => UNKNOWN.test(line)) ?? '').trim().slice(0, 110)}`)
+
+ // The runner's own test of whether a run went well, and its own order for what the result panel shows (runner.ts, execute): the spec's
+ // `read`, else its `lines`, else the lab's reading keyed on the lab id; a run with no lab id shows the CLI's own text.
+ const answer = /"success"\s*:\s*(true|false)/.exec(ran.stdout)?.[1]
+ const error = /"error"\s*:\s*"([^"]{0,160})"/.exec(ran.stdout)?.[1] ?? /\[ERROR\]\s*(.{0,160})/.exec(ran.stdout)?.[1]
+ const ok = ran.code === 0 && answer !== 'false' && error === undefined && !/"isError"\s*:\s*true/.test(ran.stdout)
+ let lines: string[]
+
+ try {
+ lines = spec.lab !== undefined ? (spec.read?.(ran.stdout, ran.stderr, ok) ?? (spec.lines ?? ((out, err) => labLines(spec.lab ?? '', out, err)))(ran.stdout, ran.stderr)) : (spec.lines?.(ran.stdout, ran.stderr) ?? `${ran.stdout}\n${ran.stderr}`.split('\n'))
+ } catch (error) {
+ return done('fail', `its reader threw: ${error instanceof Error ? error.message : String(error)}`)
+ }
+
+ const shown = lines.filter(line => line.trim() !== '' && !/: printed nothing$/.test(line))
+
+ if (shown.length === 0) return done('fail', ran.code === 0 ? 'exit 0 and the panel would be empty' : `exit ${ran.code} and the panel would be empty`)
+
+ const first = (shown[0] ?? '').trim().slice(0, 90)
+
+ // Not ok is not broken: a project with no audits, no database or no suite answers so, and the panel shows it. It is told apart from
+ // a command that does not work by the checks above (the CLI not knowing it, a reader that throws, an empty panel).
+ return ok ? done('pass', `${shown.length} lines`) : done('warn', `exit ${ran.code}: ${first}`)
+}
+
+/** Runs `items` with at most `limit` at a time. */
+async function pool<T, R>(items: readonly T[], limit: number, work: (item: T) => Promise<R>): Promise<R[]> {
+ const out: R[] = new Array(items.length)
+ let next = 0
+
+ await Promise.all(
+ Array.from({ length: Math.min(limit, items.length) }, async () => {
+ while (next < items.length) {
+ const at = next++
+
+ out[at] = await work(items[at] as T)
+ }
+ }),
+ )
+
+ return out
+}
+
+describe('the palette, offline', () => {
+ it('lists read-only runs to check, through the same call a press makes', () => {
+ const { found } = readOnlySpecs()
+
+ expect(found.length).toBeGreaterThan(30)
+ for (const { spec } of found) expect(spec.args.every(part => typeof part === 'string' && part !== '')).toBe(true)
+ })
+})
+
+describe.skipIf(!LIVE)('live: every read-only run button against the real CLI', () => {
+ it(
+ 'runs, and says something a person can read',
+ async () => {
+ const { found, skipped } = readOnlySpecs()
+ const scratch = mkdtempSync(join(tmpdir(), 'ruflo-live-'))
+
+ try {
+ const outcomes = await pool(found, CONCURRENCY, entry => grade(entry, scratch))
+ const by = (g: Outcome['grade']) => outcomes.filter(outcome => outcome.grade === g)
+ const line = (outcome: Outcome) => ` ${outcome.grade.toUpperCase().padEnd(4)} ${outcome.id.padEnd(30)} ${String(outcome.ms).padStart(5)} ms ${outcome.detail}`
+
+ // eslint-disable-next-line no-console
+ console.log(`\nlive read-only runs: ${found.length} run, ${by('pass').length} pass, ${by('warn').length} warn, ${by('fail').length} fail, ${skipped.length} skipped (not a ruflo CLI call)\n${[...by('fail'), ...by('warn')].map(line).join('\n')}\n`)
+
+ expect(by('fail').map(line)).toEqual([])
+ } finally {
+ rmSync(scratch, { recursive: true, force: true })
+ }
+ },
+ 600_000,
+ )
+})
diff --git a/plugins/ruflo-console/tests/render-smoke.spec.ts b/plugins/ruflo-console/tests/render-smoke.spec.ts
new file mode 100644
index 0000000000..ef33860022
--- /dev/null
+++ b/plugins/ruflo-console/tests/render-smoke.spec.ts
@@ -0,0 +1,84 @@
+/**
+ * Every page draws, in both looks and at three widths, with an empty project and a busy one. Without the Claude Code test kit (the
+ * kit tests need the host package), this runs each view's real code through `viewText`, the console's own text renderer, so a view that
+ * calls a name it never imported, reads a field that is not there, or prints `undefined` fails here instead of when someone opens it.
+ * (It exists because the Security page called `sentryRows` without importing it: nothing in the pure specs rendered that view.)
+ * Run with
+ * npx vitest run plugins/ruflo-console/tests/render-smoke.spec.ts
+ */
+import { afterAll, describe, expect, it } from 'vitest'
+
+import type { ReadCache } from '../hooks/data/files'
+import { readSnapshot } from '../hooks/data/snapshot'
+import { secMemo } from '../hooks/secure'
+import { newState, VIEWS, type State } from '../hooks/state'
+import { setLook, type Actions } from '../hooks/views/common'
+import { viewText } from '../hooks/views/pane'
+import { RUFLO_FILES } from './fixtures/ruflo-run'
+
+/** An `act` whose every property is itself, and callable: a view that reaches into it while drawing gets something, never a TypeError. */
+const act: Actions = (() => {
+ const handler: ProxyHandler<() => void> = { get: (_target, key) => (key === 'then' ? undefined : proxy), apply: () => undefined }
+ const proxy: unknown = new Proxy(() => undefined, handler)
+
+ return proxy as Actions
+})()
+
+const memoryFs = (files: Record<string, string>) => ({
+ read: async (path: string) => files[path] ?? Promise.reject(new Error('ENOENT')),
+ stat: async (path: string) => (files[path] !== undefined ? { mtimeMs: 1, size: (files[path] as string).length } : Promise.reject(new Error('ENOENT'))),
+ list: async () => Promise.reject(new Error('ENOENT')),
+})
+
+/** A busy project: a read snapshot with agents, claims and tasks, spend, findings, an update on offer, a terminal run. */
+async function busyState(): Promise<State> {
+ const files = {
+ ...Object.fromEntries(Object.entries(RUFLO_FILES).map(([path, text]) => [`/work/${path}`, text])),
+ '/home/dev/.claude/plugins/known_marketplaces.json': JSON.stringify({ ruflo: { installLocation: '/home/dev/m/ruflo' } }),
+ '/home/dev/m/ruflo/.claude-plugin/marketplace.json': JSON.stringify({ plugins: [{ name: 'ruflo-core' }, { name: 'ruflo-swarm' }] }),
+ }
+ const state = newState({})
+
+ state.snapshot = await readSnapshot(memoryFs(files), new Map() as ReadCache, '/work', '/home/dev', {}, 0)
+ state.usage = { costUsd: 19.81, contextPercent: 40 }
+ state.updateAvailable = '0.27.0'
+ state.events.push({ atMs: 1_000, kind: 'claims', text: 'claude: Bash' })
+ secMemo(state).findings = { source: 'scan', counts: { critical: 1, high: 235, medium: 60, low: 0 }, atMs: 0 }
+ state.terminal.runs.set('codex', { label: 'codex', startedAtMs: 0, stop: () => undefined })
+
+ return state
+}
+
+const NOISE = /\[object Object\]|\bundefined\b|\bNaN\b/
+
+afterAll(() => setLook('plain'))
+
+describe('every page draws', () => {
+ for (const look of ['bbs', 'plain'] as const) {
+ for (const columns of [60, 100, 160]) {
+ it(`in the ${look} look at ${columns} columns, empty and busy`, async () => {
+ setLook(look)
+
+ const busy = await busyState()
+ const problems: string[] = []
+
+ for (const [name, state] of [['empty', newState({})], ['busy', busy]] as const) {
+ for (const view of VIEWS) {
+ state.view = view.id
+
+ try {
+ const text = viewText({ state, nowMs: 5_000, columns, act }, view.id)
+
+ if (text.trim() === '') problems.push(`${name} ${view.id}: drew nothing`)
+ else if (NOISE.test(text)) problems.push(`${name} ${view.id}: prints ${NOISE.exec(text)?.[0]}: ${(text.split('\n').find(line => NOISE.test(line)) ?? '').trim().slice(0, 90)}`)
+ } catch (error) {
+ problems.push(`${name} ${view.id}: threw ${error instanceof Error ? error.message : String(error)}`)
+ }
+ }
+ }
+
+ expect(problems).toEqual([])
+ })
+ }
+ }
+})
diff --git a/v3/docs/adr/ADR-431-console-live-run-check-render-smoke-and-menu-design-throughout.md b/v3/docs/adr/ADR-431-console-live-run-check-render-smoke-and-menu-design-throughout.md
new file mode 100644
index 0000000000..e8d40c7994
--- /dev/null
+++ b/v3/docs/adr/ADR-431-console-live-run-check-render-smoke-and-menu-design-throughout.md
@@ -0,0 +1,54 @@
+# ADR 431: A live check that every read-only run works, a render smoke for every page, and the menu's design carried through the pages
+
+Status: Accepted (ships in ruflo-console 0.26.0)
+
+Date: 2026 10 03
+
+Decision owner: Ruflo maintainers
+
+Scope: `plugins/ruflo-console`: `tests/live-read.spec.ts` (new), `tests/render-smoke.spec.ts` (new), `tests/design.spec.ts` (new), `hooks/views/common.ts` (`tagChip`), `hooks/views/nav.ts`, `hooks/menu-colors.ts` (`COST_CHIP`), `hooks/views/{secure,devtools,mh-lab,memory-lab,vector,xruv,automate}.ts` (the cost tag), `hooks/views/secure.ts` (a missing import).
+
+Extends: ADR 426 (the self-check), ADR 430 (the menu's design), ADR 420 (the live smoke).
+
+## 1. Context
+
+Two asks: use the main menu's design through the whole UI, and make sure every run-related capability works as expected.
+
+ADR 426's self-check proves that each command is *built* correctly: its argv is well-formed, a text verb refuses an empty field, every runnable row has an input that runs. It cannot prove that the command *runs*: that the CLI still has the verb, that the entry's reader copes with what it prints. And none of the pure specs draws a page, so a page that fails to draw is invisible to them. Looking for what the second gap hides found a bug this branch had shipped.
+
+## 2. Decision
+
+### 2.1 A live check of every read-only run
+`tests/live-read.spec.ts` takes every runnable id the palette lists (the catalog a button press resolves through), keeps the ones that are read-only (`$0`, local, run at once without a confirm), runs each exactly as a press does (the console's default `npx --offline -y @claude-flow/cli@latest`, in a scratch directory, eight at a time), and reads what it printed with the runner's own rules: the runner's test of whether a run went well, and its order for what the result panel shows (`spec.read`, else `spec.lines`, else the lab's reading).
+
+- **Pass:** it went well and there are lines to show.
+- **Warning:** it did not go well but says so in words the panel shows. A project with no audits, no database, or no suite answers that way; it is not a broken button.
+- **Failure:** the CLI does not know the command or an option (the registry has drifted), a reader throws, a hang, or the panel would be empty.
+
+It is off by default (it starts a process per command): `RUFLO_LIVE=1 npx vitest run plugins/ruflo-console/tests/live-read.spec.ts`. An always-on part checks that the palette still lists a sensible set of read-only runs.
+
+**What it found, on CLI 3.51.1 from the npx cache:** 133 read-only runs in 17 seconds: **120 pass, 13 warn, 0 fail**, and 9 entries skipped because they are not ruflo CLI calls (a fixed command, or code that does its own thing). The warnings:
+
+- *No data in an empty project:* `mh-drift` (no audit records yet), `mh-bench-verify` (no bench suite), `mem-stats` and `mem-retrieve` (no database, no such key), `mem-synth`, `mem-sroute`, `auto-ses-current` (nothing to read).
+- *A sample that is not the input the verb wants:* `dt-app-inspect` and `dt-app-verify` (the sample `deploy` is not a file), and `dt-daemon`, which printed the daemon's status and exited 1 in that run (a hand run of the same command exited 0, so the exit code is not stable and the check does not rely on it).
+- ***A real defect, in the CLI, not the console:*** `dt-wasm-gallery`, `dt-wasm-categories` and `dt-wasm-search` print `Failed to initialize @ruvector/rvagent-wasm: ERR_MODULE_NOT_FOUND` and exit 0. The CLI's source imports `@ruvector/rvagent-wasm` in four files (`mcp-tools/wasm-agent-tools.ts`, `commands/agent-wasm.ts`, `ruvector/agent-wasm.ts`, `types/optional-modules.d.ts`) but its `package.json` does not declare it, so those buttons fail on any install that does not already have it. The console shows the error honestly; the fix is in the CLI's dependencies. Not done here.
+
+An early version of this check misread `mh-bench-verify` as a failure, because it did not apply the runner's rules for what the panel shows (the CLI's message is on stderr, which the lab's reader falls back to). A check that disagrees with the runner is worse than none, so it now mirrors the runner exactly.
+
+### 2.2 A render smoke for every page
+`tests/render-smoke.spec.ts` draws every page through `viewText`, the console's own text renderer, in both looks, at 60, 100 and 160 columns, with an empty project and a busy one (spend, findings, an update on offer, a terminal run), and fails on a throw, an empty page, or a printed `undefined`, `NaN` or `[object Object]`. It needs no host. **It found a bug this branch had shipped:** `views/secure.ts` called `sentryRows` (ADR 427) without importing it, so the Security page threw a `ReferenceError` the moment it drew. No pure spec renders that view, and the kit tests that would have caught it need the host package, so only CI would have. Removing the import again fails all six cases, which is the check that the smoke can fail.
+
+### 2.3 The menu's design through the pages
+- **A cost tag is a solid chip** in the BBS look (`$0`, `wr`, `cpu`, `net`, `$$`, `del`), the way the menu draws a key: dark ink on a ground by how much the run asks (a read green, local work or a write cyan, the network amber, spending or deleting red). One helper, `tagChip`, replaces seven copies of the same text at the call sites in Security, Performance, Dev Tools, the MetaHarness lab, the Memory Lab, the Vector Lab, x.ruv.io and Automation. The plain look keeps coloured text.
+- **The nav card:** the open page and the open group are solid chips in the page's accent (the colour of the menu group that lists it), and the page buttons carry the menu's badges (spend on Cost, an update on Settings, approvals, findings). Together with ADR 430's accented section rules and card borders, a page now reads in the menu's colours from the nav down.
+- **A badge never costs a row its fit.** Its length is in the width the nav uses to choose a form, and the spec tests every width from 50 to 200 columns, not a handful (a first version tested five and could not fail: the overrun only happens in the narrow window where the choice is on the edge).
+
+## 3. What this does not prove
+
+- **Only the read-only runs are run live.** A write, a spend, a network call or a delete is never run by a test: those ask first, and a test is not a person who can say no. Their commands are checked only by the self-check (built right), not by running.
+- **One CLI, one project.** The runs are against the CLI the npx cache holds (3.51.1) in an empty scratch project, so what a verb does with real data is not covered, and a verb that needs a sample (a path, a key) is only as good as the sample.
+- **How it looks.** The chips, the accents and the nav are checked by what they are made of (their colours, contrast, widths), through a fake kit, not by seeing them. The kit tests that draw them need the `claude-code/testing` host package and run in CI.
+
+## 4. Tests
+
+`tests/live-read.spec.ts` (2; one off unless `RUFLO_LIVE=1`); `tests/render-smoke.spec.ts` (6: two looks by three widths); `tests/design.spec.ts` (6: a cost tag is a chip in the BBS look and text in the plain one; the open page and group are accent chips and plain text; the menu's badges are on the page buttons and absent where there is nothing to say; no row of pages exceeds its width at any of 151 widths, checked by removing the badge from the width and watching it fail at 52 columns). The console suite passes 463 tests; the 22 files that cannot load the host package fail only on that import.