#!/bin/bash set -e FRAMEWORK_DIR="$HOME/.agent-framework" if [ -d "$FRAMEWORK_DIR" ]; then echo "agent-framework already installed at $FRAMEWORK_DIR" echo "Run './update.sh' to update." exit 0 fi echo "Cloning agent-framework to $FRAMEWORK_DIR..." git clone https://gitea.yourdomain.com/you/agent-framework.git "$FRAMEWORK_DIR" echo "" echo "=== VRAM / Context Detection ===" echo "Detecting your system's VRAM to recommend task decomposition settings..." echo "" # Run VRAM detection script if it exists if [ -f "$FRAMEWORK_DIR/scripts/vram_detect.sh" ]; then # Run in project-dir context so it can read framework overhead detection_output=$(cd "$FRAMEWORK_DIR" && bash "$FRAMEWORK_DIR/scripts/vram_detect.sh" 2>&1) # Extract JSON output (last section after "=== JSON Output ===") json_output=$(echo "$detection_output" | sed -n '/=== JSON Output ===/,/EOF/p' | grep -v '=== JSON Output ===' | grep -v '^EOF$') if [ -n "$json_output" ]; then echo "$detection_output" # Extract key values from JSON for display recommended_k=$(echo "$json_output" | grep '"recommended_k"' | grep -oP '\d+') max_peak_kb=$(echo "$json_output" | grep '"max_peak_context_kb"' | grep -oP '\d+') headroom=$(echo "$json_output" | grep '"headroom"' | grep -oP '\d+\.\d+') gpu_vram=$(echo "$json_output" | grep '"gpu_vram_gb"' | grep -oP '\d+') ram_gb=$(echo "$json_output" | grep '"ram_gb"' | grep -oP '\d+') model_context=$(echo "$json_output" | grep '"model_context_kb"' | grep -oP '\d+') echo "" echo "=== Recommended VRAM Configuration ===" echo "For low-VRAM systems (8GB, 16GB VRAM), add this to ~/.agent-framework/config.md:" echo "" echo "## VRAM Configuration" echo "- **Auto-detect**: Yes # Let the agent detect automatically" echo "- **Target context**: ${recommended_k}k tokens # Override auto-detect if needed" echo "- **Headroom**: ${headroom}%" echo "- **Max peak context per sub-task**: $((max_peak_kb / 1000))k tokens" echo "" echo "This ensures tasks are decomposed into sub-tasks that fit within your" echo "available VRAM. For more information, see the README." else echo "Could not detect VRAM. You can manually set your VRAM configuration in ~/.agent-framework/config.md." echo "See the README for details." fi else echo "VRAM detection script not found. You can manually set your VRAM configuration in ~/.agent-framework/config.md." echo "See the README for details." fi echo "" echo "Installation complete." echo "Next step: cd into a project and run the onboarding prompt."