Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions v3/@claude-flow/cli/src/commands/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2073,11 +2073,11 @@ const intelligenceCommand: Command = {
],
data: [
{ metric: 'Status', value: formatIntelligenceStatus(result.components.sona.status) },
{ metric: 'Learning Time', value: `${result.components.sona.learningTimeMs.toFixed(3)}ms` },
{ metric: 'Adaptation Time', value: `${result.components.sona.adaptationTimeMs.toFixed(3)}ms` },
{ metric: 'Trajectories', value: result.components.sona.trajectoriesRecorded },
{ metric: 'Patterns Learned', value: result.components.sona.patternsLearned },
{ metric: 'Avg Quality', value: `${(result.components.sona.avgQuality * 100).toFixed(1)}%` }
{ metric: 'Learning Time', value: `${(result.components.sona.learningTimeMs ?? 0).toFixed(3)}ms` },
{ metric: 'Adaptation Time', value: `${(result.components.sona.adaptationTimeMs ?? 0).toFixed(3)}ms` },
{ metric: 'Trajectories', value: result.components.sona.trajectoriesRecorded ?? 0 },
{ metric: 'Patterns Learned', value: result.components.sona.patternsLearned ?? 0 },
{ metric: 'Avg Quality', value: `${((result.components.sona.avgQuality ?? 0) * 100).toFixed(1)}%` }
]
});
} else {
Expand All @@ -2095,9 +2095,9 @@ const intelligenceCommand: Command = {
],
data: [
{ metric: 'Status', value: formatIntelligenceStatus(result.components.moe.status) },
{ metric: 'Active Experts', value: result.components.moe.expertsActive },
{ metric: 'Routing Accuracy', value: `${(result.components.moe.routingAccuracy * 100).toFixed(1)}%` },
{ metric: 'Load Balance', value: `${(result.components.moe.loadBalance * 100).toFixed(1)}%` }
{ metric: 'Active Experts', value: result.components.moe.expertsActive ?? 0 },
{ metric: 'Routing Accuracy', value: `${((result.components.moe.routingAccuracy ?? 0) * 100).toFixed(1)}%` },
{ metric: 'Load Balance', value: `${((result.components.moe.loadBalance ?? 0) * 100).toFixed(1)}%` }
]
});
} else {
Expand All @@ -2115,10 +2115,10 @@ const intelligenceCommand: Command = {
],
data: [
{ metric: 'Status', value: formatIntelligenceStatus(result.components.hnsw.status) },
{ metric: 'Index Size', value: result.components.hnsw.indexSize.toLocaleString() },
{ metric: 'Search Speedup', value: output.success(result.components.hnsw.searchSpeedup) },
{ metric: 'Memory Usage', value: result.components.hnsw.memoryUsage },
{ metric: 'Dimension', value: result.components.hnsw.dimension }
{ metric: 'Index Size', value: (result.components.hnsw.indexSize ?? 0).toLocaleString() },
{ metric: 'Search Speedup', value: output.success(result.components.hnsw.searchSpeedup ?? 'N/A') },
{ metric: 'Memory Usage', value: result.components.hnsw.memoryUsage ?? (result.components.hnsw.memorySizeBytes ? `${Math.round(result.components.hnsw.memorySizeBytes / 1024)}KB` : 'N/A') },
{ metric: 'Dimension', value: result.components.hnsw.dimension ?? result.components.embeddings?.dimension ?? 'N/A' }
Comment on lines +2118 to +2121
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's check if the file exists and get basic info
head -1 "v3/@claude-flow/cli/src/commands/hooks.ts" 2>/dev/null && echo "File found" || echo "File not found or checking path"
wc -l "v3/@claude-flow/cli/src/commands/hooks.ts"

Repository: blackms/claude-flow

Length of output: 124


🏁 Script executed:

# Verify memorySizeBytes usage in the codebase as requested
rg -n 'memorySizeBytes' --type=ts

Repository: blackms/claude-flow

Length of output: 971


🏁 Script executed:

# Read the type definition around lines 2008-2015
sed -n '2000,2030p' "v3/@claude-flow/cli/src/commands/hooks.ts" | cat -n

Repository: blackms/claude-flow

Length of output: 1114


🏁 Script executed:

# Read the code snippet around lines 2118-2121 to verify context
sed -n '2110,2130p' "v3/@claude-flow/cli/src/commands/hooks.ts" | cat -n

Repository: blackms/claude-flow

Length of output: 1311


🏁 Script executed:

# Search for where the HNSW response object is being constructed
rg -n -B 5 -A 5 'hnsw.*:.*{' "v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts" | head -100

Repository: blackms/claude-flow

Length of output: 146


🏁 Script executed:

# Look for where the response with hnsw component is returned
rg -n 'components.*hnsw' "v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts" | head -20

Repository: blackms/claude-flow

Length of output: 45


🏁 Script executed:

# Search for where hnsw response is being constructed in hooks-tools.ts
rg -n "hnsw" "v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts" | grep -i "return\|response\|components" | head -20

Repository: blackms/claude-flow

Length of output: 45


🏁 Script executed:

# Look at the entire function that returns the response with hnsw
# First find all hnsw assignments
rg -n -A 15 "hnsw:" "v3/@claude-flow/cli/src/mcp-tools/hooks-tools.ts" | head -80

Repository: blackms/claude-flow

Length of output: 2038


🏁 Script executed:

# Let's find which function/tool returns the response printed at line 2120
# Look at context around line 2120 to see the function name
sed -n '2070,2130p' "v3/@claude-flow/cli/src/commands/hooks.ts" | cat -n

Repository: blackms/claude-flow

Length of output: 3510


🏁 Script executed:

# Also search for the function that contains the type definition at lines 2008-2015
sed -n '1995,2045p' "v3/@claude-flow/cli/src/commands/hooks.ts" | cat -n

Repository: blackms/claude-flow

Length of output: 1839


Add memorySizeBytes to the HNSW type definition — accessing an undeclared field will cause TS2339.

On line 2120, the code accesses result.components.hnsw.memorySizeBytes, but the type parameter for callMCPTool (lines 2008–2021) does not include this field. The MCP backend returns memorySizeBytes (visible in hooks-tools.ts), so add it to the type definition to resolve the compilation error:

hnsw: {
  enabled: boolean;
  status: string;
  indexSize: number;
  searchSpeedup: string;
  memoryUsage: string;
  dimension: number;
  memorySizeBytes?: number;
};
🤖 Prompt for AI Agents
In `@v3/`@claude-flow/cli/src/commands/hooks.ts around lines 2118 - 2121, The HNSW
object returned by callMCPTool is missing the optional memorySizeBytes property
in its type declaration, causing TS2339 when accessing
result.components.hnsw.memorySizeBytes; update the type parameter passed to
callMCPTool (the HNSW subtype used around lines where callMCPTool is defined) to
include memorySizeBytes?: number alongside the existing fields (enabled, status,
indexSize, searchSpeedup, memoryUsage, dimension) so the access to
result.components.hnsw.memorySizeBytes compiles safely.

]
});
} else {
Expand All @@ -2137,19 +2137,19 @@ const intelligenceCommand: Command = {
{ metric: 'Provider', value: result.components.embeddings.provider },
{ metric: 'Model', value: result.components.embeddings.model },
{ metric: 'Dimension', value: result.components.embeddings.dimension },
{ metric: 'Cache Hit Rate', value: `${(result.components.embeddings.cacheHitRate * 100).toFixed(1)}%` }
{ metric: 'Cache Hit Rate', value: `${((result.components.embeddings.cacheHitRate ?? 0) * 100).toFixed(1)}%` }
]
});

// V3 Performance
output.writeln();
output.writeln(output.bold('🚀 V3 Performance Gains'));
output.printList([
`Flash Attention: ${output.success(result.performance.flashAttention)}`,
`Memory Reduction: ${output.success(result.performance.memoryReduction)}`,
`Search Improvement: ${output.success(result.performance.searchImprovement)}`,
`Token Reduction: ${output.success(result.performance.tokenReduction)}`,
`SWE-Bench Score: ${output.success(result.performance.sweBenchScore)}`
`Flash Attention: ${output.success(result.performance?.flashAttention ?? 'N/A')}`,
`Memory Reduction: ${output.success(result.performance?.memoryReduction ?? 'N/A')}`,
`Search Improvement: ${output.success(result.performance?.searchImprovement ?? 'N/A')}`,
`Token Reduction: ${output.success(result.performance?.tokenReduction ?? 'N/A')}`,
`SWE-Bench Score: ${output.success(result.performance?.sweBenchScore ?? 'N/A')}`
]);

return { success: true, data: result };
Expand Down
Loading