Overview
Introduction
The Command Line Setup allows you to install the Mem0 command-line interface, initialize your user or agent account, and manage credentials directly from your terminal. Whether you are setting up a standard user account or bootstrapping an unattended agent environment, the initialization wizard guides you through authentication, configuration storage, and identity management.
Interactive Setup and Authentication
When you first run the setup wizard, you can choose between logging in with your email address or manually entering an API key.
Step-by-Step Initialization
To configure your terminal environment and connect to Mem0, follow these steps:
- Launch the setup wizard: Run the initialization command in your terminal.
mem0 init - Select your authentication method: When prompted, choose whether to sign in using your email address (recommended) or by providing an API key manually.
- Verify your identity: If you chose email login, enter your email address and type the verification code sent to your inbox when prompted.
- Set your default user scope: Define a default user identifier to scope your memories, or press Enter to accept the recommended default based on your system username.
Note
Saved credentials and configuration settings are automatically stored in your user directory at ~/.mem0/config.json.
Non-Interactive and Automated Setup
Introduction
For automated scripts, continuous integration environments, or unattended terminal setups, you can pass command-line options directly to skip interactive prompts.
Command Options
| Option | Description |
|---|---|
--api-key <key> | Provide an API key directly to skip the setup prompt. |
-u, --user-id <id> | Set a default user ID for scoping your memories. |
--email <email> | Start the email verification login flow. |
--code <code> | Provide the email verification code for non-interactive login. |
--agent | Bootstrap an unattended Agent Mode account without requiring an email. |
--source <channel> | Provide channel attribution for signups (e.g., github, hn, ph). |
--agent-caller <name> | Self-declare your AI agent identity (e.g., claude-code, cursor). |
--force | Overwrite an existing configuration file without prompting for confirmation. |
Quick Setup Examples
- Standard initialization:
mem0 init - Non-interactive API key setup:
mem0 init --api-key m0-xxx --user-id alice - Non-interactive email login:
mem0 init --email you@example.com --code 123456 - Unattended Agent Mode bootstrap:
mem0 init --agent --agent-caller claude-code
Tip
If you already have a valid API key configured in your environment variables via MEM0_API_KEY, the CLI will automatically detect and reuse it during initialization.
Agent Mode and Account Management
Introduction
Mem0 supports Agent Mode for AI coding assistants and autonomous agents. This allows an agent to bootstrap a functional memory store instantly without requiring a manual email sign-up step.
Managing Agent Identity
- Bootstrap Agent Mode: Run the initialization command with the agent flag to create an unattended account:
mem0 init --agent - Tag your active agent: If you did not specify an agent caller during bootstrap, you can tag your active key later using the identify command:
mem0 identify claude-code - Check your active identity: Print your current agent identifier (AGENTRUSH identifier) using the whoami command:
mem0 whoami
Important
Supported self-declared agent identities include: claude-code, cursor, and custom bot names.
Claiming an Agent Account
If you started using Mem0 in Agent Mode and want to upgrade your account to a permanent human-owned profile linked to your email address, you can claim the account at any time:
mem0 init --email you@example.comThis process uses a verification code sent to your inbox to link your existing agent API key to your email address without changing or invalidating your current key.