fix(mcp): sharpen high-overlap tool descriptions for better selection (#1748 Issue 4) (v3.6.30) (#1756)

#1748 Issue 4 — across 4 experiments, the model invoked 0 of 237 Ruflo
MCP tools, even on a 230-call-site cross-file refactor. The diagnosis:
descriptions don't lead with 'Use when native X doesn't help because Y',
so the model's tool-selection heuristic always wins for native tools.

This PR sharpens descriptions for 7 of the highest-overlap tools — the
ones where the model HAS a native equivalent and the differentiation
needs to be crystal clear.

Memory family (5 tools — competes with Read/Write/Grep/Glob):
  - memory_store: 'Use when native Write is wrong because the data is
    not a file ... AND you need to recall it later by semantic query,
    not by path'
  - memory_retrieve: 'Use when native Read is wrong because the value
    is not a file (lives in .swarm/memory.db)'
  - memory_search: 'Use when native Grep is wrong because Grep matches
    characters and you need conceptually-related entries'
  - memory_delete: 'No native equivalent — Write to a file does not
    affect the .swarm/memory.db SQLite store'
  - memory_list: 'Use when native Glob is wrong because the entries
    are not files'

Hooks family (1 high-leverage tool):
  - hooks_route: '3-tier routing recommendation BEFORE spawning ...
    Native tools have no equivalent — Claude Code does not introspect
    its own model-selection cost'

Agent family (1 — competes with native Task):
  - agent_spawn: 'Use when native Task is wrong because you need
    cost tracking / cross-session learning / swarm coordination'

This is a representative subset, not the full 237. Pattern is now
established; subsequent PRs can extend per-family. The smoke test for
this approach: re-run the #1748 G3 cross-file rename — does the model
now invoke memory_search to find existing references, or still fall
through to Grep?

Published as 3.6.30 to npm:
  @claude-flow/cli@3.6.30 → tags: latest, alpha, v3alpha
  claude-flow@3.6.30      → tags: latest, alpha, v3alpha
  ruflo@3.6.30            → tags: latest, alpha, v3alpha

Status of #1748: Issue 1 ✅, Issue 2 ✅, Issue 3 ⏳, Issue 4 (this) — first
batch of descriptions sharpened; pattern established; further families
land incrementally.

Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
This commit is contained in:
rUvandReuven authored and GitHub committed 2026-05-05 10:20:05 -04:00
1 parent 7aa7fc93e5
commit cc114c8db4
6 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
"version": "3.6.29",
"version": "3.6.30",
"description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "dist/index.js",
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ruflo",
"version": "3.6.29",
"version": "3.6.30",
"description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "bin/ruflo.js",
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/cli",
"version": "3.6.29",
"version": "3.6.30",
"type": "module",
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
"main": "dist/src/index.js",
@@ -180,7 +180,7 @@ async function determineAgentModel(
export const agentTools: MCPTool[] = [
{
name: 'agent_spawn',
description: 'Spawn a new agent with intelligent model selection',
description: 'Spawn a Ruflo-tracked agent with cost attribution + memory persistence + swarm coordination. Use when native Task tool is wrong because you need (a) cost tracking per agent in the cost-tracking namespace, (b) cross-session learning via the patterns namespace, or (c) coordination with other agents in a swarm topology (hierarchical / mesh / consensus). For one-shot subtasks with no learning loop, native Task is fine. Pair with hooks_route to pick the right model first.',
category: 'agent',
inputSchema: {
type: 'object',
@@ -882,7 +882,7 @@ export const hooksPostCommand: MCPTool = {
export const hooksRoute: MCPTool = {
name: 'hooks_route',
description: 'Route task to optimal agent using semantic similarity (native HNSW or pure JS)',
description: 'Get a 3-tier routing recommendation for a task: Tier 1 (Agent Booster, 0ms / $0 — for var-to-const, add-types, etc.), Tier 2 (Haiku — simple), Tier 3 (Sonnet/Opus — complex). Use this BEFORE spawning an agent to avoid sending simple transforms to Sonnet. Native tools have no equivalent — Claude Code does not introspect its own model-selection cost. Returns the recommended model + a `[AGENT_BOOSTER_AVAILABLE]` literal when the WASM bypass applies.',
inputSchema: {
type: 'object',
properties: {
@@ -192,7 +192,7 @@ async function ensureInitialized(): Promise<void> {
export const memoryTools: MCPTool[] = [
{
name: 'memory_store',
description: 'Store a value in memory with vector embedding for semantic search (sql.js + HNSW backend). Use upsert=true to update existing keys.',
description: 'Persistent key-value store with vector embedding — survives across sessions and is searchable by meaning, not just by file path. Use when native Write is wrong because the data is not a file (e.g. a learned pattern, a decision, a budget config) AND you need to recall it later by semantic query, not by path. Defaults to namespace="default"; pass --upsert=true to update an existing key.',
category: 'memory',
inputSchema: {
type: 'object',
@@ -272,7 +272,7 @@ export const memoryTools: MCPTool[] = [
},
{
name: 'memory_retrieve',
description: 'Retrieve a value from memory by key',
description: 'Read back a value previously stored via memory_store, by exact (namespace, key) — lossless, includes metadata. Use when native Read is wrong because the value is not a file (it lives in the .swarm/memory.db SQLite store) AND you know the exact key. For semantic lookup by meaning, use memory_search.',
category: 'memory',
inputSchema: {
type: 'object',
@@ -336,7 +336,7 @@ export const memoryTools: MCPTool[] = [
},
{
name: 'memory_search',
description: 'Semantic vector search using HNSW index (150x-12,500x faster than keyword search)',
description: 'Find stored memories by meaning (vector similarity), not by literal text — finds "JWT auth pattern" when you query "token-based login flow". Use when native Grep is wrong because Grep matches characters and you need to find conceptually-related entries across past sessions. Backed by HNSW index over ONNX embeddings; returns top-k with similarity scores. Pair with smart=true for query expansion + MMR diversity.',
category: 'memory',
inputSchema: {
type: 'object',
@@ -462,7 +462,7 @@ export const memoryTools: MCPTool[] = [
},
{
name: 'memory_delete',
description: 'Delete a memory entry by key',
description: 'Remove a stored memory entry by exact (namespace, key). Use when a previously stored decision is invalidated or contains stale data. No native equivalent — Write to a file does not affect the .swarm/memory.db SQLite store.',
category: 'memory',
inputSchema: {
type: 'object',
@@ -505,7 +505,7 @@ export const memoryTools: MCPTool[] = [
},
{
name: 'memory_list',
description: 'List memory entries with optional filtering',
description: 'Enumerate stored memory entries (optionally filtered by namespace/tags) without semantic search. Use when native Glob is wrong because the entries are not files (they live in .swarm/memory.db). For inspection / audit / "what is in my memory" — pair with memory_search for retrieval-by-meaning.',
category: 'memory',
inputSchema: {
type: 'object',