Skip to content

[Feature]: Percentage-based compaction config #72790

@SERVICEPOP

Description

@SERVICEPOP

Summary

Percentage-based compaction config.

Problem to solve

Current compaction settings like reserveTokensFloor and keepRecentTokens use absolute token values. This creates inconsistent behavior across models with different context windows.

Example: reserveTokensFloor: 20000 means:

  • 62% of a 32k context window (Claude 3 Opus)
  • 10% of a 200k context window (Claude 3.5 Sonnet)

Same config, wildly different behavior.

Proposed solution

Add support for percentage values in context-aware token settings:

{
  "agents": {
    "defaults": {
      "compaction": {
        "reserveTokensFloor": "10%",
        "keepRecentTokens": "15%"
      }
    }
  }
}

### Alternatives considered

Auto-scale the default floor as % of context window, even if user sets absolute number.

### Impact

Config becomes portable across models
Users think in relative terms ("leave 10% headroom") not absolute numbers
Reduces per-model config maintenance

### Evidence/examples

_No response_

### Additional information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.enhancementNew feature or requestimpact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    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