From 33325b48d91c888ccde115cc45ca96e628dad9c8 Mon Sep 17 00:00:00 2001 From: Ammar Date: Mon, 24 Nov 2025 14:00:36 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20compaction=20prompt=20foc?= =?UTF-8?q?uses=20entirely=20on=20summary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated compaction prompt to explicitly instruct model to focus on summarizing what has happened, not suggest next steps or future actions - Added test to verify prompt contains strict summary instructions - Updated mock scenario to match new prompt text --- src/browser/utils/chatCommands.test.ts | 12 ++++++++++++ src/browser/utils/chatCommands.ts | 2 +- src/node/services/mock/scenarios/slashCommands.ts | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/browser/utils/chatCommands.test.ts b/src/browser/utils/chatCommands.test.ts index cb42943d8..ae3696198 100644 --- a/src/browser/utils/chatCommands.test.ts +++ b/src/browser/utils/chatCommands.test.ts @@ -120,4 +120,16 @@ describe("prepareCompactionMessage", () => { expect(metadata.parsed.resumeModel).toBe(sendMessageOptions.model); }); + + test("generates correct prompt text with strict summary instructions", () => { + const sendMessageOptions = createBaseOptions(); + const { messageText } = prepareCompactionMessage({ + workspaceId: "ws-1", + maxOutputTokens: 4096, + sendMessageOptions, + }); + + expect(messageText).toContain("Focus entirely on the summary"); + expect(messageText).toContain("Do not suggest next steps or future actions"); + }); }); diff --git a/src/browser/utils/chatCommands.ts b/src/browser/utils/chatCommands.ts index bd7f064fa..51c41d0e2 100644 --- a/src/browser/utils/chatCommands.ts +++ b/src/browser/utils/chatCommands.ts @@ -200,7 +200,7 @@ export function prepareCompactionMessage(options: CompactionOptions): { const targetWords = options.maxOutputTokens ? Math.round(options.maxOutputTokens / 1.3) : 2000; // Build compaction message with optional continue context - let messageText = `Summarize this conversation into a compact form for a new Assistant to continue helping the user. Use approximately ${targetWords} words.`; + let messageText = `Summarize this conversation into a compact form for a new Assistant to continue helping the user. Focus entirely on the summary of what has happened. Do not suggest next steps or future actions. Use approximately ${targetWords} words.`; if (options.continueMessage) { messageText += `\n\nThe user wants to continue with: ${options.continueMessage}`; diff --git a/src/node/services/mock/scenarios/slashCommands.ts b/src/node/services/mock/scenarios/slashCommands.ts index 922abbd96..448803325 100644 --- a/src/node/services/mock/scenarios/slashCommands.ts +++ b/src/node/services/mock/scenarios/slashCommands.ts @@ -7,7 +7,7 @@ export const SLASH_COMMAND_PROMPTS = { } as const; export const COMPACTION_MESSAGE = - "Summarize this conversation into a compact form for a new Assistant to continue helping the user. Use approximately 385 words."; + "Summarize this conversation into a compact form for a new Assistant to continue helping the user. Focus entirely on the summary of what has happened. Do not suggest next steps or future actions. Use approximately 385 words."; export const COMPACT_SUMMARY_TEXT = "Compact summary: The assistant read project files, listed directory contents, created and inspected test.txt, then confirmed the contents remained 'hello'. Technical details preserved.";