Files
rose-ash/scripts/sx-loops-up.sh
giles fb72c4ab9c sx-loops: add common-lisp, apl, ruby, tcl (12 slots)
Plans + briefings for four new language loops, each with a delcc/JIT
showcase that the runtime already supports natively:

- common-lisp — conditions + restarts on delimited continuations
- apl — rank-polymorphic primitives + 6 operators on the JIT
- ruby — fibers as delcc, blocks/yield as escape continuations
- tcl — uplevel/upvar via first-class env chain, the Dodekalogue

Launcher scripts now spawn 12 windows (was 8).
2026-04-25 09:25:30 +00:00

108 lines
3.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Spawn 12 claude sessions in tmux, one per language loop.
# Each runs in its own git worktree rooted at /root/rose-ash-loops/<lang>,
# on branch loops/<lang>. No two loops share a working tree, so there's
# zero risk of file collisions between languages.
#
# Usage: ./scripts/sx-loops-up.sh [interval]
# interval defaults to self-paced (omit to let model decide)
#
# After the script prints done:
# tmux a -t sx-loops
# Ctrl-B + <window-number> to switch (0=lua ... 11=tcl)
# Ctrl-B + d to detach (loops keep running, SSH-safe)
#
# Stop: ./scripts/sx-loops-down.sh
# Wipe worktrees too: ./scripts/sx-loops-down.sh --clean
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
SESSION="sx-loops"
WORKTREE_BASE="/root/rose-ash-loops"
INTERVAL="${1:-}" # e.g. "15m", or empty for self-paced
BOOT_WAIT=20
if tmux has-session -t "$SESSION" 2>/dev/null; then
echo "Session '$SESSION' already exists."
echo " Attach: tmux a -t $SESSION"
echo " Kill: ./scripts/sx-loops-down.sh"
exit 1
fi
declare -A BRIEFING=(
[lua]=lua-loop.md
[prolog]=prolog-loop.md
[forth]=forth-loop.md
[erlang]=erlang-loop.md
[haskell]=haskell-loop.md
[js]=loop.md
[hs]=hs-loop.md
[smalltalk]=smalltalk-loop.md
[common-lisp]=common-lisp-loop.md
[apl]=apl-loop.md
[ruby]=ruby-loop.md
[tcl]=tcl-loop.md
)
ORDER=(lua prolog forth erlang haskell js hs smalltalk common-lisp apl ruby tcl)
mkdir -p "$WORKTREE_BASE"
echo "Preparing per-language worktrees under $WORKTREE_BASE ..."
for lang in "${ORDER[@]}"; do
wt="$WORKTREE_BASE/$lang"
branch="loops/$lang"
if [ -d "$wt/.git" ] || [ -f "$wt/.git" ]; then
echo " $lang: worktree exists at $wt"
else
# Create or reset the branch at current architecture HEAD, then add worktree
if git show-ref --verify --quiet "refs/heads/$branch"; then
git worktree add "$wt" "$branch" >/dev/null
else
git worktree add -b "$branch" "$wt" architecture >/dev/null
fi
echo " $lang: worktree created at $wt on $branch"
fi
done
# Create tmux session with one window per language, each cwd in its worktree
tmux new-session -d -s "$SESSION" -n "${ORDER[0]}" -c "$WORKTREE_BASE/${ORDER[0]}"
for lang in "${ORDER[@]:1}"; do
tmux new-window -t "$SESSION" -n "$lang" -c "$WORKTREE_BASE/$lang"
done
echo "Starting ${#ORDER[@]} claude sessions..."
for lang in "${ORDER[@]}"; do
tmux send-keys -t "$SESSION:$lang" "claude" C-m
done
echo "Waiting ${BOOT_WAIT}s for claude to boot..."
sleep "$BOOT_WAIT"
for lang in "${ORDER[@]}"; do
briefing="${BRIEFING[$lang]}"
if [ -n "$INTERVAL" ]; then
preamble="/loop $INTERVAL "
else
preamble="/loop "
fi
cmd="${preamble}Read plans/agent-briefings/$briefing and do ONE iteration per fire: pick the first unchecked [ ] from the plan, implement, test, commit with a short factual message, tick the box, append one dated line to the Progress log (newest first), then stop. You are on branch loops/$lang in worktree /root/rose-ash-loops/$lang; push commits to origin/loops/$lang (never main). Stay strictly in the briefing's scope."
tmux send-keys -t "$SESSION:$lang" "$cmd"
# tiny pause, then a second Enter — Claude's input box sometimes eats the first newline as a soft break
sleep 0.5
tmux send-keys -t "$SESSION:$lang" Enter
done
echo ""
echo "Done. ${#ORDER[@]} loops started in tmux session '$SESSION', each in its own worktree."
echo ""
echo " Attach: tmux a -t $SESSION"
echo " Switch: Ctrl-B <0..11> (0=lua 1=prolog 2=forth 3=erlang 4=haskell 5=js 6=hs 7=smalltalk 8=common-lisp 9=apl 10=ruby 11=tcl)"
echo " List: Ctrl-B w"
echo " Detach: Ctrl-B d"
echo " Stop: ./scripts/sx-loops-down.sh"
echo " Capture: tmux capture-pane -t $SESSION:<lang> -p | tail -40"
echo ""
echo "Worktrees:"
git worktree list | grep -E "rose-ash-loops/" || true