Repository navigation
fix(bin): let a worker prefer a project's role agents when it subagents - #21
Merged
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.fm_brief_worker_rolenow says this contract is the one place that separates handing off the task (still forbidden) from subagenting parts of it (allowed). It also points todocs/subagent-guard.md, which owns the primary's own delegation guard.tests/fm-spawn-dispatch-profile.test.shnow 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.
Evidence: Decoded final worker prompts for all 9 ship/scout launch variants
Source: Decoded final worker prompts for all 9 ship/scout launch variants
Evidence: fm-spawn-dispatch-profile test transcript
Source: fm-spawn-dispatch-profile test transcript
Evidence: Delivered role contract excerpt
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.
bash tests/fm-spawn-dispatch-profile.test.sh(whole file; the updated role-contract assertions plus secondmate, Claude and Codex launch-path cases) — all passedFM_TEST_EVIDENCE=1run of onlytest_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/scoutPulled 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.