hermes - 💡(How to fix) Fix feat: inject temporal context markers for intra-session time awareness

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Hermes 在长会话中缺乏对「消息跨越时间边界」的感知能力,导致 agent 混淆事件发生的先后顺序。

具体案例:

一个从周一持续到周二的会话中,发生了以下事件:

  • 周一:硬件优化(cudf、ollama、HotCache 等)、四只 A 股深度分析
  • 周二上午:Hermes 自身从 v0.13.0 升级到 v0.14.0、创建新 skill

当用户提到「昨天的硬件优化」时,agent 正确地将其归因为周一。但当用户纠正说「四票分析也是昨天」时,agent 开始猜测而非确切知道时间边界。用户追问「Hermes 升级是刚刚的事,你没有日志吗,记忆靠猜测吗?」,agent 才意识到自己把「刚刚升级」和「昨天分析」的时间线混淆了。

Root Cause

会话上下文是一个扁平的消息角色列表(user/assistant/tool),没有任何显式的「时间边界」标记。agent 只能靠消息顺序推断先后,但无法感知:

  • 哪些消息是「昨天」发的
  • 哪些消息是「今天早上」发的
  • 哪些消息是「五分钟前」发的
  • 两次消息之间究竟隔了几分钟还是隔了一夜

当前系统已经知道当前时间(system prompt 中包含 Current time: 2026-05-19T09:30:00+08:00),但这个信息没有和消息流的时间结构关联起来。

Code Example

[Context note: It is now Tuesday, 2026-05-19 09:30 CST.
 The previous messages were sent on Monday 2026-05-18.
 Approximately 14 hours have passed since the last exchange.]
RAW_BUFFERClick to expand / collapse

Summary

Hermes 在长会话中缺乏对「消息跨越时间边界」的感知能力,导致 agent 混淆事件发生的先后顺序。

具体案例:

一个从周一持续到周二的会话中,发生了以下事件:

  • 周一:硬件优化(cudf、ollama、HotCache 等)、四只 A 股深度分析
  • 周二上午:Hermes 自身从 v0.13.0 升级到 v0.14.0、创建新 skill

当用户提到「昨天的硬件优化」时,agent 正确地将其归因为周一。但当用户纠正说「四票分析也是昨天」时,agent 开始猜测而非确切知道时间边界。用户追问「Hermes 升级是刚刚的事,你没有日志吗,记忆靠猜测吗?」,agent 才意识到自己把「刚刚升级」和「昨天分析」的时间线混淆了。

Root Cause

会话上下文是一个扁平的消息角色列表(user/assistant/tool),没有任何显式的「时间边界」标记。agent 只能靠消息顺序推断先后,但无法感知:

  • 哪些消息是「昨天」发的
  • 哪些消息是「今天早上」发的
  • 哪些消息是「五分钟前」发的
  • 两次消息之间究竟隔了几分钟还是隔了一夜

当前系统已经知道当前时间(system prompt 中包含 Current time: 2026-05-19T09:30:00+08:00),但这个信息没有和消息流的时间结构关联起来。

Proposed Solution

在消息流穿越自然时间边界时(跨天、跨数小时无活动),自动注入结构化的时间标记到上下文:

[Context note: It is now Tuesday, 2026-05-19 09:30 CST.
 The previous messages were sent on Monday 2026-05-18.
 Approximately 14 hours have passed since the last exchange.]

触发条件:

  • 两次相邻消息的 wall-clock 间隔超过阈值(如 >2 小时)
  • 日期变更(跨天)
  • Session 从挂起到恢复

这个标记应该:

  • 出现在 system/tool role 或特殊 role 中,不破坏 user/assistant 交替规则
  • 在 prompt cache 中是字节静态的(只在时间边界变化时才变化,不影响缓存效率)

Impact

  • 消除 timeline 混淆:agent 不需要猜测事件的相对时间
  • 提升长会话质量:多天工作流中 agent 可以正确引用「昨天我们做的 X」
  • 降低用户纠正成本:用户不必反复提醒 agent 什么事是什么时候发生的

Alternatives Considered

  1. 不做事:依赖 agent 自己推断。但今天的案例证明 LLM 在没有显式锚点的情况下不可靠。
  2. 在每条 user 消息前加时间戳:方案可行但会破坏 prompt cache(时间戳每刻都在变)。
  3. 用 tool 查询 session 元数据:过度工程化,agent 不会主动调用。

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING