Skip to content

feat: make AgentSwarm the preferred parallel path - #107

Merged
mbuckaway merged 3 commits into
fork/mainfrom
fix/swarm-must
Sep 12, 2026
Merged

mbuckaway merged 3 commits into
fork/mainfrom
fix/swarm-must

Conversation

@mbuckaway

Copy link
Copy Markdown
Owner

Related Issue

Problem

After the 0.39.1 sync, the agent prefers a single sequential Agent over the parallel AgentSwarm even with swarm mode on. A review found the bias is structural in the two tool definitions, not the system prompt: AgentSwarm requires ≥2 homogeneous items plus one {{item}} template, its own description told the model to "make separate Agent calls" for differently-shaped tasks, and the swarm-mode workflow reminder was off by default.

What changed

  • The swarm choice is now a MUST in agent.md (both engines), the explore profile's whenToUse, and both system prompts; the agent-swarm.md line redirecting differently-shaped work to Agent is gone.
  • AgentSwarm gained a prompts input (≥2 distinct full prompts), so differently-shaped subtasks run as one swarm.
  • default_swarm_mode now defaults to true, so new sessions start in swarm mode.
  • The AgentSwarm sole-tool-call veto was removed (it conflicted with the system prompt's parallel-tool-call directive), and the agent-swarm-exclusive-deny policy is deleted.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related upstream issue.
  • I have added tests that prove the feature works.
  • Added a changeset (minor).
  • Updated docs (config-files en/zh, reference/tools en/zh, engine Permission.md); regenerated the tool snapshots and the config manifest.

A prompt-only nudge (v0.39.1-MB.1.41) did not change tool selection. The
bias is structural: AgentSwarm could only express homogeneous item
batches, its own description routed differently-shaped work to Agent,
and the swarm-mode workflow reminder was off by default.

- Reword the swarm choice as a MUST in agent.md, the explore profile,
  and both system prompts; drop the AgentSwarm "use separate Agent
  calls" redirect.
- Add a `prompts` input to AgentSwarm so differently-shaped subtasks run
  as one swarm.
- Default `default_swarm_mode` to true so new sessions start in swarm
  mode.
- Drop the AgentSwarm sole-tool-call veto; it conflicted with the system
  prompt's parallel-tool-call directive.
default_swarm_mode = true made session create materialize the main agent
in order to enter swarm mode, which broke the lazy-materialization
invariant and 39 tests across node-sdk, kap-server, klient, and the
vscode harness. Record the intent on the session swarm service instead,
and let the main agent's swarm service enter swarm mode once when that
agent is created; a resumed session still restores its own swarm state.

Also fix the affected tests: set default_swarm_mode off where swarm state
is incidental, and assert the new default where it is the subject.
The harness's file-import tests assert a fresh session's exact context.
With default_swarm_mode now true, a fresh session starts in swarm mode
and its reminder enters the history, so those assertions fail. Swarm
state is incidental to these tests, so disable it in the fixture config.
@mbuckaway
mbuckaway merged commit 6a411d7 into fork/main Sep 12, 2026
22 of 23 checks passed
@mbuckaway
mbuckaway deleted the fix/swarm-must branch September 12, 2026 14:18
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