[Feature Request] Mitigate exponential token consumption & add token budget guardrails
維護者通常 3 天內回覆
還沒有人認領這個 Issue。
- #2482 來自 @juniorhillory-creator —— 已關閉,未合併
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
The request names no files, tests, or entry points. Start by locating where task context and tool outputs are added to conversation history, then trace how token usage is tracked. Done means the team has defined and implemented the requested budget pause, output truncation, and targeted edit behavior, with tests covering those flows.
由索引模型根據 Issue 內容生成。
描述
Is your feature request related to a problem? Please describe.
When running multi-step agentic tasks (like a 10-step debugging loop), token consumption scales exponentially due to the sliding window context. By step 5 or 6, the agent is re-sending the system prompt and all previous tool outputs (like massive linter errors or read_file contents), which drastically inflates API costs and quickly eats up the context window.
Describe the solution you'd like
To make agentic loops more sustainable, I suggest implementing a few context-management guardrails:
- Hard Token Budgets / Limits: Add a UI setting to set a maximum token budget per task (e.g., "Pause agent if task exceeds 100,000 tokens"). If the loop hits this, it pauses and asks the user if they want to summarize the context or continue.
- Raw Output Truncation: Automatically truncate or summarize massive terminal outputs (like
npm errorlogs or largeread_filepayloads) before injecting them back into the context history. - Targeted Diff Enforcement: Provide a built-in strict mode (or update system instructions) that heavily penalizes full-file rewrites via
write_fileand enforces targeted edits viaedit_fileto save on expensive output tokens.
Describe alternatives you've considered
Currently, my only workaround is to manually kill the task when the history gets too long and start a fresh session, or route repetitive tasks to my local Ollama models to avoid API costs.
Additional context
When the agent rewrites large files, it not only burns output tokens but also frequently busts the API prompt cache for subsequent turns. Better context pruning would keep cache hit rates higher and significantly reduce user costs.
- 主要語言
- TypeScript
- 星號
- 2k
- 分支
- 301
- 平均合併
- 3 天 14 小時
- 30 天內合併 PR
- 103
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Zoo-Code-Org/Zoo-Code 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 則留言 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 則留言 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
Zoo-Code-Org/Zoo-Code#2515 ·
維護者通常 3 天內回覆
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on Windows可能已有人在做 @easonLiangWorldedtech 於 16 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
維護者通常 3 天內回覆
-
[BUG] search_files hides matching text on long lines可能已有人在做 @DananjayaNadun 於 9 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 則留言 · 已指派 1 人 ·
維護者通常 3 天內回覆
查看 Zoo-Code-Org/Zoo-Code 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
ci
難度 2/5 1-3 小時 新手友好度 78/100
ClickHouse/clickhouse-js#1248 ·
維護者通常 1 天內回覆
-
E2E: Darlehen-Test wartet auf die gebuchte Auszahlung, bevor er zur Liquiditätsvorschau wechselt未關閉technik
難度 2/5 1-3 小時 新手友好度 78/100
-
bug
難度 2/5 1-3 小時 新手友好度 67/100
SR5-FoundryVTT/SR5-FoundryVTT#2162 ·
維護者通常 1 天內回覆
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 84/100
AhmedNAgy25/analysor#25 ·
維護者通常 1 天內回覆