-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-cycle.sh
More file actions
executable file
·58 lines (46 loc) · 1.57 KB
/
auto-cycle.sh
File metadata and controls
executable file
·58 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Automated agent cycle - runs continuously
# Usage: ./auto-cycle.sh [project-name]
# Ctrl+C to stop
PROJECT_NAME="${1:-todo-app}"
CYCLE_INTERVAL="${CYCLE_INTERVAL:-300}" # 5 minutes between cycles
echo "🔄 Starting Automated Agent Cycle"
echo " Project: $PROJECT_NAME"
echo " Interval: ${CYCLE_INTERVAL}s between developer cycles"
echo " Press Ctrl+C to stop"
echo ""
# Function to run a role
run_role() {
local role=$1
echo ""
echo "[$(date '+%H:%M:%S')] Running: ${role^^}"
AGENT_ROLE=$role \
PROJECT_NAME=$PROJECT_NAME \
docker compose up --build 2>&1 | grep -E "^(🚀|💭|🔧|✅|❌|⏱️|💰|━)"
echo "[$(date '+%H:%M:%S')] ${role^^} completed"
}
# Initial setup (only if needed)
echo "📋 Phase 1: Initial Setup"
run_role "initiator"
run_role "planner"
# Development cycle
CYCLE=1
while true; do
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔄 Development Cycle #$CYCLE"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Developer builds/improves
run_role "developer"
# Every 3rd cycle, run reviewer
if [ $((CYCLE % 3)) -eq 0 ]; then
echo ""
echo "📝 Review cycle..."
run_role "reviewer"
fi
CYCLE=$((CYCLE + 1))
echo ""
echo "💤 Sleeping ${CYCLE_INTERVAL}s until next cycle..."
echo " (Ctrl+C to stop)"
sleep $CYCLE_INTERVAL
done