Skip to content

Commit e14a362

Browse files
committed
fix: store compress summary prefix at creation
1 parent 8ec0dde commit e14a362

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/messages/prune.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { SessionState, WithParts } from "../state"
22
import type { Logger } from "../logger"
33
import type { PluginConfig } from "../config"
44
import { isMessageCompacted, getLastUserMessage } from "../shared-utils"
5-
import { createSyntheticUserMessage, COMPRESS_SUMMARY_PREFIX } from "./utils"
5+
import { createSyntheticUserMessage } from "./utils"
66
import type { UserMessage } from "@opencode-ai/sdk/v2"
77

88
const PRUNED_TOOL_OUTPUT_REPLACEMENT =
@@ -186,7 +186,7 @@ const filterCompressedRanges = (
186186

187187
if (userMessage) {
188188
const userInfo = userMessage.info as UserMessage
189-
const summaryContent = COMPRESS_SUMMARY_PREFIX + summary.summary
189+
const summaryContent = summary.summary
190190
result.push(
191191
createSyntheticUserMessage(userMessage, summaryContent, userInfo.variant),
192192
)

lib/tools/compress.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { sendCompressNotification } from "../ui/notification"
1010
import { prune as applyPruneTransforms } from "../messages/prune"
1111

1212
const COMPRESS_TOOL_DESCRIPTION = loadPrompt("compress-tool-spec")
13+
const COMPRESS_SUMMARY_PREFIX = "[Compressed conversation block]\n\n"
1314

1415
export function createCompressTool(ctx: PruneToolContext): ReturnType<typeof tool> {
1516
return tool({
@@ -148,7 +149,7 @@ export function createCompressTool(ctx: PruneToolContext): ReturnType<typeof too
148149

149150
const compressSummary: CompressSummary = {
150151
anchorMessageId: startResult.messageId,
151-
summary: summary,
152+
summary: COMPRESS_SUMMARY_PREFIX + summary,
152153
}
153154
state.compressSummaries.push(compressSummary)
154155

0 commit comments

Comments
 (0)