Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
16 changes: 11 additions & 5 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
12 changes: 12 additions & 0 deletions cortex-mem-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <id>` for other commands.

## ⚙️ Configuration

### Configuration File
Expand Down
50 changes: 44 additions & 6 deletions litho.docs/en/5.Boundary-Interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 44 additions & 6 deletions litho.docs/zh/5、系统边界.md
Original file line number Diff line number Diff line change
Expand Up @@ -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接口
Expand Down