Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix(swarm): split real work across sub-agents by default

Anurag Pappula727b303e3025
diff --git a/apps/server/src/engine2/restraint-notes.e2e.test.ts b/apps/server/src/engine2/restraint-notes.e2e.test.ts
index ad4e42a8..54f0f6a5 100644
--- a/apps/server/src/engine2/restraint-notes.e2e.test.ts
+++ b/apps/server/src/engine2/restraint-notes.e2e.test.ts
@@ -152,7 +152,7 @@ describeMaybe("delegation rules on the 2.x engine (mock provider)", () => {
const main = await waitFor(() => seen.find((body) => !isChild(body)), "the main session's request");
const mainSystem = systemOf(main);
- expect(mainSystem).toContain("Do simple work yourself: a question a few tool calls can answer needs no sub-agent.");
+ expect(mainSystem).toContain("Split real work: for a task of more than a few tool calls, start one sub-agent per independent part in one message");
expect(mainSystem).toContain("make exactly that many subagent calls, no more and no fewer, and start them all in one message");
expect(mainSystem).toContain("Tell a sub-agent to start its own sub-agents only when the user explicitly asked for nested sub-agents.");
expect(mainSystem).not.toContain(SUB_NOTE_MARK);
diff --git a/apps/server/src/omnirush-agent-prompt.ts b/apps/server/src/omnirush-agent-prompt.ts
index 064cd61c..effe7459 100644
--- a/apps/server/src/omnirush-agent-prompt.ts
+++ b/apps/server/src/omnirush-agent-prompt.ts
@@ -38,7 +38,7 @@ Hard rule: never copy private memory into repo files. Store only redacted summar
- If required setup or credentials are missing, ask one targeted question and continue once provided.
- If you change code, run the smallest meaningful test.
- Write long files in chunks: create a file with its first section, then append the rest in a few smaller edit (or patch) calls instead of one very large write. A single multi-thousand-token patch is the write most likely to be cut off in transit; if a write is interrupted, re-issue only the missing part.
-- Do simple work yourself: a question a few tool calls can answer needs no sub-agent. Use the subagent tool only when the user asks for sub-agents or the work clearly splits into independent parts that each take real effort.
+- Split real work: for a task of more than a few tool calls, start one sub-agent per independent part in one message (one per bug or feature, one for tests, one to review), then combine results. Do quick questions yourself.
- When the user asks for a specific number of agents, make exactly that many subagent calls, no more and no fewer, and start them all in one message so they run in parallel. Use the general subagent unless a more specialized subagent is clearly better. Never replace an explicit delegation request with a simulated multi-role answer, and never claim subagents are unavailable while the subagent tool is present.
- Write each sub-agent's prompt yourself: self-contained, limited to that sub-agent's part, saying what to return. Never paste the user's whole message, or the user's instructions about sub-agents, into a sub-agent's prompt: the sub-agent would follow them again. Tell a sub-agent to start its own sub-agents only when the user explicitly asked for nested sub-agents.
- Wait for every delegated task, then synthesize their actual results before answering; keep delegated activity visible in the session.
diff --git a/apps/server/src/omnirush-runtime-config.test.ts b/apps/server/src/omnirush-runtime-config.test.ts
index 33ba356a..43839cfd 100644
--- a/apps/server/src/omnirush-runtime-config.test.ts
+++ b/apps/server/src/omnirush-runtime-config.test.ts
@@ -324,7 +324,7 @@ describe("omnirush runtime config file", () => {
expect(prompt).toContain("## Memory\n");
expect(prompt).toContain("## OmniRush.ai Artifacts");
expect(prompt).toContain("## Connected work");
- expect(prompt).toContain("Do simple work yourself: a question a few tool calls can answer needs no sub-agent.");
+ expect(prompt).toContain("Split real work: for a task of more than a few tool calls, start one sub-agent per independent part in one message");
expect(prompt).toContain("make exactly that many subagent calls, no more and no fewer, and start them all in one message");
expect(prompt).toContain("Never paste the user's whole message, or the user's instructions about sub-agents, into a sub-agent's prompt");
expect(prompt).toContain("Never replace an explicit delegation request with a simulated multi-role answer");