#!/bin/sh # LLM backend that hands each prompt to whoever watches $MAILBOX: # prompt-N.md goes out, the reply is read from reply-N.md. For driving # the generator from an agent session, or by hand. set -eu : "${MAILBOX:?set MAILBOX to a directory}" mkdir -p "$MAILBOX" n=$(( $(ls "$MAILBOX" | grep -c '^prompt-' || true) + 1 )) cat > "$MAILBOX/prompt-$n.md" until [ -s "$MAILBOX/reply-$n.md" ]; do sleep 2; done sleep 1 cat "$MAILBOX/reply-$n.md"