Rules for optimizing context window usage across DeepSeek models including chunking strategies, summarization, and conversation management.
## DeepSeek Context Window Management
### Model Context Limits
- DeepSeek V3: 128K tokens context window
- DeepSeek R1: 128K tokens input, but optimal performance at <32K
- Claude Coder V2: 128K tokens
- Rule of thumb: performance degrades in the middle of long contexts ("lost in the middle" effect)
### Chunking Strategy
For documents exceeding comfortable context:
1. Split into semantic chunks (by section/paragraph, not by token count)
2. Maintain overlap between chunks (10-15% overlap)
3. Process each chunk independently
4. Aggregate results with a final summarization pass
### Conversation Management
- Track token count per conversation turn
- When approaching 80% of context limit, summarize earlier messages
- Keep system prompt + last 3-5 turns in full fidelity
- Archive older turns as compressed summaries
- Alert users when context is being truncated
### Priority Ordering
Place information in this order (most important first):
1. System instructions (if using V3)
2. Critical context (schemas, constraints, rules)
3. Current task description
4. Supporting examples or data
5. Conversation history (most recent first)
### Optimization Techniques
- Remove redundant whitespace and formatting in prompts
- Use abbreviations for repeated terms (define once, abbreviate after)
- Send structured data as compact JSON rather than prose
- For code: send only relevant functions, not entire files
- Use references: "Apply the same pattern as described above" instead of repeating
### Anti-Patterns
- Do not stuff the entire codebase into context
- Do not repeat instructions in every message
- Do not include irrelevant conversation history
- Do not use verbose XML tags when simpler markdown worksSystem rules for designing inter-service communication in microservices architectures with DeepSeek Coder, covering sync/async patterns, error handling, and resilience.
System rules for generating content in multiple languages with DeepSeek V3, covering translation quality, cultural adaptation, locale-specific formatting, and quality assurance.
System rules for safe code refactoring with DeepSeek R1, requiring test coverage verification, incremental changes, and behavior preservation checks.
System rules for using DeepSeek V3 to generate clear, maintainable technical documentation including API docs, architecture docs, and onboarding guides.
System rules for DeepSeek Coder to generate optimized database queries, with requirements for EXPLAIN analysis, indexing recommendations, and performance targets.
System rules for using DeepSeek V3 to generate infrastructure code, CI/CD pipelines, and operational runbooks with security and reliability best practices.
Workflows from the Neura Market marketplace related to this DeepSeek resource