Files
rose-ash/plans/restore-lib-guest.sh
giles 9dd9fb9c37 plans: layered-stack framing + chisel sequence + loop scaffolding
Design + ops scaffolding for the next phase of work, none of it touching
substrate or guest code.

lib-guest.md: rewrites Architectural framing as a 5-layer stack
  (substrate → lib/guest → languages → shared/ → applications),
  recursive dependency-direction rule, scaled two-consumer rule. Adds
  Phase B (long-running stratification) with sub-layer matrix
  (core/typed/relational/effects/layout/lazy/oo), language profiles, and
  the long-running-discipline section. Preserves existing Phase A
  progress log and rules.

ocaml-on-sx.md: scope reduced to substrate validation + HM + reference
  oracle. Phases 1-5 + minimal stdlib slice + vendored testsuite slice.
  Dream carved out into dream-on-sx.md; Phase 8 (ReasonML) deferred.
  Records lib-guest sequencing dependency.

datalog-on-sx.md: adds Phase 4 built-in predicates + body arithmetic,
  Phase 6 magic sets, safety analysis in Phase 3, Non-goals section.

New chisel plans (forward-looking, not yet launchable):
  kernel-on-sx.md       — first-class everything, env-as-value endgame
  idris-on-sx.md        — dependent types, evidence chisel
  probabilistic-on-sx.md — weighted nondeterminism + traces
  maude-on-sx.md        — rewriting as primitive
  linear-on-sx.md       — resource model, artdag-relevant

Loop briefings (4 active, 1 cold):
  minikanren-loop.md, ocaml-loop.md, datalog-loop.md, elm-loop.md, koka-loop.md

Restore scripts mirror the loop pattern:
  restore-{minikanren,ocaml,datalog,jit-perf,lib-guest}.sh
  Each captures worktree state, plan progress, MCP health, tmux status.
  Includes the .mcp.json absolute-path patch instruction (fresh worktrees
  have no _build/, so the relative mcp_tree path fails on first launch).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 22:27:50 +00:00

108 lines
3.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# restore-lib-guest.sh — print recovery state for the lib/guest extraction loop.
#
# The loop runs as a Claude Code instance inside a tmux session named `lib-guest`.
# This script shows you where things stand. To respawn, see the bottom of the output.
#
# Usage:
# bash plans/restore-lib-guest.sh # status snapshot
# bash plans/restore-lib-guest.sh --print # also cat the briefing
#
set -uo pipefail
cd "$(dirname "$0")/.."
echo "=== lib/guest loop state ==="
echo
echo "Branch: $(git rev-parse --abbrev-ref HEAD)"
echo "HEAD: $(git log -1 --oneline)"
echo
echo "=== Recent commits on lib/guest/, canaries, and plan ==="
git log -15 --oneline -- lib/guest/ lib/lua/ lib/prolog/ lib/common-lisp/ lib/haskell/ lib/tcl/ plans/lib-guest.md plans/agent-briefings/lib-guest-loop.md 2>/dev/null \
|| echo " (none yet)"
echo
echo "=== lib/guest/ contents ==="
if [ -d lib/guest ]; then
ls -1 lib/guest/ 2>/dev/null | sed 's/^/ /'
else
echo " (lib/guest/ does not exist yet — Step 0 not started)"
fi
echo
echo "=== Baseline snapshots ==="
if [ -d lib/guest/baseline ]; then
for f in lib/guest/baseline/*.json; do
[ -f "$f" ] || continue
name=$(basename "$f" .json)
totals=$(python3 -c "import json,sys
try:
d=json.load(open('$f'))
t=d.get('totals',d.get('overall',{}))
if t: print(f\"pass={t.get('pass','?')} fail={t.get('fail','?')}\")
else: print('(no totals)')
except Exception as e: print(f'(read error: {e})')" 2>/dev/null)
printf " %-14s %s\n" "$name" "$totals"
done
else
echo " (lib/guest/baseline/ does not exist yet — Step 0 not done)"
fi
echo
echo "=== Plan progress (status column) ==="
if [ -f plans/lib-guest.md ]; then
awk '/^\| Step \|/,/^$/' plans/lib-guest.md | grep -E '^\| [0-9]' | sed 's/^/ /' || true
else
echo " plans/lib-guest.md NOT found"
fi
echo
echo "=== sx_server.exe ==="
if [ -x hosts/ocaml/_build/default/bin/sx_server.exe ]; then
echo " ✓ built"
else
echo " ✗ NOT built — guest conformance runners need it. Run: sx_build target=ocaml"
fi
echo
echo "=== tmux session 'lib-guest' ==="
if command -v tmux >/dev/null && tmux has-session -t lib-guest 2>/dev/null; then
echo " ✓ session live"
echo " Attach: tmux attach -t lib-guest"
echo " Last 8 visible lines:"
tmux capture-pane -t lib-guest -p 2>/dev/null \
| grep -v '^[[:space:]]*$' \
| tail -8 \
| sed 's/^/ /'
else
echo " ✗ session not running"
fi
echo
echo "=== Briefing ==="
[ -f plans/agent-briefings/lib-guest-loop.md ] \
&& echo " plans/agent-briefings/lib-guest-loop.md" \
|| echo " briefing NOT found"
echo
echo "=== To respawn ==="
cat <<'EOF'
If the tmux session died:
tmux new-session -d -s lib-guest -c /root/rose-ash
tmux send-keys -t lib-guest 'claude' Enter
# wait until the Claude UI box appears, then:
tmux send-keys -t lib-guest 'You are the lib/guest extraction loop runner. Read /root/rose-ash/plans/agent-briefings/lib-guest-loop.md in full and follow the iteration protocol indefinitely. Resume from the first pending step in the plan. Branch: architecture. Never push, never touch main.' Enter Enter
If the session is alive but stuck, attach with `tmux attach -t lib-guest` and
unstick manually. The plan file is the source of truth — the loop reads it
fresh every iteration and picks up wherever the queue left off.
EOF
if [ "${1:-}" = "--print" ]; then
echo
echo "=== Briefing contents ==="
[ -f plans/agent-briefings/lib-guest-loop.md ] && cat plans/agent-briefings/lib-guest-loop.md
fi