Skip to content

inbox.sh: include current time in pull output so agents keep a fresh clock #489

Description

@Fewmanism

Motivation

CLI agents (Claude Code / Codex / Gemini CLI) have no reliable sense of current time: their context carries the session start date, so in long-running or resumed sessions they drift across day boundaries without noticing. Per-message [ts] in inbox.sh output shows send time, not now — an agent that pulls an empty inbox learns nothing about the clock at all.

Since the inbox pull is the one universal touchpoint every agmsg-connected agent hits (typically every turn), it is a natural place to hand the agent a fresh wall clock — same idea as the "put the timestamp in your PS1" trick, but harness-independent.

Proposal

Add a now=<UTC> marker to both pull outcomes:

3 new message(s): (now=2026-07-25T11:24:07Z)
No new messages. (now=2026-07-25T11:24:07Z)
  • --quiet stays fully silent (no change).
  • Per-message [ts] lines are unchanged.

Compatibility considerations

This changes two human-readable header lines. If anything parses ^([0-9]+) new message\(s\):$ strictly, appending the suffix could break it — I did not find such a parser in-tree (check-inbox.sh counts via SQL, not by scraping), but flagging it for review. An alternative that avoids touching existing lines would be printing a separate now=... line.

Environment

  • agmsg 1.1.10
  • host agent: Claude Code (also relevant to Codex/Gemini lanes)

I have a 3-line patch running locally (works as expected across a multi-agent team for a day) and can send a PR with bats tests if this direction is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions