appendMemoryRound folds one memory call into the conversation being built for the next decision call: the pending prompt becomes a user turn, the model's call is acknowledged, and the tool result becomes the new pending prompt.
(history []models.Message, prompt, callJSON, result string)
| 112 | // model's call is acknowledged, and the tool result becomes the new pending |
| 113 | // prompt. |
| 114 | func appendMemoryRound(history []models.Message, prompt, callJSON, result string) ([]models.Message, string) { |
| 115 | next := make([]models.Message, 0, len(history)+2) |
| 116 | next = append(next, history...) |
| 117 | next = append(next, |
| 118 | models.Message{Role: "user", Content: prompt}, |
| 119 | models.Message{Role: "assistant", Content: "[memory call] " + callJSON}, |
| 120 | ) |
| 121 | followup := "memory result:\n" + result + |
| 122 | "\n\nContinue: call memory again only if the update is incomplete, " + |
| 123 | "then confirm to the user exactly what was persisted (never more than that)." |
| 124 | return next, followup |
| 125 | } |
| 126 | |
| 127 | // chatMemoryXMLInstruction is appended to the decision-turn prompt for |
| 128 | // providers WITHOUT native tools. It overrides the tool-less framing for this |
no outgoing calls