Skip to content

Commit a600a10

Browse files
committed
cleanup: don't search reasoning parts for compress strings
1 parent 0bdce2e commit a600a10

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/prompts/compress.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ WHERE TO NEVER PICK STRINGS FROM:
7979

8080
- `<system-reminder>` tags or any XML wrapper/meta-commentary around messages
8181
- Injected system instructions (plan mode text, max-steps warnings, mode-switch text, environment info)
82+
- Reasoning parts or chain-of-thought text
8283
- File/directory listing framing text (e.g. "Called the Read tool with the following input...")
8384
- Strings that span across message or part boundaries
8485
- Entire serialized JSON objects (key ordering may differ - pick a distinctive substring within instead)

lib/tools/utils.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function findSummaryAnchorForBoundary(
4444

4545
throw new Error(
4646
`Found multiple matches for ${stringType}. ` +
47-
`Provide more surrounding context to uniquely identify the intended match.`,
47+
`Provide more surrounding context to uniquely identify the intended match.`,
4848
)
4949
}
5050

@@ -79,7 +79,6 @@ function extractMessageContent(msg: WithParts): string {
7979

8080
switch (part.type) {
8181
case "text":
82-
case "reasoning":
8382
if (typeof p.text === "string") {
8483
content += " " + p.text
8584
}
@@ -225,7 +224,7 @@ export function findStringInMessages(
225224
})
226225
throw new Error(
227226
`Found multiple matches for ${stringType}. ` +
228-
`Provide more surrounding context to uniquely identify the intended match.`,
227+
`Provide more surrounding context to uniquely identify the intended match.`,
229228
)
230229
}
231230

@@ -274,7 +273,7 @@ export function findStringInMessages(
274273
})
275274
throw new Error(
276275
`${stringType} not found in conversation. ` +
277-
`Make sure the string exists and is spelled exactly as it appears.`,
276+
`Make sure the string exists and is spelled exactly as it appears.`,
278277
)
279278
}
280279

@@ -302,7 +301,7 @@ export function findStringInMessages(
302301
})
303302
throw new Error(
304303
`Found multiple matches for ${stringType}. ` +
305-
`Provide more unique surrounding context to disambiguate.`,
304+
`Provide more unique surrounding context to disambiguate.`,
306305
)
307306
}
308307

0 commit comments

Comments
 (0)