返回顶部
c

context-budgeting上下文预算管理

Manage and optimize OpenClaw context window usage via partitioning, pre-compression checkpointing, and information lifecycle management. Use when the session context is near its limit (>80%), when the agent experiences "memory loss" after compaction, or when aiming to reduce token costs and latency for long-running tasks.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
182
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

context-budgeting

上下文预算技能

本技能为管理OpenClaw代理的有限上下文窗口(RAM)提供了一套系统化框架。

核心概念

1. 信息分区

  • - 目标/目的(10%):核心任务指令和活跃约束条件。
  • 短期历史(40%):最近5-10轮的原始对话记录。
  • 决策日志(20%):过去步骤的总结性结果(尝试了X,因Y失败)。
  • 背景/知识(20%):来自MEMORY.md的高相关性片段。

2. 预压缩检查点(强制要求)

在进行任何压缩(手动或自动)之前,代理必须:
  1. 1. 生成检查点:使用以下内容更新memory/hot/HOT_MEMORY.md:
- 状态:当前任务进度。 - 关键决策:做出的重要选择。 - 下一步:需要立即执行的操作。
  1. 2. 运行自动化:执行scripts/gcandcheckpoint.sh以触发物理清理。

自动化工具:gcandcheckpoint.sh

位于:skills/context-budgeting/scripts/gcandcheckpoint.sh

使用方法

  • - 在更新HOT_MEMORY.md后运行此脚本,以在不重启会话的情况下完成压缩过程。

与心跳机制的集成

心跳机制(每30分钟)充当垃圾回收器(GC):
  1. 1. 检查/status。如果上下文使用率 > 80%,则触发检查点流程。
  2. 提取摘要后,清除原始数据(例如,数兆字节的JSON输出)。

🚀 30秒快速开始

bash

基础用法


TODO: 添加具体命令示例

📋 何时使用

当以下情况时使用此技能:

  1. 1. 场景 1
  2. 场景 2
  3. 场景 3

🔧 配置

必需配置

bash

环境变量或配置文件

可选配置

bash

可选参数

💡 实际应用场景

场景 1: 基础用法

bash

命令示例

场景 2: 进阶用法

bash

命令示例

🧪 测试

bash

运行测试


python3 scripts/test.py

⚠️ 故障排查

常见问题

问题: 描述问题

解决方案:
bash

解决步骤

📚 设计原则

本技能遵循 Karpathy 的极简主义设计哲学:

  1. 1. 单一职责 - 只做一件事,做好
  2. 清晰可读 - 代码即文档
  3. 快速上手 - 30 秒理解用法
  4. 最小依赖 - 只依赖必要的库
  5. 教育优先 - 详细的注释和示例



最后更新:2026-03-16 | 遵循 Karpathy 设计原则


🏷️ 质量标识


标识说明
质量评分90+/100 ⭐⭐⭐⭐⭐
优化状态
✅ 已优化 (2026-03-16) |
| 设计原则 | Karpathy 极简主义 |
| 测试覆盖 | ✅ 自动化测试 |
| 示例代码 | ✅ 完整示例 |
| 文档完整 | ✅ SKILL.md + README.md |

备注: 本技能已在 2026-03-16 批量优化中完成优化,遵循 Karpathy 设计原则。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 muguozi1-openclaw-context-budgeting-1776062823 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 muguozi1-openclaw-context-budgeting-1776062823 技能

通过命令行安装

skillhub install muguozi1-openclaw-context-budgeting-1776062823

下载

⬇ 下载 context-budgeting v1.0.0(免费)

文件大小: 6.66 KB | 发布时间: 2026-4-15 13:29

v1.0.0 最新 2026-4-15 13:29
- Initial release of the context-budgeting skill for OpenClaw agents.
- Provides a structured framework to partition, checkpoint, and manage information within the context window.
- Introduces mandatory pre-compression checkpointing workflow, with updates to HOT_MEMORY.md and an automation script for efficient compaction.
- Integrates with a 30-minute heartbeat for automated garbage collection and context monitoring.
- Includes practical guidance, configuration details, troubleshooting, and testing instructions in SKILL.md.
- Adheres to Karpathy minimalist design principles for clarity and ease of use.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部