Memory
Bailian CLI command reference for managing long-term memory and user profiles.
Manage Bailian long-term memory from the terminal: create, read, update, and delete memories, and manage user-profile schemas.
NoteLong-term memory capabilities are currently available only to China site (aliyun.com) accounts.
ImportantAppend --help to any command for full parameter details, e.g. bl memory search --help. Command details on this page are verified against bl 2.2.1.
See the Memory for feature-page usage.
Command reference
bl memory add
Add memory from messages or custom content. Requires API Key authentication.
Usage
bl memory add --user-id <id> [--messages <json>] [--content <text>] [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--user-id <id> | string | yes | User ID |
--messages <json> | string | no | Messages JSON array: [{"role":"user","content":"..."},...] |
--content <text> | string | no | Custom content text to memorize |
--profile-schema <id> | string | no | Profile schema ID for user profiling |
--memory-library-id <id> | string | no | Memory library ID (isolate memory space) |
Example: Add custom content to user memory with user ID and content
bl memory add --user-id user1 --content "The user likes Python programming"
bl memory search
Search memory nodes by query or messages. Requires API Key authentication.
Usage
bl memory search --user-id <id> [--query <text>] [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--user-id <id> | string | yes | User ID |
--query <text> | string | no | Search query text |
--messages <json> | string | no | Messages JSON array for context-based search |
--top-k <n> | number | no | Number of results to return (default: 10) |
--memory-library-id <id> | string | no | Memory library ID |
Example: Search user memory using query and user ID
bl memory search --user-id user1 --query "programming preferences"
bl memory list
List memory nodes for a user. Requires API Key authentication.
Usage
bl memory list --user-id <id> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--user-id <id> | string | yes | User ID |
--page-size <n> | number | no | Results per page (default: 10) |
--page <n> | number | no | Page number (default: 1) |
--memory-library-id <id> | string | no | Memory library ID |
Example: List all memory nodes for a specific user
bl memory list --user-id user1
bl memory update
Update a memory node content. Requires API Key authentication.
Usage
bl memory update --node-id <id> --user-id <id> --content <text>
| Parameter | Type | Required | Description |
|---|---|---|---|
--node-id <id> | string | yes | Memory node ID |
--user-id <id> | string | yes | User ID |
--content <text> | string | yes | New content for the memory node |
--memory-library-id <id> | string | no | Memory library ID (non-default library) |
Example: Update memory node content with node and user IDs
bl memory update --node-id node_xxx --user-id user1 --content "updated memory content"
bl memory delete
Delete a memory node. Requires API Key authentication.
Usage
bl memory delete --node-id <id> --user-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--node-id <id> | string | yes | Memory node ID |
--user-id <id> | string | yes | User ID |
--memory-library-id <id> | string | no | Memory library ID (non-default library) |
Example: Delete a memory node using node and user IDs
bl memory delete --node-id node_xxx --user-id user1
bl memory profile create
Create a user profile schema for memory profiling. Requires API Key authentication.
Usage
bl memory profile create --name <name> --attributes <json> [flags]
| Parameter | Type | Required | Description |
|---|---|---|---|
--name <name> | string | yes | Schema name |
--description <text> | string | no | Schema description |
--attributes <json> | string | yes | Attributes JSON array: [{"name":"age","description":"age"}] |
Example: Create a user profile schema with attributes and name
bl memory profile create --name "user_basic" --attributes '[{"name":"age","description":"age"},{"name":"hobby","description":"hobby"}]'
bl memory profile get
Get user profile by schema ID and user ID. Requires API Key authentication.
Usage
bl memory profile get --schema-id <id> --user-id <id>
| Parameter | Type | Required | Description |
|---|---|---|---|
--schema-id <id> | string | yes | Profile schema ID |
--user-id <id> | string | yes | User ID |
Example: Fetch user profile data using schema and user IDs
bl memory profile get --schema-id schema_xxx --user-id user1