From 4b9e6006fad553dcca5aa69b23a039088064589f Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 13 Mar 2026 21:05:56 +0100 Subject: [PATCH] fix(coding-agent): keep only ISO date in system prompt closes #2131 --- packages/coding-agent/CHANGELOG.md | 1 + .../coding-agent/src/core/system-prompt.ts | 20 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 51abfce1..f1e75986 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -7,6 +7,7 @@ - Fixed interactive input fields backed by the TUI `Input` component to scroll by visual column width for wide Unicode text (CJK, fullwidth characters), preventing rendered line overflow and TUI crashes in places like search and filter inputs ([#1982](https://github.com/badlogic/pi-mono/issues/1982)) - Fixed `shift+tab` and other modified Tab bindings in tmux when `extended-keys-format` is left at the default `xterm` - Fixed EXIF orientation not being applied during image convert and resize, causing JPEG and WebP images from phone cameras to display rotated or mirrored ([#2105](https://github.com/badlogic/pi-mono/pull/2105) by [@melihmucuk](https://github.com/melihmucuk)) +- Fixed the default coding-agent system prompt to include only the current date in ISO format, not the current time, so prompt prefixes stay cacheable across reloads and resumed sessions ([#2131](https://github.com/badlogic/pi-mono/issues/2131)) ## [0.57.1] - 2026-03-07 diff --git a/packages/coding-agent/src/core/system-prompt.ts b/packages/coding-agent/src/core/system-prompt.ts index 94980976..75926020 100644 --- a/packages/coding-agent/src/core/system-prompt.ts +++ b/packages/coding-agent/src/core/system-prompt.ts @@ -49,17 +49,7 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin } = options; const resolvedCwd = cwd ?? process.cwd(); - const now = new Date(); - const dateTime = now.toLocaleString("en-US", { - weekday: "long", - year: "numeric", - month: "long", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - timeZoneName: "short", - }); + const date = new Date().toISOString().slice(0, 10); const appendSection = appendSystemPrompt ? `\n\n${appendSystemPrompt}` : ""; @@ -88,8 +78,8 @@ export function buildSystemPrompt(options: BuildSystemPromptOptions = {}): strin prompt += formatSkillsForPrompt(skills); } - // Add date/time and working directory last - prompt += `\nCurrent date and time: ${dateTime}`; + // Add date and working directory last + prompt += `\nCurrent date: ${date}`; prompt += `\nCurrent working directory: ${resolvedCwd}`; return prompt; @@ -210,8 +200,8 @@ Pi documentation (read only when the user asks about pi itself, its SDK, extensi prompt += formatSkillsForPrompt(skills); } - // Add date/time and working directory last - prompt += `\nCurrent date and time: ${dateTime}`; + // Add date and working directory last + prompt += `\nCurrent date: ${date}`; prompt += `\nCurrent working directory: ${resolvedCwd}`; return prompt;