fix: include promptGuidelines in customPrompt path of buildSystemPrompt (#1187)

When buildSystemPrompt() receives a customPrompt (as GSD's contract
provides), it returned early without appending promptGuidelines from
extension-registered tools. The tool definitions still reached the
API's tools parameter, but without prompt guidance the model didn't
know when to prefer them — causing subagent tools to be silently
ignored in favor of async_bash/bg_shell.

Added promptGuidelines append after date/time in the customPrompt
path, matching the behavior of the non-custom path.

Fixes #1184
This commit is contained in:
Tom Boucher 2026-03-18 12:55:16 -04:00 committed by GitHub
parent 60508c2ec2
commit 1236919c39

View file

@ -94,6 +94,17 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin
prompt += `\nCurrent date and time: ${dateTime}`;
prompt += `\nCurrent working directory: ${resolvedCwd}`;
// Append promptGuidelines from extension-registered tools.
// Without this, tools registered via pi.registerTool() with promptGuidelines
// have their definitions reach the API but the model has no guidance on when
// to use them (#1184).
if (promptGuidelines && promptGuidelines.length > 0) {
prompt += "\n\n";
for (const guideline of promptGuidelines) {
prompt += guideline + "\n";
}
}
return prompt;
}