Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: keep the swarm section out of the v2 engine preview instructions

Samrat Talukdar4ed6d7ad96aa
diff --git a/apps/server/src/engine-v2-preview.test.ts b/apps/server/src/engine-v2-preview.test.ts
index 90190be7..85793dc4 100644
--- a/apps/server/src/engine-v2-preview.test.ts
+++ b/apps/server/src/engine-v2-preview.test.ts
@@ -18,6 +18,8 @@ test("v2 app guidance fits the native entry limit and uses the current native to
for (const connected of [true, false]) {
const value = buildOmniRushV2Instructions(connected);
expect(Buffer.byteLength(JSON.stringify(value), "utf8")).toBeLessThanOrEqual(7 * 1024);
+ expect(value.operatingInstructions).not.toContain("Sub-agent swarms");
+ expect(value.operatingInstructions).toContain("## Editing files");
expect(value.operatingInstructions).not.toContain("omnirush-cloud_search_capabilities");
expect(value.operatingInstructions).not.toContain("omnirush-cloud_execute_capability");
expect(value.operatingInstructions).toStartWith("You are omnirush.ai.");
diff --git a/apps/server/src/opencode-v2-instructions.ts b/apps/server/src/opencode-v2-instructions.ts
index 1aaba42c..56714ff4 100644
--- a/apps/server/src/opencode-v2-instructions.ts
+++ b/apps/server/src/opencode-v2-instructions.ts
@@ -3,6 +3,7 @@ import { readFile, realpath } from "node:fs/promises";
import { join, sep } from "node:path";
import { parseFrontmatter } from "./frontmatter.js";
import { OMNIRUSH_AGENT_PROMPT } from "./omnirush-agent-prompt.js";
+import { OMNIRUSH_SWARM_PROMPT } from "./omnirush-swarm.js";
export const OMNIRUSH_V2_INSTRUCTION_KEY = "omnirush.context";
@@ -42,7 +43,9 @@ export async function waitForOmniRushV2Skills(directory: string, readNative: ()
/** OmniRush.ai owns app guidance; OpenCode owns the live skill and MCP catalogs. */
export function buildOmniRushV2Instructions(connectReady: boolean) {
return {
- operatingInstructions: OMNIRUSH_AGENT_PROMPT.replace(
+ // Swarms need the v1 engine's nested task tool and the swarm plugin;
+ // the v2 preview has neither, and its entry size is capped.
+ operatingInstructions: OMNIRUSH_AGENT_PROMPT.replace(`\n\n${OMNIRUSH_SWARM_PROMPT}`, "").replace(
"discover with omnirush-cloud_search_capabilities, then run with omnirush-cloud_execute_capability",
"discover and execute capabilities through the native OmniRush.ai MCP interface exposed by the current tool catalog",
),