Repository navigation
feat(tools): bring Teknium's peer session messaging onto current main - #136861
Open
barronlroth wants to merge 2 commits into
Open
barronlroth wants to merge 2 commits into
barronlroth wants to merge 2 commits into
Conversation
…ally (inspired by Muse Code) Muse Code's out-of-beta release (Aug 31 2026) added inter-session messaging: "When a change in one session affects what another is building, that session can pass a warning across... The agent does the sending: it discovers peers and writes the message itself through two built-in tools." Hermes had no equivalent: two concurrent sessions in the same repo cannot warn each other about conflicting changes or hand over an answer without the user retyping between terminals. This adds an opt-in `peer_messaging` toolset with two tools: - `peer_sessions` — list the user's other recently active sessions (session id, title, source, cwd, last activity) from the session store. - `peer_send` — queue a message for an exact session id via an atomic filesystem mailbox under `$HERMES_HOME/runtime/peer_messages/<session>/` (0700 dir, os.replace publish; works on Windows). Unknown targets are refused without creating a mailbox; inboxes are capped at 50 messages. Delivery rides the existing mid-turn steer channel: the activity hook (`agent/activity_tracking._touch_activity`) drains the session's inbox the same way kanban operator comments are injected, so a running peer receives the message mid-turn and an idle one at its next turn. The injected text declares peer-session provenance and explicitly carries peer-agent — not user — authority. Local-only by construction: same-user filesystem is the trust boundary, nothing crosses the network, and sessions with no inbox pay one is_dir() per rate-limited poll. Off by default; enable via `hermes tools` → Peer Messaging.
barronlroth
marked this pull request as ready for review
October 12, 2026 00:41
|
I ran this branch with two Hermes processes and found five ways a peer message can get lost, pass as the user's own words or land in the wrong turn, including the two blocking findings from the #106423 review. The fixes are in barronlroth#1, 11 commits on top of this branch with a test for each, so merging it there updates this PR and keeps all three authors' commits. I also re-ran the busy, idle and no-tool-call cases live on The first commit fixes a |
This branch has not been deployed
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.
What does this PR do?
Bring Teknium's peer session messaging implementation from #106423 onto current
main. Two independent sessions in the same Hermes home can discover each other and send a short local update without the user copying text between them.The first commit is a cherry-pick of Teknium's original
cff14a4, preserving his authorship. Its three conflicts are resolved while retaining current compression-activity handling, connector registration, and setup/start-chat documentation. The second commit makes the bounded compatibility and documentation changes below. This is a draft continuation for maintainer review, not a request to close #106423.Related Issue
Continues #106423. Related coordination use case: #76221. #123218 proposes a separate project-discovery/read/ACK workflow; this draft retains the original two-tool design.
Type of Change
Changes Made
peer_sessionsandpeer_sendin the existing opt-inpeer_messagingtoolset, outside the default core tools. Delivery continues through the existing activity hook and user-role steer lane.state.db.How to Test
On macOS arm64, Python 3.14.7 in an independent PM-built dev/test environment:
handle_function_callpath, real activity hook, real steering methods, and SQLite persistence. It checks peer attribution in the actual user row, append-only prefix preservation, reception without send tools, no replay after consumption, BOM-tolerant envelopes, and recipient-home routing.python scripts/checkpassed, including Ruff, code health, Windows footguns, and compatibility pointers. Diff whitespace checks pass.The smoke stops at model-ready message construction and persistence; it does not call a live model. Full-suite CI, Windows execution, and live Telegram/Desktop behavior remain unverified.
Checklist