docs(skills): refresh mem0 skills against SDK 2.2.1 / TS 3.3.1 (#7548)
This commit is contained in:
@@ -13,6 +13,8 @@ Everything about configuring the mem0 CLI: config file format, environment varia
|
||||
|
||||
The restricted permissions ensure API keys are not world-readable.
|
||||
|
||||
Saving an API key also updates an existing `env.MEM0_API_KEY` entry in `~/.claude/settings.json` and existing `export MEM0_API_KEY=...` lines in `~/.zshrc`, `~/.bashrc`, and `~/.bash_profile`. It never creates new entries.
|
||||
|
||||
---
|
||||
|
||||
## Config File Schema
|
||||
@@ -28,7 +30,19 @@ The restricted permissions ensure API keys are not world-readable.
|
||||
},
|
||||
"platform": {
|
||||
"api_key": "",
|
||||
"base_url": "https://api.mem0.ai"
|
||||
"base_url": "https://api.mem0.ai",
|
||||
"user_email": "",
|
||||
"agent_mode": false,
|
||||
"created_via": "",
|
||||
"agent_caller": "",
|
||||
"claimed_at": "",
|
||||
"default_user_id": ""
|
||||
},
|
||||
"telemetry": {
|
||||
"anonymous_id": ""
|
||||
},
|
||||
"agent_rush": {
|
||||
"acknowledged_at": ""
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -44,12 +58,20 @@ The restricted permissions ensure API keys are not world-readable.
|
||||
| `defaults.run_id` | string | `""` | Default run ID for scoping commands. |
|
||||
| `platform.api_key` | string | `""` | API key for the Mem0 Platform. |
|
||||
| `platform.base_url` | string | `"https://api.mem0.ai"` | Base URL for API requests. |
|
||||
| `platform.user_email` | string | `""` | Email used for login or claim. Also cached from the ping response during `init`. |
|
||||
| `platform.agent_mode` | boolean | `false` | `true` while the key is an unclaimed Agent Mode key. |
|
||||
| `platform.created_via` | string | `""` | How the key was obtained: `agent_mode`, `email`, `api_key`, or `existing_key`. |
|
||||
| `platform.agent_caller` | string | `""` | Agent name set by `--agent-caller` or `mem0 identify`. |
|
||||
| `platform.claimed_at` | string | `""` | ISO timestamp once an Agent Mode account is claimed. |
|
||||
| `platform.default_user_id` | string | `""` | `user_<slug>` returned by the Agent Mode bootstrap. Printed by `mem0 whoami`. |
|
||||
| `telemetry.anonymous_id` | string | `""` | Persistent anonymous ID used for telemetry. |
|
||||
| `agent_rush.acknowledged_at` | string | `""` | ISO timestamp when the `agent-rush` public-memory warning was acknowledged. |
|
||||
|
||||
---
|
||||
|
||||
## `mem0 init` Wizard
|
||||
|
||||
The `init` command provides two authentication flows:
|
||||
The `init` command provides three authentication flows: API key, email login, and Agent Mode (see [Agent Mode Init](#agent-mode-init)).
|
||||
|
||||
### API Key Flow (default)
|
||||
|
||||
@@ -65,17 +87,17 @@ mem0 init --api-key m0-xxx --user-id alice
|
||||
|
||||
1. Displays the mem0 banner.
|
||||
2. Checks for existing config. If found with an API key, asks for confirmation to overwrite.
|
||||
3. Prompts for API key (input masked with `*` characters; supports backspace and Ctrl+U to clear).
|
||||
4. Prompts for default user ID (default value: `mem0-cli`).
|
||||
5. Validates the connection by calling the status endpoint.
|
||||
6. Saves config to `~/.mem0/config.json` with `0600` permissions.
|
||||
7. Prints success message.
|
||||
3. Asks how to authenticate (`1` email login, recommended; `2` enter an API key) unless `--api-key` was passed.
|
||||
4. For option 2, prompts for the API key (input masked with `*` characters; supports backspace and Ctrl+U to clear).
|
||||
5. Prompts for default user ID (default value: `$USER`, then `$USERNAME`, then `mem0-cli`) unless `--user-id` was passed.
|
||||
6. Validates the connection by calling the status endpoint. A failed check prints an error but the config is still saved.
|
||||
7. Saves config to `~/.mem0/config.json` with `0600` permissions.
|
||||
8. Prints success message.
|
||||
|
||||
**Non-interactive mode:** When both `--api-key` and `--user-id` are provided, skips all prompts and saves directly. When running in a non-TTY without both flags, prints an error:
|
||||
**Non-interactive mode:** When both `--api-key` and `--user-id` are provided, skips all prompts and saves directly. In a non-TTY, `--api-key` alone is enough: the user ID falls back to `$USER`, then `$USERNAME`, then `mem0-cli`. A non-TTY without `--api-key` (and without `--email` or an Agent Mode signal) prints an error:
|
||||
|
||||
```
|
||||
Non-interactive terminal detected and missing required flags.
|
||||
Usage: mem0 init --api-key <key> --user-id <id>
|
||||
Non-interactive terminal detected and --api-key is required.
|
||||
```
|
||||
|
||||
### Email Login Flow
|
||||
@@ -92,14 +114,23 @@ mem0 init --email alice@company.com --code 482901
|
||||
|
||||
1. Sends a 6-digit verification code to the email via `POST /api/v1/auth/email_code/`.
|
||||
2. If `--code` is provided, verifies immediately. Otherwise prompts for the code.
|
||||
3. On success: receives API key, org_id, and project_id from the server.
|
||||
4. Saves to config. Creates a new account if the email is not registered.
|
||||
3. On success: receives the API key from the server and saves it with `platform.user_email` and `platform.created_via: "email"`. The default user ID is `--user-id`, else `$USER`, else `mem0-cli`.
|
||||
|
||||
Cannot be combined with `--api-key`.
|
||||
Without `--code` in a non-TTY, `init` sends the code and exits with an error telling you to rerun with `--code`. `--code` requires `--email`, and `--email` cannot be combined with `--api-key`.
|
||||
|
||||
**Claiming an Agent Mode account:** If the existing config is an unclaimed Agent Mode key (`platform.agent_mode: true`), `mem0 init --email <email> [--code <code>]` claims that key for the email instead of minting a new one. The API key stays the same.
|
||||
|
||||
### Agent Mode Init
|
||||
|
||||
```bash
|
||||
mem0 init --agent --agent-caller <name> --json
|
||||
```
|
||||
|
||||
With `init --agent`, `init --json`, or an agent environment variable (such as `CLAUDECODE`, `CURSOR_AGENT`, `CODEX_CLI`, `CLINE`, `AIDER_SESSION`, `GOOSE_AGENT`, `WINDSURF_AGENT`) and no `--api-key` or `--email`, `init` first reuses a valid `MEM0_API_KEY` or a valid key already in the config. Only when there is no valid key does it mint a new Agent Mode key via `POST /api/v1/auth/agent_mode/`, which is limited to 5 signups per day per network. See [command-reference.md](command-reference.md) for the `init` flags and `identify`.
|
||||
|
||||
### Force Overwrite
|
||||
|
||||
If `~/.mem0/config.json` already exists with an API key, `mem0 init` warns and asks for confirmation. Use `--force` to skip:
|
||||
If `~/.mem0/config.json` already exists with an API key, `mem0 init` warns and asks for confirmation (in a non-TTY it exits 1 with "Existing config would be overwritten." instead). Use `--force` to skip:
|
||||
|
||||
```bash
|
||||
mem0 init --api-key m0-new-key --user-id alice --force
|
||||
@@ -111,7 +142,7 @@ mem0 init --api-key m0-new-key --user-id alice --force
|
||||
|
||||
### `mem0 config show`
|
||||
|
||||
Displays the current configuration as a formatted table (text mode) or JSON envelope (json mode). API keys are always redacted.
|
||||
Displays `defaults.*`, `platform.api_key` (redacted), and `platform.base_url` as a formatted table (text mode) or JSON envelope (json mode). Other `platform.*` fields are not shown.
|
||||
|
||||
```bash
|
||||
mem0 config show
|
||||
@@ -120,7 +151,7 @@ mem0 config show -o json
|
||||
|
||||
### `mem0 config get <key>`
|
||||
|
||||
Reads a single configuration value. The key uses dotted notation.
|
||||
Reads a single configuration value. The key uses dotted notation or a short alias (`api_key`, `base_url`, `user_email`, `user_id`, `agent_id`, `app_id`, `run_id`).
|
||||
|
||||
```bash
|
||||
mem0 config get platform.api_key # prints: m0-x...xxxx (redacted)
|
||||
@@ -130,12 +161,13 @@ mem0 config get defaults.user_id # prints: alice
|
||||
**Valid keys:**
|
||||
- `platform.api_key`
|
||||
- `platform.base_url`
|
||||
- `platform.user_email`
|
||||
- `defaults.user_id`
|
||||
- `defaults.agent_id`
|
||||
- `defaults.app_id`
|
||||
- `defaults.run_id`
|
||||
|
||||
Unknown keys print an error message.
|
||||
Python also resolves any other field path in the config (for example `platform.created_via`); Node accepts only the keys above and their short aliases. Unknown keys print "Unknown config key: <key>" and still exit 0, so check the output rather than the exit code. In `--json`/`--agent` mode `config get` and `config set` return `{"key": ..., "value": ...}` in the envelope.
|
||||
|
||||
### `mem0 config set <key> <value>`
|
||||
|
||||
@@ -148,17 +180,9 @@ mem0 config set platform.base_url https://api.mem0.ai
|
||||
|
||||
**Type coercion:**
|
||||
- Boolean fields accept `true`, `1`, `yes` (case-insensitive) as true. Anything else is false.
|
||||
- Integer fields are parsed with `parseInt`.
|
||||
- Integer fields are parsed as integers (Node `parseInt`, Python `int`; Python rejects a non-numeric value as an unknown key).
|
||||
- String fields are stored as-is.
|
||||
|
||||
### `mem0 config clear`
|
||||
|
||||
Removes the config file (`~/.mem0/config.json`).
|
||||
|
||||
```bash
|
||||
mem0 config clear
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
@@ -173,6 +197,7 @@ Environment variables override config file values but are overridden by CLI flag
|
||||
| `MEM0_AGENT_ID` | `defaults.agent_id` | string | `""` |
|
||||
| `MEM0_APP_ID` | `defaults.app_id` | string | `""` |
|
||||
| `MEM0_RUN_ID` | `defaults.run_id` | string | `""` |
|
||||
| `MEM0_TELEMETRY` | n/a | string | enabled. Set to `false` to disable anonymous telemetry. |
|
||||
|
||||
---
|
||||
|
||||
@@ -218,7 +243,10 @@ The `config get` and `config set` commands use dotted key paths. Here is the ful
|
||||
|------------|---------|-------|
|
||||
| `platform.api_key` | platform | api_key |
|
||||
| `platform.base_url` | platform | base_url |
|
||||
| `platform.user_email` | platform | user_email |
|
||||
| `defaults.user_id` | defaults | user_id |
|
||||
| `defaults.agent_id` | defaults | agent_id |
|
||||
| `defaults.app_id` | defaults | app_id |
|
||||
| `defaults.run_id` | defaults | run_id |
|
||||
|
||||
Short aliases (`api_key`, `base_url`, `user_email`, `user_id`, `agent_id`, `app_id`, `run_id`) map to the same fields. Python additionally resolves any other dotted field path.
|
||||
|
||||
Reference in New Issue
Block a user