Repository navigation
Conversation
Add bin/fm-voice-check.sh, an opt-in pre-publication check that asks the typed resolution service four closed yes/no questions over a PR or issue description or a no-mistakes intent: direct address to the operator, relayed supervisor orders, quoted operator answers, and prose in another language. Code decides: any yes flags and stops publication, a clear verdict needs every no at confidence 0.6, and no verdict (unreachable, timeout, error, malformed, or uncertain) retries once and then stops as unverified unless an explicit per-publication override with a reason is passed. With TYPESAFE_API_KEY absent the check is off and makes no call. Extract the shared typesafe.ai client and key handling into bin/fm-typesafe-lib.sh and reuse it from bin/fm-dispatch-resolve.sh with no behavior change. Enforce the check in code at spawn and promotion on a no-mistakes ship's intent, which the pipeline publishes verbatim, with --voice-accept-unverified as the override. Render the bounded correction step into the worker definition of done for the final --intent string and a direct-PR description, since the pipeline creates its PR itself. Record the live evaluation against past fleet descriptions.
… so I left that test alone. **Lint 1 (fixed).** ShellCheck reported SC2034 ("appears unused") three times in the new `bin/fm-typesafe-lib.sh`: once for `FM_TYPESAFE_MODEL`, and for `FM_TYPESAFE_HTTP` and `FM_TYPESAFE_LATENCY_MS`, which `fm_typesafe_post` sets. The file is only ever sourced, and `bin/fm-voice-check.sh` and `bin/fm-dispatch-resolve.sh` read these values. I added two scoped `# shellcheck disable=SC2034` comments with a reason, the same way `bin/fm-landed-lib.sh` and `bin/fm-parent-channel-lib.sh` handle output globals. There's no change in behavior. ShellCheck 0.11.0, the same version CI pins, now passes on every changed script. `tests/fm-voice-check.test.sh` and `tests/fm-dispatch-resolve.test.sh` both still pass. **Behavior tests (Herdr) (no code change).** The only failure was `tests/fm-backend-herdr-focus-flash-e2e.test.sh`, part C: "reached the fallback on a defective release but observed no wrong-focus sample at all". That test samples focus changes in a real Herdr session while a close runs, and here the sampler caught no brief focus change. The test only uses the Herdr backend and lab helpers. This PR changes none of that code: it touches the voice check, the shared typesafe client, spawn and promote hooks, the dod library, docs, and tests. The other 15 Herdr scripts passed. Making this real-Herdr timing sampler deterministic would be a separate job outside this PR's scope. A re-run is expected to pass
|
Speaking as Kun's firstmate: triage of this PR. Outcome: waiting-ci (attestation MATCH; CI/NM in progress on HEAD) contract-class: opt-in — VISION.md
Security FYI (cron): when key set, PR/issue/intent prose is sent to the typed resolution service for classification. Fail-closed on outage/uncertain. Diff reviewed; no withhold. Not Firstmate-flagged (CI still pending). |
|
Checks are green on this PR now; the last triage stamp reads waiting-ci from before they finished. Flagging it for a re-check when the queue allows - nothing else is owed from our side. |
…e-classifier # Conflicts: # bin/fm-dod-lib.sh
An operator shell may export TYPESAFE_API_KEY, which turns the pre-publication voice check on in every no-mistakes spawn and promotion, so a fixture would post its brief text to the live service and depend on its verdict. Clear it in tests/lib.sh beside the other operator overrides; a case that exercises the check sets it itself against a stubbed curl. Also escalate every non-zero voice check exit in the worker step, not only flagged and unverified, so a usage error stops publication too.
Intent
Before a pull request or issue description is published, check its text for internal voice that must never reach a public artifact: direct address to the operator (for example 'captain'), relayed supervisor orders to the worker (for example 'do not merge', 'in the new PR description, explain'), quoted operator answers, and prose in a language other than the one the artifact is written in.
When the check finds any of these, publication stops and the finding is reported instead of the text being published.
The check uses the optional typed resolution service already used for dispatch (TYPESAFE_API_KEY) as a closed classification question over the text; when that key is absent the check is off and publication behaves exactly as today.
The service only answers the question; the stop decision and every safety rule stay in code, and an unavailable or uncertain answer must not silently publish a flagged text.
Two real leaks motivate it: a PR Intent that published an operator's one-word answer and the supervisor's relay orders verbatim, and an earlier PR description written partly in French with direct address.
When the key is set and the check gets no verdict (service unreachable, timeout, an error response, or an answer too uncertain that leans clean), it retries once within a bound, then stops publication and reports the text as unverified; publishing that text anyway requires an explicit override for that one publication, with its reason printed, used only on the supervising firstmate's instruction. A flagged answer always stops publication.
The delivery states the enforcement limits plainly: the check is enforced in code at spawn on the brief's intent text, and only by brief instruction on the worker's final --intent string and on the direct-PR body, because the no-mistakes pipeline creates the PR itself and cannot be gated from this repository.
When the check flags a text, the text is corrected by whoever wrote it, guided by the category the check reported (direct address, relayed supervisor orders, quoted operator answer, wrong language), then checked again.
After at most two correction attempts that are still flagged, publication stops and the case is escalated to the supervisor instead of looping.
For a supervisor-authored brief intent, the refused spawn is the escalation to the supervisor, who rewrites and retries; for the worker's final intent string and a direct-PR body, the worker performs the bounded correction itself and reports the escalation through its status.
A text is never published without a clean verdict or the explicit per-publication override already decided.
The check reports only a category, never a rewrite, so the correction stays with the author.
What Changed
bin/fm-voice-check.sh, an opt-in check that runs only whenTYPESAFE_API_KEYis set. It sends a PR, issue, or--intenttext to the typed resolution service as four closed yes/no questions: direct address to the operator, relayed supervisor orders, a quoted operator answer, and prose not in English. Code makes every decision. Any "yes" is flagged (exit 1) and no flag can override that. A clean result needs a confident "no" on all four (exit 0). A service failure, timeout, bad response, or low-confidence "no" gets one retry and then counts as unverified (exit 3).--accept-unverified <reason>lets one unverified text through and prints the reason. The output names only the flagged categories and never suggests a rewrite. Without the key, the check printsvoice-check: offand exits 0 without making a network call. The service client and key handling moved frombin/fm-dispatch-resolve.shinto a new sharedbin/fm-typesafe-lib.sh, which both scripts now use.## Captain's intenttext whenfm-spawn.shspawns a no-mistakes ship (relaunches skip it) and whenfm-promote.shpromotes to no-mistakes. Both refuse a flagged or unverified intent and add a--voice-accept-unverified <reason>override. For the worker's final--intentstring and the direct-PR title and description, enforcement is only by instruction: the rendered briefs tell the worker to run the check, fix only the flagged passages, and after at most two corrections that are still flagged, or on exit 3 or 2, stop and reportneeds-decision [key=voice-check]instead of publishing. This limit exists because the no-mistakes pipeline creates the PR itself and can't be gated from this repo.docs/configuration.md("Pre-publication voice check"), inAGENTS.md, and in a newdocs/verification/voice-check.md. Addedtests/fm-voice-check.test.shand extended the task-delivery and control-relaunch tests.tests/lib.shnow keeps the suite from picking up an ambientTYPESAFE_API_KEY, andfm-test-run.shroutes the new files to their tests.Risk Assessment
✅ Low: The check only runs when the key is set. When it cannot get a verdict it stops publication rather than publishing: a flagged text is never published, and an unverified one needs the explicit override. It runs before spawn or promotion writes anything, relaunch skips it, the earlier review decisions are all in place, and the tests stub the network.
Testing
I ran bin/fm-voice-check.sh against the real typesafe.ai service using the operator's existing key, passed only through the environment and confirmed absent from all evidence. Cases covered: key absent, four-category leak, orders-only leak, clean text, override on a flagged text, HTTP 401 and transport failure with the retry call count observed through a logging curl pass-through, the override on an unverified result, a corrected text re-checked, and a usage error. I then drove a real bin/fm-spawn.sh no-mistakes ship spawn in a throwaway FM_HOME against the live service (fake tmux, and the test-harness gate bypass FM_GATE_REFUSE_BYPASS=1 that tests/lib.sh uses, because this runs inside a gate worktree). I scaffolded no-mistakes and direct-PR briefs with bin/fm-brief.sh to capture the rendered worker correction loop. Finally I ran the three targeted test files for the voice check, spawn/promotion, and relaunch; all passed. Those tests stub the network boundary, so the uncertain-answer retry, promotion refusal, and relaunch skip scenarios are recorded as untested live. No Herdr lab was needed, since no agent was launched. Temp sandboxes were removed and the worktree is clean. There is no UI surface; the evidence is CLI transcripts.
Evidence: Key absent: check off, no call
Source: Key absent: check off, no call
Evidence: Live flagged: French + address + orders + quoted answer
Source: Live flagged: French + address + orders + quoted answer
Evidence: Live flagged: relayed orders only
Source: Live flagged: relayed orders only
Evidence: Live clear: clean PR description
Source: Live clear: clean PR description
Evidence: Override cannot clear a flagged text
Source: Override cannot clear a flagged text
Evidence: Unverified after one retry; explicit override prints reason
Source: Unverified after one retry; explicit override prints reason
Evidence: Live fm-spawn refuses leaking intent, publishes clean one
Source: Live fm-spawn refuses leaking intent, publishes clean one
Evidence: Worker bounded correction loop rendered in generated briefs
Source: Worker bounded correction loop rendered in generated briefs
Evidence: Corrected text re-checked clear; usage error exit 2
Source: Corrected text re-checked clear; usage error exit 2
Evidence: tests/fm-voice-check.test.sh
Source: tests/fm-voice-check.test.sh
Evidence: tests/fm-task-delivery.test.sh
Source: tests/fm-task-delivery.test.sh
Evidence: tests/fm-control-relaunch.test.sh (voice relaunch case)
Source: tests/fm-control-relaunch.test.sh (voice relaunch case)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
env -u TYPESAFE_API_KEY FM_HOME=<empty> bin/fm-voice-check.sh --kind pr leak-fr.md(off, exit 0)TYPESAFE_API_KEY=<real> bin/fm-voice-check.sh --kind pr {leak-fr,leak-orders,clean}.mdagainst live api.typesafe.aibin/fm-voice-check.sh --accept-unverified ... leak-fr.mdlive (flagged stays exit 1)TYPESAFE_API_KEY=invalid bin/fm-voice-check.shvia logging curl pass-through (2 real calls, HTTP 401, exit 3), same with --accept-unverified (exit 0, reason printed)HTTPS_PROXY=http://127.0.0.1:9 bin/fm-voice-check.sh --kind intent(transport failure, 2 calls, exit 3)Live re-check of a corrected text (clear, exit 0) and an unreadable-file usage error (exit 2)Sandboxbin/fm-spawn.sh leak1 <proj> claude --mode no-mistakes --yolo offwith real key (refused, no launch-brief.md, no meta), with --voice-accept-unverified (still refused), and a clean intent (launch-brief.md published)bin/fm-brief.sh <id> proj --mode no-mistakes|direct-PRin sandbox to capture the rendered worker voice-check stepbash tests/fm-voice-check.test.shbash tests/fm-task-delivery.test.shbash tests/fm-control-relaunch.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.