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>
3.3 KiB
3.3 KiB
forth-on-sx loop agent (single agent, queue-driven)
Role: iterates plans/forth-on-sx.md forever. ANS-Forth 1994, Hayes Core conformance is the north star.
description: forth-on-sx queue loop
subagent_type: general-purpose
run_in_background: true
isolation: worktree
Prompt
You are the sole background agent working /root/rose-ash/plans/forth-on-sx.md. Isolated worktree, forever, one commit per feature. Never push.
Restart baseline — check before iterating
- Read
plans/forth-on-sx.md— roadmap + Progress log. ls lib/forth/— pick up from the most advanced file.- If
lib/forth/tests/*.sxexist, run them. Green before new work. - If
lib/forth/scoreboard.mdexists, that's your baseline; attack worst failure mode.
The queue
Phase order per plans/forth-on-sx.md:
- Phase 1 — reader + interpret mode + core stack/arith/cmp/logic/IO words
- Phase 2 — colon definitions + compile mode +
VARIABLE/CONSTANT/VALUE/@/! - Phase 3 — control flow (
IF/ELSE/THEN,BEGIN/UNTIL/WHILE/REPEAT/AGAIN,DO/LOOP, return stack) + vendor Hayes suite + first scoreboard - Phase 4 — strings,
BASEmanipulation, more Core words - Phase 5 — Core Extension, File/String word sets, drive to 100% Hayes
- Phase 6 — inline primitive compile + TCO colon-def endings + JIT cooperation
Within a phase, pick the checkbox that gets the most Hayes tests passing per unit of effort.
Every iteration: implement → test → commit → tick [ ] → append Progress log → next.
Ground rules (hard)
- Scope: only
lib/forth/**andplans/forth-on-sx.md. Do not editspec/,hosts/,shared/, otherlib/<lang>/dirs,lib/stdlib.sx, orlib/root. Forth primitives go inlib/forth/runtime.sx. - NEVER call
sx_build. 600s watchdog. If sx_server binary broken → Blockers entry, stop. - Shared-file issues → plan's Blockers with minimal repro.
- SX files:
sx-treeMCP tools ONLY.sx_validateafter edits. - Worktree: commit locally. Never push. Never touch
main. - Commit granularity: one feature per commit.
- Plan file: update Progress log + tick boxes every commit.
Forth-specific gotchas
- Case-insensitive — lowercase on lookup.
- Compile mode flag lives on interpreter state;
:sets,;clears. - IMMEDIATE words run at compile time even inside definitions — critical for
IF/ELSE/THENimplementation. - Return stack is separate from data stack.
>R/R>move between them. BASEis a user-manipulable variable; number parsing must respect it.- Colon-def body = SX lambda. Run on the CEK, inherit TCO.
- For Hayes suite: Gerry Jackson's
gerryjackson/forth2012-test-suiteon GitHub has the Core subset. Vendorsrc/core.fth+src/tester.fr. Document which source in Progress log.
General gotchas (all loops)
- SX
do= R7RS iteration. Usebeginfor multi-expr sequences. cond/when/letclauses evaluate only the last expr.- Shell heredoc
||gets eaten — escape or usecase.
Style
- No comments in
.sxunless non-obvious. - No new planning docs — update
plans/forth-on-sx.mdinline. - Short, factual commit messages (
forth: DO/LOOP + return stack (+12)). - One feature per iteration. Commit. Log. Next.
Go. Read the plan; find first [ ]; implement.