Loading Process Overview
Context loading provides relevant memories when Claude Code starts:Core Components
Memory Index Structure
Memories stored in JSONL format for efficient processing:Memory Entry Schema
Example Memory Entries
Technical Insight Memory
Technical Insight Memory
Project Overview Memory
Project Overview Memory
Decision Record Memory
Decision Record Memory
Project-Based Filtering
Project Identification
Cross-Project Knowledge
Some memories are intentionally shared across projects:Global Patterns (project=null)
Global Patterns (project=null)
Shared Knowledge:
- General programming patterns
- Tool usage insights
- Best practices
- Debug techniques
Cross-Project References
Cross-Project References
Related Project Insights:
- Similar architectural decisions
- Reusable component patterns
- Shared utility functions
- Common problem solutions
Memory Ranking Algorithm
Ranking Factors
The context loading system uses multiple factors to rank memory relevance:1
Temporal Relevance (40% weight)
Recent memories rank higher:
- Last 24 hours: Score 0.8-1.0
- Last week: Score 0.6-0.8
- Last month: Score 0.3-0.6
- Older: Score < 0.3
2
Project Match Score (30% weight)
Project alignment scoring:
3
Memory Type Priority (20% weight)
Content type weighting:
- Overview memories: Score 1.0 (always high priority)
- Decision records: Score 0.9 (architectural context)
- Implementation insights: Score 0.8 (technical details)
- General memories: Score 0.7 (standard insights)
- Session metadata: Score 0.3 (background context)
4
Quality Indicators (10% weight)
Content quality scoring:
- Memory length (optimal 50-200 characters)
- Keyword richness
- Explicit confidence scores
- User engagement (manually saved vs auto-generated)
Final Ranking Formula
Context Formatting
Session Start Format
When Claude Code starts, memories are formatted for optimal Claude understanding:Context Injection Strategy
Progressive Context Loading
Progressive Context Loading
Adaptive Memory Count:
Memory Sectioning
Memory Sectioning
Organized by Type:
- Overview: Project description and architecture
- Recent Insights: Latest technical discoveries
- Decisions: Architectural and technical choices
- Patterns: Reusable code and design patterns
- Context: Session and workflow information
Smart Truncation
Smart Truncation
Length Management:
Loading Performance
Optimization Strategies
Performance Monitoring
Troubleshooting Context Loading
Common Issues
No Memories Loading
No Memories Loading
Diagnosis:Solutions:
- Verify memory index exists and has content
- Check project name matches directory name
- Ensure proper memory format in index
Irrelevant Memories Loading
Irrelevant Memories Loading
Diagnosis:Solutions:
- Use consistent project directory names
- Review and clean up old memories
- Adjust memory type priorities
Slow Context Loading
Slow Context Loading
Diagnosis:Solutions:
- Reduce memory count limit
- Clean up old memories
- Optimize index structure
Configuration Options
Advanced Context Loading
Custom Memory Queries
For advanced use cases, you can directly query the memory system:Integration with Development Workflow
The context loading system is designed to provide Claude with the most relevant and useful information from your previous sessions, ensuring continuity and building on past insights for more productive development sessions.