Five new guest-language plans mirroring the js-on-sx / hs-loop pattern, each with a phased roadmap (Progress log + Blockers), a self-contained agent briefing for respawning a long-lived loop, and a shared restore-all.sh that snapshots state across all seven language loops. Briefings bake in the lessons from today's stall debugging: never call sx_build (600s watchdog), only touch lib/<lang>/** + own plan file, commit every feature, update Progress log on each commit, route shared-file issues to Blockers rather than fixing them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
102 lines
4.0 KiB
Bash
Executable File
102 lines
4.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# restore-all.sh — snapshot recovery state for every language loop.
|
|
#
|
|
# Shows: per-language branch, recent commits, test/scoreboard status, plan progress.
|
|
# Points at the briefing file for each language. To respawn a loop, paste the
|
|
# briefing into Claude via the Agent tool with run_in_background=true and
|
|
# isolation=worktree.
|
|
#
|
|
# Usage:
|
|
# bash plans/restore-all.sh # status for all languages
|
|
# bash plans/restore-all.sh <lang> # one language (js|hs|lua|prolog|forth|erlang|haskell)
|
|
# bash plans/restore-all.sh --print # also cat each briefing
|
|
#
|
|
set -uo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
LANGS=(js hs lua prolog forth erlang haskell)
|
|
FILTER="${1:-}"
|
|
PRINT=""
|
|
if [ "$FILTER" = "--print" ]; then PRINT="yes"; FILTER=""; fi
|
|
|
|
snap_one() {
|
|
local lang="$1"
|
|
local plan
|
|
local dir
|
|
local scoreboard
|
|
local tests_cmd
|
|
local briefing
|
|
|
|
case "$lang" in
|
|
js) plan="plans/js-on-sx.md"; dir="lib/js"; scoreboard="lib/js/test262-scoreboard.md"; briefing="plans/agent-briefings/loop.md"; tests_cmd="bash lib/js/test.sh";;
|
|
hs) plan="plans/hs-conformance-to-100.md"; dir="lib/hyperscript"; scoreboard="plans/hs-conformance-scoreboard.md"; briefing="plans/agent-briefings/hs-loop.md"; tests_cmd="bash lib/hyperscript/test.sh";;
|
|
lua) plan="plans/lua-on-sx.md"; dir="lib/lua"; scoreboard="lib/lua/scoreboard.md"; briefing="plans/agent-briefings/lua-loop.md"; tests_cmd="bash lib/lua/conformance.sh";;
|
|
prolog) plan="plans/prolog-on-sx.md"; dir="lib/prolog"; scoreboard="lib/prolog/scoreboard.md"; briefing="plans/agent-briefings/prolog-loop.md"; tests_cmd="bash lib/prolog/conformance.sh";;
|
|
forth) plan="plans/forth-on-sx.md"; dir="lib/forth"; scoreboard="lib/forth/scoreboard.md"; briefing="plans/agent-briefings/forth-loop.md"; tests_cmd="bash lib/forth/conformance.sh";;
|
|
erlang) plan="plans/erlang-on-sx.md"; dir="lib/erlang"; scoreboard="lib/erlang/scoreboard.md"; briefing="plans/agent-briefings/erlang-loop.md"; tests_cmd="bash lib/erlang/conformance.sh";;
|
|
haskell) plan="plans/haskell-on-sx.md"; dir="lib/haskell"; scoreboard="lib/haskell/scoreboard.md"; briefing="plans/agent-briefings/haskell-loop.md"; tests_cmd="bash lib/haskell/conformance.sh";;
|
|
*) echo "unknown lang: $lang"; return 1;;
|
|
esac
|
|
|
|
echo "=== $lang ==="
|
|
if [ -f "$plan" ]; then
|
|
echo "plan: $plan"
|
|
else
|
|
echo "plan: (missing)"
|
|
fi
|
|
if [ -f "$briefing" ]; then
|
|
echo "briefing: $briefing"
|
|
else
|
|
echo "briefing: (missing — cannot respawn)"
|
|
fi
|
|
if [ -d "$dir" ]; then
|
|
echo "dir: $dir ($(find "$dir" -type f 2>/dev/null | wc -l) files)"
|
|
else
|
|
echo "dir: $dir (does not exist yet)"
|
|
fi
|
|
if [ -f "$scoreboard" ]; then
|
|
echo "scoreboard: $scoreboard"
|
|
head -3 "$scoreboard" | sed 's/^/ /'
|
|
else
|
|
echo "scoreboard: (not yet generated)"
|
|
fi
|
|
echo "recent commits (vs main):"
|
|
git log --oneline "main..HEAD" -- "$dir" "$plan" 2>/dev/null | head -5 | sed 's/^/ /' || echo " (none)"
|
|
echo
|
|
}
|
|
|
|
echo "=== environment ==="
|
|
echo "branch: $(git rev-parse --abbrev-ref HEAD)"
|
|
echo "HEAD: $(git log -1 --oneline)"
|
|
if [ -x hosts/ocaml/_build/default/bin/sx_server.exe ]; then
|
|
echo "sx_server: present"
|
|
else
|
|
echo "sx_server: MISSING — build with ./scripts/sx-build-all.sh before spawning any agent"
|
|
fi
|
|
echo "worktrees: $(git worktree list | wc -l)"
|
|
echo
|
|
|
|
if [ -n "$FILTER" ]; then
|
|
snap_one "$FILTER"
|
|
else
|
|
for l in "${LANGS[@]}"; do snap_one "$l"; done
|
|
fi
|
|
|
|
echo "=== to spawn a loop ==="
|
|
echo "Paste the target briefing into Claude via the Agent tool with"
|
|
echo " run_in_background: true"
|
|
echo " isolation: worktree"
|
|
echo "The briefing is self-contained; the agent reads the plan's Progress log"
|
|
echo "and picks up from wherever the last commit left off."
|
|
|
|
if [ "$PRINT" = "yes" ]; then
|
|
echo
|
|
echo "=== all briefings ==="
|
|
for f in plans/agent-briefings/*.md; do
|
|
echo
|
|
echo "---- $f ----"
|
|
cat "$f"
|
|
done
|
|
fi
|