Skip to content

Commit dcd6d84

Browse files
committed
Adjust context management buffer
1 parent 92722ab commit dcd6d84

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "claude-dev",
33
"displayName": "Claude Dev",
44
"description": "Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.",
5-
"version": "1.5.2",
5+
"version": "1.5.3",
66
"icon": "icon.png",
77
"engines": {
88
"vscode": "^1.84.0"

src/utils/context-management.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function isWithinContextWindow(
99
tools: Anthropic.Messages.Tool[],
1010
messages: Anthropic.Messages.MessageParam[]
1111
): boolean {
12-
const adjustedContextWindow = contextWindow - 10_000 // Buffer to account for tokenizer differences
12+
const adjustedContextWindow = contextWindow * 0.75 // Buffer to account for tokenizer differences
1313
// counting tokens is expensive, so we first try to estimate before doing a more accurate calculation
1414
const estimatedTotalMessageTokens = countTokens(systemPrompt + JSON.stringify(tools) + JSON.stringify(messages))
1515
if (estimatedTotalMessageTokens <= adjustedContextWindow) {

0 commit comments

Comments
 (0)