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(console): fold the Sessions list, honest wording, read budget for first reads, Codex sub-agent lineage

rf047a545f08e
diff --git a/plugins/ruflo-console/CHANGELOG.md b/plugins/ruflo-console/CHANGELOG.md
index 15d0567530..6901fb7d05 100644
--- a/plugins/ruflo-console/CHANGELOG.md
+++ b/plugins/ruflo-console/CHANGELOG.md
@@ -3,8 +3,8 @@
Newest first. One `## <version> — <date>` heading per version, then `feat:`, `fix:`, `breaking:` and `chore:` bullets (ADR-478). Built from git history; older versions: `git log -- plugins/ruflo-console`.
## 0.41.0 — 2026-10-09
-- feat: session workspace on the Room (ADR-486): a Needs you queue (approvals, questions, failures, finished work) across Claude Code, Codex and Ruflo sessions, a session browser grouped by repository and worktree, and a preview of the selected session (latest response, current tool, edited files, test result, cost labelled reported, estimated or unavailable). Local and read-only: no model call, no process, no wake. Sessions with an ambiguous identity go to an unassigned bucket and raise nothing. A finished session clears only after its preview was drawn. The Overview shows the four counts. Options: sessionWorkspace, sessionPreview (both on).
-- feat: ruflo-mods can show those four counts: the console keeps them (counts only) in .claude-flow/console/attention.json in a ruflo project.
+- feat: session workspace on the Room (ADR-486): a Needs you queue (approvals, questions, failures, finished work) across Claude Code, Codex and Ruflo sessions, a session browser grouped by repository and worktree, and a preview of the selected session (latest response, current tool, edited files, test result, cost labelled reported, estimated or unavailable). Discovery is local and read-only: no model call, no process, no wake. Sessions with an ambiguous identity go to an unassigned bucket and raise nothing. A finished session clears only after its preview was drawn. The Overview shows the four counts. Options: sessionWorkspace, sessionPreview (both on).
+- feat: ruflo-mods can show those four counts. The console's only write is that summary (counts only, .claude-flow/console/attention.json, in a ruflo project, when a count changes), through the same path Events persistence uses.
## 0.40.8 — 2026-10-09
- fix: an ADR scope glob with many stars no longer freezes the console: the matcher is a bounded two-pointer scan instead of a regex (a 16-star glob against a short path took 38 s; it now takes microseconds, at the real input caps under 10 ms for 9,600 pairs); results are identical on legitimate globs (ADR-480)
diff --git a/plugins/ruflo-console/README.md b/plugins/ruflo-console/README.md
index 222e04b6c8..7da4c9b91f 100644
--- a/plugins/ruflo-console/README.md
+++ b/plugins/ruflo-console/README.md
@@ -54,7 +54,7 @@ Settings → Interface and updates → **Toasts** sets what the ruflo plugins ma
Open it with `/ruflo room` (menu: Safety → The Room).
- **Waiting for a yes**: the one confirm that is pending, with the seconds left to answer it.
-- **Needs you, Sessions, Preview** (ADR-486): approvals, questions, failures and finished work across Claude Code, Codex and Ruflo sessions, including ones started outside Ruflo; the sessions grouped by repository and worktree; and a preview of the one you pick (latest response, current tool, edited files, test result, cost labelled reported, estimated or unavailable). Local and read-only: no model call, no process, nothing woken. A finished session leaves the queue only after its preview was drawn; a session whose identity is ambiguous goes to an *unassigned* bucket and raises nothing. Transcript text is never saved, never sent to a model and never included in a text answer. Options `sessionWorkspace` and `sessionPreview` (both on).
+- **Needs you, Sessions, Preview** (ADR-486): approvals, questions, failures and finished work across Claude Code, Codex and Ruflo sessions, including ones started outside Ruflo; the sessions grouped by repository and worktree; and a preview of the one you pick (latest response, current tool, edited files, test result, cost labelled reported, estimated or unavailable). Discovery is local and read-only: no model call, no process, nothing woken (the one write is a four-count summary ruflo-mods can show). The Sessions list starts folded; jumping to a session from the queue opens it. A finished session leaves the queue only after its preview was drawn; a session whose identity is ambiguous goes to an *unassigned* bucket and raises nothing. Transcript text is never saved, never sent to a model and never included in a text answer. Options `sessionWorkspace` and `sessionPreview` (both on).
- **The feed**: events, Claude's console actions and what you said, newest first. Filter by who, search, pause, page back. **â›” blocked** shows only what was refused or failed: Claude's actions the control log marked denied or error, and events that say denied. Press a line to open it; an event that came from a page of its own (swarm, claims, learning, plugins, missions) offers a jump button to that page.
- **Mods**: one line per plugin mod that has written `.claude-flow/<name>-mod/status.json`. Press a line for its detail: what it guards (the file's own `summary`), guard, calls, blocked, the *class* of its last refusal (`secret`, `destructive`, `path`, `network`, `policy`, `other`; the refused text is never kept), `modVersion`, session start, last write, file age, and a stale marker when the last write was an earlier session.
diff --git a/plugins/ruflo-console/hooks/data/harness-codex.ts b/plugins/ruflo-console/hooks/data/harness-codex.ts
index ffcc95750a..9ca263fa72 100644
--- a/plugins/ruflo-console/hooks/data/harness-codex.ts
+++ b/plugins/ruflo-console/hooks/data/harness-codex.ts
@@ -21,7 +21,11 @@ export const CODEX_CAPS: Capabilities = {
export type CodexSummary = { id: string | null; cwd: string | null; lastAtMs: number | null; open: boolean; pendingTool: string | null; preview: Preview; signals: Signals; title: string | null }
-export function summarizeCodex(text: string): CodexSummary {
+/**
+ * `whole`: the text starts at the file's first line. Only then is `session_meta` read, and only the FIRST one: a sub-agent's rollout carries its
+ * parent's `session_meta` later in the file (seen on this machine: 5 of 19 recent rollouts), which is lineage, not a second identity.
+ */
+export function summarizeCodex(text: string, whole = true): CodexSummary {
const out: CodexSummary = { id: null, cwd: null, lastAtMs: null, open: false, pendingTool: null, preview: { latest: '', tool: null, files: [], test: null }, signals: { question: false, approval: false, failed: false, turnEndedAtMs: null }, title: null }
const calls = new Map<string, string>()
@@ -34,6 +38,7 @@ export function summarizeCodex(text: string): CodexSummary {
if (at !== undefined) out.lastAtMs = Math.max(out.lastAtMs ?? 0, at)
if (type === 'session_meta') {
+ if (!whole || out.id !== null) return
out.id = str(payload.id)?.slice(0, 64) ?? out.id
out.cwd = shown(payload.cwd, 400) || out.cwd
} else if (type === 'turn_context') out.cwd = shown(payload.cwd, 400) || out.cwd
@@ -171,7 +176,7 @@ export function codexAdapter(): HarnessAdapter & { reset(): void } {
}
const tracked = [...known.values()].sort((a, b) => b.mtimeMs - a.mtimeMs).slice(0, MAX_TRACKED)
- const settled = await settle(env.fs, memory, tracked, text => summarizeCodex(text))
+ const settled = await settle(env.fs, memory, tracked, (text, whole) => summarizeCodex(text, whole))
for (const path of [...memory.keys()]) if (!known.has(path)) memory.delete(path)
diff --git a/plugins/ruflo-console/hooks/data/harness-track.ts b/plugins/ruflo-console/hooks/data/harness-track.ts
index 0bd6637c9c..85afa63a9b 100644
--- a/plugins/ruflo-console/hooks/data/harness-track.ts
+++ b/plugins/ruflo-console/hooks/data/harness-track.ts
@@ -56,10 +56,11 @@ export async function settle<S>(fs: SessionFs, memory: Memory<S>, cands: readonl
// A file that fits no more of this pass keeps its earlier summary (or none) until the next pass.
const cost = Math.min(size, 300_000)
- if (budget - cost < 0 && before !== undefined) {
- const held = { ...before, stale: before.stale ?? 'newer than the last read' }
+ if (budget - cost < 0) {
+ // Not remembered, so the next pass reads it: the row says it has not been read yet instead of waiting silently.
+ const held: Held<S> = before === undefined ? { mtimeMs, size, value: null, noPreview: 'not read yet: the pass reached its read budget', stale: null, whole: false } : { ...before, stale: before.stale ?? 'newer than the last read' }
- memory.set(cand.path, held)
+ if (before !== undefined) memory.set(cand.path, held)
out.push({ cand: { ...cand, size, mtimeMs }, held })
return
diff --git a/plugins/ruflo-console/hooks/sessions.ts b/plugins/ruflo-console/hooks/sessions.ts
index 4d65ae124e..83260c1bac 100644
--- a/plugins/ruflo-console/hooks/sessions.ts
+++ b/plugins/ruflo-console/hooks/sessions.ts
@@ -16,6 +16,8 @@ import { replaceFile } from './activity-io'
import type { Host } from './host'
import type { State } from './state'
+/** The fold key of the Sessions section (views/common.ts `section`: present means flipped from its default, which is closed). */
+export const SESSIONS_FOLD = 'room/sessions'
export const VIEWED_KEY = 'ruflo-console/sessions-viewed'
const FAST_MS = 1000
const FULL_MS = 15_000
@@ -207,7 +209,11 @@ export function sessionActions(state: State, host: Pick<Host, 'fs' | 'invalidate
jump: id => {
const item = queueOf(state).find(candidate => candidate.id === id)
- if (item?.rowKey != null) selectRow(state, item.rowKey)
+ if (item?.rowKey != null) {
+ selectRow(state, item.rowKey)
+ // The browser starts folded so the Room's own sections stay in view; jumping to a session opens it.
+ state.sections.add(SESSIONS_FOLD)
+ }
host.invalidate()
},
refresh: () => void scanSessions(state, host, true),
diff --git a/plugins/ruflo-console/hooks/views/sessions.ts b/plugins/ruflo-console/hooks/views/sessions.ts
index c0b42059b6..fe7ae155f3 100644
--- a/plugins/ruflo-console/hooks/views/sessions.ts
+++ b/plugins/ruflo-console/hooks/views/sessions.ts
@@ -11,7 +11,7 @@ import type { AttentionKind, SessionRow } from '../data/harness'
import { CAPABILITIES } from '../data/harness'
import { rowOf } from '../data/sessions-index'
import { attentionCounts, noteShown, queueOf, workspaceOf } from '../sessions'
-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'
import { fullRows } from './full-rows'
const KIND_LABEL: Record<AttentionKind, string> = { 'needs-approval': 'needs your yes', question: 'asked a question', failed: 'failed', 'completed-unread': 'finished' }
@@ -108,16 +108,16 @@ export function sessionRows(ctx: Ctx): RenderElement[] {
if (queue.length > QUEUE_ROWS) rows.push(text(ctx, ` +${queue.length - QUEUE_ROWS} more`, { dimColor: true }))
const index = ws.index
+ const body: RenderElement[] = []
+ const right = index === null ? 'looking…' : `${index.rows.length} found${index.unassigned > 0 ? ` · ${index.unassigned} unassigned` : ''}`
- rows.push(rule(ctx, 'Sessions', index === null ? 'looking…' : `${index.rows.length} found${index.unassigned > 0 ? ` · ${index.unassigned} unassigned` : ''}`))
-
- if (index === null) return rows
+ if (index === null) return [...rows, ...section(ctx, 'sessions', 'Sessions', right, body, false)]
for (const report of index.reports) {
const caps = CAPABILITIES.map(cap => `${cap} ${report.capabilities[cap].supported ? '✓' : '✗'}`).join(' · ')
- rows.push(text(ctx, ` ${report.label}: ${report.state === 'not-detected' ? 'not detected' : report.state === 'failed' ? 'FAILED, showing the last read' : `${report.count} tracked`} · ${clip(report.note, 60)}`, { color: report.state === 'failed' ? THEME.warn : undefined, dimColor: report.state !== 'failed' }))
- rows.push(text(ctx, ` can: ${caps}`, { dimColor: true }))
+ body.push(text(ctx, ` ${report.label}: ${report.state === 'not-detected' ? 'not detected' : report.state === 'failed' ? 'FAILED, showing the last read' : `${report.count} tracked`} · ${clip(report.note, 60)}`, { color: report.state === 'failed' ? THEME.warn : undefined, dimColor: report.state !== 'failed' }))
+ body.push(text(ctx, ` can: ${caps}`, { dimColor: true }))
}
let left = SHOWN_ROWS
@@ -125,13 +125,13 @@ export function sessionRows(ctx: Ctx): RenderElement[] {
for (const group of index.groups) {
if (left <= 0) break
- rows.push(text(ctx, ` ${group.label}`, { bold: true, color: group.unassigned ? THEME.warn : THEME.head }))
+ body.push(text(ctx, ` ${group.label}`, { bold: true, color: group.unassigned ? THEME.warn : THEME.head }))
for (const found of group.rows.slice(0, left)) {
const picked = ws.selected === found.key
left -= 1
- rows.push(
+ body.push(
row(
ctx,
[
@@ -145,16 +145,18 @@ export function sessionRows(ctx: Ctx): RenderElement[] {
}
}
- if (index.rows.length > SHOWN_ROWS) rows.push(text(ctx, ` +${index.rows.length - SHOWN_ROWS} more, the newest are listed first`, { dimColor: true }))
+ if (index.rows.length > SHOWN_ROWS) body.push(text(ctx, ` +${index.rows.length - SHOWN_ROWS} more, the newest are listed first`, { dimColor: true }))
- rows.push(row(ctx, [button(ctx, 'sess-prev', 'â—‚ prev', () => ctx.act.sessions.move(-1)), button(ctx, 'sess-next', 'next â–¸', () => ctx.act.sessions.move(1)), button(ctx, 'sess-refresh', 'rescan', ctx.act.sessions.refresh)], 'sess-nav'))
+ body.push(row(ctx, [button(ctx, 'sess-prev', 'â—‚ prev', () => ctx.act.sessions.move(-1)), button(ctx, 'sess-next', 'next â–¸', () => ctx.act.sessions.move(1)), button(ctx, 'sess-refresh', 'rescan', ctx.act.sessions.refresh)], 'sess-nav'))
const found = rowOf(index, ws.selected)
- if (found === undefined) rows.push(text(ctx, ' Pick a session to see its latest response, current tool, edited files and test result. Browsing never wakes or starts anything.', { dimColor: true }))
- else rows.push(...previewRows(ctx, found))
+ if (found === undefined) body.push(text(ctx, ' Pick a session to see its latest response, current tool, edited files and test result. Browsing never wakes or starts anything.', { dimColor: true }))
+ else body.push(...previewRows(ctx, found))
+
+ if (ws.note !== '') body.push(text(ctx, ` ${ws.note}`, { color: THEME.warn }))
- if (ws.note !== '') rows.push(text(ctx, ` ${ws.note}`, { color: THEME.warn }))
+ rows.push(...section(ctx, 'sessions', 'Sessions', right, body, false))
return rows
}
diff --git a/plugins/ruflo-console/tests/fixtures/sessions-world.ts b/plugins/ruflo-console/tests/fixtures/sessions-world.ts
index 16f390053b..7f3acbe510 100644
--- a/plugins/ruflo-console/tests/fixtures/sessions-world.ts
+++ b/plugins/ruflo-console/tests/fixtures/sessions-world.ts
@@ -19,6 +19,8 @@ export function world(opts: { disk?: Disk; tokens?: Record<string, string>; tail
state.home = HOME
state.configDir = CLAUDE
state.view = 'room'
+ // The Sessions section starts folded; the specs look inside it.
+ state.sections.add('room/sessions')
state.pane.isOpen = true
state.pane.isShown = true
state.snapshot = { missions: { observedAtMs: NOW, isTruncated: false, missions: [mission('m1', 'awaitingAuthorization', 'ship TOKM1X'), mission('m2', 'completed', 'done TOKM2X')] }, agents: [{ id: 'a1', type: 'coder', name: 'worker-one', status: 'failed' }], claims: [] } as unknown as State['snapshot']
diff --git a/plugins/ruflo-console/tests/sessions-safety.spec.ts b/plugins/ruflo-console/tests/sessions-safety.spec.ts
index a0e531738d..5eaa7cccd2 100644
--- a/plugins/ruflo-console/tests/sessions-safety.spec.ts
+++ b/plugins/ruflo-console/tests/sessions-safety.spec.ts
@@ -12,7 +12,7 @@ import { rowOf } from '../hooks/data/sessions-index'
import type { Host } from '../hooks/host'
import { mirrorAttention, queueOf, scanSessions, selectRow, workspaceOf } from '../hooks/sessions'
import { viewText } from '../hooks/views/pane'
-import { addClaude, CLAUDE, CODEX, fsOn, NOW, uuid } from './fixtures/sessions-fs'
+import { addClaude, CLAUDE, CODEX, fsOn, newDisk, NOW, uuid } from './fixtures/sessions-fs'
import { ctxOf, drawn, world } from './fixtures/sessions-world'
describe('hostile and unreadable input', () => {
@@ -220,6 +220,17 @@ describe('adapters on their own', () => {
expect(result.rows.find(row => row.status === 'failed')?.preview?.latest).toBe('turn aborted: interrupted')
})
+ it('reads a sub-agent rollout’s own identity, not the parent’s session_meta that follows it', async () => {
+ const disk = newDisk()
+ const rec = (type: string, payload: Record<string, unknown>) => JSON.stringify({ timestamp: new Date(NOW - 5000).toISOString(), type, payload })
+
+ disk.files.set(`${CODEX}/sessions/2026/10/09/rollout-2026-10-09T10-00-00-${uuid(31)}.jsonl`, { content: [rec('session_meta', { id: uuid(31), cwd: '/work/repo-a' }), rec('session_meta', { id: uuid(32), cwd: '/elsewhere' }), rec('event_msg', { type: 'task_complete', last_agent_message: 'TOK31X' })].join('\n') + '\n', mtimeMs: NOW - 5000 })
+
+ const result = await codexAdapter().scan({ fs: fsOn(disk), claudeDir: null, codexDir: CODEX, nowMs: NOW, full: true })
+
+ expect(result.rows[0]).toMatchObject({ unassigned: null, cwd: '/work/repo-a', status: 'done' })
+ })
+
it('finds a Claude session started after the first pass without a full relist', async () => {
const w = world()
const adapter = claudeAdapter()
diff --git a/plugins/ruflo-console/tests/sessions.spec.ts b/plugins/ruflo-console/tests/sessions.spec.ts
index fd928d312d..e7763ad498 100644
--- a/plugins/ruflo-console/tests/sessions.spec.ts
+++ b/plugins/ruflo-console/tests/sessions.spec.ts
@@ -87,6 +87,23 @@ describe('discovery and identity', () => {
})
})
+describe('the Room layout', () => {
+ it('keeps the queue open and the Sessions list folded until a jump opens it', async () => {
+ const w = world()
+
+ await scanSessions(w.state, w.host, true, NOW)
+ w.state.sections.delete('room/sessions')
+
+ const closed = drawn(w.state, w.host)
+
+ expect(closed).toContain('Needs you')
+ expect(closed).toContain('Sessions')
+ expect(closed).not.toContain('Claude Code:')
+ sessionActions(w.state, w.host).jump(queueOf(w.state).find(item => item.rowKey !== null)!.id)
+ expect(drawn(w.state, w.host)).toContain('Claude Code:')
+ })
+})
+
describe('the attention queue', () => {
it('raises the four kinds in order, from sessions Ruflo did not start too, and nothing for an unassigned row', async () => {
const w = world()
diff --git a/v3/docs/adr/ADR-486-session-workspace.md b/v3/docs/adr/ADR-486-session-workspace.md
index d3bbc23486..6e454ddc53 100644
--- a/v3/docs/adr/ADR-486-session-workspace.md
+++ b/v3/docs/adr/ADR-486-session-workspace.md
@@ -76,7 +76,11 @@ project folders, folders whose mtime moved) and a full relist every 15 s; a clos
or its last 256 KB where the host offers `readTail`; a line over 400 KB is skipped unparsed, at most 30,000 lines are looked at, and nothing uses
a backtracking pattern on file text. **The host `$.fs` has no tail read (ADR-473)**, so on the real host a transcript over 2 MB is listed from its
stat and shows "larger than this host can read" instead of a preview; it is not guessed from the folder name. Previews are computed during the scan,
-so moving the selection does no I/O.
+so moving the selection does no I/O. A pass that reaches its 12 MB read budget leaves the rest unread (the row says "not read yet") for the next pass.
+
+**The 2 s promise has a scope.** Surfacing within 2 s (a 1 s tick plus a pass of a few milliseconds) holds for the tracked sessions: the 60 most
+recently written per adapter. A dormant session outside them that wakes by appending to its file (the folder's mtime does not move) is found by
+the next 15 s relist, not within 2 s. The Sessions list starts folded so the Room's own sections stay in view; "Needs you" is always open.
### 2.5 Mission context
@@ -121,7 +125,7 @@ evidence is verified, from the observation, the ledger and the claims the consol
## 6. Consequences
-- The Room is longer; the section is off with one option, and the preview with another.
+- The Room is longer by the queue (the Sessions list starts folded); the section is off with one option, and the preview with another.
- On the real host a session over 2 MB has a row and no preview until the host offers a tail read; Codex rollouts with a `session_meta` id that
differs from the file name (4 here) are unassigned rather than guessed.
- Claude and Codex approvals are not detected. They will appear when a harness exposes them, behind a verified format and a new capability claim.