MCPcopy Create free account
hub / github.com/diillson/chatcli / appendMemoryRound

Function appendMemoryRound

cli/chat_memory.go:114–125  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

112// model's call is acknowledged, and the tool result becomes the new pending
113// prompt.
114func 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

Callers 3

TestAppendMemoryRoundFunction · 0.85
executeChatAskNativeMethod · 0.85
executeChatAskXMLMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestAppendMemoryRoundFunction · 0.68