Support Task-Scoped Context with Session-Level Code Container to Reduce Redundant Token Usage
What feature would you like to see?
I have an idea: to avoid redundant long-context usage, files required from history should be read only once and stored in a session-level temporary container that holds the contextual code files for the current session.
When executing a specific task, an independent token budget can be allocated for that task (e.g., for navigating to SDK definitions, inspecting related usages, etc.). This token space is task-scoped and exists only within the current session. Once the task is completed, the temporary context within this task space is discarded, but the session-level code container is updated with the latest code state, along with a record of the code changes made during the task and a summary of the task execution.
In essence, tokens consumed by individual work tasks are not counted toward the overall session context length. Instead, the system retains only the modified portions of the code and a concise task summary, using them to update the session-level code container. This approach can help mitigate the problem of excessively long contexts in code-related tasks, while preserving more precise and actionable information compared to purely semantic retrieval methods.
---
我有一个想法:为避免冗余的长上下文,对于历史所需文件的读取仅执行一次,并将其存储在一个会话级别的临时容器中,用于保存本次会话所涉及的上下文代码文件。
当执行具体任务时,可为该任务分配独立的 token 预算(例如用于跳转查看 SDK 定义、查阅相关用法等)。这个 token 空间是任务级别的,仅在当前会话内有效。任务完成后,该任务空间中的临时上下文将被清除,但会将会话容器中的代码更新为最新状态,并保留本次任务对代码所做的变更记录以及任务执行的总结。
总体而言,具体工作任务所消耗的 token 不计入整体会话的上下文长度;取而代之的是,系统只记录代码的变更部分和任务摘要,并据此更新会话级的代码容器。这种方法可在一定程度上缓解代码任务中上下文过长的问题,同时相比纯语义检索,能保留更多精准、有效的信息。
Additional information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗