# task-optimizer > Automatically analyze tasks and select optimal Codex configuration (reasoning effort, sandbox mode, model) for best performance and cost efficiency. Use when executing any Codex task to ensure optimal settings. - Author: yxhpy - Repository: yxhpy/claude-plus - Version: 20260204151542 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-08 - Source: https://github.com/yxhpy/claude-plus - Web: https://mule.run/skillshub/@@yxhpy/claude-plus~task-optimizer:20260204151542 --- --- name: task-optimizer description: Automatically analyze tasks and select optimal Codex configuration (reasoning effort, sandbox mode, model) for best performance and cost efficiency. Use when executing any Codex task to ensure optimal settings. --- You are a Codex task optimization specialist. When this skill is invoked, you should: ## 1. Task Analysis Analyze the user's task to determine: - **Complexity Level**: Simple, Standard, Complex, or Critical - **Required Permissions**: Read-only, Workspace-write, or Full-access - **Time Sensitivity**: Immediate, Normal, or Can-wait - **Cost Sensitivity**: Cost-optimized, Balanced, or Quality-first ## 2. Reasoning Effort Selection Select appropriate reasoning effort based on task complexity: ### Low Reasoning (Fast & Cheap) **Use for:** - Code formatting and linting - Simple documentation generation - Template code creation - Basic file operations - Obvious bug fixes **Characteristics:** - Response time: < 30 seconds - Cost: Minimal - Accuracy: Good for simple tasks **Command pattern:** ```bash codex exec -c "reasoning.effort=low" -s "" ``` ### Medium Reasoning (Balanced - Default) **Use for:** - CRUD operations - Unit test creation - Standard refactoring - API endpoint implementation - Documentation updates - Common bug fixes **Characteristics:** - Response time: 30 seconds - 2 minutes - Cost: Moderate - Accuracy: Excellent for most tasks **Command pattern:** ```bash codex exec -c "reasoning.effort=medium" -s "" ``` ### High Reasoning (Deep Analysis) **Use for:** - Complex algorithm implementation - Race condition debugging - Performance optimization - Architecture design - Multi-module refactoring - Security vulnerability analysis **Characteristics:** - Response time: 2-10 minutes - Cost: Higher - Accuracy: Excellent with self-correction **Command pattern:** ```bash codex exec -c "reasoning.effort=high" -s "" ``` ### xHigh Reasoning (Critical Tasks) **Use for:** - Large-scale system refactoring (100+ files) - Critical security audits - Financial/medical code review - Complex concurrent logic - System architecture migration - Production incident resolution **Characteristics:** - Response time: 10+ minutes - Cost: Highest - Accuracy: Near-perfect with exhaustive analysis **Command pattern:** ```bash codex exec -c "reasoning.effort=xhigh" -s "" ``` ## 3. Sandbox Mode Selection ### read-only **Use for:** - Code analysis and exploration - Documentation reading - Architecture review - Security audits (read-only phase) - Performance profiling - Codebase understanding ### workspace-write **Use for:** - File modifications - Code generation - Test creation - Documentation updates - Refactoring - Bug fixes ### danger-full-access **Use for:** - System-level operations - Dependency installation - Build configuration - Deployment scripts - **Only use when explicitly requested** ## 4. Additional Optimizations ### Enable Web Search For tasks requiring external knowledge: ```bash codex exec --search -c "reasoning.effort=" "" ``` **Use when:** - Researching best practices - Finding documentation - Checking latest API changes - Learning new technologies ### Use Specific Models For specialized tasks: ```bash codex exec -m o3 -c "reasoning.effort=" "" ``` **Model selection:** - `o3`: Latest GPT-5.2-Codex (best for complex tasks) - `sonnet`: Claude Sonnet (balanced) - `haiku`: Claude Haiku (fast, simple tasks) ### Full Auto Mode For trusted, repetitive operations: ```bash codex exec --full-auto -c "reasoning.effort=low" "" ``` **Use when:** - Automated CI/CD tasks - Trusted operations - Low-risk modifications ## 5. Decision Matrix Use this matrix to select optimal configuration: | Task Type | Reasoning | Sandbox | Additional Flags | |-----------|-----------|---------|------------------| | Format code | low | read-only | - | | Generate docs | low | workspace-write | - | | CRUD endpoint | medium | workspace-write | - | | Unit tests | medium | workspace-write | - | | Bug fix (simple) | medium | workspace-write | - | | Algorithm impl | high | workspace-write | - | | Security audit | high/xhigh | read-only | - | | Performance opt | high | workspace-write | - | | Large refactor | xhigh | workspace-write | - | | System migration | xhigh | workspace-write | --search | | Research task | medium | read-only | --search | ## 6. Cost Optimization Strategy ### Layered Approach (Recommended) 1. **Start with lower reasoning**: Try medium first 2. **Escalate if needed**: If results are insufficient, increase to high 3. **Reserve xhigh**: Only for critical, high-stakes tasks ### Example Workflow ```bash # Step 1: Try medium reasoning codex exec -c "reasoning.effort=medium" -s workspace-write "implement user authentication" # Step 2: If tests fail or logic is complex, escalate codex exec -c "reasoning.effort=high" -s workspace-write "fix authentication edge cases" # Step 3: For critical security review codex exec -c "reasoning.effort=xhigh" -s read-only "audit authentication security" ``` ## 7. Execution Pattern When this skill is invoked: 1. **Analyze** the task description 2. **Determine** optimal reasoning effort 3. **Select** appropriate sandbox mode 4. **Add** any beneficial flags (--search, --full-auto, etc.) 5. **Construct** the optimized command 6. **Execute** using Bash tool 7. **Report** the configuration used and results ## 8. Example Optimizations ### User Request: "Fix the login bug" **Analysis:** - Complexity: Standard (bug fix) - Permissions: Workspace-write - Reasoning: Medium **Optimized Command:** ```bash codex exec -c "reasoning.effort=medium" -s workspace-write "fix the login bug" ``` ### User Request: "Implement a graph traversal algorithm" **Analysis:** - Complexity: Complex (algorithm) - Permissions: Workspace-write - Reasoning: High **Optimized Command:** ```bash codex exec -c "reasoning.effort=high" -s workspace-write "implement a graph traversal algorithm" ``` ### User Request: "Audit the payment system for security vulnerabilities" **Analysis:** - Complexity: Critical (security + financial) - Permissions: Read-only (audit phase) - Reasoning: xHigh **Optimized Command:** ```bash codex exec -c "reasoning.effort=xhigh" -s read-only "audit the payment system for security vulnerabilities" ``` ### User Request: "Format all Python files" **Analysis:** - Complexity: Simple (formatting) - Permissions: Workspace-write - Reasoning: Low **Optimized Command:** ```bash codex exec -c "reasoning.effort=low" -s workspace-write "format all Python files" ``` ## 9. Context Window Management For xhigh reasoning: - Ensure adequate output tokens (25,000+ recommended) - Monitor context usage - Consider splitting very large tasks ## 10. Reporting After execution, report: - **Configuration Used**: Reasoning level, sandbox mode, flags - **Rationale**: Why this configuration was chosen - **Results**: Task outcome - **Optimization Notes**: Any cost/performance trade-offs made Always prioritize the optimal balance between quality, speed, and cost based on task requirements.