The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(start_chat): any desktop agent can start a visible chat through a native tool
alt-glitche0e0505989da
diff --git a/tools/delegate_tool_toolsets.py b/tools/delegate_tool_toolsets.pyindex ead1979a390..f4ed8e89875 100644--- a/tools/delegate_tool_toolsets.py+++ b/tools/delegate_tool_toolsets.py@@ -18,6 +18,7 @@ DELEGATE_BLOCKED_TOOLS = frozenset("memory", # no writes to shared MEMORY.md"send_message", # no cross-platform side effects"cronjob_manage", # no scheduling more work in the parent's name+ "start_chat", # no opening chats in the user's name])DEFAULT_TOOLSETS = ["terminal", "file", "web"]diff --git a/tools/start_chat_tool.py b/tools/start_chat_tool.pynew file mode 100644index 00000000000..dc20a14f007--- /dev/null+++ b/tools/start_chat_tool.py@@ -0,0 +1,47 @@+from tools.registry import registry++START_CHAT_SCHEMA = {+ "name": "start_chat",+ "description": (+ "Start a new chat in the Hermes desktop app and send it its first message, so the task runs "+ "there in view of the user while this chat stays where it is. Call it ONCE per task: every "+ "call opens another chat, and nothing de-duplicates a repeated call. The new chat starts with "+ "no history, so the message must carry everything the task needs. 'profile' must name an "+ "existing profile; omit it to use this chat's own profile. The result is 'started' with the "+ "new chat's session_id, or 'rejected' with a reason."+ ),+ "parameters": {+ "type": "object",+ "properties": {+ "message": {+ "type": "string",+ "description": "The new chat's first user message: the whole task, self-contained.",+ },+ "title": {+ "type": "string",+ "maxLength": 40,+ "description": "Sidebar title for the new chat, at most 40 characters. Omit it to let the chat title itself.",+ },+ "profile": {+ "type": "string",+ "description": "An existing profile to run the chat in. Omit it for this chat's own profile.",+ },+ },+ "required": ["message"],+ },+}+++def _start_chat(args, **_kw):+ from tui_gateway.start_chat import start_chat++ return start_chat(args)+++registry.register(+ name="start_chat",+ toolset="start_chat",+ schema=START_CHAT_SCHEMA,+ handler=_start_chat,+ emoji="π¬",+)diff --git a/tools/tool_search.py b/tools/tool_search.pyindex 755bdb04eb6..2540d295f17 100644--- a/tools/tool_search.py+++ b/tools/tool_search.py@@ -137,7 +137,7 @@ def _core_tool_names() -> frozenset[str]:# their schema; once enabled they stay direct unless the deferral list names them. ``setup``# is the setup profile's whole job: a guide that has to search for its tool first# answers the user's install request with a tool_search round trip.-_DIRECT_SURFACE_TOOLSETS = frozenset({"desktop_ui", "project", "setup"})+_DIRECT_SURFACE_TOOLSETS = frozenset({"desktop_ui", "project", "setup", "start_chat"})# Event-triggered tools deferred BY DEFAULT (a catalog stub suffices). Keep the curated# list in DEFAULT_CONFIG so config discovery and runtime behavior cannot drift. An explicitdiff --git a/toolsets.py b/toolsets.pyindex 2d3620594a7..ec5a5a43a01 100644--- a/toolsets.py+++ b/toolsets.py@@ -72,7 +72,7 @@ _CODING_TOOLS = _core_without("image_generate", "text_to_speech", "cronjob_manag# config: another surface lacking them made no configuration choice.CLIENT_SURFACE_TOOLSETS = frozenset({"project", "desktop_ui"})-TOOLSET_SESSION_PLATFORMS = {"setup": frozenset({"desktop"})}+TOOLSET_SESSION_PLATFORMS = {"setup": frozenset({"desktop"}), "start_chat": frozenset({"desktop"})}# Core toolset definitions: individual tools or references to other toolsets.TOOLSETS = {@@ -152,6 +152,7 @@ TOOLSETS = {"catalog plugin/skill install requests through the approval card",["setup_choose", "manage_catalog"],),+ "start_chat": _ts("Start a new visible desktop chat that runs a task in a chosen profile", ["start_chat"]),"clarify": _ts("Ask the user clarifying questions (multiple-choice or open-ended)", ["clarify"]),"code_execution": _ts("Run Python scripts that call tools programmatically (reduces LLM round trips)", ["execute_code"]),"delegation": _ts("Spawn subagents with isolated context for complex subtasks", ["delegate_task"]),diff --git a/tui_gateway/start_chat.py b/tui_gateway/start_chat.pynew file mode 100644index 00000000000..79c7a1a5206--- /dev/null+++ b/tui_gateway/start_chat.py@@ -0,0 +1,51 @@+import json+from pathlib import Path++TITLE_LIMIT = 40+++def _rejected(reason: str) -> str:+ return json.dumps({"status": "rejected", "reason": reason})+++def start_chat(args: dict) -> str:+ from agent.onboarding import PROFILE_BUILD_FLAG, mark_seen+ from gateway.session_context import get_session_env+ from hermes_constants import profile_name_for_home+ from tui_gateway import server+ from tui_gateway.transport import bind_transport, reset_transport++ caller = server._sessions.get(get_session_env("HERMES_UI_SESSION_ID", ""))+ if caller is None:+ return _rejected("start_chat works only from a chat in the Hermes desktop app.")+ message = str(args.get("message") or "").strip()+ if not message:+ return _rejected("message is empty: pass the new chat's first message.")+ title = str(args.get("title") or "").strip()+ if len(title) > TITLE_LIMIT:+ return _rejected(f"title has {len(title)} characters; the limit is {TITLE_LIMIT}.")+ profile = str(args.get("profile") or "").strip() or profile_name_for_home(caller.get("profile_home"))+ try:+ home = server._profile_home(profile)+ except server.ProfileUnavailableError as exc:+ return _rejected(str(exc))+ token = bind_transport(caller.get("transport"))+ try:+ with server._session_profile_runtime_scope({"profile_home": str(home) if home else None}):+ created = server._create_session(+ None, {"profile": profile or "", "source": caller.get("source"), "title": title})+ if "error" in created:+ return _rejected(created["error"]["message"])+ result = created["result"]+ mark_seen(Path(home or server._hermes_home) / "config.yaml", PROFILE_BUILD_FLAG)+ submitted = server._methods["prompt.submit"](None, {"session_id": result["session_id"], "text": message})+ if "error" in submitted:+ server._methods["session.close"](None, {"session_id": result["session_id"]})+ return _rejected(submitted["error"]["message"])+ finally:+ reset_transport(token)+ name = result["info"]["profile_name"]+ return json.dumps({+ "status": "started", "session_id": result["stored_session_id"], "profile": name, "title": title or None,+ "message": f"Started '{title or message[:TITLE_LIMIT]}' in {name}. Do not call start_chat again for this task.",+ })diff --git a/website/docs/reference/tools-reference.md b/website/docs/reference/tools-reference.mdindex 5ae0eb01deb..ef59eeade39 100644--- a/website/docs/reference/tools-reference.md+++ b/website/docs/reference/tools-reference.md@@ -189,6 +189,14 @@ Enabled by the desktop setup profile's own config (`platform_toolsets.cli`). Onl| `manage_catalog` | Only through the `setup` toolset named in a profile's config (`all` does not include it), desktop sessions only. `search` lists catalog plugins and hub skills matching `query` (optionally one `kind`) with `id`, `kind`, `display`, `tier`, `platforms` and `installed` (present in the `default` profile); it changes nothing. `install` takes `items: [{kind, id}]` and shows one approval card with a row per item (Install, Advanced, Skip); an id the catalog does not know, or a plugin this OS cannot run, is drawn failed with the reason. An approved row installs into `default` (or the profile chosen under Advanced) at the catalog's reviewed commit, with the same kill list, security scan and live activation as the Plugins tab, so the plugin's MCP tools and skills are usable in that profile's open chats at once. The result lists each row as `connected` (with `tools` and `skill`), `skipped`, `failed` (with `detail`) or `not_connected`. The model cannot pass a source, commit, profile or setting. Anywhere else the call returns the `hermes plugins install` / `hermes skills install` command to run instead. | β || `setup_choose` | Only through the `setup` toolset, desktop sessions only; never deferred unless a `tools.tool_search.defer` list names it. Shows one card in the setup chat: `kind` is `question`, `accent`, `theme`, `layout`, `connectors` or `plugins`, and `question` is the card's heading. `options` (up to 12 `{id, label, detail?}` rows, unique ids) replaces the app's own list; omitted, the pickers show the app's list and kind `question` asks for free text. A `question` card with options still takes a typed answer. `multi_select` lets the user pick several rows. `intent` (connectors and plugins only) adds a now / later / save choice per row. The result has `outcome` (`submitted`, `cancelled` or `no_answer` with a `notice`), `picked` (an option id or typed text, or a list of ids with `multi_select`) and, with `intent`, a map of picked id to `now`, `later` or `save`. It stores nothing. Anywhere else the call returns an error. | β |+## `start_chat` toolset++Enabled only when a profile's own config names it (`platform_toolsets.cli`). Only desktop sessions get its tool; CLI, `hermes -z`, cron, kanban and messaging sessions never do. `all` does not include it. Not listed by `hermes tools`. Subagents never get it.++| Tool | Description | Requires environment |+|------|-------------|----------------------|+| `start_chat` | Opens a new chat in the desktop app and sends `message` as its first user message; the calling chat stays where it is. The new chat starts with no history. `profile` must name an existing profile (it is never created); omitted, the chat runs in the caller's own profile. The new chat takes its settings from its own profile, never from the caller's. `title` (at most 40 characters) names the chat in the sidebar; omitted, the chat titles itself. Every call opens another chat: nothing de-duplicates a repeated call. The result is `started` with the new chat's `session_id` and `profile`, or `rejected` with a `reason` (unknown profile, empty message, title too long, not called from a desktop chat). | β |+## `session_search` toolset| Tool | Description | Requires environment |diff --git a/website/docs/reference/toolsets-reference.md b/website/docs/reference/toolsets-reference.mdindex db7698ceb8c..399f3599a20 100644--- a/website/docs/reference/toolsets-reference.md+++ b/website/docs/reference/toolsets-reference.md@@ -78,6 +78,7 @@ Or in-session:| `search` | `web_search` | Web search only (without extract). || `session_search` | `session_search` | Search past conversation sessions. || `setup` | `manage_catalog`, `setup_choose` | Onboarding-only surface of the desktop setup profile: ask the user one question or picker card at a time, search the plugin catalog and skills hub, and install items through the approval card. The setup profile's own config enables it (`platform_toolsets.cli`), and only desktop sessions get its tools. `all` does not include it. Not listed by `hermes tools`. |+| `start_chat` | `start_chat` | Start a new desktop chat in an existing profile (this chat's own profile when none is named) and send it its first message, so the task runs there in view of the user. Every call opens another chat. A profile's own config enables it (`platform_toolsets.cli`), and only desktop sessions get its tool. `all` does not include it. Not listed by `hermes tools`. Subagents never get it. || `skills` | `skill_manage`, `skill_view`, `skills_list` | Skill CRUD and browsing. || `spotify` | `spotify_albums`, `spotify_devices`, `spotify_library`, `spotify_playback`, `spotify_playlists`, `spotify_queue`, `spotify_search` | Native Spotify control (playback, queue, search, playlists, albums, library). Registered by the bundled `spotify` plugin. || `terminal` | `process_manage`, `terminal` | Shell command execution and background process management. |diff --git a/website/docs/user-guide/features/delegation.md b/website/docs/user-guide/features/delegation.mdindex 95c4268fea6..ccc0bc849a1 100644--- a/website/docs/user-guide/features/delegation.md+++ b/website/docs/user-guide/features/delegation.md@@ -336,6 +336,7 @@ Certain tools are blocked for subagents even when the parent has them:- `memory` β no writes to shared persistent memory- `send_message` β no cross-platform side effects- `cronjob` β no scheduling more work in the parent's name+- `start_chat` β no opening chats in the user's nameBoth roles retain `execute_code` (programmatic tool calling) so children can batch mechanical work.