🌊 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
fix(hooks): reject unimplemented hooks_intelligence_attention modes
555aadityae330da07bb87
diff --git a/v3/@claude-flow/cli/__tests__/hooks-attention-mode-3548.test.ts b/v3/@claude-flow/cli/__tests__/hooks-attention-mode-3548.test.tsnew file mode 100644index 0000000000..4235ba3c7c--- /dev/null+++ b/v3/@claude-flow/cli/__tests__/hooks-attention-mode-3548.test.ts@@ -0,0 +1,36 @@+// #3548: hooks_intelligence_attention advertised mode "hyperbolic", but only flash+// and moe have branches. Any other mode returned { results: [], _stub: true } with a+// note telling users to install @ruvector/attention, a package this tool never+// imports. Unimplemented modes are now rejected with an error that says so.++import { describe, it, expect } from 'vitest';+import { hooksIntelligenceAttention } from '../src/mcp-tools/hooks-tools.js';++const call = (params: Record<string, unknown>) =>+ hooksIntelligenceAttention.handler(params) as Promise<Record<string, any>>;++describe('hooks_intelligence_attention modes (#3548)', () => {+ it.each(['hyperbolic', 'not-a-mode'])('rejects unimplemented mode %s instead of returning a stub', async (mode) => {+ const r = await call({ query: 'test', mode });+ expect(r.success).toBe(false);+ expect(r.error).toContain(`"${mode}" is not implemented`);+ expect(r.error).toContain('flash, moe');+ expect(JSON.stringify(r)).not.toContain('@ruvector/attention');+ });++ it('no longer advertises hyperbolic', () => {+ const schema = hooksIntelligenceAttention.inputSchema as { properties: { mode: { description: string } } };+ expect(schema.properties.mode.description).toBe('Attention mode (flash, moe)');+ expect(hooksIntelligenceAttention.description).not.toMatch(/hyperbolic/i);+ });++ it.each(['flash', 'moe', undefined])('still runs mode %s (default: flash)', async (mode) => {+ const r = await call(mode ? { query: 'test', mode } : { query: 'test' });+ expect(r.success).not.toBe(false);+ expect(r.mode).toBe(mode ?? 'flash');+ expect(Array.isArray(r.results)).toBe(true);+ // Honest marker contract (ADR-073) is unchanged for the no-backend case.+ expect(r.stats._stub).toBe(r.stats.implementation === 'none');+ if (r.stats._stub) expect(r.stats._note).toContain('@claude-flow/neural');+ });+});diff --git a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.tsindex 07b7c63b47..822b23228c 100644--- a/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts+++ b/v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts@@ -4397,12 +4397,12 @@ export const hooksIntelligenceLearn: MCPTool = {// Intelligence attention hookexport const hooksIntelligenceAttention: MCPTool = {name: 'hooks_intelligence_attention',- description: 'Compute attention-weighted similarity using MoE/Flash/Hyperbolic Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',+ description: 'Compute attention-weighted similarity using MoE/Flash. Use when native Bash hooks (via Claude Code\'s settings.json) are wrong because you need Ruflo-side state — pattern persistence, neural training signals, model-routing learning, cost tracking, audit chain. For one-off shell commands, plain Bash hooks are fine.',inputSchema: {type: 'object',properties: {query: { type: 'string', description: 'Query for attention computation' },- mode: { type: 'string', description: 'Attention mode (flash, moe, hyperbolic)' },+ mode: { type: 'string', description: 'Attention mode (flash, moe)' },topK: { type: 'number', description: 'Top-k results' },},required: ['query'],@@ -4414,6 +4414,12 @@ export const hooksIntelligenceAttention: MCPTool = {const startTime = performance.now();{ const v = validateText(query, 'query'); if (!v.valid) return { success: false, error: v.error }; }+ // #3548: only flash and moe have an implementation. Any other mode+ // (including the previously advertised 'hyperbolic') used to return an+ // empty stub whose note blamed a missing package; say so instead.+ if (mode !== 'flash' && mode !== 'moe') {+ return { success: false, error: `Attention mode "${mode}" is not implemented; supported modes: flash, moe` };+ }let implementation = 'placeholder';let embeddingSource: 'onnx' | 'hash-fallback' | 'none' = 'none';@@ -4593,7 +4599,7 @@ export const hooksIntelligenceAttention: MCPTool = {implementation,_embeddingSource: embeddingSource,_stub: implementation === 'none',- _note: implementation === 'none' ? 'No attention backend available. Install @ruvector/attention for real computation.' : undefined,+ _note: implementation === 'none' ? 'No attention backend available: flash/moe attention from @claude-flow/neural could not be loaded or failed.' : undefined,...(embeddingSource === 'hash-fallback' && implementation !== 'none'? { _embeddingNote: 'Query embeddings are hash-based (not semantic). Install @claude-flow/embeddings for real ONNX embeddings.' }: {}),