🌊 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): /ruflo dump <view>, and read plugin records from CLAUDE_CONFIG_DIR
ruv6fcd9f39d972
diff --git a/plugins/ruflo-console/hooks/commands.ts b/plugins/ruflo-console/hooks/commands.tsindex 89f800a3c5..fd7d74d8f9 100644--- a/plugins/ruflo-console/hooks/commands.ts+++ b/plugins/ruflo-console/hooks/commands.ts@@ -21,6 +21,7 @@ export type Intent =| { kind: 'back' }| { kind: 'select'; by: number }| { kind: 'filter'; filter: 'all' | EventKind }+ | { kind: 'dump'; view: ViewId | null }| { kind: 'unknown'; word: string }export function parseRuflo(args: string): Intent {@@ -65,6 +66,9 @@ export function parseRuflo(args: string): Intent {case 'prev':case 'k':return { kind: 'select', by: -1 }+ case 'dump':+ case 'text':+ return { kind: 'dump', view: second === '' ? null : viewOf(second) }case 'filter':return { kind: 'filter', filter: (EVENT_KINDS as readonly string[]).includes(second) ? (second as EventKind) : 'all' }default: {@@ -83,6 +87,7 @@ export const HELP = [` /ruflo <view> ${VIEWS.map(view => `${view.id} (${view.key})`).join(', ')}`,' /ruflo agent <id|name> drill into one agent: role, task, claims, activity, logs, timeline',' /ruflo back | close | status',+ ' /ruflo dump <view> a view as plain text, without the pane (for claude -p and scripts)','','Act (each change asks to confirm; /ruflo yes or /ruflo no answers without focus)',' /ruflo palette [query] the command palette (key p): spawn, claims, swarm, votes, workers, memory',diff --git a/plugins/ruflo-console/hooks/controller.ts b/plugins/ruflo-console/hooks/controller.tsindex e92eaee423..fb509bc0e3 100644--- a/plugins/ruflo-console/hooks/controller.ts+++ b/plugins/ruflo-console/hooks/controller.ts@@ -114,7 +114,7 @@ export function createController(state: State, host: Host): Controller {])const previous = state.snapshotconst now = Date.now()- const snapshot = await readSnapshot(host.fs, state.cache, state.cwd, state.home, settings, now)+ const snapshot = await readSnapshot(host.fs, state.cache, state.cwd, state.home, settings, now, state.configDir)state.snapshot = snapshotrecord(state.events, diffEvents(previous, snapshot, now))diff --git a/plugins/ruflo-console/hooks/data/files.ts b/plugins/ruflo-console/hooks/data/files.tsindex 3a4de3b433..fc855aefcb 100644--- a/plugins/ruflo-console/hooks/data/files.ts+++ b/plugins/ruflo-console/hooks/data/files.ts@@ -1,6 +1,6 @@/*** The files the console reads, and one bounded, cached reader for them. Paths in PROJECT are relative to the session's- * working directory; paths in HOME to the person's home directory. Every read may be refused, a refusal is a missing+ * working directory; paths in HOME to Claude Code's config directory (`$CLAUDE_CONFIG_DIR`, else `~/.claude`). Every read may be refused, a refusal is a missing* fact, and a file over READ_MAX bytes is never read (`.claude-flow/policy/state.json` reaches 40 MB in a busy project).** Never listed here, never read: `.claude-flow/federation/key-*.json`, `~/.ruflo/nostr.key` and `~/.ruflo/channels.json`@@ -39,8 +39,8 @@ export const PROJECT = {export type ProjectKey = keyof typeof PROJECTexport const HOME = {- installed: '.claude/plugins/installed_plugins.json',- marketplaces: '.claude/plugins/known_marketplaces.json',+ installed: 'plugins/installed_plugins.json',+ marketplaces: 'plugins/known_marketplaces.json',} as const/** Folders listed by name only: the federation keys' node ids, never their content. */@@ -108,8 +108,8 @@ export const under = (root: string, path: string): string => `${root.replace(/\//** Every file the console reads, as text or the reason it has none, and how many changed since the last pass. */export type DiskRead = { project: Record<ProjectKey, Read>; home: Record<keyof typeof HOME, Read>; changed: number; federationNodes: string[] | null; hasNostrKey: boolean | null }-/** Reads every file in parallel; nothing here rejects. `home` is null when the home directory is unknown. */-export async function readDisk(fs: ReaderFs, cache: ReadCache, cwd: string, home: string | null): Promise<DiskRead> {+/** Reads every file in parallel; nothing here rejects. `home` and `configDir` are null when unknown. */+export async function readDisk(fs: ReaderFs, cache: ReadCache, cwd: string, home: string | null, configDir: string | null = home === null ? null : `${home}/.claude`): Promise<DiskRead> {const mtimeOf = (held: ReadCache extends Map<string, infer V> ? V : never) => ('mtimeMs' in held ? held.mtimeMs : -1)const before = new Map([...cache].map(([path, held]) => [path, mtimeOf(held)]))const projectKeys = Object.keys(PROJECT) as ProjectKey[]@@ -117,7 +117,7 @@ export async function readDisk(fs: ReaderFs, cache: ReadCache, cwd: string, homeconst missingHome: Read = { text: null, reason: 'missing' }const [projectReads, homeReads, federationNodes, hasNostrKey] = await Promise.all([Promise.all(projectKeys.map(key => readBounded(fs, cache, under(cwd, PROJECT[key])))),- Promise.all(homeKeys.map(key => (home === null ? Promise.resolve(missingHome) : readBounded(fs, cache, under(home, HOME[key]))))),+ Promise.all(homeKeys.map(key => (configDir === null ? Promise.resolve(missingHome) : readBounded(fs, cache, under(configDir, HOME[key]))))),fs.list(under(cwd, FEDERATION_DIR)).then(entries => entries.flatMap(entry => (/^key-[A-Za-z0-9._-]{1,64}\.json$/.test(entry.name) ? [entry.name.slice(4, -5)] : [])).slice(0, 50))diff --git a/plugins/ruflo-console/hooks/data/snapshot.ts b/plugins/ruflo-console/hooks/data/snapshot.tsindex 39ce085d83..af66521ef6 100644--- a/plugins/ruflo-console/hooks/data/snapshot.ts+++ b/plugins/ruflo-console/hooks/data/snapshot.ts@@ -81,8 +81,8 @@ export type ReadStatus = 'ok' | 'missing' | 'too-large' | 'refused'const statusOf = (read: Read): ReadStatus => (read.text !== null ? 'ok' : read.reason)/** Reads and parses everything; never rejects. `settings` is the merged settings, for `enabledPlugins`. */-export async function readSnapshot(fs: ReaderFs, cache: ReadCache, cwd: string, home: string | null, settings: unknown, nowMs: number): Promise<Snapshot> {- const disk = await readDisk(fs, cache, cwd, home)+export async function readSnapshot(fs: ReaderFs, cache: ReadCache, cwd: string, home: string | null, settings: unknown, nowMs: number, configDir?: string | null): Promise<Snapshot> {+ const disk = await readDisk(fs, cache, cwd, home, configDir === undefined ? (home === null ? null : `${home}/.claude`) : configDir)const text = (key: ProjectKey) => textOf(disk.project[key])const stored = parseSwarmStore(text('swarm'))const pointer = parseSwarmPointer(text('pointer'))diff --git a/plugins/ruflo-console/hooks/dispatch.ts b/plugins/ruflo-console/hooks/dispatch.tsindex 798a4e3e86..08f9484559 100644--- a/plugins/ruflo-console/hooks/dispatch.ts+++ b/plugins/ruflo-console/hooks/dispatch.ts@@ -9,6 +9,7 @@ import { median, p95 } from './controller'import { plain } from './data/parse'import { VIEWS, type State } from './state'import { barText } from './views/bar'+import { viewText } from './views/pane'export type Delegate = () => Promise<{ text?: string } | undefined>@@ -107,6 +108,18 @@ export async function dispatch(control: Controller, state: State, args: string,control.setView('events')return open(control, state, `events · ${intent.filter}`)+ case 'dump': {+ const view = intent.view ?? state.view+ const shown = state.view++ // The view's probes run for it now, as they would were it in front; then the pane's view is put back.+ state.view = view+ await control.refresh()+ await control.probe(true)+ state.view = shown++ return { text: viewText({ state, nowMs: Date.now(), columns: 100, act: control.actions }, view) }+ }case 'unknown':return { text: `Unknown: "${plain(intent.word, 30)}". /ruflo help lists the views (${VIEWS.map(view => view.id).join(', ')}) and commands.` }}diff --git a/plugins/ruflo-console/hooks/host.ts b/plugins/ruflo-console/hooks/host.tsindex b152860596..37e4f37d51 100644--- a/plugins/ruflo-console/hooks/host.ts+++ b/plugins/ruflo-console/hooks/host.ts@@ -30,6 +30,7 @@ export type Host = {rufloTools: () => Promise<{ tools: number; servers: string[] }>settings: () => Promise<unknown>home: () => Promise<string | undefined>+ configDir: () => Promise<string | undefined>rufloSnapshot: () => Promise<RufloSnapshot>rufloRoute: () => Promise<RufloRoute | null>rufloSegment: (text: string | null) => Promise<void>diff --git a/plugins/ruflo-console/hooks/register.ts b/plugins/ruflo-console/hooks/register.tsindex 870dd31f0b..074b2b9597 100644--- a/plugins/ruflo-console/hooks/register.ts+++ b/plugins/ruflo-console/hooks/register.ts@@ -55,6 +55,7 @@ function hostOf($: EngineInterface, cwd: string): Host {},settings: async () => $.settings.read(),home: async () => $.env.get('HOME'),+ configDir: async () => $.env.get('CLAUDE_CONFIG_DIR'),// `$.ruflo` exists only where ruflo-mods is seated; validate refuses feature-detecting a noun, so these are// async: a missing noun throws inside the promise and every caller's catch sees a rejection.rufloSnapshot: async () => $.ruflo.snapshot(),@@ -81,7 +82,8 @@ export const register: Register = (on, raw: PluginOptions) => {const bound = host- state.home = await bound.home().catch(() => undefined) ?? null+ state.home = (await bound.home().catch(() => undefined)) ?? null+ state.configDir = (await bound.configDir().catch(() => undefined)) ?? (state.home === null ? null : `${state.home}/.claude`)await Promise.all([bound.registerCommand({ name: 'ruflo', description: 'ruflo: the cockpit (views, palette, agents, approvals) and every ruflo mod command — /ruflo help', argumentHint: '[view|palette|agent <id>|mods|swarm <sub>|help]' })diff --git a/plugins/ruflo-console/hooks/state.ts b/plugins/ruflo-console/hooks/state.tsindex 33ff8241d3..7329989486 100644--- a/plugins/ruflo-console/hooks/state.ts+++ b/plugins/ruflo-console/hooks/state.ts@@ -110,6 +110,8 @@ export type State = {options: Optionscwd: stringhome: string | null+ /** Claude Code's config directory: `$CLAUDE_CONFIG_DIR`, else `~/.claude`. Its plugin records are read from here. */+ configDir: string | null/** When this module loaded: "since the console loaded" series and stall times count from here. */loadedAtMs: numberview: ViewId@@ -159,6 +161,7 @@ export function newState(raw: PluginOptions | undefined): State {options: optionsOf(raw),cwd: '',home: null,+ configDir: null,loadedAtMs: Date.now(),view: 'overview',back: 'overview',diff --git a/plugins/ruflo-console/hooks/views/pane.ts b/plugins/ruflo-console/hooks/views/pane.tsindex 6a2faffea0..9bf99f7f60 100644--- a/plugins/ruflo-console/hooks/views/pane.ts+++ b/plugins/ruflo-console/hooks/views/pane.ts@@ -127,3 +127,56 @@ export function paneView(ctx: Ctx): RenderElement {return ctx.kit.Box({ flexDirection: 'column', children: [...title, tabs(ctx), body, ...(confirm !== null ? [confirm] : []), footer(ctx)] })}++type Plain = { type: string; props: { children?: unknown; label?: string } }++const plainKit = (): Ctx['kit'] => {+ const element = (type: string) => (props: Record<string, unknown>) => ({ type, props }) as never++ return { Box: element('Box'), Text: element('Text'), Button: element('Button') }+}++function linesOf(node: unknown, out: string[]): void {+ if (node === null || node === undefined || typeof node === 'boolean') return+ if (typeof node === 'string' || typeof node === 'number') {+ out.push(String(node))++ return+ }++ const { type, props } = node as Plain++ if (Array.isArray(node)) {+ for (const child of node) linesOf(child, out)++ return+ }++ if (type === 'Button') {+ out.push(`[${props.label ?? ''}]`)++ return+ }++ const before = out.length+ const children = Array.isArray(props.children) ? props.children : [props.children]++ for (const child of children) linesOf(child, out)++ // A row's parts read as one line; a column's as lines.+ if (type === 'Box' && (props as { flexDirection?: string }).flexDirection === 'row') out.splice(before, out.length - before, out.slice(before).join(''))+}++/**+ * One view as plain text, every picture as its fallback words: `/ruflo dump <view>`, for a headless run (claude -p),+ * a surface without the pane, or a script that wants to read what the console sees.+ */+export function viewText(ctx: Omit<Ctx, 'kit' | 'pictures'>, view: ViewId): string {+ const body = BODIES[view]({ ...ctx, kit: plainKit(), pictures: new Map() })+ const out: string[] = []++ linesOf(body, out)++ return out.map(line => line.trimEnd()).filter(line => line !== '').join('\n')+}+diff --git a/plugins/ruflo-console/hooks/views/plugins.ts b/plugins/ruflo-console/hooks/views/plugins.tsindex 421d434a24..ff8fe86be9 100644--- a/plugins/ruflo-console/hooks/views/plugins.ts+++ b/plugins/ruflo-console/hooks/views/plugins.ts@@ -22,8 +22,8 @@ export function pluginsView(ctx: Ctx): RenderElement {const market = facts.markets?.find(entry => entry.name === RUFLO_MARKET) ?? null- if (state.home === null) {- rows.push(text(ctx, 'n/a — HOME is not readable to this mod, so ~/.claude/plugins cannot be found', { dimColor: true }))+ if (state.configDir === null) {+ rows.push(text(ctx, 'n/a — neither CLAUDE_CONFIG_DIR nor HOME is readable to this mod, so the plugin records cannot be found', { dimColor: true }))} else if (market === null) {rows.push(kv(ctx, 'ruflo clone', facts.markets === null ? 'n/a — no known_marketplaces.json' : 'not added — /plugin marketplace add ruvnet/ruflo'))} else {diff --git a/plugins/ruflo-console/tests/fixtures/world.ts b/plugins/ruflo-console/tests/fixtures/world.tsindex 74bb3e29ce..656120d391 100644--- a/plugins/ruflo-console/tests/fixtures/world.ts+++ b/plugins/ruflo-console/tests/fixtures/world.ts@@ -106,7 +106,7 @@ export function worldOf(on: On, files: Readonly<Record<string, string>>, optionsreturn 'deny' in answer ? { deny: answer.deny } : { value: { ...answer, isStdoutTruncated: false, isStderrTruncated: false } }})- on('env.get', () => (refuse ? { deny: 'env withheld' } : { value: HOME }))+ on('env.get', ($, e) => (refuse ? { deny: 'env withheld' } : { value: e.name === 'HOME' ? HOME : undefined }))on('settings.read', () => (refuse ? { deny: 'settings withheld' } : { value: { enabledPlugins: { 'ruflo-core@ruflo': true } } as never }))on('session.usage', () => (refuse ? { deny: 'usage withheld' } : { value: { context: { tokens: 50_000, window: 200_000, percent: 25 }, rateLimits: [], cost: { usd: 0.4213 } } as never }))on('tool.list', () => (refuse ? { deny: 'tools withheld' } : { value: [{ name: 'mcp__claude-flow__swarm_init' }, { name: 'mcp__claude-flow__claims_board' }, { name: 'Read' }] as never }))diff --git a/plugins/ruflo-console/tests/palette.test.ts b/plugins/ruflo-console/tests/palette.test.tsindex a68dc570c5..c1a9f09ac7 100644--- a/plugins/ruflo-console/tests/palette.test.ts+++ b/plugins/ruflo-console/tests/palette.test.ts@@ -123,4 +123,19 @@ describe('palette and /ruflo', () => {expect(world.opened).toHaveLength(0)})++ test('/ruflo dump <view> answers the view as plain text, without the pane, with its probes run', async ($, on) => {+ const world = worldOf(on, RUFLO_FILES)+ mock.clock(on)+ await $.session.start(SESSION)++ const claims = (await $.command.run(command('dump claims'))).text ?? ''+ const memory = (await $.command.run(command('dump memory'))).text ?? ''++ expect(claims).toContain('1 active · 1 stealable · 0 handoff')+ expect(claims).toMatch(/console-demo-1\s+coder agent-1790903032181-97m25s/)+ expect(memory).toContain('1 · 0 with vectors')+ expect(world.runs.some(argv => argv.join(' ').includes('memory stats'))).toBe(true)+ expect(world.opened).toHaveLength(0)+ })})