Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

docs: describe the context budget as it stands, not how it changed

cxw25929a600f6b
diff --git a/README.md b/README.md
index d0e6d2b2..da205530 100644
--- a/README.md
+++ b/README.md
@@ -175,7 +175,7 @@ Nested runs deliberately skip `globalSlots`: the parent turn already holds a slo
### Context budget: derived from the model, not a fixed number
-Compaction used to fire at fixed token counts — 18K within a turn, 12K across turns — tuned back when 200K was the ceiling. That number meant nothing to a 1M-window model, and it was actively dangerous on a 32K one: its ~25K of usable input never reached an 18K trigger with enough room left to act, so the guard failed exactly the model that needed it most. The budget is now derived top-down ([`context-budget.ts`](./src/core-agent/src/agent/context-budget.ts)):
+Every compaction threshold is derived from the model in use, so one policy fits a 32K window and a 1M one alike ([`context-budget.ts`](./src/core-agent/src/agent/context-budget.ts)):
```
usableInput = contextWindow − maxOutputTokens − safety
@@ -184,7 +184,7 @@ messageBudget = max(usableInput × 0.2, usableInput − systemPrompt − toolDef
Every trigger is a share of `messageBudget` — 0.3 for the in-turn layer, 0.2 for cross-turn history, 0.1 for one round's inline tool results — and everything else derives from its trigger, so the shares are the only tunable surface. They sum to well under 1, leaving room for injected runtime state and for the growth that happens between a trigger firing and its summary landing. The `max` is a fuse: when a large tool set would otherwise swallow the window, messages keep a floor share instead of computing a negative budget.
-There is deliberately **no cap on how many times a run may compact successfully**. That ceiling existed twice and failed the same way both times: once reached, context can only grow, the inline-result allowance falls to zero, and the agent keeps calling tools whose output it can no longer see — silently, until the request finally overflows. What gets bounded instead is wasted work: a fingerprint check refuses to compact identical state twice, a minimum-savings threshold rejects passes that would free too little, and three consecutive failures stop LLM-backed compaction.
+A run compacts as many times as it needs to — there is deliberately **no ceiling on successful passes**. What is bounded is wasted work instead: a fingerprint check refuses to compact identical state twice, a minimum-savings threshold rejects passes that would free too little, and three consecutive failures stop LLM-backed compaction.
Summarization loses detail, so what an agent must not forget is kept as structure rather than prose. A workspace ledger of files written, files read, and commands run survives compaction ([`workspace-state.ts`](./src/core-agent/src/agent/workspace-state.ts)), and a spin detector — two or more compactions plus 75% of the tool budget consumed — nudges the agent once to re-anchor on that ledger instead of re-deriving work it just summarized away.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index d65b810e..adf72794 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -175,7 +175,7 @@ run.cmd # Windows
### 上下文预算:由模型推导,而不是写死一个数
-压缩过去按固定 token 数触发 —— 回合内 18K、跨回合 12K —— 这些数字是在 200K 还是上限的年代调出来的。对 1M 窗口的模型它毫无意义;而对 32K 窗口的模型它是真有害:那约 25K 的可用输入根本到不了 18K 触发点、也就没有余量再做处置,于是最需要保护的模型恰恰没被保护。现在预算改为自顶向下推导([`context-budget.ts`](./src/core-agent/src/agent/context-budget.ts)):
+每个压缩阈值都由当前使用的模型推导而来,因此同一套策略既适配 32K 窗口,也适配 1M 窗口([`context-budget.ts`](./src/core-agent/src/agent/context-budget.ts)):
```
usableInput = 上下文窗口 − 最大输出 token − 安全余量
@@ -184,7 +184,7 @@ messageBudget = max(usableInput × 0.2, usableInput − 系统提示 − 工具
每个触发阈值都是 `messageBudget` 的一个份额 —— 回合内层 0.3、跨回合历史 0.2、单轮内联工具结果 0.1 —— 其余参数都由触发阈值派生,因此这几个份额是唯一的可调面。它们的总和远小于 1,留出的余量用于回灌的运行时状态,以及"触发发生到摘要落地"之间仍在继续的增长。那个 `max` 是保险丝:当工具集大到会吃掉整个窗口时,消息仍保有一个底线份额,而不是算出一个负预算。
-**一次运行成功压缩的次数刻意不设上限。** 这个上限存在过两次,两次都以同样的方式失效:一旦触顶,上下文只会继续增长,内联结果额度归零,智能体继续调用那些它已经看不到输出的工具 —— 全程无报错,直到请求真正溢出。真正需要设界的是无效功,而那些守卫另有其人:指纹校验拒绝对同一状态重复压缩,最小收益阈值拒绝那些释放太少的压缩,连续三次失败则停止 LLM 压缩。
+一次运行需要压缩多少次就压缩多少次 —— **成功压缩的次数刻意不设上限**。真正设界的是无效功:指纹校验拒绝对同一状态重复压缩,最小收益阈值拒绝那些释放太少的压缩,连续三次失败则停止 LLM 压缩。
摘要必然丢细节,所以智能体绝不能忘的东西不交给散文承载。一份记录"写过哪些文件、读过哪些文件、跑过哪些命令"的工作台账会以结构形式挺过压缩([`workspace-state.ts`](./src/core-agent/src/agent/workspace-state.ts));另有一个空转检测 —— 压缩两次以上且工具预算已消耗 75% —— 会提醒智能体一次,让它回到台账重新锚定,而不是把刚被摘要掉的工作再推导一遍。