[PR #2529] fix: inject current date into summary prompt to prevent AI temporal confusion #2144

Open
opened 2026-03-02 12:00:45 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/karakeep-app/karakeep/pull/2529
Author: @ursazoo
Created: 2/28/2026
Status: 🔄 Open

Base: mainHead: fix/inject-current-date-in-summary-prompt


📝 Commits (1)

  • d313932 fix: 在摘要 prompt 中注入当前日期,避免 AI 误判时间

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 packages/shared/prompts.ts (+2 -0)

📄 Description

Problem

When the AI model generates summaries, it doesn't know the current date. This causes it to incorrectly flag recent dates in articles (e.g., "2026 ClawHub trending list") as potentially erroneous in the summary's "questionable claims" section, because the model reasons from its training cutoff year rather than the actual current date.

Solution

Inject today's date (new Date().toISOString().split('T')[0]) into constructSummaryPrompt as an explicit rule. This is computed at runtime so it always reflects the server's actual current date.

+  const today = new Date().toISOString().split("T")[0];
   return `
 Summarize the following content responding ONLY with the summary. You MUST follow the following rules:
 - Summary must be in 3-4 sentences.
 - The summary must be in ${lang}.
+- Today's date is ${today}. Do NOT flag or question dates that are in the past relative to today.

Changes

  • packages/shared/prompts.ts: Added current date injection in constructSummaryPrompt

Test plan

  • Generate a summary for an article that mentions a recent year (e.g., 2025 or 2026)
  • Verify the AI no longer flags those dates as "potentially incorrect" in the summary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/karakeep-app/karakeep/pull/2529 **Author:** [@ursazoo](https://github.com/ursazoo) **Created:** 2/28/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/inject-current-date-in-summary-prompt` --- ### 📝 Commits (1) - [`d313932`](https://github.com/karakeep-app/karakeep/commit/d3139327c4094226fc0c812dc6714180ed949dbf) fix: 在摘要 prompt 中注入当前日期,避免 AI 误判时间 ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/shared/prompts.ts` (+2 -0) </details> ### 📄 Description ## Problem When the AI model generates summaries, it doesn't know the current date. This causes it to incorrectly flag recent dates in articles (e.g., \"2026 ClawHub trending list\") as potentially erroneous in the summary's \"questionable claims\" section, because the model reasons from its training cutoff year rather than the actual current date. ## Solution Inject today's date (`new Date().toISOString().split('T')[0]`) into `constructSummaryPrompt` as an explicit rule. This is computed at runtime so it always reflects the server's actual current date. ```diff + const today = new Date().toISOString().split("T")[0]; return ` Summarize the following content responding ONLY with the summary. You MUST follow the following rules: - Summary must be in 3-4 sentences. - The summary must be in ${lang}. +- Today's date is ${today}. Do NOT flag or question dates that are in the past relative to today. ``` ## Changes - `packages/shared/prompts.ts`: Added current date injection in `constructSummaryPrompt` ## Test plan - [ ] Generate a summary for an article that mentions a recent year (e.g., 2025 or 2026) - [ ] Verify the AI no longer flags those dates as \"potentially incorrect\" in the summary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/karakeep#2144
No description provided.