Skip to content

feat(synth): strip spawn tools from Kiro v2 specialist output - #149

Draft
knihit wants to merge 20 commits into
feat/orchestration-mode-hook-s2dfrom
feat/strip-spawn-v2-specialists
Draft

knihit wants to merge 20 commits into
feat/orchestration-mode-hook-s2dfrom
feat/strip-spawn-v2-specialists

Conversation

@knihit

@knihit knihit commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Description

Stack: 12 of 12, top of the orchestration stack. Base: feat/orchestration-mode-hook-s2d. Depends on everything below it, and completes #124's spawn block for Kiro CLI v2. It sits at the top because it carries the merged docs of every PR below.

A Kiro CLI v2 probe (kiro-cli 2.36.0, --agent-engine v2, --trust-all-tools) showed a specialist with @builtin can spawn k-developer through the subagent tool. v2 ignores excludedTools, and an empty availableAgents list allows every agent.

CLI:

  • synth/kiro_cli_v2.rs: for k-* agents, drop every subagent alias from tools and allowedTools, remove toolsSettings.subagent, and expand @builtin to the v2 built-ins minus subagent. A * entry expands to the explicit built-in list plus @<server> for each of the spec's MCP servers. Each tool is listed once when a spec names a built-in next to @builtin. Orchestrator output is unchanged.

Docs:

  • docs/user-guide/agents.md, concepts.md, faq.md, sop-workflows/code-review.md, use-cases/plan-and-verify-work.md, use-cases/review-code-and-tests.md: the spawn block now holds on either Kiro runtime and on Claude Code; older v2 clients may reject the explicit tool list.
  • CHANGELOG.md: feat(synth): deny subagent spawning for specialist agents #124's spawn bullet is rewritten to cover Kiro CLI v2. No VERSION change.

Type of Change

  • CLI (cli/) change: Rust
  • Documentation

Testing

  • npm test: not run (no JS changed).
  • Gate on this head (7e96728b, the top of the stack): make build && make synth pass; cd cli && make test pass (1,873 Rust tests, 0 failed); make test-skills-sh pass; uvx --with pyyaml pytest -q tests/ 281 passed, 1 skipped; make claude-plugin-check pass.
  • New tests: v2 renderer unit tests for alias removal, @builtin and * expansion and de-duplication; a v2 wildcard specialist with MCP servers rendered end to end in synth_install_e2e.rs; tests/test_agent_tool_subagent_references.py gives the current reason for rejecting a wildcard spawn grant.
  • Smoke tested: the v2 probe above, before and after the change.
  • New or changed code files carry the required SPDX header

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own changes
  • I have commented my code where necessary
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings: cargo clippy -- -D warnings and cargo fmt --check pass
  • I have added or updated tests that prove my change works

Agents Affected

Kiro CLI v2 output only; orchestrator output is unchanged.

  • k-developer
  • k-architect
  • k-researcher
  • k-product-manager
  • k-quality-assurance
  • k-tpm
  • k-browser
  • k-media-analyzer

Notes for Reviewers

  • Review: adversarial review in rounds until 0 CRITICAL and 0 IMPORTANT findings remained (5 rounds; no CRITICAL or IMPORTANT was found). Round 1 and 2 SUGGESTION and MINOR findings (the * expansion, sentence splits, a wildcard test with MCP servers, a corrected test comment) each have a fix commit.
  • Not covered: a specialist shelling out to kiro-cli or claude through its shell tool.

Nihit Kasabwala added 20 commits October 30, 2026 02:06
A Kiro CLI v2 probe (kiro-cli 2.36.0, --agent-engine v2, --trust-all-tools)
showed a specialist with @Builtin can spawn k-developer through the
subagent tool. v2 ignores excludedTools, and an empty availableAgents list
allows every agent. For k-* agents the v2 renderer now drops every
subagent alias from tools and allowedTools, removes toolsSettings.subagent,
and expands @Builtin to the v2 builtins minus subagent. Orchestrator output
is unchanged.
With the v2 strip in place, the guide and CHANGELOG again say no specialist
holds a spawn tool in either runtime, and describe the v2 mechanism: an
explicit built-in list without subagent in place of @Builtin, matched to
kiro-cli 2.36.0.
…ecialists

Brings in the empty verification commit from #124; no tree change.

Verification on this branch, run from the worktree root on 1950dae (same
tree as this merge):
- make build && make synth: pass (11 agents, 82 skills, 19 SOPs, no synth
  warnings)
- cd cli && make test: pass (1791 passed, 0 failed)
- make test-skills-sh: pass (0 failed)
- uvx --with pyyaml pytest -q tests/: pass (226 passed)
- make claude-plugin-check: pass

Kiro CLI v2 probe on this branch's synth output (kiro-cli 2.36.0,
--agent-engine v2, --trust-all-tools, specialist spawn rule removed from
the scratch k-core-rules.md): k-architect reported no spawn tool and made
no spawn call, no file written. Nested: konductor spawned k-architect, which
answered SPAWN BLOCKED; orchestrator spawning still works.
…ecialists

CHANGELOG conflict: kept this branch's v2 strip text and the parent's "kiro-cli 2.35.0" (no "and later").
The list was probed on kiro-cli 2.36.0 only, matching the caveat on the v3 excludedTools bullet.
… next to @Builtin

strip_specialist_spawn_tools expanded @Builtin into the explicit list and also kept a
named built-in such as fs_read, so the tool appeared twice.

Verified at this commit from the worktree root:
- make build && make synth: pass
- cd cli && make test: pass (cargo 1792 passed, 0 failed)
- make test-skills-sh: pass (85 passed, 0 failed)
- uvx --with pyyaml pytest -q tests/: 226 passed
- make claude-plugin-check: validation passed
…alists

Re-parents the v2 strip onto S1 (feat/single-writer-auto, 51512ce) in
place of the old parent feat/deny-specialist-spawn. No conflicts; both
CHANGELOG bullets kept under [Unreleased]. The diff against the new
parent matches the branch's pre-merge diff against its old parent
(only hunk line offsets differ).

Gate run on the merged tree before commit, all passed:
- make build && make synth: ok
- cd cli && make test: 1792 passed, 0 failed
- make test-skills-sh: 10 passed, 0 failed
- uvx --with pyyaml pytest -q tests/: 227 passed
- make claude-plugin-check: validation passed
…alists

# Conflicts:
#	CHANGELOG.md
#	docs/user-guide/faq.md
#	docs/user-guide/sop-workflows/code-review.md
A * in a k-* spec's tools passed through the v2 strip unchanged and
granted subagent, the one runtime where the config did not block it. It
now expands to the explicit built-in list plus @<server> for each of the
spec's MCP servers.
Ran: cargo test --release kiro_cli_v2 (67 passed).
Gate at this tree: make build && make synth (ok); cd cli && make test
(1793 passed); make test-skills-sh (10 scripts, 85 passed);
uvx --with pyyaml pytest -q tests/ (232 passed); make claude-plugin-check
(validated).
…alists

# Conflicts:
#	CHANGELOG.md
#	docs/user-guide/sop-workflows/code-review.md
…alists

# Conflicts:
#	docs/user-guide/sop-workflows/code-review.md
…alists

Brings PR 1 (project memory is project content) up the stack. No conflicts.

Gate: make build && make synth ok; cli make test 1794 passed, 0 failed;
make test-skills-sh 10 passed, 0 failed; pytest 260 passed, 1 skipped; make claude-plugin-check ok.
…alists

Brings PR 1 (project memory is project content) up the stack. No conflicts.

Gate: make build && make synth ok; cli make test 1794 passed, 0 failed;
make test-skills-sh 10 passed, 0 failed; pytest 260 passed, 1 skipped; make claude-plugin-check ok.
…-v2-specialists

# Conflicts:
#	cli/konductor-rs/tests/synth_install_e2e.rs
@knihit
knihit added this pull request to stack #150 October 31, 2026 23:37

This branch has not been deployed

No deployments
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