feat(sessions): add --source flag for third-party session isolation#3255
Merged
feat(sessions): add --source flag for third-party session isolation#3255
Conversation
When third-party tools (Paperclip orchestrator, etc.) spawn hermes chat as a subprocess, their sessions pollute user session history and search. - hermes chat --source <tag> (also HERMES_SESSION_SOURCE env var) - exclude_sources parameter on list_sessions_rich() and search_messages() - Sessions with source=tool hidden from sessions list/browse/search - Third-party adapters pass --source tool to isolate agent sessions Cherry-picked from PR #3208 by HenkDz.
StreamOfRon
pushed a commit
to StreamOfRon/hermes-agent
that referenced
this pull request
Mar 29, 2026
…ousResearch#3255) When third-party tools (Paperclip orchestrator, etc.) spawn hermes chat as a subprocess, their sessions pollute user session history and search. - hermes chat --source <tag> (also HERMES_SESSION_SOURCE env var) - exclude_sources parameter on list_sessions_rich() and search_messages() - Sessions with source=tool hidden from sessions list/browse/search - Third-party adapters pass --source tool to isolate agent sessions Cherry-picked from PR NousResearch#3208 by HenkDz. Co-authored-by: Henkey <noonou7@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvage of PR #3208 by @HenkDz (authorship preserved).
When third-party orchestrators like Paperclip spawn
hermes chatas a subprocess, their agent sessions pollute the user's CLI session history,hermes sessions list,hermes sessions browse, andsession_searchresults.Changes
hermes chat --source <tag>: New CLI flag (alsoHERMES_SESSION_SOURCEenv var)hermes_state.py:exclude_sourcesparameter onlist_sessions_rich()andsearch_messages()session_search_tool.py:_HIDDEN_SESSION_SOURCESconstant; recent sessions and FTS5 search excludesource=toolby defaulthermes_cli/main.py:sessions listandsessions browseexclude tool sessions by defaultcli.py+run_agent.py: ReadHERMES_SESSION_SOURCEenv var, falling back tocliFollow-up fixes
--source tool+exclude_sources=["tool"]produced contradictory SQL returning zero results. Fixed by skipping exclusion when--sourceis explicitly provided.getattrguard forargs.source— not all session subcommands (delete,prune) define this attribute.exclude_sourceson both DB methods and the_HIDDEN_SESSION_SOURCESconstant.Usage
6232 tests pass.