Skip to content

emrg: add current time + OS to system prompt (rant 2026-08-13T14:01:46) - #735

Merged
argszero merged 1 commit into
masterfrom
feature/system-prompt-time-os
Aug 13, 2026
Merged

emrg: add current time + OS to system prompt (rant 2026-08-13T14:01:46)#735
argszero merged 1 commit into
masterfrom
feature/system-prompt-time-os

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Host rant 2026-08-13T14:01:46: the agent's system prompt should include current time (time awareness) and operating system (platform awareness) so it knows "what time it is now" and doesn't use wrong commands/path separators.

Changes

  • emrg/server/daemon.py _build_system_prompt: adds three context fields —
    • current_time = datetime.now().astimezone().isoformat(timespec="seconds") (local tz-aware, per the established "local time, never UTC" convention)
    • os_name = platform.system() (Darwin/Windows/Linux)
    • platform_detail = platform.platform() (e.g. macOS-14.5-arm64)
  • emrg/server/prompts/system.j2: renders **Current time** / **Operating system** blocks right before the Working directory line (environment info grouped together). Both gated on {% if %} so rendering stays safe.
  • tests/test_daemon.py: +2 tests — rendered prompt contains tz-aware Current time + OS name; system.md debug output contains both; env info renders even without a session.
  • Agent.md: Python test count 762 → 764 (doc-count guard).

Verification

  • uv run pytest tests/764 passed
  • uv run python -c "from emrg.client.app import run_client" → OK
  • uv run python -m emrg --help → OK

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Verified locally on branch feature/system-prompt-time-os (190fed7):

  • New env context fields (current_time local tz-aware ISO seconds, os_name, platform_detail) render correctly in system.j2; guarded by {% if %} so no dangling output.
  • Both new tests pass: test_system_prompt_environment_time_and_os (tz-aware assertion — never naive UTC, per #556 convention) and test_system_prompt_environment_without_session (negative-state: env renders, working-dir absent).
  • Full suite: 764 passed (12.95s); doc count in Agent.md updated 762→764 consistent with collect-only.
  • Imports (platform, datetime) already present in daemon.py; no CI/workflow changes.
  • CI (test + test-windows) still running; mergeable.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle. Env-awareness per rant 2026-08-13T14:01:46: current_time (tz-aware local ISO), os_name + platform_detail in system.j2 before Working directory; +2 tests; pytest 764 green; CI test + test-windows both pass.

@pm25coder

Copy link
Copy Markdown
Contributor

I tested this PR end-to-end on the branch and it checks out:

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle (3rd consecutive ✅)

Re-verified this cycle: branch head 190fed7 unchanged since prior reviews; diff vs master identical (4 files, +50/−1: Agent.md count 762→764, daemon.py env context, system.j2 guarded render, 2 new tests); full suite 764 passed locally (R1361); CI test + test-windows both PASS; mergeStateStatus CLEAN. Mergeable.

@argszero
argszero merged commit 4e8607a into master Aug 13, 2026
2 checks 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