FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(compaction): configurable threshold and model (global + per-model) by tobiastornros · Pull Request #11931 · anomalyco/opencode · GitHub

feat(compaction): configurable threshold and model (global + per-model) - #11931

Closed
tobiastornros wants to merge 2 commits into
anomalyco:devfrom
tobiastornros:feature/compaction-threshold
Closed

feat(compaction): configurable threshold and model (global + per-model)#11931
tobiastornros wants to merge 2 commits into
anomalyco:devfrom
tobiastornros:feature/compaction-threshold

Conversation

tobiastornros commented Feb 3, 2026
edited
Loading

Copy link
Copy Markdown

Ever noticed how Opus gets kinda dumb around 50-60% context? Yeah, me too. Built this to escape the dumbzone.

Adds compaction settings at both global and per-model levels:

  • threshold (1-100) - trigger compaction earlier, before models go stupid
  • model - use a cheaper model for compaction (why waste Opus on summaries?)

Global config:

{
  "compaction": {
    "threshold": 80,
    "model": "anthropic/claude-haiku-5-20260205"
  }
}

Per-model config:

{
  "provider": {
    "anthropic": {
      "models": {
        "claude-opus-4-20250514": {
          "compaction_threshold": 50,
          "compaction_model": "zhipu/glm-4-plus"
        }
      }
    }
  }
}

Per-model overrides global. Default is 100 (current behavior).

Closes #11930
Relates to #11314, #8140, #10017, #8629

…model)

Add compaction settings at both global and per-model levels:
- threshold: trigger compaction at a percentage of context (1-100, default: 100)
- model: use a different model for compaction summaries

This allows users to:
- Trigger compaction earlier for models that degrade at lower context usage
- Use cheaper/faster models for compaction to save costs

Closes anomalyco#11930
Relates to anomalyco#11314, anomalyco#8140, anomalyco#10017, anomalyco#8629

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Related PRs Found

Potential duplicates/related work:

  1. feat(session): add custom compaction thresholds along with prevention of continuous compaction #10123 - feat(session): add custom compaction thresholds along with prevention of continuous compaction

    • Directly related: adds custom compaction thresholds (similar feature)
  2. feat(opencode): add context overflow prevention with configurable thresholds #8810 - feat(opencode): add context overflow prevention with configurable thresholds

    • Overlaps on configurable thresholds for context management
  3. feat(opencode): trigger compaction earlier and add multi-file read #9656 - feat(opencode): trigger compaction earlier and add multi-file read

  4. fix(opencode): accumulate step tokens for compaction #10215 - fix(opencode): accumulate step tokens for compaction

    • Related: compaction token handling
  5. fix(opencode): prevent context overflow during compaction #11453 - fix(opencode): prevent context overflow during compaction

    • Related: context management during compaction

These PRs suggest there's been ongoing work on compaction and context threshold features. PR #10123 appears most similar, implementing custom compaction thresholds. You may want to check if #11931 supersedes or builds upon any of these, particularly #10123.

tobiastornros commented Feb 3, 2026
edited
Loading

Copy link
Copy Markdown
Author

Future idea: we could add compaction_max_tokens on model level too, an absolute token cap regardless of percentage. Useful for cost control or latency-sensitive setups. Kept it simple for now, can extend later.

github-actions Bot commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

github-actions Bot closed this Apr 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Configurable compaction threshold and model (global + per-model)

1 participant


Back | FazBrowse Home | New Git URL