Skip to content

[FEATURE]:Auto-timestamp on user messages for AI time context #47251

Open

Description

@hotick

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When users interact with AI across multiple sessions or long conversations, the AI has no reliable way to know the current time. This leads to:

AI confusing "yesterday" vs "today"
Inaccurate time-related suggestions
Poor temporal context in multi-session workflows
Describe the solution you'd like
Automatically append a timestamp (e.g., [2026-09-04 16:05]) to each user message in the conversation context, so the AI can accurately perceive time without manual reminders.

Additional context
This is especially useful for long-running projects where time awareness affects decision quality (e.g., financial data analysis, scheduling tasks, version control workflows).

Activity

  1. github-actions commented on Sep 4, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of an existing issue. Please check:

  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the suggestion! You're asking for each user message to carry a timestamp (date and time of day) so the model always knows the current time in long or multi-session work.

    For context: OpenCode v2 already tells the model today's date and sends an update when the date changes during a session. It doesn't include the time of day or a timestamp on each message. Maintainers will consider this; I can't promise anything.

    Related issues:

    In the meantime, a small v2 plugin can do this today. It adds the local time to the start of every prompt you send. It type-checks against the plugin API, but I haven't tested it in a running OpenCode. Save it as ~/.config/opencode/plugins/timestamp.ts to use it everywhere, or as .opencode/plugins/timestamp.ts for a single project:

    import { Plugin } from "@opencode/plugin"
    
    const pad = (n: number) => String(n).padStart(2, "0")
    
    const stamp = (d: Date) => {
      const offset = -d.getTimezoneOffset()
      const sign = offset >= 0 ? "+" : "-"
      const tz = `${sign}${pad(Math.floor(Math.abs(offset) / 60))}:${pad(Math.abs(offset) % 60)}`
      return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())} ${tz}`
    }
    
    export default Plugin.define({
      id: "user-message-timestamp",
      setup: async (ctx) => {
        await ctx.session.hook("prompt", (event) => {
          event.prompt.text = `[${stamp(new Date())}] ${event.prompt.text}`
        })
      },
    })

    The timestamp becomes part of the saved message, so you'll also see it in the conversation (e.g. [2026-09-04 16:05 +02:00] your message). Restart the background service with opencode service restart so it picks up the plugin.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions