Files
openclaw/tools/jarvis-model-optimizer.sh
Clawd Bot ca9b510922 chore: align with upstream openclaw/openclaw and overlay local additions
- Reset master to upstream/main (16,697 commits)
- Overlay 2,271 local-only files (skills, tools, workspace, configs, apps)
- Restore IDENTITY.md and USER.md templates
- Build verified, gateway running, Discord working

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 07:40:46 +01:00

50 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Jarvis Model Optimizer
# Use llm-checker to recommend optimal models
set -euo pipefail
LOG_FILE="/home/alex/clawd/logs/jarvis-model-optimizer.log"
log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" | tee -a "$LOG_FILE"
}
mkdir -p "$(dirname "$LOG_FILE")"
log "=== MODEL OPTIMIZATION ANALYSIS ==="
# Hardware detection
if hw_info=$(llm-checker hw-detect 2>&1 | grep -A 20 "Summary:" || echo "failed"); then
log "📊 Hardware Profile:"
echo "$hw_info" | grep -E "Gen|Tier|Max model|Best backend" | sed 's/^/ /' | tee -a "$LOG_FILE"
fi
# Check current Ollama models
current_models=$(ollama list 2>/dev/null | tail -n +2 | wc -l || echo "0")
log "📦 Current Ollama models: $current_models"
if [ "$current_models" -gt 0 ]; then
log "📋 Installed models:"
ollama list 2>/dev/null | tail -n +2 | awk '{print " " $1 " (" $3 " " $4 ")"}' | tee -a "$LOG_FILE"
fi
# Recommendations (quick mode - no full scrape)
log "💡 Recommendation: Use llm-checker for detailed analysis"
log " Run: llm-checker recommend --use-cache"
log " Or: llm-checker installed (to rank current models)"
# Compare to cloud usage
if [ -f /home/alex/clawd/data/context/memory.json ]; then
preferred=$(jq -r '.preferences.preferred_agent // "none"' /home/alex/clawd/data/context/memory.json 2>/dev/null || echo "none")
log "🧠 Current preference: $preferred (cloud models)"
fi
# Cost estimate
log "💰 Cost optimization:"
log " Cloud API calls: Check usage logs for actual costs"
log " Local inference: Free (but slower on CPU-only)"
log " Hybrid strategy: Use local for simple tasks, cloud for complex"
log "=== OPTIMIZATION COMPLETE ==="