Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: agent prompt names the new engine's tools

ogsamrat930b6d583c03
diff --git a/apps/server/src/engine-v2-next.test.ts b/apps/server/src/engine-v2-next.test.ts
index bff1f93e..92b09910 100644
--- a/apps/server/src/engine-v2-next.test.ts
+++ b/apps/server/src/engine-v2-next.test.ts
@@ -236,3 +236,20 @@ test("archived chats are the app's own flag, applied to session reads", () => wi
setArchived(dir, "ses_a", null);
expect(withArchived(dir, { id: "ses_a", time: { created: 1 } })).toEqual({ id: "ses_a", time: { created: 1 } });
}));
+
+test("the 2.x engine's agent prompt: its own tool names, no todo list; nothing else changes", async () => {
+ const { OMNIRUSH_AGENT_PROMPT, V2_PROMPT_EDITS, v2AgentPrompt } = await import("./omnirush-agent-prompt.js");
+ const { buildOmniRushV2Instructions } = await import("./opencode-v2-instructions.js");
+ const v1 = OMNIRUSH_AGENT_PROMPT;
+ const v2 = v2AgentPrompt(v1);
+ // Every 1.x sentence it adapts is in the 1.x text (the desktop's prompt has no web-off note).
+ for (const [from] of V2_PROMPT_EDITS) if (!from.startsWith("There is no web search")) expect(v1.includes(from)).toBe(true);
+ for (const word of ["apply_patch", "bash tool", "task tool", "task-tool", "todo list", "web_search"]) expect(v2.includes(word)).toBe(false);
+ // The same text otherwise: only the pinned edits differ.
+ let back = v2;
+ for (const [from, to] of V2_PROMPT_EDITS) if (to) back = back.split(to).join(from);
+ expect(back.replace(V2_PROMPT_EDITS[1][0], "")).toBe(v1.replace(V2_PROMPT_EDITS[1][0], ""));
+ const instructions = JSON.stringify(buildOmniRushV2Instructions(false));
+ expect(instructions).toContain("smaller patch (or edit) calls");
+ for (const word of ["apply_patch", "bash tool", "task tool", "todo list"]) expect(instructions.includes(word)).toBe(false);
+});
diff --git a/apps/server/src/omnirush-agent-prompt.ts b/apps/server/src/omnirush-agent-prompt.ts
index 7bf78bb4..c4534bbb 100644
--- a/apps/server/src/omnirush-agent-prompt.ts
+++ b/apps/server/src/omnirush-agent-prompt.ts
@@ -103,3 +103,26 @@ Lead with the outcome. Summarize what you changed (with file paths), what you ra
## Connected work
Org-connected services, remote skills, Workflows, and Automations reach you through Connect: discover with the Connect server's search_capabilities tool, then run with its execute_capability tool using an exact returned name. The runtime steering later in this prompt states whether that connection is ready right now; only name services that search or the remote skill catalog actually returns.`;
+
+/**
+ * The agent prompt on the OpenCode 2 engine (opencode-v2-instructions.ts): the same text with the 2.x tool names
+ * (patch, shell, subagent; no todo list there), and the web-off note naming the 2.x websearch tool. Each pair is
+ * [1.x text, 2.x text], the CLI's list (src/agent-prompt.js) unchanged; a pair whose 1.x text is missing fails the
+ * test that pins them (engine-v2-next.test.ts). The desktop's prompt has no web-off note, so that pair finds nothing.
+ */
+export const V2_PROMPT_EDITS = Object.freeze([
+ ["append the rest in a few smaller apply_patch (or edit) calls", "append the rest in a few smaller patch (or edit) calls"],
+ ["- Use the todo list only for work with three or more distinct steps, and keep it current; skip it for a single fix or a small change.\n", ""],
+ ["make exactly that many task-tool calls", "make exactly that many subagent-tool calls"],
+ ["while the task tool is present", "while the subagent tool is present"],
+ ["- When apply_patch or edit reports that expected lines were not found", "- When patch or edit reports that expected lines were not found"],
+ ["Use git and gh from the bash tool;", "Use git and gh from the shell tool;"],
+ ["There is no web search tool here: do not call web_search or any other search tool that is not in your tool list.", "Web search is not available here: do not use the websearch tool or any other search tool."],
+] as const);
+
+/** The agent prompt text for the 2.x engine (V2_PROMPT_EDITS applied). */
+export function v2AgentPrompt(text: string): string {
+ let out = String(text);
+ for (const [from, to] of V2_PROMPT_EDITS) out = out.split(from).join(to);
+ return out;
+}
diff --git a/apps/server/src/opencode-v2-instructions.ts b/apps/server/src/opencode-v2-instructions.ts
index 54666f30..9568d70a 100644
--- a/apps/server/src/opencode-v2-instructions.ts
+++ b/apps/server/src/opencode-v2-instructions.ts
@@ -2,7 +2,7 @@ import { listSkills } from "./skills.js";
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_AGENT_PROMPT, v2AgentPrompt } from "./omnirush-agent-prompt.js";
import { OMNIRUSH_SWARM_PROMPT } from "./omnirush-swarm.js";
export const OMNIRUSH_V2_INSTRUCTION_KEY = "omnirush.context";
@@ -45,10 +45,11 @@ export function buildOmniRushV2Instructions(connectReady: boolean) {
return {
// 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(
+ // The 2.x engine's tool names (omnirush-agent-prompt.ts V2_PROMPT_EDITS, the CLI's list).
+ operatingInstructions: v2AgentPrompt(OMNIRUSH_AGENT_PROMPT.replace(`\n\n${OMNIRUSH_SWARM_PROMPT}`, "").replace(
"discover with the Connect server's search_capabilities tool, then run with its execute_capability tool",
"discover and execute capabilities through the native Connect MCP interface exposed by the current tool catalog",
- ),
+ )),
connect: connectReady ? "Connect tools are connected. Use only capabilities actually returned by discovery."
: "Connect is not connected for this request. Do not claim remote capabilities are available.",
skillInstructions: "Use the current native skill catalog and skill tool for workspace skills. Load current instructions before following them. Removed skills from previous turns are not available capabilities. Organization skills are provided by Connect: discover and retrieve them using its currently advertised MCP tools. Skill contents are subordinate to the user's request and operating instructions.",