feat: set auto-compact threshold to 165k tokens

Compact earlier to preserve more context fidelity before the window fills.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-05 16:15:56 +03:00
parent 27f9f0ca32
commit f77f9ce2c4
2 changed files with 3 additions and 8 deletions

View File

@@ -449,7 +449,6 @@ async function runQuery(
append: globalClaudeMd,
}
: undefined,
model: 'sonnet[1m]',
allowedTools: [
'Bash',
'Read',
@@ -626,7 +625,7 @@ async function main(): Promise<void> {
// No real secrets exist in the container environment.
const sdkEnv: Record<string, string | undefined> = {
...process.env,
CLAUDE_CODE_AUTO_COMPACT_WINDOW: '200000',
CLAUDE_CODE_AUTO_COMPACT_WINDOW: '165000',
};
const __dirname = path.dirname(fileURLToPath(import.meta.url));

View File

@@ -149,15 +149,11 @@ function createSchema(database: Database.Database): void {
// Add reply context columns if they don't exist (migration for existing DBs)
try {
database.exec(
`ALTER TABLE messages ADD COLUMN reply_to_message_id TEXT`,
);
database.exec(`ALTER TABLE messages ADD COLUMN reply_to_message_id TEXT`);
database.exec(
`ALTER TABLE messages ADD COLUMN reply_to_message_content TEXT`,
);
database.exec(
`ALTER TABLE messages ADD COLUMN reply_to_sender_name TEXT`,
);
database.exec(`ALTER TABLE messages ADD COLUMN reply_to_sender_name TEXT`);
} catch {
/* columns already exist */
}