Skip to content

feat(bin): add Kimi crewmate adapter and agent-owned dispatch routing - #1

Open
Vhailors wants to merge 12 commits into
mainfrom
fm/agent-routing-quota-fallback-v1
Open

feat(bin): add Kimi crewmate adapter and agent-owned dispatch routing#1
Vhailors wants to merge 12 commits into
mainfrom
fm/agent-routing-quota-fallback-v1

Conversation

@Vhailors

Copy link
Copy Markdown
Owner

Intent

Implement the captain-authorized future Firstmate routing correction on the latest upstream-compatible agent-owned quota-selection design. Preserve all active homes, current task metadata, Herdr runtime and presentation-space behavior, and SceneAxi's existing override. Keep persistent secondmates pinned to Pi openai-codex/gpt-5.6-luna at high effort; set future implementation profiles to direct Grok Build grok-4.5, Claude Code opus, Codex gpt-5.6-sol, and Pi openai-codex/gpt-5.6-sol at high effort. Bug-bounty and security-engagement crewmates must hard-pin Pi zai/glm-5.2 high and report a capacity blocker rather than falling back to GLM 5.1, Opus, Sol, Fable, or random selection. Stale, unavailable, or unscorable quota must fail closed under upstream's agent-owned quota procedure. Do not resurrect or broaden the bin/fm-dispatch-select.sh script removed upstream in 3f71cdd, and preserve compatibility for existing homes and static pins. Keep the port to the smallest policy, config example, documentation, and focused test changes. Publish only through this mandatory no-mistakes pipeline after its checks are green; do not merge.

What Changed

  • Added kimi as a verified crewmate harness: bin/fm-spawn.sh gains Kimi binary resolution, a bare launch path with composer-based prompt delivery and readiness polling, plus the new bin/fm-kimi-turnend-hook.sh guarded turn-end wake that is installed at spawn (refusing the spawn if it cannot be installed safely) and cleaned up by bin/fm-teardown.sh.
  • Reworked tmux pane classification in bin/fm-tmux-lib.sh and the composer/send path: bordered composers are now classified across all pane rows, busy detection is scoped so a crewmate's current turn is recognized instead of being read as idle, with matching updates in fm-send.sh, fm-composer-lib.sh, fm-supervise-daemon.sh, and fm-watch.sh.
  • Made dispatch-profile selection agent-owned: deleted bin/fm-dispatch-select.sh and its suite, and moved routing policy into AGENTS.md — precedence now runs captain override → bug-bounty/security hard pin (Pi zai/glm-5.2 high, reporting a capacity blocker instead of falling back) → configured rule → configured default → static harness, with quota evaluated per candidate and stale/unscorable quota failing closed. docs/examples/crew-dispatch.json, docs/configuration.md, and the harness-adapters skill were updated to match, and tests/fm-instruction-owners.test.sh pins the new statements.

Risk Assessment

✅ Low: Documentation, config-example, and test-only change that touches no shell code, satisfies every source-verifiable intent criterion (secondmate Luna pin, the four standing high-effort profiles, the GLM 5.2 hard pin with capacity-blocker semantics, fail-closed quota, no resurrected selector, preserved backward compatibility), and whose example validates cleanly against the existing bootstrap harness/effort matrix; the only residual issues are two narrow gaps in the new test's own guard coverage.

Testing

Ran the branch's mapped contract-test family plus a real operator walkthrough: copying the shipped crew-dispatch example into a firstmate home and running the actual bootstrap validator shows it is accepted and resolves the security engagement to a single pi/zai/glm-5.2/high hard pin with no fallback candidate, the implementation rule and default to the four standing high-effort profiles, and the real harness resolver reads the persistent-secondmate Pi Luna pin back correctly, with the upstream-removed dispatch selector still gone. Nine mutations against throwaway tree copies confirm each intent constraint is genuinely enforced, and I added one focused bootstrap test (mutation-checked) closing the gap where the example the docs tell captains to copy was never verified against the real validator. Two test scripts fail in this environment for reasons that predate the change and reproduce at the branch parent - the bootstrap orca case because /usr/bin/orca (the GNOME screen reader) exists on this Linux box, and a tmux-driven fm-calm-pi e2e case that names a different sub-case on each run - plus the coverage guard is locale-sensitive and passes under LC_ALL=C; none involve the routing policy.

Evidence: Operator walkthrough: shipped example accepted by the real bootstrap validator, resolved routing table, secondmate pin readback, selector still removed

### 2. Real bootstrap validation - a valid dispatch config stays silent $ bin/fm-bootstrap.sh (no output - config accepted, no CREW_DISPATCH error) ### 3. Same run with facts on - the routing table firstmate will apply $ FM_BOOTSTRAP_VERBOSE_FACTS=1 bin/fm-bootstrap.sh BOOTSTRAP_INFO: crew dispatch active config/crew-dispatch.json BOOTSTRAP_INFO: crew dispatch rule: The task is a bug-bounty or security engagement. -> pi/zai/glm-5.2/high BOOTSTRAP_INFO: crew dispatch rule: The task depends on fresh news, current events, live public facts, or recent market and product changes. -> grok/grok-4.5/high BOOTSTRAP_INFO: crew dispatch rule: The task is a genuinely trivial mechanical edit ... -> grok/grok-4.5/high BOOTSTRAP_INFO: crew dispatch rule: The task is a big or ambiguous multi-file feature ... -> quota-balanced[grok/grok-4.5/high, claude/opus/high, codex/gpt-5.6-sol/high, pi/openai-codex/gpt-5.6-sol/high] BOOTSTRAP_INFO: crew dispatch default: quota-balanced[codex/gpt-5.6-sol/high, pi/openai-codex/gpt-5.6-sol/high, claude/opus/high, grok/grok-4.5/high] ### 4. Persistent secondmate pin read back through the real resolver $ cat config/secondmate-harness pi openai-codex/gpt-5.6-luna high $ bin/fm-harness.sh secondmate pi $ bin/fm-harness.sh secondmate-model openai-codex/gpt-5.6-luna $ bin/fm-harness.sh secondmate-effort high ### 5. The selector removed upstream in 3f71cdd stays removed $ ls bin/fm-dispatch-select.sh ls: cannot access '.../bin/fm-dispatch-select.sh': No such file or directory $ grep -rl fm-dispatch-select . (excluding .git) tests/fm-instruction-owners.test.sh (the only remaining mention is the regression guard asserting AGENTS.md never resurrects it)

### 1. Captain copies the shipped example into the operational home
$ cp docs/examples/crew-dispatch.json ~/firstmate/config/crew-dispatch.json

### 2. Real bootstrap validation - a valid dispatch config stays silent
$ bin/fm-bootstrap.sh
(no output - config accepted, no CREW_DISPATCH error)

### 3. Same run with facts on - the routing table firstmate will apply
$ FM_BOOTSTRAP_VERBOSE_FACTS=1 bin/fm-bootstrap.sh
BOOTSTRAP_INFO: crew dispatch active config/crew-dispatch.json
BOOTSTRAP_INFO: crew dispatch rule: The task is a bug-bounty or security engagement. -> pi/zai/glm-5.2/high
BOOTSTRAP_INFO: crew dispatch rule: The task depends on fresh news, current events, live public facts, or recent market and product changes. -> grok/grok-4.5/high
BOOTSTRAP_INFO: crew dispatch rule: The task is a genuinely trivial mechanical edit such as a rote rename, formatting sweep, targeted typo fix, or simple file gathering, with no design or ambiguity to resolve. -> grok/grok-4.5/high
BOOTSTRAP_INFO: crew dispatch rule: The task is a big or ambiguous multi-file feature, a risky refactor, or work that requires holding many moving parts in mind. -> quota-balanced[grok/grok-4.5/high, claude/opus/high, codex/gpt-5.6-sol/high, pi/openai-codex/gpt-5.6-sol/high]
BOOTSTRAP_INFO: crew dispatch default: quota-balanced[codex/gpt-5.6-sol/high, pi/openai-codex/gpt-5.6-sol/high, claude/opus/high, grok/grok-4.5/high]

### 4. Persistent secondmate pin read back through the real resolver
$ cat config/secondmate-harness
pi openai-codex/gpt-5.6-luna high
$ bin/fm-harness.sh secondmate
pi
$ bin/fm-harness.sh secondmate-model
openai-codex/gpt-5.6-luna
$ bin/fm-harness.sh secondmate-effort
high

### 5. The selector removed upstream in 3f71cdd stays removed
$ ls bin/fm-dispatch-select.sh
ls: cannot access '/home/dhajczuk/.no-mistakes/worktrees/31702870740f/01KYJGB77Y6AZXHGAGM5WTZ05H/bin/fm-dispatch-select.sh': No such file or directory
$ grep -rl fm-dispatch-select . (excluding .git)
tests/fm-instruction-owners.test.sh
(the only remaining mention is the regression guard asserting AGENTS.md never resurrects it)
Evidence: Mutation proof: every routing constraint in the intent is enforced, not just asserted

== baseline: unmodified tree == exit=0 ok - captain routing profiles remain agent-owned and keep persistent secondmates pinned ### security pin downgraded to GLM 5.1 in the shipped example exit=1 not ok - dispatch example lost the GLM 5.2 hard pin, a standing implementation default, or retained GLM 5.1 ### security hard pin removed from AGENTS.md exit=1 not ok - captain routing contract lost 'hard-pin Pi zai/glm-5.2 at high effort' ### GLM 5.1 / Opus / Sol / Fable fallback prohibition removed from AGENTS.md exit=1 not ok - captain routing contract lost 'never substitute GLM 5.1, Opus, Sol, Fable, or a random candidate' ### stale/unscorable-quota fail-closed rule removed from AGENTS.md exit=1 not ok - captain routing contract lost 'Stale, unavailable, or unscorable quota is unresolved evidence' ### standing implementation profiles removed from AGENTS.md exit=1 not ok - captain routing contract lost 'direct Grok Build grok-4.5, Claude opus, Codex gpt-5.6-sol, and Pi openai-codex/gpt-5.6-sol' ### one standing implementation profile (Claude opus) dropped from the example default set exit=1 not ok - dispatch example lost the GLM 5.2 hard pin, a standing implementation default, or retained GLM 5.1 ### example security rule replaced by a random-fallback array exit=1 not ok - dispatch example lost the GLM 5.2 hard pin, a standing implementation default, or retained GLM 5.1 ### persistent secondmate Pi Luna pin removed exit=1 not ok - persistent secondmate Pi Luna pin is missing ### removed fm-dispatch-select.sh selector resurrected in AGENTS.md exit=1 not ok - agent-owned routing policy resurrected the removed selector

== baseline: unmodified tree ==
exit=0
ok - captain routing profiles remain agent-owned and keep persistent secondmates pinned

### security pin downgraded to GLM 5.1 in the shipped example
exit=1
not ok - dispatch example lost the GLM 5.2 hard pin, a standing implementation default, or retained GLM 5.1

### security hard pin removed from AGENTS.md
exit=1
not ok - captain routing contract lost 'hard-pin Pi `zai/glm-5.2` at high effort'

### GLM 5.1 / Opus / Sol / Fable fallback prohibition removed from AGENTS.md
exit=1
not ok - captain routing contract lost 'never substitute GLM 5.1, Opus, Sol, Fable, or a random candidate'

### stale/unscorable-quota fail-closed rule removed from AGENTS.md
exit=1
not ok - captain routing contract lost 'Stale, unavailable, or unscorable quota is unresolved evidence'

### standing implementation profiles removed from AGENTS.md
exit=1
not ok - captain routing contract lost 'direct Grok Build `grok-4.5`, Claude `opus`, Codex `gpt-5.6-sol`, and Pi `openai-codex/gpt-5.6-sol`'

### one standing implementation profile (Claude opus) dropped from the example default set
exit=1
not ok - dispatch example lost the GLM 5.2 hard pin, a standing implementation default, or retained GLM 5.1

### example security rule replaced by a random-fallback array
exit=1
not ok - dispatch example lost the GLM 5.2 hard pin, a standing implementation default, or retained GLM 5.1

### persistent secondmate Pi Luna pin removed
exit=1
not ok - persistent secondmate Pi Luna pin is missing

### removed fm-dispatch-select.sh selector resurrected in AGENTS.md
exit=1
not ok - agent-owned routing policy resurrected the removed selector
Evidence: New focused test (shipped example vs real validator) with its mutation check

### baseline - shipped example ok - shipped crew-dispatch example validates and renders the captain-authorized pins ### mutation: security pin downgraded to zai/glm-5.1 not ok - shipped example lost the single-profile security hard pin (missing: 'security engagement. -> pi/zai/glm-5.2/high') ### mutation: grok profile given an effort the adapter rejects (xhigh) not ok - shipped dispatch example must pass bootstrap validation, got: CREW_DISPATCH: invalid config/crew-dispatch.json - invalid effort: grok:xhigh

# Focused test added: tests/fm-bootstrap.test.sh::test_shipped_dispatch_example_is_accepted_and_keeps_its_pins
# (run in a throwaway copy with the environment-broken orca case skipped: /usr/bin/orca exists on this box)

### baseline - shipped example
ok - shipped crew-dispatch example validates and renders the captain-authorized pins
### mutation: security pin downgraded to zai/glm-5.1
not ok - shipped example lost the single-profile security hard pin (missing: 'security engagement. -> pi/zai/glm-5.2/high')
### mutation: grok profile given an effort the adapter rejects (xhigh)
not ok - shipped dispatch example must pass bootstrap validation, got: CREW_DISPATCH: invalid config/crew-dispatch.json - invalid effort: grok:xhigh
Evidence: Reproducible operator-walkthrough script (evidence generator)
#!/usr/bin/env bash
# End-to-end operator walkthrough of the agent-owned routing correction:
#  1. copy docs/examples/crew-dispatch.json into a real firstmate home config
#  2. run the real bin/fm-bootstrap.sh validator (quiet path + verbose facts)
#  3. read the persistent-secondmate pin back through bin/fm-harness.sh
#  4. confirm bin/fm-dispatch-select.sh stays removed
set -u

ROOT=${ROOT:?set ROOT to the firstmate worktree}
WORK=$(mktemp -d /tmp/fm-routing-evidence.XXXXXX)
BASE_PATH=/usr/bin:/bin:/usr/sbin:/sbin
HOME_DIR="$WORK/home"
FAKEBIN="$WORK/fakebin"
mkdir -p "$HOME_DIR/config" "$FAKEBIN"
git init -q "$HOME_DIR" 2>/dev/null || true

# Minimal fake toolchain so bootstrap reaches dispatch validation without
# depending on the developer machine's real tools.
for tool in tmux node gh-axi chrome-devtools-axi lavish-axi quota-axi gh; do
  printf '#!/usr/bin/env bash\nexit 0\n' > "$FAKEBIN/$tool"
done
cat > "$FAKEBIN/treehouse" <<'SH'
#!/usr/bin/env bash
if [ "${1:-}" = get ] && [ "${2:-}" = --help ]; then
  printf '%s\n' 'Usage: treehouse get [--lease] [--lease-holder <holder>]'
fi
exit 0
SH
cat > "$FAKEBIN/no-mistakes" <<'SH'
#!/usr/bin/env bash
[ "${1:-}" = --version ] && printf '%s\n' 'no-mistakes version v1.31.2 (fake) 2026-06-27T00:02:18Z'
exit 0
SH
cat > "$FAKEBIN/tasks-axi" <<'SH'
#!/usr/bin/env bash
[ "${1:-}" = --version ] && { printf '%s\n' 0.1.1; exit 0; }
if [ "${1:-}" = update ] && [ "${2:-}" = --help ]; then
  printf '%s\n' 'usage: tasks-axi update <id> [flags]' '  --body-file <path>' '  --archive-body'; exit 0
fi
if [ "${1:-}" = mv ] && [ "${2:-}" = --help ]; then
  printf '%s\n' 'usage: tasks-axi mv <id> [<id>...] --to <path-or-dir>'; exit 0
fi
exit 0
SH
printf '#!/usr/bin/env bash\nexec %s "$@"\n' "$(command -v jq)" > "$FAKEBIN/jq"
chmod +x "$FAKEBIN"/*
printf '%s\n' manual > "$HOME_DIR/config/backlog-backend"

echo "### 1. Captain copies the shipped example into the operational home"
cp "$ROOT/docs/examples/crew-dispatch.json" "$HOME_DIR/config/crew-dispatch.json"
echo "\$ cp docs/examples/crew-dispatch.json ~/firstmate/config/crew-dispatch.json"
echo

echo "### 2. Real bootstrap validation - a valid dispatch config stays silent"
echo "\$ bin/fm-bootstrap.sh"
out=$(PATH="$FAKEBIN:$BASE_PATH" FM_BACKEND=tmux FM_HOME="$HOME_DIR" FM_ROOT_OVERRIDE="$HOME_DIR" \
  bash "$ROOT/bin/fm-bootstrap.sh" 2>&1)
if [ -z "$out" ]; then
  echo "(no output - config accepted, no CREW_DISPATCH error)"
else
  printf '%s\n' "$out"
fi
echo

echo "### 3. Same run with facts on - the routing table firstmate will apply"
echo "\$ FM_BOOTSTRAP_VERBOSE_FACTS=1 bin/fm-bootstrap.sh"
PATH="$FAKEBIN:$BASE_PATH" FM_BACKEND=tmux FM_HOME="$HOME_DIR" FM_ROOT_OVERRIDE="$HOME_DIR" \
  FM_BOOTSTRAP_VERBOSE_FACTS=1 bash "$ROOT/bin/fm-bootstrap.sh" 2>&1
echo

echo "### 4. Persistent secondmate pin read back through the real resolver"
printf '%s\n' 'pi openai-codex/gpt-5.6-luna high' > "$HOME_DIR/config/secondmate-harness"
echo "\$ cat config/secondmate-harness"
cat "$HOME_DIR/config/secondmate-harness"
for sub in secondmate secondmate-model secondmate-effort; do
  printf '$ bin/fm-harness.sh %s\n' "$sub"
  PATH="$FAKEBIN:$BASE_PATH" FM_HOME="$HOME_DIR" FM_ROOT_OVERRIDE="$HOME_DIR" \
    bash "$ROOT/bin/fm-harness.sh" "$sub"
done
echo

echo "### 5. The selector removed upstream in 3f71cdd stays removed"
echo "\$ ls bin/fm-dispatch-select.sh"
ls "$ROOT/bin/fm-dispatch-select.sh" 2>&1 || true
echo "\$ grep -rl fm-dispatch-select . (excluding .git)"
hits=$(grep -rl 'fm-dispatch-select' "$ROOT" --exclude-dir=.git 2>/dev/null | sed "s|$ROOT/||")
if [ -z "$hits" ]; then
  echo "(no references anywhere in the tree)"
else
  printf '%s\n' "$hits"
  echo "(the only remaining mention is the regression guard asserting AGENTS.md never resurrects it)"
fi

rm -rf "$WORK"
Evidence: Reproducible mutation-proof script (evidence generator)
#!/usr/bin/env bash
# Mutation proof: each routing constraint in the user intent is actually
# enforced. Every mutation is applied to a throwaway copy of the tree; the
# real worktree is never modified.
set -u

ROOT=${ROOT:?set ROOT to the firstmate worktree}
WORK=$(mktemp -d /tmp/fm-guard-mutations.XXXXXX)
trap 'rm -rf "$WORK"' EXIT

run_case() {
  local label=$1 shadow out rc
  shift
  shadow="$WORK/case-$RANDOM"
  cp -a "$ROOT" "$shadow"
  rm -f "$shadow/.git"
  ( cd "$shadow" && "$@" )
  out=$(bash "$shadow/tests/fm-instruction-owners.test.sh" 2>&1)
  rc=$?
  printf '### %s\n' "$label"
  printf 'exit=%s\n' "$rc"
  printf '%s\n\n' "$(printf '%s\n' "$out" | grep -E '^not ok' || printf '%s\n' "$out" | tail -1)"
}

echo "== baseline: unmodified tree =="
out=$(bash "$ROOT/tests/fm-instruction-owners.test.sh" 2>&1); rc=$?
printf 'exit=%s\n' "$rc"
printf '%s\n\n' "$(printf '%s\n' "$out" | grep -E 'captain routing profiles')"

run_case "security pin downgraded to GLM 5.1 in the shipped example" \
  sed -i 's|zai/glm-5.2|zai/glm-5.1|' docs/examples/crew-dispatch.json

run_case "security hard pin removed from AGENTS.md" \
  sed -i '/hard-pin Pi `zai\/glm-5.2` at high effort/d' AGENTS.md

run_case "GLM 5.1 / Opus / Sol / Fable fallback prohibition removed from AGENTS.md" \
  sed -i '/never substitute GLM 5.1, Opus, Sol, Fable, or a random candidate/d' AGENTS.md

run_case "stale/unscorable-quota fail-closed rule removed from AGENTS.md" \
  sed -i '/Stale, unavailable, or unscorable quota is unresolved evidence/d' AGENTS.md

run_case "standing implementation profiles removed from AGENTS.md" \
  sed -i '/direct Grok Build `grok-4.5`, Claude `opus`, Codex `gpt-5.6-sol`/d' AGENTS.md

run_case "one standing implementation profile (Claude opus) dropped from the example default set" \
  bash -c 'jq "(.default) |= map(select(.model != \"opus\"))" docs/examples/crew-dispatch.json > t && mv t docs/examples/crew-dispatch.json'

run_case "example security rule replaced by a random-fallback array" \
  bash -c 'jq "(.rules[0].use) = [{harness:\"pi\",model:\"zai/glm-5.1\",effort:\"high\"},{harness:\"claude\",model:\"opus\",effort:\"high\"}]" docs/examples/crew-dispatch.json > t && mv t docs/examples/crew-dispatch.json'

run_case "persistent secondmate Pi Luna pin removed" \
  sed -i '/pi openai-codex\/gpt-5.6-luna high/d' .agents/skills/secondmate-provisioning/SKILL.md

run_case "removed fm-dispatch-select.sh selector resurrected in AGENTS.md" \
  bash -c 'printf "%s\n" "Run bin/fm-dispatch-select.sh to choose a profile." >> AGENTS.md'
- Outcome: ⚠️ 3 issues (2 warnings, 1 info) across 1 run (21m11s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ℹ️ docs/examples/crew-dispatch.json:15 - docs/examples/crew-dispatch.json:15 keeps the rule whose when describes "a trivial mechanical edit such as a rote rename, formatting sweep, targeted typo fix" but now resolves it to claude/opus/high, and replaces the old rationale with "Claude Code implementation work uses Opus at high effort." The rule's selection category (cheapest fast profile for narrow, low-ambiguity work) no longer has any distinct effect - it resolves identically to the standing implementation profile - while AGENTS.md:180 and harness-adapters SKILL.md:111 still describe low as the intended level for well-understood bounded work (as a fallback that configured effort legitimately overrides, so this is not a functional conflict). Consider whether this rule should be dropped from the example or its when/why reworded, rather than advertising the most expensive profile for the trivially-scoped category.
  • ℹ️ AGENTS.md:166 - AGENTS.md:166 still states routing precedence as "an explicit per-task captain override, then the best-fit configured rule, then the configured default, then the static crewmate harness" with no security exception, while the new AGENTS.md:174 requires security/bug-bounty crewmates to "bypass ordinary profile-array selection" and hard-pin Pi zai/glm-5.2. A local crew-dispatch.json with no security rule but a broad matching rule (e.g. the "big or ambiguous multi-file feature" array in the example) leaves an agent reading the precedence line first with a configured-rule match that appears to win - exactly the array selection the hard pin is meant to bypass. Since enforcement here is purely textual, a clause on line 166 noting that the security hard pin outranks configured rules would close the ambiguity.
  • ℹ️ tests/fm-instruction-owners.test.sh:156 - tests/fm-instruction-owners.test.sh:156 invokes jq unguarded and funnels any nonzero exit into fail &#34;dispatch example lost the GLM 5.2 hard pin or retained GLM 5.1&#34;. On a host without jq (which the repo treats as an optional dependency - bin/fm-bootstrap.sh:707 reports MISSING: jq through install-consent), this test reports a false policy regression instead of a missing tool. Repo convention is either a skip guard (tests/fm-crew-state.test.sh:795) or an explicit jq-specific failure (tests/fm-bootstrap.test.sh:115); adopt one of those.
  • ℹ️ tests/fm-instruction-owners.test.sh:158 - The new jq assertion in tests/fm-instruction-owners.test.sh:156-164 pins only the bug-bounty rule and the absence of zai/glm-5.1; the four standing implementation profiles that this change actually rewrote in the example (grok/grok-4.5, claude/opus, codex/gpt-5.6-sol, pi/openai-codex/gpt-5.6-sol, all at high) are asserted only as an AGENTS.md prose phrase. The example file could silently drift back to weaker or older profiles - the exact regression this change corrects - and the suite would still pass. Extend the same jq check to assert those profiles in .default.

🔧 Fix: route trivial-edit rule to Grok, clarify security pin precedence
2 infos still open:

  • ℹ️ AGENTS.md:173 - AGENTS.md:173 says the standing high-effort profiles yield to "a more specific project rule or explicit captain override" but is silent about the configured default, which the precedence chain on line 166 lists as its own tier. An existing home whose config/crew-dispatch.json carries an older default (e.g. {&#34;harness&#34;:&#34;codex&#34;,&#34;model&#34;:&#34;gpt-5.5&#34;,&#34;effort&#34;:&#34;medium&#34;}) leaves an agent with two defensible readings: follow the configured default per line 166, or substitute the standing Sol/Opus profile per line 173. The intent requires preserving compatibility for existing homes and static pins, which resolves the ambiguity in favor of the configured default, so adding "or configured default" to the exception clause on line 173 closes it. Enforcement here is purely textual, so precision is the only mechanism.
  • ℹ️ docs/examples/crew-dispatch.json:16 - The trivial-edit rule's why reads "Direct Grok Build takes narrow low-ambiguity mechanical work; Opus at high effort stays the standing profile for Claude implementation and design work, and Sol at high effort for Codex and Pi." Per docs/configuration.md:217, why is rationale "that helps firstmate choose" this rule, and firstmate matches rules with judgment over when plus why. Two thirds of this why describes Claude/Codex/Pi implementation and design work - the category this rule is explicitly not for (its when requires "no design or ambiguity to resolve") - so a design-heavy Claude implementation task can plausibly best-fit against this rule's text and get routed to Grok. The standing-profile statement already lives in its authoritative place at AGENTS.md:173; trimming the why to the Grok rationale alone would keep the rule's selection signal aligned with its when.

🔧 Fix: scope trivial-edit rule rationale to its own category
2 infos still open:

  • ℹ️ tests/fm-instruction-owners.test.sh:146 - The new phrase loop at tests/fm-instruction-owners.test.sh:146-153 pins five AGENTS.md statements but omits the precedence clause added at AGENTS.md:166 ("then the bug-bounty and security-engagement hard pin below"). That clause is the only text stating the hard pin outranks a matching configured rule; the hard-pin sentence itself (AGENTS.md:174) says only "bypass ordinary profile-array selection", which does not tell an agent what to do when a broad configured rule such as the example's "big or ambiguous multi-file feature" array matches a security task first. This file's own header (line 3) states it exists to guard these statements across "the AGENTS.md reduction pass", and every other statement this change added is pinned, so the precedence clause is the single unprotected one. Add 'then the bug-bounty and security-engagement hard pin below' to the same loop.
  • ℹ️ tests/fm-instruction-owners.test.sh:177 - tests/fm-instruction-owners.test.sh:177 asserts only that the string 'fm-dispatch-select' is absent from AGENTS.md, but its failure message is "agent-owned routing policy resurrected the removed selector" and the intent's forbidden behavior is resurrecting bin/fm-dispatch-select.sh (removed upstream in 3f71cdd). A re-added bin/fm-dispatch-select.sh that is wired through docs/configuration.md or fm-spawn.sh without any AGENTS.md mention passes this assertion unchanged, so the guard does not detect the condition it names. Add assert_absent "$ROOT/bin/fm-dispatch-select.sh" alongside the existing prose check.
⚠️ **Test** - 3 issues (2 warnings, 1 info)
  • ⚠️ tests/fm-bootstrap.test.sh:351 - Pre-existing environment failure, not caused by this change: tests/fm-bootstrap.test.sh::test_orca_backend_gates_orca_tool_only_when_selected assumes orca is absent from the base PATH, but /usr/bin/orca (the GNOME screen reader) ships on this Linux box, so bootstrap never emits the expected MISSING: orca line. This aborts the bootstrap suite before later cases, so I exercised the newly added dispatch-example case in a throwaway copy with that one case skipped. Reproduces identically at branch parent a5fe1bc. Fixing it would mean shadowing orca in the fake toolchain, which is outside this change's scope.
  • ⚠️ tests/fm-calm-pi-extension.test.sh:1091 - Pre-existing flaky test, not caused by this change: tests/fm-calm-pi-extension.test.sh fails its live tmux Pi follow-up e2e with "rendered a duplicate captain answer", but names a different sub-case on each run (absent, legacy_away, loaded_off, exact_watcher), which points at a timing race in the capture-pane polling rather than a deterministic defect. It fails the same way at branch parent a5fe1bc, and the branch touches no .pi extension or runtime code.
  • ℹ️ bin/fm-test-run.sh:392 - Pre-existing locale sensitivity, not caused by this change: run_coverage_guard writes its intermediate lists with LC_ALL=C sort but invokes comm under the ambient locale, so under en_US.UTF-8 comm reports "file 2 is not in sorted order" and --check-coverage exits 1 (taking tests/fm-test-run.test.sh with it). LC_ALL=C bin/fm-test-run.sh --check-coverage prints FM_TEST_COVERAGE ok. Worth a one-line locale pin on the comm calls in a separate change.
  • bash bin/fm-test-run.sh tests/fm-instruction-owners.test.sh - all 12 contract assertions green, including the new captain-routing case
  • bash bin/fm-test-run.sh --changed --base a5fe1bc - the runner's own changed-file mapping selects the pure-contract-unit family (31 scripts) for these files; 29 green, 2 pre-existing failures unrelated to the change
  • Manual operator walkthrough: copied docs/examples/crew-dispatch.json into a firstmate home config and ran the real bin/fm-bootstrap.sh (silent = accepted) and FM_BOOTSTRAP_VERBOSE_FACTS=1 bin/fm-bootstrap.sh (renders the resolved routing table)
  • bin/fm-harness.sh secondmate / secondmate-model / secondmate-effort against a home pinned to pi openai-codex/gpt-5.6-luna high
  • Mutation proof (throwaway tree copies, worktree untouched): GLM 5.1 downgrade in the example, security hard pin deleted from AGENTS.md, GLM 5.1/Opus/Sol/Fable prohibition deleted, stale-quota fail-closed rule deleted, standing implementation profiles deleted, Claude opus dropped from the default set, security rule replaced by a random-fallback array, Luna secondmate pin deleted, and fm-dispatch-select.sh resurrected - each turns tests/fm-instruction-owners.test.sh red
  • Added tests/fm-bootstrap.test.sh::test_shipped_dispatch_example_is_accepted_and_keeps_its_pins, then mutation-checked it (GLM 5.1 downgrade and a grok xhigh effort the adapter rejects both fail it)
  • ls bin/fm-dispatch-select.sh and grep -rl fm-dispatch-select - selector absent, only remaining mention is the regression guard
  • Pre-existing-failure isolation: ran tests/fm-calm-pi-extension.test.sh and tests/fm-bootstrap.test.sh against a git archive a5fe1bc extract of the branch parent; both fail there too
⚠️ **Document** - 1 warning
  • ⚠️ docs/configuration.md:176 - docs/configuration.md:176 claims "claude, codex, opencode, pi, grok, and kimi are empirically verified for crewmate and secondmate launches", but every other evidence surface scopes Kimi to crewmates only: the upstream commit is titled "add verified Kimi crewmate adapter", .agents/skills/harness-adapters/SKILL.md states Kimi is outside the primary turn-end guard scope, docs/turnend-guard.md documents its hook as a crew wake integration, and docs/supervision-protocols/ has no Kimi primary protocol (secondmates run as primaries in their own home). I could not establish whether upstream verified Kimi secondmate launches and left the sentence unchanged rather than unilaterally narrowing a supported-scope claim.
✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

kunchenguid and others added 12 commits July 25, 2026 01:36
* Replace quota dispatch selector instructions

* no-mistakes(review): Align bootstrap docs with agent-owned dispatch selection
* remove vestigial dispatch selector

* no-mistakes(review): Synchronize isolation proof and portable shard evidence

* no-mistakes(review): Correct shard history and proof archive date

* no-mistakes(review): Remove reintroduced selector documentation reference

* no-mistakes(document): Remove stale dispatch strategy documentation
…1039)

quota-axi 0.1.13 emits schemaVersion 2 with a quotaSemantics object per
provider, so the successor named in the interim rule has landed and the
rule's own removal condition is satisfied.

Keep the ownership clause so quota-axi remains the single owner of how
model or product windows relate to bounding account windows, and drop
the interim weakest-headroom instruction. The unknown-semantics case is
already covered by the existing requirement to stop and report a
candidate whose applicable quota data or interpretation cannot be
established.

Drop the matching assertion phrase from
tests/fm-instruction-owners.test.sh; the retained ownership phrase still
asserts.
…unchenguid#1049)

* fix(tmux): scope Claude busy detection by harness

* no-mistakes(review): Separate verified and fallback busy signatures

* no-mistakes(test): Scope busy signatures to supplied harnesses

* no-mistakes(document): Document harness-scoped busy detection
* Add verified Kimi crewmate harness adapter

* no-mistakes(review): Scope Kimi moon detection to spinner lines

* no-mistakes(review): Match only complete Kimi spinner rows

* no-mistakes(review): Resolve Kimi binary portably before pane creation

* no-mistakes(document): Align Kimi adapter documentation

* no-mistakes(lint): Suppress false-positive ShellCheck warning for sourced watcher override

* Fix Kimi busy spinner detection

* no-mistakes(review): Recognize Kimi session-lock ancestry and holders

* no-mistakes(review): Scope pending-reply Kimi busy detection by harness

* no-mistakes(document): Correct Kimi spinner capture documentation

* no-mistakes(document): Clarify optional Kimi spinner whitespace

* no-mistakes(lint): Silence intentional pending-reply test stub warnings

* test: align rebased Kimi busy fixtures

* no-mistakes: apply CI fixes

* Reconcile Kimi busy detection after per-harness scoping

* no-mistakes(review): Clarify observed Kimi spinner whitespace contract

* no-mistakes(document): Clarify Kimi harness documentation
* fix kimi pointer submission and spinner conformance

* no-mistakes(review): Preserve Kimi submit target ownership guard
* Add guarded Kimi turn-end hook

* no-mistakes(review): Require jq before installing Kimi turn-end hook

* no-mistakes(review): Expose jq inside isolated Kimi test fixtures

* no-mistakes(review): Preserve Kimi config boundaries during hook removal

* no-mistakes(review): Document Kimi removal newline safeguard

* no-mistakes(document): Document Kimi shared-home preservation
)

* Fix structural tmux composer reading

* Verify Calm compatibility with Pi 0.82

* no-mistakes(review): Harden structural composer classification boundaries

* no-mistakes(review): Refresh composer and Kimi regression fixtures

* no-mistakes(review): Fail closed on unbounded composer edges

* no-mistakes(review): Enforce aligned composer geometry safely

* no-mistakes(review): Make composer ambiguity locale-safe

* no-mistakes(review): Preserve ambiguity through composer submission

* no-mistakes(review): Carry composer proof through retries

* no-mistakes(document): Document structural tmux composer delivery guarantees

* no-mistakes: apply CI fixes
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

2 participants