Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

fix(ops-inbox): start drafting in the parent session (#1000)

Aurora Capitalced81bf25a53
diff --git a/claude-ops/CHANGELOG.md b/claude-ops/CHANGELOG.md
index 298d44b4..5455063d 100644
--- a/claude-ops/CHANGELOG.md
+++ b/claude-ops/CHANGELOG.md
@@ -2,6 +2,18 @@
## Unreleased
+### Fixed
+- `/ops:ops-inbox` no longer forks the whole skill into a background agent.
+ Drafting now starts in the parent session on the slash command itself, so
+ the owner does not have to type "continue drafting". Scanners still fan
+ out; sends stay in the parent (Rule 6). Guard:
+ `tests/test-ops-inbox-parent-autodraft.sh`.
+- Inbox workers report to the parent every 30 seconds by default. A
+ heartbeat script (`bin/ops-inbox-parent-heartbeat.sh`) exits with one
+ `INBOX HEARTBEAT` line so the parent prints it and relaunches; scanners
+ `SendMessage` on the same cadence. Guard:
+ `tests/test-ops-inbox-parent-heartbeat.sh`.
+
## [3.10.20] - 2026-09-17
### Fixed
diff --git a/claude-ops/bin/ops-inbox-parent-heartbeat.sh b/claude-ops/bin/ops-inbox-parent-heartbeat.sh
new file mode 100755
index 00000000..7f73c708
--- /dev/null
+++ b/claude-ops/bin/ops-inbox-parent-heartbeat.sh
@@ -0,0 +1,96 @@
+#!/usr/bin/env bash
+# Sleep INTERVAL (default 30s), print one INBOX HEARTBEAT line, exit 0.
+# The parent launches this with Bash run_in_background at the start of
+# /ops:ops-inbox. The job's exit IS the ping — relaunch immediately.
+set -u
+
+INTERVAL="${OPS_INBOX_HEARTBEAT_SEC:-30}"
+ONCE=0
+SCAN_JSON="${OPS_INBOX_SCAN_JSON:-/tmp/ops-inbox-scan-clean.json}"
+KEEP_JSON="${OPS_INBOX_KEEP_JSON:-/tmp/ops-inbox-keep.json}"
+
+usage() {
+ cat <<'EOF'
+ops-inbox-parent-heartbeat.sh — one 30s ping for the parent inbox session
+
+ --once print now, do not sleep
+ --interval N sleep N seconds (default 30, or OPS_INBOX_HEARTBEAT_SEC)
+ --scan-json PATH ops-inbox-scan JSON (default /tmp/ops-inbox-scan-clean.json)
+ --keep-json PATH keep JSON (default /tmp/ops-inbox-keep.json)
+ -h, --help
+
+Exit 0 after printing one INBOX HEARTBEAT line. The parent relaunches.
+EOF
+}
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --once) ONCE=1; shift ;;
+ --interval)
+ if [ $# -lt 2 ]; then echo "ops-inbox-parent-heartbeat: --interval requires a value" >&2; exit 2; fi
+ INTERVAL="$2"; shift 2
+ ;;
+ --scan-json)
+ if [ $# -lt 2 ]; then echo "ops-inbox-parent-heartbeat: --scan-json requires a value" >&2; exit 2; fi
+ SCAN_JSON="$2"; shift 2
+ ;;
+ --keep-json)
+ if [ $# -lt 2 ]; then echo "ops-inbox-parent-heartbeat: --keep-json requires a value" >&2; exit 2; fi
+ KEEP_JSON="$2"; shift 2
+ ;;
+ -h|--help) usage; exit 0 ;;
+ *) echo "ops-inbox-parent-heartbeat: unknown arg '$1'" >&2; exit 2 ;;
+ esac
+done
+
+case "$INTERVAL" in
+ ''|*[!0-9]*) echo "ops-inbox-parent-heartbeat: interval must be an integer" >&2; exit 2 ;;
+esac
+
+if [ "$ONCE" -eq 0 ]; then
+ sleep "$INTERVAL"
+fi
+
+summary="$(python3 - "$SCAN_JSON" "$KEEP_JSON" <<'PY'
+import json, sys
+scan_path, keep_path = sys.argv[1], sys.argv[2]
+keep = waiting = "?"
+nxt = "-"
+
+def load(path):
+ try:
+ with open(path) as f:
+ data = json.load(f)
+ return data if isinstance(data, dict) else None
+ except (OSError, ValueError, TypeError):
+ return None
+
+def as_list(v):
+ if isinstance(v, list):
+ return v
+ if isinstance(v, dict):
+ return list(v.values())
+ return []
+
+def who(rows):
+ rows = as_list(rows)
+ if rows and isinstance(rows[0], dict):
+ return rows[0].get("who") or rows[0].get("from") or rows[0].get("name") or "-"
+ return "-"
+
+scan = load(scan_path)
+keepj = load(keep_path)
+if keepj is not None and ("keep" in keepj or "archive" in keepj):
+ kr, ar = as_list(keepj.get("keep")), as_list(keepj.get("archive") or keepj.get("waiting"))
+ keep, waiting, nxt = len(kr), len(ar), who(kr)
+elif isinstance(scan, dict):
+ wa, em = scan.get("whatsapp") or {}, scan.get("email") or {}
+ nr = as_list(wa.get("needs_reply")) + as_list(em.get("needs_reply"))
+ wt = as_list(wa.get("waiting")) + as_list(em.get("waiting"))
+ keep, waiting, nxt = len(nr), len(wt), who(nr)
+print(f"keep={keep} waiting={waiting} next={nxt}")
+PY
+)" || summary="keep=? waiting=? next=-"
+
+echo "INBOX HEARTBEAT after=${INTERVAL}s ${summary}"
+exit 0
diff --git a/claude-ops/skills/ops-inbox/SKILL.md b/claude-ops/skills/ops-inbox/SKILL.md
index 869a1408..0b4ae32c 100644
--- a/claude-ops/skills/ops-inbox/SKILL.md
+++ b/claude-ops/skills/ops-inbox/SKILL.md
@@ -56,13 +56,54 @@ allowed-tools:
- mcp__plugin_imessage_imessage__reply
effort: high
maxTurns: 60
-context: fork
---
# OPS ► INBOX ZERO
Load `ops-rules` before acting. Public repo (no personal data). Outbound: one draft → one approval → one send. If `AskUserQuestion` / `Workflow` are missing, follow Rule 10 in `ops-rules` (Hermes: numbered options / two-turn Telegram card; `delegate_task`).
+## Parent session: AUTO-START DRAFTING
+
+This skill MUST run in the parent session. Never set `context: fork` — that
+parks the whole run (including drafts) in a background agent, so the parent
+idles until the owner types "continue drafting". Measured 2026-09-21.
+
+**Always report to the main agent by default.** Every Agent / Workflow /
+forked worker this skill launches returns KEEP rows, thread arcs, and draft
+text to the parent. It never `AskUserQuestion`, never numbered-options the
+owner, never waits for "continue". If this skill itself was spawned as a
+subagent, the same rule: the last message is a report for the parent, not a
+card for the owner.
+
+**30-second parent heartbeat (default).** At the start of every run, launch:
+
+```bash
+"$CLAUDE_PLUGIN_ROOT/bin/ops-inbox-parent-heartbeat.sh"
+```
+
+via Bash `run_in_background: true`. Default interval is 30 seconds
+(`OPS_INBOX_HEARTBEAT_SEC`). The job sleeps, prints one `INBOX HEARTBEAT`
+line, and exits. **The job's exit IS the ping to this parent session.**
+When it fires: print that line to the owner, then relaunch the same
+command. Never wait for the owner to ask for a status.
+
+Every background worker also `SendMessage`s the parent at least every 30
+seconds with one line (`channel=… keep=… drafting=…`). That is the
+default, not an opt-in.
+
+On `/ops:ops-inbox` / `/ops-inbox`, start drafting in THIS session without a
+second prompt:
+
+1. Kick the cheap scan (`ops-inbox-scan`) and fan-out readers immediately.
+2. The moment the first KEEP / NEEDS_REPLY exists (scan JSON, keep.md,
+ thread_tail, or a reader returning), stage that draft. Do not wait for
+ the rest of the inbox.
+3. Queue further drafts as readers land. One draft → one approval → one send.
+4. Never wait for "continue drafting", "go", or "next?". The slash command
+ is the start signal.
+
+Scanners stay background and read-only. Sends never leave the parent.
+
## ⚠️ WHATSAPP TRANSPORT — MCP ONLY, NEVER `wacli`
For **all** WhatsApp operations in this skill (list chats, read messages, search contacts, send replies, archive chats), use the `mcp__whatsapp__*` tool family backed by the whatsmeow (Go) whatsapp-bridge — upstream `lharries/whatsapp-mcp`. (Earlier docs misnamed this as "Baileys" — Baileys is the Node.js WhatsApp library; this bridge uses `go.mau.fi/whatsmeow`.)
@@ -150,8 +191,8 @@ Every run, in order:
2b. **Every other channel in the same pass, in parallel:** iMessage/SMS (`$HERMES_HOME/bin/imessage-inbox-scan --days 30` — copies `-wal`/`-shm` first or recent messages are invisible; alphanumeric shortcodes and OTP bodies are `fyi`, never `needs_reply`). Slack: `channels_me {channel_types:"im,mpim"}` then `conversations_history` per human DM, never `conversations_unreads` — unread is never a filter (Sam, 2026-09-17), a DM he read on his phone and never answered stays invisible to an unread listing. Telegram user dialogs if configured. Email is already in the scan. A miss on one channel is not absence on another.
3. **All-context sweep** (Rule 9 + `references/details.md` "ALL CONTEXT SOURCES"): query every configured calendar, mailbox, and messaging channel before any schedule claim or NEEDS_REPLY draft. Google Calendar alone is not enough — Notion show/calendar databases count when Notion is configured.
4. `bin/ops-inbox-archive-set` report-only. Present KEEP vs ARCHIVE; `--apply` only after explicit OK.
-5. Deep-read KEEP / NEEDS_REPLY. Fan out if volume (`references/fan-out.md`). One read-only worker per channel, then one per KEEP thread-chunk. Stage the next draft the moment the previous card is answered — no "next?" pause.
-6. Stage drafts one at a time (Rule 6). Archive after a verified send.
+5. Deep-read KEEP / NEEDS_REPLY. Fan out if volume (`references/fan-out.md`). One read-only worker per channel, then one per KEEP thread-chunk. Stage the first draft as soon as one KEEP exists — do not wait for the full scan, and do not wait for "continue drafting". Stage the next draft the moment the previous card is answered — no "next?" pause.
+6. Stage drafts one at a time (Rule 6) in this parent session. Archive after a verified send.
## Every suggested send carries reasoning
diff --git a/claude-ops/skills/ops-inbox/references/fan-out.md b/claude-ops/skills/ops-inbox/references/fan-out.md
index 664fca4d..7503780d 100644
--- a/claude-ops/skills/ops-inbox/references/fan-out.md
+++ b/claude-ops/skills/ops-inbox/references/fan-out.md
@@ -33,6 +33,11 @@ volume is more than a glance.
the per-channel checks in "Channel availability + fallback". Never spawn a scanner for an
unconfigured / unreachable channel — it burns a turn and produces a misleading
"unreachable" row. Build the workflow's channel list from the channels you confirmed up.
+- **Always report to the main agent by default.** Workers never address the
+ owner. No `AskUserQuestion`, no numbered options, no "what should I send?".
+ Return structured KEEP + draft text. The parent presents and gates sends.
+ At least every 30 seconds, `SendMessage` the parent one line
+ (`channel=… keep=… drafting=…`). Default, not opt-in.
- **No `AskUserQuestion` inside the workflow.** Presentation, reply drafting, approval,
archive, and the Cron offer all happen back in the main session _after_ the workflow
returns. Workflow agents cannot gate sends, so they must never try.
diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.sh
index 2218aa71..bc6acd09 100755
--- a/claude-ops/tests/run-all.sh
+++ b/claude-ops/tests/run-all.sh
@@ -79,6 +79,9 @@ run_suite "$TESTS_DIR/test-ops-inbox-email-forgotten-debt.sh"
run_suite "$TESTS_DIR/test-ops-inbox-answered-thread.sh"
run_suite "$TESTS_DIR/test-ops-inbox-email-watermark.sh"
run_suite "$TESTS_DIR/test-ops-inbox-scan-arg-parse.sh"
+run_suite "$TESTS_DIR/test-ops-inbox-parent-autodraft.sh"
+run_suite "$TESTS_DIR/test-ops-inbox-parent-session.sh"
+run_suite "$TESTS_DIR/test-ops-inbox-parent-heartbeat.sh"
run_suite "$TESTS_DIR/test-ops-wa-accounts.sh"
run_suite "$TESTS_DIR/test-ops-daemon-manager.sh"
run_suite "$TESTS_DIR/test-ops-package.sh"
diff --git a/claude-ops/tests/test-ops-inbox-parent-autodraft.sh b/claude-ops/tests/test-ops-inbox-parent-autodraft.sh
new file mode 100755
index 00000000..6c513066
--- /dev/null
+++ b/claude-ops/tests/test-ops-inbox-parent-autodraft.sh
@@ -0,0 +1,72 @@
+#!/usr/bin/env bash
+# Guard: /ops:ops-inbox must run in the parent session so drafting starts on
+# the slash command. `context: fork` parked the whole skill (including drafts)
+# in a background agent; the parent then idled until the owner typed
+# "continue drafting". Measured 2026-09-21.
+set -euo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+SKILL="$PLUGIN_ROOT/skills/ops-inbox/SKILL.md"
+
+pass=0
+fail=0
+ok() { echo " PASS: $1"; pass=$((pass+1)); }
+err() { echo " FAIL: $1"; fail=$((fail+1)); }
+
+frontmatter() {
+ awk '/^---/{c++; if(c==2)exit} c==1 && !/^---/' "$1"
+}
+
+has_fork() {
+ frontmatter "$1" | grep -qE '^context:[[:space:]]*fork[[:space:]]*$'
+}
+
+echo "Checking: ops-inbox parent auto-draft"
+echo ""
+
+if [[ ! -f "$SKILL" ]]; then
+ echo "FAIL: $SKILL not found"
+ exit 1
+fi
+ok "SKILL.md exists"
+
+# Prove the guard would have caught the live defect, not just the current file.
+FIXTURE="$(mktemp "${TMPDIR:-/tmp}/ops-inbox-fork.XXXXXX")"
+trap 'rm -f "$FIXTURE"' EXIT
+printf '%s\n' '---' 'name: ops-inbox' 'context: fork' '---' 'body' > "$FIXTURE"
+if has_fork "$FIXTURE"; then
+ ok "guard detects context: fork (the 2026-09-21 defect)"
+else
+ err "guard missed a context: fork fixture"
+fi
+
+if has_fork "$SKILL"; then
+ err "ops-inbox frontmatter still has context: fork — parent would idle until continue drafting"
+else
+ ok "ops-inbox is not context: fork"
+fi
+
+if grep -q 'AUTO-START DRAFTING' "$SKILL"; then
+ ok "body has AUTO-START DRAFTING"
+else
+ err "body missing AUTO-START DRAFTING heading"
+fi
+
+if grep -q 'continue drafting' "$SKILL"; then
+ ok "body names continue drafting as something not to wait for"
+else
+ err "body does not mention continue drafting"
+fi
+
+if grep -q 'Always report to the main agent by default' "$SKILL"; then
+ ok "body reports to the parent by default"
+else
+ err "body missing report-to-parent default"
+fi
+
+echo ""
+echo "Results: $pass passed, $fail failed"
+if (( fail > 0 )); then
+ exit 1
+fi
+exit 0
diff --git a/claude-ops/tests/test-ops-inbox-parent-heartbeat.sh b/claude-ops/tests/test-ops-inbox-parent-heartbeat.sh
new file mode 100755
index 00000000..db64fa0a
--- /dev/null
+++ b/claude-ops/tests/test-ops-inbox-parent-heartbeat.sh
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+# Guard: /ops:ops-inbox pings the parent every 30s by default.
+# The heartbeat script's exit IS the ping (same pattern as live-watch).
+set -euo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+HB="$PLUGIN_ROOT/bin/ops-inbox-parent-heartbeat.sh"
+SKILL="$PLUGIN_ROOT/skills/ops-inbox/SKILL.md"
+FANOUT="$PLUGIN_ROOT/skills/ops-inbox/references/fan-out.md"
+
+pass=0
+fail=0
+ok() { echo " PASS: $1"; pass=$((pass+1)); }
+err() { echo " FAIL: $1"; fail=$((fail+1)); }
+
+echo "Checking: ops-inbox 30s parent heartbeat"
+echo ""
+
+if [[ -x "$HB" ]]; then
+ ok "heartbeat script is executable"
+else
+ err "heartbeat script missing or not executable: $HB"
+fi
+
+if grep -q 'default 30' "$HB" && grep -q 'OPS_INBOX_HEARTBEAT_SEC:-30' "$HB"; then
+ ok "default interval is 30 seconds"
+else
+ err "default interval is not 30 seconds"
+fi
+
+help="$("$HB" --help 2>&1)"
+case "$help" in
+ *"30s"*|*"30 second"*) ok "help names 30s" ;;
+ *) err "help does not name 30s: $help" ;;
+esac
+
+missing="${TMPDIR:-/tmp}/ois-missing-$$.json"
+out="$("$HB" --once --scan-json "$missing" --keep-json "$missing" 2>&1)"
+rc=$?
+if [[ "$rc" -eq 0 ]]; then
+ ok "--once exits 0"
+else
+ err "--once exit=$rc"
+fi
+case "$out" in
+ INBOX\ HEARTBEAT\ after=30s*) ok "--once prints INBOX HEARTBEAT after=30s" ;;
+ *) err "--once output was: $out" ;;
+esac
+
+scan="$(mktemp "${TMPDIR:-/tmp}/ois-scan.XXXXXX")"
+printf '%s\n' '{"whatsapp":{"needs_reply":[{"who":"Ada"}],"waiting":[{},{}]},"email":{"needs_reply":[],"waiting":[]}}' > "$scan"
+out="$("$HB" --once --scan-json "$scan" --keep-json "$missing" 2>&1)"
+rm -f "$scan"
+case "$out" in
+ *'keep=1 waiting=2 next=Ada'*) ok "summarises scan JSON" ;;
+ *) err "scan summary was: $out" ;;
+esac
+
+if grep -q '30-second parent heartbeat' "$SKILL" && grep -q 'ops-inbox-parent-heartbeat.sh' "$SKILL"; then
+ ok "skill launches the heartbeat"
+else
+ err "skill missing 30-second heartbeat launch"
+fi
+
+if grep -q 'SendMessage' "$SKILL" && grep -q 'every 30' "$FANOUT"; then
+ ok "workers SendMessage parent every 30s"
+else
+ err "fan-out/skill missing 30s SendMessage"
+fi
+
+echo ""
+echo "Results: $pass passed, $fail failed"
+if (( fail > 0 )); then
+ exit 1
+fi
+exit 0
diff --git a/claude-ops/tests/test-ops-inbox-parent-session.sh b/claude-ops/tests/test-ops-inbox-parent-session.sh
new file mode 100755
index 00000000..72e91e19
--- /dev/null
+++ b/claude-ops/tests/test-ops-inbox-parent-session.sh
@@ -0,0 +1,64 @@
+#!/usr/bin/env bash
+# ops-inbox must run in the parent session and workers must report to it.
+# A forked skill parks drafts in a side channel (measured 2026-09-21).
+set -euo pipefail
+
+PLUGIN_ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
+SKILL="$PLUGIN_ROOT/skills/ops-inbox/SKILL.md"
+FANOUT="$PLUGIN_ROOT/skills/ops-inbox/references/fan-out.md"
+HEARTBEAT="$PLUGIN_ROOT/bin/ops-inbox-parent-heartbeat.sh"
+
+pass=0
+fail=0
+ok() { echo " PASS: $1"; pass=$((pass+1)); }
+err() { echo " FAIL: $1 — $2"; fail=$((fail+1)); }
+
+echo "ops-inbox parent-session gate"
+echo ""
+
+if [ ! -f "$SKILL" ]; then
+ err "skill exists" "missing $SKILL"
+else
+ ok "skill exists"
+fi
+
+if [ -f "$SKILL" ]; then
+ if awk 'BEGIN{in_fm=0} /^---$/{in_fm++; next} in_fm==1 && /^context:[[:space:]]*fork([[:space:]]|$)/{found=1} END{exit found?0:1}' "$SKILL"; then
+ err "no context:fork in frontmatter" "skills/ops-inbox/SKILL.md still has context: fork"
+ else
+ ok "no context:fork in frontmatter"
+ fi
+
+ if grep -q 'Always report to the main agent by default' "$SKILL"; then
+ ok "skill names the report-to-parent default"
+ else
+ err "skill names the report-to-parent default" "phrase missing from SKILL.md"
+ fi
+
+ if grep -q 'Never set `context: fork`' "$SKILL"; then
+ ok "skill forbids context: fork"
+ else
+ err "skill forbids context: fork" "ban missing from SKILL.md"
+ fi
+fi
+
+if [ ! -f "$FANOUT" ]; then
+ err "fan-out exists" "missing $FANOUT"
+else
+ ok "fan-out exists"
+ if grep -q 'Always report to the main agent by default' "$FANOUT"; then
+ ok "fan-out names the report-to-parent default"
+ else
+ err "fan-out names the report-to-parent default" "phrase missing from fan-out.md"
+ fi
+fi
+
+if [ -x "$HEARTBEAT" ] || [ -f "$HEARTBEAT" ]; then
+ ok "heartbeat script exists"
+else
+ err "heartbeat script exists" "missing $HEARTBEAT"
+fi
+
+echo ""
+echo "pass=$pass fail=$fail"
+[ "$fail" -eq 0 ]