Skip to content

[FEATURE]: Per-agent compaction config (disable compaction for specific agents) #16375

Closed as not planned

Description

@leeweisern

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

Compaction is currently only configurable globally via compaction: { auto, prune, reserved }. There is no way to control compaction behavior per-agent.

This causes issues with read-only agents like explore -- when compaction triggers during an explore subagent session, the agent loses its read-only constraints and starts writing code.

Reproduction

  1. Configure the explore subagent with a codex model (e.g. opencode/codex-spark)
  2. Use explore for codebase exploration until context gets long enough to trigger compaction
  3. After compaction, explore starts making file edits despite being a read-only agent

Proposed solution

Allow compaction to be configured per-agent, consistent with how tools, permission, model, steps, and temperature already support per-agent overrides.

JSON config example:

{
  "agent": {
    "explore": {
      "compaction": {
        "auto": false
      }
    }
  }
}

Markdown agent example:

---
description: Fast codebase exploration
mode: subagent
compaction:
  auto: false
---

Alternative (minimum fix)

If per-agent compaction config is too broad, at minimum the compaction agent should preserve the invoking agent's tool/permission constraints after compacting. If an agent has write: false and edit: false, those constraints should survive compaction.

Why this makes sense

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 6, 2026
  2. assigned and unassigned on Apr 26, 2026
  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. phazei commented on May 6, 2026

    @phazei

    Compaction completely breaks local models that use jinja templates. Disabling it per agent would be ideal.

  5. github-actions commented on Jul 8, 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