You are the autonomous builder for open-dispatch, an open-source tool that lets agents (and
humans) dispatch prompts/messages to coding agents running in tmux windows — locally and across
machines — reliably. Repo: GitHub hasna/dispatch (public OSS), npm @hasna/dispatch, folder
~/workspace/hasna/opensource/open-dispatch. Drive this to DONE — do not stop until it is live
(published + working), with every "Done when" box verified.
We constantly drive coding agents (Claude Code, Codex/codewith, etc.) running in tmux windows by
tmux send-keys. Doing it by hand is unreliable: the Enter often doesn't submit (text sits in the
composer), long prompts get mangled, there's no delivery confirmation, and it doesn't work across
machines. open-dispatch makes this a first-class, reliable tool.
- Study sibling repos for structure/conventions (Bun+TS, CLI + MCP + daemon/server + SDK, tests,
docs, packaging):
~/workspace/hasna/opensource/open-todos(CLI+MCP+SDK+dashboard layout, AGENTS.md/CLAUDE.md, scripts, publishing) and others under~/workspace/hasna/opensource/open-*. - Integrate cross-machine via the open-machines SDK (
@hasna/machines) at~/workspace/hasna/opensource/open-machines— read its README/SDK to learn how to enumerate/reach machines (LAN/Tailscale/MagicDNS) so a dispatch can target a tmux window on another host. - Follow
~/.claude/rules/(TDD, secrets scan before every commit/push, conventional commits, NO Co-Authored-By, patch-version bumps, Bun over npm, use theprojectsCLI for repo create/publish).
- Dispatch to a tmux target.
dispatch send --to <session:window> --prompt "..."(and--filefor long prompts). Types the prompt into the target pane and submits it. - Reliable auto-submit (THE key feature). Solve the flaky-Enter problem: after typing/pasting the prompt, auto-calculate a delay from the prompt's word/char count (longer text → longer wait) so the full text is registered by the target TUI before pressing Enter, then press Enter — and if it didn't submit, retry Enter. Make submission deterministic regardless of prompt length.
- Long prompts. Handle large multi-line prompts without corruption (prefer paste/bracketed-paste or chunked send; avoid newline-triggered premature submits).
- Delivery confirmation (smart). After dispatching, verify it was actually received/submitted
— capture the target pane before/after, detect that the agent started processing (e.g. the TUI
footer changed to a "working/esc-to-interrupt" state and the composer cleared), and return a clear
delivered/not-delivered status (with a reason). Expose
dispatch status <id>. - Cross-machine. Using
@hasna/machines, dispatch to a tmux window on another machine (dispatch send --machine spark01 --to <session:window> ...) over SSH/Tailscale; sync machine inventory via the open-machines SDK. Works for the 5 machines (spark01/02, apple01/03/06). - Scheduled dispatches.
dispatch schedule --at <time>|--cron <expr> --to ... --prompt ...— queue a dispatch to fire later; list/cancel scheduled dispatches. - Live daemon. A background daemon that owns the dispatch queue, scheduled dispatches,
cross-machine routing, and delivery tracking (
dispatch daemon start|stop|status). Persist state (so scheduled dispatches survive restarts). - Surfaces (mirror open-todos): a first-class CLI, an MCP server (every verb as a tool so
agents dispatch via MCP), an SDK (
@hasna/dispatchprogrammatic API), and the daemon.
- Bun + TypeScript. TDD throughout — tests first, full suite green, nothing skipped.
- Model package layout, scripts, MCP/CLI parity, and publishing on
open-todos. - Secrets: never hardcode; scan staged files before every commit/push.
- Create the GitHub repo via the
projectsCLI (projects workspaces import <path>thenprojects workspaces publish, orimport-github) → hasna/dispatch (public). Register in todos. - Publish
@hasna/dispatchto npm (public access, patch version).bun install -g @hasna/dispatchand verify the CLI works. - Use
/skill-goal-execute(/gosl): create a todos plan under the open-dispatch project and execute tasks one by one, verifying each. Keep todos + the conversations space updated.
-
bun run buildclean; fullbun testgreen (nothing skipped). — 140 tests pass across 23 files. -
dispatch sendreliably delivers a prompt to a tmux window AND auto-submits it, verified with a long multi-paragraph prompt (no premature submit, no mangling), with delivery confirmed. —src/e2e.integration.test.tsrecords a 5-paragraph prompt byte-for-byte off a real pane; verified again against the builtdistCLI. - Delivery-confirmation reports delivered/not-delivered correctly (test against a real tmux pane). —
src/lib/confirm.integration.test.ts(working-state detected vs unsent prompt). - Scheduled dispatch fires at the scheduled time; daemon runs and survives restart. —
src/daemon/daemon.integration.test.ts(fires + delivers; schedule survives a full daemon restart). - Cross-machine dispatch works. —
src/cross-machine.integration.test.tsdispatches to a tmux pane on spark01 over Tailscale via@hasna/machines; delivered + confirmed. - Published:
npm view @hasna/dispatchshows0.0.1; installs + runs (verified on spark02 + apple03). GitHub hasna/dispatch is public (default branchmain). - todos plan complete; final summary posted to the conversations space.