diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 49f271f79..f8d5e3fde 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -203,6 +203,10 @@ def cmd_chat(args): except Exception: pass + # --pass-session-id: include session ID in the agent's system prompt + if getattr(args, "pass_session_id", False): + os.environ["HERMES_PASS_SESSION_ID"] = "1" + # Import and run the CLI from cli import main as cli_main @@ -1303,6 +1307,12 @@ For more help on a command: default=False, help="Run in an isolated git worktree (for parallel agents)" ) + parser.add_argument( + "--pass-session-id", + action="store_true", + default=False, + help="Include the session ID in the agent's system prompt" + ) subparsers = parser.add_subparsers(dest="command", help="Command to run") @@ -1357,6 +1367,12 @@ For more help on a command: default=False, help="Run in an isolated git worktree (for parallel agents on the same repo)" ) + chat_parser.add_argument( + "--pass-session-id", + action="store_true", + default=False, + help="Include the session ID in the agent's system prompt" + ) chat_parser.set_defaults(func=cmd_chat) # ========================================================================= diff --git a/run_agent.py b/run_agent.py index ec3efe4a0..2f73f335a 100644 --- a/run_agent.py +++ b/run_agent.py @@ -1410,7 +1410,7 @@ class AIAgent: from hermes_time import now as _hermes_now now = _hermes_now() timestamp_line = f"Conversation started: {now.strftime('%A, %B %d, %Y %I:%M %p')}" - if self.session_id: + if self.session_id and os.getenv("HERMES_PASS_SESSION_ID"): timestamp_line += f"\nSession ID: {self.session_id}" prompt_parts.append(timestamp_line)