Skip to content

Fix #747: Add explicit terminal/shell access awareness to system prompt#834

Open
fuleinist wants to merge 1 commit intoNousResearch:mainfrom
fuleinist:fix/issue-747-shell-access-awareness
Open

Fix #747: Add explicit terminal/shell access awareness to system prompt#834
fuleinist wants to merge 1 commit intoNousResearch:mainfrom
fuleinist:fix/issue-747-shell-access-awareness

Conversation

@fuleinist
Copy link

Summary

Fixes #747 - Agent consistently forgets it has shell access

Problem

Users reported that Hermes Agent would 'forget' it has shell access and output code blocks for the user to copy-paste instead of using the terminal tool directly.

From the issue:

i have to keep reminding hermesagent he/it/she has shell access. this seems like a bug for an autonomous agent that grows?

Solution

Add explicit TERMINAL_GUIDANCE that gets injected into the system prompt when the terminal tool is available. This follows the same pattern as existing guidance constants (MEMORY_GUIDANCE, SKILLS_GUIDANCE, SESSION_SEARCH_GUIDANCE).

The guidance explicitly tells the agent:

  • It has terminal/shell access
  • To use the terminal tool directly (not output code blocks)
  • It can run commands, manage background processes, and work with the filesystem programmatically

Changes

agent/prompt_builder.py | 7 +++++++
run_agent.py            | 4 ++++
  • Add TERMINAL_GUIDANCE constant in agent/prompt_builder.py
  • Import and inject TERMINAL_GUIDANCE in _build_system_prompt() when terminal tool is available

Testing

  • Verified imports work correctly
  • The guidance is injected alongside other tool-awareness guidance (memory, skills, session_search)

How it works

When the agent initializes, it checks which tools are available. If the terminal tool is in valid_tool_names, the TERMINAL_GUIDANCE string is appended to the system prompt. This ensures the agent is explicitly aware of its shell access capabilities at the start of every session.

… system prompt

When the terminal tool is available, inject clear guidance that the agent
has shell access and should use the terminal tool directly instead of
outputting code blocks for the user to copy-paste.

This addresses the issue where hermes-agent would 'forget' it has shell
access and output code on-screen instead of executing it.

Changes:
- Add TERMINAL_GUIDANCE constant in agent/prompt_builder.py
- Inject TERMINAL_GUIDANCE in _build_system_prompt() when terminal tool is available
- Follows the same pattern as MEMORY_GUIDANCE, SKILLS_GUIDANCE, etc.
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.

[Bug]: hermesagent consistently forgets he/she/it has shell access

1 participant