Intelligent thread session management for AI assistants - Reduce token usage by 40%+ through smart task decomposition
1. Start the VS Code Extension (Development Mode)
# Press F5 in VS Code to launch Extension Development Host
# OR run:
npm run watch2. Start the Web Interface
cd web
npm install
npm run dev
# Web UI will be available at http://localhost:51733. Start the Backend Server
cd server
npm install
npm run dev
# Server will run at http://localhost:3000# Install all dependencies
npm install
# Start extension in watch mode
npm run watch
# In separate terminals:
# Terminal 1 - Web UI
cd web && npm run dev
# Terminal 2 - Backend Server
cd server && npm run devThread Session Manager is a VS Code extension that intelligently breaks down large AI assistant tasks into isolated thread sessions, dramatically reducing token usage while maintaining context quality. With special integration for Bob/Cline and support for other AI assistants, it provides a seamless experience for managing complex development workflows.
- π§΅ Intelligent Thread Management - Automatic, manual, and AI-suggested thread creation
- π Real-time Token Tracking - Monitor usage with predictive alerts
- π― Minimal Context Isolation - Each thread maintains only essential context
- π³ Visual Thread Hierarchy - Tree and timeline views for easy navigation
- π Advanced Operations - Branch, merge, and compare threads
- π Analytics Dashboard - Track efficiency and token savings
- π€ Bob Integration - Seamless integration with Bob/Cline AI assistant
- π Extensible Architecture - Support for multiple AI assistants
π Thread Sessions
βββ π’ Main Implementation (Active) - 45.2K/50K tokens
β βββ π‘ Database Setup (Paused)
β βββ β
API Integration (Completed)
βββ β
Initial Planning (Completed)
Token Savings: 295K (41%)
Active Threads: 3
Efficiency Score: 8.5/10
- Open VS Code
- Press
Ctrl+P(orCmd+Pon Mac) - Type
ext install thread-session-manager - Press Enter
-
Create a Thread
Press Ctrl+Shift+T N Enter thread name Start working with your AI assistant -
Monitor Token Usage
Check status bar: [π§΅ Thread Name] [π 45.2K tokens] [β οΈ 90%] Extension alerts you when approaching limits -
Split When Needed
Accept AI suggestion or manually create new thread Minimal context automatically transferred Continue with fresh token budget -
View Analytics
Press Ctrl+Shift+T A Review token savings and efficiency metrics
- Extension Plan - Complete architectural overview and design decisions
- Technical Specification - Detailed API specs, algorithms, and data models
- Project Structure - File organization and development guidelines
- Implementation Roadmap - 9-week phased development plan
- Quick Reference - Commands, shortcuts, and troubleshooting
Isolated conversation contexts with independent token budgets. Each thread maintains minimal shared context (β€1000 tokens) while preserving essential decisions, artifacts, and dependencies.
Real-time monitoring of token usage with configurable thresholds:
- Warning: 80% (40K tokens)
- Critical: 90% (45K tokens)
- Limit: 100% (50K tokens)
Each thread receives only essential context:
- Key Decisions (40% of budget) - Critical architectural choices
- Artifacts (40% of budget) - Generated files and code
- Dependencies (20% of budget) - Required packages and services
Machine learning analyzes your conversation to:
- Detect optimal thread boundaries
- Estimate task complexity
- Extract logical subtasks
- Suggest thread names
| Feature | Description | Shortcut |
|---|---|---|
| Create Thread | Start new isolated thread | Ctrl+Shift+T N |
| Switch Thread | Change active thread | Ctrl+Shift+T S |
| Branch Thread | Create branch from current | Ctrl+Shift+T B |
| Merge Threads | Combine multiple threads | Ctrl+Shift+T M |
| Show Tree | Display thread hierarchy | Ctrl+Shift+T V |
| Show Timeline | View chronological history | - |
| Show Analytics | Open analytics dashboard | Ctrl+Shift+T A |
| Compare Threads | Side-by-side diff view | - |
- Real-time Counting - Accurate token counting using tiktoken
- Threshold Monitoring - Configurable alerts at 80%, 90%, 100%
- Predictive Analytics - Estimate future token usage
- Auto-split Suggestions - AI-driven boundary detection
- Automatic Extraction - Key decisions, artifacts, dependencies
- Smart Compression - Optimize summary size while preserving meaning
- Incremental Updates - Efficient context updates as conversation progresses
- Quality Metrics - Track context relevance and completeness
- Tree View - Hierarchical thread display with status indicators
- Timeline View - Chronological thread history with branch points
- Analytics Dashboard - Token usage, efficiency metrics, trends
- Diff Viewer - Compare thread states and contexts
- Bob/Cline - Native integration with automatic context injection
- Generic Adapter - Support for Continue, Copilot, and custom assistants
- Plugin System - Extensible adapter architecture
- API Hooks - Message interception and context passing
{
"threadSession.tokenThreshold": 50000,
"threadSession.autoSplitEnabled": true,
"threadSession.contextSummaryMaxTokens": 1000,
"threadSession.aiSuggestionsEnabled": true,
"threadSession.bobIntegration.enabled": true
}{
"threadSession.defaultIsolationLevel": "minimal",
"threadSession.autoBackupInterval": 300,
"threadSession.maxThreadDepth": 5,
"threadSession.analytics.trackUsage": true,
"threadSession.performance.lazyLoading": true
}See Configuration Guide for all available settings.
Thread Session Manager
βββ Core
β βββ ThreadSessionManager - Central orchestrator
β βββ ThreadSession - Individual thread model
β βββ ThreadHierarchy - Parent-child relationships
βββ Tracking
β βββ TokenCounter - Real-time token counting
β βββ ThresholdMonitor - Alert system
β βββ TokenPredictor - Usage prediction
βββ Context
β βββ ContextExtractor - Extract key information
β βββ SummaryGenerator - Generate summaries
β βββ ContextCompressor - Optimize size
βββ AI
β βββ TaskComplexityAnalyzer - Assess task size
β βββ ThreadBoundaryDetector - Suggest splits
β βββ SubtaskExtractor - Identify subtasks
βββ Storage
β βββ ThreadStorage - Persist data
β βββ SessionCache - In-memory cache
β βββ BackupManager - Automatic backups
βββ UI
β βββ ThreadTreeView - Hierarchical display
β βββ ThreadTimelineView - Chronological view
β βββ AnalyticsDashboard - Metrics display
β βββ ThreadDiffViewer - Comparison tool
βββ Integration
βββ BobAdapter - Bob-specific hooks
βββ GenericAIAdapter - Universal interface
See Architecture Documentation for detailed design.
| Operation | Target | Status |
|---|---|---|
| Extension Activation | <500ms | β³ Pending |
| Thread Switch | <100ms | β³ Pending |
| Token Count Update | <50ms | β³ Pending |
| Context Summary | <500ms | β³ Pending |
| UI Render | <200ms | β³ Pending |
- Supports 1000+ threads per workspace
- Handles threads with 100K+ tokens
- Efficient memory usage through lazy loading
- Background processing for heavy operations
- Node.js 18+
- VS Code 1.80+
- TypeScript 5.0+
# Clone repository
git clone https://github.com/yourusername/thread-session-manager.git
cd thread-session-manager
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch# Run all tests
npm test
# Run specific test suite
npm test -- --grep "ThreadSessionManager"
# Watch tests
npm run watch-tests- Open project in VS Code
- Press
F5to launch Extension Development Host - Set breakpoints in source code
- Test extension functionality
See Developer Guide for detailed instructions.
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use ESLint and Prettier
- Write tests for new features
- Document public APIs with JSDoc
- Keep functions small and focused
This project is licensed under the MIT License - see the LICENSE file for details.
- VS Code Extension API team
- tiktoken library maintainers
- Bob/Cline development team
- Open source community
- Email: soham4306@gmail.com
Current Version: 0.1.0 (Planning Phase)
Status: Ready for Implementation
Last Updated: 2026-05-02
Made with β€οΈ for the AI-assisted development community