Skip to content

[Bug]: terminal.cwd not correctly injected into system prompt #24882

@perqin

Description

@perqin

Bug Description

terminal.cwd not correctly injected into system prompt, which sometimes leads to unexpected behavior. For example, when I ask it to "clone the repo to the current working directory", it clones the repo into the directory injected into the system prompt, instead of terminal tool's cwd.

Steps to Reproduce

  1. Set terminal.cwd in config.yaml to some path e.g. /Users/perqin-moego/Workspaces/hermes-workspace;
  2. Restart hermes gateway: hermes gateway restart;
  3. Talk to the agent via discord and inspect the session json.

Expected Behavior

The current working directory in system prompt should be the same as that configured in config.yaml.

Actual Behavior

The current working directory in system prompt is set to the WorkingDirectory directive of macOS launchd profile. The trailing lines of system_prompt in the session json file:

Conversation started: Wednesday, May 13, 2026 10:01 AM
Model: gpt-5.4
Provider: custom

Host: macOS (26.4.1)
User home directory: /Users/perqin-moego
Current working directory: /Users/perqin-moego/.hermes/hermes-agent

You are in a Discord server or group chat communicating with your user. You can send media files natively: include MEDIA:/absolute/path/to/file in your response. Images (.png, .jpg, .webp) are sent as photo attachments, audio as file attachments. You can also include image URLs in markdown format ![alt](url) and they will be sent as attachments.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Discord

Debug Report

Report       https://paste.rs/RgjYm
agent.log    https://paste.rs/5cogQ
gateway.log  https://paste.rs/jIp89

Operating System

macOS 26.4.1

Python Version

3.11.15

Hermes Version

0.13.0

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/gatewayGateway runner, session dispatch, deliveryplatform/discordDiscord bot adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions