Skip to content

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

Closed as not planned

Description

@tebayoso

Feature hasn't been suggested before.

  • 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.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 10, 2026
  2. github-actions commented on Jan 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  3. tebayoso commented on Jan 10, 2026

    @tebayoso
    Author

    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.

  4. github-actions commented on Mar 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  5. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on May 3, 2026
  6. Dmitrii-Software-Testing commented on Aug 25, 2026

    @Dmitrii-Software-Testing

    Absolutely need thiss

  7. tuan2linh commented on Oct 3, 2026

    @tuan2linh

    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:

    1. 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.

    2. 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.

    Related

    Environment:

    • opencode version: 2.0.18
    • OS: Windows_NT 10.0.26200 (win32 x64)
    • Client: Desktop app
    • Active plugins: opencode-browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions