skills-experimental/context-suggestions/SKILL.md
Automatic context optimization suggestions. Detect bloat, large tool results, memory usage issues. Warn users and suggest actions to optimize context. Use when [context suggestions] is needed.
npx skillsauth add bianhaifeng789-hue/openclaw-config context-suggestionsInstall 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.
自动检测 Context 问题,提供优化建议。
场景:
Claude Code 方案:contextSuggestions.ts + 多阈值检测 OpenClaw 飞书适配:session_status + 飞书卡片建议
const LARGE_TOOL_RESULT_PERCENT = 15 // 工具结果 > 15% context
const LARGE_TOOL_RESULT_TOKENS = 10_000
const READ_BLOAT_PERCENT = 5 // Read 结果 > 5% context
const NEAR_CAPACITY_PERCENT = 80 // Context > 80%
const MEMORY_HIGH_PERCENT = 5 // Memory > 5% context
const MEMORY_HIGH_TOKENS = 5_000
检测:Context >= 80%
建议:
"Context is 80% full.
Autocompact will trigger soon.
Use /compact now to control what gets kept."
检测:某个工具结果 > 15% context
建议:
"FileReadTool result is 20% of context (15k tokens).
Consider using readFileInRange to limit scope."
检测:Read 结果累计 > 5% context
建议:
"Read results total 10% of context.
Consider using GrepTool first to narrow scope."
检测:MEMORY.md > 5% context
建议:
"MEMORY.md is 8% of context (6k tokens).
Consider consolidating or archiving old entries."
检测:Autocompact 禁用
建议:
"Autocompact is disabled.
Use /compact to free space, or enable in config."
{
"config": {"wide_screen_mode": true},
"elements": [
{
"tag": "div",
"text": {
"tag": "lark_md",
"content": "**💡 Context 建议**\n\n**当前状态**:107k/128k (84%) ⚠️\n\n**建议**:\n\n🔴 **接近上限**:Context 已达 84%\n→ 建议:执行 /compact 或等待自动触发\n\n🟡 **大工具结果**:FileReadTool 占用 15%\n→ 建议:使用 readFileInRange 限制范围\n\n🟢 **可节省**:约 20k tokens\n\n**优先级**:Warning > Info"
}
},
{
"tag": "action",
"actions": [
{
"tag": "button",
"text": {"tag": "plain_text", "content": "执行 Compact"},
"type": "primary",
"value": {"action": "compact"}
},
{
"tag": "button",
"text": {"tag": "plain_text", "content": "查看详情"},
"type": "default",
"value": {"action": "view_context_detail"}
}
]
}
]
}
Heartbeat:
1. 获取 session_status(Context 百分比)
2. 检查各类阈值
3. 生成建议列表
4. 按优先级排序(Warning > Info)
5. 如果有 Warning,发送飞书卡片
function generateContextSuggestions(data: ContextData): ContextSuggestion[] {
const suggestions: ContextSuggestion[] = []
checkNearCapacity(data, suggestions)
checkLargeToolResults(data, suggestions)
checkReadResultBloat(data, suggestions)
checkMemoryBloat(data, suggestions)
checkAutoCompactDisabled(data, suggestions)
// 按优先级排序
suggestions.sort((a, b) => {
if (a.severity !== b.severity) {
return a.severity === 'warning' ? -1 : 1
}
return (b.savingsTokens ?? 0) - (a.savingsTokens ?? 0)
})
return suggestions
}
// memory/context-suggestions-state.json
{
"lastCheck": "2026-04-11T23:00:00Z",
"suggestions": [
{
"severity": "warning",
"title": "Context is 84% full",
"detail": "Autocompact will trigger soon",
"savingsTokens": 20000,
"timestamp": "2026-04-11T23:00:00Z"
}
],
"stats": {
"checksPerformed": 0,
"warningsIssued": 0,
"suggestionsAccepted": 0
}
}
| Claude Code | OpenClaw 飞书场景 | |-------------|------------------| | ContextData(内部) | session_status | | checkNearCapacity | 同样检测 | | checkLargeToolResults | 同样检测 | | generateContextSuggestions | 同样生成 | | Terminal UI | 飞书卡片建议 |
此 Skill 由 Heartbeat 定期检查,接近阈值时自动发送建议。
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