Skip to content

fix(bin): deliver Claude-bound operational input as a record-backed doorbell - #26

Merged
max-metaplanet merged 2 commits into
mainfrom
fm/op-marker-strip
Oct 6, 2026
Merged

max-metaplanet merged 2 commits into
mainfrom
fm/op-marker-strip

Conversation

@max-metaplanet

Copy link
Copy Markdown
Owner

Intent

We should fix the first mate invisible character thing.

Context: while validating the Calm activation-gate fix (PR on max-metaplanet/firstmate, branch fm/calm-flag-rename), the live test found that Claude Code 2.1.291's composer strips an invisible character from submitted input and asks for a second Enter; both tmux send-keys -l and a bracketed tmux paste-buffer lose the marker the same way.
Firstmate marks operational input with FM_OPERATIONAL_PREFIX (U+2063 INVISIBLE SEPARATOR followed by FIRSTMATE_OP: , see bin/fm-operational-input.sh), so marked operational input typed into a Claude pane - away-supervisor injections, launch briefs, and anything else that relies on the marker - can arrive unmarked.
The risk: an unmarked away-mode injection could read as the captain returning, and a launch brief could lose its operational identity.
Make firstmate's operational-input marking survive this; check first whether upstream kunchenguid/firstmate already fixed it.

What Changed

  • Claude Code strips U+2063 from submitted prompts, so bin/fm-operational-input.sh now has a record-backed carrier for the harnesses listed in FM_OPERATIONAL_RECORD_HARNESSES (currently just claude). The full envelope is written atomically to state/operational-inbox/<name>.msg (records older than about 7 days are pruned), and only a plain ASCII doorbell line naming that record is typed. This adds the record, doorbell-kind, and open CLI commands, plus helpers that verify a doorbell only when the record it names exists and holds a current envelope. One of these helpers also requires the record to sit in this home's own inbox.
  • When the captain's harness is Claude, away-supervisor injections from bin/fm-supervise-daemon.sh and launch briefs from bin/fm-spawn.sh now go through the doorbell. The afk return check counts a doorbell backed by this home's record as internal input, so it no longer reads as the captain coming back. fm-afk-launch.sh now passes FM_DAEMON_PRIMARY_HARNESS to daemon terminals it creates. If fm-spawn.sh can't publish the brief record, it stops the spawn instead of sending an unmarked brief. A secondmate's brief record goes into the secondmate's own state directory.
  • The Claude Code Calm mod has a matching doorbell parser and record classifier. It hides a doorbell row when its record holds a current envelope, caching that result until the next invalidation. Docs (calm-mode-feasibility, calm, configuration, architecture, runtime-backend verification, and the afk/ahoy skills) are updated. Unit, daemon, spawn, afk-launch, and Calm tests are extended, and a new live tmux/Claude e2e test (tests/fm-operational-marker-live-e2e.test.sh) is added.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: This ports upstream's record-backed doorbell. It covers the Claude-bound producers the intent names: away-supervisor injections, by passing the primary harness to daemon terminals, and crewmate and secondmate launch briefs, each published into the receiving home. Marker-preserving harnesses keep the typed envelope. The doorbell counts only when its record verifies. Spawns fail closed when a record cannot be published. Behavioral tests cover parity, home binding and refusal, and no reachable defect was found.

Testing

I ran the repo's opt-in live marker guard and my own live scenario script against the installed Claude Code 2.1.291 on a private tmux socket with throwaway labs. Both drove the real daemon inject_msg, the submit primitive and the operational-input owner. I read the prompt Claude actually submitted from a UserPromptSubmit hook. The baseline step reproduced the reported bug: the old typed envelope arrives stripped and reads as the captain returning. With the fix, the doorbell arrives intact, stays internal, and the agent acts on the record. Four forged or plain captain inputs were all correctly read as the captain returning. A launch-brief doorbell kept its identity and was carried out. The targeted tests for the owner, the daemon end-to-end, spawn and the Calm mod all passed. The fm-spawn record-publishing scenario was covered only by a fixture test, not a live spawn, so it is marked untested here. No UI surface changed, so I took no screenshots; the evidence is CLI transcripts. A side effect: fm-claude-trust.sh added workspace-trust entries for the temporary lab directories to the seat's Claude config, the same way every fleet spawn does.

  • Live validation: ✅ go - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Regression repro: the old typed U+2063 away escalation sent into a real Claude pane arrives stripped and reads as the captain returning ✅ pass live live-scenarios-output.txt S1: submitted prompt shows the marker stripped; should_exit_afk reads it as the captain returning
Away-mode escalation to a Claude captain is typed as a record-backed doorbell, arrives intact, and keeps away mode active ✅ pass live live-scenarios-output.txt S2: the submitted doorbell classifies as away-supervisor, should_exit_afk stays afk, the agent reads the record; tests/fm-afk-inject-e2e.test.sh Scenario D
Adversarial: captain-typed plain text, a forged doorbell with no record, a doorbell for another home's record, and a stripped envelope all read as the captain returning ✅ pass live live-scenarios-output.txt S3 (4 cases PASS)
A Claude worker launched with a launch-brief doorbell keeps its launch-brief identity and carries out the brief from the record ✅ pass live live-scenarios-output.txt S4; operational-marker-live-e2e.txt
fm-spawn publishes a Claude launch brief as a record in the receiving home (a secondmate's own home included) and refuses the spawn when it cannot publish ⏸️ untested no The earlier payload backed this only with a fixture harness test (fm-spawn-dispatch-profile.test.sh), not a live fm-spawn run, so it did not establish a live result. To check it live, run a real fm-sp…
Harnesses not in the record list (codex, opencode, pi, grok) keep their typed marker ⏸️ untested no codex, opencode, pi and grok are not installed on this machine. Install them and re-run FM_OPERATIONAL_MARKER_LIVE_E2E=1 tests/fm-operational-marker-live-e2e.test.sh
Evidence: Live marker guard against real Claude Code 2.1.291

Source: Live marker guard against real Claude Code 2.1.291

ok - claude (2.1.291): strips the operational marker from submitted input, so the record-backed doorbell carrier is required ok - claude (2.1.291): a typed record-backed doorbell reaches the agent recognizably - it opened the record and carried out the operational input

ok - claude (2.1.291 (Claude Code)): strips the operational marker from submitted input, so the record-backed doorbell carrier is required (submitted-prompt hook and session transcript agree; rendered removal notice present)
ok - claude (2.1.291 (Claude Code)): a typed record-backed doorbell reaches the agent recognizably - it opened the record and carried out the operational input the envelope holds
# codex: not installed on this machine; its carrier selection is UNVERIFIED by this run
# opencode: not installed on this machine; its carrier selection is UNVERIFIED by this run
# pi: not installed on this machine; its carrier selection is UNVERIFIED by this run
# grok: not installed on this machine; its carrier selection is UNVERIFIED by this run
# verified the carrier selection against 1 installed harness(es)
Evidence: Live away-mode / adversarial / launch-brief scenarios transcript

Source: Live away-mode / adversarial / launch-brief scenarios transcript

# Claude Code: 2.1.291 (Claude Code)
# S1 submitted prompt: FIRSTMATE_OP: v1 away-supervisor: Supervisor escalate: [baseline] fake-1 done. No action needed; reply OK.
# S1 marker kept by Claude Code: no
PASS - S1 reproduce: pre-fix typed U+2063 envelope arrives stripped and the away-mode check reads it as the CAPTAIN RETURNING (the reported bug)
# S2 submitted prompt: : Firstmate operational input waiting: read '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-nm-opmark.Bv34JD/state/operational-inbox/1791279307-037c604bbb834d15.msg' and handle its contents as Firstmate operational input.
# S2 doorbell-kind of submitted prompt: away-supervisor
PASS - S2 away escalation via doorbell survives Claude's submit and stays afk (not read as captain return)
# S2 record body via open: Supervisor escalate: [doorbell] fake-2 done. No action needed; reply OK.
# S2 pane after doorbell turn:
#   ✻ Sautéed for 3s · done 5:35 AM
#   ❯ : Firstmate operational input waiting: read '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-nm-opmark.Bv34JD/state/operational-inbox/1791279307-037c604bbb834d15.msg' and handle its
#     contents as Firstmate operational input.
#     Read 1 file
#   ⏺ OK
#   ✻ Cooked for 8s · done 5:35 AM
#                                                                                                        tmux detected · scroll with PgUp/PgDn · or add 'set -g mouse on' to ~/.tmux.conf for wheel scroll
#   ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#   ❯ 
#   ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#     Opus 5.5 | p/v/f/1/g/T/f/wt [nm-opmark ⚠1] | 🔴22.0¢ 23.5s | ⚙️24 | ⚡100% | P02=E05=U09=J18:35:18
#     -- INSERT -- ⏵⏵ bypass permissions on (shift+tab to cycle) · ← for agents
PASS - S3 captain-typed 'plain' (as submitted to Claude) reads as the captain returning
PASS - S3 captain-typed 'forged-missing-record' (as submitted to Claude) reads as the captain returning
PASS - S3 captain-typed 'foreign-home-record' (as submitted to Claude) reads as the captain returning
PASS - S3 captain-typed 'stripped-envelope' (as submitted to Claude) reads as the captain returning
# S4 submitted launch prompt: : Firstmate operational input waiting: read '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-nm-opmark.Bv34JD/state/operational-inbox/1791279364-e63be16cbbc877cf.msg' and handle its contents as Firstmate operational input.
PASS - S4 launch-prompt doorbell arrives intact and its record classifies as launch-brief
PASS - S4 the Claude worker opened the record and carried out the launch brief
failures=0
Evidence: Live scenario driver script

Source: Live scenario driver script

#!/usr/bin/env bash
# Live scenarios for fm/op-marker-strip against the REAL installed Claude Code,
# on a private tmux socket and throwaway labs. Usage: live-scenarios.sh <repo-root>
set -u
ROOT=$1
REAL_TMUX=$(command -v tmux)
SOCKET="fm-nm-opmark-$$"
LAB=$(mktemp -d "${TMPDIR:-/tmp}/fm-nm-opmark.XXXXXX")
T() { "$REAL_TMUX" -f /dev/null -L "$SOCKET" "$@"; }
cleanup() { T kill-server >/dev/null 2>&1 || true; rm -rf "$LAB"; }
trap cleanup EXIT
FAILS=0
ok() { printf 'PASS - %s\n' "$1"; }
bad() { printf 'FAIL - %s\n' "$1"; FAILS=$((FAILS + 1)); }
note() { printf '# %s\n' "$1"; }

mkdir -p "$LAB/shim"
cat > "$LAB/shim/tmux" <<SH
#!/usr/bin/env bash
exec "$REAL_TMUX" -f /dev/null -L "$SOCKET" "\$@"
SH
chmod +x "$LAB/shim/tmux"
export PATH="$LAB/shim:$PATH"

# Lab shaped like a spawn target (base + linked worktree) so trust pre-registers.
mkdir -p "$LAB/base" "$LAB/state" "$LAB/other-home/state" "$LAB/prompts"
git -C "$LAB/base" init -q
git -C "$LAB/base" -c [email protected] -c user.name=t commit -q --allow-empty -m base
git -C "$LAB/base" worktree add -q -b nm-opmark "$LAB/wt"
"$ROOT/bin/fm-claude-trust.sh" "$LAB/wt" "$LAB/base" >/dev/null || { echo "trust failed"; exit 1; }
mkdir -p "$LAB/wt/.claude"
cat > "$LAB/wt/.claude/settings.json" <<JSON
{"hooks":{"UserPromptSubmit":[{"hooks":[{"type":"command","command":"cat > $LAB/prompts/\$(date +%s)-\$\$.json"}]}]}}
JSON

FM_STATE_OVERRIDE="$LAB/state"; export FM_STATE_OVERRIDE
# shellcheck source=/dev/null
. "$ROOT/bin/fm-supervise-daemon.sh"

last_prompt() {  # prints the latest submitted prompt exactly as Claude Code recorded it
  local f
  for _ in $(seq 1 120); do
    f=$(find "$LAB/prompts" -maxdepth 1 -name '*.json' | sort | tail -1)
    [ -n "$f" ] && break; sleep 1
  done
  [ -n "$f" ] || return 1
  P="$f" python3 -I -c 'import json,os,sys; sys.stdout.write(json.load(open(os.environ["P"]))["prompt"])'
}
has_mark() { case "$1" in *"$FM_OPERATIONAL_MARK"*) echo yes ;; *) echo no ;; esac; }
start_claude() {  # <session> [launch-arg...]
  local s=$1; shift
  T new-session -d -s "$s" -n w -c "$LAB/wt" -x 200 -y 50 -- claude --dangerously-skip-permissions "$@"
}
wait_empty() {
  for _ in $(seq 1 120); do
    [ "$(fm_backend_composer_state tmux "$1" 2>/dev/null)" = empty ] && return 0; sleep 1
  done; return 1
}
wait_idle() {  # wait until the agent finished its turn and composer is empty again
  sleep 3
  for _ in $(seq 1 180); do
    pane_is_busy "$1" tmux || { [ "$(fm_backend_composer_state tmux "$1" 2>/dev/null)" = empty ] && return 0; }
    sleep 1
  done; return 1
}

note "Claude Code: $(claude --version)"
afk_enter "$LAB/state"
start_claude cap
CAP="cap:w"
FM_SUPERVISOR_TARGET=$CAP; FM_SUPERVISOR_BACKEND=tmux
export FM_SUPERVISOR_TARGET FM_SUPERVISOR_BACKEND
wait_empty "$CAP" || { echo "claude composer never ready"; exit 1; }

# --- S1 (regression baseline): the OLD typed-envelope path loses the marker ---
rm -f "$LAB/prompts"/*.json
FM_DAEMON_PRIMARY_HARNESS=unknown
if inject_msg "Supervisor escalate: [baseline] fake-1 done. No action needed; reply OK." "$LAB/state"; then
  p=$(last_prompt); note "S1 submitted prompt: $p"
  note "S1 marker kept by Claude Code: $(has_mark "$p")"
  if should_exit_afk "$LAB/state" "$p"; then
    ok "S1 reproduce: pre-fix typed U+2063 envelope arrives stripped and the away-mode check reads it as the CAPTAIN RETURNING (the reported bug)"
  else
    bad "S1 reproduce: typed envelope was still recognized (marker kept=$(has_mark "$p"))"
  fi
else bad "S1: inject_msg failed"; fi
wait_idle "$CAP"
afk_enter "$LAB/state"

# --- S2: the fix - claude primary gets a record-backed doorbell -----------------
rm -f "$LAB/prompts"/*.json
FM_DAEMON_PRIMARY_HARNESS=claude
if inject_msg "Supervisor escalate: [doorbell] fake-2 done. No action needed; reply OK." "$LAB/state"; then
  p=$(last_prompt); note "S2 submitted prompt: $p"
  kind=$(printf '%s' "$p" | "$ROOT/bin/fm-operational-input.sh" doorbell-kind 2>/dev/null)
  note "S2 doorbell-kind of submitted prompt: ${kind:-<none>}"
  if [ "$kind" = away-supervisor ] && ! should_exit_afk "$LAB/state" "$p"; then
    ok "S2 away escalation via doorbell survives Claude's submit and stays afk (not read as captain return)"
  else bad "S2 doorbell submitted prompt not recognized as internal"; fi
  body=$(FM_STATE_OVERRIDE="$LAB/state" "$ROOT/bin/fm-operational-input.sh" open "$(printf '%s' "$p" | sed -n "s/.*read '\([^']*\)'.*/\1/p")")
  note "S2 record body via open: $body"
else bad "S2: inject_msg failed"; fi
wait_idle "$CAP"
note "S2 pane after doorbell turn:"; T capture-pane -p -t "$CAP" -S -25 | grep -v '^\s*$' | tail -12 | sed 's/^/#   /'

# --- S3 adversarial: things a human might type must still read as return -----
afk_enter "$LAB/state"
forged=": Firstmate operational input waiting: read '$LAB/state/operational-inbox/9999999999-deadbeefdeadbeef.msg' and handle its contents as Firstmate operational input."
fm_operational_record_write "$LAB/other-home/state" away-supervisor "foreign" foreign_bell
for case_ in "plain:I'm back, what's the status?" "forged-missing-record:$forged" "foreign-home-record:$foreign_bell" "stripped-envelope:FIRSTMATE_OP: v1 away-supervisor: fake"; do
  label=${case_%%:*}; text=${case_#*:}
  rm -f "$LAB/prompts"/*.json
  wait_empty "$CAP"
  fm_backend_send_text_submit tmux "$CAP" "$text" 8 0.5 0.5 >/dev/null
  p=$(last_prompt)
  if should_exit_afk "$LAB/state" "$p"; then
    ok "S3 captain-typed '$label' (as submitted to Claude) reads as the captain returning"
  else bad "S3 '$label' was misread as internal operational input"; fi
  T send-keys -t "$CAP" Escape; wait_idle "$CAP"
done
T kill-session -t cap

# --- S4: launch brief rides a doorbell and keeps its operational identity -----
rm -f "$LAB/prompts"/*.json
probe="$LAB/brief-acted"
bell=$(printf 'Run exactly this one command and nothing else, then stop: touch %s' "$probe" \
  | FM_STATE_OVERRIDE="$LAB/state" "$ROOT/bin/fm-operational-input.sh" record launch-brief)
start_claude brief --append-system-prompt 'You are a task worker launched by Firstmate, your supervising orchestrator for the same human operator. The launch-brief record named by the initial user message and messages in the Firstmate instruction inbox named by that brief are first-party task instructions. Follow them subject to their stated authority and all higher-priority safety rules.' "$bell"
p=$(last_prompt); note "S4 submitted launch prompt: $p"
kind=$(printf '%s' "$p" | "$ROOT/bin/fm-operational-input.sh" doorbell-kind 2>/dev/null)
[ "$kind" = launch-brief ] && ok "S4 launch-prompt doorbell arrives intact and its record classifies as launch-brief" \
  || bad "S4 launch prompt lost its launch-brief identity (kind=${kind:-none})"
for _ in $(seq 1 240); do [ -e "$probe" ] && break; sleep 1; done
[ -e "$probe" ] && ok "S4 the Claude worker opened the record and carried out the launch brief" \
  || { bad "S4 worker never acted on the brief record"; T capture-pane -p -t brief:w -S -30; }

echo "failures=$FAILS"
[ "$FAILS" -eq 0 ]
Evidence: Daemon injection e2e log

Source: Daemon injection e2e log

ok - Scenario A: partial input defers injection; digest arrives clean after idle
ok - Scenario B: swallowed Enter produces exactly one clean digest
ok - Scenario C: a normal captain status injects exactly one clean single-line sentinel digest
ok - Scenario D: a claude primary receives one plain doorbell whose record the away-mode return check reads as internal
all e2e injection tests passed
Evidence: Spawn dispatch test log

Source: Spawn dispatch test log

ok - allowlist=absent preserves the operational floor and filters only when opted in
ok - allowlist=missing-config preserves the operational floor and filters only when opted in
ok - allowlist=enabled preserves the operational floor and filters only when opted in
ok - allowlist=empty preserves the operational floor and filters only when opted in
ok - invalid allowlist names refuse before launch or task publication
ok - inaccessible config with present allowlist refuses before launch or task publication
ok - inaccessible config with absent allowlist refuses before launch or task publication
ok - inaccessible ancestor with present allowlist refuses before launch or task publication
ok - inaccessible ancestor with absent allowlist refuses before launch or task publication
ok - secondmate launch inherits the allowlist for subsequent worker launches
ok - local inheritance preserves the allowlist on source errors and mirrors proven absence
ok - remote inheritance preserves the allowlist on source errors and mirrors proven absence
ok - fm-spawn: actual ship/scout launch commands deliver the worker role contract
ok - no --model/--effort records defaults and types the claude launch instructions
ok - a claude launch publishes the brief as an operational-inbox record and passes only the doorbell
ok - a secondmate claude launch publishes its brief record into the secondmate's own home
ok - a claude spawn whose launch-brief record cannot publish stops with a clear error and sends no launch
ok - non-cursor launches clear inherited Cursor identity markers
ok - relative home overrides ignore CDPATH and become absolute before spawn launch construction
ok - FM_HOME defaults resolve relative paths and preserve absolute spellings
ok - absolute override spellings are preserved in spawn launch paths
ok - unresolvable relative spawn overrides fail with named diagnostics
ok - active crew-dispatch profile requires an explicit harness for ship spawns
ok - active crew-dispatch profile requires an explicit harness for scout spawns
ok - active crew-dispatch profile allows an explicit resolved harness
ok - active crew-dispatch profile allows the legacy positional harness form
ok - active crew-dispatch profile allows the raw launch-command escape hatch
ok - claude receives --model and --effort profile flags
ok - codex receives --model and model_reasoning_effort profile flags
ok - codex Luna receives --model and model_reasoning_effort max profile flags
ok - codex omits max for models without the catalog capability
ok - a codex crewmate launches with no hook layer and keeps its turn-end signal
ok - a codex secondmate keeps the project hook layer its primary session runs on
ok - grok receives --model and --reasoning-effort profile flags
ok - grok omits unsupported max reasoning effort
ok - grok omits unsupported xhigh reasoning effort
ok - cursor receives its model-qualified reasoning class and exact task workspace
ok - cursor refuses model ids absent from its resolved binary's live catalog
ok - cursor preserves the requested model when its live catalog is unreachable
ok - opencode receives --model and omits the unsupported effort axis
ok - native effort validator checks harness and model as separate axes
ok - Ultra is explicit for native Pi and Pi-signed, including direct-PR, and refuses unsupported profiles before provisioning
ok - batch dispatch preserves native Ultra in metadata and launch flags
ok - pi receives --model and --thinking max profile flags
ok - Pi launch probing omits --tui-mode on older Pi and preserves it on supporting Pi
ok - pi-signed shares Pi launch semantics while preserving its configured and recorded identity
ok - pi-signed refuses safely and actionably when the selected executable is unavailable
ok - pi-signed is a distinct persistent secondmate runtime with shared Pi supervision semantics
ok - batch dispatch forwards shared --harness, --model, and --effort to every pair
ok - claude forwards firstmate's CLAUDE_CONFIG_DIR so the crewmate uses the same credential store
ok - the primary-owned Lavish server address reaches every worker launch
ok - absent Lavish configuration preserves the destination environment
ok - claude omits the config-dir prefix when firstmate runs with the single-store default
ok - config/claude-permission-mode=bypass launches exactly as an absent file does
ok - config/claude-permission-mode=auto replaces --dangerously-skip-permissions with --permission-mode auto
ok - config/claude-permission-mode=auto reaches scout launches too
ok - an unrecognized config/claude-permission-mode token refuses before any endpoint or metadata
ok - config/claude-permission-mode changes claude launches only
ok - non-claude harnesses do not receive the claude CLAUDE_CONFIG_DIR prefix
ok - a claude task launch establishes only Firstmate's task control channels through the system prompt
ok - a persistent claude secondmate keeps its supervisor contract without a task-worker authority overlay
ok - fm-spawn: a Claude launch longer than 1024 bytes is delivered intact through the staging path
ok - a claude crewmate launch carries the attribution-off policy in its own settings
ok - a claude secondmate launch carries the attribution-off policy too
ok - active crew-dispatch profile does not block secondmate launches
# all fm-spawn-dispatch-profile tests passed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 4 issues found → auto-fixed ✅
  • ⚠️ README.md - merge conflict rebasing onto origin/main
  • ⚠️ docs/calm-mode-feasibility.md - merge conflict rebasing onto origin/main
  • ⚠️ docs/calm.md - merge conflict rebasing onto origin/main
  • ⚠️ tests/fm-calm-claude-mod-live-e2e.test.sh - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 4 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Regression repro: the old typed U+2063 away escalation sent into a real Claude pane arrives stripped and reads as the captain returning ✅ pass live live-scenarios-output.txt S1: submitted prompt shows the marker stripped; should_exit_afk reads it as the captain returning
Away-mode escalation to a Claude captain is typed as a record-backed doorbell, arrives intact, and keeps away mode active ✅ pass live live-scenarios-output.txt S2: the submitted doorbell classifies as away-supervisor, should_exit_afk stays afk, the agent reads the record; tests/fm-afk-inject-e2e.test.sh Scenario D
Adversarial: captain-typed plain text, a forged doorbell with no record, a doorbell for another home's record, and a stripped envelope all read as the captain returning ✅ pass live live-scenarios-output.txt S3 (4 cases PASS)
A Claude worker launched with a launch-brief doorbell keeps its launch-brief identity and carries out the brief from the record ✅ pass live live-scenarios-output.txt S4; operational-marker-live-e2e.txt
fm-spawn publishes a Claude launch brief as a record in the receiving home (a secondmate's own home included) and refuses the spawn when it cannot publish ⏸️ untested no The earlier payload backed this only with a fixture harness test (fm-spawn-dispatch-profile.test.sh), not a live fm-spawn run, so it did not establish a live result. To check it live, run a real fm-sp…
Harnesses not in the record list (codex, opencode, pi, grok) keep their typed marker ⏸️ untested no codex, opencode, pi and grok are not installed on this machine. Install them and re-run FM_OPERATIONAL_MARKER_LIVE_E2E=1 tests/fm-operational-marker-live-e2e.test.sh
  • FM_OPERATIONAL_MARKER_LIVE_E2E=1 tests/fm-operational-marker-live-e2e.test.sh (real claude 2.1.291, private tmux socket)
  • FM_HOME=/nonexistent-nm bash ~/.no-mistakes/evidence/01M488P2AP1YFQA8C99CBKWB7T/live-scenarios.sh &lt;worktree&gt;: real daemon inject_msg + should_exit_afk against a real Claude pane, adversarial captain inputs, and a real launch-brief doorbell launch
  • tests/fm-operational-input.test.sh
  • tests/fm-afk-inject-e2e.test.sh (real daemon process, Scenario D claude doorbell)
  • tests/fm-spawn-dispatch-profile.test.sh
  • tests/fm-calm-claude-mod.test.sh (mod doorbell port agrees with the owner on all 28 cases)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…oorbell

Claude Code 2.1.291 removes invisible characters, U+2063 included, from
every submitted prompt, so a FM_OPERATIONAL_PREFIX-marked operational
input reaches a Claude pane as plain text no consumer can tell apart from
a captain message. An away-mode escalation then reads as the captain
returning, and a launch brief loses its operational identity.

This ports upstream kunchenguid/firstmate 1fe1a67 (PR 5664) rather than
inventing a second design, adapted to this fork: its INJECT_LAST_FAILURE
bookkeeping, AI-trailer launch prefix, unknown-wake acknowledgement tests
and oversized-digest test belong to upstream commits this fork does not
carry, so those hunks are dropped and the surrounding code keeps this
tree's own shape.

Marked operational input to a harness named in the owner's
FM_OPERATIONAL_RECORD_HARNESSES now travels as a durable record plus a
printable-ASCII doorbell naming it: the away daemon writes the envelope
under state/operational-inbox and types only the doorbell, and a Claude
launch brief is published into the receiving home's own state before
launch, refusing the spawn rather than sending a marker that would be
stripped. The doorbell text alone proves nothing - it counts as Firstmate
input only when the record it names holds a current envelope - so a human
still cannot produce an operational marker by accident. Marker-preserving
harnesses keep the typed envelope unchanged.

Reproduced first on the installed Claude Code 2.1.291: the launch-prompt
argument (the vendor itself reports removing the character), typing
through Firstmate's own submit primitive, and a bracketed paste all
arrive bare, confirmed in both the UserPromptSubmit payload and the
stored session transcript. A SessionStart hook's stdout keeps the marker,
so the session-start nudge is untouched, and the steering doorbell was
never marked, so fm-send's plane is unaffected.

A new opt-in live guard proves both halves of the carrier selection
against the real installed binaries and refuses a pass that checked
nothing, with the dated 2.1.291 result recorded in
docs/verification/runtime-backends.md.
@max-metaplanet
max-metaplanet merged commit 31f04ac into main Oct 6, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant