Skip to content

Comments

feat(telegram): add message metadata prefix to prompts#26

Merged
mikeyobrien merged 1 commit intomikeyobrien:mainfrom
screenfluent:feat/telegram-message-metadata
Feb 18, 2026
Merged

feat(telegram): add message metadata prefix to prompts#26
mikeyobrien merged 1 commit intomikeyobrien:mainfrom
screenfluent:feat/telegram-message-metadata

Conversation

@screenfluent
Copy link
Contributor

Prepend [msg:chatId:messageId] [YYYY-MM-DD HH:MM] to messages sent to the LLM, giving the model awareness of message timing and identifiers.

Changes:

  • router.ts: add date field (Unix epoch) to TelegramInboundEnvelope
  • worker-runtime.ts: formatMessagePrefix helper + prefixPrompt wrapper that skips slash commands (preserves ^/ anchored parsing in rpc.ts)
  • Prefix applied at 5 RPC call sites (image, audio, text foreground + 2 background fork points)
  • Timezone configurable via TELEGRAM_TIMESTAMP_TZ env var (default UTC)
  • Backwards compatible: missing date field on queued items produces prefix without timestamp bracket

Prepend [msg:chatId:messageId] [YYYY-MM-DD HH:MM] to messages sent to the
LLM, giving the model awareness of message timing and identifiers.

Changes:
- router.ts: add date field (Unix epoch) to TelegramInboundEnvelope
- worker-runtime.ts: formatMessagePrefix helper + prefixPrompt wrapper
  that skips slash commands (preserves ^/ anchored parsing in rpc.ts)
- Prefix applied at 5 RPC call sites (image, audio, text foreground + 2
  background fork points)
- Timezone configurable via TELEGRAM_TIMESTAMP_TZ env var (default UTC)
- Backwards compatible: missing date field on queued items produces
  prefix without timestamp bracket
@mikeyobrien mikeyobrien merged commit 8703c3f into mikeyobrien:main Feb 18, 2026
1 check passed
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.

2 participants