Skip to content

feat(tui): Compact Mode Phase 3 - Intelligence Layer #9019

Closed

Description

@apto-as

Summary

Implement Phase 3 of Compact Mode: Intelligent, context-aware compression with analytics.

Background

Phase 1-2 provide manual/threshold-based compression. Phase 3 adds intelligence for optimal compression.

Phase 3 Scope (4 weeks)

Intelligence Features

Feature Description Benefit
Context-Aware Selection Auto-detect task type, adjust compression Optimal quality/efficiency
Agent-Specific Dictionaries TMWS agent shorthand (T:A = Task: Artemis) 15-25% additional
Differential Encoding Only transmit changes from known state Variable
Tokenizer-Aware Formatting Align text with token boundaries Minor optimization

Task-Specific Compression Rules

Task Type Compression Sensitivity Recommended Ratio
Summarization Low Up to 10x
Conversation Low-Medium 5x
Code Generation Medium-High 2x-3x
Mathematical Reasoning Medium 3x-5x
Multi-hop QA Very High ≤2x

Deliverables

  • Task type detection heuristics
  • Adaptive compression ratio selection
  • Agent-specific shorthand dictionary system
  • TMWS Memory integration for differential encoding
  • Compression analytics dashboard
  • ROI metrics (tokens saved, cost reduction)
  • A/B testing framework for quality validation

Analytics Dashboard

┌─────────────────────────────────────────┐
│ Compact Mode Analytics                  │
├─────────────────────────────────────────┤
│ Session Tokens:     12,450 → 4,150     │
│ Compression Ratio:  3.0x               │
│ Estimated Savings:  $0.25              │
│ Quality Score:      97.2%              │
└─────────────────────────────────────────┘

Technical Notes

  • LLM Understanding Impact: Adaptive (task-dependent)
  • Vendor Agnostic: ✅ All techniques universal
  • TMWS Integration: Uses Memory for dictionary/pattern storage

Files to Create/Modify

  • packages/opencode/src/session/compression-intelligence.ts
  • packages/opencode/src/session/task-detector.ts
  • packages/opencode/src/cli/cmd/tui/components/analytics.tsx
  • TMWS: Shorthand dictionary storage

Dependencies

Success Criteria

  • 75-90% token reduction achieved
  • Task detection accuracy >80%
  • Analytics dashboard functional
  • No quality regression on sensitive tasks

ROI Projections (100K tokens/day baseline)

Phase Reduction Monthly Savings
Phase 1 25-35% $13-19
Phase 2 60-75% $32-41
Phase 3 75-90% $41-49

Generated by Trinitas Full Mode Analysis

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    perfIndicates a performance issue or need for optimization
    on Jan 17, 2026
  2. rekram1-node commented on Jan 17, 2026

    @rekram1-node
    Collaborator

    closing - spam

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

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentuiperfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions