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

feat(ruflo-agentdb): guard four more free-text writers (0.4.5)

ruv79470ce89214
diff --git a/plugins/ruflo-agentdb/.claude-plugin/plugin.json b/plugins/ruflo-agentdb/.claude-plugin/plugin.json
index 167f0d009b..47b420ac3a 100644
--- a/plugins/ruflo-agentdb/.claude-plugin/plugin.json
+++ b/plugins/ruflo-agentdb/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-agentdb",
"description": "Substrate plugin for Ruflo memory: AgentDB controller bridge (15 agentdb_* MCP tools), RuVector ONNX embeddings (10 embeddings_* tools incl. RaBitQ 32x quantization), and WASM HNSW pattern router (3 ruvllm_hnsw_* tools). As a mod (ADR-445): opt-in safe recall into the prompt, a write guard that keeps secrets out of memory, /agentdb, and a status file the console shows",
- "version": "0.4.4",
+ "version": "0.4.5",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
diff --git a/plugins/ruflo-agentdb/README.md b/plugins/ruflo-agentdb/README.md
index 88eb0d30bb..be5b83bca3 100644
--- a/plugins/ruflo-agentdb/README.md
+++ b/plugins/ruflo-agentdb/README.md
@@ -205,13 +205,13 @@ bash plugins/ruflo-agentdb/scripts/smoke.sh
The 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.4, ADR-445)
+## As a mod (0.4.5, 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. The shared screen (`hooks/screen.ts`, copied to every mod by `scripts/sync-mod-screen.mjs`) judges an assignment by its value: calls, env references, identifier paths, placeholders, UUIDs, secret-manager paths and hyphenated names are not secrets; a literal needs two character classes (one a digit or symbol) and at least 2.5 bits of entropy per character. Vendor keys (Stripe, npm, HuggingFace, SendGrid, Twilio, Slack webhooks) and `scheme://user:pass@host` URLs are matched by shape; input is scanned in one pass up to 200 KB (head and tail beyond that). |
+| **Secret guard** | on | Refuses a memory write (`agentdb_hierarchical-store`, `agentdb_pattern-store`, `agentdb_batch`, `agentdb_causal-edge`, `memory_store`, `hooks_remember`, `hooks_intelligence_pattern-store`, `agentdb_feedback`, `agentdb_session-end`, `hive-mind_memory`, `session_save`) that holds a private key, cloud/GitHub/Slack token, bearer token, JWT or key-like assignment. The secret is never echoed. The shared screen (`hooks/screen.ts`, copied to every mod by `scripts/sync-mod-screen.mjs`) judges an assignment by its value: calls, env references, identifier paths, placeholders, UUIDs, secret-manager paths and hyphenated names are not secrets; a literal needs two character classes (one a digit or symbol) and at least 2.5 bits of entropy per character. Vendor keys (Stripe, npm, HuggingFace, SendGrid, Twilio, Slack webhooks) and `scheme://user:pass@host` URLs are matched by shape; input is scanned in one pass up to 200 KB (head and tail beyond that). |
| **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 tools, in order: `memory_search` (semantic: the only reader that finds a paraphrase; its 60-character cut is completed with `memory_retrieve`), `agentdb_hierarchical-recall` and `agentdb_pattern-search` (substring matches, so also asked with the prompt's salient words), ruvector `hooks_recall`. A result scoring under 0.25 is noise and skipped. No CLI, no network. Skipped for slash commands, `!` lines and short prompts; gives up after `recallDeadlineMs` (800; the first recall of a fresh session takes 0.5–1.5 s, so consider 1500); 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-mod`** | — | `status`, `recall <text>`, `scan <text>`, `recent`; answered locally, no model call. |
diff --git a/plugins/ruflo-agentdb/hooks/tools.ts b/plugins/ruflo-agentdb/hooks/tools.ts
index c7f946e183..2be28761d5 100644
--- a/plugins/ruflo-agentdb/hooks/tools.ts
+++ b/plugins/ruflo-agentdb/hooks/tools.ts
@@ -53,6 +53,10 @@ const WRITERS = new Set([
'memory_store',
'hooks_remember',
'hooks_intelligence_pattern-store',
+ 'agentdb_feedback',
+ 'agentdb_session-end',
+ 'hive-mind_memory',
+ 'session_save',
])
export const isWriter = (name: string) => WRITERS.has(splitName(name)?.tool ?? name)
diff --git a/plugins/ruflo-agentdb/scripts/smoke.sh b/plugins/ruflo-agentdb/scripts/smoke.sh
index eb1db1d110..cda1a101a8 100755
--- a/plugins/ruflo-agentdb/scripts/smoke.sh
+++ b/plugins/ruflo-agentdb/scripts/smoke.sh
@@ -48,10 +48,10 @@ grep -q "## Namespace convention" "$ROOT/README.md" \
&& ok || bad "Namespace convention section missing"
# 1. Plugin version + new keywords
-step "1. plugin.json declares version 0.4.4 with rabitq + namespace-convention keywords"
+step "1. plugin.json declares version 0.4.5 with rabitq + namespace-convention keywords"
v=$(grep -E '"version"[[:space:]]*:' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
-if [[ "$v" != "0.4.4" ]]; then
- bad "expected 0.4.4, got '$v'"
+if [[ "$v" != "0.4.5" ]]; then
+ bad "expected 0.4.5, got '$v'"
else
miss=""
for k in rabitq quantization namespace-convention controller-bridge; do
diff --git a/plugins/ruflo-agentdb/tests/guard-scan.test.ts b/plugins/ruflo-agentdb/tests/guard-scan.test.ts
index 5461cef9af..9bd4c24255 100644
--- a/plugins/ruflo-agentdb/tests/guard-scan.test.ts
+++ b/plugins/ruflo-agentdb/tests/guard-scan.test.ts
@@ -42,3 +42,23 @@ describe('the memory write guard reads what the walker cannot', () => {
expect(verdict('memory_search', { key: 'api_key', value: TOKEN })).toBeUndefined()
})
})
+
+describe('the write-capable tools found by checking the registry schemas are guarded', () => {
+ const cases: ReadonlyArray<readonly [string, Record<string, unknown>]> = [
+ ['agentdb_feedback', { taskId: 't1', patterns: [`api_key=${TOKEN}`] }],
+ ['agentdb_session-end', { sessionId: 's1', summary: `deploy used password=${TOKEN}` }],
+ ['hive-mind_memory', { action: 'set', key: 'creds', value: { token: TOKEN } }],
+ ['session_save', { name: 'work', description: `secret: ${TOKEN}` }],
+ ]
+ for (const [tool, input] of cases) {
+ test(`${tool} is refused with a secret and passes without one`, () => {
+ expect(verdict(tool, input)).toMatch(/secret/)
+ expect(verdict(`mcp__ruflo__${tool}`, input)).toMatch(/secret/)
+ expect(verdict(tool, JSON.parse(JSON.stringify(input).replaceAll(TOKEN, 'see the vault')))).toBeUndefined()
+ })
+ }
+
+ test('tools that take no free text stay unguarded', () => {
+ for (const tool of ['memory_import', 'rvf_ingest', 'hooks_compress_store']) expect(verdict(tool, { value: `api_key=${TOKEN}` })).toBeUndefined()
+ })
+})