360 Secure SkillHub
360 安全技能中心

Multi-Chat Context Manager

这是一个本地命令行工具,用 Python 脚本把会话上下文以 JSON 形式按渠道、用户、线程键值保存,支持 store、retrieve、clear、list 四个子命令,数据为明文存储,需由使用者手动在脚本或工作流中调用。

derick001
derick001
热度 87.08
最近更新 2026-05-11 17:27:08
分类:知识依赖:代码执行 / 读写文件应用场景:笔记整理 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add multi-chat-context-manager
Metadata
name
multi-chat-context-manager
description
CLI tool to store and retrieve conversation contexts per channel/user.
version
1.0.2
author
skill-factory
metadata
{"openclaw":{"requires":{"bins":["python3"]}}}

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