perf(mcp): Replace redundant LLM usages with deterministic logic

- Refactored memory_consolidation_worker to use purely deterministic string normalization ((N)$ regex stripping & lowercase) instead of passing graph entities to Ollama for duplication detection.
- Removed redundant Ollama architectural summarization from log_code_change tool since the agent already provides a descriptive summary.
- Removed redundant Ollama fix summarization from log_error_fix tool since the agent already provides a solution string.
This commit is contained in:
Riz Ashraf committed 2026-10-10 10:58:50 +01:00
1 parent 26eaf03b6f
commit e006ef1220
4 files changed
+77 -90

No files matched your search

+1 -30
View File
@@ -24,24 +24,7 @@ impl McpTool for LogErrorFixHandler {
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> crate::error::Result<String> {
let req: LogErrorFixTool = serde_json::from_value(args).map_err(|e| e.to_string())?;
let text_to_embed = format!("Signature: {}\nSolution: {}", req.signature, req.solution);
let mut solution = req.solution;
if state.ollama.is_available().await {
let prompt = format!(
"Analyze this error signature and solution. Output 1 sentence summarizing the root cause and fix:\nSignature: {}\nSolution: {}",
req.signature, solution
);
if let Ok(summary) = state
.ollama
.generate(&prompt, Some(&state.ollama.reasoning_model), None, None)
.await
{
let clean = summary.trim();
if !clean.is_empty() {
solution = format!("{} (AI Analysis: {})", solution, clean);
}
}
}
let solution = req.solution;
let embedding = crate::embedding::generate_embedding_async(text_to_embed)
.await
@@ -204,18 +187,6 @@ impl McpTool for LogCodeChangeHandler {
description = format!("{} [Symbols: {}]", description, symbols.join(", "));
}
if state.ollama.is_available().await {
let prompt = format!(
"Summarize in 1 concise sentence the architectural impact of changing file '{}': {}",
req.file_path, description
);
if let Ok(summary) = state.ollama.generate(&prompt, None, None, None).await {
let clean = summary.trim();
if !clean.is_empty() {
description = format!("{} (AI Summary: {})", description, clean);
}
}
}
let change_kind = match req
.change_kind
.as_deref()