opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: I want to be able to edit the context to delete messages

Open tebayoso opened this issue 4 days ago • 2 comments

Feature hasn't been suggested before.

  • [x] 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

  1. Remove images from non-vision models: Delete screenshots added to sessions when switching to models that don't support vision
  2. Manage context limits: Remove large tool outputs or files that push the session over token limits
  3. Fix broken context: Remove corrupted or problematic parts that cause errors without reverting entire messages
  4. 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.

tebayoso avatar Jan 10 '26 22:01 tebayoso