🌊 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): wire research form, loop settings rows; unify --cap-usd flag
ruvb94d2edf0896
diff --git a/plugins/ruflo-console/hooks/help-topics-more.ts b/plugins/ruflo-console/hooks/help-topics-more.tsindex a4d6684b0b..fa68a3594d 100644--- a/plugins/ruflo-console/hooks/help-topics-more.ts+++ b/plugins/ruflo-console/hooks/help-topics-more.ts@@ -43,7 +43,7 @@ export const MORE_TOPICS: readonly HelpTopic[] = [{ text: 'The question is screened first by AIDefence. An unsafe one, or one with personal data, is refused.' },{ text: 'Read the confirm: it starts a billed Claude Code turn and allows web search and fetch up to the cap. Web content is untrusted, and nothing is stored until you accept the report.', go: { run: 'mission-research' }, label: 'Start research' },],- tips: ['The console only prepares /ruflo-goals:deep-research --depth <d> --cap <usd> <question>. The run itself happens in the main conversation.', 'Needs the ruflo-goals plugin.'],+ tips: ['The console only prepares /ruflo-goals:deep-research --depth <d> --cap-usd <usd> <question>. The run itself happens in the main conversation.', 'Needs the ruflo-goals plugin.'],related: ['cost', 'security'],keywords: ['deep', 'research', 'web', 'search', 'fetch', 'cap', 'depth', 'question'],},diff --git a/plugins/ruflo-console/hooks/mission-options.ts b/plugins/ruflo-console/hooks/mission-options.tsindex e83e6a511c..cbb9c6ca33 100644--- a/plugins/ruflo-console/hooks/mission-options.ts+++ b/plugins/ruflo-console/hooks/mission-options.ts@@ -137,8 +137,8 @@ export function researchWhy(question: string, cap: number | null): string | nullreturn cap === null ? 'the cap must be a number of dollars from 0.10 to 50' : null}-/** The slash-command arguments, the contract with the ruflo-goals skill: `--depth <d> --cap <usd> <question>`. */-export const researchArgs = (question: string, depth: ResearchDepth, cap: number): string => `--depth ${depth} --cap ${cap} ${question}`+/** The slash-command arguments, the contract with the ruflo-goals skill: `--depth <d> --cap-usd <usd> <question>`. */+export const researchArgs = (question: string, depth: ResearchDepth, cap: number): string => `--depth ${depth} --cap-usd ${cap} ${question}`/** The confirm text, in words: what pressing yes starts, what it allows, what is untrusted, and when anything is stored. */export const researchConfirm = (depth: ResearchDepth, cap: number, screen: Screen): string =>diff --git a/plugins/ruflo-console/hooks/views/mission-control.ts b/plugins/ruflo-console/hooks/views/mission-control.tsindex c2fc8a2f3b..8b6dc240cf 100644--- a/plugins/ruflo-console/hooks/views/mission-control.ts+++ b/plugins/ruflo-console/hooks/views/mission-control.ts@@ -9,6 +9,7 @@ import { ago, button, clip, col, confirmHere, isBbs, row, rule, section, text, Timport { GOALS_PLUGIN, isAvailable, MISSION_SKILLS, slashOf } from '../mission-skills'import { observationRows } from './missions'import { capabilityRows, launchRows } from './mission-launch'+import { researchStartRows } from './research-start'const GLYPH: Record<Derived, string> = { done: '●', running: '◐', ready: '○', waiting: '·', failed: '✖', cancelled: '⊘' }const COLOR = (status: Derived): string => (status === 'done' ? THEME.ok : status === 'running' ? THEME.warn : status === 'failed' ? THEME.bad : status === 'ready' ? THEME.head : THEME.info)@@ -224,7 +225,7 @@ export function missionControlView(ctx: Ctx): RenderElement {rows.push(...box(ctx, 'mc-goal', '✎ goal', mc.goal === '' ? 'what should get done? e.g. add a dark mode toggle to settings (Enter plans it)' : `planned: ${clip(mc.goal, 60)} — type another goal to re-plan`, 'plan', value => ctx.act.mission.goal(value)))if (mc.goal !== '') rows.push(row(ctx, [text(ctx, ` goal: ${clip(mc.goal, Math.max(20, ctx.columns - 24))} `, { bold: true }), button(ctx, 'mc-edit-goal', '✎ edit', () => ctx.act.editField('mc-goal', mc.goal))], 'mc-goal-line'))- rows.push(...launchRows(ctx))+ rows.push(...launchRows(ctx), ...researchStartRows(ctx))if (mc.missions.size > 1) rows.push(row(ctx, [...mc.missions.values()].slice(-6).map(candidate => chip(ctx, `mc-pick-${candidate.id}`, candidate.id.slice(4, 10), candidate.id === mc.active, () => ctx.act.mission.select(candidate.id))), 'mc-picker'))diff --git a/plugins/ruflo-console/hooks/views/research-start.ts b/plugins/ruflo-console/hooks/views/research-start.tsnew file mode 100644index 0000000000..0dfcbc8295--- /dev/null+++ b/plugins/ruflo-console/hooks/views/research-start.ts@@ -0,0 +1,30 @@+import type { RenderElement } from 'claude-code'++import { mcOf, missionWired, researchOf, setResearch } from '../mission-control'+import { RESEARCH_DEPTHS } from '../mission-options'+import { button, row, rule, text, type Ctx } from './common'++const CAPS = ['1', '2', '5', '10'] as const++/**+ * Deep research from Mission Control (ADR-439): a question, a depth and a spend cap. Enter, or the button, screens the question+ * and asks first; the console only prepares /ruflo-goals:deep-research and never fetches anything itself.+ */+export function researchStartRows(ctx: Ctx): RenderElement[] {+ const { state } = ctx+ const draft = researchOf(state)+ const redraw = () => ctx.act.mission.tab(mcOf(state).tab)+ const start = () => void missionWired(state)?.research()+ const pick = (key: string, label: string, isOn: boolean, onPress: () => void) => ctx.kit.Button({ key, label: ` ${isOn ? '●' : '○'} ${label} `, plain: true, ...(isOn && { variant: 'primary' as const }), onPress })+ const rows = [rule(ctx, 'Deep research', 'asks first · capped')]++ if (ctx.kit.Input !== undefined) {+ rows.push(ctx.kit.Input({ key: 'research-question', label: 'question', value: draft.question, placeholder: 'what should it find out?', submitLabel: 'ask', onInput: value => setResearch(state, { question: value.slice(0, 500) }), onSubmit: value => { setResearch(state, { question: value.slice(0, 500) }); start() } }))+ }++ rows.push(row(ctx, [text(ctx, ' depth ', { dimColor: true }), ...RESEARCH_DEPTHS.map(depth => pick(`research-depth-${depth}`, depth, draft.depth === depth, () => { setResearch(state, { depth }); redraw() }))], 'research-depth'))+ rows.push(row(ctx, [text(ctx, ' cap $ ', { dimColor: true }), ...CAPS.map(cap => pick(`research-cap-${cap}`, cap, draft.cap === cap, () => { setResearch(state, { cap }); redraw() })), button(ctx, 'research-start', 'Start research…', start)], 'research-cap'))+ rows.push(text(ctx, ' Bills a Claude turn; web content is untrusted.', { dimColor: true }))++ return rows+}diff --git a/plugins/ruflo-console/hooks/views/settings.ts b/plugins/ruflo-console/hooks/views/settings.tsindex 65655f6846..eedee5b0dc 100644--- a/plugins/ruflo-console/hooks/views/settings.ts+++ b/plugins/ruflo-console/hooks/views/settings.ts@@ -1,7 +1,7 @@import type { RenderElement } from 'claude-code'import { catalogOf } from '../plugin-catalog'-import { AI_BUDGETS, CLAUDE_MODELS, CORE, DEFAULT_AI, pluginNames, SIMPLE, settingsOf, type CoreKey, type Level, type PluginConfig } from '../settings'+import { AI_BUDGETS, CLAUDE_MODELS, CORE, DEFAULT_AI, LOOP_ROWS, pluginNames, SIMPLE, settingsOf, type CoreKey, type Level, type PluginConfig } from '../settings'import { NAV_STYLES } from '../state'import { UPDATES_MODES, type UpdatesMode } from '../updates'import { button, clip, col, row, rule, section, text, THEME, type Ctx } from './common'@@ -159,6 +159,7 @@ function aiItems(ctx: Ctx): Item[] {one('model', 'Claude model', 'the model claude -p uses for AI terminal turns (the CLI’s default when unset)', ai.claudeModel, CLAUDE_MODELS, ai.claudeModel !== DEFAULT_AI.claudeModel, value => ctx.act.settings.ai({ claudeModel: value as (typeof CLAUDE_MODELS)[number] }), 'model haiku sonnet opus'),one('budget', 'Turn budget (USD)', 'claude -p --max-budget-usd: the most one turn may spend; the sandbox stays read-only', String(ai.budgetUsd), AI_BUDGETS.map(String), ai.budgetUsd !== DEFAULT_AI.budgetUsd, value => ctx.act.settings.ai({ budgetUsd: Number(value) as (typeof AI_BUDGETS)[number] }), 'cost spend cap'),one('guidance', 'Mission guidance', 'after a mission goal is entered, claude -p writes detailed guidance by lifecycle stage and suggests ruflo capabilities to bring in (it asks first unless always accept)', ai.guidance ? 'on' : 'off', ['on', 'off'], !ai.guidance, value => ctx.act.settings.ai({ guidance: value === 'on' }), 'mission goal guidance advice suggestions'),+ ...LOOP_ROWS.map(row => one(row.id, row.title, row.description, row.current(ai), row.options, row.isChanged(ai), value => ctx.act.settings.ai(row.patch(value)), row.extra)),one('accept', 'Ask before each AI turn', 'always accept sends claude, codex and swarm turns straight out (read-only, plan mode, under the budget); ruflo commands still ask', ai.autoAccept ? 'always accept' : 'ask each time', ['ask each time', 'always accept'], ai.autoAccept, value => ctx.act.settings.ai({ autoAccept: value === 'always accept' }), 'confirm accept approve'),]}diff --git a/plugins/ruflo-console/tests/mission-research.spec.ts b/plugins/ruflo-console/tests/mission-research.spec.tsindex 3c2e6e10db..79bc29b92a 100644--- a/plugins/ruflo-console/tests/mission-research.spec.ts+++ b/plugins/ruflo-console/tests/mission-research.spec.ts@@ -61,7 +61,7 @@ describe('research start: validation', () => {})describe('research start: screen, confirm, prepare', () => {- it('prepares exactly /ruflo-goals:deep-research --depth <d> --cap <usd> <question> after the confirm, with no network but the AIDefence screens', async () => {+ it('prepares exactly /ruflo-goals:deep-research --depth <d> --cap-usd <usd> <question> after the confirm, with no network but the AIDefence screens', async () => {const { state, net, slashes, asked, start } = setup()setResearch(state, { question: 'How does Raft handle log compaction?', depth: 'deep', cap: '3.5' })@@ -69,11 +69,11 @@ describe('research start: screen, confirm, prepare', () => {await settle()expect(net.sort()).toEqual(['aidefence_has_pii', 'aidefence_is_safe'])expect(asked).toHaveLength(1)- expect(asked[0]?.shows).toBe('/ruflo-goals:deep-research --depth deep --cap 3.5 How does Raft handle log compaction?')+ expect(asked[0]?.shows).toBe('/ruflo-goals:deep-research --depth deep --cap-usd 3.5 How does Raft handle log compaction?')expect(slashes).toEqual([])await asked[0]?.run?.()await settle()- expect(slashes).toEqual(['ruflo-goals:deep-research --depth deep --cap 3.5 How does Raft handle log compaction?'])+ expect(slashes).toEqual(['ruflo-goals:deep-research --depth deep --cap-usd 3.5 How does Raft handle log compaction?'])})it('the confirm row says it in words', async () => {@@ -90,7 +90,7 @@ describe('research start: screen, confirm, prepare', () => {expect(note).toContain('untrusted')expect(note).toContain('Nothing is stored until you accept the report')expect(researchConfirm('deep', 7, { status: 'unavailable', detail: '' })).toContain('could not screen')- expect(researchArgs('q', 'quick', 0.1)).toBe('--depth quick --cap 0.1 q')+ expect(researchArgs('q', 'quick', 0.1)).toBe('--depth quick --cap-usd 0.1 q')})it('an unsafe question is refused: no confirm, nothing prepared', async () => {diff --git a/plugins/ruflo-console/tests/research-wiring.spec.ts b/plugins/ruflo-console/tests/research-wiring.spec.tsnew file mode 100644index 0000000000..81b5c363bc--- /dev/null+++ b/plugins/ruflo-console/tests/research-wiring.spec.ts@@ -0,0 +1,31 @@+import { describe, expect, it } from 'vitest'++import { filterPalette, paletteEntries } from '../hooks/palette'+import { newState } from '../hooks/state'+import type { Actions } from '../hooks/views/common'+import { viewText } from '../hooks/views/pane'++const shown = (view: 'missions' | 'settings') => viewText({ state: newState({}), nowMs: 5, columns: 110, act: {} as Actions }, view)++describe('the research and loop wiring on the pages', () => {+ it('Missions draws the deep research form with its depth and cap choices and the warning', () => {+ const text = shown('missions')++ expect(text).toContain('Deep research')+ for (const word of ['quick', 'standard', 'deep', 'Start research', 'Bills a Claude turn']) expect(text).toContain(word)+ for (const cap of ['1', '2', '5', '10']) expect(text).toMatch(new RegExp(`[●○] ${cap} `))+ })++ it('Settings lists every loop row, so the loop approach is a setting and not only prose', () => {+ const text = viewText({ state: newState({}), nowMs: 5, columns: 110, act: {} as Actions }, 'settings')++ for (const title of ['Mission loop interval', 'Worktree per writer', 'Loop may commit', 'Loop may push', 'Loop may publish', 'Max concurrent writers']) expect(text, title).toContain(title)+ })++ it('the palette finds the research start by its words, and it runs the typed draft (not text after a keyword)', () => {+ const all = paletteEntries(newState({}), 1)++ expect(filterPalette(all, 'research', 'all').map(entry => entry.id)).toContain('mission-research')+ expect(all.find(entry => entry.id === 'mission-research')?.run.kind).not.toBe('text')+ })+})diff --git a/v3/docs/adr/ADR-439-console-research-start-and-confirm.md b/v3/docs/adr/ADR-439-console-research-start-and-confirm.mdindex d6b912d757..61cce14318 100644--- a/v3/docs/adr/ADR-439-console-research-start-and-confirm.md+++ b/v3/docs/adr/ADR-439-console-research-start-and-confirm.md@@ -17,9 +17,9 @@ The Missions page can start a capped deep-research run. The console only **prepa- **Confirm, in words.** The runner's ask row states: it starts a billed Claude Code turn; it allows web search and fetch up to the cap (and the depth); web content is untrusted; nothing is stored until you accept the report. The ask is never "remembered" (the spec has a `run`, so `rememberKey` returns null). The existing denylist and ask-first rules are unchanged.- **The prepared command**, idle: `runSlash`; mid-turn: only placed in the prompt box.- `/ruflo-goals:deep-research --depth <d> --cap <usd> <question>`+ `/ruflo-goals:deep-research --depth <d> --cap-usd <usd> <question>`- **Contract with the plugin side:** `ruflo-goals` (updated concurrently) accepts exactly the flags `--depth <quick|standard|deep>` and `--cap <usd>` before the question text, in that order, and treats everything after them as the question. If the plugin and console disagree, this ADR and ADR-438 are the reference.+ **Contract with the plugin side:** `ruflo-goals` (updated concurrently) accepts exactly the flags `--depth <quick|standard|deep>` and `--cap-usd <usd>` before the question text, in that order, and treats everything after them as the question. If the plugin and console disagree, this ADR and ADR-438 are the reference.- **Palette and Help.** Palette entry `mission-research` (runs the start on the question typed in Missions); Help topic `research`.## 2. Notes