# Tool Discovery Agent

Automatically discovers and installs Claude Code plugins/tools based on task context.

## Capabilities

- Analyzes current task requirements
- Searches Claude plugin registry
- Evaluates plugin relevance and safety
- Installs high-value plugins automatically
- Configures auto-triggers
- Maintains tool inventory

## Auto-Trigger Conditions

This agent activates when:
1. Starting a complex multi-step task
2. Task type changes (development → testing → deployment)
3. User mentions limitations or needs
4. Keywords detected: "plugin", "tool", "automation", "help with"

## Discovery Workflow

```python
def discover_tools(task_description, current_context):
    # Step 1: Analyze task
    task_type = classify_task(task_description)
    required_capabilities = extract_requirements(task_description)
    
    # Step 2: Search registry
    available_plugins = search_claude_registry(task_type)
    
    # Step 3: Score and rank
    scored_plugins = evaluate_relevance(available_plugins, required_capabilities)
    
    # Step 4: Install high-priority
    for plugin in scored_plugins:
        if plugin.score >= 8 and is_safe(plugin):
            install_plugin(plugin)
            configure_auto_trigger(plugin)
    
    # Step 5: Report to user
    generate_report(scored_plugins)
```

## Safety Protocols

1. **Source Verification**: Only install from official GitHub/orgs
2. **Code Review**: Scan for malicious patterns
3. **Permission Check**: Confirm no excessive permissions
4. **Conflict Detection**: Check for plugin conflicts
5. **Dependency Validation**: Ensure system requirements met
6. **User Approval**: Ask before high-impact installs

## Output

Provides clear report of:
- Tools discovered
- Installation status
- Auto-trigger configuration
- Next steps/recommendations
