-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
Β·819 lines (721 loc) Β· 30.6 KB
/
install.sh
File metadata and controls
executable file
Β·819 lines (721 loc) Β· 30.6 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
#!/usr/bin/env bash
# PepeClaw + Pepe 2.0 Installer β Self-Evolving Agent System for OpenClaw
# Usage: curl -fsSL https://raw.githubusercontent.com/openclaw/pepe-2.0/main/install.sh | bash
# Or: ./install.sh
set -euo pipefail
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Configuration
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PEPE_VERSION="2.0.0"
PEPECLAW_PORT="${PEPECLAW_PORT:-5173}"
REQUIRED_BASH_VERSION=4
REPO_URL="https://github.com/openclaw/pepe-2.0.git"
PEPECLAW_SERVICE_NAME="com.openclaw.pepeclaw"
# Colors (only if terminal supports them)
if [ -t 1 ] && command -v tput >/dev/null 2>&1; then
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
RED=$(tput setaf 1)
CYAN=$(tput setaf 6)
BOLD=$(tput bold)
RESET=$(tput sgr0)
else
GREEN="" YELLOW="" RED="" CYAN="" BOLD="" RESET=""
fi
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Helpers
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
info() { printf "%s[INFO]%s %s\n" "$CYAN" "$RESET" "$1"; }
ok() { printf "%s[ OK]%s %s\n" "$GREEN" "$RESET" "$1"; }
warn() { printf "%s[WARN]%s %s\n" "$YELLOW" "$RESET" "$1"; }
fail() { printf "%s[FAIL]%s %s\n" "$RED" "$RESET" "$1"; exit 1; }
banner() {
printf "\n%s" "$GREEN"
cat <<'ART'
βββββββββββββββββββββββββββββββββββββββββββββ
β β
β πΈ P E P E C L A W β
β β
β 3D AI Agent Visualizer + Self-Evolving β
β Agent System for OpenClaw β
β β
βββββββββββββββββββββββββββββββββββββββββββββ
ART
printf "%s\n\n" "$RESET"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Pre-flight Checks
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
preflight() {
info "Running pre-flight checks..."
# Check bash version
if [ "${BASH_VERSINFO[0]}" -lt "$REQUIRED_BASH_VERSION" ]; then
fail "Bash $REQUIRED_BASH_VERSION+ required (found ${BASH_VERSION}). On macOS: brew install bash"
fi
ok "Bash ${BASH_VERSION}"
# Check for Node.js
if ! command -v node >/dev/null 2>&1; then
warn "Node.js not found. Attempting to install via nvm..."
install_nodejs
else
NODE_VER=$(node --version 2>/dev/null || echo "unknown")
NODE_MAJOR=$(echo "$NODE_VER" | sed 's/v//' | cut -d. -f1)
if [ "$NODE_MAJOR" -lt 18 ] 2>/dev/null; then
warn "Node.js $NODE_VER is too old (need 18+). Attempting upgrade via nvm..."
install_nodejs
else
ok "Node.js $NODE_VER"
fi
fi
# Check for npm (or fallback info)
if command -v npm >/dev/null 2>&1; then
ok "npm $(npm --version 2>/dev/null)"
elif command -v npx >/dev/null 2>&1; then
warn "npm not found but npx is available. Will use npx where possible."
else
fail "Neither npm nor npx found. Install Node.js first: https://nodejs.org"
fi
# Check for jq
if ! command -v jq >/dev/null 2>&1; then
warn "jq not found. Installing..."
if command -v brew >/dev/null 2>&1; then
brew install jq
elif command -v apt-get >/dev/null 2>&1; then
sudo apt-get install -y jq
elif command -v yum >/dev/null 2>&1; then
sudo yum install -y jq
else
fail "Cannot install jq automatically. Install it manually: https://stedolan.github.io/jq/download/"
fi
fi
ok "jq $(jq --version 2>/dev/null || echo 'installed')"
# Check for python3 (used by several skill scripts)
if ! command -v python3 >/dev/null 2>&1; then
warn "python3 not found. Some skill scripts require Python 3."
warn "Install it: macOS: 'brew install python3' / Linux: 'sudo apt-get install python3'"
else
ok "python3 $(python3 --version 2>/dev/null | awk '{print $2}')"
fi
# Check for crontab
if ! command -v crontab >/dev/null 2>&1; then
warn "crontab not found. Scheduled tasks (Dream Mode, War Room) will not run automatically."
HAS_CRON=false
else
ok "cron available"
HAS_CRON=true
fi
# Detect OpenClaw workspace
if [ -n "${OPENCLAW_WORKSPACE:-}" ]; then
WORKSPACE="$OPENCLAW_WORKSPACE"
elif [ -d "$HOME/.openclaw/workspace" ]; then
WORKSPACE="$HOME/.openclaw/workspace"
elif [ -d "$HOME/.openclaw" ]; then
WORKSPACE="$HOME/.openclaw"
else
warn "OpenClaw workspace not found."
warn "Install OpenClaw first: https://openclaw.ai"
warn "Or set OPENCLAW_WORKSPACE to your workspace directory."
warn "Continuing with default location: $HOME/.openclaw"
WORKSPACE="$HOME/.openclaw"
mkdir -p "$WORKSPACE"
fi
ok "OpenClaw workspace: $WORKSPACE"
# Detect OS
OS="$(uname -s)"
case "$OS" in
Darwin) ok "Platform: macOS" ;;
Linux) ok "Platform: Linux" ;;
*) warn "Untested platform: $OS. Proceeding anyway." ;;
esac
printf "\n"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Install Node.js via nvm
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
install_nodejs() {
if command -v nvm >/dev/null 2>&1; then
info "nvm found. Installing Node.js 20 LTS..."
nvm install 20
nvm use 20
elif [ -s "$HOME/.nvm/nvm.sh" ]; then
info "Loading nvm from ~/.nvm..."
# shellcheck source=/dev/null
. "$HOME/.nvm/nvm.sh"
nvm install 20
nvm use 20
else
info "Installing nvm..."
if command -v curl >/dev/null 2>&1; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
elif command -v wget >/dev/null 2>&1; then
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
else
fail "Cannot install nvm. Install Node.js manually: https://nodejs.org"
fi
export NVM_DIR="$HOME/.nvm"
# shellcheck source=/dev/null
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 20
nvm use 20
fi
if command -v node >/dev/null 2>&1; then
ok "Node.js $(node --version) installed via nvm"
else
fail "Failed to install Node.js. Install it manually: https://nodejs.org"
fi
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Determine Source Directory
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
find_source() {
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -d "$SCRIPT_DIR/skills" ] || [ -f "$SCRIPT_DIR/package.json" ]; then
SOURCE_DIR="$SCRIPT_DIR"
info "Installing from local directory: $SOURCE_DIR"
else
info "Downloading Pepe 2.0 from GitHub..."
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
if command -v git >/dev/null 2>&1; then
git clone --depth 1 "$REPO_URL" "$TMPDIR/pepe-2.0" 2>/dev/null
SOURCE_DIR="$TMPDIR/pepe-2.0"
elif command -v curl >/dev/null 2>&1; then
curl -fsSL "https://github.com/openclaw/pepe-2.0/archive/main.tar.gz" | tar xz -C "$TMPDIR"
SOURCE_DIR="$TMPDIR/pepe-2.0-main"
else
fail "git or curl required to download Pepe 2.0"
fi
fi
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Install Skills
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
install_skills() {
if [ ! -d "$SOURCE_DIR/skills" ]; then
warn "No skills directory found in source. Skipping skill installation."
return
fi
info "Installing skills..."
SKILL_DIR="$WORKSPACE/skills"
mkdir -p "$SKILL_DIR"
SKILLS=(
"skill-genome"
"predictive-intent"
"dream-mode"
"meta-learning"
"adversarial-red-team"
"project-war-room"
"temporal-arbitrage"
"deep-search"
"execution-trace"
"openclaw-optimizer"
"self-scoring"
"skill-autocreator"
"realtime-learning"
"user-modeling"
"realtime-skill-creator"
"skill-mutator"
"genetic-evolution"
"dialectic-user-model"
)
for skill in "${SKILLS[@]}"; do
if [ -d "$SOURCE_DIR/skills/$skill" ]; then
if [ -d "$SKILL_DIR/$skill" ]; then
backup="$SKILL_DIR/${skill}.backup.$(date +%Y%m%d%H%M%S)"
warn "Existing skill '$skill' found. Backing up to $backup"
mv "$SKILL_DIR/$skill" "$backup"
fi
cp -r "$SOURCE_DIR/skills/$skill" "$SKILL_DIR/$skill"
if [ -d "$SKILL_DIR/$skill/scripts" ]; then
chmod +x "$SKILL_DIR/$skill/scripts/"*.sh 2>/dev/null || true
fi
ok "Installed: $skill"
else
warn "Skill not found in source: $skill"
fi
done
printf "\n"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Build PepeClaw 3D Viewer
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
build_pepeclaw() {
if [ ! -f "$SOURCE_DIR/package.json" ]; then
warn "No package.json found. Skipping PepeClaw build."
return
fi
info "Building PepeClaw 3D Viewer..."
PEPECLAW_DIR="$HOME/.openclaw/pepeclaw"
mkdir -p "$PEPECLAW_DIR"
# Install dependencies
cd "$SOURCE_DIR"
if command -v npm >/dev/null 2>&1; then
npm install --production=false 2>/dev/null || npm install
npm run build
elif command -v npx >/dev/null 2>&1; then
npx --yes npm install
npx --yes npm run build
else
fail "npm or npx required to build PepeClaw"
fi
# Copy built files
if [ -d "$SOURCE_DIR/dist" ]; then
cp -r "$SOURCE_DIR/dist/"* "$PEPECLAW_DIR/"
ok "PepeClaw built and installed to $PEPECLAW_DIR"
else
warn "Build output not found. PepeClaw may not have built correctly."
fi
printf "\n"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Auto-Start PepeClaw Server
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
setup_autostart() {
PEPECLAW_DIR="$HOME/.openclaw/pepeclaw"
if [ ! -d "$PEPECLAW_DIR" ]; then
warn "PepeClaw not built. Skipping auto-start setup."
return
fi
info "Setting up PepeClaw auto-start..."
OS="$(uname -s)"
case "$OS" in
Darwin)
setup_launchd
;;
Linux)
setup_systemd
;;
*)
warn "Auto-start not supported on $OS. Run manually: npx serve $PEPECLAW_DIR -l $PEPECLAW_PORT"
;;
esac
printf "\n"
}
setup_launchd() {
PLIST_DIR="$HOME/Library/LaunchAgents"
PLIST_FILE="$PLIST_DIR/$PEPECLAW_SERVICE_NAME.plist"
PEPECLAW_DIR="$HOME/.openclaw/pepeclaw"
mkdir -p "$PLIST_DIR"
# Find npx or node path
NPX_PATH=$(command -v npx 2>/dev/null || echo "/usr/local/bin/npx")
# Unload existing service if present (upgrade path)
if [ -f "$PLIST_FILE" ]; then
launchctl unload "$PLIST_FILE" 2>/dev/null || true
warn "Existing PepeClaw service found. Upgrading..."
fi
cat > "$PLIST_FILE" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>${PEPECLAW_SERVICE_NAME}</string>
<key>ProgramArguments</key>
<array>
<string>${NPX_PATH}</string>
<string>serve</string>
<string>${PEPECLAW_DIR}</string>
<string>-l</string>
<string>${PEPECLAW_PORT}</string>
<string>-s</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>${HOME}/.openclaw/pepeclaw/server.log</string>
<key>StandardErrorPath</key>
<string>${HOME}/.openclaw/pepeclaw/server.err</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:${HOME}/.nvm/versions/node/v20/bin</string>
</dict>
</dict>
</plist>
PLIST
launchctl load "$PLIST_FILE" 2>/dev/null || {
warn "Could not load launchd service. You may need to run:"
warn " launchctl load $PLIST_FILE"
}
ok "macOS LaunchAgent installed (starts on login)"
}
setup_systemd() {
SYSTEMD_DIR="$HOME/.config/systemd/user"
SERVICE_FILE="$SYSTEMD_DIR/pepeclaw.service"
PEPECLAW_DIR="$HOME/.openclaw/pepeclaw"
mkdir -p "$SYSTEMD_DIR"
NPX_PATH=$(command -v npx 2>/dev/null || echo "/usr/local/bin/npx")
cat > "$SERVICE_FILE" <<SERVICE
[Unit]
Description=PepeClaw 3D AI Agent Visualizer
After=network.target
[Service]
Type=simple
ExecStart=${NPX_PATH} serve ${PEPECLAW_DIR} -l ${PEPECLAW_PORT} -s
Restart=on-failure
RestartSec=5
Environment=PATH=/usr/local/bin:/usr/bin:/bin
[Install]
WantedBy=default.target
SERVICE
if command -v systemctl >/dev/null 2>&1; then
systemctl --user daemon-reload 2>/dev/null || true
systemctl --user enable pepeclaw.service 2>/dev/null || true
systemctl --user start pepeclaw.service 2>/dev/null || {
warn "Could not start systemd service. You may need to run:"
warn " systemctl --user start pepeclaw.service"
}
ok "systemd user service installed and started"
else
warn "systemctl not found. Service file written to $SERVICE_FILE"
warn "Start manually: npx serve $PEPECLAW_DIR -l $PEPECLAW_PORT -s"
fi
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Create Data Directories
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
create_data_dirs() {
info "Creating data directories..."
DATA_DIR="$HOME/.openclaw/data/pepe"
mkdir -p "$DATA_DIR"
DIRS=(
"skill-genome/fitness-logs"
"skill-genome/archives"
"skill-genome/crossovers"
"predictive-intent/patterns"
"predictive-intent/cache"
"predictive-intent/anomalies"
"dream-mode/dreams"
"dream-mode/morning-briefs"
"meta-learning/analysis"
"meta-learning/proposals"
"meta-learning/gaps"
"adversarial-red-team/challenges"
"adversarial-red-team/biases"
"adversarial-red-team/assumptions"
"adversarial-red-team/audits"
"project-war-room/health"
"project-war-room/velocity"
"project-war-room/triage"
"project-war-room/dependencies"
"temporal-arbitrage/scores"
"temporal-arbitrage/batches"
"temporal-arbitrage/deferrals"
"realtime-skill-creator/patterns"
"realtime-skill-creator/installs"
"skill-mutations"
"evolution-runs"
"execution-traces"
"self-scores"
"genetic-evolution/benchmarks"
"user-model"
"user-model/updates"
"user-model/insights"
)
for dir in "${DIRS[@]}"; do
mkdir -p "$DATA_DIR/$dir"
done
ok "Data directories created: $DATA_DIR"
printf "\n"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Write Default Configuration
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
write_config() {
CONFIG_FILE="$HOME/.openclaw/data/pepe/config.json"
if [ -f "$CONFIG_FILE" ]; then
warn "Configuration already exists. Skipping. (Delete $CONFIG_FILE to regenerate.)"
return
fi
info "Writing default configuration..."
cat > "$CONFIG_FILE" <<'CONFIG'
{
"version": "2.0.0",
"dream_mode": {
"enabled": true,
"schedule": "2-5",
"max_dreams": 200,
"promotion_threshold": 0.6
},
"meta_learning": {
"enabled": true,
"schedule": "nightly",
"auto_apply_proposals": false
},
"skill_genome": {
"evolution_cycle": "weekly",
"mutation_threshold": 0.2,
"prune_threshold": 0.05,
"rollback_window_days": 14
},
"war_room": {
"check_interval_hours": 6,
"auto_triage_threshold": 50,
"health_weights": {
"git_activity": 0.25,
"deploy_health": 0.20,
"issue_health": 0.20,
"blocker_status": 0.20,
"momentum": 0.15
}
},
"red_team": {
"challenge_threshold_cost": 1000,
"challenge_threshold_weeks": 1,
"monthly_hindsight_audit": true
},
"predictive_intent": {
"pattern_confidence_threshold": 0.7,
"pre_compute_before_minutes": 30,
"anomaly_sigma_threshold": 2,
"anomaly_window_days": 14
},
"temporal_arbitrage": {
"procrastination_threshold": 3,
"opportunity_cost_switch_threshold": 0.30,
"deadline_buffer_percent": 0.20
}
}
CONFIG
ok "Configuration written: $CONFIG_FILE"
printf "\n"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Set Up Cron Jobs
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
setup_cron() {
if [ "$HAS_CRON" != "true" ]; then
warn "Skipping cron setup (crontab not available)."
return
fi
info "Setting up scheduled tasks..."
SKILL_DIR="$WORKSPACE/skills"
CRON_MARKER="# Pepe 2.0 β Managed by install.sh"
EXISTING_CRON=$(crontab -l 2>/dev/null || true)
if echo "$EXISTING_CRON" | grep -q "$CRON_MARKER"; then
warn "Cron jobs already installed. Skipping. (Run 'crontab -e' to modify.)"
return
fi
NEW_CRON="$EXISTING_CRON
$CRON_MARKER
# Dream Mode: Run creative exploration at 3 AM daily
0 3 * * * $SKILL_DIR/dream-mode/scripts/dream-cycle.sh >> $HOME/.openclaw/data/pepe/dream-mode/cron.log 2>&1
# Meta-Learning: Nightly self-analysis at 1 AM
0 1 * * * $SKILL_DIR/meta-learning/scripts/conversation-analyzer.sh >> $HOME/.openclaw/data/pepe/meta-learning/cron.log 2>&1
# War Room: Health check every 6 hours
0 */6 * * * $SKILL_DIR/project-war-room/scripts/health-scorer.sh >> $HOME/.openclaw/data/pepe/project-war-room/cron.log 2>&1
# Skill Genome: Weekly evolution cycle on Sunday at 4 AM
0 4 * * 0 $SKILL_DIR/skill-genome/scripts/evolution-cycle.sh >> $HOME/.openclaw/data/pepe/skill-genome/cron.log 2>&1
# Predictive Intent: Pre-compute at 5:30 AM daily
30 5 * * * $SKILL_DIR/predictive-intent/scripts/pre-compute.sh >> $HOME/.openclaw/data/pepe/predictive-intent/cron.log 2>&1
# Adversarial Red Team: Monthly hindsight audit on the 1st at 2 AM
0 2 1 * * $SKILL_DIR/adversarial-red-team/scripts/contrarian-spawner.sh --audit >> $HOME/.openclaw/data/pepe/adversarial-red-team/cron.log 2>&1
# Genetic Evolution: Run evolution cycle every 6 hours
0 */6 * * * $SKILL_DIR/genetic-evolution/scripts/evolve.sh >> $HOME/.openclaw/data/pepe/genetic-evolution/cron.log 2>&1
$CRON_MARKER β END"
echo "$NEW_CRON" | crontab -
ok "Cron jobs installed (7 scheduled tasks)"
printf "\n"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Validate Installation
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
validate() {
info "Validating installation..."
SKILL_DIR="$WORKSPACE/skills"
DATA_DIR="$HOME/.openclaw/data/pepe"
ERRORS=0
for skill in skill-genome predictive-intent dream-mode meta-learning adversarial-red-team project-war-room temporal-arbitrage deep-search execution-trace openclaw-optimizer self-scoring skill-autocreator realtime-learning user-modeling realtime-skill-creator skill-mutator genetic-evolution dialectic-user-model; do
if [ -d "$SKILL_DIR/$skill" ] && [ -f "$SKILL_DIR/$skill/SKILL.md" ]; then
ok "Skill: $skill"
else
warn "Missing: $skill"
ERRORS=$((ERRORS + 1))
fi
done
if [ -d "$DATA_DIR" ]; then
dir_count=$(find "$DATA_DIR" -type d | wc -l | tr -d ' ')
ok "Data directories: $dir_count created"
else
warn "Data directory missing: $DATA_DIR"
ERRORS=$((ERRORS + 1))
fi
if [ -f "$DATA_DIR/config.json" ]; then
if jq . "$DATA_DIR/config.json" >/dev/null 2>&1; then
ok "Configuration: valid JSON"
else
warn "Configuration: invalid JSON"
ERRORS=$((ERRORS + 1))
fi
else
warn "Configuration file missing"
ERRORS=$((ERRORS + 1))
fi
# Check PepeClaw viewer
PEPECLAW_DIR="$HOME/.openclaw/pepeclaw"
if [ -f "$PEPECLAW_DIR/index.html" ]; then
ok "PepeClaw 3D Viewer: installed"
else
warn "PepeClaw 3D Viewer: not built"
ERRORS=$((ERRORS + 1))
fi
printf "\n"
if [ "$ERRORS" -gt 0 ]; then
warn "$ERRORS issue(s) detected. Installation may be incomplete."
else
ok "All checks passed!"
fi
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Open Browser
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
open_browser() {
PEPECLAW_URL="http://localhost:$PEPECLAW_PORT"
info "PepeClaw 3D Viewer available at: $PEPECLAW_URL"
# Wait briefly for server to start
sleep 2
OS="$(uname -s)"
case "$OS" in
Darwin)
open "$PEPECLAW_URL" 2>/dev/null || true
;;
Linux)
if command -v xdg-open >/dev/null 2>&1; then
xdg-open "$PEPECLAW_URL" 2>/dev/null || true
elif command -v sensible-browser >/dev/null 2>&1; then
sensible-browser "$PEPECLAW_URL" 2>/dev/null || true
fi
;;
esac
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Success Message
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
success_message() {
PEPECLAW_URL="http://localhost:$PEPECLAW_PORT"
printf "\n%s%s" "$GREEN$BOLD" ""
cat <<MSG
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β πΈ PepeClaw + Pepe 2.0 installed successfully! β
β β
β β¨ 3D Agent Viewer: β
β ${PEPECLAW_URL} β
β β
β Your agent starts evolving tonight. β
β β
β What happens next: β
β β’ 1:00 AM β Meta-Learning analyzes today β
β β’ 3:00 AM β Dream Mode explores new ideas β
β β’ 5:30 AM β Predictive Intent pre-computes β
β β’ Every 6h β War Room checks project health β
β β’ Weekly β Skill Genome evolves capabilities β
β β’ Monthly β Red Team runs hindsight audit β
β β
β Quick commands: β
β β’ openclaw skill genome report β
β β’ openclaw skill war-room status β
β β’ openclaw skill red-team challenge "topic" β
β β
β Config: ~/.openclaw/data/pepe/config.json β
β Docs: https://github.com/openclaw/pepe-2.0 β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MSG
printf "%s\n" "$RESET"
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Uninstall
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
uninstall() {
info "Uninstalling PepeClaw + Pepe 2.0..."
# Stop and remove auto-start
OS="$(uname -s)"
case "$OS" in
Darwin)
PLIST_FILE="$HOME/Library/LaunchAgents/$PEPECLAW_SERVICE_NAME.plist"
if [ -f "$PLIST_FILE" ]; then
launchctl unload "$PLIST_FILE" 2>/dev/null || true
rm -f "$PLIST_FILE"
ok "LaunchAgent removed"
fi
;;
Linux)
if command -v systemctl >/dev/null 2>&1; then
systemctl --user stop pepeclaw.service 2>/dev/null || true
systemctl --user disable pepeclaw.service 2>/dev/null || true
fi
rm -f "$HOME/.config/systemd/user/pepeclaw.service" 2>/dev/null || true
ok "Systemd service removed"
;;
esac
# Remove cron jobs
if command -v crontab >/dev/null 2>&1; then
EXISTING_CRON=$(crontab -l 2>/dev/null || true)
CLEANED_CRON=$(echo "$EXISTING_CRON" | sed '/# Pepe 2.0/,/# Pepe 2.0 β END/d')
echo "$CLEANED_CRON" | crontab -
ok "Cron jobs removed"
fi
# Detect workspace
if [ -n "${OPENCLAW_WORKSPACE:-}" ]; then
WORKSPACE="$OPENCLAW_WORKSPACE"
elif [ -d "$HOME/.openclaw/workspace" ]; then
WORKSPACE="$HOME/.openclaw/workspace"
else
WORKSPACE="$HOME/.openclaw"
fi
# Remove skills
for skill in skill-genome predictive-intent dream-mode meta-learning adversarial-red-team project-war-room temporal-arbitrage deep-search execution-trace openclaw-optimizer self-scoring skill-autocreator realtime-learning user-modeling realtime-skill-creator skill-mutator genetic-evolution dialectic-user-model; do
if [ -d "$WORKSPACE/skills/$skill" ]; then
rm -rf "$WORKSPACE/skills/$skill"
ok "Removed skill: $skill"
fi
done
# Remove PepeClaw viewer
if [ -d "$HOME/.openclaw/pepeclaw" ]; then
rm -rf "$HOME/.openclaw/pepeclaw"
ok "PepeClaw viewer removed"
fi
# Ask about data
printf "\n"
read -r -p "Remove data directory (~/.openclaw/data/pepe)? This deletes all fitness logs, dreams, and history. [y/N] " confirm
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
rm -rf "$HOME/.openclaw/data/pepe"
ok "Data directory removed"
else
info "Data directory preserved: ~/.openclaw/data/pepe"
fi
ok "PepeClaw + Pepe 2.0 uninstalled."
}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Main
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
main() {
banner
# Handle --uninstall flag
if [ "${1:-}" = "--uninstall" ] || [ "${1:-}" = "uninstall" ]; then
uninstall
exit 0
fi
# Handle --version flag
if [ "${1:-}" = "--version" ] || [ "${1:-}" = "-v" ]; then
echo "PepeClaw + Pepe 2.0 v$PEPE_VERSION"
exit 0
fi
info "Installing PepeClaw + Pepe 2.0 v$PEPE_VERSION"
printf "\n"
preflight
find_source
install_skills
create_data_dirs
write_config
setup_cron
build_pepeclaw
setup_autostart
validate
success_message
open_browser
}
main "$@"