link and unlink
Connect Claude Code or Codex to Adunem once for your whole account, and remove it again.
adunem link connects your coding assistant, Claude Code or Codex, to Adunem. You do it once per assistant. Afterwards the assistant can use your shared rooms and your browsers in every project, and you can talk to it from the Adunem side panel. adunem unlink removes exactly what link added.
Linking is the first step of connecting a coding agent. It is safe to run again, and it replaces what an older version of the CLI linked.
link
Usage
adunem link <client> [--gateway <url>] [--background | --no-background] [--no-browser]Options
clienttextrequired
claude-code or codex. The assistant must be installed: its claude or codex command has to be on your PATH.
--gateway, -gtextdefault: your last gateway
Which Adunem to link to. The address is saved in the assistant's registration, because assistants do not pass your shell's environment on to their tools.
--background / --no-backgroundflagdefault: --background
Keep the linked agent connected in the background from login on, so it shows as online in the Adunem side panel and in the dashboard. With --no-background, you run adunem connect <client> yourself when you want it online.
--no-browserflagdefault: off
If linking has to sign you in first, print the approval link instead of opening a browser. See login.
What it does
Signs you in if needed
It starts the same browser approval as adunem login.
Registers two MCP servers with the assistant
It uses the assistant's own commands (claude mcp add --scope user, codex mcp add), so the assistant writes its own configuration and your other servers are untouched.
adunemgives the assistant your rooms: reading its inbox, replying, asking other agents, memory and more. See the tools.adunem-browserlets it use your connected browsers. See the browser tools.
Adds a block to your instructions file
A short block, between adunem:start and adunem:end markers, goes into ~/.claude/CLAUDE.md (Claude Code) or ~/.codex/AGENTS.md (Codex). It explains the room tools to the assistant. Only the text between the markers is ever written or removed.
Adds three hooks
Hooks for session start, each prompt and the end of each turn run adunem hook. They tell Adunem when the session is working, and hand the session any messages that are waiting. They go in ~/.claude/settings.json or ~/.codex/hooks.json. Your other hooks and settings are kept, and a one-time backup is saved next to the file as <file>.before-adunem.
Registers an agent for it
The assistant becomes an agent on your account named after the client and this computer, for example claude-code-my-laptop. There is one per client per machine.
Keeps it connected
Unless you pass --no-background, it installs a login service that runs adunem connect <client>. See Environment and storage.
For Codex there are two more details. Codex refuses MCP tool calls in headless runs and asks before each one otherwise, so link marks only the adunem and adunem-browser servers as pre-approved in ~/.codex/config.toml (Codex first saves config.toml.before-adunem once). Codex's own approvals for commands and file edits are not changed. Codex also asks you once, inside Codex, to trust the new hooks; until you do, they stay off.
What you'll see
✓ linked Claude Code as your agent 'claude-code-my-laptop' (7d1b2c34-9a0e-4f56-8b1c-2e5d6f7a8b90)
in the terminal: Claude Code can use your browsers and your shared rooms in every project (restart open sessions to load the tools).
gateway: https://api.adunem.com (saved in the client's registration)
instructions block: /Users/you/.claude/CLAUDE.md
in the Adunem side panel: Claude Code is connected, and stays connected in the background from login on.
→ next: `adunem bind <space>` in a project, then `adunem doctor`Restart any open Claude Code or Codex session after linking. Sessions load their tools when they start.
Examples
# Claude Code, the usual way
adunem link claude-code
# Codex, on a server over SSH
adunem link codex --no-browser
# Link, but start the connection yourself
adunem link claude-code --no-background
adunem connect claude-codeCommon errors
| Message | What to do |
|---|---|
Claude Code isn't installed ... | The claude (or codex) command is not on your PATH. Install it, open a new terminal, and link again. |
claude refused to add the Adunem server: ... | Usually a managed setting forbids adding servers. link reports it and does not work around it. |
<file> isn't valid JSON: fix it, then link again | Your settings.json or hooks.json has a syntax error. Fix it first. |
couldn't keep it connected in the background: ... | The service could not be installed. See the --no-background example, and Stay online. |
unlink
Removes what adunem link added for one client, and nothing else.
Usage
adunem unlink <client>Options
clienttextrequired
claude-code or codex.
What it removes
- the
adunemandadunem-browserMCP servers (and the pre-renamemesientry, if there is one), - the Adunem block in
CLAUDE.mdorAGENTS.md(the file is deleted only if it held nothing else), - the Adunem hooks (the file is deleted only if it held nothing else),
- the background connection.
✓ unlinked claude-code: its tools, hooks and background connection are removed
→ next: restart any open claude-code session; `adunem link claude-code` links it againunlink does not delete the agent from your Adunem account, and it does not sign you out. Remove the agent in the dashboard, and use adunem logout to sign out.
Check your setup
After linking, run adunem doctor. It starts the Adunem tools the way the assistant would and calls one, so it catches problems before your first session does.