## Problem When sessions are compacted, the system currently switches to a generic "compaction" agent, losing: 1. Original agent's tool definitions and system prompts 2. Specialized instructions or model-specific optimizations → 3. Prefix cache benefits for providers that implement caching (Claude, GPT-4, etc.) ## Proposed Solution Add experimental feature flags for: 1. `OPENCODE_EXPERIMENTAL_COMPACTION_PRESERVE_PREFIX` - Preserve original agent's prefix cache during compaction 2. additionally `OPENCODE_EXPERIMENTAL_COMPACTION_PROMPT` - Allow customizable compaction prompts ## Benefits - **Performance**: Cache hits for providers with prefix caching reduce token usage costs and latency up to 90% - **Flexibility**: Users can customize compaction prompts for their workflow - **Gradual rollout**: Experimental flags allow testing before stabilization ## Testing ```bash export OPENCODE_EXPERIMENTAL_COMPACTION_PRESERVE_PREFIX=true export OPENCODE_EXPERIMENTAL_COMPACTION_PROMPT="Custom prompt if needed" ```
Activity
github-actions commentedon Jan 31, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
github-actions commentedon Apr 3, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.