Fix custom system prompts missing context, skills, date/time, cwd

fixes #321
This commit is contained in:
Mario Zechner 2025-12-26 03:06:10 +01:00
parent 9652072f20
commit fbfdeb2c2e
2 changed files with 11 additions and 1 deletions

View file

@ -2,6 +2,10 @@
## [Unreleased] ## [Unreleased]
### Fixed
- **Custom system prompts missing context**: When using a custom system prompt string, project context files (AGENTS.md), skills, date/time, and working directory were not appended. ([#321](https://github.com/badlogic/pi-mono/issues/321))
## [0.30.0] - 2025-12-25 ## [0.30.0] - 2025-12-25
### Breaking Changes ### Breaking Changes

View file

@ -550,7 +550,13 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
if (options.systemPrompt === undefined) { if (options.systemPrompt === undefined) {
systemPrompt = defaultPrompt; systemPrompt = defaultPrompt;
} else if (typeof options.systemPrompt === "string") { } else if (typeof options.systemPrompt === "string") {
systemPrompt = options.systemPrompt; systemPrompt = buildSystemPromptInternal({
cwd,
agentDir,
skills,
contextFiles,
customPrompt: options.systemPrompt,
});
} else { } else {
systemPrompt = options.systemPrompt(defaultPrompt); systemPrompt = options.systemPrompt(defaultPrompt);
} }