hermes - ✅(Solved) Fix Document tool-time policy: advisory context, not hidden quiet-hours enforcement [3 pull requests, 1 comments, 1 participants]

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…
GitHub stats
NousResearch/hermes-agent#17475Fetched 2026-04-30 06:47:18
View on GitHub
Comments
1
Participants
1
Timeline
11
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×5labeled ×4closed ×1commented ×1

Document the Hermes tool-time principle established in #17459:

Runtime time, timezone, and contact-window facts should be surfaced to the agent/tool result as context. Hermes core should not silently enforce quiet-hours policy in the control plane by default.

The repo currently does not appear to contain TOOL-PRINCIPLES.md, but this architectural decision needs a durable home so future PRs do not reintroduce hidden quiet-hours enforcement.

Error Message

  1. Advisory by default: tools may warn when an action appears outside the user's normal contact window, but Hermes core should not silently block, queue, or rewrite the action unless an explicit tool/user policy asks for that.

Root Cause

Document the Hermes tool-time principle established in #17459:

Runtime time, timezone, and contact-window facts should be surfaced to the agent/tool result as context. Hermes core should not silently enforce quiet-hours policy in the control plane by default.

The repo currently does not appear to contain TOOL-PRINCIPLES.md, but this architectural decision needs a durable home so future PRs do not reintroduce hidden quiet-hours enforcement.

Fix Action

Fixed

PR fix notes

PR #15872: fix: prevent stale timestamp perception by injecting current time per-turn

Description (problem / solution / changelog)

Problem

The system prompt includes a timestamp frozen at session creation time (for prompt cache stability). However, the label "Conversation started: <time>" is ambiguous — agents interpret it as the current time, leading to incorrect time-sensitive behavior.

Observed: In a session started at 5:07 AM, the agent said "good night 🌙" at 9:00 AM because the only timestamp it saw was "Conversation started: Sunday, April 26, 2026 05:07 AM".

Solution

Split the timestamp into two layers, both using user-message injection to preserve prompt cache:

LayerContentLocationFrequency
System promptSession started: <time> (timezone)FrozenOnce per session (cache-stable)
User messageCurrent time: <time>\nTimezone: <tz>DynamicEvery turn (cache-safe)

Why user-message injection (not system prompt)?

PR #10448 addresses the same bug but injects Current time: into the system prompt via _build_turn_scoped_system_prompt(). This changes the system prompt content every turn, which breaks prompt cache prefix.

This PR injects into the user message — the same mechanism that plugins use (pre_llm_call context). The Hermes codebase itself documents this principle:

"Context is ALWAYS injected into the user message, never the system prompt. This preserves the prompt cache prefix — the system prompt stays identical across turns so cached tokens are reused."

User-message injection also composes naturally with the existing plugin system — time context merges with plugin context in _plugin_user_context.

Changes

  1. run_agent.py_build_system_prompt(): Rename "Conversation started""Session started" and add timezone name
  2. run_agent.pyrun_conversation(): Inject current time + timezone into _plugin_user_context on every turn
  3. run_agent.py_handle_max_iterations(): Inject current time into the summary request user message (recovery path)
  4. hermes_time.py: Add get_timezone_name() public API
  5. Comment update: Layer 6 comment now documents the split explicitly
  6. Tests: 4 new/updated tests covering cache safety, user-message injection, and max-iterations path

Test results

tests/run_agent/test_run_agent.py::TestBuildSystemPrompt::test_includes_datetime PASSED
tests/run_agent/test_run_agent.py::TestBuildSystemPrompt::test_excludes_current_time_from_cached_prompt PASSED
tests/run_agent/test_run_agent.py::TestHandleMaxIterations::test_summary_injects_current_time_into_user_message PASSED
tests/run_agent/test_run_agent.py::TestRunConversation::test_turn_level_time_injected_into_user_message PASSED

Relation to #10448

Same bug, different injection location. See my comment on #10448 for the full comparison. Key difference: this PR preserves prompt cache by using user-message injection; #10448 breaks cache by modifying the system prompt per turn.

Token impact

~50 tokens per turn (two lines: current time + timezone). This is minimal compared to typical tool schemas and memory blocks, and the information is essential for correct agent behavior.

Changed files

  • hermes_time.py (modified, +40/-0)
  • run_agent.py (modified, +48/-4)
  • tests/run_agent/test_run_agent.py (modified, +73/-2)
  • tests/run_agent/test_run_agent_codex_responses.py (modified, +31/-0)

PR #17531: docs: document tool-time advisory-not-enforcement principle

Description (problem / solution / changelog)

Closes #17475.

Summary

Adds TOOL-PRINCIPLES.md at repo root capturing the architectural invariant established in #17459: runtime time/timezone/contact-window facts are surfaced to the agent as advisory context, not silently enforced in the control plane.

Why this doc needs to exist

Two closed-unmerged PRs tried to add quiet-hours enforcement and were rejected for the same reason:

  • #4711 feat: Add profile-scoped gateway autonomy runtime — held contacts in control plane
  • #7402 feat: drain Ockham outbox notifications via Hermes scheduler — held approvals during quiet hours

Without a durable written principle, it's easy for a future contributor to re-invent the same shape and get rejected again. The doc also names the preferred shape (#10421 / #15872: inject Current time + timezone into the ephemeral user-message context) so reviewers and contributors have a positive template to point at.

Shape

Each principle follows a consistent template so future invariants can be appended without re-designing the structure:

  1. Title — one-line statement of the invariant
  2. Decision — date + originating issue/PR references
  3. Why — failure mode the inverse produces
  4. What this means in practice — rejected vs encouraged PR shapes
  5. Related history — closed PRs demonstrating the wrong shape + open PRs doing it right

This first entry documents tool-time. Future candidates (credential-scope boundaries, cross-platform identity, etc.) can slot in identically.

Not in scope

  • No behavior change.
  • Does not close #10421, #15872, #17474 (those implement the principle; this just writes it down).
  • Does not take a position on whether opt-in quiet-hours enforcement should exist as a gateway plugin — the doc explicitly leaves that door open if visibility/overridability constraints are met.

File

  • TOOL-PRINCIPLES.md (new, 88 lines)

Changed files

  • TOOL-PRINCIPLES.md (added, +88/-0)
RAW_BUFFERClick to expand / collapse

Summary

Document the Hermes tool-time principle established in #17459:

Runtime time, timezone, and contact-window facts should be surfaced to the agent/tool result as context. Hermes core should not silently enforce quiet-hours policy in the control plane by default.

The repo currently does not appear to contain TOOL-PRINCIPLES.md, but this architectural decision needs a durable home so future PRs do not reintroduce hidden quiet-hours enforcement.

Why

Several related PRs/issues try to solve time awareness in different layers. Without a written principle, it is easy to regress toward gateway/control-plane suppression or duplicated timestamp-prefix mechanisms.

Proposed docs

Add or update docs that state:

  1. Stable cached prompt: volatile current time does not belong in the cached system prompt.
  2. Agent-visible runtime context: current time/timezone/contact-window facts should be injected through the chosen ephemeral runtime context path and/or returned by relevant tools.
  3. Advisory by default: tools may warn when an action appears outside the user's normal contact window, but Hermes core should not silently block, queue, or rewrite the action unless an explicit tool/user policy asks for that.
  4. One core path: avoid multiple gateway-specific timestamp-prefix mechanisms when a core ephemeral context path exists.
  5. Tool extension point: document how new time-sensitive tools should use the shared time-advisory helper.

Acceptance criteria

  • Add a durable docs page/file for tool-use/time-policy principles.
  • Link #17459 as the umbrella issue.
  • Document non-goals: no broad policy engine, no hidden quiet-hours enforcement, no volatile time in cached system prompt.
  • Cross-link from relevant tool/gateway docs.
  • Include a short checklist for reviewers evaluating time-sensitive tools.

Related

Parent: #17459 Related: #10421, #15872, #17335

extent analysis

TL;DR

Create a TOOL-PRINCIPLES.md document to establish the Hermes tool-time principle, outlining how runtime time, timezone, and contact-window facts should be handled.

Guidance

  • Add a new document TOOL-PRINCIPLES.md to the repository, detailing the principles for tool-time awareness, including the four proposed points.
  • Ensure the document links to the umbrella issue #17459 and cross-links to relevant tool and gateway documentation.
  • Include a checklist for reviewers to evaluate time-sensitive tools against these principles.
  • Verify that the document clearly states the non-goals, such as no broad policy engine and no hidden quiet-hours enforcement.

Example

No code snippet is necessary for this issue, as it focuses on documentation and architectural principles.

Notes

This solution assumes that the TOOL-PRINCIPLES.md document will be a Markdown file, but the specific format may vary depending on the project's documentation conventions.

Recommendation

Apply workaround: Create the TOOL-PRINCIPLES.md document to establish a clear and durable home for the Hermes tool-time principle, preventing future regressions.

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

hermes - ✅(Solved) Fix Document tool-time policy: advisory context, not hidden quiet-hours enforcement [3 pull requests, 1 comments, 1 participants]