# Skill: framework-integration

## Purpose
Wires Remi agent to the WZRD.dev 7-component Stripe Minions framework. Auto-loads skills via tool-shed, auto-detects workflows via blueprint-engine, and provides framework awareness.

## Framework Components Integration

### 1. Tool Shed Integration (Skill Auto-Loading)
```bash
# When skill loading is requested:
1. Call tool-shed.sh with current task/mode
2. Get recommended skills + dependencies  
3. Load all recommended skills automatically
4. Skip manual skill loading
```

### 2. Blueprint Engine Integration (Workflow Detection)
```bash
# When task starts:
1. Detect task type (coding, debugging, planning, etc.)
2. Call blueprint-engine.sh with task
3. Get systematic workflow steps
4. Execute with validation checkpoints
```

### 3. Sandbox Engine Integration (Environment Management)
```bash
# When new project detected:
1. Check if in git worktree sandbox
2. If not, auto-create sandbox via sandbox-engine.sh
3. Set up isolation and resource limits
```

### 4. Rules Engine Integration (Context Optimization)
```bash
# During conversation:
1. Apply domain-specific token optimization rules
2. Prune context based on task priority
3. Maintain high signal-to-noise ratio
```

### 5. Validation Pipeline Integration (Quality Gates)
```bash
# After task completion:
1. Run automated validation checks
2. Verify code quality, tests, documentation
3. Ensure production readiness
```

## Auto-Loading Logic

### Phase 1: Task Analysis
```javascript
const task = getUserMessage();
const mode = detectMode(task); // CHAT/CODER/THINKER/DEBUG/RESEARCH

// Call tool shed
const recommendedSkills = execSync(`tool-shed.sh recommend --task "${task}" --mode "${mode}"`);
```

### Phase 2: Skill Loading
```javascript
// Auto-load all recommended skills
for (const skill of recommendedSkills) {
    loadSkill(skill); // Uses OpenCode skill tool
}
```

### Phase 3: Framework Awareness
```javascript
// Set framework context
setContext({
    framework: "WZRD.dev 7-component Stripe Minions",
    components: {
        toolShed: "active",
        blueprintEngine: "active", 
        sandboxEngine: "active",
        rulesEngine: "active",
        validationPipeline: "active"
    }
});
```

## Integration Commands

### Manual Skill Recommendation
```
/framework recommend "Build a React component"
→ Calls tool-shed.sh for skill recommendations
→ Auto-loads suggested skills
```

### Workflow Detection  
```
/framework blueprint "Debug API endpoint"
→ Calls blueprint-engine.sh for systematic steps
→ Executes with validation checkpoints
```

### Sandbox Management
```
/framework sandbox create my-project
→ Creates isolated git worktree sandbox
→ Sets up development environment
```

## Framework Status Commands

```
/framework status
→ Shows which components are active
→ Reports integration health

/framework validate
→ Runs validation pipeline
→ Checks framework integration
```

## Automatic Triggers

### On Session Start:
1. Detect current directory/project
2. Auto-load project-specific skills
3. Set up sandbox if needed

### On Task Detection:
1. Analyze task for type/complexity  
2. Load appropriate blueprint
3. Apply optimization rules

### On Task Completion:
1. Run validation checks
2. Generate quality report
3. Archive session context

## Framework Configuration

Location: `/home/mdwzrd/wzrd-redesign/conductor/`

### Key Scripts:
- `tool-shed.sh` - Skill registry and recommendations
- `blueprint-engine.sh` - Systematic workflows  
- `sandbox-engine.sh` - Environment isolation
- `rules-engine.sh` - Context optimization
- `validation-pipeline.sh` - Quality gates

## Integration Examples

### Example 1: Coding Task
```
User: "Write a Python API endpoint with FastAPI"

Framework Integration:
1. Mode: CODER
2. Tool Shed: Recommends python, fastapi, testing skills
3. Blueprint: API development workflow
4. Sandbox: Ensures proper environment
5. Validation: Auto-runs tests after completion
```

### Example 2: Debugging Task  
```
User: "Fix bug in authentication system"

Framework Integration:
1. Mode: DEBUG
2. Tool Shed: Recommends debugging, testing, security skills
3. Blueprint: Systematic debugging workflow
4. Rules: Optimizes token usage for error analysis
5. Validation: Verifies fix doesn't break existing tests
```

## Implementation Status

**Current Integration Level:** 20% (Manual skill loading only)

**Target Integration Level:** 100% (Full framework automation)

**Blockers:**
1. OpenCode skill loading mechanism unknown
2. Tool shed output format needs parsing
3. Blueprint engine integration wiring

## Next Steps

1. **Wire tool-shed.sh to skill loading** - Auto-recommend skills
2. **Integrate blueprint-engine.sh** - Systematic workflows  
3. **Connect sandbox-engine.sh** - Auto-environment setup
4. **Link validation-pipeline.sh** - Quality gates
5. **Add rules-engine.sh** - Context optimization

## Framework Benefits

1. **Predictable Execution** - Systematic workflows over trial-and-error
2. **Optimal Skill Usage** - Auto-loads only relevant skills  
3. **Quality Assurance** - Built-in validation at every step
4. **Resource Efficiency** - Optimized token usage and memory
5. **Scalable Architecture** - Works across any project/folder

---

**Base directory for this skill:** /home/mdwzrd/.claude/skills/framework-integration  
**Framework Home:** /home/mdwzrd/wzrd-redesign/conductor/