You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: I want to be able to edit the context to delete messages #7712
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
I've been using a lot of models recently, and every so often I end up in a dead end because the context introduced something that just breaks the conversation. Most likely, it grows over limits, which effectively blocks any new command, including /compact, to run. There are other scenarios like pushing an image to a model that doesn't support it (e.g., claude-sonnet-4.5 throwing "model not supported for vision" errors).
In order to keep working I have to either:
Undo the last message - which sometimes is not feasible
Start a new conversation and reprompt from scratch
Neither solution is ideal when I just need to remove a specific problematic item (like an image or large tool output) from the context.
Proposed Solution
Introduce a /context command that opens a dialog showing all messages in the current session context with:
Part details: type (text, image, file, tool output), size in KB/MB
Token counts: per message breakdown (input/output/reasoning tokens)
Delete capability: ability to remove individual parts without losing the entire message
Visual indicators: emojis for different part types (🖼️ images, 📄 files, 🔧 tools, etc.)
Message ordering: newest to oldest for easy access to recent additions
This allows me to surgically remove problematic context items and continue the conversation without losing all previous work.
Use Cases
Remove images from non-vision models: Delete screenshots added to sessions when switching to models that don't support vision
Manage context limits: Remove large tool outputs or files that push the session over token limits
Fix broken context: Remove corrupted or problematic parts that cause errors without reverting entire messages
Token optimization: Identify and remove high-token items to stay within budget
Expected Behavior
User: /context
[Dialog opens showing:]
Summary
Total context size: 234.5 KB
Message 8 (assistant) • 1,234 tokens (800 in, 400 out, 34 thinking)
💭 Reasoning (1.2 KB)
Text (5.4 KB)
🔧 Tool: bash output (3.2 KB)
Message 7 (user)
Text (42 B)
🖼️ Image: screenshot.png [image/png] (234.5 KB) ← Press Enter to remove
[User selects and deletes the image]
[Toast: "Part removed from context"]
[Conversation continues normally]
Additional Context
This feature would complement existing context management tools like /compact and /undo, providing more granular control over session context without destructive operations.
Hit this exact gap while using the Desktop app (opencode v2.0.18, Windows 10.0.26200
x64). Two concrete symptoms in the same long-running session, confirmed by pulling
raw message history via opencode api get /api/session/{id}/message:
Agent's own tool-result screenshot persists and gets reused silently. The
agent called browser.screenshot (via Code Mode execute) to inspect a running
Electron desktop app. That screenshot is a tool-result file part, rendered in the
Desktop app transcript only inside a collapsible tool-call row -- not as a visible
chat image like a user-pasted attachment. Many turns later, discussing an
unrelated topic, the agent reused that stale screenshot (combined with a Get-Process timestamp) to make a UI claim, worded as if it were current. A
later attempt to take a fresh screenshot failed
([browser.operation_failed] browser.screenshot failed. Screenshot needs a visible tab...), and the agent fell back to the stale cached image without
flagging that explicitly.
User-pasted images from earlier turns get referenced in later unrelated
turns without being resent. Several images were pasted across different user
turns (files: 1 each, confirmed via the message API). On a later turn with files: 0, the agent's reply said "latest image" / "the image you sent",
reusing an earlier turn's image. Technically correct (full history is resent
every call, so the model still "sees" it), but there is no way for the user to
tell which earlier image is being referenced, and no way to drop a specific
stale image from context once it's no longer relevant -- short of starting a
new session or running full /compact (which is lossy for everything else too).
Both cases point at the same missing capability requested here: a way to inspect
and selectively remove one message part (especially images/tool-result media)
from the active context, without losing the rest of the conversation.
Activity
github-actions commentedon Jan 10, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
tebayoso commentedon Jan 10, 2026
Closing as duplicate, for some reason opencode using the github mcp decided it wasn't. I'll work on the others as I built a PoC.
github-actions commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
Dmitrii-Software-Testing commentedon Aug 25, 2026
Absolutely need thiss
tuan2linh commentedon Oct 3, 2026
Real-world case supporting this request
Hit this exact gap while using the Desktop app (opencode v2.0.18, Windows 10.0.26200
x64). Two concrete symptoms in the same long-running session, confirmed by pulling
raw message history via
opencode api get /api/session/{id}/message:Agent's own tool-result screenshot persists and gets reused silently. The
agent called
browser.screenshot(via Code Modeexecute) to inspect a runningElectron desktop app. That screenshot is a tool-result file part, rendered in the
Desktop app transcript only inside a collapsible tool-call row -- not as a visible
chat image like a user-pasted attachment. Many turns later, discussing an
unrelated topic, the agent reused that stale screenshot (combined with a
Get-Processtimestamp) to make a UI claim, worded as if it were current. Alater attempt to take a fresh screenshot failed
(
[browser.operation_failed] browser.screenshot failed. Screenshot needs a visible tab...), and the agent fell back to the stale cached image withoutflagging that explicitly.
User-pasted images from earlier turns get referenced in later unrelated
turns without being resent. Several images were pasted across different user
turns (
files: 1each, confirmed via the message API). On a later turn withfiles: 0, the agent's reply said "latest image" / "the image you sent",reusing an earlier turn's image. Technically correct (full history is resent
every call, so the model still "sees" it), but there is no way for the user to
tell which earlier image is being referenced, and no way to drop a specific
stale image from context once it's no longer relevant -- short of starting a
new session or running full
/compact(which is lossy for everything else too).Both cases point at the same missing capability requested here: a way to inspect
and selectively remove one message part (especially images/tool-result media)
from the active context, without losing the rest of the conversation.
Related
explicitly described by its author as not ready for mainstream merge.
/compact) are coarse -- theyeither lose unrelated context or require abandoning the session.
Environment: