← 返回 Skills 市场
janussilence

Context Manager

作者 JanusSilence · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
93
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install autoglm-context-manager
功能描述
管理多个 AI Agent 的长期记忆与文件,通过向量和时间双重过滤,实现高效语义检索和减少 LLM 调用。
使用说明 (SKILL.md)

Context Manager Skill

长上下文管理器技能。为多个 AI Agent 提供智能的长期记忆管理,通过向量索引和时间轴双重命中判断,大幅减少 LLM 调用次数。

🎯 适用场景

当用户需要:

  • 管理多个 Agent 的文件和上下文
  • 在大型项目中快速检索相关信息
  • 减少 LLM 调用以降低成本
  • 建立长期记忆系统
  • 在多个 Agent 之间共享上下文
  • 基于语义相似度搜索文件
  • 按时间维度过滤和检索内容

📋 功能清单

Agent 管理

  • 创建新的 Agent
  • 查看 Agent 列表
  • 获取 Agent 详情
  • 删除 Agent

文件管理

  • 为 Agent 创建文件
  • 获取文件内容
  • 列出 Agent 的所有文件
  • 删除文件

智能检索

  • 语义向量搜索
  • 时间轴过滤
  • 双重命中判断(向量+时间)
  • 智能调取详情
  • LLM 集成(可选)

🚀 使用方法

基本用法

创建 Agent

为项目 "文档编写" 创建一个 Agent

创建文件

将以下内容保存到 Agent "agent001" 的文件 "设计文档.md" 中:
[文件内容]

查询

在 Agent "agent001" 中搜索 "深度学习算法"

查询(带详情)

查找 "微服务架构设计" 相关内容,并获取详情

列出文件

显示 Agent "agent001" 的所有文件

高级用法

带标签的文件

创建一个关于 "机器学习" 的文件,标签为 "research, ai, ml"

跨 Agent 搜索

在所有 Agent 中搜索 "Python 编程"

强制 LLM 调用

用 LLM 分析 "如何优化数据库查询" 相关内容

🔧 配置

环境变量(可选)

# OpenAI API Key(用于 LLM 功能)
export OPENAI_API_KEY="your-api-key"

# Redis 配置(用于缓存)
export CONTEXT_MANAGER_REDIS_HOST="localhost"
export CONTEXT_MANAGER_REDIS_PORT=6379

配置参数(可选)

config.py 中可调整:

  • vector_threshold: 向量相似度阈值(默认 0.7)
  • time_threshold: 时间相关性阈值(默认 0.5)
  • combined_threshold: 综合评分阈值(默认 0.6)
  • cache_ttl: 缓存过期时间(默认 3600 秒)

📊 工作原理

文件索引流程

  1. 接收文件内容
  2. 生成向量嵌入
  3. 存储到向量数据库
  4. 提取时间轴信息
  5. 更新索引

智能检索流程

  1. 向量搜索找到相关文件
  2. 时间轴过滤
  3. 双重命中判断
  4. 智能调取详情
  5. LLM 集成(如需要)

💡 最佳实践

  1. 文件命名:使用有意义的文件名
  2. 标签使用:为文件添加相关主题标签
  3. 时间标签:使用时间标签帮助时间轴匹配
  4. 批量操作:批量创建文件以提高效率
  5. 定期清理:删除不再需要的文件

⚠️ 注意事项

  • 文件内容会进行向量嵌入,需要网络连接(首次)
  • LLM 功能需要配置 OpenAI API Key
  • Redis 可选,未配置时使用内存缓存
  • 向量数据库存储在本地 vector_db 目录

🔄 数据存储

所有数据存储在:

~/.openclaw-autoclaw/workspace/context-manager/
├── agents/           # Agent 数据
├── vector_db/        # 向量数据库
├── cache/            # 缓存数据
└── logs/             # 日志文件

📈 性能优化

预期效果:

  • LLM 调用减少:60-80%
  • 检索速度提升:10-50 倍
  • 项目完成度显著提高

🔍 技术栈

  • 向量数据库: ChromaDB
  • 嵌入模型: Sentence Transformers
  • 缓存: Redis + 内存
  • API: FastAPI
  • LLM: OpenAI GPT(可选)

🛠️ 故障排除

问题:向量数据库初始化失败

解决:删除 vector_db 目录后重试

问题:Redis 连接失败

解决:系统会自动使用内存缓存

问题:LLM 调用超时

解决:检查网络连接和 API Key 配置

📚 示例对话

用户:为 "研究项目" 创建一个 Agent
AI:✓ 已创建 Agent "research-project"

用户:将以下内容保存到研究项目的文件 "文献综述.md":
深度学习是机器学习的一个子集...
AI:✓ 文件 "文献综述.md" 已创建并索引(索引时间: 452ms)

用户:在研究项目中搜索 "神经网络"
AI:找到 3 个相关文件:
1. 文献综述.md(相似度: 0.89)
2. 算法总结.md(相似度: 0.76)
3. 项目计划.md(相似度: 0.65)

用户:获取 "神经网络" 相关内容的详情
AI:已获取 2 个文件的详情。LLM 回复:
[详细答案]

🎓 更多信息

查看完整文档: cat ~/.openclaw-autoclaw/workspace/context-manager/README.md

运行示例: python ~/.openclaw-autoclaw/workspace/context-manager/example.py

🔗 相关技能

  • memory - 简单的内存管理
  • wecom-doc - 企业微信文档管理
安全使用建议
What to consider before installing: - The bundle does not include the core 'context_manager' implementation it claims to use. skill.py expects to import that module from ~/.openclaw-autoclaw/workspace/context-manager; verify what code actually exists at that path before enabling the skill. - Because the skill adds that workspace path to Python's import path, any module named context_manager placed there will be executed by the skill. Only proceed if you trust the code in that directory or you control it. - The SKILL.md mentions optional use of an OpenAI API key and Redis. Only provide those secrets if you trust the skill and the code it imports; a malicious context_manager implementation could exfiltrate keys or data to remote endpoints. - The included demo (skill_demo.py) is safe and in-memory; consider running the demo first to verify behavior. Do not run the full skill until you inspect or install a trusted context_manager implementation and its dependencies (chromadb, sentence-transformers, etc.). - Recommended steps to reduce risk: inspect ~/.openclaw-autoclaw/workspace/context-manager for unexpected files, run the demo in an isolated environment, install third-party dependencies from trusted sources, and monitor network activity when first using the skill. If you can provide the missing context_manager implementation or confirm its source (e.g., a trusted GitHub repo), I can reassess the coherence and risk with higher confidence.
功能分析
Type: OpenClaw Skill Name: autoglm-context-manager Version: 1.0.0 The skill bundle implements a legitimate context management system for AI agents, utilizing vector indexing (ChromaDB) and semantic search to manage long-term memory. The code in skill.py and skill_demo.py provides standard CRUD operations for agents and files, as well as search functionality. While the test scripts (final_test.py, simple_test.py) contain hardcoded local file paths (e.g., C:\Users\TIANXIN-01\...), these appear to be artifacts of a local development environment rather than malicious indicators. No evidence of data exfiltration, unauthorized execution, or prompt injection was found.
能力评估
Purpose & Capability
The SKILL.md and description claim a full system (ChromaDB, sentence-transformers, Redis, optional OpenAI integration, FastAPI) but the distributed files do not include the core 'context_manager' implementation or vector DB code. Instead, skill.py appends ~/.openclaw-autoclaw/workspace/context-manager to sys.path and attempts to import a context_manager module that is not bundled. That means the skill delegates essential functionality to external code expected to live in the user's home workspace — a coherence gap between claimed capabilities and what's actually provided.
Instruction Scope
The SKILL.md instructs creating agents, saving files, and running example scripts under ~/.openclaw-autoclaw/workspace/context-manager/ and mentions network usage for embeddings/LLM. The included demo implementation (skill_demo.py) operates only in-memory and does not perform embeddings or network calls. Real embedding/LLM behavior would come from the absent context_manager module; SKILL.md also tells the user to run python example and cat README from that workspace, which implies the agent may read local files during normal operations.
Install Mechanism
There is no install spec and no packaged implementation of the heavy dependencies (ChromaDB, sentence-transformers, etc.). The skill expects external components to be installed in the user's workspace. The absence of a controlled install path means arbitrary or third-party code under ~/.openclaw-autoclaw/workspace/context-manager will be imported and executed when the skill runs.
Credentials
No required environment variables or credentials are declared. SKILL.md documents optional OPENAI_API_KEY and Redis settings that are proportionate to the described (optional) LLM and cache features. Requesting an OpenAI key for optional LLM integration aligns with the stated functionality.
Persistence & Privilege
The skill does not request always:true and has no declared system-wide config access. However, it modifies sys.path to include a directory in the user's home workspace and will import whatever 'context_manager' exists there; that design means the skill will execute code from that workspace if present, which is a behavioral privilege to be aware of (not an automatic platform-level escalation, but still a runtime execution surface).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install autoglm-context-manager
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /autoglm-context-manager 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: Long-term memory management for multi-agent systems with vector search and timeline filtering
元数据
Slug autoglm-context-manager
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Context Manager 是什么?

管理多个 AI Agent 的长期记忆与文件,通过向量和时间双重过滤,实现高效语义检索和减少 LLM 调用。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 93 次。

如何安装 Context Manager?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install autoglm-context-manager」即可一键安装,无需额外配置。

Context Manager 是免费的吗?

是的,Context Manager 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Context Manager 支持哪些平台?

Context Manager 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Context Manager?

由 JanusSilence(@janussilence)开发并维护,当前版本 v1.0.0。

💬 留言讨论