Repository navigation
feat(mate): one worker protocol for both workers - #37619
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
|
Paused by the owner: this change will be redone on top of #37609 after that one merges. The branch stays. |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The PR reuses the conductor side's one-table-plus-parity-test shape, keeps Notes
[DESIGN-REVIEWED] f5d94eb Description read[DESCRIPTION-READ] 711092de6750bfd996f497067dfdb27aa2116d4d4c50e65127ca163cb70159cd That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item traces to the 2026-11-06 ledger decision or the facade-import rule, and the worker half reuses the shape What this change shipsInventory (8 items) — 7 justifiedIntent: a Bot's worker follows the same ledger work protocol as Conductor mode's worker, from one copy of the text, and drift fails a test. ADDITION (prompt text plus a guard).
[FIRST-PRINCIPLES-REVIEWED] f5d94eb Description read[DESCRIPTION-READ] feba0ffe93268dec365f4f9e543e7743ed2a25382cbc032376f94da4b7f6e705 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] f5d94eb Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Code change approver recommendation: A person should decideWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 695 lines, more than the 400 it may approve on its own. Approve. The PR moves the worker protocol into one table, An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
3fa3d35 to
ca8b0b3
Compare
ca8b0b3 to
a51dbd5
Compare
a51dbd5 to
6094225
Compare
6094225 to
f5d94eb
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review confirmed four things. Joining _WORKER_PROMPT_SECTIONS rebuilds the kirocrew-worker prompt byte for byte, and its value pin and spec digests are unchanged. Only the kirocrew-mate-worker digests move. No reader of MATE_WORKER_PROMPT is left in src, scripts or test. The branch merges cleanly with current main.
Done well: the parity test checks identity against one rule table, and it carries positive controls (a planted section, a stale allowlist entry, a reworded copy) that prove the guard fires.
Optional:
- Line 5 of
test/fixtures/crewmate_prompts/ledger.golden.txtandall-met.golden.txtnow has the tracking-off conductor sentence ("could not be read"). That does not matchhas_ledger_tools: true. The preview script stubsbinding_has_ledger_toolsbut notbinding_ledger_off_reason. No test compares the goldens, so only the reading aid is wrong. You could revert that hunk, or fix the stub in a separate change. - The earlier "Paused by the owner" comment is still open. Its condition looks met, since this head is built on #37609. A one-line comment would close it on the record.
Problem / Motivation
Goal: A Bot's worker follows the same work protocol as a Conductor mode worker, from one copy of the text, and a test fails when the two drift.
Both workers are bound to one work-ledger item and report on it with
work_brief/work_report. Today they read two different prompts.kirocrew-workergets the full protocol (_WORKER_SYSTEM_PROMPT, about 5.5k characters). A Bot's worker,kirocrew-mate-worker, gets two sentences of it inworker.principles. It is never told the statuses andreasonvalues, which reports wake its conductor, to reportprogressbefore it parks, thatdoneis a claim, thesummarybar, thatdecisionis the one instruction field, the false-premise andbudget:rules, or the dependent-calls rule. It puts its plan in its reply, so the plan never reaches the ledger. No test notices: the only worker parity test holds the coding rules.Why it matters
A Bot's worker that does not know the statuses reports the wrong one, or none, and its Bot cannot read its state from the ledger. The accepted decision says the Bot and Ultra Mode must work the same way on the ledger; the worker half of that has no guard, so every protocol fix lands on one worker only.
Not a goal
kirocrew-workeris told. Its prompt bytes are unchanged.What changed (motivation → approach → change)
The conductor side already solved this problem with one rule table both conductors render (
_LEDGER_CONDUCTOR_RULES, held bytest/test_mate_conductor_parity.py). The worker side copies that shape, with no new mechanism._WORKER_SYSTEM_PROMPTonly_LEDGER_WORKER_RULESinagent_parts/spec_prompts.py, one copykirocrew-workerprompt_WORKER_PROMPT_SECTIONS; same bytesworker.principlesmate_worker.pytest/test_mate_worker_parity.pyA rule that is not true as written for a Bot's worker stays a
kirocrew-worker-only section. A Bot's worker's every turn end also wakes its Bot with a[Worker report](decision 2026-11-06: "the[Worker report]wake stays"). So it is never told that the report is the ONLY wake or that a silent turn wakes nobody. It is told instead that its Bot also reads its reply, and that only what it reports reaches the ledger. Three other sections stay worker-only for the same reason, each with a one-line reason in the test's allowlist:not_bound(a Bot also hands work over with no item),summary_language(names the goal board) andall_tools(a Bot's worker runs its Bot's kit). The Bot's worker gets one line of its own fornot_bound(its reply is its report, so the five plan lines open the reply) and for the summary language.The module constant
MATE_WORKER_PROMPTbecomes the functionmate_worker_prompt(), likeworker_agent.worker_prompt(), and every reader calls it (service_agents.py,context_assembly/agent_spec.py,scripts/crewmate_prompt_preview.py, the tests). Its text still ends with the coding rules, then the ask core and worker tail. It is a function because the rules live behind thekiro_crew.agentfacade, whichmate_workermust not import at load (test_agent_parts.pyholds that only the facade importsagent_parts);src/kiro_crew/agent.pybinds the two new names.docs/system-specs/modules/crew-mode.mdgains "The two workers stay in step" and a row for the new test.Covered by
docs/decisions/2026-11-06-every-task-a-bot-dispatches-goes-into-its-work-ledger.md("The Bot and Ultra Mode must work the same way on this") anddocs/request-for-change/rfc-conductor-work-ledger.md(statuspartial; workers report structured data throughwork_brief/work_report). No new RFC: no default, tool, grant or contract changes, only the Bot worker's prompt text.Backwards compatibility
Compatible:
kirocrew-worker's prompt is byte-identical (the_WORKER_SYSTEM_PROMPTdigest pinned intest/test_agent_refactor_contracts.pyis unchanged), and every reader of the Bot worker prompt callsmate_worker_prompt()in place of the old constant; nothing outside this repository reads it. The Bot worker spec is rewritten from source on every start, so its new text needs no migration.The module constant
mate_worker.MATE_WORKER_PROMPTis renamed to the functionmate_worker.mate_worker_prompt(); every reader on origin/main is switched in this diff:Reader: src/kiro_crew/agent_materialization/service_agents.py:_install_mate_worker_agent -- chat|crew page -- calls
mate_worker_prompt();test_mate_worker.pyReader: src/kiro_crew/context_assembly/agent_spec.py:_crewmate_worker_prompt -- chat (claude, codex) -- calls
mate_worker_prompt();test_mate_worker_harnesses.pyReader: scripts/crewmate_prompt_preview.py:main -- release (maintainer preview) -- calls
mate_worker_prompt();test_crewmate_prompts.py::test_the_ledger_preview_fixture_renders_the_patrol_cleanlyTests
test/test_mate_worker_parity.py(new): the worker prompt is exactly its sections; every section is a shared rule or allowlisted with a reason; every shared rule renders in the Bot's worker prompt;worker.principlesnames only shared rules; it copies no worker sentence; the Bot's worker is told its reply reaches its Bot and never the two Ultra-only wake sentences; both workers carry the same coding rules (moved here fromtest_worker_agent.py). Positive controls: a planted worker-only section, a stale allowlist entry and a reworded copy are each caught.test/test_crewmate_prompts.py: the brief-and-report check reads the rendered Bot worker prompt.test/test_agent_refactor_spec_bytes.py:kirocrew-mate-worker.jsondigests re-pinned for its new prompt; every other spec,kirocrew-worker.jsonincluded, keeps its digest.test/fixtures/crewmate_prompts/*.golden.txtrefreshed withscripts/crewmate_prompt_preview.py --write; only the worker part changed.Local, on base
c2f1b329a3: 1825 passed across the touched and related test files (worker and conductor parity, crewmate prompts, worker agent, mate worker and harnesses, refactor contracts, spec bytes, composition, ask core); flake-pattern ratchet passed; isort, flake8, mypy, the black gate, the comment-history gate andscripts/docs-lint.shclean. Semgrep is not installed on this host; CI's SAST lane runs it.Manual verification
N/A — prompt text only; unit coverage renders the Bot worker prompt and pins
kirocrew-worker's bytes.Related Issues
Closes #37613
Built on #37609 (merged): both workers already end with
ASK_COREplusWORKER_ASK_TAILfromcontext_assembly/output_contract.py. This PR keeps that tail as it is and does not move it into_LEDGER_WORKER_RULES; the Bot worker's blocked-command line insrc/kiro_crew/crewmate_prompts.jsonkeeps #37609's "and no allowed path is left" wording.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)