Skip to content

Commit b521e8c

Browse files
fix(server): Claude sets a /goal that also mentions a skill
makeClaudeUserMessage split a prompt mentioning a known skill into a leading block plus a trailing /skill block. Claude only runs /goal when it opens the prompt, so '/goal ... $skill' never set a goal while the server still treated the message as a goal command. Send a goal command as one string, with skill mentions rewritten inline as /name. Fixes #29750 AI-assisted; verified with the tests and tools listed above.
1 parent bee7013 commit b521e8c

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ import {
9797
TrimmedNonEmptyString,
9898
defaultInstanceIdForDriver,
9999
isCompactionCommandMessage,
100+
parseGoalCommand,
100101
type MessageId,
101102
type ModelSelection,
102103
type OrchestrationV2ConversationMessage,
@@ -2551,18 +2552,22 @@ export function makeClaudeUserMessage(input: {
25512552
// Keep the whole request before that block; see ClaudeSkillDispatch.
25522553
const dispatch =
25532554
input.skills === undefined ? undefined : planClaudeSkillDispatch(input.text, input.skills);
2555+
// Claude runs `/goal` only when it opens the prompt, so a goal stays one block.
2556+
const isGoalCommand = parseGoalCommand({ text: input.text }) !== null;
25542557
return {
25552558
type: "user",
25562559
message: {
25572560
role: "user",
2558-
content: dispatch
2559-
? [
2560-
...(dispatch.leadingText === undefined
2561-
? []
2562-
: [{ type: "text" as const, text: dispatch.leadingText }]),
2563-
{ type: "text" as const, text: dispatch.commandText },
2564-
]
2565-
: input.text,
2561+
content: isGoalCommand
2562+
? (dispatch?.leadingText ?? input.text)
2563+
: dispatch
2564+
? [
2565+
...(dispatch.leadingText === undefined
2566+
? []
2567+
: [{ type: "text" as const, text: dispatch.leadingText }]),
2568+
{ type: "text" as const, text: dispatch.commandText },
2569+
]
2570+
: input.text,
25662571
},
25672572
parent_tool_use_id: null,
25682573
...(input.priority === undefined ? {} : { priority: input.priority }),

0 commit comments

Comments
 (0)