Skip to content

The agent that grows with you

feat: hermes migrate and setup move Grok Bot users over; hermes migrate <agent> installs the importer

Teknium3053b9dd929e
diff --git a/hermes_cli/migrate.py b/hermes_cli/migrate.py
index e322dfc7e78..8a2bbc6501b 100644
--- a/hermes_cli/migrate.py
+++ b/hermes_cli/migrate.py
@@ -1,6 +1,7 @@
"""CLI handlers for ``hermes migrate ...``.
-Currently exposes only ``hermes migrate xai`` — diagnoses and (with --apply) rewrites references to
+``hermes migrate`` (bare) and ``hermes migrate <agent>`` move a user over from another agent through
+the agent-importers plugin; ``hermes migrate xai`` diagnoses and (with --apply) rewrites references to
xAI models retired on May 15, 2026.
"""
from __future__ import annotations
@@ -17,11 +18,33 @@ def cmd_migrate(args: Any) -> int:
"""Dispatcher for ``hermes migrate <subtype>``."""
if getattr(args, "migrate_type", None) == "xai":
return cmd_migrate_xai(args)
+ if getattr(args, "migrate_type", None) is None:
+ from hermes_cli.config import get_hermes_home
+ from hermes_cli.setup_agent_import import migrate_from_agents
+ return migrate_from_agents(get_hermes_home())
- print("usage: hermes migrate xai [--apply] [--no-backup]", file=sys.stderr)
+ print("usage: hermes migrate [<agent> | xai [--apply] [--no-backup]]", file=sys.stderr)
return 2
+# ``hermes migrate <agent>`` flags forwarded to ``hermes import-agent <agent>``, as (dest, flag).
+_AGENT_IMPORT_FLAGS = (("dry_run", "--dry-run"), ("overwrite", "--overwrite"), ("yes", "--yes"),
+ ("activate_routines", "--activate-routines"))
+
+
+def cmd_migrate_agent(args: Any) -> int:
+ """``hermes migrate <agent>``: install the agent-importers plugin when missing, then run its
+ import for that agent with the flags given here."""
+ from hermes_cli.config import get_hermes_home
+ from hermes_cli.setup_agent_import import migrate_from_agents
+ extra = [flag for dest, flag in _AGENT_IMPORT_FLAGS if getattr(args, dest, False)]
+ if getattr(args, "source", None):
+ extra += ["--source", str(Path(args.source).expanduser())]
+ for name in getattr(args, "bot", None) or ():
+ extra += ["--bot", name]
+ return migrate_from_agents(get_hermes_home(), args.migrate_agent, tuple(extra))
+
+
def _fail(message: str) -> int:
print(f" {color('✗', Colors.RED)} {message}", file=sys.stderr)
return 1
diff --git a/hermes_cli/setup_agent_import.py b/hermes_cli/setup_agent_import.py
index 74d7aef89f4..699d9b17825 100644
--- a/hermes_cli/setup_agent_import.py
+++ b/hermes_cli/setup_agent_import.py
@@ -23,8 +23,9 @@ PLUGIN = "agent-importers"
class ImportSource(NamedTuple):
name: str # ``hermes import-agent <name>``
label: str
- dirs: tuple[str, ...] # dirs under ``~`` the plugin reads; the first one found wins
+ dirs: tuple[str, ...] # paths under ``~`` (or absolute) that show the agent is here; first found wins
extra_args: tuple[str, ...] = ()
+ exports: tuple[str, ...] = () # globs under ``~`` for export files the plugin reads
# The plugin's importers, with the dirs its own auto-detection checks.
@@ -35,6 +36,12 @@ IMPORT_SOURCES: tuple[ImportSource, ...] = (
ImportSource("claude-code", "Claude Code", (".claude",)),
ImportSource("codex", "Codex CLI", (".codex",)),
ImportSource("cursor", "Cursor", (".cursor",)),
+ # Grok Bot lives in its cloud account: the desktop app's dirs only show it is used here, and the
+ # plugin walks the user through having each Bot export itself (or reads an export already saved).
+ ImportSource("grok-bot", "Grok Bot", ("Library/Application Support/Grok Bot", "/Applications/Grok Bot.app",
+ "Applications/Grok Bot.app", ".config/Grok Bot",
+ "AppData/Roaming/Grok Bot", "AppData/Local/Programs/Grok Bot"),
+ exports=("Downloads/grok-bot-export*",)),
)
@@ -43,6 +50,7 @@ def detect_import_sources() -> list[tuple[ImportSource, Path]]:
found = []
for source in IMPORT_SOURCES:
home = next((p for p in (Path.home() / d for d in source.dirs) if p.is_dir()), None)
+ home = home or next((p for g in source.exports for p in sorted(Path.home().glob(g))), None)
if home is not None:
found.append((source, home))
return found
@@ -123,10 +131,13 @@ def _snapshot(hermes_home: Path) -> tuple[Optional[bytes], ...]:
for p in (hermes_home / "config.yaml", hermes_home / ".env"))
-def _run_import(source: ImportSource, hermes_home: Path) -> bool:
+def _run_import(source: ImportSource, hermes_home: Path, extra_args: tuple[str, ...] = (),
+ from_setup: bool = True) -> bool:
"""``hermes import-agent <source>`` in a child process, so the freshly installed plugin's command
is wired; it previews and asks before changing anything (and exits 0 on a no too). True when the
- run changed config.yaml or .env, which the setup sections after it read."""
+ run changed config.yaml or .env, which the setup sections after it read. ``hermes migrate``
+ passes the user's flags as ``extra_args`` and runs it as a command of its own (``from_setup``
+ False)."""
from hermes_cli.setup import print_header, print_warning
from tools.environments.local import served_profile_child_env
print_header(f"Importing from {source.label}", gap=True)
@@ -137,13 +148,50 @@ def _run_import(source: ImportSource, hermes_home: Path) -> bool:
# --from-setup: the plugin's import speaks as a step of this setup (no "run hermes setup" pointers,
# OpenClaw's skipped items folded into one line).
argv = [sys.executable, "-P", "-m", "hermes_cli.main", *selector, "import-agent", source.name, *source.extra_args,
- "--from-setup"]
+ *extra_args, *(["--from-setup"] if from_setup else [])]
env = served_profile_child_env(target_home=hermes_home)
if os.environ.get("PYTHONPATH"): # this same interpreter running Hermes: keep the source tree
env["PYTHONPATH"] = os.environ["PYTHONPATH"] # a checkout launched by path, which it strips
# health: allow HX006 -- interactive child: the user reads its preview and answers its prompts
- if subprocess.run(argv, env=env, check=False).returncode:
- # An install from before the plugin gained this importer, or --from-setup, refuses it (argparse, exit 2).
+ returncode = subprocess.run(argv, env=env, check=False).returncode
+ # An install from before the plugin gained this importer (or --from-setup) refuses it in argparse
+ # (exit 2) before asking anything: update the plugin once and try again.
+ if returncode == 2 and _update_plugin(source):
+ returncode = subprocess.run(argv, env=env, check=False).returncode # health: allow HX006 -- same child
+ if returncode:
print_warning(f"The {source.label} import did not run. If the error names an invalid choice or "
f"unrecognized arguments, update the plugin first: hermes plugins update {PLUGIN}")
return _snapshot(hermes_home) != before
+
+
+def _update_plugin(source: ImportSource) -> bool:
+ """Bring the installed plugin to the catalog's current pin; False when that update failed."""
+ from hermes_cli.plugins_cmd_update import cmd_update
+ from hermes_cli.setup import _info
+ _info(None, f"Your '{PLUGIN}' plugin predates the {source.label} importer. Updating it...")
+ try:
+ cmd_update(PLUGIN, interactive=False)
+ except SystemExit: # it printed why
+ return False
+ return True
+
+
+def migrate_from_agents(hermes_home: Path, source_name: str = "", extra_args: tuple[str, ...] = ()) -> int:
+ """``hermes migrate [<agent>]``: the same import as setup's step, on demand. Named: install the
+ plugin when missing and run that agent's import with ``extra_args``. Bare: offer the agents found
+ on this computer, as setup does."""
+ from hermes_cli.setup import is_noninteractive, print_info
+ if not source_name:
+ found = detect_import_sources()
+ if found and not is_noninteractive():
+ offer_agent_import(hermes_home)
+ return 0
+ print_info(("Found: " + ", ".join(s.label for s, _ in found) + ". " if found else
+ "No other agent setup found on this computer. ")
+ + "Import one with: " + ", ".join(f"hermes migrate {s.name}" for s in IMPORT_SOURCES))
+ return 0
+ source = next(s for s in IMPORT_SOURCES if s.name == source_name)
+ if not _ensure_plugin(hermes_home):
+ return 1
+ _run_import(source, hermes_home, extra_args, from_setup=False)
+ return 0
diff --git a/hermes_cli/subcommands/migrate.py b/hermes_cli/subcommands/migrate.py
index c7530ced244..5e0329e001e 100644
--- a/hermes_cli/subcommands/migrate.py
+++ b/hermes_cli/subcommands/migrate.py
@@ -8,9 +8,10 @@ def build_migrate_parser(subparsers) -> None:
from hermes_cli.migrate import cmd_migrate, cmd_migrate_xai
migrate_parser = subparsers.add_parser(
- "migrate", help="Migrate configuration for retired models or deprecated settings",
- description="Diagnose and (optionally) rewrite the active config.yaml to "
- "replace references to retired models or deprecated settings.")
+ "migrate", help="Move over from another agent, or migrate retired models and deprecated settings",
+ description="With no type: find another agent's setup on this computer (OpenClaw, Claude Code, "
+ "Codex CLI, Cursor, Grok Bot) and offer to import it. Name an agent to import from it; "
+ "xai and relay rewrite deprecated settings in the active config.yaml.")
migrate_subparsers = migrate_parser.add_subparsers(dest="migrate_type")
migrate_xai = migrate_subparsers.add_parser(
@@ -39,9 +40,34 @@ def build_migrate_parser(subparsers) -> None:
"--no-validate", action="store_true",
help="Skip activating the generated file through Relay's validator before writing it")
migrate_relay.set_defaults(func=_cmd_migrate_relay)
+ _add_agent_import_parsers(migrate_subparsers)
migrate_parser.set_defaults(func=cmd_migrate)
+def _add_agent_import_parsers(migrate_subparsers) -> None:
+ """``hermes migrate <agent>``: one per importer setup offers; runs the agent-importers plugin's
+ ``hermes import-agent <agent>`` (installing the plugin first when it is missing)."""
+ from hermes_cli.migrate import cmd_migrate_agent
+ from hermes_cli.setup_agent_import import IMPORT_SOURCES
+
+ for source in IMPORT_SOURCES:
+ sub = migrate_subparsers.add_parser(
+ source.name, help=f"Import your {source.label} setup into Hermes",
+ description=f"Import your {source.label} setup into the active profile through the "
+ "agent-importers plugin (installed from the plugin catalog when missing). Always "
+ "previews first and asks before changing anything.")
+ sub.add_argument("--source", help="Where the agent's setup (or, for Grok Bot, its export file) is")
+ sub.add_argument("--dry-run", action="store_true", help="Preview only")
+ sub.add_argument("--overwrite", action="store_true", help="Replace existing items on name conflicts")
+ sub.add_argument("-y", "--yes", action="store_true", help="Skip the confirmation prompt")
+ if source.name == "grok-bot":
+ sub.add_argument("--activate-routines", action="store_true",
+ help="Create the imported cron jobs running instead of paused")
+ sub.add_argument("--bot", action="append", metavar="NAME",
+ help="Only this Bot from an export holding several (repeatable)")
+ sub.set_defaults(func=cmd_migrate_agent, migrate_agent=source.name)
+
+
def _cmd_migrate_relay(args) -> None:
from hermes_cli.relay_plugin_migrate import cmd_migrate_relay
cmd_migrate_relay(args)
diff --git a/tests/hermes_cli/test_setup_agent_import.py b/tests/hermes_cli/test_setup_agent_import.py
index 9268938ce0c..4d7320bae48 100644
--- a/tests/hermes_cli/test_setup_agent_import.py
+++ b/tests/hermes_cli/test_setup_agent_import.py
@@ -148,3 +148,35 @@ def test_setup_menu_shows_what_was_found_with_the_question(homes, monkeypatch):
assert ("Found on this computer: OpenClaw (~/.openclaw), Claude Code (~/.claude), Codex CLI (~/.codex)."
in " ".join(description.split()))
assert calls == [] and not (hermes_home / "plugins").exists()
+
+
+def test_grok_bot_export_in_downloads_is_offered_like_the_other_agents(homes):
+ """Grok Bot keeps its setup in the cloud: an export the Bot wrote, saved to Downloads, is enough
+ for setup to offer the import."""
+ user_home, hermes_home, calls, _answers = homes
+ (user_home / "Downloads").mkdir()
+ (user_home / "Downloads" / "grok-bot-export.json").write_text("{}", encoding="utf-8")
+
+ assert step.offer_agent_import(hermes_home) == "Grok Bot"
+ assert calls[-1] == ("import", ["--profile", "default", "import-agent", "grok-bot", "--from-setup"],
+ str(hermes_home))
+
+
+def test_hermes_migrate_names_an_agent_installs_the_plugin_and_forwards_its_flags(homes):
+ """`hermes migrate grok-bot ...` through the real parser: the plugin is installed from the catalog
+ when missing, and the import runs as its own command (no --from-setup) with the user's flags."""
+ import argparse
+
+ from hermes_cli.subcommands.migrate import build_migrate_parser
+ user_home, hermes_home, calls, _answers = homes
+ parser = argparse.ArgumentParser()
+ build_migrate_parser(parser.add_subparsers(dest="command"))
+ args = parser.parse_args(["migrate", "grok-bot", "--source", "~/export.json", "--activate-routines",
+ "--bot", "Scout", "-y"])
+
+ assert args.func(args) == 0
+ assert calls == [
+ ("install", "agent-importers", True, True),
+ ("import", ["--profile", "default", "import-agent", "grok-bot", "--yes", "--activate-routines",
+ "--source", str(user_home / "export.json"), "--bot", "Scout"], str(hermes_home)),
+ ]
diff --git a/website/docs/reference/cli-commands.md b/website/docs/reference/cli-commands.md
index 819280965fd..8bb62e2f214 100644
--- a/website/docs/reference/cli-commands.md
+++ b/website/docs/reference/cli-commands.md
@@ -63,7 +63,7 @@ The install also ships `hermes-agent`, a minimal runner that sends one query and
| `hermes send` | Send a one-shot message to a configured messaging platform (Telegram, Discord, Slack, Signal, SMS, …). Useful from shell scripts, cron jobs, CI hooks, and monitoring daemons — no agent loop, no LLM. |
| `hermes peer` | Register peer Hermes gateways on other machines and DM their agents' canonical Bot Chats (`hermes peer dm <peer>[/<agent>] "…"`). The transport behind cross-machine bot-to-bot messaging. |
| `hermes secrets` | Manage external secret sources (currently Bitwarden Secrets Manager) for pulling API keys at process startup instead of from `~/.hermes/.env`. |
-| `hermes migrate` | Diagnose and (optionally) rewrite `config.yaml` to replace references to retired models or deprecated settings (e.g. `migrate xai`). |
+| `hermes migrate` | Move over from another agent (`migrate grok-bot`, `migrate claude-code`, ... or bare to detect), or rewrite `config.yaml` for retired models and deprecated settings (`migrate xai`). |
| `hermes codex-runtime` | Noninteractive counterpart of `/codex-runtime`: `migrate [--dry-run] [--json]` regenerates the Hermes-managed block in `~/.codex/config.toml` for the selected profile. See [Codex app-server runtime](../user-guide/features/codex-app-server-runtime.md#running-the-migration-from-a-script). |
| `hermes status` | Show agent, auth, and platform status. |
| `hermes usage` | Show the configured account's rate-limit windows (the `/usage` block) without a session; `--json` for scripts. |
@@ -599,13 +599,18 @@ Pull API keys from an external secret manager at process startup instead of stor
## `hermes migrate`
```bash
-hermes migrate <type>
+hermes migrate # find another agent's setup here and offer to import it
+hermes migrate <agent> # openclaw, claude-code, codex, cursor or grok-bot
+hermes migrate <type> # xai, relay
```
-Diagnose and (optionally) rewrite the active `config.yaml` to replace references to retired models or deprecated settings. A timestamped backup of the original `config.yaml` is taken before any rewrite (skip with `--no-backup`).
+Bare `hermes migrate` looks for OpenClaw, Claude Code, Codex CLI, Cursor and Grok Bot on this computer and offers to import what it finds, the same step a first `hermes setup` runs. `hermes migrate <agent>` imports from that agent even when nothing is detected: it installs the [`agent-importers`](../user-guide/import-from-other-agents.md) plugin from the catalog when it is missing, then runs `hermes import-agent <agent>` (preview, then confirmation). It takes `--source`, `--dry-run`, `--overwrite` and `-y`; `grok-bot` also takes `--activate-routines` and `--bot <name>`.
+
+The `xai` and `relay` types diagnose and (optionally) rewrite the active `config.yaml` to replace references to retired models or deprecated settings. A timestamped backup of the original `config.yaml` is taken before any rewrite (skip with `--no-backup`).
| Subcommand | Description |
|------------|-------------|
+| `openclaw`, `claude-code`, `codex`, `cursor`, `grok-bot` | Import that agent's setup (see above). |
| `xai` | Scan `config.yaml` for references to xAI models scheduled for retirement on May 15, 2026 and (with `--apply`) rewrite them in-place to the official replacements per the xAI migration guide. Defaults to dry-run. |
Common flags for migration subcommands:
@@ -615,7 +620,6 @@ Common flags for migration subcommands:
| `--apply` | Rewrite `config.yaml` in-place (default: dry-run, no writes). |
| `--no-backup` | Skip the timestamped backup of `config.yaml` when applying. |
-> Not to be confused with `hermes import-agent openclaw` (one-shot import of OpenClaw configuration into Hermes) — `hermes migrate` is the top-level config-rewrite command.
## `hermes codex-runtime`
diff --git a/website/docs/user-guide/import-from-other-agents.md b/website/docs/user-guide/import-from-other-agents.md
index 691b500e1ea..80112127bbd 100644
--- a/website/docs/user-guide/import-from-other-agents.md
+++ b/website/docs/user-guide/import-from-other-agents.md
@@ -1,18 +1,18 @@
---
sidebar_position: 9
title: "Import from Other Agents"
-description: "One-command import of an OpenClaw (~/.openclaw), Claude Code (~/.claude), OpenAI Codex CLI (~/.codex) or Cursor (~/.cursor) setup into Hermes — instructions, rules, allowlists, MCP servers, skills, and memories."
+description: "One-command import of an OpenClaw (~/.openclaw), Claude Code (~/.claude), OpenAI Codex CLI (~/.codex), Cursor (~/.cursor) or Grok Bot setup into Hermes — instructions, rules, allowlists, MCP servers, skills, memories and Grok Bot routines."
---
# Import from Other Agents
-`hermes import-agent` imports your existing **OpenClaw**, **Claude Code**, **OpenAI Codex CLI** or **Cursor** setup into Hermes with one command. You always see a per-item plan before anything is written, and `--dry-run` never touches disk.
+`hermes import-agent` imports your existing **OpenClaw**, **Claude Code**, **OpenAI Codex CLI**, **Cursor** or **Grok Bot** setup into Hermes with one command. You always see a per-item plan before anything is written, and `--dry-run` never touches disk.
The command comes from the official **`agent-importers` plugin** from the [plugin catalog](./features/plugins.md), maintained by Nous Research in [NousResearch/hermes-official-plugins](https://github.com/NousResearch/hermes-official-plugins/tree/main/agent-importers).
## The easy way: `hermes setup`
-On a fresh install, `hermes setup` checks for `~/.openclaw` (or legacy `~/.clawdbot` / `~/.moltbot`), `~/.claude`, `~/.codex` and `~/.cursor` before anything else. When it finds one it asks **"Import your setup from Claude Code?"** (naming what it found); with several found you then pick which from a checklist, all checked. Say yes and setup installs the `agent-importers` plugin from the catalog, unless you already have it, and runs the import below for each pick, preview and confirmation included. For OpenClaw it passes `--migrate-secrets`, as Hermes' old built-in OpenClaw step did, so your API keys and bot tokens come over and the provider and messaging sections that follow are already filled in. If you then pick Quick Setup and the import brought a model along with its key, setup asks whether to keep that model (the default) or switch to Nous Portal. Say no, or have none of these folders, and nothing is installed. Already set up? Use the commands below.
+On a fresh install, `hermes setup` checks for `~/.openclaw` (or legacy `~/.clawdbot` / `~/.moltbot`), `~/.claude`, `~/.codex`, `~/.cursor` and the Grok Bot desktop app (or a `grok-bot-export*` file in `~/Downloads`) before anything else. When it finds one it asks **"Import your setup from Claude Code?"** (naming what it found); with several found you then pick which from a checklist, all checked. Say yes and setup installs the `agent-importers` plugin from the catalog, unless you already have it, and runs the import below for each pick, preview and confirmation included. For OpenClaw it passes `--migrate-secrets`, as Hermes' old built-in OpenClaw step did, so your API keys and bot tokens come over and the provider and messaging sections that follow are already filled in. If you then pick Quick Setup and the import brought a model along with its key, setup asks whether to keep that model (the default) or switch to Nous Portal. Say no, or have none of these folders, and nothing is installed. Already set up? Run `hermes migrate` for the same offer, `hermes migrate <agent>` (`openclaw`, `claude-code`, `codex`, `cursor`, `grok-bot`) to import from one agent, installing the plugin when it is missing, or use the commands below.
## By hand
@@ -72,6 +72,21 @@ Claude's `Bash(npm run test:*)` prefix rules become `npm run test*` globs. Non-`
`.mdc` frontmatter (`description`, `globs`, `alwaysApply`) is routing metadata for Cursor's rule engine and is stripped; only the rule body is imported. A skill is the folder holding `SKILL.md`, so `skills/shipping/land-it/` imports as `cursor-imports/land-it/`; two skills with the same name in different folders are reported as a conflict.
+### Grok Bot
+
+Grok Bot keeps your Bots, routines and skills in its cloud account and has no export button, so each Bot exports itself. Run `hermes migrate grok-bot` (or `hermes import-agent grok-bot`): with no export yet it prints a message to paste into a Bot's chat. The Bot writes `grok-bot-export.json` (or replies with one JSON block) without changing anything; download it and run `hermes import-agent grok-bot --source <file>`. Files saved as `~/Downloads/grok-bot-export*` are found without `--source`. Repeat per Bot, into the profile that should own its work (`hermes -p <profile> ...`).
+
+| Grok Bot | Hermes |
+|---|---|
+| Routine on a schedule | [Cron job](./features/cron.md) `<Bot>: <routine>` with the same schedule, time zone and skills, created **paused** |
+| Routine on an event (Slack, GitHub, email, webhook, ...) | Its instruction and trigger saved to `grok-bot-import/<bot>-event-routines.md` to rebuild |
+| Skills | `skills/grok-bot-imports/<name>/` |
+| What the Bot remembers / facts about you | `memories/MEMORY.md` / `memories/USER.md` |
+| The Bot's role | `SOUL.md` while it still holds Hermes' default, else memory entries |
+| Apps with a remote MCP URL | `mcp_servers` in `config.yaml` |
+
+Routines arrive paused so they don't run twice while the Grok copy is still on: turn it off in Grok Bot, then `hermes cron resume <id>` (the import prints each id), or pass `--activate-routines`. Point a job's output somewhere with `hermes cron edit <id> --deliver telegram`. An export carrying credential-looking keys is refused, and token-shaped text is redacted.
+
## What is never imported
**API keys and credentials.** (OpenClaw is the one exception: its allowlisted API keys and bot tokens come over only when you pass `--migrate-secrets`.) Credential files (`~/.claude/.credentials.json`, `~/.codex/auth.json`, `~/.cursor/cli-config.json`) are never read, and MCP server environment variables or headers with secret-looking names (`*_TOKEN`, `*_API_KEY`, `Authorization`, ...) are stripped and listed in the report so you can re-add them deliberately. Run `hermes setup` to configure providers, or add secrets to `~/.hermes/.env`.