🌊 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-ruos): README, local overhead benchmark, typecheck in smoke
ruv56e847b79e28
diff --git a/plugins/ruflo-ruos/README.md b/plugins/ruflo-ruos/README.mdnew file mode 100644index 0000000000..f3d69df309--- /dev/null+++ b/plugins/ruflo-ruos/README.md@@ -0,0 +1,70 @@+# ruflo-ruos++Run ruflo swarm agents on **your own ruOS cloud desktops**. The plugin can:++- place an agent on a desktop;+- stream the agent's output back;+- show the agent in ruflo's swarm state;+- hand finished work back for your review.++The plugin is optional. ruflo works the same without it.++Design and threat model: [ADR-405](../../v3/docs/adr/ADR-405-ruos-desktops-as-swarm-hosts.md).++## Transports++| Transport | When | Configure |+|---|---|---|+| ruOS fleet MCP (default) | Always the control plane. Exec from anywhere. | In Claude Code: the connected `mcp__ruos__*` tools. In a terminal: `RUOS_MCP_URL`, `RUOS_MCP_TOKEN` |+| Per-tenant SSH `:2222` | Only when ruflo runs on one of your ruOS desktops (Fly 6PN) | `--transport ssh`, `RUOS_SSH_KEY`, optional `RUOS_SSH_USER`, `RUOS_FLY_APP` |++The plugin never contacts the desktop executor on `:17870`. That executor has no per-tenant auth (ruOS ADR-070). Credentials are read from the environment only. With them unset, every networked command exits 2 and makes no request.++## Commands++| Command | What it does |+|---|---|+| `/ruflo-ruos:hosts` | Lists your desktops: state, heartbeat, and the ruflo agents on each |+| `/ruflo-ruos:run` | Runs `claude -p` on a desktop, streams the output, and records the agent and its claim |+| `/ruflo-ruos:view` | Delegates to `/ruos view` if installed, otherwise to a view-only `desktop_share` link |+| `/ruflo-ruos:deploy` | Read-only: branch, HEAD, dirty and ahead counts of a repo on the desktop. Never pushes. |++Skill: `ruos-host-run`, the session path that uses the connected fleet MCP. Agent: `ruos-host-operator`.++## CLI++```bash+CLI="node plugins/ruflo-ruos/scripts/cli.mjs"+$CLI status # config + next auto-stop, no network+$CLI hosts+$CLI run --desktop "Work Desktop" --prompt-file task.txt --model sonnet --timeout 900+$CLI run --desktop <id> --prompt-file task.txt --start # wakes a stopped desktop (billable)+$CLI stop --desktop <id> --run <runId> --confirm+$CLI desktop-stop --desktop <id> --confirm+$CLI logs --run <runId>+$CLI build --prompt-file task.txt # exact desktop_exec strings for the session path+$CLI record start|output|end --run <runId> ...+$CLI deploy-info --desktop <id> --repo projects/app+```++## Swarm state++Remote agents are recorded with ruflo's own tools: `agent_spawn` with `config.host = {kind: "ruos", desktopId, desktopName, transport, runId}`, then `agent_update`, then `claims_claim`/`claims_release` on `ruos-run-<runId>`. The plugin itself writes only to `.claude-flow/ruos/`:++- `events.jsonl`: lifecycle events, with ids and sizes only;+- `hosts.json`: the current host snapshot;+- `runs/<runId>.log`: the run output, mode 0600.++## Cost and auto-stop++ruOS stops cloud desktops at **23:00 America/Toronto on weekdays**. `desktop_keepawake` does not override this.++- A run that could cross the stop is refused unless you pass `--ignore-autostop`.+- A stopped desktop is started only with `--start`.++## Verify++```bash+bash plugins/ruflo-ruos/scripts/smoke.sh # structure, security greps, full node --test suite+node plugins/ruflo-ruos/scripts/bench.mjs # adapter overhead vs a raw local call+```diff --git a/plugins/ruflo-ruos/scripts/bench.mjs b/plugins/ruflo-ruos/scripts/bench.mjsnew file mode 100644index 0000000000..c6b55e2909--- /dev/null+++ b/plugins/ruflo-ruos/scripts/bench.mjs@@ -0,0 +1,77 @@+#!/usr/bin/env node+// @ts-check+/**+ * ruflo-ruos local benchmark (ADR-405): adapter overhead vs a raw call.+ *+ * Both sides run the same fake `claude` (prints immediately, then exits)+ * through /bin/sh on THIS machine, so network and fleet latency are zero and+ * what remains is the adapter's own cost: builder, prompt chunking, sha+ * check, launch, poll loop and ledger writes. Remote latency is measured+ * separately against a live desktop (see the PR) — it dominates in practice.+ *+ * node scripts/bench.mjs [--n 20]+ */+import { execFile } from 'node:child_process';+import { mkdtempSync, writeFileSync, chmodSync, mkdirSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { RuosHostAdapter } from './lib/adapter.mjs';+import { createLedger } from './lib/ledger.mjs';++const n = Number(process.argv[process.argv.indexOf('--n') + 1]) || 20;+const root = mkdtempSync(join(tmpdir(), 'ruflo-ruos-bench-'));+const home = join(root, 'home');+const bin = join(root, 'bin');+mkdirSync(home, { recursive: true });+mkdirSync(bin, { recursive: true });+writeFileSync(join(bin, 'claude'), '#!/bin/sh\necho first; cat > /dev/null; echo done\n');+chmodSync(join(bin, 'claude'), 0o755);+const env = { HOME: home, PATH: `${bin}:/usr/bin:/bin` };++/** @param {string} cmd @returns {Promise<{stdout:string,stderr:string,exitCode:number}>} */+const sh = (cmd) => new Promise((res) => {+ execFile('/bin/sh', ['-c', cmd], { env }, (err, stdout, stderr) => res({ stdout, stderr, exitCode: err ? Number(/** @type {any} */ (err).code ?? 1) : 0 }));+});++/** bench-only transport: runs builder strings in a local shell */+const transport = { kind: /** @type {'fleet-mcp'} */ ('fleet-mcp'), exec: async (/** @type {any} */ _d, /** @type {string} */ c) => sh(c) };+const desk = { id: 'a'.repeat(32), flyMachineId: null, name: 'local', displayName: 'local', state: 'started', heartbeatStatus: 'ok', heartbeatAt: 0, ready: true };+const fleet = {+ listDesktops: async () => [{ ...desk, heartbeatAt: Math.floor(Date.now() / 1000) }],+ start: async () => {}, stop: async () => {}, keepAwake: async () => {},+};+const prompt = 'Summarise the repository README in three bullet points.\n'.repeat(20);++/** @param {number[]} xs */+const stats = (xs) => {+ const s = [...xs].sort((a, b) => a - b);+ const q = (/** @type {number} */ p) => s[Math.min(s.length - 1, Math.floor(p * s.length))];+ return { median: +q(0.5).toFixed(1), p95: +q(0.95).toFixed(1), min: +s[0].toFixed(1) };+};++const raw = [];+const firstOut = [];+const total = [];+for (let i = 0; i < n; i++) {+ writeFileSync(join(home, 'p.txt'), prompt);+ let t = performance.now();+ await sh(`cd "$HOME" && claude -p < p.txt`);+ raw.push(performance.now() - t);++ const ledger = createLedger({ cwd: join(root, 'proj'), callTool: null });+ const adapter = new RuosHostAdapter({ fleet, transport, ledger, sleep: (ms) => new Promise((r) => setTimeout(r, Math.min(ms, 20))) });+ t = performance.now();+ const out = await adapter.run({ desktop: desk.id, prompt, runId: `r-bench-${String(i).padStart(4, '0')}`, agentId: `bench-${i}`, timeoutSecs: 60, ignoreAutoStop: true });+ total.push(performance.now() - t);+ if (out.firstOutputMs !== null) firstOut.push(out.firstOutputMs);+}++const result = {+ n,+ promptBytes: Buffer.byteLength(prompt),+ rawCallMs: stats(raw),+ adapterFirstOutputMs: stats(firstOut),+ adapterTotalMs: stats(total),+ note: 'local /bin/sh, zero network; adapter = prepare + 1 chunk + launch + >=1 poll + ledger files. Poll sleep capped at 20ms here; production backs off 1s->5s.',+};+console.log(JSON.stringify(result, null, 2));diff --git a/plugins/ruflo-ruos/scripts/lib/ssh.mjs b/plugins/ruflo-ruos/scripts/lib/ssh.mjsindex 2bb2a3e3ab..bf60042e75 100644--- a/plugins/ruflo-ruos/scripts/lib/ssh.mjs+++ b/plugins/ruflo-ruos/scripts/lib/ssh.mjs@@ -16,7 +16,7 @@ export const SSH_PORT = 2222;/*** @typedef {object} SshOptions- * @property {string} keyPath path to the tenant's ed25519 private key+ * @property {string|undefined} keyPath path to the tenant ed25519 private key (required)* @property {string=} user remote user (default 'ruv')* @property {string=} app Fly app name (default 'ruos-desktop')* @property {typeof nodeSpawn=} spawnImpldiff --git a/plugins/ruflo-ruos/scripts/smoke.sh b/plugins/ruflo-ruos/scripts/smoke.shindex f28dd6e1b7..fba54cb880 100755--- a/plugins/ruflo-ruos/scripts/smoke.sh+++ b/plugins/ruflo-ruos/scripts/smoke.sh@@ -46,7 +46,16 @@ rm -rf "$tmp"step "7. unit + injection + failure-path tests"if out=$(cd "$ROOT" && node --test tests/*.test.mjs 2>&1); then ok; else bad "$(printf '%s' "$out" | grep -E '^not ok' | head -5)"; fi-step "8. ADR-405 present"+step "8. sources type-check (tsc --checkJs, skipped if tsc absent)"+TSC="$ROOT/../../node_modules/.bin/tsc"+if [[ -x "$TSC" ]]; then+ if out=$("$TSC" --noEmit --allowJs --checkJs --strict --target es2022 --module nodenext --moduleResolution nodenext \+ --types node --skipLibCheck "$ROOT/scripts/cli.mjs" "$ROOT"/scripts/lib/*.mjs 2>&1); then ok; else bad "$(printf '%s' "$out" | head -5)"; fi+else+ printf "SKIP (no tsc)\n"+fi++step "9. ADR-405 present"[[ -f "$ROOT/../../v3/docs/adr/ADR-405-ruos-desktops-as-swarm-hosts.md" ]] && ok || bad "missing ADR"echo