-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Diagnose and mitigate large tool-result retention in long sessions #4184
Copy link
Copy link
Open
Labels
category/cliCommand line interface and interactionCommand line interface and interactionroadmap/context-performanceRoadmap: Context and performanceRoadmap: Context and performancescope/memoryMemory and context managementMemory and context managementscope/memory-usageMemory consumptionMemory consumptionstatus/needs-triageIssue needs to be triaged and labeledIssue needs to be triaged and labeledtype/feature-requestNew feature or enhancement requestNew feature or enhancement request
Metadata
Metadata
Assignees
Labels
category/cliCommand line interface and interactionCommand line interface and interactionroadmap/context-performanceRoadmap: Context and performanceRoadmap: Context and performancescope/memoryMemory and context managementMemory and context managementscope/memory-usageMemory consumptionMemory consumptionstatus/needs-triageIssue needs to be triaged and labeledIssue needs to be triaged and labeledtype/feature-requestNew feature or enhancement requestNew feature or enhancement request
Type
Fields
Give feedbackNo fields configured for issues without a type.
Parent
Part of #3000 and builds on
/doctor memorydiagnostics.Goal
Introduce large tool-result and history retention diagnostics, then use those signals to design a safe offload/preview path that reduces OOM risk in long sessions.
Motivation
For agent CLIs, OOM often comes from retaining oversized tool outputs or duplicating history during compression, not just from a traditional leak. Claude Code-style behavior suggests a useful pattern: keep structured metadata and previews in the live context, persist large payloads out of the hot path, and make diagnostics show where memory is being retained.
Proposed solution
Phase 1: diagnostics only
/doctor memorywithout content.Phase 2: mitigation design
Non-goals
/doctor memoryPR on offload implementation.Acceptance criteria
/doctor memorycan identify large retained tool results by size/count only.