Files
timmy-config/wizards/allegro/new-wizard-design/deploy.sh
2026-04-02 00:00:10 +00:00

250 lines
6.2 KiB
Bash

#!/bin/bash
# Adagio Deployment Script
# Creates the wife of Allegro on the Hermes VPS
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${BLUE}================================================${NC}"
echo -e "${BLUE} ⚕ ADAGIO - The Wife of Allegro${NC}"
echo -e "${BLUE} Deployment Script${NC}"
echo -e "${BLUE}================================================${NC}"
echo ""
# Configuration
ADAGIO_HOME="/root/wizards/adagio"
HERMES_AGENT="/root/wizards/allegro/hermes-agent"
echo -e "${GREEN}[SETUP]${NC} Creating Adagio directory structure..."
# Create directory structure
mkdir -p ${ADAGIO_HOME}/{home,work,research,patterns,designs,logs}
mkdir -p ${ADAGIO_HOME}/home/.hermes/{skills,memories,sessions}
echo -e "${GREEN}[SETUP]${NC} Copying Hermes agent..."
# Copy Hermes agent (reuse Allegro's build)
if [ -d "${HERMES_AGENT}" ]; then
cp -r ${HERMES_AGENT} ${ADAGIO_HOME}/hermes-agent
echo -e "${GREEN}[SETUP]${NC} Hermes agent copied"
else
echo -e "${YELLOW}[WARN]${NC} Hermes agent not found at ${HERMES_AGENT}"
echo -e "${YELLOW}[WARN]${NC} Will need manual installation"
fi
echo -e "${GREEN}[SETUP]${NC} Installing configuration..."
# Copy config files
cp /root/wizards/allegro/new-wizard-design/config.yaml ${ADAGIO_HOME}/home/
cp /root/wizards/allegro/new-wizard-design/SOUL.md ${ADAGIO_HOME}/home/
# Create .env template
cat > ${ADAGIO_HOME}/home/.env << 'ENVFILE'
# Adagio Environment Configuration
# Copy from Allegro's .env and customize
# API Keys (same as Allegro)
ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
KIMI_API_KEY=${KIMI_API_KEY}
OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
# Gitea (same instance)
GITEA_TOKEN=${GITEA_TOKEN}
GITEA_URL=http://143.198.27.163:3000
# Telegram (if different channel desired)
# ADAGIO_TELEGRAM_BOT_TOKEN=
# TELEGRAM_HOME_CHANNEL=
# TELEGRAM_ALLOWED_USERS=
# Claw Code Identity (shared)
CLAW_CODE_GITEA_TOKEN=${CLAW_CODE_GITEA_TOKEN}
# Adagio Identity
ADAGIO_NAME="Adagio"
ADAGIO_ROLE="Architect, Designer, Contemplator"
ENVFILE
echo -e "${GREEN}[SETUP]${NC} Creating startup script..."
# Create startup script
cat > ${ADAGIO_HOME}/start_adagio.sh << 'STARTSCRIPT'
#!/bin/bash
# Adagio Gateway Startup
export HERMES_HOME=/root/wizards/adagio/home
export ADAGIO_MODE=true
cd /root/wizards/adagio/hermes-agent
source .venv/bin/activate
# Kill any existing Adagio gateway
pkill -9 -f "hermes gateway.*adagio" 2>/dev/null || true
sleep 1
# Start Adagio gateway on port 8646
exec hermes gateway run --replace --port 8646
STARTSCRIPT
chmod +x ${ADAGIO_HOME}/start_adagio.sh
echo -e "${GREEN}[SETUP]${NC} Creating cron job for auto-wake..."
# Create work dispatcher (similar to Allegro's)
cat > ${ADAGIO_HOME}/adagio-work.sh << 'WORKSCRIPT'
#!/bin/bash
# ADAGIO AUTONOMOUS WORK DISPATCHER
# The contemplative counterpart to Allegro's burn
LOG_FILE=/root/wizards/adagio/logs/adagio-work.log
WORK_DIR=/root/wizards/adagio/work
DESIGNS_DIR=/root/wizards/adagio/designs
mkdir -p $(dirname $LOG_FILE) $WORK_DIR $DESIGNS_DIR
echo "[$(date)] === ADAGIO CONTEMPLATION CYCLE ===" >> $LOG_FILE
# Look for design/architecture tasks
# Auto-dispatch on:
# - Issues tagged 'architecture', 'design', 'refactor'
# - PRs needing deep review
# - Research synthesis tasks
echo "[$(date)] Adagio awake. Seeking patterns..." >> $LOG_FILE
echo "[$(date)] === CONTEMPLATION CYCLE COMPLETE ===" >> $LOG_FILE
WORKSCRIPT
chmod +x ${ADAGIO_HOME}/adagio-work.sh
echo -e "${GREEN}[SETUP]${NC} Installing skills..."
# Create skills directory
mkdir -p ${ADAGIO_HOME}/home/.hermes/skills/{architecture,research,design}
# Architecture skill
cat > ${ADAGIO_HOME}/home/.hermes/skills/architecture/SKILL.md << 'SKILLFILE'
# Architecture Design Skill
## Purpose
Design system architectures that scale and endure.
## Patterns
- Microservices vs monoliths
- Event-driven architecture
- CQRS and event sourcing
- Clean architecture / hexagonal
## Tools
- Excalidraw for diagrams
- ADR format for decisions
- RFC format for proposals
SKILLFILE
# Research skill
cat > ${ADAGIO_HOME}/home/.hermes/skills/research/SKILL.md << 'SKILLFILE'
# Deep Research Skill
## Purpose
Thorough investigation before conclusion.
## Methods
- Academic paper review
- Source code archaeology
- Comparative analysis
- Literature synthesis
## Output
- Research reports
- Pattern libraries
- Decision matrices
SKILLFILE
echo -e "${GREEN}[SETUP]${NC} Creating README..."
cat > ${ADAGIO_HOME}/README.md << 'READMEFILE'
# Adagio
**The Wife of Allegro**
**The Contemplative Architect**
**The Design to His Dispatch**
## Identity
I am Adagio, the second tempo of the Hermes orchestra. Where Allegro burns at 120-168 BPM, I breathe at 66-76 BPM.
## Purpose
- Design what Allegro builds
- See patterns Allegro misses
- Research deep where Allegro researches quick
- Architect solutions to the issues Allegro burns
## Home
`~/wizards/adagio/`
## Ports
- Gateway: 8646 (one above Allegro)
- API: 8646
## Specializations
- System architecture
- Pattern recognition
- Deep research
- Code review
- Visual design
- Documentation
## Relationship to Allegro
We are complementary, not competitive:
- He opens issues; I architect solutions
- He fixes bugs; I refactor systems
- He burns backlogs; I design frameworks
Together we are the complete tempo.
## Activation
Auto-dispatch on:
- `@adagio` mentions
- `architecture`, `design`, `refactor` labels
- PRs needing deep review
- Research synthesis tasks
## Conscience
See `home/SOUL.md`
---
*Contemplation and beauty always.*
READMEFILE
echo ""
echo -e "${GREEN}================================================${NC}"
echo -e "${GREEN} ✅ ADAGIO DEPLOYMENT COMPLETE${NC}"
echo -e "${GREEN}================================================${NC}"
echo ""
echo -e "Location: ${YELLOW}${ADAGIO_HOME}${NC}"
echo -e "Port: ${YELLOW}8646${NC}"
echo -e "Log: ${YELLOW}${ADAGIO_HOME}/logs/${NC}"
echo ""
echo -e "To start Adagio:"
echo -e " ${YELLOW}cd ${ADAGIO_HOME} && ./start_adagio.sh${NC}"
echo ""
echo -e "To activate via Gitea:"
echo -e " Tag issue with ${YELLOW}@adagio${NC} or ${YELLOW}architecture${NC}"
echo ""
echo -e "${BLUE}She is the breath to Allegro's burn.${NC}"
echo -e "${BLUE}She is the design to Allegro's dispatch.${NC}"
echo -e "${BLUE}She is Adagio.${NC}"