Innovation Engine — automation

Bounded-Email Reply Radar

May 24, 2026

A 10-minute cron that scans Gmail for replies to threads currently blocked by bounded-email state and auto-acks them, so async-loops never silently stall waiting on threads the human already answered. Closes the gap between human reply cadence and the hook's pending-thread tracking — the #1 cause of async-loops going quiet without you noticing.

bounded-email-hookasync-loopgws-clinotify-focus

Create ~/bin/bounded-email-reply-radar (bash, ~60 lines): (1) read pending threads from ~/.local/state/bounded-email/*.json, extract (account, threadId) pairs; (2) for each, call gws via env GOOGLE_WORKSPACE_CLI_CONFIG_DIR=/home/ethan/.config/gws- /home/ethan/.npm-global/bin/gws gmail users threads get --params '{"userId":"me","id":"","format":"metadata"}' and check if messages.length > 1 AND last message's From != self; (3) if reply detected, run bounded-email-ack and notify-focus 'Reply detected on — async-loop unblocked'; (4) write companion .test.bats with fixture state files. Add safe crontab line: */10 * * * * /home/ethan/bin/bounded-email-reply-radar >> ~/.local/state/bounded-email/radar.log 2>&1. Connects async-loop's email-only outbound discipline with the actual inbox state — the missing feedback edge in the loop.

Built & Ready
Done. Summary:

**Bounded-Email Reply Radar — shipped**

- **`~/bin/bounded-email-reply-radar`** (72 lines, executable) — scans `~/.local/state/bounded-email/*.json`, maps each `account` to its `gws` config dir, fetches each pending thread's metadata via `gws gmail users threads get`, and treats a thread as replied when the last message lacks the `SENT` label. On reply: calls `bounded-email-ack <tid>` and pings `notify-focus`. All paths overridable via env (`GWS_BIN`, `ACK_BIN`, `NOTIFY_BIN`, `BOUNDED_EMAIL_STATE_DIR`) so the bats suite can stub them.
- **`~/bin/bounded-email-reply-radar.test.bats`** — 4 hermetic tests covering reply detected, sent-only no-op, missing state dir, unknown account. All green.
- **Cron installed:** `*/10 * * * * /home/ethan/bin/bounded-email-reply-radar >> ~/.local/state/bounded-email/radar.log 2>&1` (added via dedup-append; pre-existing `bounded-email-tablet-brief` cron untouched).
- **First live run unblocked one real thread** (`bys/19e56f8e1cfda8a4` — "Phase 18 plan: self-improvement daemon"), confirming the feedback edge async-loops were missing.
Active Projects
innovation-engine, russ-telegram, joyos-labs-monitor, linkedin-engine, .claude
Category
automation