akseljoonas HF Staff Claude Opus 4.6 (1M context) commited on
Commit
84633b2
·
1 Parent(s): 06d26aa

fix: skip research tool outputs in deterministic pruning

Browse files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. agent/context_manager/manager.py +5 -0
agent/context_manager/manager.py CHANGED
@@ -221,6 +221,9 @@ class ContextManager:
221
 
222
  return False
223
 
 
 
 
224
  def prune_old_tool_outputs(self) -> None:
225
  """Stage 1 compaction: deterministically truncate old tool outputs.
226
 
@@ -241,6 +244,8 @@ class ContextManager:
241
  continue
242
 
243
  tool_name = getattr(msg, "name", None) or "tool"
 
 
244
  preview = content[:80]
245
  total = len(content)
246
 
 
221
 
222
  return False
223
 
224
+ # Tools whose outputs should never be pruned (too valuable to summarise)
225
+ _PRUNE_SKIP_TOOLS: set[str] = {"research"}
226
+
227
  def prune_old_tool_outputs(self) -> None:
228
  """Stage 1 compaction: deterministically truncate old tool outputs.
229
 
 
244
  continue
245
 
246
  tool_name = getattr(msg, "name", None) or "tool"
247
+ if tool_name in self._PRUNE_SKIP_TOOLS:
248
+ continue
249
  preview = content[:80]
250
  total = len(content)
251