Skip to content

Commit 1fc5b2b

Browse files
vincentkocsteipete
andauthored
feat(migrations): add plugin-owned Hermes import
* feat: add migration providers * feat: offer Hermes migration during onboarding * feat(hermes): map imported config surfaces * feat(onboard): require fresh migration imports * docs(cli): clarify Hermes import coverage * chore(migrations): rename Hermes importer package * chore(migrations): rewire Hermes importer id * fix(migrations): redact migration JSON details * fix(hermes): use provider runtime for config imports * test(hermes): cover missing source planning --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
1 parent 75c52b6 commit 1fc5b2b

96 files changed

Lines changed: 5477 additions & 24 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
- any-glob-to-any-file:
3636
- "extensions/google-meet/**"
3737
- "docs/plugins/google-meet.md"
38+
"plugin: migrate-hermes":
39+
- changed-files:
40+
- any-glob-to-any-file:
41+
- "extensions/migrate-hermes/**"
42+
- "docs/cli/migrate.md"
3843
"plugin: bonjour":
3944
- changed-files:
4045
- any-glob-to-any-file:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Docs: https://docs.openclaw.ai
99
- Control UI: polish the quick settings dashboard grid so common cards align across desktop, tablet, and mobile layouts without wasting horizontal space. Thanks @BunsDev.
1010
- Matrix/E2EE: add `openclaw matrix encryption setup` to enable Matrix encryption, bootstrap recovery, and print verification status from one setup flow. Thanks @gumadeiras.
1111
- Agents/compaction: add an opt-in `agents.defaults.compaction.maxActiveTranscriptBytes` preflight trigger that runs normal local compaction when the active JSONL grows too large, requiring transcript rotation so successful compaction moves future turns onto a smaller successor file instead of raw byte-splitting history. Thanks @vincentkoc.
12+
- CLI/migration: add `openclaw migrate` with plan, dry-run, JSON, pre-migration backup, onboarding detection, archive-only report copies, and a bundled Hermes importer for configuration, memory/plugin hints, model providers, MCP servers, skills, and supported credentials. Thanks @NousResearch.
1213

1314
### Fixes
1415

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
2a3fb85feb7420de8b166a695c3693dcc1eaa7a7f31de0dd139da856f10b2085 plugin-sdk-api-baseline.json
2-
6bdb96f7f92c34d7ae698784c0073343c34fb4274ab7eeded49acebb81056074 plugin-sdk-api-baseline.jsonl
1+
8371f19a19ceeae4eb20fbfe8e68e51f6f54f42c487d7d5c75f214ab1ba0922a plugin-sdk-api-baseline.json
2+
a5f5e15e75f8cf27ebaa1302cfe0488974edd53121279c1e90705bc531a4761a plugin-sdk-api-baseline.jsonl

docs/.i18n/glossary.zh-CN.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,22 @@
435435
"source": "Setup",
436436
"target": "设置"
437437
},
438+
{
439+
"source": "Migrate",
440+
"target": "迁移"
441+
},
442+
{
443+
"source": "Migration",
444+
"target": "迁移"
445+
},
446+
{
447+
"source": "Hermes",
448+
"target": "Hermes"
449+
},
450+
{
451+
"source": "Archive-only",
452+
"target": "仅归档"
453+
},
438454
{
439455
"source": "Channel Plugin SDK",
440456
"target": "渠道插件 SDK"

docs/cli/migrate.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
summary: "CLI reference for importing state from another agent system"
3+
read_when:
4+
- You want to migrate from Hermes or another agent system into OpenClaw
5+
- You are adding a plugin-owned migration provider
6+
title: "Migrate"
7+
---
8+
9+
# `openclaw migrate`
10+
11+
Import state from another agent system through a plugin-owned migration provider.
12+
13+
```bash
14+
openclaw migrate list
15+
openclaw migrate hermes --dry-run
16+
openclaw migrate hermes
17+
openclaw migrate apply hermes --yes
18+
openclaw migrate apply hermes --include-secrets --yes
19+
openclaw onboard --flow import
20+
openclaw onboard --import-from hermes --import-source ~/.hermes
21+
```
22+
23+
## Safety model
24+
25+
`openclaw migrate` is preview-first. The provider returns an itemized plan before anything changes, including conflicts, skipped items, and sensitive items. JSON plans, apply output, and migration reports redact nested secret-looking keys such as API keys, tokens, authorization headers, cookies, and passwords.
26+
27+
`openclaw migrate apply <provider>` previews the plan and prompts before changing state unless `--yes` is set. In non-interactive mode, apply requires `--yes`. With `--json` and no `--yes`, apply prints the JSON plan and does not mutate state.
28+
29+
Apply creates and verifies an OpenClaw backup before applying the migration. If no local OpenClaw state exists yet, the backup step is skipped and the migration can continue. To skip a backup when state exists, pass both `--no-backup` and `--force`.
30+
31+
Apply mode refuses to continue when the plan has conflicts. Review the plan, then rerun with `--overwrite` if replacing existing targets is intentional. Providers may still write item-level backups for overwritten files in the migration report directory.
32+
33+
Secrets are never imported by default. Use `--include-secrets` to import supported credentials.
34+
35+
## Hermes
36+
37+
The bundled Hermes provider detects Hermes state at `~/.hermes` by default. Use `--from <path>` when Hermes lives elsewhere.
38+
39+
The Hermes migration can import:
40+
41+
- default model configuration from `config.yaml`
42+
- configured model providers and custom OpenAI-compatible endpoints from `providers` and `custom_providers`
43+
- MCP server definitions from `mcp_servers` or `mcp.servers`
44+
- `SOUL.md` and `AGENTS.md` into the OpenClaw agent workspace
45+
- `memories/MEMORY.md` and `memories/USER.md` by appending them to workspace memory files
46+
- memory config defaults for OpenClaw file memory, plus archive/manual-review items for external memory providers such as Honcho
47+
- skills with a `SKILL.md` file from `skills/<name>/`
48+
- per-skill config values from `skills.config`
49+
- supported API keys from `.env`, only with `--include-secrets`
50+
51+
Archive-only Hermes state is copied into the migration report for manual review, but it is not loaded into live OpenClaw config or credentials. This preserves opaque or unsafe state such as `plugins/`, `sessions/`, `logs/`, `cron/`, `mcp-tokens/`, `auth.json`, and `state.db` without pretending OpenClaw can execute or trust it automatically.
52+
53+
Supported Hermes `.env` keys include `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `OPENROUTER_API_KEY`, `GOOGLE_API_KEY`, `GEMINI_API_KEY`, `GROQ_API_KEY`, `XAI_API_KEY`, `MISTRAL_API_KEY`, and `DEEPSEEK_API_KEY`.
54+
55+
After applying a migration, run:
56+
57+
```bash
58+
openclaw doctor
59+
```
60+
61+
## Plugin contract
62+
63+
Migration sources are plugins. A plugin declares its provider ids in `openclaw.plugin.json`:
64+
65+
```json
66+
{
67+
"contracts": {
68+
"migrationProviders": ["hermes"]
69+
}
70+
}
71+
```
72+
73+
At runtime the plugin calls `api.registerMigrationProvider(...)`. The provider implements `detect`, `plan`, and `apply`; core owns CLI orchestration, backup policy, prompts, JSON output, and conflict preflight. Core passes the reviewed plan into `apply(ctx, plan)`, and providers may rebuild the plan only when that argument is absent for compatibility. Provider plugins can use `openclaw/plugin-sdk/migration` for item construction and summary counts, plus `openclaw/plugin-sdk/migration-runtime` for conflict-aware file copies, archive-only report copies, and migration reports.
74+
75+
Onboarding can also offer migration when a provider detects a known source. `openclaw onboard --flow import` and `openclaw setup --wizard --import-from hermes` use the same plugin migration provider and still show a preview before applying. Onboarding imports require a fresh OpenClaw setup; reset config, credentials, sessions, and the workspace first if you already have local state. Backup plus overwrite or merge imports are feature-gated for existing setups.

docs/cli/onboard.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@ openclaw onboard
3636
openclaw onboard --modern
3737
openclaw onboard --flow quickstart
3838
openclaw onboard --flow manual
39+
openclaw onboard --flow import
40+
openclaw onboard --import-from hermes --import-source ~/.hermes
3941
openclaw onboard --skip-bootstrap
4042
openclaw onboard --mode remote --remote-url wss://gateway-host:18789
4143
```
4244

45+
`--flow import` uses plugin-owned migration providers such as Hermes. It only runs against a fresh OpenClaw setup; if existing config, credentials, sessions, or workspace memory/identity files are present, reset or choose a fresh setup before importing.
46+
4347
`--modern` starts the Crestodian conversational onboarding preview. Without
4448
`--modern`, `openclaw onboard` keeps the classic onboarding flow.
4549

@@ -176,6 +180,7 @@ openclaw onboard --non-interactive \
176180
<Accordion title="Flow types">
177181
- `quickstart`: minimal prompts, auto-generates a gateway token.
178182
- `manual`: full prompts for port, bind, and auth (alias of `advanced`).
183+
- `import`: runs a detected migration provider, previews the plan, then applies after confirmation.
179184
</Accordion>
180185
<Accordion title="Provider prefiltering">
181186
When an auth choice implies a preferred provider, onboarding prefilters the default-model and allowlist pickers to that provider. For Volcengine and BytePlus, this also matches the coding-plan variants (`volcengine-plan/*`, `byteplus-plan/*`).
@@ -194,6 +199,7 @@ openclaw onboard --non-interactive \
194199
- Local onboarding DM scope behavior: [CLI setup reference](/start/wizard-cli-reference#outputs-and-internals).
195200
- Fastest first chat: `openclaw dashboard` (Control UI, no channel setup).
196201
- Custom provider: connect any OpenAI or Anthropic compatible endpoint, including hosted providers not listed. Use Unknown to auto-detect.
202+
- If Hermes state is detected, onboarding offers a migration flow. Use [Migrate](/cli/migrate) for dry-run plans, overwrite mode, reports, and exact mappings.
197203
</Accordion>
198204
</AccordionGroup>
199205

docs/cli/setup.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Related:
2121
openclaw setup
2222
openclaw setup --workspace ~/.openclaw/workspace
2323
openclaw setup --wizard
24+
openclaw setup --wizard --import-from hermes --import-source ~/.hermes
2425
openclaw setup --non-interactive --mode remote --remote-url wss://gateway-host:18789 --remote-token <token>
2526
```
2627

@@ -30,6 +31,9 @@ openclaw setup --non-interactive --mode remote --remote-url wss://gateway-host:1
3031
- `--wizard`: run onboarding
3132
- `--non-interactive`: run onboarding without prompts
3233
- `--mode <local|remote>`: onboarding mode
34+
- `--import-from <provider>`: migration provider to run during onboarding
35+
- `--import-source <path>`: source agent home for `--import-from`
36+
- `--import-secrets`: import supported secrets during onboarding migration
3337
- `--remote-url <url>`: remote Gateway WebSocket URL
3438
- `--remote-token <token>`: remote Gateway token
3539

@@ -42,7 +46,8 @@ openclaw setup --wizard
4246
Notes:
4347

4448
- Plain `openclaw setup` initializes config + workspace without the full onboarding flow.
45-
- Onboarding auto-runs when any onboarding flags are present (`--wizard`, `--non-interactive`, `--mode`, `--remote-url`, `--remote-token`).
49+
- Onboarding auto-runs when any onboarding flags are present (`--wizard`, `--non-interactive`, `--mode`, `--import-from`, `--import-source`, `--import-secrets`, `--remote-url`, `--remote-token`).
50+
- If Hermes state is detected, interactive onboarding can offer migration automatically. Import onboarding requires a fresh setup; use [Migrate](/cli/migrate) for dry-run plans, backups, and overwrite mode outside onboarding.
4651

4752
## Related
4853

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,7 @@
15451545
"cli/gateway",
15461546
"cli/health",
15471547
"cli/logs",
1548+
"cli/migrate",
15481549
"cli/onboard",
15491550
"cli/reset",
15501551
"cli/secrets",

docs/plugins/manifest.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ read without importing the plugin runtime.
429429
"videoGenerationProviders": ["qwen"],
430430
"webFetchProviders": ["firecrawl"],
431431
"webSearchProviders": ["gemini"],
432+
"migrationProviders": ["hermes"],
432433
"tools": ["firecrawl_search", "firecrawl_scrape"]
433434
}
434435
}
@@ -450,6 +451,7 @@ Each list is optional:
450451
| `videoGenerationProviders` | `string[]` | Video-generation provider ids this plugin owns. |
451452
| `webFetchProviders` | `string[]` | Web-fetch provider ids this plugin owns. |
452453
| `webSearchProviders` | `string[]` | Web-search provider ids this plugin owns. |
454+
| `migrationProviders` | `string[]` | Import provider ids this plugin owns for `openclaw migrate`. |
453455
| `tools` | `string[]` | Agent tool names this plugin owns for bundled contract checks. |
454456

455457
`contracts.embeddedExtensionFactories` is retained for bundled Codex

docs/plugins/sdk-subpaths.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ For the plugin authoring guide, see [Plugin SDK overview](/plugins/sdk-overview)
1616

1717
## Plugin entry
1818

19-
| Subpath | Key exports |
20-
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
21-
| `plugin-sdk/plugin-entry` | `definePluginEntry` |
22-
| `plugin-sdk/core` | `defineChannelPluginEntry`, `createChatChannelPlugin`, `createChannelPluginBase`, `defineSetupPluginEntry`, `buildChannelConfigSchema` |
23-
| `plugin-sdk/config-schema` | `OpenClawSchema` |
24-
| `plugin-sdk/provider-entry` | `defineSingleProviderPluginEntry` |
19+
| Subpath | Key exports |
20+
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
21+
| `plugin-sdk/plugin-entry` | `definePluginEntry` |
22+
| `plugin-sdk/core` | `defineChannelPluginEntry`, `createChatChannelPlugin`, `createChannelPluginBase`, `defineSetupPluginEntry`, `buildChannelConfigSchema` |
23+
| `plugin-sdk/config-schema` | `OpenClawSchema` |
24+
| `plugin-sdk/provider-entry` | `defineSingleProviderPluginEntry` |
25+
| `plugin-sdk/migration` | Migration provider item helpers such as `createMigrationItem`, reason constants, item status markers, redaction helpers, and `summarizeMigrationItems` |
26+
| `plugin-sdk/migration-runtime` | Runtime migration helpers such as `copyMigrationFileItem` and `writeMigrationReport` |
2527

2628
<AccordionGroup>
2729
<Accordion title="Channel subpaths">

0 commit comments

Comments
 (0)