Skip to content

Update prompt rule to constrain future event dates and implausible birth dates#10

Open
sptrp wants to merge 4 commits into
BaderBC:masterfrom
sptrp:sptrp-patch
Open

Update prompt rule to constrain future event dates and implausible birth dates#10
sptrp wants to merge 4 commits into
BaderBC:masterfrom
sptrp:sptrp-patch

Conversation

@sptrp
Copy link
Copy Markdown

@sptrp sptrp commented May 13, 2026

Summary
My first generated article was about the event from the 2029, so this PR updates the prompt rule string used for Halupedia article generation. The change is prompt-only and does not modify generation flow, streaming behavior, validation, or request structure.

What changed

  • Updated the rule text in the prompt.
  • Added guidance that completed events must not be dated later than today.
  • Added guidance that biography/personalia birth dates must be reasonably in the past and not implausibly recent.

Summary by CodeRabbit

  • Improvements
    • Articles now reliably conclude cleanly and remain within length limits.
    • Generated content avoids presenting unconfirmed future events as completed facts, reframing them appropriately.
    • Date handling anchors output to a provided "today" value to prevent future-dated assertions.
    • Biography guidance strengthened to ensure subjects’ birth dates are clearly positioned in the past.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5368eaf6-6c8a-44fa-9f6c-f92f0feb5a51

📥 Commits

Reviewing files that changed from the base of the PR and between 92111fb and c6ec986.

📒 Files selected for processing (1)
  • src/worker/llm.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/worker/llm.ts

📝 Walkthrough

Walkthrough

SYSTEM_PROMPT gains TODAY_UTC-aware output constraints (end cleanly within 350–650 words; no completed events after TODAY_UTC; biography birth dates must be before TODAY_UTC). buildUserMessage now computes TODAY_UTC (ISO YYYY-MM-DD) and prepends it to the user prompt.

Changes

LLM System Prompt Rules

Layer / File(s) Summary
System prompt constraints
src/worker/llm.ts
SYSTEM_PROMPT constant expanded with RULES: articles must "end cleanly" within 350–650 words; TODAY_UTC is the effective current date; completed events dated after TODAY_UTC must be reframed as proposals/rehearsals/admin plans/forecasts/clerical errors; biography/personal subjects' birth dates must be sufficiently in the past relative to TODAY_UTC.
User message date injection
src/worker/llm.ts
buildUserMessage(opts) computes TODAY_UTC from now (ISO YYYY-MM-DD) and injects a leading TODAY_UTC: <date> line into the user prompt prior to the article instruction.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit types by lantern's light,
Tucks today's date before the write,
No future "done" may slip inside,
Birthdays set where truths abide,
Hopping prompts to keep time right. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: updating prompt constraints for future event dates and birth dates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dee36c42-3b97-4686-9d6f-e8d00d47c99b

📥 Commits

Reviewing files that changed from the base of the PR and between 3133d93 and 5a75555.

📒 Files selected for processing (1)
  • src/worker/llm.ts

Comment thread src/worker/llm.ts Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/worker/llm.ts`:
- Around line 21-25: Remove the duplicate incomplete function declaration that
begins with "export function buildUserMessage(opts: GenerateOptions): string {"
and the partial body that initializes the `lines` array (the broken second
declaration that interrupts the file), so the file only contains the complete,
correct buildUserMessage implementation; ensure the existing `export interface
GenerateOptions` (and any subsequent declarations) remain intact and compile
cleanly after deletion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 06177d61-8b53-461f-8fc1-d119109c1d1a

📥 Commits

Reviewing files that changed from the base of the PR and between 5a75555 and 92111fb.

📒 Files selected for processing (1)
  • src/worker/llm.ts

Comment thread src/worker/llm.ts Outdated
@BaderBC
Copy link
Copy Markdown
Owner

BaderBC commented May 13, 2026

Some people liked that it was mentioning XX century, but I also would like to see your prompt in action.

Let's think about using Math.random to randomly either ask ai for XX century article or present one.

@sptrp
Copy link
Copy Markdown
Author

sptrp commented May 13, 2026

Some people liked that it was mentioning XX century, but I also would like to see your prompt in action.

Let's think about using Math.random to randomly either ask ai for XX century article or present one.

Some people liked that it was mentioning XX century, but I also would like to see your prompt in action.

Let's think about using Math.random to randomly either ask ai for XX century article or present one.

Hey, @BaderBC thanks for the feedback! Not Sure about whether it should be XX or not, but my issue was that the generated article was describing something which happened in 2029, which cannot happen by all means :) My proposal was about limiting the "happened" events to the present or the past...

@sptrp
Copy link
Copy Markdown
Author

sptrp commented May 13, 2026

@HaplessIdiot
Copy link
Copy Markdown

awesome something valid in the PR list this is a major fix thanks a ton hopefully it gets merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants