Plan Command - Execute with Approval
Plans and executes complex tasks with context-aware analysis and multi-agent validation
/plugin marketplace add jleechanorg/claude-commands/plugin install claude-commands@claude-commands-marketplaceWhen this command is invoked, YOU (Claude) must execute these steps immediately: This is NOT documentation - these are COMMANDS to execute right now. Use TodoWrite to track progress through multi-phase workflows.
Action Steps: 🔍 Context Assessment: Every planning session MUST begin with context assessment:
### Phase 1: Strategic Analysis
**Action Steps:**
**Memory Integration**: Automatically consults Memory MCP for relevant patterns, corrections, and user preferences.
**Guidelines Consultation**: Calls `/guidelines` for systematic mistake prevention and protocol compliance.
**Tool Selection Hierarchy** (Context-Optimized):
1. **Serena MCP** - Semantic analysis for efficient context usage
2. **Targeted Reads** - Limited file reads based on context capacity
3. **Focused Implementation** - Claude direct or /cerebras based on task size
4. **Context Preservation** - Reserve capacity for execution and validation
### Phase 2: Execution Plan Presentation
**Action Steps:**
**📋 CONTEXT-ADAPTIVE PLAN FORMAT**:
**🧠 Context Status**: _____% remaining → **[High/Medium/Low]** complexity planning
**🎯 Universal Composition Strategy**:
1. **Primary Command**: `/plan` (this command)
2. **Composed Commands**: List of commands that will be naturally integrated
3. **Tool Selection**: Context-aware hierarchy (Serena MCP → Read → /cerebras/Claude → Bash)
**⚡ Implementation Approach**:
4. **Analysis Tasks**: Minimal context consumption using Serena MCP
5. **Generation Tasks**: /cerebras for >10 delta lines, Claude for ≤10 lines (per CLAUDE.md)
6. **Integration Tasks**: Efficient tool selection based on remaining context
7. **Validation**: Context-appropriate testing depth
**🔀 Execution Method Decision** (Context-Optimized):
8. **Parallel Tasks** (0 additional tokens): For simple, independent operations <30 seconds
9. Method: Background processes (&), GNU parallel, xargs, or batched tool calls
10. Best for: File searches, test runs, lint operations, data aggregation
11. **Sequential Tasks**: For complex workflows requiring coordination >5 minutes
12. Method: Step-by-step with context monitoring
13. Best for: Feature implementation, architectural changes, complex integrations
14. **Reference**: See [parallel-vs-subagents.md](./parallel-vs-subagents.md) for full decision criteria
**🚀 Execution Sequence** (Context-Optimized):
15. **Quick Discovery**: Use Serena MCP for targeted analysis
16. **Smart Generation**: /cerebras for large tasks, Claude for integration
17. **Efficient Validation**: Context-appropriate testing and verification
18. **Clean Integration**: Minimal overhead for final steps
**Timeline**: _____ minutes (context-optimized approach)
### Phase 3: Approval Requirement
**Action Steps:**
**❌ NEVER proceed without explicit user approval**
User must respond with "APPROVED" or specific modifications before execution begins.
### Phase 4: Execute Protocol
**Action Steps:**
**After approval, implements the plan directly with context awareness**:
1. Monitor context usage throughout execution
2. Apply context-saving strategies when needed
3. Use universal composition with other commands naturally
4. Preserve context for testing and validation
### Phase 5: Consensus Validation
**Action Steps:**
**🎯 Multi-Agent Quality Assurance**
After Phase 4 execution, automatically run `/consensus` command to validate code quality and deployment readiness.
**Implementation**: See [consensus.md](./consensus.md) for complete consensus validation workflow including:
1. 3-round multi-agent validation loop
2. Automated test execution per round
3. Context-aware test selection
4. Early termination triggers
5. Evidence-based decision making
**Integration**: Phase 5 executes the full `/consensus` workflow with the implemented changes as input, providing comprehensive quality assurance before completion.
## 📋 REFERENCE DOCUMENTATION
# Plan Command - Execute with Approval
**Purpose**: Context-aware planning that requires user approval before implementation. **CONTEXT-AWARE PLANNING** with intelligent tool selection and universal composition.
**Usage**: `/plan` - Present context-aware execution plan with approval workflow
## 🧠 CONTEXT-AWARE PLANNING PROTOCOL
# Check remaining context capacity to inform planning approach
/context
Context-Informed Planning Strategy:
Command Integration: /plan naturally composes with:
/think - Strategic analysis and problem solving/guidelines - Mistake prevention and protocol compliance/context - Continuous context monitoring/cerebras - High-speed code generation for appropriate tasks/consensus - Multi-agent validation and quality assurance (Phase 5)Adaptive Workflow: The planning process adapts based on:
Context-Efficient Tools (Prioritized):
High-Performance Generation (When Appropriate):
Context Preservation:
Context-Aware /plan Flow:
User: /plan implement user authentication
Assistant:
Phase 0 - Context Assessment:
/context → 45% remaining → Medium Context Strategy
Phase 1 - Strategic Analysis:
[Memory consultation for auth patterns]
[Guidelines check for security requirements]
[Serena MCP discovery for efficient analysis]
Phase 2 - Execution Plan:
Context Status: 45% remaining → Medium complexity planning
- Analysis: Use Serena MCP for efficient codebase understanding
- Generation: /cerebras for new auth classes, Claude for integration
- Context preservation: Strategic tool selection
Seeking approval to proceed...
User: APPROVED
Assistant: [Executes context-optimized implementation]