Skip to content

feat(agent): ship kirocrew-team-lead as one of the default agents that leads and works - #18128

Merged
iamwhatever merged 3 commits into
mainfrom
feat/18049-lead-crewmate
Oct 11, 2026
Merged

iamwhatever merged 3 commits into
mainfrom
feat/18049-lead-crewmate

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: give the product one default agent that owns a goal end to end: it does the small focused items itself and dispatches and patrols a session for every other one.

A conductor spec has no file-writing tool, so under it a one-line fix costs a whole dispatch. A worker does one item and is never handed a goal. Neither can both run a team and do a piece of the work.

Why it matters

An operator handed a goal today must pick between two shapes that both waste the unattended case: under a conductor the one-line fix stalls behind a dispatch, and under a worker there is no way to hand off the pieces the goal splits into. A default agent reaches every operator, because it appears in every agent picker.

Not a goal

  • Changing kirocrew-conductor or kirocrew-worker, their charters or their grants.
  • Mounting kirocrew-panel or any dashboard-page verb; the lead is a default agent, not a crewmate.
  • New grant tuples. The lead reuses the goal conductor's existing dashboard and ledger tuples.
  • The crewmate / hand-edit-detection design the RFC records as rejected by the product owner.

What changed (motivation → approach → change)

One installer, built like kirocrew-research. _install_team_lead_agent() in service_agents.py derives from build_agent_config(), drops the platform guide server and swaps in name, description and prompt. Its filename joins OWNED_KIRO_AGENT_FILES, and the two agent.py facade entries are added. It is rewritten on every boot exactly like research, with no ownership check; a customized lead belongs under another agent name.

The dispatch servers are mounted, not inherited. build_agent_config() skips every opt_in server, so a derived spec carries no kirocrew-dashboard (session_create, chat_folder_*) and no kirocrew-work (work_ledger_*). Declared in tools without an mcpServers entry, kiro-cli mounts nothing. _mount_team_lead_dispatch builds both entries with managed_mcp._managed_opt_in_entry, the call the dashboard-manager and worker installers make. That helper carries the two fields that fail silently: "type": "registry" and the KIROCREW_HOME pin. The auto-approved verbs are _CONDUCTOR_DASHBOARD_GRANTS and _LEDGER_CONDUCTOR_WORK_GRANTS, and the whole allowedTools list goes back through the governance ceiling; the KAS permissions block is derived from the filtered list.

Charter and skill. _TEAM_LEAD_SYSTEM_PROMPT is short: identity, the do-it-yourself rule, and pointers to the team-lead and goal-conductor skills. builtin_skills/team-lead/SKILL.md is the delta over goal-conductor: echo the ask, register the work, the do-it-yourself test, dispatch one level deep, and running the team.

A failed rewrite holds the ceiling. Both kirocrew-team-lead and kirocrew-research derive from build_agent_config(), so a failed rewrite during a ceiling-tightening rebuild marks the rebuild held instead of recording the ceiling as synced; the next maintenance poll retries.

Decision record: docs/request-for-change/rfc-team-lead-default-agent.md.

Backwards compatibility

Compatible: nothing main accepts today is rejected, renamed or removed. One agent spec appears under ~/.kiro/agents/ and one filename joins the owned-files allowlist.

Removes nothing: the change adds an installer, a skill and a hold flag; no key, path, record or function is taken away.

Tests

test/test_team_lead_agent.py:

  • session_create and work_ledger_record are reachable: the server is configured, its entry launches the subcommand that serves the tool, the server lists the tool, and the server is declared in tools. A positive control shows the probe reports a dropped mcpServers entry as unreachable.
  • Both entries equal _managed_opt_in_entry, and with registry mode and a home override forced on, both carry type: registry and the KIROCREW_HOME pin.
  • The grants are exactly the conductor tuples, and a ceiling that withholds session_create keeps it off allowedTools while it stays mounted.
  • kirocrew-panel is not mounted; the charter points at both skills and copies no line from the conductor charter.
  • Everything outside the dispatch mount equals the research shape; a file at this path is overwritten in place with nothing written beside it; the skill's sections and mechanism names.
  • A failed team-lead or research rewrite reports the rebuild held.

Spec-byte and contract baselines are re-pinned for the team-lead file only; no other spec's bytes or the audit sequence changed. Run locally: the files above plus test_agent_refactor_*, test_agent_execution_catalog.py, test_dashboard_manager_agent.py, test_builtin_skill_* (248 passed). flake8, isort, black, mypy, the comment-history gate, docs_lint.py and semgrep --config semgrep/ on the changed files are clean.

Manual verification

N/A: every claim is about an emitted spec, and each is asserted by materializing the spec into a temp agents directory and reading it back.

Related Issues

Fixes #18049

@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 8, 2026 10:52
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 8, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18049-lead-crewmate branch from 3911af4 to 98de4e7 Compare October 8, 2026 10:53
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4b7bf4c

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The research-agent hold is a rider on a feature PR; it fixes one of three ceiling-filtered installers and leaves two siblings still logging the same failure at debug.

Not justified as shipped

  • Item 4 — rides along, symptom-level: the cause is the try/except → logger.debug pattern around installers that filter through the ceiling. The PR converts research and team-lead only. Grepped _apply_allowed_tools_ceiling in installers: _install_worker_agent (agent.py:4585) and _install_dashboard_manager_agent (agent.py:4453) are both filtered and still swallowed at debug. That leaves 2 unfixed siblings. The provenance is only "GPT 6.1 F1 / First Principles Item 4", with no linked issue.
    Subtraction: move the research_held hunk to its own fix PR, covering all three siblings.
    Clears when: the research hold leaves this PR, or the worker and dashboard-manager installers get the same hold in it.

What this change ships

Inventory (5 items) — 4 justified

Intent: give operators one default agent that does small items itself and dispatches the rest. This is an ADDITION.

  1. A new kirocrew-team-lead agent appears in every agent picker and is rewritten on every boot — justified
  2. The lead can create sessions, use chat folders and the work ledger, auto-approved within the conductor's existing grants under the ceiling — justified
  3. New team-lead builtin skill holding the do-it-yourself and one-level dispatch rules — justified
  4. A failed research-agent rewrite now logs a warning and holds the ceiling sync instead of logging at debug — rides along, symptom-level (2 unfixed siblings)
  5. A failed team-lead rewrite holds the ceiling sync for a retry — justified

[FIRST-PRINCIPLES-REVIEWED] 4b7bf4c

Description read

[DESCRIPTION-READ] 97f1c6590ba6339ff253d2f9386f46e8aec142da85ec29ef13f8b49a59d11419

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that it's intended for a failed kirocrew-research rewrite to now hold the conductor ceiling and trigger the hourly full-rebuild retry; this widens behaviour beyond the new agent.

[DESIGN-REVIEWED] 4b7bf4c

Description read

[DESCRIPTION-READ] e911dba96d3c5c34c1bb4f6c6157aef18ebe915367bcac1ea56635f86034e1bf

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0 — this comment is updated in place on each push.

Review details

No findings block the merge; two advisory findings.

FINDING — src/kiro_crew/agent.py:4521 — conductor_held = conductor_held or team_lead_held or research_held puts research and team-lead install failures into _conductor_installers_held. So when kirocrew-research.json or kirocrew-team-lead.json fails to write, _hold_cause() says "a conductor spec could not be read or written" in the boot warning (prime_ceiling_projection) and in every hourly retry warning (retry_held_conductor_specs). The retry warning also offers a conductor remedy, so the operator goes looking for the wrong file → Fix: keep a separate service-agent hold flag and give it its own cause in _hold_cause, or reword the conductor cause to "a ceiling-filtered agent spec".

FINDING — src/kiro_crew/agent_files.py:49 — the new comment says the lead "does the focused work on it itself (running a goal as a team is a planned follow-up)". But _mount_team_lead_dispatch in the same diff mounts kirocrew-dashboard/kirocrew-work and auto-approves session_create and the ledger verbs. The test suite already asserts that "planned follow-up" is gone from the skill, so this comment misstates what the spec auto-approves → Fix: reword the comment to say the lead dispatches through the mounted conductor grants.

[OPUS-REVIEWED] 4b7bf4c

Verdict parsed from the review's SHA-scoped output markers for commit 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 4b7bf4cf70c429c6ca8ec9865558abf202cd30c0: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 8, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18049-lead-crewmate branch from 91968d1 to 65f3efa Compare October 8, 2026 12:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 8, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18049-lead-crewmate branch from 65f3efa to 2fb1c62 Compare October 8, 2026 13:03
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 8, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/18049-lead-crewmate branch from 2fb1c62 to b26cced Compare October 8, 2026 13:43
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 8, 2026
iamwhatever
iamwhatever previously approved these changes Oct 10, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shall be a normal customer agent, but not a mate for now. Please confirm this thing first.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Addressed the blocking review findings on the previous head in 11d18615d8, by narrowing the agent to what its spec can actually do rather than widening the spec.

Design / First Principles (the spec can't dispatch). Correct: the spec derives from build_agent_config(), which does not emit the opt_in kirocrew-dashboard and kirocrew-work servers, so it carries neither session_create nor the work-ledger tools. Rather than mount those servers and grant the dispatch tuples (a grants-and-permissions change), I narrowed _TEAM_LEAD_SYSTEM_PROMPT to the identity and the one do-it-yourself rule and named dispatch as a follow-up this spec does not yet mount. The duplicated conductor/goal-conductor procedure sections are removed. The PR description and the RFC premise/overwrite sections were rewritten to match the shipped installer, and the RFC names the dispatch surface as a follow-up (#18049). A new test pins that the charter does not instruct a dispatch call.

F1 — a failed rewrite left a stale grant list under a tightened ceiling. The team-lead spec's allowedTools is re-filtered through the governance ceiling on every boot, so a swallowed rewrite failure could let the generation memo advance over an unrewritten list. Fixed by marking the rebuild held on a team-lead install failure (the same pattern the conductor specs and dashboard-author use), so the next maintenance poll retries rather than recording the ceiling as synced. Test: a failing install now reports held == [True].

F2 — first install destroyed a pre-existing file at the newly reserved name. Fixed by moving a pre-existing file whose declared name is not this agent's (or that does not parse) to a .bak sibling before the first write, so a recoverable copy survives. A file this installer wrote earlier is still replaced in place with no backup. Tests cover both the preserve case and the replace-our-own control.

Local gate green on the directly-testing files plus the governance, reset and session-start-gate suites; flake8, isort, mypy, the formatting gate and docs-lint all pass. The spec-byte and contract baselines were re-pinned to the narrowed charter.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Updated in 2e5e7ad937 to address the remaining blocking findings on the previous head.

UX / First Principles / Design — the team half was still promised in the skill, the picker description and a comment. Correct. The charter was narrowed last round but three other shipped surfaces still described dispatch:

  • The team-lead skill still opened with "Read goal-conductor first" and gave the dispatch, ledger and patrol steps. It is now cut to the work half only — the echo, intake, the do-it-yourself test and the smallest-honest-version rule — with the goal-conductor pointer and every dispatch/ledger/patrol step removed. A test pins that it instructs none of those tools.
  • The agent-picker description field is narrowed to "Takes a goal, states what done looks like, and makes the smallest honest change itself … Running a goal as a team is a planned follow-up."
  • The agent_files.py comment is narrowed to match.

So no text the spec loads or shows now instructs a tool the spec does not carry.

GPT 6.1 F1 — the first-install guard decided ownership by name, which is forgeable. Replaced the name check with the installer-recorded SHA-256 digest in the agent_state sidecar, reusing the same primitives the kirocrew-dashboard-author stem uses: a file whose bytes reproduce the recorded digest is our own prior write and is refreshed; any other file (including a copy that forges the name) is left untouched. The install runs under agents_spec_lock with a two-phase digest commit. Tests cover the foreign-file-left-untouched case, the forged-name case, our-own-write-refreshed, and that the digest is recorded.

The earlier F1 (a failed rewrite marking the ceiling held, not synced) and the charter narrowing are unchanged from the previous push.

Local gate green on the directly-testing files plus the governance/reset/start-gate suites; flake8, isort, mypy, the formatting gate and docs-lint all pass. The spec-byte, contract and sidecar-snapshot baselines were re-pinned, and the sidecar snapshot folds the new team-lead ownership digest to a stable label. The PR body and RFC were rewritten to match the shipped installer.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Addressed the remaining red lanes in a78b92a4e7 and the PR description.

PR Hygiene — the description was missing the required ## Why it matters and ## Not a goal headings. Rebuilt the body from the template with both headings present (no push needed for that; Hygiene re-runs on edit).

First Principles — the previous verdict read the earlier body, which still described the first-round .bak/name-match guard that this head no longer ships:

  • Items 4 & 5 (description vs diff): the body now describes the actual mechanism — the installer confirms ownership by the recorded SHA-256 digest and leaves a file it did not write untouched; it no longer claims a .bak or "records nothing".
  • Item 7 (RFC vs diff): the RFC's "What ships" claimed the skill carries "the five team-management rules", but the narrowed skill ships none of them. Removed that claim and the section; the RFC now describes the skill's work-half procedure only.

No code behaviour changed in this push — it is the RFC Item-7 doc fix plus the description rewrite; the digest-ownership guard, the narrowed charter/skill/description and the failed-install hold are unchanged from the previous head. Local gate (flake8/isort/mypy/black-gate/docs-lint + the directly-testing and governance/start-gate suites) is green.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Changed approach in ca89ab1a5d: the installer now overwrites on every boot exactly like kirocrew-research and kirocrew-knowledge, with no ownership digest, refusal or start gate.

The previous head added a digest-ownership guard to protect a pre-existing file at this newly reserved name. That guard drew a deeper set of blocking findings — the digest is never renewed on an authorized model/skills edit, so a later install sees a mismatch and stops rewriting (leaving a tightened ceiling's revoked grants live); the filename-only readers treat a preserved file as managed; forks and a .md sibling need their own handling. Those are the apparatus the RFC's Alternatives section records the product owner as having rejected.

Dropping the guard removes that whole class:

  • _team_lead_json_blocks_install, agents_spec_lock and the two-phase digest commit are deleted; the install is the plain _atomic_json_write the other service agents use (also First Principles' Item 4 "one guard, not a duplicate").
  • There is no digest to go stale, so the never-renewed-ceiling hole is gone.
  • A pre-existing file at this newly reserved name is overwritten on first boot — the accepted contract kirocrew-research/kirocrew-knowledge already carry; a customized lead belongs under another name. The one-line "copy it to a different name" rule in the charter and RFC is that contract.

The failed-rewrite ceiling-hold (a failed team-lead write marks the rebuild held so a tightened ceiling is retried, not synced) is unchanged — it is independent of the overwrite question. The narrowed charter/skill/description are unchanged. Local gate green on the directly-testing files plus the governance/reset/start-gate suites; flake8/isort/mypy/black-gate/docs-lint all pass. PR body and RFC rewritten to match.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Updated in 76fc03b656: direction B with the one narrow guard kept, as ruled.

The installer overwrites on every boot exactly like kirocrew-research/kirocrew-knowledge — no ownership digest, no refusal, no start gate, and no model/skills/reset renewal table (that is what drew the earlier blocking cascade, so it is gone).

GPT F2 (a user-owned file at the newly reserved name must not be destroyed) stays fixed by a one-time migration, not ongoing tracking: on install, if a file at the path is not one this installer wrote — recognised by the name field it always sets — it is moved aside once to a timestamped .bak and logged at warning level, then the managed spec is written. A file we wrote is overwritten in place with no .bak. Because the migration leaves our own spec at the path, it fires at most once per operator-authored file.

GPT F1 is unchanged: a failed team-lead rewrite marks the rebuild held and retries on the next maintenance poll rather than being swallowed, so a tightened ceiling is never recorded as synced over a stale grant list.

Tests: a foreign file is preserved as a .bak on first install; our own file is overwritten on the next boot with no .bak; the migration fires at most once; and the failed-write hold. The narrowed charter/skill/description are unchanged. The RFC and PR body now state the migration in one plain sentence. Local gate green (flake8/isort/mypy/black-gate/docs-lint + the directly-testing, governance, reset and start-gate suites).

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Addressed the red lanes and the First Principles findings on f8cd74ce42.

Backend Tests shard 4 (Linux + Windows) — real, ours. Narrowing the team-lead skill grew its description frontmatter to 310 characters, past the 300-character index-line cut, so test_no_packaged_description_exceeds_the_index_cut failed. Trimmed the description to 273 characters, keeping both what the skill is and the "Load it when you are handed a goal" routing directive before the cut.

First Principles Item 4 — the one unfixed sibling. Correct: _install_research_agent derives from build_agent_config() exactly as team-lead does, so its allowedTools is re-filtered through the governance ceiling on every boot, and it still swallowed a failed rewrite at debug — a tightening whose research rewrite failed left the stale grant list recorded as synced. Extended the same hold to it: a failed research install now folds a research_held flag into the rebuild hold beside team_lead_held, so the ceiling is not recorded as projected and the next maintenance poll retries. A fail-before/pass-after test pins it.

First Principles title/metadata blocker. The title said "a crewmate that both leads and works" and the body said Fixes #18049, both claiming the lead half this diff defers. Retitled to "ship a default agent that owns a goal and does the work", and changed the related-issues line from Fixes #18049 to Part of #18049 so merging no longer closes the issue that tracks the deferred lead half.

First Principles Item 1 (premise). This is the one residual point and it is a product-justification call, not a code fix: the agent derives from the default template and adds a charter prompt and the guide-server removal rather than a new tool, so whether that is sufficient justification is a maintainer decision on the RFC, not something to code around.

Local gate green: the directly-testing team-lead + skill-index suites, the governance/reprojection/facade/contract suites (703), the full spec-byte/contract set (6408), flake8, isort, mypy, the formatting gate and docs-lint all pass.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

/ai-review override first-principles 89ac1e8: the product owner (Mingwei) directed shipping kirocrew-team-lead as a default agent installed like kirocrew-research; rfc-team-lead-default-agent.md in this PR is that decision's record.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@chenmingwei23 marked the first-principles AI finding as false positive, not applicable, or explicitly accepted for 89ac1e85f1b49c2c22717b403e4f8960c0aa8bf0.

the product owner (Mingwei) directed shipping kirocrew-team-lead as a default agent installed like kirocrew-research; rfc-team-lead-default-agent.md in this PR is that decision's record.

This decision applies only to this commit. A new push requires a new judgment.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 05cf623: parity with the existing conductor and worker installers, which mount kirocrew-dashboard / kirocrew-work the same way (conductor_agents._conductor_mcp_servers, worker_agent mcp['kirocrew-work'] = managed_mcp._managed_opt_in_entry) without carrying inherited disabled/disabledTools; changing that contract belongs in its own PR for all three.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

/ai-review override fable 05cf623: parity with _install_research_agent and _install_knowledge_agent, which rewrite their reserved spec on every boot; the product owner (Mingwei) ruled no ownership digest or preservation code for this default agent.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@chenmingwei23 marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 05cf62348a1d003ad15058613fa70520ee84aab0.

parity with the existing conductor and worker installers, which mount kirocrew-dashboard / kirocrew-work the same way (conductor_agents._conductor_mcp_servers, worker_agent mcp['kirocrew-work'] = managed_mcp._managed_opt_in_entry) without carrying inherited disabled/disabledTools; changing that contract belongs in its own PR for all three.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@chenmingwei23 marked the fable AI finding as false positive, not applicable, or explicitly accepted for 05cf62348a1d003ad15058613fa70520ee84aab0.

parity with _install_research_agent and _install_knowledge_agent, which rewrite their reserved spec on every boot; the product owner (Mingwei) ruled no ownership digest or preservation code for this default agent.

This decision applies only to this commit. A new push requires a new judgment.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Re: review 2026-10-10. Confirming the point you asked me to confirm first, on the current head 0c45c05bff549a8d2781fed7aa3e88409eb61dbe.

Confirmed: kirocrew-team-lead ships as a normal default agent, not a crewmate. It is installed by _install_team_lead_agent() in src/kiro_crew/agent_materialization/service_agents.py, built exactly the way kirocrew-research and kirocrew-knowledge are: it derives from build_agent_config(), swaps in the name, description and charter prompt, drops the platform guide server, and is rewritten in place on every boot with no ownership digest, no refusal and no start gate. It is not a crewmate template — there is no member registration, no private per-member memory, no greeting or chatted-list wiring, and kirocrew-panel is not mounted. A customized lead belongs under a different agent name, same contract as the other default agents.

The decision and its rationale are recorded in docs/request-for-change/rfc-team-lead-default-agent.md ("Ship the team lead as a default agent built like kirocrew-research, not as a crewmate template"), which quotes the ruling directly. The crewmate-template-with-hand-edit-detection alternative is listed under "Alternatives considered" as rejected. The test test_the_skill_describes_a_default_agent_not_a_crewmate pins that the shipped skill describes a default agent and contains no crewmate-only surface.

The only capability added beyond build_agent_config() is the dispatch surface: kirocrew-dashboard and kirocrew-work are mounted via _mount_team_lead_dispatch (head 0c45c05bff) so the lead can run a goal as a team (session_create, chat_folder_*, work_ledger_*). Those are opt_in servers that build_agent_config() skips, so naming them in tools alone mounts nothing; they are built through managed_mcp._managed_opt_in_entry (the same call the worker and dashboard-manager installers make), their auto-approved verbs are the goal conductor's existing tuples, and the whole allowedTools list goes back through the governance ceiling before it is written. Mounting dispatch tools does not make it a crewmate — it is still a plain default agent.

So on this head it is a normal default/customer agent, not a mate.

chenmingwei23 and others added 2 commits October 11, 2026 16:44
A goal handed to a person does not decompose itself. The conductors run a
fleet but cannot do an item; the worker does one item but runs nobody.
Nothing shipped did both: split a goal into work-ledger items, keep the few
small focused ones, dispatch a session for each of the rest, and patrol that
fleet.

The missing piece is a prompt, not a mechanism. Every verb such a lead needs
is already in the default agent's surface, so this ships the way the other
default agents ship. _install_team_lead_agent is the _install_research_agent
pattern: derive from build_agent_config(), swap in a name, a description and
a prompt, drop the platform guide server, write the file. One call in the
same install sequence, one filename in OWNED_KIRO_AGENT_FILES, one prompt
constant beside _RESEARCH_SYSTEM_PROMPT, and the two agent.py facade entries
every moved name carries.

Deriving from build_agent_config() is the load-bearing part: that function
has already filtered its tool list and its MCP servers against the
governance ceiling, so this agent inherits what the ceiling permits and
nothing else. It adds no grant, no server and no autoApprove of its own, and
a test pins that -- the spec equals the baseline on every key except the
three identity fields.

The spec is overwritten on every boot, exactly as kirocrew-research and
kirocrew-knowledge are. An operator who wants a lead with different rules
copies it to a different agent name. That removes a question rather than
answering it: an installer that had to detect and respect a hand-edit needs
to decide whether the file on disk is its own write, which needs a recorded
digest, a place to record it, a three-way install outcome and a start-time
gate -- and each of those guards has to cover what the next one assumes.
None of it is needed when nothing asks whether the file is ours.

The skill carries the lead's procedure plus five team-management rules, each
naming the mechanism that decides it rather than asking for judgement:
resource_status and its four posture words with the server's own session
ceilings, MAX_DEPTH in work_ledger.py as what refuses a third conducting
level, close-and-reseed as the merge with session_adopt named as what it is
not, a concrete trigger for a tracker worker that reports and never decides,
and one owner per shared file with one integrator per output. A posture of
unknown is the reading that FAILED and takes the same lighter path as tight,
which is the one place a lead would otherwise decide from feel.

Tests mirror what kirocrew-research is already held to: the installer's three
identity fields, the owned filename, the no-surface-of-its-own property, the
overwrite, and one pin per rule on the mechanism's name behind a positive
control. The contract suites list this agent the way research is listed, and
the spec-byte goldens gain one file entry per scenario plus the audit record
this installer adds -- no other agent's digest, the state sidecar and the
fork-refresh verdicts are unchanged.

Fixes #18049, Fixes #18813
…research rewrite

build_agent_config() skips opt_in servers, so the team-lead spec carried
no kirocrew-dashboard or kirocrew-work and could not dispatch. Mount both
through managed_mcp._managed_opt_in_entry (registry type and KIROCREW_HOME
pin), grant the goal conductor's dashboard and ledger tuples through the
governance ceiling, and derive the KAS permissions from the filtered list.
Restore the dispatch skill and description; shorten the charter to identity,
the do-it-yourself rule and pointers to team-lead and goal-conductor.

A failed research rewrite now holds the ceiling like team-lead does.

Drop the one-time foreign-spec migration: it keyed on the name field of
the file it judged and swallowed a failed backup. The spec is overwritten
on every boot exactly like kirocrew-research.
iamwhatever
iamwhatever previously approved these changes Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conductor charter: fold multi-team field lessons into _CONDUCTOR_SYSTEM_PROMPT and the goal-conductor skill

2 participants