From 8fda94886645dfddb46bdebbc43034aa976d63da Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 8 Jan 2026 20:47:52 +0100 Subject: [PATCH] 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 --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/src/core/sdk.ts | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index c337e94c..a9c287b8 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -17,6 +17,7 @@ ### Fixed +- String `systemPrompt` in `createAgentSession()` now works as a full replacement instead of having context files and skills appended, matching documented behavior ([#543](https://github.com/badlogic/pi-mono/issues/543)) - Update notification for bun binary installs now shows release download URL instead of npm command ([#567](https://github.com/badlogic/pi-mono/pull/567) by [@ferologics](https://github.com/ferologics)) - ESC key now works during "Working..." state after auto-retry ([#568](https://github.com/badlogic/pi-mono/pull/568) by [@tmustier](https://github.com/tmustier)) - Abort messages now show correct retry attempt count (e.g., "Aborted after 2 retry attempts") ([#568](https://github.com/badlogic/pi-mono/pull/568) by [@tmustier](https://github.com/tmustier)) diff --git a/packages/coding-agent/src/core/sdk.ts b/packages/coding-agent/src/core/sdk.ts index 16072359..93bb9ea5 100644 --- a/packages/coding-agent/src/core/sdk.ts +++ b/packages/coding-agent/src/core/sdk.ts @@ -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); }