diff --git a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts index 95df58c2bff32..f45248c0ce6f5 100644 --- a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts @@ -20297,6 +20297,13 @@ describe("ClaudeAdapterV2 background wake turns", () => { ); describe("native goals", () => { + it("preserves a multiline /goal as a native command when its objective mentions a skill", () => { + const skills = new Map([["review", { path: "/home/me/.claude/skills/review/SKILL.md" }]]); + const text = "/goal fix all the gaps.\ndecompile target.ipa into ./target/\n$review"; + const message = ClaudeAdapterV2.makeClaudeUserMessage({ text, skills }); + assert.equal(message.message.content, text); + }); + const syntheticFrame = (uuid: string, text: string) => claudeSdkFrame({ type: "assistant", diff --git a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts index 7c63bdb6024a6..5ef47007ee9b9 100644 --- a/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts +++ b/apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts @@ -97,6 +97,7 @@ import { TrimmedNonEmptyString, defaultInstanceIdForDriver, isCompactionCommandMessage, + parseGoalCommand, type MessageId, type ModelSelection, type OrchestrationV2ConversationMessage, @@ -2418,8 +2419,11 @@ export function makeClaudeUserMessage(input: { }): SDKUserMessage { // Claude expands a skill only when `/name` starts the last text block. // Keep the whole request before that block; see ClaudeSkillDispatch. + // Keep /goal on the native command path instead of dispatching a skill in its objective. const dispatch = - input.skills === undefined ? undefined : planClaudeSkillDispatch(input.text, input.skills); + input.skills === undefined || parseGoalCommand(input) !== null + ? undefined + : planClaudeSkillDispatch(input.text, input.skills); return { type: "user", message: {