A local-first multi-agent app development platform, built on PenguinHarness
feat(core,docs): raise the seeded compaction threshold to 256000 (#366)
Yaowei Zhengf539a584133c
diff --git a/changelog/unreleased/2026-08-20-compaction-threshold-default.md b/changelog/unreleased/2026-08-20-compaction-threshold-default.mdnew file mode 100644index 00000000..7659f1e2--- /dev/null+++ b/changelog/unreleased/2026-08-20-compaction-threshold-default.md@@ -0,0 +1,50 @@+# Compaction threshold default raised to 256000++- **Date:** 2026-08-20+- **Type:** feature+- **Scope:** `core`, `docs`+- **PR:** [#366](https://github.com/Prism-Shadow/penguin-harness/pull/366)++[中文版](2026-08-20-compaction-threshold-default.zh.md)++Newly created Agents are seeded with `compaction.max_context_length: 256000` instead of+`128000`. The effective threshold is the smaller of that number and the model's+`context_window − COMPACTION_HEADROOM` (2048), taken at every use, so a small-window model+compacts exactly where it did before while a big-window model carries twice the context it+used to before compaction folds it.++## Details++- The seeded value moved into a named constant, `DEFAULT_MAX_CONTEXT_LENGTH` in+ `packages/core/src/state/default-config.ts`. The Agent composition layer reads the same+ constant as its fallback for a config carrying no `compaction` section, so the two sites+ cannot drift apart the way two literals could.+- With the new seed, a 32768-token window still fires compaction at 30720 and a+ 200000-token window fires at 197952. A window above 258048 — nearly every entry in the+ built-in model catalog — fires at the seeded 256000 itself.+- A model entry with no usable `context_window` derives from the assumed window of 128000 —+ `DEFAULT_CONTEXT_WINDOW`, a separate constant that happened to hold the same value as the+ old threshold default — and therefore compacts at 125952. A test pins that backstop+ against the shipped constant rather than a stand-in literal, and the comments at both+ constants now name the other one so the two 128000s are not read as one fact.++## Compatibility++- Existing Agents are not migrated. An Agent runs from its `system_config.yaml` verbatim, so+ every Agent already on disk keeps the `compaction.max_context_length` it stores — 128000+ for anything created before this change. Only Projects and Agents created afterwards are+ seeded with 256000.+- Three ways to adopt it on an existing Agent, none automatic: edit+ `compaction.max_context_length` on the **Runtime** tab of the Agent's settings page (or in+ `system_config.yaml` directly), run **Update kernel**, or **Restore default+ configuration**.+- Changing a built-in default advanced `KERNEL_VERSION` to generation `2026-08-20`, with+ `compaction.max_context_length` as its only changed leaf, so existing Agents show the+ kernel-update hint. Under **Update kernel** a stored value still equal to a recorded+ generation's default advances to 256000; a value the user edited is kept and reported.++## Docs++- The bilingual configuration and agent-loop pages record the new default and state which+ number actually fires — the smaller of the seeded threshold and the model window's cap —+ plus what an entry without a `context_window` derives.diff --git a/changelog/unreleased/2026-08-20-compaction-threshold-default.zh.md b/changelog/unreleased/2026-08-20-compaction-threshold-default.zh.mdnew file mode 100644index 00000000..daf2cb74--- /dev/null+++ b/changelog/unreleased/2026-08-20-compaction-threshold-default.zh.md@@ -0,0 +1,41 @@+# 压缩阈值缺省值提高到 256000++- **Date:** 2026-08-20+- **Type:** feature+- **Scope:** `core`, `docs`+- **PR:** [#366](https://github.com/Prism-Shadow/penguin-harness/pull/366)++[English](2026-08-20-compaction-threshold-default.md)++新建 Agent 的 `compaction.max_context_length` 初始值由 `128000` 改为 `256000`。生效阈值取该+数值与模型 `context_window − COMPACTION_HEADROOM`(2048)中的较小者,且每次使用时重新计算,+所以小窗口模型的触发点与此前完全一致,大窗口模型则能比此前多带一倍的上下文再折叠。++## 细节++- 初始值收进了一个具名常量 `DEFAULT_MAX_CONTEXT_LENGTH`,位于+ `packages/core/src/state/default-config.ts`。Agent 组装层在配置缺少 `compaction` 整节时+ 也读同一个常量作为兜底,两处不会再像两个字面量那样各自漂移。+- 采用新初始值后,32768 的窗口仍在 30720 触发压缩,200000 的窗口在 197952 触发。窗口大于+ 258048 时——内置模型目录里几乎每个条目都是——触发的就是初始值 256000 本身。+- 未配置可用 `context_window` 的模型条目按假定窗口 128000 推导——那是+ `DEFAULT_CONTEXT_WINDOW`,一个恰好曾与旧阈值缺省值同值的独立常量——因此在 125952 触发。+ 新增的测试直接以出厂常量(而非替身字面量)钉住这条兜底路径,两个常量的注释也各自点名+ 对方,避免这两个 128000 被当成同一件事读。++## 兼容性++- 存量 Agent 不迁移。Agent 始终按其磁盘上的 `system_config.yaml` 原样运行,所以已在磁盘上+ 的每个 Agent 都保留它自己存着的 `compaction.max_context_length`——本次改动之前创建的即+ 128000。只有此后新建的 Project 与 Agent 才以 256000 初始化。+- 存量 Agent 采纳新值有三条路径,均需显式操作:在 Agent 设置页的**运行参数**标签页(或直接+ 在 `system_config.yaml` 里)改 `compaction.max_context_length`、执行**更新内核**,或+ **还原为默认配置**。+- 内置默认发生变化,`KERNEL_VERSION` 因此前进到 `2026-08-20` 一代,其唯一变化的叶子就是+ `compaction.max_context_length`,存量 Agent 会看到内核更新提示。执行**更新内核**时,仍等+ 于某一代已记录默认的存量值会跟进到 256000,被用户改过的值则保留并在结果中列出。++## 文档++- 双语的配置页与 Agent 循环页记录了新的缺省值,并写明实际触发的是哪个数字——阈值缺省值与模型+ 窗口上限中的较小者——以及未配置 `context_window` 的条目按什么推导。diff --git a/packages/core/src/agent.ts b/packages/core/src/agent.tsindex aa5eb165..73565c85 100644--- a/packages/core/src/agent.ts+++ b/packages/core/src/agent.ts@@ -14,6 +14,7 @@ import {buildToolConfig,selectBuiltinToolsForModel,DEFAULT_COMPACTION_PROMPT,+ DEFAULT_MAX_CONTEXT_LENGTH,formatModelRef,getModel,listInstalledSkills,@@ -910,7 +911,7 @@ export class Agent {const compactionConfig = this.state.systemConfig.compaction;const compaction: CompactionSettings = {maxContextLength: effectiveMaxContextLength(- compactionConfig?.max_context_length ?? 128000,+ compactionConfig?.max_context_length ?? DEFAULT_MAX_CONTEXT_LENGTH,modelEntry.context_window,),maxSessionTurns: compactionConfig?.max_session_turns ?? -1,diff --git a/packages/core/src/llm/context-limits.ts b/packages/core/src/llm/context-limits.tsindex ea3f42d1..e420efac 100644--- a/packages/core/src/llm/context-limits.ts+++ b/packages/core/src/llm/context-limits.ts@@ -32,6 +32,11 @@ import type { OmniMessage } from "../omnimessage/index.js";* output clamp is disabled without a configured window (see effectiveMaxOutputTokens).* Models with a *smaller* real window still need `context_window` set on their entry —* no derivation can protect a window it doesn't know about.+ *+ * Not the compaction-threshold default (`DEFAULT_MAX_CONTEXT_LENGTH` in+ * state/default-config.ts) — a separate number that happens to concern the same axis. The+ * seeded threshold sits above this assumption, so an entry without a usable `context_window`+ * effectively compacts at `DEFAULT_CONTEXT_WINDOW − COMPACTION_HEADROOM`.*/export const DEFAULT_CONTEXT_WINDOW = 128000;@@ -70,8 +75,9 @@ export const MIN_OUTPUT_TOKENS = Math.floor(OUTPUT_SAFETY_MARGIN / 2);* per-request clamp, so at the trigger point its output budget is about* `COMPACTION_HEADROOM − OUTPUT_SAFETY_MARGIN` minus the compaction prompt; reserving less* would clamp the summary to the floor and truncate it. On a 32768 window this makes- * compaction fire at ≈ 30720 instead of never (the previous default threshold of 128000- * was unreachable inside the window).+ * compaction fire at ≈ 30720 instead of never — the seeded default threshold+ * (`DEFAULT_MAX_CONTEXT_LENGTH`, 256000) sits far outside such a window, so without this cap+ * the window's hard limit would always be hit first.*/export const COMPACTION_HEADROOM = OUTPUT_SAFETY_MARGIN * 2;diff --git a/packages/core/src/state/default-config.ts b/packages/core/src/state/default-config.tsindex dea6c88f..9ecfdff2 100644--- a/packages/core/src/state/default-config.ts+++ b/packages/core/src/state/default-config.ts@@ -96,12 +96,27 @@ export const SCHEDULES_PLACEHOLDER = "{{SCHEDULES}}";/** Inside `schedules.prompt` only: the current schedule-file names, one `- name` per line (SCHEDULE_LIST_EMPTY_NOTE when none exist). */export const SCHEDULE_LIST_PLACEHOLDER = "{{SCHEDULE_LIST}}";+/**+ * Seeded `compaction.max_context_length`: the context-token threshold newly created Agents+ * start with. Set high on purpose, because the model's own `context_window` is the backstop:+ * the effective threshold is the smaller of this value and the window minus+ * COMPACTION_HEADROOM, taken at use (see llm/context-limits.ts). A window with no room for+ * this value plus that headroom therefore decides the trigger point, so a small-window model+ * still compacts inside its window rather than never; on a roomier window — nearly every+ * built-in catalog entry — this value is what fires. A model entry with no usable+ * `context_window` falls back to the assumed window (128000), which is a different number+ * from this one and must not be conflated with it.+ *+ * Persisted per-agent in system_config.yaml — existing agents keep their stored value.+ */+export const DEFAULT_MAX_CONTEXT_LENGTH = 256000;+/*** Context compaction config (the `compaction` section of `system_config.yaml`).* Docs: /docs/configuration § "Agent config".*/export interface CompactionConfig {- /** Context Token threshold (taken from the most recent token_usage's request.total); defaults to 128000, <=0 disables. */+ /** Context Token threshold (taken from the most recent token_usage's request.total); defaults to {@link DEFAULT_MAX_CONTEXT_LENGTH}, <=0 disables. */max_context_length?: number;/** Session cumulative turn threshold (counted in LLM Requests, across Tasks); defaults to -1, <=0 means no limit. */max_session_turns?: number;@@ -353,7 +368,7 @@ export interface SystemConfig {thinking_level?: ThinkingLevelName;timeoutMs?: number;};- /** Context compaction (enabled by default, max_context_length 128k, mode summarize). */+ /** Context compaction (enabled by default, max_context_length 256k, mode summarize). */compaction?: CompactionConfig;/** Memory (enabled by default; only reaches the prompt through the template's `{{MEMORY}}` placeholder). */memory?: MemoryConfig;@@ -885,7 +900,7 @@ export function defaultSystemConfig(): SystemConfig {timeoutMs: 120000,},compaction: {- max_context_length: 128000,+ max_context_length: DEFAULT_MAX_CONTEXT_LENGTH,max_session_turns: -1,mode: "summarize",prompt: DEFAULT_COMPACTION_PROMPT,diff --git a/packages/core/src/state/kernel-history.ts b/packages/core/src/state/kernel-history.tsindex a0bb803f..3b2e12db 100644--- a/packages/core/src/state/kernel-history.ts+++ b/packages/core/src/state/kernel-history.ts@@ -26,7 +26,7 @@ import type { SystemConfig } from "./default-config.js";* pinned-hash test enforces both directions (bump without new hashes, or changed defaults* without a bump, both fail).*/-export const KERNEL_VERSION = "2026-08-19";+export const KERNEL_VERSION = "2026-08-20";/*** Identity / user-data fields excluded from kernel management: never hashed, never written@@ -143,9 +143,11 @@ export function isKernelOutdated(kernelVersion: string | null | undefined): bool* - `"2026-08-11"` — the toggles generation.* - `"2026-08-18"` — `run_subagent` gained the optional `thinking_level` argument* (issue #306): only the `tools.builtin.run_subagent` leaf changed.- * - `"2026-08-19"` (current) — the `max` thinking level joined the ladder, widening- * `run_subagent`'s `thinking_level` enum: again only the `tools.builtin.run_subagent` leaf- * changed.+ * - `"2026-08-19"` — the `max` thinking level joined the ladder, widening `run_subagent`'s+ * `thinking_level` enum: again only the `tools.builtin.run_subagent` leaf changed.+ * - `"2026-08-20"` (current) — the seeded `compaction.max_context_length` rose to 256000,+ * with the per-model `context_window` cap as its backstop: only the+ * `compaction.max_context_length` leaf changed.** Generations older than the seeded ones cannot be fully reconstructed; their values match* no recorded hash and are conservatively kept by a kernel update (restore-default-config is@@ -290,6 +292,42 @@ export const KERNEL_HASH_HISTORY: Readonly<Record<string, Readonly<Record<string"tools.builtin.describe_image":"fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",},+ "2026-08-20": {+ system_prompt: "de8952daede04db17400c5cd59b279eccf523cf2d8a0ecedfa37a96de7925b44",+ max_turns: "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",+ "model.max_tokens": "492f431bae35265f2e5f4ed49bd8c58dda912431be561504846988d00d05d117",+ "model.thinking_level": "60d4c90eee5e731df8d3ef2891de541d2e755ff8ee9db358e26bdec49f6e0db9",+ "model.timeoutMs": "4f9f73b34c5b89879aad65a48025f3187dd9ce6dc3d4e88eecb2fc79227350f1",+ "compaction.max_context_length":+ "b412afcc00967650c9e51efd8cdc35ae59d3d6c30234331b7bf75b382d982ee9",+ "compaction.max_session_turns":+ "1bad6b8cf97131fceab8543e81f7757195fbb1d36b376ee994ad1cf17699c464",+ "compaction.mode": "e58fac0b4b9c0f29b3d224da119dff5f6517a40d139faf92e309705b98bd410a",+ "compaction.prompt": "8ed55781e8071083f8246ed70d9e063ee729d3872d5bc6a2bedfa9c99aed6ae5",+ "memory.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",+ "memory.prompt": "9380e2382e5dd3d37a6470b0bc0d27c9ed113fa9a54ff78122784c57a16b992c",+ "memory.workspace_prompt": "76c5a8e18a568f471593ef1da6d75d2596f27619cb877703b2dd28bb0554e0d5",+ "vault.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",+ "vault.prompt": "66e607aa4e205413f1816a677bed31af2d8c24218e71b55adba54aff5aa094ce",+ "skills.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",+ "skills.prompt": "42934d17f5dd9c02dfa7c1d37f255dea92bd36905c96a54775c65ef7db713bd9",+ "schedules.enabled": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",+ "schedules.prompt": "3c690ff9bb3e4d423b2d5dfce74f5890d52bf8ae159cfe135a671ac3d46da75a",+ "tools.builtin.read_file": "858f128945421043f5f373c908a0ee081e93e9413debaa49c8c7af1c1c76db3c",+ "tools.builtin.edit_file": "165a3e2dabe3d13200a1670f3c23ed2d6561c508439db1972db066719f3549ef",+ "tools.builtin.write_file": "c98253bd5a3b6ff021accda91af016a809a9b50ce56f38a3ed60eeb673c0b130",+ "tools.builtin.exec_command":+ "16b327e5c3617b7c4d21505c9d1a72dd33a74de97cd5c60d6c4538b8ec408421",+ "tools.builtin.input_command":+ "4c907500cda145161a9481803cfb57ed814b6793e762fd6284510187e9d781c8",+ "tools.builtin.run_subagent":+ "f43ac4f9621032d554275be1d416f994f0d3cc0918537de99c974e436eb69316",+ "tools.builtin.input_subagent":+ "22cc4648d773e8422e80a12a7a095b00b7f7eb01ab5a9ea080858dcd7517b4e3",+ "tools.builtin.read_image": "05b797a88df1e6a90fb3da67ec654b206f8d81291f89d160a505620afcea38bb",+ "tools.builtin.describe_image":+ "fad6d0cdd483eb53b5d243c0508024ab3b708ce6d3c81933acd291f05d4a265f",+ },};/**diff --git a/packages/core/test/context-limits.test.ts b/packages/core/test/context-limits.test.tsindex 817e17e8..60e0ad25 100644--- a/packages/core/test/context-limits.test.ts+++ b/packages/core/test/context-limits.test.ts@@ -16,6 +16,7 @@ import {effectiveMaxOutputTokens,resolveContextWindow,} from "../src/llm/context-limits.js";+import { DEFAULT_MAX_CONTEXT_LENGTH } from "../src/state/default-config.js";import { toolCallOutput, userText } from "../src/omnimessage/index.js";import type { OmniMessage } from "../src/omnimessage/index.js";@@ -168,8 +169,7 @@ describe("effectiveMaxOutputTokens (per-request output clamp)", () => {describe("effectiveMaxContextLength (window-derived compaction threshold)", () => {it("caps the configured threshold at context_window − COMPACTION_HEADROOM", () => {- // 32k window: compaction now fires at ~30.7k instead of never (the 128000 default was- // unreachable inside the window).+ // A 32k window compacts at ~30.7k rather than at a configured threshold it can never reach.expect(effectiveMaxContextLength(128000, 32768)).toBe(32768 - COMPACTION_HEADROOM);expect(effectiveMaxContextLength(128000, 200000)).toBe(128000); // ample window: unchangedexpect(effectiveMaxContextLength(8000, 32768)).toBe(8000); // tighter user setting wins@@ -180,7 +180,7 @@ describe("effectiveMaxContextLength (window-derived compaction threshold)", () =);});- it("derives from the 128000 default when the window is unconfigured or implausible", () => {+ it("derives from DEFAULT_CONTEXT_WINDOW when the window is unconfigured or implausible", () => {expect(effectiveMaxContextLength(128000, undefined)).toBe(DEFAULT_CONTEXT_WINDOW - COMPACTION_HEADROOM,);@@ -195,6 +195,35 @@ describe("effectiveMaxContextLength (window-derived compaction threshold)", () =);});+ // The effective threshold is the smaller of the seeded value and the window's cap, so the+ // window decides on anything too small to hold it and the seeded value decides above that.+ // Covers the shipped constant rather than a stand-in literal.+ it("backstops the seeded default threshold with the model's context window", () => {+ // Windows smaller than the seeded threshold: the window decides, and always leaves+ // COMPACTION_HEADROOM for the summary request itself.+ expect(effectiveMaxContextLength(DEFAULT_MAX_CONTEXT_LENGTH, 32768)).toBe(+ 32768 - COMPACTION_HEADROOM,+ );+ expect(effectiveMaxContextLength(DEFAULT_MAX_CONTEXT_LENGTH, 200000)).toBe(+ 200000 - COMPACTION_HEADROOM,+ );+ // No usable window on the entry: the assumed window backstops it just the same, which is+ // where the two 128000s must not be confused — this is DEFAULT_CONTEXT_WINDOW, not a+ // threshold default.+ expect(effectiveMaxContextLength(DEFAULT_MAX_CONTEXT_LENGTH, undefined)).toBe(+ DEFAULT_CONTEXT_WINDOW - COMPACTION_HEADROOM,+ );+ expect(effectiveMaxContextLength(DEFAULT_MAX_CONTEXT_LENGTH, 2048)).toBe(+ DEFAULT_CONTEXT_WINDOW - COMPACTION_HEADROOM,+ );+ // A window roomier than the threshold leaves it alone — the only case where the+ // configured number is what fires.+ expect(effectiveMaxContextLength(DEFAULT_MAX_CONTEXT_LENGTH, 1_000_000)).toBe(+ DEFAULT_MAX_CONTEXT_LENGTH,+ );+ expect(DEFAULT_MAX_CONTEXT_LENGTH).toBeGreaterThan(DEFAULT_CONTEXT_WINDOW);+ });+it("keeps <=0 as 'compaction disabled'", () => {expect(effectiveMaxContextLength(-1, 32768)).toBe(-1); // off: no clampingexpect(effectiveMaxContextLength(0, 32768)).toBe(0); // off: no clampingdiff --git a/packages/core/test/kernel-version.test.ts b/packages/core/test/kernel-version.test.tsindex adadb2fa..538c0f9c 100644--- a/packages/core/test/kernel-version.test.ts+++ b/packages/core/test/kernel-version.test.ts@@ -238,7 +238,7 @@ describe("applyKernelUpdate", () => {expect(result.advanced).toContain("compaction.max_context_length");const written = await readConfig();expect(written.compaction?.prompt).toBe("Ancient compaction wording.");- expect(written.compaction?.max_context_length).toBe(128000);+ expect(written.compaction?.max_context_length).toBe(256000);});it("never touches name, description, version or mcpServers", async () => {diff --git a/packages/docs/content/agent-loop.en.md b/packages/docs/content/agent-loop.en.mdindex b40aa0f4..e001e1e4 100644--- a/packages/docs/content/agent-loop.en.md+++ b/packages/docs/content/agent-loop.en.md@@ -122,7 +122,7 @@ Three triggers (`compaction_begin.reason`):| reason | Condition || --- | --- |-| `context` | last turn's `token_usage.request.total` ≥ `maxContextLength` (default 128000; the effective threshold is capped at the model's `context_window` − 2048, so a small-window model — a 32k local vLLM, say — compacts at ~30.7k instead of overflowing the window first; an entry without `context_window` derives from the assumed 128000 default) |+| `context` | last turn's `token_usage.request.total` ≥ `maxContextLength` (default 256000; the effective threshold is the smaller of that and the model's `context_window` − 2048, so a 32k local vLLM compacts at ~30.7k instead of overflowing the window first while a 1M-window model fires at the configured 256000; an entry without `context_window` derives from an assumed 128000 window, i.e. ~126k) || `turns` | Session turn count ≥ `maxSessionTurns` (default -1 = unlimited) || `manual` | the user runs `/compact` or calls `session.compact()` |diff --git a/packages/docs/content/agent-loop.zh.md b/packages/docs/content/agent-loop.zh.mdindex 6e3f0c41..18a663cc 100644--- a/packages/docs/content/agent-loop.zh.md+++ b/packages/docs/content/agent-loop.zh.md@@ -119,7 +119,7 @@ interface CompactionSettings {| reason | 触发条件 || --- | --- |-| `context` | 上一轮 `token_usage.request.total` ≥ `maxContextLength`(默认 128000;生效阈值不超过模型 `context_window` − 2048,小窗口模型——如 32k 的本地 vLLM——约在 30.7k 处压缩,而不是先撞上窗口硬限制;条目未配置 `context_window` 时按 128000 的假定默认值推导) |+| `context` | 上一轮 `token_usage.request.total` ≥ `maxContextLength`(默认 256000;生效阈值取它与模型 `context_window` − 2048 中的较小者,故 32k 的本地 vLLM 约在 30.7k 处压缩、而不是先撞上窗口硬限制,1M 窗口的模型则在配置的 256000 处触发;条目未配置 `context_window` 时按 128000 的假定窗口推导,即约 126k) || `turns` | Session 轮数 ≥ `maxSessionTurns`(默认 -1,即不限) || `manual` | 用户执行 `/compact` 或调用 `session.compact()` |diff --git a/packages/docs/content/configuration.en.md b/packages/docs/content/configuration.en.mdindex 3809e9a5..34bc1b61 100644--- a/packages/docs/content/configuration.en.md+++ b/packages/docs/content/configuration.en.md@@ -105,7 +105,7 @@ Edit this file via the CLI (`penguin config model …`) or the Web Models page| `model.max_tokens` | `32000` | Output Token ceiling per Request (-1 = no cap, provider default); each request clamps the effective value to the model's `context_window` minus the estimated input, so a small-window model never gets asked for more than fits || `model.thinking_level` | `medium` | `none` / `low` / `medium` / `high` / `xhigh` / `max`; the session default, overridable per-Task || `model.timeoutMs` | `120000` | Per-Request timeout (milliseconds) |-| `compaction.max_context_length` | `128000` | Context Token threshold that triggers compaction; the effective threshold is capped at the model's `context_window` − 2048 so compaction fires before a small window overflows |+| `compaction.max_context_length` | `256000` | Context Token threshold that triggers compaction; the effective threshold is the smaller of this and the model's `context_window` − 2048, so a small-window model compacts inside its window while a window above 258048 fires at this number (an entry with no `context_window` assumes a 128000 window) || `compaction.max_session_turns` | `-1` | Cumulative Session turn threshold (`-1` = unlimited) || `compaction.mode` | `summarize` | `summarize` / `discard` || `compaction.prompt` | built-in template | Prompt used for summarize compaction |@@ -143,7 +143,7 @@ model:timeoutMs: 120000compaction:- max_context_length: 128000+ max_context_length: 256000max_session_turns: -1mode: summarizediff --git a/packages/docs/content/configuration.zh.md b/packages/docs/content/configuration.zh.mdindex 5c17bdc0..5450fb8a 100644--- a/packages/docs/content/configuration.zh.md+++ b/packages/docs/content/configuration.zh.md@@ -105,7 +105,7 @@ output = 0.857143| `model.max_tokens` | `32000` | 单次输出 Token 天花板(-1 不设上限,用服务商默认);每次请求会把实际值收敛到模型 `context_window` 减估算输入以内,小窗口模型不会被索要放不下的输出 || `model.thinking_level` | `medium` | `none` / `low` / `medium` / `high` / `xhigh` / `max`;作为会话默认档位,可被逐轮 Task 参数覆盖 || `model.timeoutMs` | `120000` | 单次 Request 超时(毫秒) |-| `compaction.max_context_length` | `128000` | 触发压缩的上下文 Token 阈值;生效阈值不超过模型 `context_window` − 2048,压缩在小窗口溢出之前触发 |+| `compaction.max_context_length` | `256000` | 触发压缩的上下文 Token 阈值;生效阈值取它与模型 `context_window` − 2048 中的较小者,故小窗口模型在自己的窗口内压缩,窗口大于 258048 时则在该数值处触发(条目未配置 `context_window` 时按 128000 的假定窗口计) || `compaction.max_session_turns` | `-1` | Session 累计轮数阈值(`-1` 不限制) || `compaction.mode` | `summarize` | `summarize` / `discard` || `compaction.prompt` | 内置模板 | summarize 压缩使用的 Prompt |@@ -143,7 +143,7 @@ model:timeoutMs: 120000compaction:- max_context_length: 128000+ max_context_length: 256000max_session_turns: -1mode: summarize