skills-experimental/context-collapse/SKILL.md
Collapse repetitive read/search tool calls into summary lines to reduce context token usage. Use when: - Multiple consecutive file reads or searches in a session - Context window is getting large - Repeated bash/grep/glob operations - Hook summaries need aggregation Keywords: collapse, context, token, summarize reads, fold messages
npx skillsauth add bianhaifeng789-hue/openclaw-config context-collapseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
基于 Claude Code collapseReadSearch 系列工具的上下文折叠机制,减少重复操作的 token 占用。
Claude Code 有 4 个 collapse 工具:
把连续的读/搜索操作折叠成一行摘要:
[已读取 5 个文件,搜索 3 次] → 展开查看详情
可折叠的操作:
不可折叠:
把多个 hook 执行摘要折叠:
[3 个 hooks 执行完成: 2 成功, 1 警告]
把 teammate agent 关闭消息折叠:
[2 个 agents 已完成]
把后台 bash 通知折叠:
[5 个后台命令已完成]
在以下情况检查是否需要折叠:
检测连续读/搜索序列:
- 统计连续的 read/search 工具调用
- 如果 >= 3 个连续操作:
生成摘要: "读取了 N 个文件 (file1, file2, ...)"
替换为单行摘要
保留最后一个完整结果
统计信息:
- searchCount: 搜索次数
- readCount: 读取次数
- fileList: 涉及的文件列表(最多显示 5 个)
// 统计末尾连续的 search/read 活动
function summarizeRecentActivities(activities) {
let searchCount = 0, readCount = 0
for (let i = activities.length - 1; i >= 0; i--) {
if (activities[i].isSearch) searchCount++
else if (activities[i].isRead) readCount++
else break // 遇到非 read/search 停止
}
if (searchCount > 0 && readCount > 0)
return `搜索 ${searchCount} 次,读取 ${readCount} 个文件`
if (searchCount > 0) return `搜索 ${searchCount} 次`
if (readCount > 0) return `读取 ${readCount} 个文件`
}
| 特性 | Claude Code | OpenClaw 适配 | |------|-------------|---------------| | 触发时机 | 渲染时自动折叠 | 手动/上下文警告时触发 | | 展示 | TUI 可展开组件 | 飞书文本摘要 | | 粒度 | 消息级别 | 工具调用批次级别 |
当检测到大量读操作时,在回复中使用折叠摘要:
[已扫描 12 个文件: src/utils/*.ts (8个), src/services/*.ts (4个)]
关键发现: ...
而不是逐一列出每个文件的读取结果。
business
IAA 日报飞书输出能力。 支持把固定 CSV 模板一键转换成: - 中文运营结论 - 飞书卡片 JSON - 飞书发送载荷 Use when: - 需要把 IAA 日报直接发到飞书 - 需要从 CSV 一键生成运营日报
data-ai
IAA日报分析模型 功能: - 渠道日报自动分析 - 小时级+日级ROI联动判断 - 按地区输出加量/降量/停投建议 - 按产品类型输出阈值 - 自动识别利润区/观察区/止损区 Use when: - 分析每天投放数据 - 生成运营日报结论 - 判断是否加量/降量/停投 - 对比美加澳/日韩表现 Keywords: - 日报模型, 投放日报, 加量, 降量, 停投, ROI日报, 分地区分析
data-ai
IAA固定日报分析模板 功能: - 固定字段模板(可直接贴每天数据) - 自动输出总盘结论 - 自动输出美加澳/日韩结论 - 自动给出加量/降量/停投建议 - 适配文件修复/清理两类产品 Use when: - 需要固定日报格式 - 每天复盘渠道表现 - 给运营团队出统一结论 Keywords: - 固定模板, 日报模板, ROI模板, IAA日报, 运营模板
development
# HyperlinkPool Pattern Skill HyperlinkPool Pattern - HyperlinkPool class + strings array + stringMap + Index 0 no hyperlink + intern(hyperlink) + get(id) + undefined handling + 5-minute reset + OSC8 hyperlink interning。 ## 功能概述 从Claude Code的ink/screen.ts提取的HyperlinkPool模式,用于OpenClaw的OSC8超链接池管理。 ## 核心机制 ### HyperlinkPool Class ```typescript export class HyperlinkPool { private strings: string[] = [''] // Index 0 = no hyperlink private stringMap = new Map<string, number>() // strings