# Auto-Trigger Integration Complete ✅ **Date:** 2026-01-27 **Status:** ✅ All agents auto-routing enabled via Ralph --- ## What Was Added ### 1. Intelligent Router Hook **File:** `~/.claude/hooks/intelligent-router.sh` This hook automatically analyzes user prompts and suggests the best agent for the task. It runs on every `UserPromptSubmit` event. **Routing Logic:** - Analyzes task keywords and patterns - Calculates confidence scores (threshold: 70%) - Suggests appropriate agent command - Covers ALL 21 integrated commands ### 2. Enhanced Ralph Command **File:** `~/.claude/commands/ralph.md` (updated) Ralph now: - Has access to ALL integrated agents (Clawd, Prometheus, Dexto) - Routes to best agent automatically - Can orchestrate multi-agent workflows - Removed `disable-model-invocation` for proper functionality ### 3. Enhanced Ralph Skill **File:** `~/.claude/skills/ralph/enhanced-ralph.md` (new) Complete documentation of all agents and routing patterns. ### 4. Updated Hooks Configuration **File:** `~/.claude/hooks.json` (updated to v5) Added `intelligent-router.sh` as the first hook in UserPromptSubmit chain. --- ## Auto-Routing Patterns | Task Pattern | Routes To | Example | |-------------|-----------|---------| | "autonomous", "automatically", "on its own" | `/clawd` | "Handle this autonomously" | | "architecture", "design system", "from scratch" | `/ralph` | "Design microservices architecture" | | "bug", "fix", "reproduce", "regression" | `/prometheus-bug` | "Fix authentication bug" | | "feature", "implement", "add functionality" | `/prometheus-feature` | "Add two-factor auth" | | "code context", "how does", "explain" | `/prometheus-context` | "How does payment work?" | | "github", "pr", "issue", "commit" | `/dexto-github` | "Analyze the pull request" | | "pdf", "document", "summarize paper" | `/dexto-pdf` | "Summarize this document" | | "generate image", "create picture", "ai art" | `/dexto-nano-banana` | "Generate an image" | | "video", "sora", "generate clip" | `/dexto-sora` | "Create a video" | | "music", "audio", "podcast", "beat" | `/dexto-music` | "Create a beat" | | "database", "sql", "query", "schema" | `/dexto-database` | "Optimize this query" | | "explore code", "analyze codebase" | `/dexto-explore` | "Explore this codebase" | | "product name", "branding", "research" | `/dexto-research` | "Research product names" | | "support ticket", "triage", "categorize" | `/dexto-triage` | "Triage this ticket" | --- ## How It Works ### User Experience 1. **User types a task:** ``` Fix the authentication bug in the login system ``` 2. **Intelligent Router analyzes:** - Detects "bug", "fix", "authentication" keywords - Matches to Prometheus Bug Analyzer (score: 85) - Confidence: high 3. **Suggestion appears:** ``` 💡 **Tip:** This is a code analysis task. Use Prometheus: `/prometheus "Fix the authentication bug in the login system"` ``` 4. **User can:** - Click/tap the suggested command - Type it manually - Ignore and use default Claude - Use `/ralph` to let Ralph orchestrate ### Ralph Orchestration When using `/ralph`, it: 1. Analyzes task requirements 2. Selects best agent automatically 3. For complex tasks, chains multiple agents: - Example: "Analyze code, find bugs, create fix plan" - Ralph chains: `dexto-explore` → `prometheus-bug` → `prometheus-feature` --- ## Examples ### Example 1: Bug Fix ``` User: "The login is broken after password reset" Router detects: bug pattern Suggestion: 💡 Use Prometheus: `/prometheus-bug "The login is broken after password reset"` ``` ### Example 2: Image Generation ``` User: "Create an image of a cyberpunk city" Router detects: image generation pattern Suggestion: 💡 Use Dexto nano-banana agent: `/dexto-nano-banana "Create an image of a cyberpunk city"` ``` ### Example 3: Architecture Design ``` User: "Design a scalable e-commerce backend" Router detects: architecture pattern Suggestion: 💡 This is a complex architecture task. Ralph can help: `/ralph "Design a scalable e-commerce backend"` ``` ### Example 4: Autonomous Execution ``` User: "Automatically deploy the application to production" Router detects: autonomous pattern Suggestion: 💡 This task looks suitable for autonomous execution. Consider using: `/clawd "Automatically deploy the application to production"` ``` --- ## Configuration ### Enable/Disable Router Edit `~/.claude/hooks.json`: ```json { "type": "command", "command": "/home/roman/.claude/hooks/intelligent-router.sh", "timeout": 10 } ``` ### Adjust Confidence Threshold Edit `~/.claude/hooks/intelligent-router.sh`: ```bash if [ "$SCORE" -ge 70 ]; then # Change 70 to desired threshold ``` ### Add New Patterns Add to the detect patterns in `intelligent-router.sh`: ```bash if echo "$prompt" | grep -qiE "(your|pattern)"; then best_agent="your-agent" best_score=80 fi ``` --- ## Testing Test the router: ```bash # Test various patterns echo "Fix this bug" | ~/.claude/hooks/intelligent-router.sh echo "Generate an image" | ~/.claude/hooks/intelligent-router.sh echo "Design architecture" | ~/.claude/hooks/intelligent-router.sh echo "Handle this autonomously" | ~/.claude/hooks/intelligent-router.sh ``` --- ## Files Modified/Created ``` ~/.claude/ ├── hooks/ │ ├── intelligent-router.sh # NEW - Auto-routing logic │ └── hooks.json # UPDATED - v5 with router ├── commands/ │ └── ralph.md # UPDATED - Enhanced capabilities └── skills/ └── ralph/ └── enhanced-ralph.md # NEW - Documentation ``` --- ## Health Check ```bash ~/.claude/health-check.sh ``` **Status:** ✅ All systems operational (291 skills) --- ## Summary Your Claude Code CLI now has **intelligent auto-routing** that: 1. ✅ **Detects task type** from natural language 2. ✅ **Suggests best agent** automatically 3. ✅ **Routes via Ralph** for complex orchestration 4. ✅ **Covers all 21 commands** (Clawd, Prometheus, Dexto) 5. ✅ **Runs on every prompt** via hooks **Just describe your task and the system will guide you to the best tool! 🎯**