Skip to content

[Feature]: optionally run sweep before automatic compression #561

@Sboursen

Description

@Sboursen

Feature request

Add an option to automatically run a sweep/prune pass before model-triggered compress executions.

Motivation

Right now, DCP exposes compress as the model-facing context-management tool, while /dcp sweep [count] is only available as a manual slash command. This means there is no config-only way to say: "before automatic compression, first prune the last N tool calls/results."

For long agentic sessions, especially coding sessions with many tool outputs, it would be useful to aggressively remove stale tool noise before creating compression summaries. This could reduce summary verbosity and avoid spending compression effort summarizing low-value tool chatter that could simply be pruned.

Current behavior

  • The model can autonomously call compress.
  • The user can manually run /dcp sweep 100 and then /dcp compress.
  • There does not appear to be a pre-compress hook or config option to automatically run sweep before automatic/model-triggered compression.
  • Prompt overrides can encourage "general cleanup" compression, but they cannot invoke /dcp sweep because sweep is not a model-facing tool.

Proposed behavior

Add a config option such as:

{
  "compress": {
    "preSweep": {
      "enabled": true,
      "count": 100
    }
  }
}

When enabled, every automatic/model-triggered compress call would first run the same pruning logic as /dcp sweep <count>, then continue with the normal compression flow.

Possible variants

A few possible designs:

  1. compress.preSweep.enabled + compress.preSweep.count
  2. compress.preHooks: [{ "type": "sweep", "count": 100 }]
  3. Expose sweep as a model-facing tool, though this may be less desirable because it gives the model another destructive context-management action.
  4. Add a dedicated slash command like /dcp sweep-compress 100, though this would not solve automatic compression unless also wired into the model-triggered compress path.

Why not just use prompt overrides?

The default system prompt says the only context-management tool available to the model is compress. So prompt overrides can only influence how/when compression happens; they cannot make the model execute /dcp sweep before compression.

Expected benefit

  • Cleaner context before compression.
  • Less verbose compression summaries.
  • Fewer stale tool outputs preserved unnecessarily.
  • Better behavior for reasoning-heavy or long-running coding sessions where tool-output buildup is the main source of context bloat.

Thanks for considering this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions