[FEATURE] Implement HOT/WARM/COLD File Tiering System for 94.5% Token Cost Reduction
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Every time Claude Code reads a codebase, users pay for all tokens loaded into context - regardless of relevance. Most projects contain:
- READMEs, changelogs, archived docs (rarely needed)
- Core patterns, config files (sometimes needed)
- Active task files (always needed)
Claude Code currently charges the same for all files, leading to inflated token costs and slower response times. Users are essentially paying for Claude to read outdated documentation and archived content on every session.
Real-world impact: A typical mid-size project with ~66,834 tokens loads ALL of this content into every session, even when only ~3,647 tokens (5.5%) are actively relevant to the current task.
Proposed Solution
Implement a HOT/WARM/COLD file tiering system inspired by cortex-tms (https://github.com/cortex-tms/cortex-tms):
HOT Tier: Active tasks, current work (~3,647 tokens)
- Always loaded into context
- Files with
<!-- @cortex-tier HOT -->marker or in active sprint folders
WARM Tier: Patterns, glossary, recent docs (~10,419 tokens)
- Loaded when referenced or via explicit flag:
claude --include-warm
COLD Tier: Archives, old sprints, changelogs (~52,768 tokens)
- Almost never loaded unless explicitly requested:
claude --include-cold
Implementation Details:
- Add tier markers to documentation files (comment-based, non-intrusive)
- Provide
claude status --tokenscommand to show token breakdown by tier - Default behavior: Load only HOT files
- Smart detection: Automatically promote files to WARM when frequently accessed
- Configuration file (
.claude-tiering.yml) for custom tier rules
Real Results from cortex-tms dogfooding:
- Without tiering: 66,834 tokens/session
- With tiering: 3,647 tokens/session
- 94.5% reduction in token costs
- Faster responses (less context processing)
- Better focus (Claude sees current docs, not 6-month-old archives)
Cost Savings:
- Claude Sonnet 4.5: $0.01/session (was $0.11)
- GPT-4: $0.11/session (was $1.20)
This would give Claude Code users direct control over token costs while maintaining full access to their entire codebase when needed.
Alternative Solutions
Current workarounds being used:
- Manually organizing files into separate directories and using selective
@filereferences (tedious, error-prone) - Creating separate
.claudeignorefiles for different contexts (requires switching configs) - Splitting large projects into multiple repositories (not always feasible)
Other tools addressing this:
- cortex-tms (open source, MIT license): Already implements this exact system with proven 94.5% cost reduction
- Manual token management via custom scripts (fragile, requires maintenance)
Why these don't fully solve it:
- cortex-tms is a separate tool - native Claude Code integration would provide seamless UX
- Manual approaches require constant vigilance and don't scale
Priority
High - Significant impact on productivity
Feature Category
Performance and speed
Use Case Example
Scenario: A developer working on a large SaaS application with extensive documentation
Current Workflow (without tiering):
- Open Claude Code:
claude - Claude loads entire project: 66,834 tokens
- Ask: "Update the user authentication flow to support OAuth"
- Wait while Claude processes 66K tokens (including 5-year-old changelogs, archived sprint docs)
- Cost: $0.11 per session
- Time: Slower responses due to large context
With File Tiering:
- Developer tags files during setup:
docs/sprints/CURRENT.md→ HOTsrc/auth/README.md→ HOTdocs/patterns/oauth-guide.md→ WARMCHANGELOG-2020.md→ COLD
- Open Claude Code:
claude - Claude loads only HOT files: 3,647 tokens
- Ask: "Update the user authentication flow to support OAuth"
- Claude references WARM tier when needed (oauth-guide.md)
- Cost: $0.01 per session (10x cheaper)
- Time: Faster responses, focused context
When WARM/COLD needed:
- "Check what changed in version 2.0" →
claude --include-cold - "Review our OAuth implementation patterns" → Automatically loads WARM tier
Result: 94.5% cost reduction, faster responses, better focus
Additional Context
Reference Implementation: cortex-tms has already proven this concept works with 1,000+ NPM downloads and real-world usage. See their case study: https://cortex-tms.org/blog/cortex-dogfooding-case-study/
Community Interest: Based on Reddit discussions (r/ClaudeAI), many developers are actively seeking ways to reduce Claude API costs. This feature directly addresses a major pain point.
Implementation Considerations:
- Backward compatible: Works with existing projects without requiring changes
- Opt-in: Developers can choose to use tiering or continue with current behavior
- Non-intrusive markers: Comment-based tags don't affect code execution
- Cross-platform: Works with CLI, VS Code extension, and web interface
Benefits Beyond Cost:
- Lower carbon footprint: Less GPU compute = reduced environmental impact
- Better quality: Claude focuses on relevant, current documentation
- Scalability: Enables larger projects to use Claude Code without prohibitive costs
- Educational: Helps developers understand token usage patterns
MIT License: cortex-tms is open source and could serve as reference or even be integrated directly.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗