summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-22 00:53:25 +0900
committerAdam Malczewski <[email protected]>2026-06-22 00:53:25 +0900
commit128e6c04cf2a5de6b005e1293b4ef81c53b20840 (patch)
treec4f861480aab449f4dc697a83fbf2f9d7051279e /packages
parentc1bfd62b0c734484efcff09d6cd521acdbab2640 (diff)
downloaddispatch-128e6c04cf2a5de6b005e1293b4ef81c53b20840.tar.gz
dispatch-128e6c04cf2a5de6b005e1293b4ef81c53b20840.zip
feat: default auto-compact threshold to 350k tokens
When no compact-threshold is explicitly set on a conversation, the default is 350000 tokens. Setting threshold to 0 explicitly disables auto-compact.
Diffstat (limited to 'packages')
-rw-r--r--packages/session-orchestrator/src/orchestrator.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/session-orchestrator/src/orchestrator.ts b/packages/session-orchestrator/src/orchestrator.ts
index e2d126c..c3b94bf 100644
--- a/packages/session-orchestrator/src/orchestrator.ts
+++ b/packages/session-orchestrator/src/orchestrator.ts
@@ -693,6 +693,7 @@ export function createWarmService(
}
const DEFAULT_KEEP_LAST_N = 10;
+const DEFAULT_COMPACT_THRESHOLD = 350000;
const COMPACTION_SYSTEM_PROMPT =
"You are a conversation summarizer. Summarize the following conversation concord concisely but comprehensively. " +
@@ -734,10 +735,12 @@ export function createCompactionService(
return { error: "conversation too short to compact" };
}
- // Auto mode: check threshold
+ // Auto mode: check threshold (default 350k if not explicitly set;
+ // 0 explicitly disables).
if (opts?.auto === true) {
- const threshold = await deps.conversationStore.getCompactThreshold(conversationId);
- if (threshold === null || threshold <= 0) return { error: "auto-compact disabled" };
+ const stored = await deps.conversationStore.getCompactThreshold(conversationId);
+ const threshold = stored ?? DEFAULT_COMPACT_THRESHOLD;
+ if (threshold <= 0) return { error: "auto-compact disabled" };
const metrics = await deps.conversationStore.loadMetrics(conversationId);
const lastTurn = metrics[metrics.length - 1];
if (lastTurn === undefined) return { error: "no metrics" };