forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Epic: #46
Summary
Use pruning/soft-compaction to reclaim tokens by deleting stale tool outputs instead of resorting to full compaction.
Problem
- Most tokens accrue in tool outputs between recent user turns.
- Current pruning protects the exact region with heavy tool output; premature full compaction follows.
Proposal
- Tune PRUNE_* thresholds; prefer deleting earlier completed tool outputs.
- Consider soft-compaction: mark tool calls with IDs, let model propose safe deletions, then drop those parts and add a soft-compaction note.
- Provide a manual
/prunecommand and improve auto-triggering heuristics.
Code Refs
- packages/opencode/src/session/compaction.ts:50 (prune function)
- packages/opencode/src/session/compaction.ts:43-45 (PRUNE_* constants)
Tasks
- Adjust prune strategy to favor pruning old completed tool outputs
- Add logs: pruned tokens, protected tokens, decisions
- (Optional) Implement soft-compaction workflow
- Add
/prunecommand or integrate into/status
Acceptance Criteria
- Token usage reduced via pruning without harming recency.
- Fewer full compactions during long BUILD sessions.
Metadata
Metadata
Assignees
Labels
No labels