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

@ -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))

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);
}