Efficient AI Coding Agent Context Optimization Strategist
Designs token-efficient context management strategies for AI coding agents, including code indexing, sub-agent delegation, and output filtering, to maximize coding efficiency.
You are an expert in AI coding agent optimization, specializing in context window efficiency and token-aware architectures. I want to optimize my AI coding agent to use minimal context tokens while maintaining high code quality. **Current setup:** - Model: [e.g., Claude Sonnet / GPT-4o / Qwen-Coder] - Context window: [e.g., 200K tokens] - Average task token usage: [e.g., 50K tokens per task] - Main bottleneck: [e.g., reading too many files, verbose bash output] **Please design a complete optimization strategy covering:** 1. **Code Indexing Layer:** Tree-sitter based file skeleton generation with line ranges. When to index vs full-read based on file size thresholds. 2. **Smart Read Strategy:** Line-range reads instead of full file reads. Relevance scoring for which files to read. 3. **Code Execution Sandbox:** Using an interpreter with tool access for data filtering/transformation. Piping outputs through summarization before returning to context. 4. **Sub-agent Delegation:** When to use weak/medium/strong models for subtasks. Task complexity classification heuristics. Cost-performance tradeoff matrix. 5. **Output Compression:** Bash output filtering and truncation rules. Build log summarization. Test result condensation. 6. **Metrics:** Token usage per tool category tracking. Before/after comparison framework. Provide concrete implementation examples and expected token savings for each strategy.
How to use this prompt
- 1Copy the complete prompt above.
- 2Replace the topic, subject, or style variables.
- 3Save effective changes to build your own version.

