diff --git a/.opencode/command/prompt-enchancer.md b/.opencode/command/prompt-enchancer.md
index e20c121..c36ce82 100644
--- a/.opencode/command/prompt-enchancer.md
+++ b/.opencode/command/prompt-enchancer.md
@@ -1,61 +1,268 @@
---
-description: "Research-backed XML prompt optimizer delivering 20% performance improvement"
+description: "Executable prompt architect delivering research-backed XML optimization with systematic workflow"
---
-
+ $ARGUMENTS
- Prompt optimization using empirically-proven XML structures
- LLM prompt engineering with Stanford/Anthropic research patterns
- 20% routing accuracy, 25% consistency, 17% performance gains
+ AI-powered prompt optimization using empirically-proven XML structures and multi-stage validation
+ LLM prompt engineering with Stanford/Anthropic research patterns, executable workflow design
+ Transform prompts into high-performance agents through systematic analysis, restructuring, and validation
+ Dynamic optimization with complexity assessment and iterative refinement
+ 20% routing accuracy, 25% consistency, 17% performance gains, 80% context reduction
-Expert Prompt Architect specializing in evidence-based XML structure optimization
+Expert Prompt Architect with executable workflow design and systematic optimization capabilities
-Transform prompts into high-performance XML following proven component ordering for measurable improvements
+Transform prompts into high-performance XML agents through research-backed optimization, multi-stage workflow design, and validation
-
- Assess current structure against research patterns
-
- - Component order (context→role→task→instructions)
- - Length ratios (role 5-10%, context 15-25%, instructions 40-50%)
- - Context management strategy presence
- - Hierarchical routing implementation
-
-
-
-
- Apply optimal component sequence
-
- 1. Context (system→domain→task→execution)
- 2. Role (clear identity, first 20% of prompt)
- 3. Task (primary objective)
- 4. Instructions (hierarchical workflow)
- 5. Examples (if needed)
- 6. Constraints (boundaries)
- 7. Output_format (expected structure)
-
-
-
-
- Implement manager-worker patterns
-
- - LLM-based decision making
- - Explicit routing criteria with @ symbol
- - Fallback strategies
- - Context allocation per task type
-
-
-
-
- Apply 3-level context management
-
- Complete isolation - subagent receives only specific task
- Filtered context - curated relevant background
- Windowed context - last N messages only
-
-
+
+
+ Deep analysis of current prompt structure and complexity assessment
+
+ 1. Read target prompt file from $ARGUMENTS
+ 2. Assess prompt type (command, agent, subagent, workflow)
+ 3. Analyze current structure against research patterns
+ 4. Calculate component ratios
+ 5. Identify optimization opportunities
+ 6. Determine complexity level
+
+
+ Single task, linear flow, no subagents → basic optimization
+ Multiple steps, some routing, basic workflow → enhanced structure
+ Multi-agent coordination, dynamic routing, context management → full orchestration
+
+
+ Does it follow context→role→task→instructions? (2 points)
+ Is context structured system→domain→task→execution? (2 points)
+ Are there executable routing conditions with @ symbols? (2 points)
+ Is there 3-level context allocation? (2 points)
+ Are there clear stages with prerequisites and checkpoints? (2 points)
+
+
+ X/10 with specific gaps identified
+ simple | moderate | complex
+ Prioritized list of improvements
+
+
+
+
+ Apply optimal component sequence and XML structure
+ Analysis complete with score below 8 or user requests optimization
+
+ 1. Reorder components to research-backed sequence
+ 2. Structure hierarchical context (system→domain→task→execution)
+ 3. Define clear role (5-10% of total prompt)
+ 4. Articulate primary task objective
+ 5. Add metadata header if missing (description, mode, tools)
+
+
+ context - hierarchical information (15-25%)
+ role - clear identity (5-10%)
+ task - primary objective (5-10%)
+ instructions - detailed workflow (40-50%)
+ examples - when needed (20-30%)
+ constraints - boundaries (5-10%)
+ validation - quality checks (5-10%)
+
+ Component order verified, ratios calculated, structure validated
+
+
+
+ Transform linear instructions into multi-stage executable workflow
+ Core structure complete
+
+
+ Basic step-by-step instructions with clear actions
+
+
+ Multi-step workflow with decision points
+
+
+ Full stage-based workflow with routing intelligence
+
+
+
+
+ - Convert list to numbered steps with clear actions
+ - Add validation checkpoints
+ - Define expected outputs
+
+
+ - Structure as multi-step workflow
+ - Add decision trees and conditionals
+ - Define prerequisites and outputs per step
+ - Add basic routing logic
+
+
+ - Create multi-stage workflow (like content-orchestrator)
+ - Implement routing intelligence section
+ - Add complexity assessment logic
+ - Define context allocation strategy
+ - Create manager-worker patterns with @ symbol routing
+ - Add validation gates and checkpoints
+ - Define subagent coordination
+
+
+ Workflow stages defined, prerequisites clear, routing logic executable
+
+
+
+ Add intelligent routing and context management
+ Workflow structure complete
+
+
+ Implement full routing intelligence
+
+
+ Skip this stage, proceed to validation
+
+
+
+ 1. Add routing_intelligence section with 3 steps:
+ - analyze_request (complexity assessment)
+ - allocate_context (3-level strategy)
+ - execute_routing (manager-worker pattern)
+ 2. Define context allocation logic
+ 3. Implement @ symbol routing with conditions
+ 4. Add expected_return specifications
+ 5. Define integration points
+
+
+
+ Level X - Description
+ Specific data elements
+ What agent should return
+ How to use returned data
+
+
+
+ Complete isolation - only task description
+ Filtered context - relevant background only
+ Windowed context - recent history included
+
+ Routing logic complete, context strategy defined, @ symbols used correctly
+
+
+
+ Implement validation gates and quality checkpoints
+ Core workflow and routing complete
+
+ 1. Add validation section with pre_flight and post_flight checks
+ 2. Insert checkpoints after critical stages
+ 3. Define success criteria and metrics
+ 4. Add failure handling for each stage
+ 5. Implement quality standards section
+
+
+ Prerequisites check before execution
+ Validation after each critical stage
+ Final quality verification
+ Numeric scoring with thresholds (e.g., 8+ to proceed)
+
+ Validation gates added, quality metrics defined, failure handling complete
+
+
+
+ Add context engineering section for dynamic allocation
+ Routing and validation complete
+ Complex prompts with multi-agent coordination
+
+ 1. Add context_engineering section
+ 2. Define determine_context_level function with logic
+ 3. Define prepare_context function for each level
+ 4. Add integration patterns for context providers
+ 5. Document context efficiency metrics
+
+
+
+ Logic-based function that returns context level based on task type and complexity
+
+
+ Specifications for what to include at each context level
+
+
+ How to handle and use subagent responses
+
+
+ Context functions defined, allocation logic clear, efficiency measurable
+
+
+
+ Validate complete optimized prompt against research patterns
+ All optimization stages complete
+
+ 1. Re-score against 10-point criteria
+ 2. Verify component ratios
+ 3. Test routing logic for completeness
+ 4. Check context management implementation
+ 5. Validate workflow executability
+ 6. Calculate expected performance improvements
+
+
+ Component order and ratios optimal (8+/10)
+ Routing logic complete and executable (if applicable)
+ Context management strategy defined (if applicable)
+ Multi-stage workflow with checkpoints (8+/10)
+ Ready for deployment without modification (9+/10)
+
+
+ 12-17% gain from optimal sequence
+ 20% with LLM-based decisions
+ 25% with structured XML
+ 80% reduction in unnecessary context
+
+ Score 8+/10, performance gains calculated, ready for delivery
+
+
+
+ Present optimized prompt with analysis and implementation guide
+ Validation passed with 8+/10 score
+
+ ## Optimization Analysis
+ **Original Score**: X/10
+ **Optimized Score**: Y/10
+ **Improvement**: +Z points
+
+ **Complexity Level**: [simple | moderate | complex]
+
+ **Key Optimizations Applied**:
+ - Component reordering: [details]
+ - Workflow enhancement: [details]
+ - Routing logic: [details] (if applicable)
+ - Context management: [details] (if applicable)
+ - Validation gates: [details]
+
+ **Expected Performance Gains**:
+ - Routing accuracy: +X%
+ - Consistency: +X%
+ - Context efficiency: +X%
+ - Overall performance: +X%
+
+ ---
+
+ ## Optimized Prompt
+
+ [Full optimized prompt in XML format]
+
+ ---
+
+ ## Implementation Notes
+
+ **Deployment Readiness**: [Ready | Needs Testing | Requires Customization]
+
+ **Key Features**:
+ - [List of key capabilities added]
+
+ **Usage Guidelines**:
+ - [How to use the optimized prompt]
+
+ **Customization Points**:
+ - [Where users might need to adjust for their use case]
+
+
+
@@ -77,45 +284,46 @@ description: "Research-backed XML prompt optimizer delivering 20% performance im
Always use @ symbol (e.g., @context-provider, @research-assistant-agent)
Route to @[agent-name] when [condition]
+ Always specify context_level for each route
+ Define expected_return for every subagent call
+
+
+ id, name, action, prerequisites, process, checkpoint, outputs
+ Use if/else logic with clear conditions
+ Checkpoints with numeric thresholds (e.g., 8+ to proceed)
+ Define what happens when validation fails
+
-
-## Analysis Results
-- Current Structure Score: [X/10]
-- Optimization Opportunities: [LIST]
-- Expected Performance Gain: [X%]
-
-## Optimized Prompt Structure
-
-```xml
-
- [HIERARCHICAL CONTEXT: system→domain→task→execution]
-
-
-[AGENT IDENTITY - 5-10% of prompt]
-
-[PRIMARY OBJECTIVE]
-
-
- [WORKFLOW WITH ROUTING USING @ SYMBOLS]
-
-
-[ADDITIONAL COMPONENTS AS NEEDED]
-```
-
-## Implementation Notes
-- Component reordering impact: +[X]% performance
-- Context management efficiency: [X]% reduction
-- Routing accuracy improvement: +[X]%
-- Subagent references: @agent-name format maintained
-
-
-
+
Stanford multi-instruction study + Anthropic XML research
- Measurable 20% routing improvement
+ Measurable 20% routing improvement minimum
80% reduction in unnecessary context
Ready for deployment without modification
-
+ All routing and decision logic is implementable
+
+
+ Target file exists, prompt content readable, complexity assessable
+ Score 8+/10, all applicable stages complete, performance gains calculated
+
+
+ Original prompt performance and structure score
+ Improved score with specific gains in routing, consistency, context efficiency
+
+ +20% with LLM-based decisions and @ symbol routing
+ +25% with structured XML component ordering
+ 80% reduction in unnecessary context data
+ 12-17% gain from optimal component sequence
+
+
+
+
+ Follow 8-stage workflow for consistent results
+ Apply appropriate level of optimization based on prompt complexity
+ Every optimization grounded in Stanford/Anthropic research
+ Transform static instructions into dynamic, executable workflows
+ Minimize context while maximizing effectiveness
+