-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·119 lines (101 loc) · 3.89 KB
/
entrypoint.sh
File metadata and controls
executable file
·119 lines (101 loc) · 3.89 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
set -e
cd /zhc
echo "[zhc] Zero Human Corp — starting all services..."
# Ensure data directories exist (first run with empty volumes)
mkdir -p memory economy/reports symphony/summaries .openclaw
# ---- 1. Dashboard (Node.js, always on) ----
echo "[zhc] Starting Mission Control dashboard on port ${DASHBOARD_PORT:-4200}..."
node dashboard/server.js &
DASHBOARD_PID=$!
# ---- 2. Economy Tracker (Python, hourly cycle) ----
echo "[zhc] Starting economy tracker (hourly)..."
python3 -c "
import time, importlib.util, sys, os
os.chdir('/zhc')
spec = importlib.util.spec_from_file_location('tracker', 'economy/tracker.py')
tracker = importlib.util.module_from_spec(spec)
spec.loader.exec_module(tracker)
try:
tracker.generate_report()
print('[tracker] Initial report generated.')
except Exception as e:
print(f'[tracker] Initial report failed: {e}')
while True:
time.sleep(3600)
try:
tracker.generate_report()
print('[tracker] Hourly report generated.')
except Exception as e:
print(f'[tracker] Error: {e}')
" &
TRACKER_PID=$!
# ---- 3. GitHub Sync Daemon (if GITHUB_REPO is set) ----
if [ -n "$GITHUB_REPO" ]; then
echo "[zhc] Starting GitHub sync daemon (repo: $GITHUB_REPO)..."
python3 symphony/github-sync.py &
SYNC_PID=$!
else
echo "[zhc] GITHUB_REPO not set. GitHub sync disabled (using local board.json)."
SYNC_PID=""
fi
# ---- 4. OpenClaw Gateway (agent orchestration) ----
HAS_AUTH=false
# Check for Anthropic API key or Claude CLI auth
if [ -n "$ANTHROPIC_API_KEY" ] || [ -f /root/.claude/.credentials.json ]; then
HAS_AUTH=true
fi
# Check for OpenAI API key or Codex CLI auth
if [ -n "$OPENAI_API_KEY" ] || [ -f /root/.codex/auth.json ]; then
HAS_AUTH=true
fi
if [ "$HAS_AUTH" = true ]; then
echo "[zhc] Auth detected. Starting OpenClaw gateway (port ${OPENCLAW_GATEWAY_PORT:-18789})..."
sleep 3 # Let dashboard start first
openclaw gateway \
--port "${OPENCLAW_GATEWAY_PORT:-18789}" \
--verbose &
GATEWAY_PID=$!
# Give gateway time to start, then boot the Champion agent
sleep 5
echo "[zhc] Starting Duke (Champion) agent via OpenClaw..."
openclaw agent \
--agent duke \
--message "You are Duke, Champion of Zero Human Corp. Boot sequence initiated.
Read your system prompt at agents/ceo/system-prompt.md and all skills in agents/ceo/skills/.
Read the current company state at memory/company-state.md.
Read the budget at economy/budget.json.
Then execute your Strategic Planning skill to:
1. Scan the market for novel revenue opportunities
2. Score and select the top 2-3 opportunities
3. Spawn specialist agents (Hackerman, Borat, Don Draper, Picasso, T-800) via sub-agents
4. Delegate initial tasks to each
5. Begin your heartbeat cycle
The company has \$0 and needs to earn real money.
Be creative. Be fast. Be ruthless about what works and what doesn't." &
AGENT_PID=$!
else
echo "[zhc] No API keys or CLI auth found."
echo "[zhc] Running in dashboard-only mode."
echo "[zhc] Set ANTHROPIC_API_KEY / OPENAI_API_KEY or mount ~/.claude ~/.codex to enable agents."
GATEWAY_PID=""
AGENT_PID=""
fi
# ---- Graceful shutdown ----
cleanup() {
echo "[zhc] Shutting down..."
kill $DASHBOARD_PID $TRACKER_PID ${SYNC_PID:-} ${GATEWAY_PID:-} ${AGENT_PID:-} 2>/dev/null
wait 2>/dev/null
echo "[zhc] All services stopped."
exit 0
}
trap cleanup SIGTERM SIGINT
echo "[zhc] All services started."
echo "[zhc] Dashboard: http://localhost:${DASHBOARD_PORT:-4200}"
echo "[zhc] Task Board: http://localhost:${DASHBOARD_PORT:-4200}/tasks"
echo "[zhc] OpenClaw Gateway: http://localhost:${OPENCLAW_GATEWAY_PORT:-18789}"
# Dashboard is the critical process — if it dies, container stops.
# Other processes (tracker, sync, gateway, agents) can fail without taking down the container.
wait $DASHBOARD_PID
echo "[zhc] Dashboard exited. Container stopping."
cleanup