Skip to content

Commit 0d923bf

Browse files
authored
🤖 fix: compaction prompt focuses entirely on summary (#733)
_Generated with `mux`_ Updated compaction prompt to explicitly instruct the model to focus entirely on summarizing what has happened, rather than suggesting next steps or future actions.
1 parent 380be35 commit 0d923bf

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/browser/utils/chatCommands.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,16 @@ describe("prepareCompactionMessage", () => {
120120

121121
expect(metadata.parsed.resumeModel).toBe(sendMessageOptions.model);
122122
});
123+
124+
test("generates correct prompt text with strict summary instructions", () => {
125+
const sendMessageOptions = createBaseOptions();
126+
const { messageText } = prepareCompactionMessage({
127+
workspaceId: "ws-1",
128+
maxOutputTokens: 4096,
129+
sendMessageOptions,
130+
});
131+
132+
expect(messageText).toContain("Focus entirely on the summary");
133+
expect(messageText).toContain("Do not suggest next steps or future actions");
134+
});
123135
});

src/browser/utils/chatCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export function prepareCompactionMessage(options: CompactionOptions): {
200200
const targetWords = options.maxOutputTokens ? Math.round(options.maxOutputTokens / 1.3) : 2000;
201201

202202
// Build compaction message with optional continue context
203-
let messageText = `Summarize this conversation into a compact form for a new Assistant to continue helping the user. Use approximately ${targetWords} words.`;
203+
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.`;
204204

205205
if (options.continueMessage) {
206206
messageText += `\n\nThe user wants to continue with: ${options.continueMessage}`;

src/node/services/mock/scenarios/slashCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const SLASH_COMMAND_PROMPTS = {
77
} as const;
88

99
export const COMPACTION_MESSAGE =
10-
"Summarize this conversation into a compact form for a new Assistant to continue helping the user. Use approximately 385 words.";
10+
"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.";
1111

1212
export const COMPACT_SUMMARY_TEXT =
1313
"Compact summary: The assistant read project files, listed directory contents, created and inspected test.txt, then confirmed the contents remained 'hello'. Technical details preserved.";

0 commit comments

Comments
 (0)