openclaw/docs/cli/users.md
Peter Steinberger b1694b364c
feat(users): merge duplicate user profiles (#159889)
* feat(users): merge duplicate user profiles

Expose the existing profile merge owner through the admin-only users.merge
RPC and openclaw users merge <source> --into <target>. Support email-less
duplicates, exact-repeat success, and exact head validation. Preserve merge
semantics and historical attribution without changing database or protocol
versions. Reuse worker admission/publication and retire affected live authority.

Document transfer rules and add registered RPC, CLI, and authority boundary
coverage. Regenerate the Android method enum with the protocol generators.

Validation: five merge RPC tests (16.55s test time, 79.99s wrapper wall), six
CLI tests (3.46s wrapper wall), and three sibling administration tests pass.
The Gateway/CLI test graphs and core production types pass. Codex review is
scoped-clean through P2. The initial changed-file assertion failure was fixed
with runtime validation; remaining native checks were continued separately.
Broader test types and core lint encounter two unchanged base-fixture errors
already fixed upstream by 0b6f02faae (#159836).

* test(gateway): register users.merge as a current-release method

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-09-27 16:18:08 -07:00

2.7 KiB

summary read_when title
CLI reference for `openclaw users` (profiles, email aliases, and duplicate merges)
You need to find a durable Gateway profile ID
You want to link an email alias or merge duplicate profiles
Users

openclaw users

Manage durable Gateway profiles through the Gateway RPC API. These profiles identify people; they are separate from the CLI's --profile option, which selects an isolated OpenClaw configuration and state directory.

Common options

  • --url <url>: Gateway WebSocket URL; defaults to gateway.remote.url when configured.
  • --token <token>: Gateway token, if required.
  • --timeout <ms>: RPC timeout in milliseconds; defaults to 10000.
  • --json: Print the Gateway result as JSON.

Place these options after the subcommand.

List profiles

openclaw users list
openclaw users list --json

Requires operator.read. Human output lists each profile's ID, display name, and email aliases. Use the durable IDs when linking or merging profiles.

openclaw users link-email person@example.com --to <profile-id>

Requires operator.admin. Calls users.linkEmail to move one email alias to the target profile. If the previous profile loses its last email, it merges into the target. Otherwise, it remains a separate profile with its other aliases.

Merge duplicate profiles

openclaw users merge <source-profile-id> --into <target-profile-id>
openclaw users merge <source-profile-id> --into <target-profile-id> --json

Requires operator.admin. Calls users.merge with sourceProfileId and targetProfileId. Use this when both profiles belong to the same person and the whole source profile should retire, including when it has no email aliases.

The target must be an existing, unmerged profile distinct from the source. The shared Owner profile cannot be merged in either direction. Repeating an already completed merge into the same target succeeds. If the source points to another survivor, the command fails and names that current profile.

Human output names the survivor and retired ID. JSON returns profile, the surviving profile, and movedAliasKinds, the alias categories actually moved: email, provider, or channel. An unchanged repeat returns an empty list.

The survivor keeps its role, display name, primary identity, and conflicting preferences and account choices. Logins, channel links, and personal accounts follow the survivor under the existing merge rules. History keeps its original attribution; previously captured authority for the retired profile does not transfer. See Merging duplicate profiles for transfer rules and personal USER.md handling.