fix(coding-agent): string systemPrompt now works as full replacement

When passing a string systemPrompt to createAgentSession(), it is now
used as-is without appending context files and skills. This matches the
documented behavior: 'String replaces default, function receives default
and returns final.'

Previously, string systemPrompt would have context files and skills
appended, causing duplication if they were already in the string.

fixes #543
This commit is contained in:
Mario Zechner 2026-01-08 20:47:52 +01:00
parent dc54c308a9
commit 8fda948866
2 changed files with 3 additions and 8 deletions

View file

@ -549,14 +549,8 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
if (options.systemPrompt === undefined) {
return defaultPrompt;
} else if (typeof options.systemPrompt === "string") {
return buildSystemPromptInternal({
cwd,
agentDir,
skills,
contextFiles,
selectedTools: validToolNames,
customPrompt: options.systemPrompt,
});
// String is a full replacement - use as-is without appending context/skills
return options.systemPrompt;
} else {
return options.systemPrompt(defaultPrompt);
}