← Back to Skills Marketplace
fangbb-coder

session-compactor

by fangbb-coder · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
141
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install session-compactor
Description
自动会话压缩以优化 token 使用。当会话消息数超过阈值时,将早期历史压缩为结构化摘要,保留工具调用和关键事实。适用于长对话场景以节省上下文窗口。核心算法参考 claw-code 项目的 compact.rs 设计。
Usage Guidance
要点与建议: - 功能与实现:本技能为本地 Node.js 实现,会估算 token 并将早期消息用单条 system 消息摘要替换;压缩是不可逆的。若对历史对话重要,请先备份会话或禁用自动压缩。 - 切勿直接运行 deploy.sh:deploy.sh 会把当前目录内容推送到一个硬编码的 GitHub 仓库(GITHUB_USERNAME="fangbb-coder")。该脚本本身不窃取数据,但如果你在包含敏感内容的目录运行它,会把本地文件推到远端仓库。审查并修改远程 URL 或不要运行该脚本,除非你明确想把这些文件推到该 GitHub 账号下的仓库。 - 元数据不一致(低风险但警示):registry metadata/version 与 package.json/_meta.json/SKILL.md 中的版本、作者、仓库 URL 在若干地方不一致(例如 package.json 指向 your-username,deploy.sh 硬编码 fangbb-coder,_meta.json 的 owner 不同)。这通常表示打包/维护不严格;在生产环境部署前应做基本代码审查。 - 未来功能风险:文档提到未来可能集成 LLM API(例如 GPT)和将压缩历史备份到外部存储(Redis/DB)。这些增强会需要凭据并引入网络通信,安装或升级到包含这些特性的版本时要重新审核请求的环境变量和网络行为。 - 使用建议:在将 autoCompact 打开到生产会话前,先在非敏感数据上做 dry-run;设置较高的 maxTokens 并监控 savedTokens;阅读并理解 scripts/compact_session.js 的行为;不要把包含敏感信息的会话目录直接推到远端仓库。
Capability Analysis
Type: OpenClaw Skill Name: session-compactor Version: 1.0.0 The session-compactor skill is a legitimate utility designed to manage LLM context windows by summarizing older conversation history. The core logic in `scripts/compact_session.js` performs local text processing, token estimation, and regex-based fact extraction without any external network requests, sensitive file access, or obfuscation. The accompanying `deploy.sh` and documentation are consistent with the stated purpose of the tool and do not contain malicious instructions or prompt injection attempts.
Capability Assessment
Purpose & Capability
技能声明为会话压缩并只要求 node 二进制;代码(scripts/compact_session.js)和文档实现了描述的压缩逻辑。所需资源和声明的目的相符。
Instruction Scope
SKILL.md 指示在 openclaw 配置中启用、可以手动或自动调用压缩工具,运行时说明仅处理会话消息并生成摘要;没有发现指令要求读取或上传与压缩无关的系统文件或隐蔽地收集凭据。
Install Mechanism
没有自动安装规范(instruction-only 风格),主要以 Node.js 脚本提供,风险较低。注意 deploy.sh 存在并会将本地仓库推送到外部 GitHub 帐号(见下文),该脚本是本地运行的但会将文件公开到远端仓库——在运行前需审查并确认目标远程地址。
Credentials
技能不要求任何环境变量或凭据,代码也未包含对外部 API 密钥或敏感凭据的调用。当前功能不会请求或使用与其目的不相干的凭证。
Persistence & Privilege
技能未设置 always:true,也不修改其他技能或系统配置。它以导出模块和 CLI 形式存在,允许手动/自动调用(平台默认),没有请求持久驻留或额外权限。
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install session-compactor
  3. After installation, invoke the skill by name or use /session-compactor
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Session-compactor v1.0.0 – Initial Release - Introduces automated session compression to optimize token usage in long conversations. - Compresses early session history into structured summaries while preserving tool calls and key facts. - Features auto and manual trigger modes; configurable via `openclaw.config.json`. - Inspired by the compact.rs algorithm from the claw-code project. - Provides a compact_session tool for manual invocation. - Chinese documentation included for setup, usage, and key parameters.
Metadata
Slug session-compactor
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is session-compactor?

自动会话压缩以优化 token 使用。当会话消息数超过阈值时,将早期历史压缩为结构化摘要,保留工具调用和关键事实。适用于长对话场景以节省上下文窗口。核心算法参考 claw-code 项目的 compact.rs 设计。 It is an AI Agent Skill for Claude Code / OpenClaw, with 141 downloads so far.

How do I install session-compactor?

Run "/install session-compactor" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is session-compactor free?

Yes, session-compactor is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does session-compactor support?

session-compactor is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created session-compactor?

It is built and maintained by fangbb-coder (@fangbb-coder); the current version is v1.0.0.

💬 Comments