Memory

Updated at:

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]
ParameterTypeRequiredDescription
--user-id <id>stringyesUser ID
--messages <json>stringnoMessages JSON array: [{"role":"user","content":"..."},...]
--content <text>stringnoCustom content text to memorize
--profile-schema <id>stringnoProfile schema ID for user profiling
--memory-library-id <id>stringnoMemory 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"

Search memory nodes by query or messages. Requires API Key authentication.

Usage

bl memory search --user-id <id> [--query <text>] [flags]
ParameterTypeRequiredDescription
--user-id <id>stringyesUser ID
--query <text>stringnoSearch query text
--messages <json>stringnoMessages JSON array for context-based search
--top-k <n>numbernoNumber of results to return (default: 10)
--memory-library-id <id>stringnoMemory 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]
ParameterTypeRequiredDescription
--user-id <id>stringyesUser ID
--page-size <n>numbernoResults per page (default: 10)
--page <n>numbernoPage number (default: 1)
--memory-library-id <id>stringnoMemory 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>
ParameterTypeRequiredDescription
--node-id <id>stringyesMemory node ID
--user-id <id>stringyesUser ID
--content <text>stringyesNew content for the memory node
--memory-library-id <id>stringnoMemory 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>
ParameterTypeRequiredDescription
--node-id <id>stringyesMemory node ID
--user-id <id>stringyesUser ID
--memory-library-id <id>stringnoMemory 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]
ParameterTypeRequiredDescription
--name <name>stringyesSchema name
--description <text>stringnoSchema description
--attributes <json>stringyesAttributes 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>
ParameterTypeRequiredDescription
--schema-id <id>stringyesProfile schema ID
--user-id <id>stringyesUser ID

Example: Fetch user profile data using schema and user IDs

bl memory profile get --schema-id schema_xxx --user-id user1