Repository navigation
feat(crew): give each crewmate its own config, a conductor and a worker - #23010
Conversation
36cb031 to
3f4f18b
Compare
First Principles Review (Opus 5.5) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK product-shape change without accepted RFC: this PR reverses the conductor tool set that the base RFC marks as settled, and it also remaps a stored Notes
What this change shipsInventory (12 items, capped at 10) — 7 justifiedIntent: each crewmate gets its own config, a conductor chat and its own worker that does the work (ADDITION).
Blockersproduct-shape change without accepted RFC — conductor tool set and [FIRST-PRINCIPLES-REVIEWED] 1934364 Description read[DESCRIPTION-READ] 077155e0afd5b2fbaf78a4bb9b8f130a28aa594a890227b541df624f0d59481a That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/mate_config.py:184 -- Concurrent creates bypass the foreign-file ownership check
BLOCKING -- src/kiro_crew/mate_config.py:249 -- Recreated mates inherit their predecessor’s sidecar state
BLOCKING -- website/src/i18n/locales/en.json:7509 -- New roster copy reverses the recorded Mate naming decision
[BLOCK-MERGE] 1934364 Adjudication (Opus 5.5) — is blocking on each finding proportionate?F2 — Harm is MEDIUM. When it happens the system fails closed, quietly: a recreated mate loses approvals its owner never revoked for it, and its "Built From" label is wrong. Conditions I confirmed:
The real fix is small: drop both name-keyed records when a new identity is created or deleted. That costs less than the harm, so the block stands. [ADJUDICATION] 1934364 total=1 uphold=1 downgrade=0 [ADJUDICATION-FENCED] 1934364 fenced=2 flagged=1 🏷️ Fenced finding(s) machine-flagged as likely edge caseThe security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override. The annotate-only pass judged the condition combination each one requires extreme, and pre-drafted the override rationale below. A repository writer must independently verify a rationale before posting it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop.
False positive or not applicable? A repository writer can comment: |
3f4f18b to
1ec089f
Compare
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the accepted RFC (#22443) settles the conductor/worker split, the one-way migration and the KAS-only worker set. The Backwards compatibility section is past the description's truncation point, so it was not judged. Notes
[DESIGN-REVIEWED] 1934364 Description read[DESCRIPTION-READ] e9ac679f4cd5bc552a3b4e9b89cbad53b31ef4b8a9a1f8348a9c97c4cc54dbce 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 |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing the crew editor's new Advanced › "Worker's extra kit" pane and the reworked Built From section. They are the main path for giving a crewmate its own kit, and neither screenshot shows them. Evidence gaps
Notes
[UX-REVIEWED] 1934364 Description read[DESCRIPTION-READ] ba04eb372095eeff61677034a83c52d70ca57a5bde179468c91d25f774ce326a That sha256 names everything this verdict read: the PR description, plus the 5 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 |
|
Goal line updated at my request: "and git worktree" is removed. The per-crewmate git worktree was split out of this PR to keep it reviewable, and it will land in its own PR after this one. Nothing else in Goal, Why it matters or Not a goal changed. |
1ec089f to
21c5a2d
Compare
Sensitive change review
|
21c5a2d to
3241a33
Compare
Sensitive change review
|
|
/ai-review override first-principles 3241a33: Ray Xu (crewmate design owner) decided: a crewmate needs the dispatch tools that only KAS carries among Kiro backends and kiro is moving to KAS, so a stored kiro member backend runs as KAS (logged once at load). The KAS-only worker in this PR is an interim step; the next PR, stacked on this one, runs the worker on every backend in ACP_BACKENDS_MEMBER_CAPABILITIES through the member saved-spec path. |
Human judgment recorded@buluoray marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
Problem / Motivation
Goal: Make each crewmate the conductor of its own work: it gets its own config file, chats on a gateway-assembled conductor, and hands every task to its own worker, which runs with that crewmate's kit and permissions.
Today a crewmate is a pinned DM thread bound to a shared agent template. Its chat both talks to the user and does the work, so a long job ties up the thread, its tools are whatever the template happens to mount, and there is no place to give one crewmate an extra server or skill without forking the template. The accepted RFCs (#22443) split the two roles: a conductor that answers, plans and dispatches, and a worker that does the file and command work.
Why it matters
A crewmate is meant to keep at a goal for days. With one session doing everything, the thread goes silent during work, the user cannot see or take over what is running, and every crewmate on the same template shares one tool set. Splitting conductor and worker keeps the chat free, puts the work in sessions the user can open, and lets each crewmate carry its own kit without touching anyone else's.
Not a goal
goal/waitingfolds, the build-your-page wake line, page shape and colour-scheme checks, the "goal written on an idle thread" fix).What changed (motivation → approach → change)
Goal → approach: the RFCs accepted in #22443 (
docs/request-for-change/rfc-mate-owned-agent-config.mdand the conductor/worker RFC, bothacceptedon main) set the split. This PR is the Crewmate 2.0 core of the trial branch #22037, re-applied on current main with everything outside it left out (list below). It is one commit.dashboard.crewmate_v2key, toggle or off path. New crewmates are 2.0 from creation, and existing ones migrate once, one way.mate_configwrites~/.kiro/mates/agents/<id>.json, holding only what that crewmate adds. The startup migration (mate_config_migration.migrate_existing_crewmates) moves a crewmate off a shared template or acrew-<hex>copy, skips and logs one whose worker would differ, repoints its own DM thread records to the conductor, and posts a one-time upgrade notice in its chat. Nothing moves a crewmate back. The ledger entry records the crewmate'smember_id, so a key deleted and made again starts a fresh entry.kirocrew-mate-conductoris assembled by the gateway: the platform servers only, the default template's built-in tools (the shell and file writer included), and no spawn / task / workflow runners. Sub-agent spawning is the one thing it loses (conductor_spawn_refusal); it may run a quick command or a small edit itself and hands longer work to its worker. It keeps its notes with a newsave_notestool. This PR amendsrfc-mate-owned-agent-config.md(§5.0, §6 step 1, §10 question 7) to record that decision, the KAS remap below, and the conductor's scripted cron; the earlier read-only, no-shell conductor is superseded.session_createfrom a crewmate opens its ownkirocrew-mate-worker: the gateway base, plus the template kit copied in the crew editor's new Advanced > Worker's extra kit section, plus capabilities the user added. It runs on the crewmate's member backend and only on a backend that takes a per-session spec (ACP_BACKENDS_MATE_WORKER_KIT= {kas}); elsewhere the hand-off is refused withworker_kit_harness_unsupported. When a worker ends a turn, its report wakes the crewmate (dashboard/mate_thread_wakes.py). A crewmate's scheduled agent turn runs on its worker too, not the conductor: at each firemate_worker.cron_worker_executionturns the job's member capture into the worker's record, so the turn carries the crewmate's kit, servers, permissions, store and identity under the job's owncron:key. A 1.0 job (template_id: kirocrewwith a member id) takes the same path with no data migration. A scriptedcron_addfrom the conductor is dispatched like any caller's (test_cron_conductor_scripted.py); there is no conductor gate for it, by the design owner's decision recorded in the RFC amendment. When that turn's result changed (the cron's ownlast_posted_hashdedupe), the crewmate's thread gets the usual[Worker report]wake (mate_thread_wakes.note_cron_result), recognised by the job's attested member binding and itscron:key; an identical result wakes nobody, including a job the worker itself created.crewmate_approval.py).MISSING CAPABILITY:.request_capabilitiesis refused on that wake turn (not_user_turn), so the wake tells the conductor to name the gap to the user and raise main's card on the user's next turn. A worker started after the card applies has it.mate_approval_revocations.py), and Approvals still lists it switched off so it can be turned back on. Approvals also lists the worker base's own grants, which a migrated file does not hold, so each can be switched off. The worker-kit preview lists every tool a copy turns off. A worker-kit copy keeps the template'sexcludedTools, and a template whosepermissionsortoolsSettingslimits the worker cannot carry is refused (a create from it keeps the crewmate on the template). A worker-kit apply is bound to the file AND the result its preview showed, so a template edited since asks for a fresh preview. A create whose template has the crew's own name is refused (template_name_in_use). The migration does not move an agent whosepermissionsdeny/ask rules ortoolsSettingsits worker would lose, and its repoint is a compare-and-set on the template it planned from, so a switch made meanwhile wins. A worker whose crewmate file, revoked-approvals record or execution record cannot be read, or whose crewmate's own file is absent or shadowed, is refused, not run on the bare base; revocations are read even for a crewmate with no file. The migration writes its ledger intent before a repoint and marks the crewmate moved after, so a crash in between still moves its old threads. Revocations are written before a capabilities save, re-grants only after it. A crewmate may not take a name a user-level agent declares, and a crewmate file another instance sharing the Kiro home wrote is never replaced (mates/owners.json). An unreadable crewmate file no longer reads as removed, so it cannot reset the default agent.save_notesreplaces the file through a temporary and refuses a symlinked leaf. A fresh install keeps plain chats on the configured template; only the first crewmate runs on the conductor.kascarries (main's own doc formember_acp_backendinconfig/sections_agent.py: a value resolving to kiro leaves member threads as plain chat, no dispatch tools), so a storedkiromember backend now runs askas, by the design owner's decision. The remap is logged once at load with the stored and the used value;config.jsonkeepskiro, and the remedy "set member_acp_backend to kiro" is gone because it no longer changes anything.src/kiro_crew/crewmate_prompts.json.scripts/crewmate_prompt_preview.pyassembles them offline from fixtures. The goal-setup kickoff now hands research to a worker session instead ofspawn_run.agent_sdk.agent_sdk/agent_specs.pyis the one seam the crewmate modules read agent specs through, so none of them importskiro_crew.acp.Re-applied on main's split modules:
members_parts/member_sessions.py(worker backend routing),handlers/members_roster.py,handlers/core_config_schema.py,chat_turn/turn_admission.py, andCrewEditorNextDialog.tsx, which replaces the old editor that main removed. main's #21430 told a crewmate without file tools not to keep its briefing. Here a crewmate with thekirocrew-matetools can still write it throughsave_notes, and #21430's text moved into the prompt file unchanged.Moved to follow-up pull requests, opened after this one merges: Dynamic capabilities (the per-crewmate preview,
find_capabilities, named additions, the ask card, the hand-off capability note and the same-worker reload), and each crewmate's own git worktree.Left out of #22037, and the small pieces kept:
1f35c185c5,5898b34b2bheartbeat_quiet_end.py) and its prompt keys are dropped.12db47d80d,2d66cf544b,07a715166e,a0c7cc7855dashboard.*prompt keys are gone, and the conductor's crew-log line no longer names the trial-only folds.800956d11beb2b648386mate_thread_wakes.py),mate_welcome.app_is_stopping, the per-turn permission hook, and the prompt preview script.key_result_met,milestones_lineand themilestones.*keys are dropped.Backwards compatibility
Compatible: an upgrade migrates every crewmate, once. That move is the product-shape change the accepted RFCs record (#22443). It is one way: no switch turns it off. A shared template and any
crew-<hex>copy are never deleted.Reader:
src/kiro_crew/dashboard/handlers/members_roster.py:api_members-- crew page -- a binding the migration left on a legacycrew-<hex>copy (mate_worker.is_legacy_binding) is not listed twice;test/test_legacy_binding_roster.pyReader:
src/kiro_crew/agent_materialization/service_agents.py:_remove_user_level_copy-- release -- deletes~/.kiro/agents/kirocrew-mate-{conductor,worker}.jsononly when name and description are the generated ones, and keeps any other file with a warning;test/test_mate_service_specs.pyReader:
src/kiro_crew/mate_worker.py:MATE_CONDUCTOR_EXCLUDED_TOOLS-- chat -- a crewmate's chat loses only the spawn runners (its built-ins are the default template's); work goes throughsession_createto its worker;test/test_mate_conductor_agent.py,test/test_mate_worker_dispatch.pyReader:
src/kiro_crew/dashboard/handlers/cron_jobs.py:api_cron_tools-- cron -- a scriptedcron_addfrom a crewmate's conductor is dispatched like any caller's (the conductor's scripted-cron refusal is removed);test/test_cron_conductor_scripted.pyReader:
src/kiro_crew/mate_config_migration.py:migrate_existing_crewmates-- crew page, chat, cron --agents.<name>.kiro_agentand the crewmate's own DM threadtemplate_idare rewritten, once;test/test_mate_config_migration.pyReader:
src/kiro_crew/config/loader_builders.py(member backend) -- chat -- a storedkirois read askas;config.jsonkeepskiro;test/test_acp_backend_kas.pyTests
New suites, each pinning one behaviour:
test_mate_owned_config.py,test_mate_config_migration.py,test_mate_migration_real_kirocrew.py,test_mate_upgrade_notice.py: the own-file write, the migration (what it carries, what it skips, a template restriction it would lose, idempotence, the thread repoint, a fresh ledger entry for a key made again) and the notice being posted once.test_acp_backend_kas.py: a storedkiromember backend runs askasand the remap is logged once;test_api_agents_create_template.py: a template or user-level agent of the crew's own name is refused;test_mate_worker_kit.py: an apply after the template changed is refused, and adopting a user-level agent's name is refused;test_mate_worker.py: a revoked approval stays off, and an unreadable crewmate file or revocation record refuses the worker;test_mate_config_migration.py: a template switched during the pass is not overwritten;test_guide_server.py: a fresh install keeps plain chats off the conductor;test_mate_owned_config.py: another instance's crewmate file is not overwritten;test_config_loader_default_agent.py: an unreadable crewmate file is not removal evidence.test_cron_crewmate_worker.py: a crewmate's cron turn runs on its worker with its MCP servers, a 1.0 record moves onto the worker once, and a non-crewmate cron is unchanged.test_cron_crewmate_report.py: a changed crewmate cron result wakes the conductor once, an identical one does not, and a non-crewmate cron never does; a worker-created job reports too.test_mate_worker_kit.py: a template with uncarried limits is refused on copy and on create, and its exclusions are carried.test_mate_owned_config.py: a switched-off approval stays listed and turns back on, and a base grant missing from the file switches off and on;test_mate_worker_kit.pyalso checks the preview lists an added exclusion.test_mate_conductor_agent.py,test_mate_conductor_every_create_path.py,test_mate_service_specs.py,test_mate_service_names.py,test_cron_conductor_scripted.py: the conductor's tool set (built-ins kept, spawn tools excluded), every create path landing on it, where the service specs live, and a scripted cron from it being accepted.test_mate_worker.py,test_mate_worker_dispatch.py,test_mate_worker_kit.py,test_mate_worker_disabled_servers.py,test_mate_platform_server_override.py,test_mate_thread_wakes.py: the worker merge (additions only, switched-off tools withheld), the worker spec read by member id, backend routing and refusal, the kit copy, and the worker-report wake.test_crewmate_worker_approval.py: Permissions reaching workers.test_mate_capabilities_redaction.py,test_mate_capabilities_worker_summary.py: the in-place editor's redaction and the worker counts on Built From.test_legacy_binding_roster.py,test_member_notes.py: the roster andsave_notes.WorkerKitPane.test.tsx,builtFromName.test.ts,workerKitLabels.test.ts,KiroCrewAgentsPage.rosterLabels.test.tsx(including a kit read error), plus updatedCrewProfileSettings.test.tsxandCrewEditorNextDialog.test.tsx.Local run on this head: black, isort, flake8,
mypy --platform linux, agent-SDK boundary, subprocess encoding, line cap, harness parity, docs-lint, comment-history, the prompt-preview golden,tsc,i18n:check, and the touched Python and Vitest suites, andtest/integration/test_governance.py.test/e2e/test_private_workflow_memory.pynow expects the nested spawn from a crewmate's workflow to be refused (its chat runs on the conductor).Manual verification
On the trial branch (#22037) this slice ran through five pod soak rounds and a real-install switch. On this head, in a pod: a crewmate bound to
kirocrewwas migrated at startup (ledger entry with itsmember_id), posted the one-time notice, handed "list the files in your workspace" to its worker withsession_create, and the worker's report woke it with the answer. The pod checks of the ask card and the same-worker reload move with the Dynamic capabilities PR.Screenshots / video
A migrated crewmate's chat: the upgrade notice, the hand-off to its worker and the worker's report (light):
The same crewmate's Profile, Permissions reaching its workers, no Dynamic capabilities row (light):
Related Issues
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.