Skip to content

fix(bin): let a worker prefer a project's role agents when it subagents - #21

Merged
max-metaplanet merged 1 commit into
mainfrom
fm/role-agent-preference
Oct 3, 2026
Merged

max-metaplanet merged 1 commit into
mainfrom
fm/role-agent-preference

Conversation

@max-metaplanet

Copy link
Copy Markdown
Owner

Intent

Workers launched by firstmate are told, in the worker role contract every launch brief opens with, to do the assigned work themselves and not to delegate the task, and nothing in the brief mentions project-provided role agents.
In practice this steers workers toward the harness's built-in general subagents whenever they split off part of their own work, so a project's installed role agents (for example a project plugin that ships a Reviewer, an Implementer and an Analyst) go unused - one project measured zero calls across six such agents.

Wanted behaviour: when a worker uses subagents for parts of its own task, it prefers a fitting installed role agent where the project provides one, over a generic built-in subagent.
The rule that the worker must not hand off the task itself, nor adopt a supervisor identity, stays exactly as strong as it is today.
The change must stay project-neutral, because firstmate is a shared template used across many unrelated projects: no project, plugin, or agent names baked in as requirements.

What Changed

  • The worker role contract that fm_brief_worker_role (bin/fm-dod-lib.sh) puts at the top of every ship/scout launch brief now forbids delegating "the task itself" instead of just "the task". It also adds a line saying workers may hand parts of their own work to subagents, as long as they stay accountable for the result. When they do, they should prefer a fitting role agent from the project or its installed plugins over a generic built-in one. The line names no project, plugin or agent.
  • The comment on fm_brief_worker_role now says this contract is the one place that separates handing off the task (still forbidden) from subagenting parts of it (allowed). It also points to docs/subagent-guard.md, which owns the primary's own delegation guard.
  • tests/fm-spawn-dispatch-profile.test.sh now checks that each delivered launch command still forbids delegating the task itself and includes the role-agent preference line.

Risk Assessment

✅ Low: The change edits one prompt line and adds one in the worker role contract. The new wording is project-neutral and keeps the bans on handing off the task and on adopting a supervisor identity. The tests check the emitted launch prompt, which counts as a generated interface, and no other code depends on the old wording.

Testing

I launched real fm-spawn.sh ship and scout workers through a stub harness that records the arguments it receives, then decoded the launch-brief envelope into the final prompt. All 9 brief/mode variants deliver the role contract exactly once, before the task. It keeps the ban on delegating the task itself and on taking a supervisor identity, and adds the project-neutral role-agent preference. The full fm-spawn-dispatch-profile suite also passed, including the secondmate cases that must not get the worker contract. I did not run a live LLM worker to see whether it actually picks a project role agent; that depends on how the model reads the prompt and needs a Herdr lab with a live Claude seat. The decoded prompts are saved in the evidence directory. This is a prompt-only change with no UI, so there are no screenshots.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A ship worker launched by fm-spawn.sh gets a prompt telling it to prefer a project's installed role agent over a generic built-in subagent when it subagents part of its work ✅ pass live worker-role-contract-delivered-prompts.log: all 9 heading/legacy/scaffold × no-mistakes/direct-PR/local-only variants plus scout carry the new sentence in the decoded final prompt
Adversarial: the delivered contract still forbids handing off the task itself and adopting a firstmate/secondmate identity, and stays the first section, appearing once ✅ pass live worker-role-contract-delivered-prompts.log + test_worker_launch_delivers_role_scope (role section first, before # Task, count = 1, 'delegate the task itself' and 'do not adopt a firstmate or secondmat…
Adversarial: the guidance stays project-neutral, with no project, plugin or agent names required ✅ pass live The role-contract section taken from every delivered prompt has 0 matches for metaplanet/Reviewer/Implementer/Analyst; the bin/ diff adds none
A secondmate launch still gets its supervisor charter with no worker contract added ✅ pass live fm-spawn-dispatch-profile.log: 'a persistent claude secondmate keeps its supervisor contract without a task-worker authority overlay' ok
A real Claude worker given a project that ships role agents actually sends subtasks to those agents instead of general-purpose ⏸️ untested no This depends on how a live LLM reads the prompt. Testing it needs a provisioned fm-lab-* Herdr session (bin/fm-herdr-lab.sh) with a live Claude seat, a test project with role agents installed, and a m…
Evidence: Decoded final worker prompts for all 9 ship/scout launch variants

Source: Decoded final worker prompts for all 9 ship/scout launch variants

# all fm-spawn-dispatch-profile tests passed
# evidence begin: heading no-mistakes worker
warning: /private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/home/data/role-launch-heading-no-mistakes/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/fake/fakebin/timeout: line 3: exec: 1: not found
/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/fake/fakebin/timeout: line 3: exec: 1: not found
spawned role-launch-heading-no-mistakes harness=codex kind=ship mode=no-mistakes yolo=off window=firstmate:fm-role-launch-heading-no-mistakes worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/wt
launch command executed with an argv-capture harness:
export COMPACT_ADVISER_DISABLE=1; env -u CURSOR_AGENT -u CURSOR_INVOKED_AS -u GEMINI_CLI codex --dangerously-bypass-approvals-and-sandbox --disable hooks -c "notify=[\"bash\",\"-c\",\"touch '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/home/state/role-launch-heading-no-mistakes.turn-ended'\"]" "$('~/.no-mistakes/worktrees/61c6dd39b831/01M41QBWMVBDN46W2YE02XE08W/bin/fm-operational-input.sh' encode launch-brief < '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/home/data/role-launch-heading-no-mistakes/launch-brief.md')"
received arguments and final prompt:
# Current worker role contract
You are a crewmate: an autonomous worker agent managed by firstmate.
This section establishes your current identity before every project or task instruction below and supersedes any conflicting role identity in those instructions.
Do the assigned work yourself and report only to firstmate; do not adopt a firstmate or secondmate supervisor identity, delegate the task itself, run fleet supervision, or address the captain.
Splitting parts of your own work out to subagents is fine where your harness offers them and you stay accountable for the result; when you do, prefer a fitting role agent the project or its installed plugins provide over a generic built-in one.
Your steering inbox is `/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-heading-no-mistakes/home/state/role-launch-heading-no-mistakes.inbox`; this exact path belongs to your current task even when it is outside the worktree or under the supervising firstmate home, so read and acknowledge its messages and do not reject it as another home's state.
Never inspect or change any other home's endpoint namespace; this authorization is limited to the exact task paths named by this brief.
When this task works on Firstmate itself, the repository root `AGENTS.md` (also imported by `CLAUDE.md`) is project content and the supervisor contract for the firstmate managing you: follow this brief instead of that supervisor contract.
Project instructions still govern the work wherever they do not conflict with this worker identity, including `CONTRIBUTING.md` and `firstmate-coding-guidelines` for Firstmate changes.

# Task
## Captain's intent
brief for role-launch-heading-no-mistakes

## Firstmate spec
Exercise the spawn behavior under test.

# Worker role
Follow the project instructions.

# Current no-mistakes intent contract
This section supersedes every earlier brief instruction about constructing `--intent`, but not later clarifications actually supplied by the captain.
Use everything under `## Captain intent authorized for --intent` through the end of this brief, including any nested subheadings but excluding that heading, plus any later words the captain actually supplied as `--intent`; never include Firstmate specification or other mixed Task content.
Preserve those words without adding speaker labels or direct address.
Firstmate-authored constraints, acceptance criteria, implementation details, decisions, and tradeoffs are specification, not captain intent.
The Definition of done's rule that `--intent` must be self-sufficient still governs the string you pass: resolve any report, decision, or PR the intent below refers to into its substance rather than passing the pointer.

## Captain intent authorized for --intent
brief for role-launch-heading-no-mistakes
authored brief remains byte-identical
# evidence end
# evidence begin: legacy no-mistakes worker
warning: /private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/home/data/role-launch-legacy-no-mistakes/launch-brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/fake/fakebin/timeout: line 3: exec: 1: not found
/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/fake/fakebin/timeout: line 3: exec: 1: not found
spawned role-launch-legacy-no-mistakes harness=codex kind=ship mode=no-mistakes yolo=off window=firstmate:fm-role-launch-legacy-no-mistakes worktree=/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/wt
launch command executed with an argv-capture harness:
export COMPACT_ADVISER_DISABLE=1; env -u CURSOR_AGENT -u CURSOR_INVOKED_AS -u GEMINI_CLI codex --dangerously-bypass-approvals-and-sandbox --disable hooks -c "notify=[\"bash\",\"-c\",\"touch '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/home/state/role-launch-legacy-no-mistakes.turn-ended'\"]" "$('~/.no-mistakes/worktrees/61c6dd39b831/01M41QBWMVBDN46W2YE02XE08W/bin/fm-operational-input.sh' encode launch-brief < '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/home/data/role-launch-legacy-no-mistakes/launch-brief.md')"
received arguments and final prompt:
# Current worker role contract
You are a crewmate: an autonomous worker agent managed by firstmate.
This section establishes your current identity before every project or task instruction below and supersedes any conflicting role identity in those instructions.
Do the assigned work yourself and report only to firstmate; do not adopt a firstmate or secondmate supervisor identity, delegate the task itself, run fleet supervision, or address the captain.
Splitting parts of your own work out to subagents is fine where your harness offers them and you stay accountable for the result; when you do, prefer a fitting role agent the project or its installed plugins provide over a generic built-in one.
Your steering inbox is `/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-legacy-no-mistakes/home/state/role-launch-legacy-no-mistakes.inbox`; this exact path belongs to your current task even when it is outside the worktree or under the supervising firstmate home, so read and acknowledge its messages and do not reject it as another home's state.
Never inspect or change any other home's endpoint namespace; this authorization is limited to the exact task paths named by this brief.
When this task works on Firstmate itself, the repository root `AGENTS.md` (also imported by `CLAUDE.md`) is project content and the supervisor contract for the firstmate managing you: follow this brief instead of that supervisor contract.
Project instructions still govern the work wherever they do not conflict with this worker identity, including `CONTRIBUTING.md` and `firstmate-coding-guidelines` for Firstmate changes.

# Task
## Captain's i

... [58324 bytes truncated] ...

tead of that supervisor contract.
Project instructions still govern the work wherever they do not conflict with this worker identity, including `CONTRIBUTING.md` and `firstmate-coding-guidelines` for Firstmate changes.

You are a crewmate: an autonomous worker agent managed by firstmate. Work on your own; do not wait for a human.

# Task
## Captain's intent
brief for role-launch-scaffold-scout

## Firstmate spec
Exercise the spawn behavior under test.

# Herdr lifecycle declaration - NOT ENABLED
**HARD SAFETY GATE:** this scaffold cannot inspect the task text filled in above.
If the task will start, stop, delete, restart, profile, or otherwise drive Herdr lifecycle behavior, stop and regenerate the brief with `--herdr-lab` before dispatch.
Do not add Herdr lifecycle commands to this unguarded brief by hand.

# Setup
You are in a disposable git worktree of arbitrary-project-name, at a detached HEAD on a clean default branch.
This is a SCOUT task: the deliverable is a written report, not a PR.
The worktree is your laboratory - install, run, edit, and make scratch commits freely; all of it is discarded at teardown.
The report is the only thing that survives, so anything worth keeping must be in it.

# Rules
1. Never push to any remote and never open a PR.
2. Stay inside this worktree; the only files you may write outside it are the report and the status file below.
3. Use gh-axi for GitHub operations and chrome-devtools-axi for browser operations.
4. Report status by appending one line:
   `echo "{state} [at=<epoch>]: {one short line}" >> '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/state/role-launch-scaffold-scout.status' && { [ ! -e '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/config/fleet-ledger' ] || '~/.no-mistakes/worktrees/61c6dd39b831/01M41QBWMVBDN46W2YE02XE08W/bin/fm-fleet-ledger.sh' appended '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/config' '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/state/role-launch-scaffold-scout.status' >/dev/null 2>&1 || true; }`
   States: working, needs-decision, blocked, paused, done, failed.
   Substitute `<epoch>` with the current Unix time in seconds - run `date +%s` and write the number it printed; a stamp that is not plain digits records no time at all.
   Each append wakes firstmate, so report sparingly: only phase changes a supervisor
   would act on and the needs-decision/blocked/paused/done/failed states. No step-by-step
   FYI progress lines; firstmate reads your pane for that.
   Whenever you mention a PR anywhere - a status line, your terminal, a summary - write its full
   https:// URL exactly as the forge printed it, never a bare number such as "PR 108"; firstmate
   copies that URL from your line rather than assembling one.
   Use `paused: {why}` - distinct from `blocked:` - ONLY when you are deliberately idling on a
   known external wait you expect to clear on its own (an upstream release, a rate-limit reset, a scheduled window, or your own validation round):
   firstmate then leaves your idle pane alone and rechecks it on a long cadence instead of
   treating it as a possible wedge. When you know when the wait clears, say so in the line with
   `until <YYYY-MM-DDTHH:MMZ>` (UTC) and firstmate rechecks at that time instead.
   Use `blocked:` when you are stuck and need help.
5. If you hit the same obstacle twice, append `blocked [at=<epoch>]: {why}` and stop; firstmate will help.
6. If a decision belongs to a human (product choices, destructive actions),
   append `needs-decision [at=<epoch>]: {summary of options}` and stop. Firstmate will reply with the decision.
   A decision or blocker you opened stays open until a `resolved` line carrying its exact key lands; a later `done:` or `working:` line never closes it, even when the answer is what started that work.
   Firstmate's reply normally writes that closing line at answer time; when a blocker or wait clears WITHOUT a firstmate reply, append `resolved [at=<epoch>]: {how it cleared}` yourself (same `[key=<slug>]` if you opened it with one) as you resume.
7. Never stop, restart, or update the shared `no-mistakes` daemon - it is one instance serving
   every lane/home, so restarting it kills other lanes' in-flight pipeline runs; only firstmate
   manages the daemon.
   Before you append `blocked:` about the pipeline, run `no-mistakes daemon status` and
   `no-mistakes axi status`. If the daemon socket refuses connections or is missing, append
   `blocked [at=<epoch>]: {the daemon error}` and stop even when the local run record still says running or
   fixing, because that record can be stale after the daemon exits. A run record failed with a
   daemon error is also a real block.
   Only after ruling out socket refusal, if the run is still running or fixing, reattach and keep
   going. A drive-call error, timeout, slow read, or generic unreachability is NOT a daemon error:
   the daemon accepts `respond` immediately and runs the round in the background, so a killed or
   timed-out call was only waiting for a read while the run kept working.

# Firstmate instruction inbox
Firstmate steers you through durable message files in '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/state/role-launch-scaffold-scout.inbox'.
When a terminal message says an instruction is waiting there - and at any natural checkpoint when you are unsure - list '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/state/role-launch-scaffold-scout.inbox'/*.msg, read and act on each message in numeric order, then acknowledge each handled message by moving it: `mv '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/state/role-launch-scaffold-scout.inbox'/NNN.msg '/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/state/role-launch-scaffold-scout.inbox'/handled/`.
The move IS the acknowledgement: without it firstmate rings again and eventually treats you as stuck. An empty or absent inbox needs no action.

# Definition of done
Write your findings to `/private/var/folders/1l/gg6b5zsx0qn753wwhcmmq8cr0000gn/T/fm-spawn-dispatch-profile.yQTn8z/role-launch-scaffold-scout/home/data/role-launch-scaffold-scout/report.md`.
The report must stand alone: what you did, what you found, the evidence (commands run, output, file:line references), and what you recommend.
If your deliverable is a visual artifact the captain will review and iterate on, use the lavish-axi rule: arm your board with bin/fm-procevent-lavish.sh arm <artifact.html> --for <task-id>; never run lavish-axi poll yourself. Re-arm with the reply after each nonterminal round to acknowledge it, route the board feedback through your steering inbox, write needs-decision [key=board-review] with the live board URL when the captain owes a decision, and stop at session_ended or an empty End without re-arming - acknowledge that final round with bin/fm-procevent.sh handled <source-id> <sequence> to conclude and retire your board.
Before reporting done, read and follow `~/.no-mistakes/worktrees/61c6dd39b831/01M41QBWMVBDN46W2YE02XE08W/.agents/skills/captain-hold-lifecycle/SKILL.md` and pass its shared completion gate for the report and any visual review.
When the report is complete, append `done [at=<epoch>]: {one-line conclusion}` to the status file and stop.
If your findings reveal work that should ship (e.g. you reproduced a bug and the fix is clear), say so in the report; firstmate may promote this task in place, and you would then receive mode-specific ship instructions as a follow-up message.
authored brief remains byte-identical
# evidence end
ok - fm-spawn: actual ship/scout launch commands deliver the worker role contract
Evidence: fm-spawn-dispatch-profile test transcript

Source: fm-spawn-dispatch-profile test transcript

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 - 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
bash tests/fm-spawn-dispatch-profile.test.sh  42.57s user 66.98s system 33% cpu 5:31.32 total
Evidence: Delivered role contract excerpt
# Current worker role contract
You are a crewmate: an autonomous worker agent managed by firstmate.
...
Do the assigned work yourself and report only to firstmate; do not adopt a firstmate or secondmate supervisor identity, delegate the task itself, run fleet supervision, or address the captain.
Splitting parts of your own work out to subagents is fine where your harness offers them and you stay accountable for the result; when you do, prefer a fitting role agent the project or its installed plugins provide over a generic built-in one.

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.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A ship worker launched by fm-spawn.sh gets a prompt telling it to prefer a project's installed role agent over a generic built-in subagent when it subagents part of its work ✅ pass live worker-role-contract-delivered-prompts.log: all 9 heading/legacy/scaffold × no-mistakes/direct-PR/local-only variants plus scout carry the new sentence in the decoded final prompt
Adversarial: the delivered contract still forbids handing off the task itself and adopting a firstmate/secondmate identity, and stays the first section, appearing once ✅ pass live worker-role-contract-delivered-prompts.log + test_worker_launch_delivers_role_scope (role section first, before # Task, count = 1, 'delegate the task itself' and 'do not adopt a firstmate or secondmat…
Adversarial: the guidance stays project-neutral, with no project, plugin or agent names required ✅ pass live The role-contract section taken from every delivered prompt has 0 matches for metaplanet/Reviewer/Implementer/Analyst; the bin/ diff adds none
A secondmate launch still gets its supervisor charter with no worker contract added ✅ pass live fm-spawn-dispatch-profile.log: 'a persistent claude secondmate keeps its supervisor contract without a task-worker authority overlay' ok
A real Claude worker given a project that ships role agents actually sends subtasks to those agents instead of general-purpose ⏸️ untested no This depends on how a live LLM reads the prompt. Testing it needs a provisioned fm-lab-* Herdr session (bin/fm-herdr-lab.sh) with a live Claude seat, a test project with role agents installed, and a m…
  • bash tests/fm-spawn-dispatch-profile.test.sh (whole file; the updated role-contract assertions plus secondmate, Claude and Codex launch-path cases) — all passed
  • FM_TEST_EVIDENCE=1 run of only test_worker_launch_delivers_role_scope (from a temporary filtered copy, since deleted) to capture the final decoded prompt fm-spawn.sh delivers to the harness for heading/legacy/scaffold × no-mistakes/direct-PR/local-only/scout
  • Pulled the '# Current worker role contract' section out of every captured prompt and checked: no-delegation sentence, new subagent sentence, no project-specific names (metaplanet/Reviewer/Implementer/Analyst: 0 hits)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

The worker role contract forbade "delegate the task" without distinguishing
handing the whole task off from splitting parts of the worker's own work out
to subagents. Workers read the blanket prohibition as covering both, so where
they did subagent they reached for the harness's generic built-in rather than
the role agents a project installs, and project-provided agents went unused.

Draw the line in fm_brief_worker_role, the one owner of that scope: delegating
the task itself stays forbidden, while subagenting parts of it is allowed with
the worker still accountable, preferring a fitting role agent the project or
its plugins provide over a generic built-in one. The wording stays
project-neutral and reads sensibly on a harness with no subagent concept.

docs/subagent-guard.md already scopes the primary's delegation guard away from
worker copies, so it needs no change; the function header now cross-references
it rather than restating that boundary.
@max-metaplanet
max-metaplanet merged commit b18e774 into main Oct 3, 2026
21 checks passed
max-metaplanet added a commit that referenced this pull request Oct 6, 2026
…ts (#21)

The worker role contract forbade "delegate the task" without distinguishing
handing the whole task off from splitting parts of the worker's own work out
to subagents. Workers read the blanket prohibition as covering both, so where
they did subagent they reached for the harness's generic built-in rather than
the role agents a project installs, and project-provided agents went unused.

Draw the line in fm_brief_worker_role, the one owner of that scope: delegating
the task itself stays forbidden, while subagenting parts of it is allowed with
the worker still accountable, preferring a fitting role agent the project or
its plugins provide over a generic built-in one. The wording stays
project-neutral and reads sensibly on a harness with no subagent concept.

docs/subagent-guard.md already scopes the primary's delegation guard away from
worker copies, so it needs no change; the function header now cross-references
it rather than restating that boundary.
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