Skip to content

[BUG] /compact command does not compress - context increases instead #17557

Closed as not planned

Description

@guyinwonder168

Description

The /compact command does not actually compress the context. Instead, the context token count increases after running /compact, indicating the command either fails silently or does nothing at all.

Evidence

Before /compact:

  • Context: 50,241 tokens (25%)

After /compact:

  • Context: 51,405 tokens (25%)
  • Change: +1,164 tokens (context INCREASED)

No visual feedback was shown in the TUI during compaction (no "compacting" status), and no compression actually occurred.

Related Issues

This appears to be related to or a more severe version of:

Steps to Reproduce

  1. Start a session with moderate context (25%+ used)
  2. Note the current token count (e.g., via TUI status or /compact prompt)
  3. Run /compact
  4. Check token count again
  5. Observe that context has NOT decreased (may even increase)

Expected Behavior

  • Context tokens should DECREASE after /compact
  • TUI should show a "compacting" status during operation
  • Compression should actually occur

Actual Behavior

  • Context tokens INCREASED (+1,164 tokens)
  • No TUI feedback during compaction
  • No compression occurred

Environment

  • OpenCode version: (latest - please specify in comments)
  • OS: Linux
  • Model: GLM-5 (zai-coding-plan/glm-5)

Additional Context

This was tested in a session with:

  • ~80 messages exchanged
  • 1 manually compressed block (via compress tool)
  • Git operations, file reads/writes, and GitHub searches performed

The manual compress tool (agent-side compression) works correctly, but the user-facing /compact command does not.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Mar 15, 2026
  2. guyinwonder168 commented on Mar 15, 2026

    @guyinwonder168
    Author

    Update: DCP Plugin vs OpenCode Core Distinction

    After further investigation, I want to clarify the distinction between two separate compression mechanisms:

    Feature Source Status
    compress tool DCP Plugin (@tarquinen/opencode-dcp) ✅ Works correctly
    /compact command OpenCode Core ❌ Broken

    Key Findings:

    1. The compress tool I have access to comes from the Dynamic Context Pruning (DCP) plugin, evidenced by:

      • System tags named <dcp-message-id> and <dcp-system-reminder>
      • The plugin @tarquinen/opencode-dcp is installed
    2. The DCP plugin's compress tool works correctly - I successfully used it to compress earlier conversation ranges (confirmed by compressed block count increasing)

    3. OpenCode's built-in /compact command is the broken one - it shows no TUI feedback and doesn't actually compress the context

    This means:

    • Users with the DCP plugin have a working agent-side compression mechanism
    • Users without the DCP plugin have NO working compression at all
    • The native /compact command needs to be fixed in OpenCode core

    Recommendation:
    The OpenCode team should investigate why the native /compact command doesn't trigger actual compression, while the DCP plugin's compress tool works as expected.

  3. lumlase commented on Mar 19, 2026

    @lumlase

    I'm encountering the same issue. I was also using the latest version of OpenCode v1.2.27 , use opencode-web the context compact command isn't responding , I've tried using GLM-5 and GPT-5.4 Nothing is working.

  4. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. clousky2020 commented on May 14, 2026

    @clousky2020

    The issue still exists in version 1.14.50 and has not been fixed.

  6. 4riful commented on May 18, 2026

    @4riful

    i am using @tarquinen/opencode-dcp plugin its working fine for me thanks mate @guyinwonder168

  7. privettoli commented on Jun 25, 2026

    @privettoli

    Faced this with 1.17.10.

  8. sanketblin-stone commented on Jul 19, 2026

    @sanketblin-stone

    facing the same issue with opecode desktop app

  9. github-actions commented on Sep 19, 2026

    @github-actions
    Contributor

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

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