From abbfc88bf135d3707c0d5686e46f0e73f79acb18 Mon Sep 17 00:00:00 2001 From: Sopaco Date: Fri, 27 Feb 2026 17:51:20 +0800 Subject: [PATCH] docs update --- README.md | 16 ++++-- README_zh.md | 16 ++++-- cortex-mem-cli/README.md | 12 +++++ litho.docs/en/5.Boundary-Interfaces.md | 50 ++++++++++++++++--- ...73\347\273\237\350\276\271\347\225\214.md" | 50 ++++++++++++++++--- 5 files changed, 122 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f9054d9..55995d6 100644 --- a/README.md +++ b/README.md @@ -525,15 +525,21 @@ cortex-mem-cli --config config.toml --tenant acme session create thread-456 --ti cortex-mem-cli --config config.toml --tenant acme session close thread-456 ``` -#### Sync and Stats -Synchronize filesystem with vector store and display system statistics. +#### Sync, Layers, and Stats +Synchronize filesystem with vector store, manage layer files, and display system statistics. ```sh -# Manual synchronization between filesystem and vector store -cortex-mem-cli --config config.toml --tenant acme sync - # Display system statistics cortex-mem-cli --config config.toml --tenant acme stats + +# List available tenants +cortex-mem-cli --config config.toml tenant list + +# Show L0/L1 layer file coverage status +cortex-mem-cli --config config.toml --tenant acme layers status + +# Generate missing L0/L1 layer files +cortex-mem-cli --config config.toml --tenant acme layers ensure-all ``` ### REST API (`cortex-mem-service`) diff --git a/README_zh.md b/README_zh.md index f3c170e..9001c5a 100644 --- a/README_zh.md +++ b/README_zh.md @@ -527,15 +527,21 @@ cortex-mem-cli --config config.toml --tenant acme session create thread-456 --ti cortex-mem-cli --config config.toml --tenant acme session close thread-456 ``` -#### 同步和统计 -同步文件系统与向量存储并显示系统统计信息。 +#### 层级管理和统计 +管理层级文件并显示系统统计信息。 ```sh -# 文件系统与向量存储之间的手动同步 -cortex-mem-cli --config config.toml --tenant acme sync - # 显示系统统计信息 cortex-mem-cli --config config.toml --tenant acme stats + +# 列出可用租户 +cortex-mem-cli --config config.toml tenant list + +# 显示L0/L1层级文件覆盖状态 +cortex-mem-cli --config config.toml --tenant acme layers status + +# 生成缺失的L0/L1层级文件 +cortex-mem-cli --config config.toml --tenant acme layers ensure-all ``` ### REST API (`cortex-mem-service`) diff --git a/cortex-mem-cli/README.md b/cortex-mem-cli/README.md index f9e9f94..9409f96 100644 --- a/cortex-mem-cli/README.md +++ b/cortex-mem-cli/README.md @@ -186,6 +186,18 @@ Displays: - Total message count - Data directory path +### Tenant Commands + +#### List Tenants + +List all available tenant IDs to help you identify the correct `--tenant` parameter value. + +```bash +cortex-mem tenant list +``` + +Output displays all tenant IDs found in the data directory. Use the desired tenant ID with `--tenant ` for other commands. + ## ⚙️ Configuration ### Configuration File diff --git a/litho.docs/en/5.Boundary-Interfaces.md b/litho.docs/en/5.Boundary-Interfaces.md index 2e59357..79faf42 100644 --- a/litho.docs/en/5.Boundary-Interfaces.md +++ b/litho.docs/en/5.Boundary-Interfaces.md @@ -6,20 +6,58 @@ This document describes the system's external invocation interfaces, including C ### cortex-mem-cli -**Description**: Command-line interface for interacting with the Cortex-Mem system, supporting operations like search, add, list, and configuration loading. +**Description**: Command-line interface for interacting with the Cortex-Mem system, supporting operations like search, add, list, get, delete, session management, layer management, and tenant management. **Source File**: `cortex-mem-cli/src/main.rs` -**Arguments**: +**Global Options**: -- `config` (string): required - Path to the configuration file (TOML format) -- `scope` (string): optional - Scope of the search operation (e.g., user, system) -- `limit` (integer): optional - Maximum number of results to return (default: `10`) +| Option | Short | Default | Description | +|--------|-------|---------|-------------| +| `--config` | `-c` | `config.toml` | Path to configuration file | +| `--tenant` | | `default` | Tenant identifier (use `tenant list` to see available tenants) | +| `--verbose` | `-v` | `false` | Enable verbose/debug logging | + +**Available Commands**: + +| Command | Description | +|---------|-------------| +| `session` | Session management (create, list) | +| `add` | Add a message to a session | +| `search` | Search memories using semantic vector search | +| `list` | List memories in a directory | +| `get` | Get a specific memory by URI | +| `delete` | Delete a memory by URI | +| `layers` | Layer management (L0/L1 files) | +| `stats` | Show system statistics | +| `tenant` | Tenant management (list available tenants) | **Usage Examples**: ```bash -cortex-mem-cli --config config.toml search "user preferences" --scope user --limit 5 +# List available tenants +cortex-mem -c config.toml tenant list + +# Create a session +cortex-mem -c config.toml session create my-session --title "My Session" + +# Add a message +cortex-mem -c config.toml add --thread my-session "Hello, this is a test message" + +# Search for memories +cortex-mem -c config.toml search "user preferences" --scope user --limit 5 + +# List memories +cortex-mem -c config.toml list --uri cortex://user + +# Get a specific memory +cortex-mem -c config.toml get cortex://session/my-session/timeline/2024/01/15/14_30_00_abc123.md + +# Show statistics +cortex-mem -c config.toml stats + +# Generate missing L0/L1 layer files +cortex-mem -c config.toml layers ensure-all ``` ## API Interfaces diff --git "a/litho.docs/zh/5\343\200\201\347\263\273\347\273\237\350\276\271\347\225\214.md" "b/litho.docs/zh/5\343\200\201\347\263\273\347\273\237\350\276\271\347\225\214.md" index 4f23a41..a95bb82 100644 --- "a/litho.docs/zh/5\343\200\201\347\263\273\347\273\237\350\276\271\347\225\214.md" +++ "b/litho.docs/zh/5\343\200\201\347\263\273\347\273\237\350\276\271\347\225\214.md" @@ -6,20 +6,58 @@ ### cortex-mem-cli -**描述**: 用于与Cortex-Mem系统交互的命令行界面,支持搜索、添加、列出和配置加载等操作。 +**描述**: 用于与Cortex-Mem系统交互的命令行界面,支持搜索、添加、列出、获取、删除、会话管理、层级管理和租户管理等操作。 **源文件**: `cortex-mem-cli/src/main.rs` -**参数**: +**全局选项**: + +| 选项 | 简写 | 默认值 | 描述 | +|--------|-------|---------|-------------| +| `--config` | `-c` | `config.toml` | 配置文件路径 | +| `--tenant` | | `default` | 租户标识符(使用 `tenant list` 查看可用租户) | +| `--verbose` | `-v` | `false` | 启用详细/调试日志 | + +**可用命令**: -- `config` (字符串): 必需 - 配置文件路径(TOML格式) -- `scope` (字符串): 可选 - 搜索操作的作用域(如user、system) -- `limit` (整数): 可选 - 返回的最大结果数(默认: `10`) +| 命令 | 描述 | +|---------|-------------| +| `session` | 会话管理(创建、列出) | +| `add` | 向会话添加消息 | +| `search` | 使用语义向量搜索记忆 | +| `list` | 列出目录中的记忆 | +| `get` | 通过URI获取特定记忆 | +| `delete` | 通过URI删除记忆 | +| `layers` | 层级管理(L0/L1文件) | +| `stats` | 显示系统统计信息 | +| `tenant` | 租户管理(列出可用租户) | **使用示例**: ```bash -cortex-mem-cli --config config.toml search "user preferences" --scope user --limit 5 +# 列出可用租户 +cortex-mem -c config.toml tenant list + +# 创建会话 +cortex-mem -c config.toml session create my-session --title "我的会话" + +# 添加消息 +cortex-mem -c config.toml add --thread my-session "你好,这是一条测试消息" + +# 搜索记忆 +cortex-mem -c config.toml search "用户偏好" --scope user --limit 5 + +# 列出记忆 +cortex-mem -c config.toml list --uri cortex://user + +# 获取特定记忆 +cortex-mem -c config.toml get cortex://session/my-session/timeline/2024/01/15/14_30_00_abc123.md + +# 显示统计信息 +cortex-mem -c config.toml stats + +# 生成缺失的L0/L1层级文件 +cortex-mem -c config.toml layers ensure-all ``` ## API接口