Skip to content

fix: inject date/time context into all agent prompts#627

Closed
glifocat wants to merge 1 commit intoqwibitai:mainfrom
glifocat:fix/date-context-injection
Closed

fix: inject date/time context into all agent prompts#627
glifocat wants to merge 1 commit intoqwibitai:mainfrom
glifocat:fix/date-context-injection

Conversation

@glifocat
Copy link
Copy Markdown
Collaborator

@glifocat glifocat commented Mar 1, 2026

LLMs cannot reliably derive day-of-week from ISO timestamps, so inject an explicit date/time prefix into every prompt sent to the container agent.

This adds a shared datePrefix() utility that prepends "[Current date and time: ...]" with the day-of-week to prompts in:

  • processGroupMessages (index.ts) — queued message processing
  • startMessageLoop (index.ts) — piped messages to active containers
  • runTask (task-scheduler.ts) — scheduled task execution

Without this, agents have no reliable notion of the current day-of-week, leading to incorrect temporal reasoning (e.g. saying "Friday" on Saturday).

Type of Change

  • Skill - adds a new skill in .claude/skills/
  • Fix - bug fix or security fix to source code
  • Simplification - reduces or simplifies source code

xicv pushed a commit to xicv/nanoclaw that referenced this pull request Mar 3, 2026
- qwibitai#657: computeNextRun() prevents interval drift on scheduled tasks
- qwibitai#655: auto-retry with fresh session when resume fails (breaks infinite loops)
- qwibitai#636: update next_run before enqueue to prevent duplicate task runs
- qwibitai#651: reduce container stop timeout to 1s for faster restarts
- qwibitai#622: add jq to container Dockerfile for safe JSON parsing
- qwibitai#627: inject date/time context into all agent prompts
LLMs cannot reliably calculate day-of-week from ISO timestamps.
Without explicit date context, agents give wrong answers about
scheduling, deadlines, and relative dates. This prepends
[Current date and time: ...] with day-of-week to every prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@glifocat glifocat force-pushed the fix/date-context-injection branch from fcbdf2d to 6ab9e9a Compare March 4, 2026 10:10
@glifocat
Copy link
Copy Markdown
Collaborator Author

glifocat commented Mar 4, 2026

Superseded by #701 (rebased to post-#500 architecture).

@glifocat glifocat closed this Mar 4, 2026
@glifocat glifocat deleted the fix/date-context-injection branch March 4, 2026 21:23
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.

1 participant