mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat: --pass-session-id flag to include session ID in system prompt
Adds --pass-session-id CLI flag that includes the session ID in the agent's system prompt when set: hermes --pass-session-id hermes chat --pass-session-id Sets HERMES_PASS_SESSION_ID=1 env var, which _build_system_prompt() checks before appending the session ID.
This commit is contained in:
parent
f2027b8bff
commit
e80320069b
2 changed files with 17 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
# =========================================================================
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue