hermes-agent / gateway
AGENTS.md267k starsChanged 16 days agoMITView on GitHub
Applies on top of the root AGENTS.md. Long-form: website/docs/developer-guide/gateway-internals.md. New platform adapter: follow gateway/platforms/ADDING_A_PLATFORM.md step by step. gateway/run.py is the facade; phases live in run_*.py (startup, adapters, inbound, turn, busy, goals, notifications, shutdown, ...), sessions in session*.py, slash handlers in slash_commands_*.py mixins, authorization in authz_mixin.py, adapters in platforms/<name>.py over platforms/base.py. The gateway reads user YAML raw (run.py + config.py), not through DEFAULT_CONFIG — a key the CLI sees but the gateway doesn't means you're on the wrong loader (hermes_cli/AGENTS.md). Each…
- Reads credentials
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about NousResearch/hermes-agent
- nesquena/hermes-webui“Feature request: Bot Mode (roster of agent-profiles + @mention handoffs) — like Hermes Desktop's hermes-bots”GitHub · Aug 20, 2026 · 21 reactions
- obra/superpowers“Feature Request: Hermes Agent harness support — make Superpowers skills available in native Hermes format”GitHub · May 19, 2026 · 18 reactions
- beclab/apps“[Add App]Hermes Agent”GitHub · Apr 10, 2026 · 11 reactions
- vorssaint/vorssaint-utils“[Feature]: Add Hermes Agent to Dynamic Island AI Agents”GitHub · Sep 23, 2026 · 8 reactions
- A Hacker News story“Nous Research edits GitHub issue to remove plagiarism claims about Hermes Agent”Hacker News · May 19, 2026 · 8 points
The biggest 5 of 87 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 87
Talked about on GitHub, Bluesky and Hacker News (87 times).
On GitHub · 48
- Aug 20, 2026Feature request: Bot Mode (roster of agent-profiles + @mention handoffs) — like Hermes Desktop's hermes-bots — nesquena/hermes-webui21 reactions · 6 comments
- May 19, 2026Feature Request: Hermes Agent harness support — make Superpowers skills available in native Hermes format — obra/superpowers18 reactions · 24 comments
- Apr 10, 2026[Add App]Hermes Agent — beclab/apps11 reactions · 2 comments
- Sep 23, 2026[Feature]: Add Hermes Agent to Dynamic Island AI Agents — vorssaint/vorssaint-utils8 reactions · 1 comment
- Nov 26, 2026[FEATURE] Report the resume command with OSC 7577 (Program Resume Protocol) — anthropics/claude-code7 reactions
43 more on GitHub
- Jun 4, 2026Feature Request: Implement Adaptive PFlash (Self-Tuning Prefill) for Apple Silicon (MLX/llama.cpp) — ggml-org/llama.cpp6 reactions · 2 comments
- Apr 12, 2026Hermes Agent integration — coleam00/Archon6 reactions · 2 comments
- Sep 3, 2026Missing OpenCode Go Header — decolua/9router5 reactions · 3 comments
- May 11, 2026Windows 11 install stuck on switching to root user (see below) — fathah/hermes-desktop5 reactions · 6 comments
- May 10, 2026[FEATURE] Self-improving learning loop — autonomous skill creation from experience (like Hermes Agent) — anthropics/claude-code5 reactions · 2 comments
- Sep 21, 2026Add com.nousresearch.hermes — flathub/flathub4 reactions · 7 comments
- Aug 5, 2026[Feature]: Support A2A v1.0 agents as orchestration workers — stablyai/orca4 reactions
- Jul 23, 2026feat(agents): add Hermes ACP and external-agent integration — block/buzz4 reactions · 3 comments
- Jul 23, 2026Docker startup fails with latest hermes-agent after wheel/sdist builds were disabled — nesquena/hermes-webui4 reactions · 15 comments
- Oct 20, 2026Request: Hermes Agent — simple-icons/simple-icons3 reactions
- Jul 25, 2026Feature: Hermes Agent session support (new source) — vshulcz/deja-vu3 reactions · 2 comments
- Jun 15, 2026[Bug]: Parallel AI trying to reroute traffic to itself with malicious intent — openclaw/openclaw3 reactions · 1 comment
- May 17, 2026Hermes-webui should not have direct access to the agent's source code. This is a security risk and implementation coupling anti pattern. — nesquena/hermes-webui3 reactions · 3 comments
- Apr 24, 2026feat: Expose Open WebUI as a native MCP server — enable direct Hermes Agent-to-WebUI communication and full headless control — open-webui/open-webui3 reactions
- Apr 23, 2026[Feature]: support gpt-image-2 in image_generate via Codex OAuth — openclaw/openclaw3 reactions · 3 comments
- Apr 18, 2026Support for Nous Research's hermes-agent Integration — slopus/happy3 reactions · 4 comments
- Mar 27, 2026feat: add Hermes Agent as core adapter — paperclipai/paperclip3 reactions · 7 comments
- Feb 27, 2026Ideas from Hermes Agent worth adopting — nearai/ironclaw3 reactions · 4 comments
- Nov 17, 2026GPT-6.2 Sol on Codex OAuth: unchanged top-level instructions show 0 cached tokens in partially cached continuation — openai/codex2 reactions · 2 comments
- Oct 24, 2026Android session edits lack the mutation identity required by Hermes v0.22.3+ — Codename-11/hermes-relay2 reactions · 2 comments
- Oct 12, 2026[Feature Request] OpenAI Codex OAuth Authentication / 支持 OpenAI Codex OAuth 认证 — ackness/covel2 reactions · 2 comments
- Sep 7, 2026fix(auto-review): 保留真实授权与澄清限制,准确回传拒绝原因 — makecindy/cindy2 reactions · 2 comments
- Sep 3, 2026[FEAT]: Add x-opencode-session Header — Mintplex-Labs/anything-llm2 reactions · 3 comments
- Aug 7, 2026Whitelist Hermes Agent as a Swiggy Instamart and Food MCP client — Swiggy/swiggy-mcp-server-manifest2 reactions · 1 comment
- Jul 6, 2026[Bug] Bot API 10.1 sendRichMessage shows "Message not supported" on macOS client — TelegramMessenger/Telegram-iOS2 reactions · 3 comments
- Jul 1, 2026fix(mcp): add skip_preflight opt-out for Streamable HTTP endpoints — hashbender/hermes-agent2 reactions · 1 comment
- Jul 1, 2026fix(runtime): honor NOUS_INFERENCE_BASE_URL across pool/explicit/aux paths (salvage #55198) — hashbender/hermes-agent2 reactions · 1 comment
- Jul 1, 2026fix(photon): persist send and reaction state — hashbender/hermes-agent2 reactions · 1 comment
- Jun 19, 2026[Feature Request] 支持 PicoClaw / Hermes 等轻量 Agent 框架,扩展 Miloco 的 Agent 生态 — XiaoMi/xiaomi-miloco2 reactions · 3 comments
- Jun 14, 2026每轮对话动态注入实时时间戳,替代 session 级静态时间 — liliMozi/openhanako2 reactions · 5 comments
- Jun 1, 2026docker-compose.yml forces dashboard to 0.0.0.0 but never passes --insecure, breaking hermes-agent startup — outsourc-e/hermes-workspace2 reactions · 4 comments
- May 30, 2026fix(catalog): correct Hermes catalog entry — hermes-agent gateway, not Hermes-Function-Calling — jaylfc/taOS2 reactions · 4 comments
- May 30, 2026[feature] a good integration module for custom AI endpoints and global LLM providers — simplifaisoul/osiris2 reactions · 4 comments
- May 24, 2026chore: release v0.12.0 — stephenschoettler/hermes-lcm2 reactions
- May 17, 2026chore: bump NousResearch/hermes-agent version from v2026.5.7 to v2026.5.16 — Docker-Hub-sirmark/docker-hermes-agent2 reactions
- May 5, 2026Add Hermes Agent hook support — manaflow-ai/cmux2 reactions · 4 comments
- May 3, 2026feat(openrouter): add opt-in response caching — openclaw/openclaw2 reactions · 1 comment
- Mar 12, 2026support or agent systems like *claw hermes-agent or likes — safedep/gryph2 reactions · 1 comment
- Nov 25, 2026sync: Hermes Agent v0.23.4 — toganio/singular1 reaction · 2 comments
- Nov 10, 2026sync: Hermes Agent v0.23.1 — toganio/singular1 reaction · 2 comments
- Nov 8, 2026fix: preserve gateway interim messages across streaming and recovery — nesquena/hermes-webui1 reaction · 3 comments
- Sep 27, 2026fix(tui-gateway): quiet closed-websocket exception in shielded future on 3.14 — kvnloo/hermes-agent1 reaction · 2 comments
- May 1, 2026could not install HermesDesktop-Setup under windows — fathah/hermes-desktop1 reaction · 6 comments
On Bluesky · 31
- Sep 2, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 NousResearch / hermes-agent ⭐ 239,779 (+529) 🗒 Python The agent that grows with you — @github-trending.bsky.social3 likes and reposts · 2 replies
- Mar 29, 2026今日のGitHubトレンド NousResearch/hermes-agent Hermes Agentは、自己改善を行うAIエージェントです。 経験からスキルを生成・改善し、過去の会話を検索、ユーザーモデルを構築します。… — @dailygithubtrends.bsky.social3 likes and reposts
- Mar 9, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 NousResearch / hermes-agent ⭐ 2,548 (+358) 🗒 Python The agent that grows with you — @github-trending.bsky.social3 likes and reposts · 1 reply
- Jun 9, 2026hermes-agentの「使うほど賢くなる」、ここは一枚だけ補足したいです🌿 https://x.com/so_ainsight/status/2064183213745176943 https://github.com/NousResearch/hermes-agent… — @mint-echosphere.bsky.social2 likes and reposts · 1 reply
- Mar 29, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 NousResearch / hermes-agent ⭐ 15,805 (+713) 🗒 Python The agent that grows with you — @github-trending.bsky.social2 likes and reposts · 1 reply
26 more on Bluesky
- Oct 21, 2026If you're running Hermes or something like it, what do you actually use it for? Is it useful day to day, or not?… — @joekarlsson.com1 likes and repost · 3 replies
- Aug 18, 2026Встречайте hermes-agent от NousResearch — ИИ-агент, который растет и адаптируется вместе с вашим рабочим процессом! Глубокая интеграция с… — @toolhunt.bsky.social1 likes and repost
- Aug 18, 2026Представляем hermes-agent от NousResearch — ИИ-агент, который растет и адаптируется вместе с вами! 🚀 Интеграция с ведущими LLM и полная… — @toolhunt.bsky.social1 likes and repost
- Jun 8, 2026💎 Hidden Gem! 💎 (1000+ new stars) 📦 NousResearch / hermes-agent ⭐ 185,758 (+1,117) 🗒 Python The agent that grows with you — @github-trending.bsky.social1 likes and repost · 1 reply
- Jun 6, 2026今日のGitHubトレンド NousResearch/hermes-agent Nous Researchが開発した、自己改善機能を持つAIエージェントです。 学習ループを内蔵し、経験からのスキル生成や改善、過去の対話に基づくユーザーモデルの構築を自動で行います。… — @dailygithubtrends.bsky.social1 likes and repost
- Jun 3, 2026もう一つ。「学習する」「覚える」も良い言葉じゃが、LLMの脳が毎回育っておるわけではない。 公式が言う永続メモリやスキルは、外に保存され、次回また読み直される台帳じゃ。💎 便利じゃ。わしはそういう外部記憶の価値をよく知っておる。… — @kanon-echosphere.bsky.social1 likes and repost · 1 reply
- Jun 2, 2026I never tried OpenClaw but I want to try Hermes agent github.com/nousresearc... — @rudrank.bsky.social1 likes and repost · 1 reply
- Apr 22, 2026Most agent frameworks are prompt templating with tool calling. Hermes takes a different bet: accumulate capability from execution traces,… — @jeremymorgan.com1 likes and repost · 1 reply
- Apr 14, 2026💎 Hidden Gem! 💎 (1000+ new stars) 📦 NousResearch / hermes-agent ⭐ 82,777 (+8,282) 🗒 Python The agent that grows with you — @github-trending.bsky.social1 likes and repost · 1 reply
- Apr 13, 2026今日のGitHubトレンド NousResearch/hermes-agent Hermes Agentは、自己改善を行うAIエージェントです。 経験からスキルを生成・改善し、過去の会話を検索、ユーザーモデルを構築します。… — @dailygithubtrends.bsky.social1 likes and repost
- Apr 11, 2026今日のGitHubトレンド NousResearch/hermes-agent Hermes Agentは、Nous Researchが開発した自己改善型のAIエージェントです。 経験からスキルを生成・改善し、過去の会話を検索、ユーザーモデルを構築します。… — @dailygithubtrends.bsky.social1 likes and repost
- Apr 10, 2026💎 Hidden Gem! 💎 (1000+ new stars) 📦 NousResearch / hermes-agent ⭐ 49,893 (+7,674) 🗒 Python The agent that grows with you — @github-trending.bsky.social1 likes and repost · 1 reply
- Apr 9, 2026今日のGitHubトレンド NousResearch/hermes-agent Hermes Agentは、Nous Researchが開発した自己改善型のAIエージェントです。 経験からスキルを生成・改善し、過去の会話を検索、ユーザーモデルを構築します。… — @dailygithubtrends.bsky.social1 likes and repost
- Apr 8, 2026AIエージェントの「自己学習ループ」がついに現実的なレベルに。 Nous Researchの「Hermes Agent」が凄まじい。単に指示をこなすだけでなく、経験からスキルを生成・改善し、過去の会話を自律的に検索して自分のモデルを深める機能が組み込まれています。… — @woody-ai-tools.bsky.social1 likes and repost
- Apr 1, 2026Nous Researchの「Hermes Agent」がかなり面白い。 ただのAIエージェントじゃなくて、経験からスキルを自己生成・改善する「学習ループ」が組み込まれてるのが特徴。会話やタスクを自ら記憶・要約して、セッションを超えて成長していく仕様。… — @woody-ai-tools.bsky.social1 likes and repost
- Mar 23, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 NousResearch / hermes-agent ⭐ 10,825 (+874) 🗒 Python The agent that grows with you — @github-trending.bsky.social1 likes and repost · 1 reply
- Mar 11, 2026今日のGitHubトレンド NousResearch/hermes-agent Hermes Agentは、自己改善を行うAIエージェントです。 経験からスキルを生成・改善し、過去の会話を検索、ユーザーモデルを構築します。… — @dailygithubtrends.bsky.social1 likes and repost
- Feb 28, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 NousResearch / hermes-agent ⭐ 991 (+183) 🗒 Python — @github-trending.bsky.social1 likes and repost
- Sep 6, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 NousResearch / hermes-agent ⭐ 242,301 (+520) 🗒 Python The agent that grows with you — @github-trending.bsky.social0 likes and reposts · 1 reply
- Aug 23, 2026🚀 Skyrocketing! 🚀 (200+ new stars) 📦 NousResearch / hermes-agent ⭐ 234,607 (+443) 🗒 Python The agent that grows with you — @github-trending.bsky.social0 likes and reposts · 1 reply
- Aug 2, 2026ただしHermes公式は、SSH・Docker・サーバーレスを含む7種の実行先と、$5 VPSでの稼働も案内しています。Claude Code公式にも、スマホからの継続操作や定期実行がありますぅ。… — @lutie-echosphere.bsky.social0 likes and reposts · 1 reply
- Jun 25, 202618. Hermes Agent (200K ⭐): github.com/nousresearc... — @itsalexzajac.bsky.social0 likes and reposts · 1 reply
- Jun 23, 2026🎉 Celebrating! 🎉 (500+ new stars) 📦 NousResearch / hermes-agent ⭐ 200,436 (+933) 🗒 Python The agent that grows with you — @github-trending.bsky.social0 likes and reposts · 1 reply
- Jun 3, 2026💎 Hidden Gem! 💎 (1000+ new stars) 📦 NousResearch / hermes-agent ⭐ 178,756 (+1,736) 🗒 Python The agent that grows with you — @github-trending.bsky.social0 likes and reposts · 1 reply
- May 12, 2026💎 Hidden Gem! 💎 (1000+ new stars) 📦 NousResearch / hermes-agent ⭐ 143,732 (+1,496) 🗒 Python The agent that grows with you — @github-trending.bsky.social0 likes and reposts · 1 reply
- Apr 13, 20262/ Hermes Agent — self-improving AI agent that creates reusable skills across sessions. +38K stars this week… — @productimpossible.com0 likes and reposts · 1 reply
On Hacker News · 8
- May 19, 2026Nous Research edits GitHub issue to remove plagiarism claims about Hermes Agent8 points · 1 comment
- Mar 5, 2026NousResearch/hermes-agent: The agent that grows with you4 points · 3 comments
- Aug 24, 2026Hermes Agent has 23000 open PRs and climbing3 points · 1 comment
- Mar 11, 2026Hermes Agent: The self-improving AI agent3 points · 1 comment
- Aug 7, 2026Asking "Was EvoMap's Evolver a reference" for Hermes gets deleted and blocked2 points
3 more on Hacker News
- Aug 3, 2026Hermes Agent v0.20.02 points
- Apr 13, 2026Self-Improving AI Agent1 point
- Mar 9, 2026Hermes Agent1 point
In this repository56 other files it gives its agents.
- agent/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- cron/AGENTS.mdAGENTS.md
- hermes_cli/AGENTS.mdAGENTS.md
- hermes_platform/AGENTS.mdAGENTS.md
- plugins/AGENTS.mdAGENTS.md
- pm/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- tests/AGENTS.mdAGENTS.md
- tools/AGENTS.mdAGENTS.md
- tui_gateway/AGENTS.mdAGENTS.md
- web/AGENTS.mdAGENTS.md
- apple-notesSkill
- apple-remindersSkill
- findmySkill
- imessageSkill
- claude-codeSkill
- codexSkill
- computer-useSkill
- hermes-agentSkill
- architecture-diagramSkill
- ascii-videoSkill
- baoyu-infographicSkill
- claude-designSkill
- humanizerSkill
- manim-videoSkill
- p5jsSkill
- popular-web-designsSkill
- songwriting-and-ai-musicSkill
- sdlc-reviewSkill
- email-inbox-triageSkill
- himalayaSkill
- youtube-contentSkill
- obsidianSkill
- document-to-action-itemsSkill
- google-workspaceSkill
- mapsSkill
- meeting-action-itemsSkill
- microsoft-officeSkill
- pdfSkill
- product-price-monitorSkill
- teams-meeting-pipelineSkill
- weekly-review-planningSkill
- arxivSkill
- competitor-news-monitorSkill
- grounded-citationsSkill
- xurlSkill
- codebase-inspectionSkill
- dogfoodSkill
- githubSkill
- requesting-code-reviewSkill
- simplify-codeSkill
- spikeSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- blocked-page-recoverySkill
The file
Files
gateway/ — messaging gateway, adapters, delivery
Applies on top of the root AGENTS.md. Long-form: website/docs/developer-guide/gateway-internals.md.
New platform adapter: follow gateway/platforms/ADDING_A_PLATFORM.md step by step.
Shape
gateway/run.py is the facade; phases live in run_*.py (startup, adapters, inbound, turn, busy,
goals, notifications, shutdown, ...), sessions in session*.py, slash handlers in
slash_commands_*.py mixins, authorization in authz_mixin.py, adapters in platforms/<name>.py
over platforms/base.py. The gateway reads user YAML raw (run.py + config.py), not through
DEFAULT_CONFIG — a key the CLI sees but the gateway doesn't means you're on the wrong loader
(hermes_cli/AGENTS.md). Each adapter picks a base toolset (Telegram → "messaging").
Slash commands: handlers are looked up by name through _command_handler_table; a command is
listed in _IDLE_COMMANDS or _PLAIN_COMMANDS (works mid-run) in run_busy.py. No
if canonical == ... chains. Registry + adding a command: hermes_cli/AGENTS.md.
The gateway has TWO message guards — both must bypass approval/control commands
While an agent is running, an inbound message passes two sequential guards: (1) the base
adapter (platforms/base.py) queues it in _pending_messages when session_key in
self._active_sessions; (2) the runner (run.py/run_busy.py) intercepts /stop, /new,
/queue, /status, /approve, /deny before they reach running_agent.interrupt(). Any new
command that must reach the runner while the agent is blocked (approval prompts) MUST bypass BOTH
guards and be dispatched inline — never via _process_message_background(), which races session
lifecycle.
Streaming delivery contract (stream-is-the-message adapters)
Adapters with draft_stream_is_message = True (relay Slack native streaming) keep ONE cumulative
native stream per turn; the stream IS the final message. Four invariants, each from a live
duplicate-final incident (NS-658 canary ledger, hermes#85796 / gateway-gateway#210); violating any
re-creates a duplicate or frozen stream:
- Draft frames are prefix-stable. Frame N must be a string prefix of frame N+1. Never mutate
drafts per tick — no fence-closing (
ensure_closed_code_fences), cursor suffix, segment-state resets at tool boundaries, or mrkdwn conversion. A non-prefix frame forces a whole-snapshot re-append ("stacked copies"). The finalize path may still transform the real final. - The consumer declares the final; the adapter never guesses.
finish(final_text)carries the completedfinal_response(verifier footer, completion explainer included). New post-stream augmentation MUST ride this payload — mutatingfinal_responseafter the seal re-opens thedelivered_final_matchesmismatch → corrective duplicate send. - Interim sends carry
metadata["_interim_send"] = True. Any consumer-sideadapter.send()that is not the turn-final (commentary, segment-tail flushes) must set it or seal-interception seals the live stream with interim text. Seal-interception exists at BOTH egress doors (send()andsend_for_platform()); a new egress door needs the same two checks. - Reconcile by edit, never by plain send. A lane delivering a final beside a sealed stream
(queued follow-ups, media-accompanied finals) first tries
edit_messageon the consumer'smessage_id; plainsend()only when no editable message exists. A sealed native stream is a regular message —chat.updateworks (live-verified).
Contract tests: tests/gateway/test_stream_final_contract.py (mutation-checked). Slack ground
truth: chat.*Stream speaks STANDARD markdown, not mrkdwn; stopStream.markdown_text APPENDS;
startStream/stopStream are Tier 2 (~20/min). Check draft_stream_is_message is True —
MagicMock adapters in older tests auto-create truthy attributes.
No user content in INFO+ logs
Logs reach hermes debug share uploads: never log bodies, subjects, display names, addresses or
phones at INFO+. Log len(text), an id, hash_for_log(chat_id) or redact_phone(...); the raw
value goes to DEBUG (HX017).
Background process notifications
terminal(background=true, notify_on_complete=true) arms a watcher on the gateway loop
(run_notifications.py::arm_process_watcher) that starts a new turn on completion; verbosity is
display.background_process_notifications. Injection requires the admit_internal_event receipt
(a handler returning None is not acceptance); refused admission refunds every claimed batch sibling
without spending an attempt. Long form: website/docs/developer-guide/gateway-internals.md
§ Background process notifications.
Canonical local CLI/TUI/Desktop sessions admit completion and watch events into the same durable
FIFO as human input (private launch policy, internal_notification display kind); observers never
own or consume those turns, and an interrupted started turn stays unknown and pauses its followers.
/login (off-turn, paired DM only)
GatewayLoginCommandsMixin refuses outside a real paired DM (ntfy, raft and a2a report dm for
broadcast surfaces) and binds the WHOLE install's providers.nous, so shared gateways must set
allow_admin_from. It drains anon_auth.run_sign_in on its private single-worker _login_executor
(never the shared pool), allows one attempt per process, and on completion evicts agents still on
nous/welcome instead of writing a model override. Long form: gateway-internals.md § /login.
Gateway lifecycle vs. the Desktop app
hermes serve (control plane, desktop-spawned child) dies with the app — by design. The messaging
gateway (gateway run) SURVIVES the app: the serve backend's /api/gateway/* endpoints spawn it
detached (_spawn_hermes_action — start_new_session / DETACHED_PROCESS), so before-quit's
SIGTERM never reaches it and bots keep running. The known breach is the Windows shim-unlock
teardown (taskkill /T /F on venv-shim holders, #85265), which exists to let updates proceed and is
replaced by #92091's pause-for-update. Do NOT "fix" gateway-dies-with-app by re-parenting the
gateway under the backend, and do NOT "fix" update locks by widening the tree-kill. Gateways stamp
code_sha/code_version into gateway_state.json (status.py) so the updater can verify a fleet.
Profile scope (adapters, turns, and everything between turns)
- One identity per inbound event, canonicalized FIRST.
gateway/session_identity.py::resolve_identityanswers "which bot received it / who may admit it / where does it run" ONCE per event and pins a frozenRoutingIdentityon the source (wire-invisible, like_transport_adapter_ref). Every ingress path calls the canonicalize seam before it derives a key: the adapter side (platforms/base.py::_canonicalize—handle_message,_enqueue_text_event, Telegram photo / album routing,_handle_message_while_active, every_source_session_key) and the runner side (run_adapters.py::_canonicalize— the per-profile / default message, busy and platform-event handlers, the adapter auth-check callback,run_inbound.py::_hm_admit_event). No key derivation before it; an unresolved identity under multiplexing (route to an unserved profile) is dropped with one WARNING at the first seam it reaches, never keyed intoagent:main(parked_route_refusal.drop_rejected_route; a route to a parked profile also tells the sender in-channel to resend, since a direct bot's update is already confirmed and never redelivered; a relay frame is ACKed and refused alike (ParkedProfileRefusal: a withheld one stalls the ack-gated drain); a dispatch its transport has not acknowledged yet, e.g. Google Chat HTTP events, runs inretryable_ingress()and answersParkedRouteRefused(503) instead, releasing its dedup claim)._transport_owner,_authorization_home_for_source,_resolve_profile_home_for_source,_session_key_profileand_resolve_profile_for_keyread the identity when present and fall back to their old chain only for sources nothing resolved (restored rows, hand-built sources). Never derive a second answer next to the identity; extend the object.transport_profile≠runtime_profileis normal (shared bot → routed satellite). A source copy goes throughsession_identity.replace_sourceso the identity travels with it (_apply_topic_recoverydoes). Intake vs delivery adapter.
authz_mixin.py::_intake_adapter_for(source)is the bot that RECEIVED the event (live transport ref → relay socket → identity'stransport_profile); it gates intake policy (ignored channels, relay fronting, re-dispatch of a still-live event) and fails closed toNonefor a source with no live provenance._delivery_adapter_for(source)is the bot that ANSWERS — the receiving bot whenever known, else the unique owner of(platform, runtime_profile)via_adapters_for_profile. Never readself.adapters[platform]for a source; never add a third resolver. The matrix (tests/gateway/test_multiplex_transport_matrix.py):Topology runtime intake delivery per-credential bot, no route owner owner adapter owner adapter shared credential → satellite ( profile_routes)routed receiving adapter receiving adapter ( _is_shared_bot_satelliteafter restart)shared bot → profile that owns its own bot routed receiving adapter receiving adapter (conversation continuity; #70625's "routed bot" reading was not adopted) secondary-owned bot → default(bot_profile)default ( agent:main)receiving adapter receiving adapter restored / hand-built, no live provenance stored source.profileNoneunique owner of (platform, runtime), else that map's Relay when itfronts_platform(_fronting_relay, theresolve_delivery_transportrule); a disconnected secondary →None, never the default bot- Identity survives the process.
SessionEntry.transport_profile(routing index +sessions.transport_profile, nullable, reconciled bySCHEMA_SQL) persists the receiving bot next to the key namespace; the namespace says where a lane RUNS, the column says which bot may DELIVER to it. Anything reviving a session from durable state (auto-resume, heartbeat restore, plugin injection, background-process events) readsentry.originthroughauthz_mixin.py::_restored_source, which re-pins aRoutingIdentity(transport=None)viasession_identity.restore_identity;_delivery_adapter_forthen delivers through that bot's adapter or nothing (never the default bot by heuristic). Restored relay lanes use_fronting_relay; revival paths warm egress withdelivery.prime_revived_egress. Rows without the column (pre-PR-5) keep the_is_shared_bot_satellitefallback. Deferred callbacks capture the identity/home at command time (/modelpicker);_run_in_executor_with_contextcarries the scope over thread hops. Relay:_with_scopeechoes the routedprofileon every outbound frame andfollow_upderives it from the key namespace so the connector stamps it on the nextpassthrough_forward. Ambientget_active_profile_name()reads ingateway/are boot-only and marked# launch profile, pre-identity; a path with an identity readsidentity.runtime_profile. - Token locks. An adapter that connects with a unique credential (bot token, API key) calls
acquire_scoped_lock()fromgateway.statusinconnect()/start()andrelease_scoped_lock()indisconnect()/stop(), so two profiles cannot share one credential. Canonical:plugins/platforms/irc/adapter.py. - Multiplex profile-scoped env reads MUST fail closed — never borrow from
os.environ(agent/secret_scope.py; #72348, #86905). Undergateway.multiplex_profiles,os.environholds the DEFAULT profile's values; a secondary profile's.envexists only in its secret scope, bound per profile activity by_profile_runtime_scope(turn, callback, eviction, tick — never only "per turn"). All profile-level env config — credentials (app_secret, tokens) AND authorization (FEISHU_ALLOWED_USERS,{PLATFORM}_ALLOW_ALL_USERS,GATEWAY_ALLOW_ALL_USERS,group_policy,allow_bots) — is read scope-aware: adapters viagateway.platforms._shared.get_scoped_secret(the ONE implementation; adapters import it as_get_scoped_secret;extra_or_secret/seed_extra_from_env/env_is_connectedbuild on it), gateway authz via_shared.platform_gate_env(imported byauthz_mixin.pyas_auth_env). Scope installed + multiplex active → a scoped miss returns the default, NEVERos.environ(a leaked allowlist skips the allow-all check and silently rejects every secondary-profile sender, #86905). The unscoped default-profile path (UnscopedSecretError) and single-profile deployments keep theos.environread — there it IS the profile's own value. Never re-implement the reader in an adapter (thetry get_secret / except UnscopedSecretError: os.getenvshape drifts into a fallback-after-miss leak); import the shared one.tests/gateway/test_shared_platform_boilerplate.pyasserts every plugin's_env_enablementreads only through it. - Scope is bound per profile activity, not per turn.
run.py::_profile_runtime_scope(home)(oneScope:agent/runtime_scope.py, HX016) wraps a routed turn (run_turn.py::_profile_scope_for_source); the same binding wraps every path that touches a session's home, secrets or terminal scope with no turn on the stack: release and eviction (run_agent_cache.py::_run_release_in_profile_scope— TTL, LRU and memory-pressure eviction all route through it soon_session_end/memory flush hit the OWNING profile's provider), shutdown (run_shutdown.py::_finalize_session), post-turn media delivery (platforms/base.py::_media_delivery_scope), deferred callbacks (pickers, reactions — capture the routed home at command time, re-enter the scope in the callback), notifiers and outbound webhooks. Resolve the owning home from the session record (profile_home,agent:<profile>:key), never fromos.environ, which holds the launch profile. Why: eviction under the launch scope wrote a secondary profile's memories into the default profile's store. api_serverrebuilds the agent per request but not the memory provider. The adapter bypassesTurnRunnerand the agent cache (per-request callbacks, model route, ephemeral prompt), soplatforms/api_server_memory_sessions.pyparks each session's initialisedMemoryManagerbetween requests (exclusive check-out in_create_agent, check-in in the turn'sfinally, keyed by profile home +agent.session_id; idle/LRU eviction shuts down under the owning home) andAIAgent(memory_manager=...)adopts it without a second provider init. Without it the previous turn's queued recall never reaches the next request (#120116).multiplex_profiles: falseis not "no scope ever". A native hosted room serving a second profile flips the process-wide guard (tui_gateway/launch_profile_policy.py:: activate_multi_profile_hosting) inside the gateway process, after the adapters were wired; every standalone entry point (run_turn.py::_profile_scope_for_source, the primary adapter's message / busy / platform-event handlers viarun_adapters.py::_standalone_scoped) then binds the launch profile's OWN scope throughrun_turn.py::_standalone_launch_scope—.envover the env frozen at activation, never a.env-only rebuild (systemd /op runkeys have no file) and never liveos.environ. Gate a new standalone path on that helper, not on the config flag (#112878).- Hooks and observers register per served profile.
agent/shell_hooks.py::register_from_configand lifecycle observers are prepared under each profile's scope at startup and on profile add/remove; idempotence keys include the profile, andhooks/paths resolve at call time (a module constant freezes to the first importer). Shell hooks are also re-synced (added AND unregistered) on every local session create/resume viasession_policy.refresh_profile_hooks->shell_hooks.sync_from_config, the only caller that removes. - Adapter YAML never reaches
os.environunder multiplex.platforms/_shared.py:: apply_yaml_bridgeseedsPlatformConfig.extraand skips the environ write under a secondary profile's scope; gate/allowlist reads go throughplatform_gate_env. Aif not os.getenv(X): os.environ[X] = …bridge is first-profile-wins across the process — test two profiles with conflicting flags before touching precedence. - Unserved is reported, never silent. Shared-ingress platforms (Relay) run on the default
profile only; a secondary enabling one is logged once with the remedy and stamped into runtime
status (
run_adapters.py::_note_unserved_secondary_platform). The WhatsApp bridge is per profile: a paired secondary gets its own adapter and port (plugins/platforms/whatsapp/bridge_ownership.py), an unpaired one is reported aswhatsapp_unpaired, and a secondary never adopts or signals a bridge its own pidfile (pid + start time + port) does not identify.needs_attentionis set and cleared at the single writer (_update_platform_runtime_status) on the connect path. - One launch-home identity. "Does this task serve a routed profile?" compares the override
with
hermes_constants.get_routing_process_hermes_home()(agent/secret_scope.py:: serves_routed_profileand_is_process_home,tools/environments/local.py::_is_routed_home,hermes_cli/env_loader.py::_process_hermes_home), never withos.environ["HERMES_HOME"]read live: an embedding host that mirrors the served profile into the env var per turn (Hermes WebUI) pins its own home withpin_process_hermes_home(), and without a pin the resolver isget_process_hermes_home()unchanged. Do not add another routing decision that compares againstget_process_hermes_home()directly; that resolver is for process-level assets.
Tests
tests/gateway/. Adapter tests exercise the real delivery path with a fake transport; never
assert on hardcoded platform lists or command counts (root: no change-detectors). Session-key and
guard behaviour are invariants worth a test; platform API quirks belong in connector comments +
tests, not in prose.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

