extractFromToolOutput method
Extract from a tool's output.
Implementation
List<MemoryCandidate> extractFromToolOutput(String toolName, String output) {
if (output.length < 20) return [];
final candidates = _matchPatterns(output, ExtractionSource.toolOutput);
// Boost confidence for build/test tool output.
if (toolName == 'bash' || toolName == 'shell') {
for (var i = 0; i < candidates.length; i++) {
final c = candidates[i];
if (c.category == MemoryCategory.buildInstructions ||
c.category == MemoryCategory.testingGuidelines) {
candidates[i] = MemoryCandidate(
content: c.content,
source: c.source,
category: c.category,
confidence: min(c.confidence + 0.1, 1.0),
reasoning: '${c.reasoning} (from $toolName output)',
relatedFile: c.relatedFile,
);
}
}
}
return _filterAndCap(candidates);
}