Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat: leave long chats to the agent's own summaries by default

leepokai29ead8c81b69
diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.md
index 27536ac1..c57182fe 100644
--- a/apps/android/WhatsNew.md
+++ b/apps/android/WhatsNew.md
@@ -7,6 +7,13 @@ released version's section; a version without one gets the PRs' "What's New: And
else a generic "Bug fixes and improvements" line. Delete old sections.
-->
+## 2.42.1
+### zh-Hant
+- bot 詳情「智慧體」區塊的「壓縮對話」預設改為「自動」:交給 Claude Code 或 Codex 在對話快滿時自己壓縮。想讓 Codync 提早壓縮,可以改選提早、接近上限或指定數量(從 100K、200K… 裡挑,或自己輸入)。已經是「提早」的 bot 會保留原設定,想交給智慧體自己壓縮可以改選「自動」。
+
+### en-US
+- Summarize long chats, in a bot's Agent section, now defaults to Auto: Claude Code or Codex summarizes a chat on its own once it fills up. Pick Early, Near the limit or a size (100K, 200K and so on, or one you type) to have Codync summarize sooner. Bots already on Early keep it; pick Auto to leave it to the agent.
+
## 2.42.0
### zh-Hant
- bot 詳情的「智慧體」區塊新增「壓縮對話」:選擇 Codync 什麼時候把長對話壓縮成摘要。可以選提早(預設)、接近上限、不主動壓縮,或指定數量:從 100K、200K… 裡挑,或自己輸入,最多到模型裝得下的上限。適用於 Claude Code 和 Codex 的 bot。
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/CompactionPicker.kt b/apps/android/app/src/main/kotlin/com/codync/android/CompactionPicker.kt
index 3e7fc363..bb4600bf 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/CompactionPicker.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/CompactionPicker.kt
@@ -33,7 +33,7 @@ import com.codync.android.design.*
internal fun CardRows.compactionRow(bot: Bot?, draft: BotDraft, change: (BotDraft) -> Unit) {
val choice = draft.compaction ?: return
row {
- ValueRow("Summarize long chats", detail = "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.") {
+ ValueRow("Summarize long chats", detail = "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.") {
CompactionPicker(choice, bot?.compactionTokens) { change(draft.copy(compaction = it)) }
}
}
@@ -53,7 +53,7 @@ internal fun CardRows.compactionRow(bot: Bot?, draft: BotDraft, change: (BotDraf
}
private fun compactionRows(choice: Compaction, tokens: CompactionTokens?, select: (Compaction) -> Unit, custom: () -> Unit): List<MenuItem> {
- val presets = listOf(Compaction.Early, Compaction.NearLimit, Compaction.Off).map { preset ->
+ val presets = listOf(Compaction.Off, Compaction.Early, Compaction.NearLimit).map { preset ->
MenuItem(preset.label, selected = choice == preset) { select(preset) }
}
if (tokens == null) return presets + MenuItem("Sizes show after the bot's next reply", divider = true, enabled = false)
diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/Compaction.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/Compaction.kt
index bcf5eb10..8e8de04e 100644
--- a/apps/android/core/src/main/kotlin/com/codync/android/core/Compaction.kt
+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/Compaction.kt
@@ -11,8 +11,8 @@ import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.longOrNull
/**
- * When Codync summarizes a bot's chat so it can go on (the host's `compaction`): early by default, near the limit of
- * the agent's window, never (the agent still does when the chat fills up), or at a size the user picked.
+ * When a bot's chat is summarized so it can go on (the host's `compaction`): by the agent on its own (off, shown as
+ * Auto, the default), or by Codync early, near the limit of the agent's window, or at a size the user picked.
*/
@Serializable(with = CompactionSerializer::class)
sealed interface Compaction {
@@ -23,9 +23,9 @@ sealed interface Compaction {
/** As its menu row and the pill show it: a phrase to translate, or a size such as "120K" shown as it is. */
val label: String get() = when (this) {
- Early -> "Early (default)"
+ Off -> "Auto (default)"
+ Early -> "Early"
NearLimit -> "Near the limit"
- Off -> "Only when full"
is Tokens -> sizeLabel(tokens)
}
@@ -51,7 +51,7 @@ data class CompactionTokens(val min: Long, val max: Long, val step: Long, val pr
}
}
-/** `"early"`, `"nearLimit"`, `"off"` or a number of tokens; a name from a newer host reads as early, rather than losing the bot. */
+/** `"early"`, `"nearLimit"`, `"off"` or a number of tokens; a name from a newer host reads as the default (off), rather than losing the bot. */
internal object CompactionSerializer : KSerializer<Compaction> {
override val descriptor = buildClassSerialDescriptor("Compaction")
override fun serialize(encoder: Encoder, value: Compaction) {
@@ -64,12 +64,12 @@ internal object CompactionSerializer : KSerializer<Compaction> {
(encoder as JsonEncoder).encodeJsonElement(wire)
}
override fun deserialize(decoder: Decoder): Compaction {
- val wire = (decoder as JsonDecoder).decodeJsonElement() as? JsonPrimitive ?: return Compaction.Early
+ val wire = (decoder as JsonDecoder).decodeJsonElement() as? JsonPrimitive ?: return Compaction.Off
if (!wire.isString) wire.longOrNull?.let { return Compaction.Tokens(it) }
return when (wire.content) {
+ "early" -> Compaction.Early
"nearLimit" -> Compaction.NearLimit
- "off" -> Compaction.Off
- else -> Compaction.Early
+ else -> Compaction.Off
}
}
}
diff --git a/apps/android/core/src/test/kotlin/com/codync/android/core/CompactionTest.kt b/apps/android/core/src/test/kotlin/com/codync/android/core/CompactionTest.kt
index 983c246a..acd7c93f 100644
--- a/apps/android/core/src/test/kotlin/com/codync/android/core/CompactionTest.kt
+++ b/apps/android/core/src/test/kotlin/com/codync/android/core/CompactionTest.kt
@@ -7,12 +7,13 @@ import org.junit.Test
class CompactionTest {
private fun bot(fields: String): Bot = WireJson.decodeFromString("""{"id": "b", "name": "B" $fields}""")
- @Test fun `a bot reads each compaction choice, and a newer host's name as early`() {
+ @Test fun `a bot reads each compaction choice, and a newer host's name as the default`() {
assertEquals(Compaction.Early, bot(""", "compaction": "early"""").compaction)
assertEquals(Compaction.NearLimit, bot(""", "compaction": "nearLimit"""").compaction)
assertEquals(Compaction.Off, bot(""", "compaction": "off"""").compaction)
assertEquals(Compaction.Tokens(120_000), bot(""", "compaction": 120000""").compaction)
- assertEquals(Compaction.Early, bot(""", "compaction": "later"""").compaction)
+ assertEquals("Auto, the default", Compaction.Off, bot(""", "compaction": "later"""").compaction)
+ assertEquals("Auto (default)", Compaction.Off.label)
assertNull("no setting where Codync doesn't summarize", bot(""", "compaction": null""").compaction)
assertNull(bot("").compaction)
}
diff --git a/apps/desktop/e2e/compaction.spec.ts b/apps/desktop/e2e/compaction.spec.ts
index 735b4a57..c62bc2ed 100644
--- a/apps/desktop/e2e/compaction.spec.ts
+++ b/apps/desktop/e2e/compaction.spec.ts
@@ -30,13 +30,17 @@ test('before its first reply a Claude Code bot offers only the three choices', a
botId = (await api<{ bot: Bot }>(page, 'createBot', { name, backend: 'claude', connectors: [], skills: [], notify: false })).bot.id
const row = await summarizeRow(page, name)
const pill = row.locator('.choice-picker')
- await expect(pill).toHaveText('Early (default)')
+ await expect(pill).toHaveText('Auto (default)')
await pill.click()
- for (const title of ['Early (default)', 'Near the limit', 'Only when full']) await expect(menuRow(page, title)).toBeEnabled()
+ for (const title of ['Auto (default)', 'Early', 'Near the limit']) await expect(menuRow(page, title)).toBeEnabled()
await expect(menuRow(page, "Sizes show after the bot's next reply")).toBeDisabled()
await expect(menuRow(page, 'Set a size')).toHaveCount(0)
- await menuRow(page, 'Only when full').click()
- await expect(pill).toHaveText('Only when full')
+ await menuRow(page, 'Early').click()
+ await expect(pill).toHaveText('Early')
+ await expect.poll(() => stored(page, botId!)).toBe('early')
+ await pill.click()
+ await menuRow(page, 'Auto (default)').click()
+ await expect(pill).toHaveText('Auto (default)')
await expect.poll(() => stored(page, botId!)).toBe('off')
// It moved off the Settings tab.
@@ -62,7 +66,7 @@ test('once the agent tells its window, Set a size lists sizes by 100K and takes
await typeMessage(page, 'USAGE 10000 SIZE 1000000')
const pill = row.locator('.choice-picker')
- await expect(pill).toHaveText('Early (default)', { timeout: 20_000 })
+ await expect(pill).toHaveText('Auto (default)', { timeout: 20_000 })
await pill.click()
await menuRow(page, 'Set a size').click()
await expect(menuRow(page, /^100K$/)).toBeVisible()
diff --git a/apps/desktop/src/renderer/lib/compaction-options.test.ts b/apps/desktop/src/renderer/lib/compaction-options.test.ts
index 70080ae4..b4ed6882 100644
--- a/apps/desktop/src/renderer/lib/compaction-options.test.ts
+++ b/apps/desktop/src/renderer/lib/compaction-options.test.ts
@@ -16,7 +16,7 @@ test('the menu lists the presets, then the sizes and a custom one', () => {
const picked: unknown[] = []
let custom = 0
const menu = compactionMenu(200_000, million, (t) => picked.push(t), () => custom++)
- assert.deepEqual(menu.map((m) => m.title), ['Early (default)', 'Near the limit', 'Only when full', 'Set a size'])
+ assert.deepEqual(menu.map((m) => m.title), ['Auto (default)', 'Early', 'Near the limit', 'Set a size'])
assert.ok(menu.slice(0, 3).every((m) => m.selected === false))
const sizes = menu[3].submenu ?? []
assert.deepEqual(sizes.map((m) => m.title), ['100K', '200K', '300K', 'Custom size…'])
@@ -24,19 +24,19 @@ test('the menu lists the presets, then the sizes and a custom one', () => {
sizes[0].action?.()
menu[1].action?.()
sizes.at(-1)?.action?.()
- assert.deepEqual(picked, [100_000, 'nearLimit'])
+ assert.deepEqual(picked, [100_000, 'early'])
assert.equal(custom, 1)
const own = compactionMenu(350_000, million, () => {}, () => {})[3].submenu ?? []
assert.deepEqual(own.filter((m) => m.selected).map((m) => m.title), ['Custom size…'], 'a size of the user\'s own')
})
test('before the window is known the sizes wait for the next reply', () => {
- const menu = compactionMenu('early', null, () => {}, () => {})
+ const menu = compactionMenu('off', null, () => {}, () => {})
assert.equal(menu[0].selected, true)
assert.deepEqual(menu.at(-1), { title: "Sizes show after the bot's next reply", disabled: true, divider: true, action: menu.at(-1)?.action })
})
test('the pill shows a preset translated and a size as it is', () => {
- assert.deepEqual(compactionLabel('off'), { title: 'Only when full', verbatim: false })
+ assert.deepEqual(compactionLabel('off'), { title: 'Auto (default)', verbatim: false })
assert.deepEqual(compactionLabel(350_000), { title: '350K', verbatim: true })
})
diff --git a/apps/desktop/src/renderer/lib/compaction-options.ts b/apps/desktop/src/renderer/lib/compaction-options.ts
index 4ba9260f..3669b713 100644
--- a/apps/desktop/src/renderer/lib/compaction-options.ts
+++ b/apps/desktop/src/renderer/lib/compaction-options.ts
@@ -2,9 +2,9 @@ import type { CompactionSizes, CompactionThreshold } from '@shared/models'
import type { MenuItem } from '../components/Menu'
const PRESETS: { id: Exclude<CompactionThreshold, number>; title: string }[] = [
- { id: 'early', title: 'Early (default)' },
+ { id: 'off', title: 'Auto (default)' },
+ { id: 'early', title: 'Early' },
{ id: 'nearLimit', title: 'Near the limit' },
- { id: 'off', title: 'Only when full' },
]
/** A size as the apps show it: thousands of tokens, `120K`. */
diff --git a/apps/desktop/src/renderer/views/bots/CompactionRow.tsx b/apps/desktop/src/renderer/views/bots/CompactionRow.tsx
index 5ca9024a..60f55b6c 100644
--- a/apps/desktop/src/renderer/views/bots/CompactionRow.tsx
+++ b/apps/desktop/src/renderer/views/bots/CompactionRow.tsx
@@ -14,12 +14,12 @@ export function CompactionRow({ draft, bot, onChange }: {
}) {
const tr = useTr()
const [typing, setTyping] = useState<string | null>(null)
- const selection = draft.compaction ?? bot.compaction ?? 'early'
+ const selection = draft.compaction ?? bot.compaction ?? 'off'
const { title, verbatim } = compactionLabel(selection)
const label = verbatim ? title : tr(title)
const pick = (compaction: BotDraft['compaction']) => onChange((d) => ({ ...d, compaction }))
return (
- <ValueRow label="Summarize long chats" detail="When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.">
+ <ValueRow label="Summarize long chats" detail="Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.">
<DropdownMenu
title={label}
className="choice-picker outlined"
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/CompactionThreshold.swift b/apps/ios/Kit/Sources/CodyncKit/Models/CompactionThreshold.swift
index a2ec9cb9..8f799ae0 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Models/CompactionThreshold.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/CompactionThreshold.swift
@@ -1,7 +1,8 @@
import Foundation
/// When Codync summarizes a bot's chat ahead of time (the bot's `compaction`): `"early"`, `"nearLimit"`, `"off"`, or a
-/// size in tokens. A value from a newer host reads as the default.
+/// size in tokens. `"off"` (the apps' Auto) is the default: the agent summarizes on its own. A value from a newer host
+/// reads as the default.
public enum CompactionThreshold: Codable, Hashable, Sendable {
case early, nearLimit, off
case tokens(Int)
@@ -13,9 +14,9 @@ public enum CompactionThreshold: Codable, Hashable, Sendable {
return
}
switch try? c.decode(String.self) {
+ case "early": self = .early
case "nearLimit": self = .nearLimit
- case "off": self = .off
- default: self = .early
+ default: self = .off
}
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
index e992094d..de8d98cd 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "Nicht mit diesem Konto gekoppelte Telefone verlieren den Zugriff und müssen neu gekoppelt werden.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "Die Dateien dieser Nachricht sind nicht mehr auf diesem Gerät. Lösche sie und hänge die Dateien erneut an.",
"Summarize long chats": "Lange Chats zusammenfassen",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Wann Codync diesen Chat zusammenfasst, damit er weitergehen kann. Füllt sich der Chat vorher, fasst der Agent ihn selbst zusammen.",
- "Early (default)": "Früh (Standard)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "„Automatisch“ überlässt es dem Agenten, der zusammenfasst, sobald der Chat voll ist. Bei den anderen tut Codync es früher.",
+ "Early": "Früh",
"Near the limit": "Kurz vor dem Limit",
"Set a size": "Größe festlegen",
"Sizes show after the bot's next reply": "Größen erscheinen nach der nächsten Antwort des Bots",
- "Only when full": "Nur wenn voll",
+ "Auto (default)": "Automatisch (Standard)",
"Summarize": "Verdichten",
"Claude Code and Codex bots only": "Nur für Claude-Code- und Codex-Bots",
"Custom size…": "Eigene Größe…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
index 5402880f..1c787538 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "Los teléfonos emparejados sin esta cuenta pierden el acceso y deben emparejarse de nuevo.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "Los archivos de este mensaje ya no están en este dispositivo. Elimínalo y vuelve a adjuntarlos.",
"Summarize long chats": "Resumir chats largos",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Cuándo Codync resume este chat para que pueda continuar. Si el chat se llena antes, el agente lo resume por su cuenta.",
- "Early (default)": "Pronto (predeterminado)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "«Automático» lo deja en manos del agente, que resume cuando el chat se llena. Con las demás, Codync lo hace antes.",
+ "Early": "Pronto",
"Near the limit": "Cerca del límite",
"Set a size": "Elegir un tamaño",
"Sizes show after the bot's next reply": "Los tamaños aparecen tras la próxima respuesta del bot",
- "Only when full": "Solo cuando esté lleno",
+ "Auto (default)": "Automático (predeterminado)",
"Summarize": "Resumir",
"Claude Code and Codex bots only": "Solo para bots de Claude Code y Codex",
"Custom size…": "Tamaño personalizado…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
index 00f54674..414f0874 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "Les téléphones jumelés sans ce compte perdent l'accès et devront être jumelés à nouveau.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "Les fichiers de ce message ne sont plus sur cet appareil. Supprimez-le et joignez-les à nouveau.",
"Summarize long chats": "Résumer les longues discussions",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Quand Codync résume cette discussion pour qu’elle puisse continuer. Si la discussion se remplit avant, l’agent la résume lui-même.",
- "Early (default)": "Tôt (par défaut)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "« Auto » laisse faire l’agent, qui résume quand la conversation est pleine. Avec les autres choix, Codync le fait plus tôt.",
+ "Early": "Tôt",
"Near the limit": "Près de la limite",
"Set a size": "Choisir une taille",
"Sizes show after the bot's next reply": "Les tailles apparaissent après la prochaine réponse du bot",
- "Only when full": "Seulement quand c'est plein",
+ "Auto (default)": "Auto (par défaut)",
"Summarize": "Résumés",
"Claude Code and Codex bots only": "Uniquement pour les bots Claude Code et Codex",
"Custom size…": "Taille personnalisée…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json
index 4bfd0409..3fe3c659 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/it.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "I telefoni associati senza questo account perdono l'accesso e devono essere associati di nuovo.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "I file di questo messaggio non sono più su questo dispositivo. Eliminalo e allega di nuovo i file.",
"Summarize long chats": "Riassunto delle chat lunghe",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Quando Codync riassume questa chat perché possa continuare. Se la chat si riempie prima, l'agente la riassume da solo.",
- "Early (default)": "Presto (predefinito)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "«Automatico» lascia fare all’agente, che riassume quando la chat è piena. Con le altre scelte Codync lo fa prima.",
+ "Early": "Presto",
"Near the limit": "Vicino al limite",
"Set a size": "Imposta una dimensione",
"Sizes show after the bot's next reply": "Le dimensioni compaiono dopo la prossima risposta del bot",
- "Only when full": "Solo quando è pieno",
+ "Auto (default)": "Automatico (predefinito)",
"Summarize": "Riassunti",
"Claude Code and Codex bots only": "Solo per i bot di Claude Code e Codex",
"Custom size…": "Dimensione personalizzata…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
index de2988eb..956ee5a5 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "このアカウントでペアリングしていないスマートフォンはアクセスを失い、再度ペアリングが必要です。",
"This message's files aren't on this device anymore. Delete it and attach them again.": "このメッセージのファイルはこの端末にもうありません。メッセージを削除して、もう一度ファイルを添付してください。",
"Summarize long chats": "長いチャットを要約",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Codync がこのチャットを要約して続けられるようにするタイミングです。先にチャットがいっぱいになった場合は、エージェントが自分で要約します。",
- "Early (default)": "早め(デフォルト)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "「自動」はエージェントに任せ、チャットがいっぱいになると自分で要約します。ほかの選択肢では Codync が早めに要約します。",
+ "Early": "早め",
"Near the limit": "上限の手前",
"Set a size": "サイズを指定",
"Sizes show after the bot's next reply": "ボットの次の返信後にサイズを選べます",
- "Only when full": "満杯になったときだけ",
+ "Auto (default)": "自動(デフォルト)",
"Summarize": "要約",
"Claude Code and Codex bots only": "Claude Code と Codex のボットのみ",
"Custom size…": "カスタムサイズ…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
index 75ef4f9a..421604da 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "이 계정으로 페어링하지 않은 휴대폰은 접근 권한을 잃으며 다시 페어링해야 합니다.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "이 메시지의 파일이 더 이상 이 기기에 없습니다. 메시지를 삭제하고 파일을 다시 첨부하세요.",
"Summarize long chats": "긴 채팅 요약",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Codync가 이 채팅을 요약해 계속 이어갈 수 있게 하는 시점입니다. 채팅이 먼저 가득 차면 에이전트가 직접 요약합니다.",
- "Early (default)": "일찍(기본값)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "'자동'은 에이전트에 맡기며, 채팅이 가득 차면 에이전트가 직접 요약합니다. 다른 선택지는 Codync가 더 일찍 요약합니다.",
+ "Early": "일찍",
"Near the limit": "한도 직전",
"Set a size": "크기 지정",
"Sizes show after the bot's next reply": "봇의 다음 답장 후에 크기를 고를 수 있습니다",
- "Only when full": "가득 찼을 때만",
+ "Auto (default)": "자동(기본값)",
"Summarize": "압축",
"Claude Code and Codex bots only": "Claude Code와 Codex 봇에서만",
"Custom size…": "직접 입력…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json
index b85d36e6..3f045d46 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/pt-BR.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "Celulares pareados sem esta conta perdem o acesso e precisam parear de novo.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "Os arquivos desta mensagem não estão mais neste dispositivo. Exclua a mensagem e anexe os arquivos de novo.",
"Summarize long chats": "Resumir conversas longas",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Quando o Codync resume esta conversa para que ela possa continuar. Se a conversa encher antes, o agente a resume sozinho.",
- "Early (default)": "Cedo (padrão)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "\"Automático\" deixa com o agente, que resume quando o chat enche. Nas outras opções, o Codync faz isso antes.",
+ "Early": "Cedo",
"Near the limit": "Perto do limite",
"Set a size": "Definir um tamanho",
"Sizes show after the bot's next reply": "Os tamanhos aparecem após a próxima resposta do bot",
- "Only when full": "Só quando estiver cheio",
+ "Auto (default)": "Automático (padrão)",
"Summarize": "Resumir",
"Claude Code and Codex bots only": "Só para bots do Claude Code e do Codex",
"Custom size…": "Tamanho personalizado…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json
index 1873f12d..a9adbe21 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ru.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "Телефоны, сопряжённые без этого аккаунта, потеряют доступ, и их нужно будет сопрячь заново.",
"This message's files aren't on this device anymore. Delete it and attach them again.": "Файлов этого сообщения больше нет на этом устройстве. Удалите его и прикрепите файлы заново.",
"Summarize long chats": "Сжатие длинных чатов",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Когда Codync сжимает этот чат в сводку, чтобы его можно было продолжить. Если чат заполнится раньше, агент сожмёт его сам.",
- "Early (default)": "Рано (по умолчанию)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "«Автоматически» — решает агент: он сам сжимает чат, когда тот заполнится. В остальных вариантах Codync делает это раньше.",
+ "Early": "Рано",
"Near the limit": "У предела",
"Set a size": "Задать размер",
"Sizes show after the bot's next reply": "Размеры появятся после следующего ответа бота",
- "Only when full": "Только когда заполнится",
+ "Auto (default)": "Автоматически (по умолчанию)",
"Summarize": "Сжатие",
"Claude Code and Codex bots only": "Только для ботов Claude Code и Codex",
"Custom size…": "Свой размер…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
index 6533a0f1..b7d18792 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "未用此账户配对的手机将失去访问权限,必须重新配对。",
"This message's files aren't on this device anymore. Delete it and attach them again.": "此消息的文件已不在此设备上。请删除这条消息并重新添加文件。",
"Summarize long chats": "压缩对话",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Codync 何时把这个对话压缩成摘要,好让对话继续下去。对话若先塞满,agent 会自己压缩。",
- "Early (default)": "提早(默认)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "“自动”交给 agent,对话快满时它会自己压缩。其他选项由 Codync 提早压缩。",
+ "Early": "提早",
"Near the limit": "接近上限",
"Set a size": "指定数量",
"Sizes show after the bot's next reply": "Bot 下次回复后就能指定数量",
- "Only when full": "不主动压缩",
+ "Auto (default)": "自动(默认)",
"Summarize": "压缩",
"Claude Code and Codex bots only": "仅适用于 Claude Code 和 Codex 的 bot",
"Custom size…": "自定义数量…",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
index 12174c40..6f10d272 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
@@ -1884,12 +1884,12 @@
"Phones paired without this account lose access and must pair again.": "未用此賬戶配對的手機將失去存取權,必須重新配對。",
"This message's files aren't on this device anymore. Delete it and attach them again.": "這則訊息的檔案已不在此裝置上。請刪除這則訊息並重新新增檔案。",
"Summarize long chats": "壓縮對話",
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.": "Codync 何時把這個對話壓縮成摘要,好讓對話繼續下去。對話若先塞滿,agent 會自己壓縮。",
- "Early (default)": "提早(預設)",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.": "「自動」交給 agent,對話快滿時它會自己壓縮。其他選項由 Codync 提早壓縮。",
+ "Early": "提早",
"Near the limit": "接近上限",
"Set a size": "指定數量",
"Sizes show after the bot's next reply": "Bot 下次回覆後就能指定數量",
- "Only when full": "不主動壓縮",
+ "Auto (default)": "自動(預設)",
"Summarize": "壓縮",
"Claude Code and Codex bots only": "只適用於 Claude Code 和 Codex 的 bot",
"Custom size…": "自訂數量…",
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
index 73b9fd34..d05be16e 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
@@ -149,7 +149,7 @@ struct BotSettingsForm: View {
/// Only where the host summarizes this bot's chat (its bot says).
@ViewBuilder private var compactionPicker: some View {
if bot?.compaction != nil, draft.compaction != nil {
- CompactionPicker(selection: Binding(get: { draft.compaction ?? .early }, set: { draft.compaction = $0 }),
+ CompactionPicker(selection: Binding(get: { draft.compaction ?? .off }, set: { draft.compaction = $0 }),
range: bot?.compactionTokens)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/CompactionPicker.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/CompactionPicker.swift
index ec75694d..4785a96c 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/CompactionPicker.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/CompactionPicker.swift
@@ -1,7 +1,7 @@
import CodyncKit
import SwiftUI
-/// When Codync summarizes the bot's chat ahead of time: early, near the limit, off, or a size its window holds.
+/// When the bot's chat is summarized: by the agent (auto), or by Codync early, near the limit or at a size its window holds.
struct CompactionPicker: View {
@Binding var selection: CompactionThreshold
/// Nil until the agent has told its window.
@@ -10,11 +10,11 @@ struct CompactionPicker: View {
@State private var typed = ""
private static let presets: [(CompactionThreshold, String)] =
- [(.early, "Early (default)"), (.nearLimit, "Near the limit"), (.off, "Only when full")]
+ [(.off, "Auto (default)"), (.early, "Early"), (.nearLimit, "Near the limit")]
var body: some View {
ValueRow("Summarize long chats",
- detail: "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.") {
+ detail: "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.") {
DropdownMenu { items } label: {
HStack(spacing: 6) {
Text(verbatim: label).lineLimit(1)
diff --git a/apps/ios/Kit/Tests/CodyncKitTests/CompactionTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/CompactionTests.swift
index 42180c0d..77fd772d 100644
--- a/apps/ios/Kit/Tests/CodyncKitTests/CompactionTests.swift
+++ b/apps/ios/Kit/Tests/CodyncKitTests/CompactionTests.swift
@@ -11,7 +11,7 @@ private func bot(_ extra: String) throws -> Bot {
#expect(try bot(#","compaction":"nearLimit""#).compaction == .nearLimit)
#expect(try bot(#","compaction":"off""#).compaction == .off)
#expect(try bot(#","compaction":120000"#).compaction == .tokens(120_000))
- #expect(try bot(#","compaction":"later""#).compaction == .early, "a newer host's value reads as the default")
+ #expect(try bot(#","compaction":"later""#).compaction == .off, "a newer host's value reads as the default, Auto")
#expect(try bot(#","compaction":null"#).compaction == nil, "no setting where Codync can't summarize")
#expect(try bot("").compaction == nil, "an older host")
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index e9de03db..2a000a9a 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -6,6 +6,13 @@ any left). tools/asc-submit.py reads the released version's section;
a version without one gets a generic "Bug fixes and improvements" line. Delete old sections.
-->
+## 2.42.1
+### zh-Hant
+- bot 詳情「智慧體」區塊的「壓縮對話」預設改為「自動」:交給 Claude Code 或 Codex 在對話快滿時自己壓縮。想讓 Codync 提早壓縮,可以改選提早、接近上限或指定數量(從 100K、200K… 裡挑,或自己輸入)。已經是「提早」的 bot 會保留原設定,想交給智慧體自己壓縮可以改選「自動」。
+
+### en-US
+- Summarize long chats, in a bot's Agent section, now defaults to Auto: Claude Code or Codex summarizes a chat on its own once it fills up. Pick Early, Near the limit or a size (100K, 200K and so on, or one you type) to have Codync summarize sooner. Bots already on Early keep it; pick Auto to leave it to the agent.
+
## 2.42.0
### zh-Hant
- bot 詳情的「智慧體」區塊新增「壓縮對話」:選擇 Codync 什麼時候把長對話壓縮成摘要。可以選提早(預設)、接近上限、不主動壓縮,或指定數量:從 100K、200K… 裡挑,或自己輸入,最多到模型裝得下的上限。適用於 Claude Code 和 Codex 的 bot。
diff --git a/apps/maestro/compaction.yaml b/apps/maestro/compaction.yaml
index 57fe5353..b25a8662 100644
--- a/apps/maestro/compaction.yaml
+++ b/apps/maestro/compaction.yaml
@@ -1,7 +1,7 @@
# A bot's Summarize long chats setting on the phones, in the Agent card of its details: once its agent has replied and
-# told its window, the menu has the three choices and Set a size, which lists sizes by 100K up to what the window holds
-# and Custom size… for one typed in; a size picked or typed shows on the pill and the host keeps it, and so does a
-# choice. The phone must already be signed in and paired with the host (a worktree's sandbox,
+# told its window, the menu has the three choices (Auto, the default, first) and Set a size, which lists sizes by 100K
+# up to what the window holds and Custom size… for one typed in; a size picked or typed shows on the pill and the host
+# keeps it, and so does a choice, which reopened details show again. The phone must already be signed in and paired with the host (a worktree's sandbox,
# docs/guides/dev-app.md#worktree-sandboxes), so run it apart from `welcome`, whose clearState undoes that; the flow
# makes its own bot there:
# maestro --device "<simulator udid>,<adb serial>" test --shard-all 2 --include-tags bot-settings \
@@ -45,9 +45,9 @@ onFlowComplete:
- scrollUntilVisible:
element: "Summarize long chats"
centerElement: true
-- tapOn: "Early \\(default\\)"
+- tapOn: "Auto \\(default\\)"
+- assertVisible: "Early"
- assertVisible: "Near the limit"
-- assertVisible: "Only when full"
- tapOn: "Set a size"
- assertVisible: "900K"
- tapOn: "100K"
@@ -71,8 +71,22 @@ onFlowComplete:
env:
STORED: "350000"
- tapOn: "350K"
-- tapOn: "Only when full"
-- assertVisible: "Only when full"
+- tapOn: "Early"
+- assertVisible: "Early"
+- runScript:
+ file: compaction.js
+ env:
+ STORED: "early"
+# Reopened, the details read the choice back from the host.
+- tapOn: "Close details"
+- tapOn: "${output.bot.name}, view details"
+- tapOn: "Details"
+- scrollUntilVisible:
+ element: "Summarize long chats"
+ centerElement: true
+- tapOn: "Early"
+- tapOn: "Auto \\(default\\)"
+- assertVisible: "Auto \\(default\\)"
- runScript:
file: compaction.js
env:
diff --git a/docs/design/bot-memory.md b/docs/design/bot-memory.md
index e9ea8838..1d1288df 100644
--- a/docs/design/bot-memory.md
+++ b/docs/design/bot-memory.md
@@ -45,7 +45,7 @@ Built differently from the plan below, for now:
the opening.
In one line: **memory records the person, the transcript stays in the host, the opening stays frozen until
-compaction, and the host decides when to compact.**
+compaction, and the harness compacts unless the bot's Summarize long chats has the host do it sooner.**
## Why redesign
@@ -163,10 +163,10 @@ and keep the file camp's real requirement: no hidden state.
| Pattern | Seen in | For Codync |
|---|---|---|
-| Harness auto-compacts at a threshold | Claude Code (at the model limit, about 967k on 1M models), Codex | Kept as the safety net |
+| Harness auto-compacts at a threshold | Claude Code (at the model limit, about 967k on 1M models), Codex | The default (Auto), and the safety net |
| Idle compaction inside the harness | Claude Code 2.1.299+: interactive terminal only, flag-gated off by default | Never active in bot sessions, so the host's idle compaction is the only one |
| Summary written while idle, swapped in on return | Claude Code's flag-gated `compact_on_return` mode; its "resume from summary" offer after over 1 hour idle and over 100k tokens | Precedent for host idle compaction and rollover |
-| Host-timed compaction | No product feature found | **Adopted**: end of turn, and idle before the cache expires |
+| Host-timed compaction | No product feature found | **Adopted** when a bot picks Early, Near the limit or a size: end of turn, and idle before the cache expires |
| Handoff to a fresh session | Amp Handoff, an editable draft; Amp calls compaction "lossy" and warns about "stacking summary on top of summary" | **Adopted** as rollover |
| Anchored or iterative summaries | Factory: only the newly truncated span is summarized and merged. It scores 3.70 vs. 3.44 (Anthropic) and 3.35 (OpenAI); the artifact trail is weakest everywhere. | Left to the harness; rollover resets drift; probes in the evaluation |
| Memory-flush turn before compaction | OpenClaw | Not needed: the host keeps the full transcript |
@@ -427,24 +427,25 @@ doubles the write cost on API billing.
| **Rollover** | Any of: (1) returning with a cold cache and `used ≥ 100k`; (2) away ≥ 8 hours with ≥ 3 compactions; (3) the loop guard fires | Summaries of summaries drift. A new session starts with a handoff. |
| **Safety net** | A single turn fills the window | The harness's own auto-compaction |
-These are the defaults. Each Claude Code or Codex bot has a **Summarize long chats** setting (`compaction` in its
-config, `codync_mem::compaction::Threshold`) that moves the end-of-turn trigger:
+These are Early's rules. Each Claude Code or Codex bot has a **Summarize long chats** setting (`compaction` in its
+config, `codync_mem::compaction::Threshold`) that decides whether they apply and moves the end-of-turn trigger. Its
+default is Auto: the host stays out and the harness compacts on its own.
| Setting | End-of-turn trigger | Idle compaction and cold rollover |
|---|---|---|
-| Early (`"early"`, the default) | `min(0.75 × size, 200k)` | Past 100k, as above |
+| Auto (`"off"`, the default) | None | None: the harness's own auto-compaction is all there is |
+| Early (`"early"`) | `min(0.75 × size, 200k)` | Past 100k, as above |
| Near the limit (`"nearLimit"`) | The largest size the window allows: `size − 40k`, rounded down to 10k (960k on a 1M window), never below Early's trigger | Only past the trigger |
| A size (a number) | That many tokens, a multiple of 10k and at least 50k, held to the largest size the window allows | Only past the trigger (and 100k) |
-| Only when full (`"off"`) | None | None: the harness's own auto-compaction is all there is |
The 40k headroom is the compaction turn itself (its prompt and a summary of about 20k). Below 50k, the summary and
the opening alone would trip the trigger every few turns. The long-absence rollover (8 hours, 3 compactions) and
-the loop guard apply to every setting but Only when full. The apps take the sizes from `compactionTokens`
+the loop guard apply to every setting but Auto. The apps take the sizes from `compactionTokens`
(`{min, max, step, presets}`: the bounds a typed size is rounded and held to, and the 100k multiples a menu
lists), which the host sends once the bot's own agent (not a fallback) has reported the main chat's window (kept
in `context.window.<bot>`); before that they offer only the three choices. A custom command that
reported a window keeps its setting while its agent isn't running. Other agents have no setting (`compaction` is
-`null`) and keep the defaults for rollovers.
+`null`) and get the default: no compaction or rollover from the host.
Decisions follow the setting in force when they act. A queued compaction runs only if it's still due then (another
turn may have gone first, or the user changed the setting). When the setting changes, a handoff card it no longer
diff --git a/docs/features/context-and-memory.md b/docs/features/context-and-memory.md
index e5b2b035..228e808d 100644
--- a/docs/features/context-and-memory.md
+++ b/docs/features/context-and-memory.md
@@ -160,7 +160,8 @@ Claude Code's own memory; the rules live in the `codync-mem` crate, and `chat/me
from `usage_update`, compactions, and when turns end. How long the provider keeps prompts cached is learned
from turns that came after a pause (`cache.life.<bot>`); until then it is an hour for Claude on a subscription
and five minutes otherwise. Each turn's cached read and write tokens are logged (`turn usage`).
-- **Compacting ahead of time**, in the bot's own chat only (never rooms, routines or bot requests):
+- **Compacting ahead of time**, when the user's threshold asks for it (Early's rules here), in the bot's own chat
+ only (never rooms, routines or bot requests):
- at the end of a turn past three quarters of the window or 200k tokens, whichever is less;
- while idle, with a one-hour cache and over 100k in use, five minutes before the cache expires.
@@ -169,10 +170,10 @@ Claude Code's own memory; the rules live in the `codync-mem` crate, and `chat/me
`CODEX_CONFIG` `compact_prompt`. Other harnesses compact on their own. The keep-list is also in the opening.
A compaction queued behind another turn runs only if it is still due when its turn comes.
- **The user's threshold** (*Summarize long chats* in a Claude Code or Codex bot's settings, the bot's
- `compaction`): Early (the default above), Near the limit, Only when full (no compaction or rollover from the
- host), or a size from 50k up to the window less 40k (the apps list 100k steps and take any other size typed,
- rounded to 10k). A size or Near the limit also keeps idle compaction and the cold rollover away until the
- context reaches it. The bot's JSON carries `compaction`
+ `compaction`): Auto (`"off"`, the default: no compaction or rollover from the host, the harness compacts on its
+ own), Early (the rules above), Near the limit, or a size from 50k up to the window less 40k (the apps list 100k
+ steps and take any other size typed, rounded to 10k). A size or Near the limit also keeps idle compaction and
+ the cold rollover away until the context reaches it. The bot's JSON carries `compaction`
(`null` for other agents, or a custom command until it turns out to run Claude's or Codex's adapter) and
`compactionTokens` (`{min, max, step, presets}`, `null` until the agent has reported the window, kept in
`context.window.<bot>`). The rules and the table are in the [design](../design/bot-memory.md#compaction).
diff --git a/host/Cargo.lock b/host/Cargo.lock
index 7beba999..3cbb5b3c 100644
--- a/host/Cargo.lock
+++ b/host/Cargo.lock
@@ -788,7 +788,7 @@ dependencies = [
[[package]]
name = "codync-mem"
-version = "0.4.0"
+version = "0.5.0"
dependencies = [
"rusqlite",
"serde",
diff --git a/host/crates/memory/Cargo.toml b/host/crates/memory/Cargo.toml
index 411f3fef..e522334b 100644
--- a/host/crates/memory/Cargo.toml
+++ b/host/crates/memory/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "codync-mem"
-version = "0.4.0"
+version = "0.5.0"
edition = "2024"
rust-version = "1.88"
description = "Memory for coding-agent bots: one store, the rules for who may write it, and what each session sees"
diff --git a/host/crates/memory/README.md b/host/crates/memory/README.md
index 4f4e0ab3..94451e8b 100644
--- a/host/crates/memory/README.md
+++ b/host/crates/memory/README.md
@@ -101,8 +101,9 @@ cargo add [email protected] --features bundled
run also tidies it into the notes of their topics.
- `legacy`: the memory entries of codync-mem 0.1, read once to move them into files.
- `evidence`: what counts as the user's own words (not pasted, quoted or forwarded text).
-- `compaction`: when to summarize a conversation ahead of time (by default or at the size the user picks), the loop
- guard, the keep-list and the handoff to a fresh conversation.
+- `compaction`: when to summarize a conversation ahead of time (early, near the limit or at a size the user picks;
+ by default never, leaving it to the harness), the loop guard, the keep-list and the handoff to a fresh
+ conversation.
- `tokens`: the token estimate the caps count in (one per CJK character, one per four others).
## License
diff --git a/host/crates/memory/src/compaction.rs b/host/crates/memory/src/compaction.rs
index 282c572e..5053e475 100644
--- a/host/crates/memory/src/compaction.rs
+++ b/host/crates/memory/src/compaction.rs
@@ -342,7 +342,7 @@ mod tests {
assert_eq!(at(50_000, 1_000_000, Threshold::Tokens(10_000)), Decision::Compact, "never below the minimum");
assert_eq!(at(40_000, 1_000_000, Threshold::Tokens(10_000)), Decision::Keep);
assert_eq!(at(990_000, 1_000_000, Threshold::Off), Decision::Keep, "left to the harness");
- assert_eq!(at(60_000, 64_000, Threshold::NearLimit), Decision::Compact, "too small a window: the default's");
+ assert_eq!(at(60_000, 64_000, Threshold::NearLimit), Decision::Compact, "too small a window: Early's");
}
#[test]
@@ -357,7 +357,7 @@ mod tests {
assert!(!rollover_due(&c, threshold, CacheLife::OneHour, cold), "{threshold:?}");
}
let low = Threshold::Tokens(60_000);
- assert_eq!(while_idle(&c, low, CacheLife::OneHour, idle), Decision::Compact, "past 100k, as by default");
+ assert_eq!(while_idle(&c, low, CacheLife::OneHour, idle), Decision::Compact, "past 100k, as Early");
let summarized = Conversation { used: 30_000, compactions: 3, ..full() };
let away = NOW + 9 * HOUR_MS;
assert!(
diff --git a/host/crates/memory/src/compaction/threshold.rs b/host/crates/memory/src/compaction/threshold.rs
index 6e797598..ae9317c6 100644
--- a/host/crates/memory/src/compaction/threshold.rs
+++ b/host/crates/memory/src/compaction/threshold.rs
@@ -2,7 +2,7 @@
use serde::{Deserialize, Serialize};
-/// By default, compact past three quarters of the window or this many tokens, whichever is less: the summary needs
+/// Early compacts past three quarters of the window or this many tokens, whichever is less: the summary needs
/// room, and a hot cache makes reading the history cheap.
const TURN_END_CAP: u64 = 200_000;
/// A size the user sets is a multiple of this...
@@ -20,11 +20,12 @@ const PRESET_STEP: u64 = 100_000;
#[serde(from = "Wire", into = "Wire")]
pub enum Threshold {
/// At three quarters of the window or 200k, whichever is less; idle compaction and rollovers past 100k.
- #[default]
Early,
/// At the largest size the window allows ([`sizes`]), never sooner than [`Threshold::Early`].
NearLimit,
- /// Never: the harness's own compaction, when a turn fills the window, is all there is.
+ /// Never: the harness's own compaction, when a turn fills the window, is all there is. The default (the apps call
+ /// it Auto): the agent decides unless the user chooses otherwise.
+ #[default]
Off,
/// At this many tokens, held to the [`sizes`] the window allows.
Tokens(u64),
@@ -52,9 +53,9 @@ impl From<Wire> for Threshold {
fn from(wire: Wire) -> Self {
match wire {
Wire::Tokens(n) => Self::Tokens(n),
- Wire::Name(Name::Early) | Wire::Other(_) => Self::Early,
+ Wire::Name(Name::Early) => Self::Early,
Wire::Name(Name::NearLimit) => Self::NearLimit,
- Wire::Name(Name::Off) => Self::Off,
+ Wire::Name(Name::Off) | Wire::Other(_) => Self::Off,
}
}
}
@@ -93,7 +94,7 @@ impl Threshold {
}
/// The context use that compacts a conversation in a window of `window` tokens at the end of a turn; `None` when
- /// the user turned that off. A window too small for a size gets the default's.
+ /// the user turned that off. A window too small for a size gets Early's.
pub(super) fn trigger(self, window: u64) -> Option<u64> {
let early = (window / 4 * 3).min(TURN_END_CAP);
let max = max_tokens(window);
@@ -155,7 +156,8 @@ mod tests {
assert_eq!(serde_json::to_value(threshold).unwrap(), wire);
assert_eq!(serde_json::from_value::<Threshold>(wire).unwrap(), threshold);
}
- assert_eq!(serde_json::from_value::<Threshold>(json!("later")).unwrap(), Threshold::Early, "a newer app's");
+ assert_eq!(serde_json::from_value::<Threshold>(json!("later")).unwrap(), Threshold::Off, "a newer app's");
+ assert_eq!(Threshold::default(), Threshold::Off, "the agent decides unless the user chooses");
}
#[test]
@@ -179,6 +181,6 @@ mod tests {
fn near_the_limit_is_never_sooner_than_early() {
assert_eq!(Threshold::NearLimit.trigger(1_000_000), Some(960_000));
assert_eq!(Threshold::NearLimit.trigger(128_000), Some(96_000), "a small window: three quarters of it");
- assert_eq!(Threshold::NearLimit.trigger(64_000), Some(48_000), "too small for a size: the default's");
+ assert_eq!(Threshold::NearLimit.trigger(64_000), Some(48_000), "too small for a size: Early's");
}
}
diff --git a/host/src/agent/bot/compaction.rs b/host/src/agent/bot/compaction.rs
index 383799db..ac66e4d8 100644
--- a/host/src/agent/bot/compaction.rs
+++ b/host/src/agent/bot/compaction.rs
@@ -31,8 +31,8 @@ fn harness_adapter(backend: &str) -> Adapter {
}
/// The user's threshold where Codync compacts the bot's chat: by the adapter running it, or with none running (a
-/// custom command released or not started yet) by what its agent last reported. Elsewhere rollovers follow the
-/// default's.
+/// custom command released or not started yet) by what its agent last reported. Elsewhere the default: the agent's
+/// own compaction, and no rollovers.
fn threshold(store: &Store, cfg: &BotConfig, running: Option<Adapter>) -> Threshold {
let compacts = running.map_or_else(|| offers_threshold(store, cfg), |adapter| adapter != Adapter::Other);
if compacts { cfg.compaction } else { Threshold::default() }
@@ -380,12 +380,13 @@ mod tests {
let path = std::env::temp_dir().join(format!("codync-threshold-{}.db", uuid::Uuid::new_v4()));
let store = Store::open(&path).unwrap();
let cfg: BotConfig =
- serde_json::from_value(json!({"id": "b", "name": "B", "backend": "custom", "compaction": "off"})).unwrap();
- assert_eq!(threshold(&store, &cfg, None), Threshold::Early, "not known to run Claude's or Codex's adapter yet");
+ serde_json::from_value(json!({"id": "b", "name": "B", "backend": "custom", "compaction": "nearLimit"}))
+ .unwrap();
+ assert_eq!(threshold(&store, &cfg, None), Threshold::Off, "not known to run Claude's or Codex's adapter yet");
store.kv_set(&window_key("b"), "1000000").unwrap();
- assert_eq!(threshold(&store, &cfg, None), Threshold::Off, "released after it reported its window");
- assert_eq!(threshold(&store, &cfg, Some(Adapter::Claude)), Threshold::Off);
- assert_eq!(threshold(&store, &cfg, Some(Adapter::Other)), Threshold::Early, "now running another adapter");
+ assert_eq!(threshold(&store, &cfg, None), Threshold::NearLimit, "released after it reported its window");
+ assert_eq!(threshold(&store, &cfg, Some(Adapter::Claude)), Threshold::NearLimit);
+ assert_eq!(threshold(&store, &cfg, Some(Adapter::Other)), Threshold::Off, "now running another adapter");
let cold = Conversation { used: 150_000, size: 1_000_000, last_turn: 1, ..Conversation::default() };
assert!(!rules::rollover_due(&cold, threshold(&store, &cfg, None), CacheLife::FiveMinutes, 2 * 3_600_000));
std::fs::remove_file(&path).ok();
diff --git a/host/src/analytics/observe/tests.rs b/host/src/analytics/observe/tests.rs
index 802a3c08..05f4ed18 100644
--- a/host/src/analytics/observe/tests.rs
+++ b/host/src/analytics/observe/tests.rs
@@ -267,7 +267,7 @@ async fn store_lookups_add_fields_choice_and_platform() {
assert_eq!((&p["fields"], &p["compaction"]), (&json!(["compaction"]), &json!("tokens")), "the kind, not the size");
// The apps send the whole form: an unchanged threshold in it isn't a pick.
let (_, p) =
- observe_call(&hub, &Caller::Local, "updateBot", &json!({"id": "b1", "name": "c", "compaction": "early"}))
+ observe_call(&hub, &Caller::Local, "updateBot", &json!({"id": "b1", "name": "c", "compaction": "off"}))
.unwrap();
assert_eq!(p["fields"], json!(["name"]));
assert!(p.get("compaction").is_none());
diff --git a/host/src/tui/app/forms.rs b/host/src/tui/app/forms.rs
index 4c8739a6..69e84836 100644
--- a/host/src/tui/app/forms.rs
+++ b/host/src/tui/app/forms.rs
@@ -305,7 +305,7 @@ impl Form {
/// When Codync summarizes the chat, in the order ← → steps through: the three choices, then the sizes a menu lists.
pub fn compaction_choices(&self) -> Vec<Threshold> {
let presets = self.compaction_sizes.iter().flat_map(|s| s.presets.iter().map(|&n| Threshold::Tokens(n)));
- [Threshold::Early, Threshold::NearLimit, Threshold::Off].into_iter().chain(presets).collect()
+ [Threshold::Off, Threshold::Early, Threshold::NearLimit].into_iter().chain(presets).collect()
}
/// A digit typed into the size (thousands of tokens), or Backspace (`None`); held to the window's sizes on save.
@@ -435,10 +435,12 @@ mod tests {
let mut app = test_app();
let f = compaction_editor(&mut app, &json!("off"));
let f = press(&mut app, f, [KeyCode::Right]);
+ assert_eq!(f.changes(), json!({"compaction": "early"}), "auto first, then Codync's own");
+ let f = press(&mut app, f, [KeyCode::Right, KeyCode::Right]);
assert_eq!(f.changes(), json!({"compaction": 100_000}));
- let f = press(&mut app, f, [KeyCode::Left]);
+ let f = press(&mut app, f, [KeyCode::Left, KeyCode::Left, KeyCode::Left]);
assert_eq!(f.changes(), json!({}));
- assert_eq!(f.compaction_choices().len(), 5, "early, near the limit, only when full, 100K, 200K");
+ assert_eq!(f.compaction_choices().len(), 5, "auto, early, near the limit, 100K, 200K");
for (key, next) in [(KeyCode::Right, 200_000), (KeyCode::Left, 100_000)] {
let f = compaction_editor(&mut app, &json!(150_000));
diff --git a/host/src/tui/view/forms.rs b/host/src/tui/view/forms.rs
index 84df89c9..4f5a0bdc 100644
--- a/host/src/tui/view/forms.rs
+++ b/host/src/tui/view/forms.rs
@@ -21,9 +21,9 @@ use codync_mem::compaction::Threshold;
/// A compaction threshold as the apps name it: a choice, or the size as "120K".
fn compaction_label(at: Threshold) -> String {
match at {
- Threshold::Early => tr("Early (default)").into_owned(),
+ Threshold::Off => tr("Auto (default)").into_owned(),
+ Threshold::Early => tr("Early").into_owned(),
Threshold::NearLimit => tr("Near the limit").into_owned(),
- Threshold::Off => tr("Only when full").into_owned(),
Threshold::Tokens(n) => format!("{}K", n / 1000),
}
}
@@ -68,7 +68,7 @@ fn field_help(app: &App, f: &Form, agent_name: &str) -> Option<(String, Style)>
Field::Compaction if f.compaction.is_none() => tr("Claude Code and Codex bots only").into_owned(),
Field::Compaction => {
let about = tr(
- "When Codync summarizes this chat so it can go on. If the chat fills up first, the agent summarizes it itself.",
+ "Auto leaves it to the agent, which summarizes once the chat fills up. The others have Codync do it sooner.",
);
let sizes = f.compaction_sizes.as_ref().map_or_else(
|| tr("Sizes show after the bot's next reply").into_owned(),
diff --git a/host/tests/compaction_e2e.rs b/host/tests/compaction_e2e.rs
index 6a474c8c..e2930efb 100644
--- a/host/tests/compaction_e2e.rs
+++ b/host/tests/compaction_e2e.rs
@@ -11,6 +11,13 @@ use common::host::Host;
use serde_json::{Value, json};
use std::time::{Duration, Instant};
+/// A fixture bot that Codync summarizes for: Early, since by default the agent decides.
+async fn early_bot(host: &Host, name: &str, mode: &str) -> String {
+ let bot = host.fixture_bot(name, "instructions_agent.py", mode).await;
+ host.call("updateBot", json!({"id": bot, "compaction": "early"})).await;
+ bot
+}
+
/// Waits until the bot's chat has a notice with this field, and returns the newest one.
async fn notice(host: &Host, bot: &str, field: &str) -> Value {
let deadline = Instant::now() + Duration::from_secs(30);
@@ -27,7 +34,7 @@ async fn notice(host: &Host, bot: &str, field: &str) -> Value {
#[tokio::test]
async fn a_full_conversation_is_compacted_with_its_keep_list() {
let host = Host::start().await;
- let claude = host.fixture_bot("Claude-like", "instructions_agent.py", "claude").await;
+ let claude = early_bot(&host, "Claude-like", "claude").await;
host.reply(&claude, "hello").await;
host.write_memory(Some(&claude), "MEMORY.md", "- Allergic to peanuts\n");
host.reply(&claude, "USAGE 210000 SIZE 1000000").await;
@@ -42,7 +49,7 @@ async fn a_full_conversation_is_compacted_with_its_keep_list() {
let opening = loads.last().unwrap()["params"]["_meta"]["systemPrompt"]["append"].as_str().unwrap();
assert!(opening.contains("Allergic to peanuts"), "{opening}");
- let codex = host.fixture_bot("Codex-like", "instructions_agent.py", "codex").await;
+ let codex = early_bot(&host, "Codex-like", "codex").await;
host.reply(&codex, "USAGE 150000 SIZE 200000").await;
notice(&host, &codex, "compaction").await;
assert!(host.prompts(&codex).iter().any(|p| p == "/compact"), "Codex's keep-list is in its config");
@@ -62,7 +69,7 @@ async fn the_users_threshold_decides_when_the_host_compacts() {
break shown;
}
};
- assert_eq!(shown["compaction"], "early");
+ assert_eq!(shown["compaction"], "off", "by default the agent decides");
assert_eq!(
shown["compactionTokens"],
json!({"min": 50_000, "max": 960_000, "step": 10_000, "presets": (1..=9).map(|n| n * 100_000).collect::<Vec<u64>>()})
@@ -75,18 +82,17 @@ async fn the_users_threshold_decides_when_the_host_compacts() {
host.reply(&bot, "USAGE 300000 SIZE 1000000").await;
notice(&host, &bot, "compaction").await;
- let off = host.fixture_bot("Off", "instructions_agent.py", "codex").await;
- host.call("updateBot", json!({"id": off, "compaction": "off"})).await;
- host.reply(&off, "USAGE 950000 SIZE 1000000").await;
- host.reply(&off, "next").await;
- assert!(!host.prompts(&off).iter().any(|p| p == "/compact"), "left to the agent's own compaction");
- assert!(host.refused("updateBot", json!({"id": off, "compaction": 123_456})).await.contains("multiple of"));
+ let auto = host.fixture_bot("Auto", "instructions_agent.py", "codex").await;
+ host.reply(&auto, "USAGE 950000 SIZE 1000000").await;
+ host.reply(&auto, "next").await;
+ assert!(!host.prompts(&auto).iter().any(|p| p == "/compact"), "by default left to the agent's own compaction");
+ assert!(host.refused("updateBot", json!({"id": auto, "compaction": 123_456})).await.contains("multiple of"));
}
#[tokio::test]
async fn compacting_too_often_turns_into_a_rollover_the_user_can_edit_or_turn_down() {
let host = Host::start().await;
- let bot = host.fixture_bot("Busy", "instructions_agent.py", "codex").await;
+ let bot = early_bot(&host, "Busy", "codex").await;
host.reply(&bot, "USAGE 210000 SIZE 1000000").await;
notice(&host, &bot, "compaction").await;
// Full again right after a compaction: compacting again wouldn't help.
@@ -134,7 +140,7 @@ async fn compacting_too_often_turns_into_a_rollover_the_user_can_edit_or_turn_do
#[tokio::test]
async fn turning_summaries_off_withdraws_a_fresh_conversation_already_drafted() {
let host = Host::start().await;
- let bot = host.fixture_bot("Changed", "instructions_agent.py", "codex").await;
+ let bot = early_bot(&host, "Changed", "codex").await;
host.reply(&bot, "USAGE 210000 SIZE 1000000").await;
notice(&host, &bot, "compaction").await;
host.reply(&bot, "USAGE 210000 SIZE 1000000").await;
@@ -191,7 +197,7 @@ fn compactions(host: &Host, bot: &str) -> usize {
async fn a_queued_compaction_runs_only_while_still_due() {
let host = Host::start().await;
// The second turn queues another compaction, but the first one makes room.
- let busy = host.fixture_bot("Busy", "instructions_agent.py", "codex").await;
+ let busy = early_bot(&host, "Busy", "codex").await;
compaction_queued_behind_a_turn(&host, &busy).await;
release(&host, &busy);
notice(&host, &busy, "compaction").await;
@@ -199,7 +205,7 @@ async fn a_queued_compaction_runs_only_while_still_due() {
assert_eq!(compactions(&host, &busy), 1);
// Summaries turned off while it waits.
- let off = host.fixture_bot("Off", "instructions_agent.py", "codex").await;
+ let off = early_bot(&host, "Off", "codex").await;
compaction_queued_behind_a_turn(&host, &off).await;
host.call("updateBot", json!({"id": off, "compaction": "off"})).await;
release(&host, &off);
diff --git a/web/content/docs/bots.mdx b/web/content/docs/bots.mdx
index 0e9020a6..d04bb22a 100644
--- a/web/content/docs/bots.mdx
+++ b/web/content/docs/bots.mdx
@@ -83,13 +83,13 @@ How approval cards work: [Conversations](/docs/conversations#approval-cards).
## Summarize long chats
-For a Claude Code or Codex bot, **Summarize long chats** decides when Codync summarizes the bot's chat so the conversation can go on with room to spare. It sits in the Agent section, under the agent and its fallbacks (on the Details page of a chat's details).
+For a Claude Code or Codex bot, **Summarize long chats** decides who summarizes the bot's chat so the conversation can go on with room to spare, and when. It sits in the Agent section, under the agent and its fallbacks (on the Details page of a chat's details).
| Setting | When Codync summarizes |
| --- | --- |
-| **Early** (default) | Once the chat uses three quarters of the model's window or 200K tokens, whichever is less. It may also summarize a chat over 100K just before its cache expires, or start a [fresh conversation](/docs/conversations#fresh-conversations) when you come back after the cache went cold. |
+| **Auto** (default) | The agent summarizes on its own when a chat fills its window. Codync doesn't summarize ahead of time or start fresh conversations. |
+| **Early** | Once the chat uses three quarters of the model's window or 200K tokens, whichever is less. It may also summarize a chat over 100K just before its cache expires, or start a [fresh conversation](/docs/conversations#fresh-conversations) when you come back after the cache went cold. |
| **Near the limit** | Just before the window fills: 40K short of it (960K on a 1M window), and never sooner than Early. |
-| **Only when full** | Never ahead of time. The agent summarizes on its own when a chat fills its window. |
| **Set a size** | At the size you pick: 100K, 200K and so on up to the largest the window allows, or **Custom size…** to type your own, in thousands of tokens (from 50K, rounded to 10K). |
With Near the limit or a size, nothing summarizes the chat or starts it over before it reaches that size, except that a chat already summarized three times starts fresh after eight hours away. The sizes appear once the bot has replied and its agent has said how large its window is. A size larger than a new model's window counts as that window's largest. A longer chat costs more usage on every turn, because the agent reads all of it each time. In the terminal UI this field is called **Summarize** and sits under the fallbacks: ←/→ goes through the same choices, then each listed size, and typing digits sets a size of your own in K.
@@ -137,7 +137,7 @@ Sections group a computer's bots under headings you name, such as Work and Perso
A bot's chat and its agent's session are two different things. The chat is the permanent record you scroll through. The session is the agent's working context: what the model currently remembers of the conversation.
-You never start a session yourself. Codync starts a fresh one on its own when a long conversation needs one; the chat then shows a card with a summary you can edit or skip. See [Fresh conversations](/docs/conversations#fresh-conversations). A new session also starts when you change the bot's agent, model or folder. Either way the chat history stays where it is, and so do the bot's memory, settings and files.
+You never start a session yourself. For a Claude Code or Codex bot whose [Summarize long chats](#summarize-long-chats) isn't Auto, Codync starts a fresh one on its own when a long conversation needs one; the chat then shows a card with a summary you can edit or skip. See [Fresh conversations](/docs/conversations#fresh-conversations). A new session also starts when you change the bot's agent, model or folder. Either way the chat history stays where it is, and so do the bot's memory, settings and files.
## Delete a bot
diff --git a/web/content/docs/conversations.mdx b/web/content/docs/conversations.mdx
index adab1f89..38781971 100644
--- a/web/content/docs/conversations.mdx
+++ b/web/content/docs/conversations.mdx
@@ -116,7 +116,7 @@ Type `/` at the start of a message to see the bot's commands:
- `/servers` (terminal UI): opens the bot's [dev servers](/docs/dev-servers), while it has some.
- `/` followed by a skill's ID: tells the bot to read that skill first and follow it for this message. The bot's skills are listed after the built-in commands.
-Any other `/command` goes to the agent unchanged, so the agent's own commands keep working. In the terminal UI that includes `/servers` while the bot has no dev servers. There's no command to start a new session: Codync starts one on its own when a conversation needs it. See [Bots](/docs/bots#sessions).
+Any other `/command` goes to the agent unchanged, so the agent's own commands keep working. In the terminal UI that includes `/servers` while the bot has no dev servers. There's no command to start a new session: Codync starts one on its own when a conversation needs it, for a Claude Code or Codex bot whose [Summarize long chats](/docs/bots#summarize-long-chats) isn't Auto. See [Bots](/docs/bots#sessions).
## Fresh conversations
@@ -132,7 +132,7 @@ Before your next message, you can:
Afterwards the card folds into one line that unfolds to what was carried.
-When Codync summarizes, and whether it starts fresh conversations at all, is the bot's [Summarize long chats](/docs/bots#summarize-long-chats) setting. Changing it takes back a card the new setting no longer calls for, and the conversation carries on.
+Fresh conversations come only from a Claude Code or Codex bot whose [Summarize long chats](/docs/bots#summarize-long-chats) setting is something other than Auto, the default. Changing it takes back a card the new setting no longer calls for, and the conversation carries on.
## Notifications
diff --git a/web/content/docs/memory.mdx b/web/content/docs/memory.mdx
index 676ee2b1..c4a4ae51 100644
--- a/web/content/docs/memory.mdx
+++ b/web/content/docs/memory.mdx
@@ -109,7 +109,7 @@ The bot's chat, its memory and the agent's session are separate things.
- **New session** gives the agent a fresh context. The chat stays in the app, and memory carries over: every new session starts with MEMORY.md in full and the list of notes.
- **During a session,** when memory changes (by this bot, another bot sharing About you, dreaming, or your own edit), the bot gets the new memory with its next message.
-- **Compaction:** when a conversation in the bot's own chat gets long, Codync has the agent summarize it to make room. Dreaming runs first, so what you said reaches memory before it's summarized. Afterwards the bot's instructions and memory are applied again. Sometimes Codync starts a fresh conversation with a summary card instead. See [Fresh conversations](/docs/conversations#fresh-conversations).
+- **Compaction:** on Auto, the default, the agent summarizes a full conversation itself, and the bot then gets its instructions and memory again. With another [Summarize long chats](/docs/bots#summarize-long-chats) choice, Codync has the agent summarize sooner: dreaming runs first, so what you said reaches memory before it's summarized, and afterwards the bot's instructions and memory are applied again. Sometimes Codync starts a fresh conversation with a summary card instead. See [Fresh conversations](/docs/conversations#fresh-conversations).
- If the agent has deleted an old session, the bot starts fresh, and its memory is still there.
## Limits