| 992 | query := toolMemoryRecallQuery(state.LastQuery, toolResults, executor) |
| 993 | if query == "" { |
| 994 | return |
| 995 | } |
| 996 | // Tool follow-up recall is deliberately local. Tool inputs and outputs are |
| 997 | // useful retrieval anchors but must not become a second remote expansion. |
| 998 | recalled := RunMemoryRecallWithEngine(ctx, e.Config, state, query, e.memoryEngineSnapshot()) |
| 999 | for _, item := range recalled { |
| 1000 | if len(item.RecallIDs) > 0 { |
| 1001 | InjectRecalledMemories(state, recalled) |
| 1002 | return |
| 1003 | } |
| 1004 | } |
| 1005 | } |
| 1006 | |
| 1007 | func toolMemoryRecallQuery(original string, toolResults []map[string]any, executor *StreamingToolExecutor) string { |
| 1008 | parts := []string{strings.TrimSpace(original)} |
| 1009 | for _, result := range toolResults { |