updates

ober

3a72ac08efa8e92f4169bbd4032ad37c36387187

diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..d9812a5
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,52 @@
+# AGENTS.md for jerboa-$app Repositories
+
+These instructions apply to agents working in this repository.
+
+## Language: Jerboa ONLY
+
+All code in any `jerboa-*` directory or repository must be written in **Jerboa**
+— `.ss` files using `(jerboa prelude)`, `def`, `defstruct`, the Jerboa reader
+extras (`[...]` lists, `{...}` method dispatch, `keyword:` args), and
+`(std ...)` modules. The Jerboa toolchain compiles `.ss` → `.sls`.
+
+Never write raw Chez `.sls` files with `#!chezscheme` + R6RS
+`define`/`define-record-type`/`(library ...)` forms, and never write the
+application logic in another language (shell, Python, Rust, etc.) — that
+bypasses Jerboa entirely and defeats the purpose of these repos.
+
+## Build Contract
+
+The Makefile must provide these targets:
+
+- `make` prints the available targets. It must not build, install, test, or mutate artifacts.
+- `make binary` builds the application binary for the local host OS and architecture.
+- `make linux-amd64` cross-builds the Linux amd64 binary from the current host.
+- `make linux-arm64` cross-builds the Linux arm64 binary from the current host.
+- `make freebsd-amd64` cross-builds the FreeBSD amd64 binary from the current host.
+
+The cross-build targets must use the local cross toolchains and Jerboa/Chez
+cross-build setup. Never use Docker or Podman for building, testing, smoke
+testing, packaging, or verifying these targets.
+
+## Required Verification
+
+Before committing or pushing any code, all required build targets must succeed:
+
+```sh
+make
+make binary
+make linux-amd64
+make linux-arm64
+make freebsd-amd64
+```
+
+Do not commit or push if any target fails. If a cross-build cannot run because
+the host is missing a required toolchain or sysroot, stop and report the missing
+dependency instead of committing or pushing partially verified code.
+
+## Working Rules
+
+- Keep changes inside the current repository unless the user explicitly names another path.
+- Preserve the target semantics above when editing the Makefile.
+- Treat the cross-build targets as release-critical, not optional follow-up work.
+- Do not add Dockerfiles, container scripts, Podman invocations, or container-based verification paths.
diff --git a/Makefile b/Makefile
index 7612b52..50a449a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,12 @@
 # jerboa-coreutils Makefile
 # Gerbil-like coreutils on Chez Scheme via Jerboa
 
-SCHEME = scheme
+# Use the scheme-script wrapper from /usr/local/bin if available, otherwise use 'scheme'
+SCHEME ?= scheme
+
+# Override CHEZ_DIR if Chez is not in default location
+CHEZ_DIR ?= 
+
 JERBOA_LIB = $(HOME)/mine/jerboa/lib
 LIB_DIR = $(CURDIR)/lib
 BIN_DIR = $(CURDIR)/bin
@@ -46,7 +51,7 @@ all: binary
 # Native multi-call binary (BusyBox-style, self-contained ELF)
 binary: $(SUPPORT_DIR)/libcoreutils.so
 	@mkdir -p $(BIN_DIR)
-	PROJECT_DIR=$(CURDIR) $(SCHEME) --libdirs "$(CHEZSCHEMELIBDIRS)" -q < build-binary.ss
+	CHEZ_DIR=$(CHEZ_DIR) PROJECT_DIR=$(CURDIR) $(SCHEME) --libdirs "$(CHEZSCHEMELIBDIRS)" -q < build-binary.ss
 
 # Legacy: build C shim + generate interpreter wrapper scripts
 build: $(SUPPORT_DIR)/libcoreutils.so $(BIN_DIR)/.generated
@@ -61,8 +66,11 @@ $(BIN_DIR)/.generated: $(wildcard $(LIB_DIR)/jerboa-coreutils/*.sls)
 		echo 'SCRIPT_DIR=$$(cd "$$(dirname "$$0")/.." && pwd)' >> $(BIN_DIR)/$$util; \
 		echo 'export CHEZSCHEMELIBDIRS="$$SCRIPT_DIR/lib:$(JERBOA_LIB)"' >> $(BIN_DIR)/$$util; \
 		echo 'export LD_LIBRARY_PATH="$$SCRIPT_DIR/support:$$LD_LIBRARY_PATH"' >> $(BIN_DIR)/$$util; \
+		if [ -n "$(CHEZ_DIR)" ]; then \
+			echo "export CHEZ_DIR='$(CHEZ_DIR)'" >> $(BIN_DIR)/$$util; \
+		fi; \
 		echo 'exec $(SCHEME) --libdirs "$$CHEZSCHEMELIBDIRS" --program "$$SCRIPT_DIR/bin/'"$$util"'.sps" "$$@"' >> $(BIN_DIR)/$$util; \
-		chmod +x $(BIN_DIR)/$$util; \
+	(chmod +x $(BIN_DIR)/$$util); \
 		if [ ! -f $(BIN_DIR)/$$util.sps ]; then \
 			echo '#!chezscheme' > $(BIN_DIR)/$$util.sps; \
 			echo "(import (except (chezscheme) make-hash-table hash-table? iota 1+ 1- getenv path-extension path-absolute? thread? make-mutex mutex? mutex-name))" >> $(BIN_DIR)/$$util.sps; \