Skip to content

Conversation

@processtrader
Copy link
Contributor

Summary

This PR implements Smart Pruning, a new context management system that replaces the basic FIFO approach with a tiered priority system to preserve critical information longer.

Key Changes

  • Tiered Pruning: Tools are now classified into 3 tiers with separate token budgets:
    • Content (60k tokens): High value (read, webfetch) - Summarized when pruned
    • Navigation (15k tokens): Ephemeral (ls, grep) - Compressed when pruned
    • Action (Protected): Important (edit, write) - Never pruned
  • LLM Summarization: Instead of deleting content entirely, pruned content is now replaced with concise (<100 token) LLM-generated summaries.
    • Uses the user's configured model or falls back to the provider's default "small model".
  • Tool Compression: Navigation tools now gracefully degrade (e.g., grep keeps first 5 matches, bash keeps exit code + last 10 lines).
  • Configuration: Added full configuration support in opencode.json for budgets, custom tool classification, and summarization settings.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

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

Based on my search results, I found one potentially related PR:

Related PR Found:

PR #7049: "fix: clear tool output and attachments when pruning to prevent memory leak"
#7049

Why it's related: This PR deals with pruning mechanism and memory management, which is closely related to the context management improvements in PR #7215. While PR #7049 appears to be a bug fix for clearing outputs during pruning, your new smart pruning system likely supersedes or enhances this approach with the tiered priority system and LLM summarization.

The other results (PR #5422 on cache configuration and #1407 on autocompaction) are tangentially related to context optimization but don't appear to be direct duplicates of the smart pruning feature.

@processtrader processtrader force-pushed the feature/smart-pruning-with-summarization branch 2 times, most recently from d939ec8 to f0df7bb Compare January 7, 2026 15:09
@processtrader processtrader force-pushed the feature/smart-pruning-with-summarization branch from f0df7bb to 1b7f011 Compare January 8, 2026 21:19
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant