core: ephemerally wrap queued user messages with reminder to stay on track (#6725)

pull/6624/head^2
Aiden Cline 2026-01-02 20:42:56 -08:00 committed by GitHub
parent 401b498c7d
commit f991fbbde8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 0 deletions

View File

@ -560,6 +560,25 @@ export namespace SessionPrompt {
const sessionMessages = clone(msgs)
// Ephemerally wrap queued user messages with a reminder to stay on track
if (step > 1 && lastFinished) {
for (const msg of sessionMessages) {
if (msg.info.role !== "user" || msg.info.id <= lastFinished.id) continue
for (const part of msg.parts) {
if (part.type !== "text" || part.ignored || part.synthetic) continue
if (!part.text.trim()) continue
part.text = [
"<system-reminder>",
"The user sent the following message:",
part.text,
"",
"Please address this message and continue with your tasks.",
"</system-reminder>",
].join("\n")
}
}
}
await Plugin.trigger("experimental.chat.messages.transform", {}, { messages: sessionMessages })
const result = await processor.process({