🌊 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): AgentDB mod section on the Memory page + Help guide (0.31.0)
ruv78a9733da1a9
diff --git a/plugins/ruflo-agentdb/README.md b/plugins/ruflo-agentdb/README.mdindex b1382f4463..8b20bb190c 100644--- a/plugins/ruflo-agentdb/README.md+++ b/plugins/ruflo-agentdb/README.md@@ -205,8 +205,28 @@ bash plugins/ruflo-agentdb/scripts/smoke.shThe smoke script is the contract. It calls each documented MCP tool, exercises the RaBitQ workflow, and source-inspects the fallback path (no env-var gate exists to force the fallback live).+## As a mod (0.4.0, ADR-445)++A function-hook mod ships beside the skills. Needs a Claude Code with mods (2.1.287+); older builds ignore it.++| Piece | Default | What it does |+|---|---|---|+| **Secret guard** | on | Refuses a memory write (`agentdb_hierarchical-store`, `agentdb_pattern-store`, `agentdb_batch`, `agentdb_causal-edge`, `memory_store`, `hooks_remember`) that holds a private key, cloud/GitHub/Slack token, bearer token, JWT or key-like assignment. The secret is never echoed. |+| **Recall into prompts** | **off** | Attaches the best 1–5 memories to each prompt as framed, per-prompt context (the prompt cache is not disturbed). Read through the already-connected AgentDB (or ruvector) tool: no CLI, no network. Skipped for slash commands, `!` lines and short prompts; gives up after `recallDeadlineMs` (800); cached 10 minutes. |+| **Untrusted memory** | always | A retrieved memory with a secret or an instruction-to-the-model phrase is dropped; the rest are control-character-stripped, capped (5 items, 400 chars each, 1500 total) and framed as data. |+| **`/agentdb`** | — | `status`, `recall <text>`, `scan <text>`, `recent`; answered locally, no model call. |+| **Status file** | — | `.claude-flow/agentdb-mod/status.json` (counts and short snippets); the ruflo console's Memory page shows it. |++Options (`userConfig`): `recall` off|on, `recallLimit` 1–5, `recallDeadlineMs` 200–3000, `guard` on|off, `source` auto|agentdb|ruvector|none.++```bash+claude plugin test plugins/ruflo-agentdb # 20 tests: screening, recall, guard, /agentdb, deadline, cache+node plugins/ruflo-agentdb/scripts/bench.mjs # per-call cost of the pure paths (tens of µs)+```+## Architecture Decisions+- [`ADR-445` — AgentDB as a mod](../../v3/docs/adr/ADR-445-agentdb-as-a-mod.md)- [`ADR-0001` — Optimize ruflo-agentdb (accurate surface, RaBitQ, namespacing, smoke contract)](./docs/adrs/0001-agentdb-optimization.md)## Related Pluginsdiff --git a/plugins/ruflo-console/.claude-plugin/plugin.json b/plugins/ruflo-console/.claude-plugin/plugin.jsonindex bd3014946c..234b0f1c41 100644--- a/plugins/ruflo-console/.claude-plugin/plugin.json+++ b/plugins/ruflo-console/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "ruflo-console","description": "ruflo's cockpit inside Claude Code and the one /ruflo command for every ruflo mod (function hooks, early access). Views: overview with health alerts, swarm topology graph, claims flow with TTL rings, federation map, plugin health matrix, learning curve and pipeline, MetaHarness radar and audit trend, memory, cost gauge, agent timeline, approvals queue, event stream, a main menu, an x.ruv.io federation board, an AI terminal (codex, claude or both in remembered sessions, streamed), Skills (npx skills), a Hive-Mind view, a MetaHarness lab, agent drill-down; a command palette for confirm-gated actions through the ruflo CLI; a band above the prompt. Reads ruflo's files and the CLI's local JSON; anything not measured reads n/a. The one network call it makes by itself is a daily read of the published plugin.json at github.com/ruvnet/ruflo to offer an update (Settings → Updates: ask, auto, or off); it installs only through Claude Code's own claude plugin update, and never a new major version without asking.",- "version": "0.30.0",+ "version": "0.31.0","author": {"name": "ruvnet","url": "https://github.com/ruvnet"diff --git a/plugins/ruflo-console/hooks/data/agentdb-mod.ts b/plugins/ruflo-console/hooks/data/agentdb-mod.tsnew file mode 100644index 0000000000..2ffb08cce7--- /dev/null+++ b/plugins/ruflo-console/hooks/data/agentdb-mod.ts@@ -0,0 +1,51 @@+import { jsonObject, recordOf } from './parse'++/** What the ruflo-agentdb mod last wrote to `.claude-flow/agentdb-mod/status.json` (ADR-445): its settings, counters and the last items it attached. */+export type AgentdbMod = {+ recall: boolean+ guard: boolean+ source: string+ tool: string | null+ updatedMs: number+ attached: number+ skipped: number+ cached: number+ timedOut: number+ dropped: number+ blocked: number+ errors: number+ lastMs: number | null+ recent: { source: string; score: number | null; snippet: string }[]+}++const whole = (v: unknown): number => (typeof v === 'number' && Number.isFinite(v) && v >= 0 ? Math.floor(v) : 0)++/** Parses the status file; anything that is not version 1 of its shape is null (the console never guesses at a shape it does not know). */+export function parseAgentdbMod(text: string | null): AgentdbMod | null {+ const value = jsonObject(text)++ if (value === null || value.version !== 1) return null++ const recent = (Array.isArray(value.recent) ? value.recent : []).slice(-5).flatMap(item => {+ const r = recordOf(item)++ return r !== null && typeof r.snippet === 'string' ? [{ source: typeof r.source === 'string' ? r.source.slice(0, 24) : '?', score: typeof r.score === 'number' ? r.score : null, snippet: r.snippet.slice(0, 120) }] : []+ })++ return {+ recall: value.recall === true,+ guard: value.guard === true,+ source: typeof value.source === 'string' ? value.source.slice(0, 16) : 'auto',+ tool: typeof value.lastTool === 'string' ? value.lastTool.slice(0, 24) : null,+ updatedMs: whole(value.updatedMs),+ attached: whole(value.attached),+ skipped: whole(value.skipped),+ cached: whole(value.cached),+ timedOut: whole(value.timedOut),+ dropped: whole(value.dropped),+ blocked: whole(value.blocked),+ errors: whole(value.errors),+ lastMs: typeof value.lastMs === 'number' ? whole(value.lastMs) : null,+ recent,+ }+}diff --git a/plugins/ruflo-console/hooks/data/files.ts b/plugins/ruflo-console/hooks/data/files.tsindex 39e3b4fc9d..2e10c04091 100644--- a/plugins/ruflo-console/hooks/data/files.ts+++ b/plugins/ruflo-console/hooks/data/files.ts@@ -36,6 +36,7 @@ export const PROJECT = {helpersVersion: '.claude/helpers/.helpers-version',config: '.claude-flow/config.yaml',missions: '.claude-flow/missions/observation.json',+ agentdbMod: '.claude-flow/agentdb-mod/status.json',} as constexport type ProjectKey = keyof typeof PROJECTdiff --git a/plugins/ruflo-console/hooks/data/snapshot.ts b/plugins/ruflo-console/hooks/data/snapshot.tsindex 9349945c83..b19ee41194 100644--- a/plugins/ruflo-console/hooks/data/snapshot.ts+++ b/plugins/ruflo-console/hooks/data/snapshot.ts@@ -25,6 +25,7 @@ import {} from './facts'import { parseMissions, type MissionObservation } from './missions'import { readBounded, readDisk, textOf, type ProjectKey, type Read, type ReadCache, type ReaderFs } from './files'+import { parseAgentdbMod, type AgentdbMod } from './agentdb-mod'import {parseAgents,parseClaims,@@ -78,6 +79,8 @@ export type Snapshot = {hasNostrKey: boolean | nullplugins: PluginsFactsmissions: MissionObservation | null+ /** The ruflo-agentdb mod's own status file (ADR-445); null while the mod has not written one. */+ agentdbMod: AgentdbMod | nullchanged: numberreadAtMs: number}@@ -127,6 +130,7 @@ export async function readSnapshot(fs: ReaderFs, cache: ReadCache, cwd: string,missingFromClone: offered === null ? [] : EXPECTED_IN_MARKET.filter(name => !offered.includes(name)),},missions: parseMissions(text('missions')),+ agentdbMod: parseAgentdbMod(text('agentdbMod')),changed: disk.changed,readAtMs: nowMs,}diff --git a/plugins/ruflo-console/hooks/help-topics-more.ts b/plugins/ruflo-console/hooks/help-topics-more.tsindex 207d84aebf..1b18fecfc6 100644--- a/plugins/ruflo-console/hooks/help-topics-more.ts+++ b/plugins/ruflo-console/hooks/help-topics-more.ts@@ -64,6 +64,22 @@ export const MORE_TOPICS: readonly HelpTopic[] = [related: ['settings', 'mission', 'security'],keywords: ['claude', 'control', 'drive', 'computer', 'use', 'tools', 'autonomy', 'level', 'auto', 'ask', 'take', 'back', 'confirm', 'autoconfirm', 'approve', 'yes'],},+ {+ id: 'agentdb-mod',+ title: 'Memory in every prompt, without secrets',+ group: 'Learn',+ summary: 'the AgentDB mod: safe recall into prompts and a guard that keeps secrets out of memory',+ steps: [+ { text: 'Install the ruflo-agentdb plugin (0.4 or newer), then start a new Claude Code session. Open Memory (key 9): the AgentDB mod section shows what it is set to and what it has done.', go: { view: 'memory' }, label: 'Open Memory' },+ { text: 'The secret guard is on by itself: a memory write that holds a key, token or password is refused, and Claude is told to store a reference instead. Nothing else is touched.' },+ { text: 'Recall is off until you turn it on in the plugin’s options (recall = on). Then each prompt gets the best few matching memories attached as retrieved data, never as instructions. A slow memory read is given up on after 800 ms.' },+ { text: 'Anything retrieved is treated as untrusted: a memory that holds a secret or an instruction to the model is dropped, and the count shows on the Memory page.' },+ { text: 'Type /agentdb status, /agentdb recall <text>, /agentdb scan <text> or /agentdb recent for the same answers in the prompt, with no model call.' },+ ],+ tips: ['Recall adds tokens to every prompt, which is why it is off by default.', 'The page reads the mod’s status file; it does not call the mod.'],+ related: ['memory', 'vector', 'security'],+ keywords: ['agentdb', 'mod', 'recall', 'prompt', 'retrieval', 'recalled'],+ },{id: 'perf',title: 'Find and fix slowness',diff --git a/plugins/ruflo-console/hooks/version.ts b/plugins/ruflo-console/hooks/version.tsindex 020be6eb87..4a4f7a8414 100644--- a/plugins/ruflo-console/hooks/version.ts+++ b/plugins/ruflo-console/hooks/version.ts@@ -2,4 +2,4 @@* The console's version, shown on the header so a person can tell which build is running. Kept equal to the plugin's manifest* (`.claude-plugin/plugin.json`); tests/version.spec.ts fails if the two drift.*/-export const CONSOLE_VERSION = '0.30.0'+export const CONSOLE_VERSION = '0.31.0'diff --git a/plugins/ruflo-console/hooks/views/agentdb-mod.ts b/plugins/ruflo-console/hooks/views/agentdb-mod.tsnew file mode 100644index 0000000000..22c08d4eac--- /dev/null+++ b/plugins/ruflo-console/hooks/views/agentdb-mod.ts@@ -0,0 +1,40 @@+import type { RenderElement } from 'claude-code'++import { ago, count, kv, rule, text, THEME, type Ctx } from './common'++const PLUGIN = 'ruflo-agentdb'+/** A status file older than this was written by a session that has ended. */+const STALE_MS = 6 * 3_600_000++/**+ * The "AgentDB mod" section of the Memory page (ADR-445): whether the ruflo-agentdb mod is installed, what it is set to (recall into prompts,+ * the secret guard, the source), and what it has done: memories attached, skipped, cached, timed out, dropped as unsafe, writes refused.+ * It reads the mod's own status file; it never calls the mod.+ */+export function agentdbModRows(ctx: Ctx): RenderElement[] {+ const snap = ctx.state.snapshot+ const mod = snap?.agentdbMod ?? null+ const installed = snap?.plugins.installed?.find(plugin => plugin.name === PLUGIN)+ const rows: RenderElement[] = [rule(ctx, 'AgentDB mod', mod === null ? (installed === undefined ? 'not installed' : 'no session yet') : mod.recall ? 'recall on' : 'recall off')]++ if (mod === null) {+ rows.push(+ text(ctx, installed === undefined ? ' Install ruflo-agentdb (0.4+): safe recall of memory into prompts and a guard that keeps secrets out of memory. /plugin' : ` ruflo-agentdb ${installed.version} is installed; it reports here once a session has started with it (restart Claude Code after an update).`, { dimColor: true }),+ )++ return rows+ }++ const stale = ctx.nowMs - mod.updatedMs > STALE_MS+ rows.push(kv(ctx, 'recall', mod.recall ? `on · ${mod.source}${mod.tool !== null ? ` · via ${mod.tool}` : ''}` : 'off (a plugin option: attaches the best few memories to each prompt as retrieved data)', mod.recall ? THEME.ok : undefined))+ rows.push(kv(ctx, 'secret guard', mod.guard ? 'on · memory writes holding a key, token or password are refused' : 'off', mod.guard ? THEME.ok : THEME.warn))+ rows.push(kv(ctx, 'attached', `${count(mod.attached)} · ${count(mod.cached)} from cache · ${count(mod.skipped)} skipped · ${count(mod.timedOut)} timed out${mod.lastMs === null ? '' : ` · last ${mod.lastMs} ms`}`))+ rows.push(kv(ctx, 'refused', `${count(mod.dropped)} memories dropped as unsafe · ${count(mod.blocked)} writes blocked${mod.errors > 0 ? ` · ${count(mod.errors)} errors` : ''}`, mod.dropped + mod.blocked > 0 ? THEME.warn : undefined))+ rows.push(text(ctx, ` written ${ago(mod.updatedMs, ctx.nowMs)}${stale ? ' (an earlier session)' : ''} · /agentdb status|recall|scan|recent`, { dimColor: true }))++ for (const item of mod.recent) {+ rows.push(text(ctx, ` ◆ ${item.snippet.slice(0, Math.max(20, ctx.columns - 30))} [${item.source}${item.score === null ? '' : ` ${item.score.toFixed(2)}`}]`, { color: THEME.info }))+ }++ return rows+}diff --git a/plugins/ruflo-console/hooks/views/memory.ts b/plugins/ruflo-console/hooks/views/memory.tsindex e90e282520..965bf70be2 100644--- a/plugins/ruflo-console/hooks/views/memory.ts+++ b/plugins/ruflo-console/hooks/views/memory.ts@@ -2,6 +2,7 @@ import type { RenderElement } from 'claude-code'import type { MemoryEntry, MemoryStats, Namespaces } from '../data/cli'import { gauge, recency, sparkline } from '../memory-lines'+import { agentdbModRows } from './agentdb-mod'import { ago, button, clip, col, count, kv, live, row, rule, sourceLine, text, THEME, type Ctx } from './common'import { areaPanel, memoryLabRows } from './memory-lab'@@ -140,5 +141,5 @@ export function memoryView(ctx: Ctx): RenderElement {const spaces = live<Namespaces>(ctx.state.probes.get('namespaces'))const entries = spaces?.entries ?? []- return col(ctx, [...storeRows(ctx, memory, spaces), ...namespaceRows(ctx, spaces), ...timelineRows(ctx, entries), ...browseRows(ctx, entries), ...areaPanel(ctx, 'browse'), ...memoryLabRows(ctx), text(ctx, 'spend, budget gauge and burn: Cost (9)', { dimColor: true })], 'memory')+ return col(ctx, [...storeRows(ctx, memory, spaces), ...agentdbModRows(ctx), ...namespaceRows(ctx, spaces), ...timelineRows(ctx, entries), ...browseRows(ctx, entries), ...areaPanel(ctx, 'browse'), ...memoryLabRows(ctx), text(ctx, 'spend, budget gauge and burn: Cost (9)', { dimColor: true })], 'memory')}diff --git a/plugins/ruflo-console/scripts/smoke.sh b/plugins/ruflo-console/scripts/smoke.shindex c6c7c45fb1..e9fd291612 100755--- a/plugins/ruflo-console/scripts/smoke.sh+++ b/plugins/ruflo-console/scripts/smoke.sh@@ -11,9 +11,9 @@ step() { printf "→ %s ... " "$1"; }ok() { printf "PASS\n"; PASS=$((PASS+1)); }bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }-step "1. plugin.json declares ruflo-console 0.30.0"+step "1. plugin.json declares ruflo-console 0.31.0"grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \- && grep -q '"version": "0.30.0"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"+ && grep -q '"version": "0.31.0"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"step "2. hooks.json names exactly one module and no classic hook commands"grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \diff --git a/plugins/ruflo-console/tests/agentdb-mod.spec.ts b/plugins/ruflo-console/tests/agentdb-mod.spec.tsnew file mode 100644index 0000000000..d2b689b9dd--- /dev/null+++ b/plugins/ruflo-console/tests/agentdb-mod.spec.ts@@ -0,0 +1,57 @@+/**+ * The AgentDB mod's status file as the console reads it (ADR-445): the parser's shape checks, and the section the Memory page draws from it.+ * npx vitest run plugins/ruflo-console/tests/agentdb-mod.spec.ts+ */+import { describe, expect, it } from 'vitest'++import { parseAgentdbMod } from '../hooks/data/agentdb-mod'+import { PROJECT } from '../hooks/data/files'++const FILE = {+ version: 1,+ updatedMs: 1_700_000_000_000,+ recall: true,+ guard: true,+ source: 'auto',+ attached: 4,+ skipped: 2,+ cached: 1,+ timedOut: 1,+ dropped: 2,+ blocked: 3,+ errors: 0,+ lastMs: 41,+ lastTool: 'agentdb',+ recent: [{ atMs: 1, source: 'agentdb', score: 0.91, snippet: 'use HNSW above 5k vectors' }],+}++describe('parseAgentdbMod', () => {+ it('reads version 1 of the file', () => {+ expect(parseAgentdbMod(JSON.stringify(FILE))).toMatchObject({ recall: true, guard: true, attached: 4, dropped: 2, blocked: 3, lastMs: 41, tool: 'agentdb' })+ expect(parseAgentdbMod(JSON.stringify(FILE))?.recent).toEqual([{ source: 'agentdb', score: 0.91, snippet: 'use HNSW above 5k vectors' }])+ })++ it('refuses a shape it does not know, and junk', () => {+ expect(parseAgentdbMod(JSON.stringify({ ...FILE, version: 2 }))).toBeNull()+ expect(parseAgentdbMod('not json')).toBeNull()+ expect(parseAgentdbMod(null)).toBeNull()+ expect(parseAgentdbMod('[]')).toBeNull()+ })++ it('clamps counters and cuts long text; a negative or missing number is zero', () => {+ const parsed = parseAgentdbMod(JSON.stringify({ ...FILE, attached: -5, skipped: 'x', recent: [{ source: 's'.repeat(99), snippet: 'y'.repeat(999) }, { snippet: 4 }, 9] }))++ expect(parsed).toMatchObject({ attached: 0, skipped: 0 })+ expect(parsed?.recent).toHaveLength(1)+ expect(parsed?.recent[0]?.snippet).toHaveLength(120)+ expect(parsed?.recent[0]?.source).toHaveLength(24)+ })+})++describe('where the console looks', () => {+ it('reads the status file under the project, never outside it', () => {+ expect(PROJECT.agentdbMod).toBe('.claude-flow/agentdb-mod/status.json')+ expect(PROJECT.agentdbMod.startsWith('/')).toBe(false)+ expect(PROJECT.agentdbMod.includes('..')).toBe(false)+ })+})diff --git a/v3/docs/adr/ADR-445-agentdb-as-a-mod.md b/v3/docs/adr/ADR-445-agentdb-as-a-mod.mdindex 7f58a6823d..0232df2fdc 100644--- a/v3/docs/adr/ADR-445-agentdb-as-a-mod.md+++ b/v3/docs/adr/ADR-445-agentdb-as-a-mod.md@@ -1,6 +1,6 @@# ADR 445: AgentDB as a mod: safe recall in the prompt, a write guard, `/agentdb`, and a status the console shows-Status: Proposed+Status: Accepted (implemented in ruflo-agentdb 0.4.0 and ruflo-console 0.31.0)Date: 2026 10 05@@ -52,3 +52,11 @@ Settings are the plugin's `userConfig`, which the console's Settings page alread- Auto-learning (writing to memory at the end of a turn) and `agentdb_feedback` from outcomes: a write path with a weak signal. Left for a later ADR with evidence.- Moving the ruflo CLI to `ruvector` 0.3.x.- Use of `recall with-certificate` provenance certificates in the frame (the CLI has it; whether a connected tool exposes it is UNVERIFIED).++## 6. Result (2026-10-05)++- Implemented as designed: `hooks/{options,screen,recall,tools,guard,command,status,register}.ts`, all under 120 lines; `claude plugin validate` lists the hooks (`session.start`, `prompt.submit`, `tool.call`, `command.run`) and only `$.clock`, `$.command`, `$.fs.write`, `$.mcp.call`, `$.session.root`, `$.tool.list` as calls: no `$.http`, no `$.process`.+- **The mod reads memory with `$.mcp.call`** on the connected server (the name is split out of `$.tool.list()`), so it needs no CLI and is not blocked by a permission prompt; `hooks_recall` / `agentdb_hierarchical-recall` / `agentdb_pattern-search` take `query` and `topK` (checked against the tool schemas).+- 20 tests under `claude plugin test` (screening, parsing, the guard, the prompt hook with a mocked tool, the deadline, the cache, `/agentdb`). The console adds a status parser spec and the Memory page section; the console's own results are unchanged (165/39 under `claude plugin test` before and after; the 39 need the CI kit).+- Cost of the mod's own work (`scripts/bench.mjs`, median of 7): scan of 2 KB 8.8 µs; guard on a clean memory write 5.5 µs; parse + screen + frame of 5 results 22 µs; 20 KB adversarial input (ReDoS probe) 0.53 ms, linear. All negligible beside the read it wraps.+- Finding while writing it: a regex literal holding raw U+2028 in the source breaks the mod parser; the character class is built with `new RegExp` from escaped text.