anomalyco / anomalyco/opencode
[FEATURE]: Ensure fresh time context for recurring/loop-triggered prompts in long-lived sessions (complement to #47816)
@neriousy is already working on this.
Since Sep 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Related
#47816, #29672, #15876, #47251
Problem
PR #47816 injects a synthetic date reminder (<system-reminder>Today's date is ...</system-reminder>) attached to the current last user message, only when no visible synthetic date part with today's date exists. This works well for interactive sessions.
However, it does not cover recurring, loop-triggered prompts injected into long-lived sessions (e.g. cron jobs, event-loop schedulers, or any automation that pushes a new prompt into an existing session that may have been running for days or weeks).
In such setups, tasks with an "update/refresh character" ("aktuell", "aktualisiere", "neueste", "what's the latest") depend on the model correctly interpreting current time. Without a guaranteed fresh timestamp on every injected turn, the model can:
- fall back to a stale date from an earlier turn in the same session,
- misinterpret "today"/"yesterday"/"latest" relative to an outdated reference,
- produce results that are not actually current, defeating the purpose of the scheduled task.
Proposed enhancement
Extend the injection logic from #47816 so that every new turn - including turns triggered by injected/automated prompts (cron, event-loop, session-resume) - is guaranteed to carry a fresh, well-formed time context:
- Always inject on automated/injected prompts: when a prompt is pushed into a session by an external scheduler (not typed interactively), append a fresh
<system-reminder>with the current date and time (e.g.2026-09-12 11:41 CEST (Saturday)), regardless of whether an older synthetic date part exists. - Include time-of-day, not just date: "aktuell"/"latest" often refers to the current hour, not just the calendar day. A date-only reminder is insufficient for intra-day freshness.
- Re-inject on day/time change mid-session: if the last injected timestamp is older than the current turn (e.g. session resumed after hours/days), replace/append the fresh one.
- Keep cache-friendliness: preserve the #47816 goal of not putting the date into the cached system prompt - the reminder should remain a tail-attached synthetic part so prompt-cache hits are not broken.
Why this matters
Recurring automation (cron-triggered prompts into older sessions) is a first-class use case for agentic setups. Without guaranteed fresh time context, scheduled "update" tasks silently produce stale results. This complements #47816 by covering the non-interactive injection path.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.