multi-chat-context-manager

TotalClaw 作者 skill-factory v1.0.2

用于存储和检索每个频道/用户的对话上下文的 CLI 工具。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~derick001-multi-chat-context-manager
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~derick001-multi-chat-context-manager/file -o derick001-multi-chat-context-manager.md
# Multi-Chat Context Manager

## What This Does

A simple CLI tool to store, retrieve, and clear conversation contexts. Contexts are saved as JSON, keyed by channel/user/thread IDs. This is a utility library, not an auto-integration plugin.

## When To Use

- You need to manually store conversation history per channel or user
- You want a simple key-value context store for your scripts
- You're building custom integrations and need context persistence

## Usage

Store a conversation:
python3 scripts/context_manager.py store --channel "telegram-123" --user "user-456" --message "Hello" --response "Hi there"

Retrieve context:
python3 scripts/context_manager.py retrieve --channel "telegram-123" --user "user-456"

Clear context:
python3 scripts/context_manager.py clear --channel "telegram-123"

List all contexts:
python3 scripts/context_manager.py list

## Examples

### Example 1: Store and retrieve

Store:
python3 scripts/context_manager.py store --channel "discord-general" --user "john" --message "What is AI?" --response "AI is artificial intelligence."

Retrieve:
python3 scripts/context_manager.py retrieve --channel "discord-general" --user "john"

Output:
{
  "channel_id": "discord-general",
  "user_id": "john",
  "history": [{"message": "What is AI?", "response": "AI is artificial intelligence."}]
}

## Requirements

- Python 3.x
- No external dependencies

## Limitations

- This is a CLI tool, not an auto-integration plugin
- Does not automatically intercept messages from platforms
- Stores data in plaintext JSON (not encrypted)
- No file-locking for concurrent access
- You must call it manually from your scripts or workflows

---

## 中文说明

# Multi-Chat Context Manager

## 功能说明

一个简单的 CLI 工具,用于存储、检索和清除对话上下文。上下文以 JSON 形式保存,按 channel/user/thread ID 作为键。这是一个实用工具库,而非自动集成插件。

## 何时使用

- 你需要按频道或用户手动存储对话历史
- 你想要一个供脚本使用的简单键值上下文存储
- 你正在构建自定义集成,需要上下文持久化

## 用法

存储一段对话:
python3 scripts/context_manager.py store --channel "telegram-123" --user "user-456" --message "Hello" --response "Hi there"

检索上下文:
python3 scripts/context_manager.py retrieve --channel "telegram-123" --user "user-456"

清除上下文:
python3 scripts/context_manager.py clear --channel "telegram-123"

列出所有上下文:
python3 scripts/context_manager.py list

## 示例

### 示例 1:存储并检索

存储:
python3 scripts/context_manager.py store --channel "discord-general" --user "john" --message "What is AI?" --response "AI is artificial intelligence."

检索:
python3 scripts/context_manager.py retrieve --channel "discord-general" --user "john"

输出:
{
  "channel_id": "discord-general",
  "user_id": "john",
  "history": [{"message": "What is AI?", "response": "AI is artificial intelligence."}]
}

## 要求

- Python 3.x
- 无外部依赖

## 局限性

- 这是一个 CLI 工具,而非自动集成插件
- 不会自动拦截来自各平台的消息
- 以明文 JSON 存储数据(未加密)
- 没有用于并发访问的文件锁
- 你必须从自己的脚本或工作流中手动调用它