← 返回 Skills 市场
mkgnbear

Context Budgeting Pro

作者 MKGNBEAR · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
374
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install context-budgeting-v2
功能描述
Manage and optimize OpenClaw context window usage via partitioning, pre-compression checkpointing, and information lifecycle management. Use when the session...
使用说明 (SKILL.md)

Context Budgeting Skill

This skill provides a systematic framework for managing the finite context window (RAM) of an OpenClaw agent.

Core Concepts

1. Information Partitioning

  • Objective/Goal (10%): Core task instructions and active constraints.
  • Short-term History (40%): Recent 5-10 turns of raw dialogue.
  • Decision Logs (20%): Summarized outcomes of past steps ("Tried X, failed because Y").
  • Background/Knowledge (20%): High-relevance snippets from MEMORY.md.

2. Pre-compression Checkpointing (Mandatory)

Before any compaction (manual or automatic), the agent MUST:

  1. Generate Checkpoint: Update memory/hot/HOT_MEMORY.md with:
    • Status: Current task progress.
    • Key Decision: Significant choices made.
    • Next Step: Immediate action required.
  2. Run Automation: Execute scripts/gc_and_checkpoint.sh to trigger the physical cleanup.

Automation Tool: gc_and_checkpoint.sh

Located at: skills/context-budgeting/scripts/gc_and_checkpoint.sh

Usage:

  • Run this script after updating HOT_MEMORY.md to finalize the compaction process without restarting the session.

Integration with Heartbeat

Heartbeat (every 30m) acts as the Garbage Collector (GC):

  1. Check /status. If Context > 80%, trigger the Checkpointing procedure.
  2. Clear raw data (e.g., multi-megabyte JSON outputs) once the summary is extracted.
安全使用建议
This skill appears to do what it says (manage context), but it contains unsafe assumptions and omissions. Before installing: (1) review and edit scripts/gc_and_checkpoint.sh — replace the hard-coded WORKSPACE with a configurable path and verify it points to the intended directory; (2) confirm the 'openclaw' CLI exists and is the correct binary, and add that as a declared dependency; (3) back up HOT_MEMORY.md and any large raw outputs — compaction can delete or permanently discard raw data; (4) test the script in a non-production environment to confirm behavior; (5) ask the author why no required binaries/config paths were declared and request explicit documentation for the heartbeat /status check; (6) if you cannot verify the script and its effects, do not run it with real sessions or sensitive data. These issues look like sloppy configuration rather than clearly malicious code, but they create an elevated risk of accidental data loss or unintended session changes.
功能分析
Type: OpenClaw Skill Name: context-budgeting-v2 Version: 1.0.0 The skill bundle is designed for managing an AI agent's context window through information partitioning and session compaction. The primary script, `scripts/gc_and_checkpoint.sh`, performs legitimate maintenance tasks such as triggering the OpenClaw CLI to compact sessions and referencing a local memory file. While it contains a hardcoded user path (/Users/yang/clawd), there is no evidence of data exfiltration, malicious execution, or prompt injection intended to subvert the agent's behavior.
能力评估
Purpose & Capability
The skill claims to manage context but the distributed artifacts reveal mismatches: the provided script invokes an 'openclaw' CLI and references a hard-coded workspace (/Users/yang/clawd), yet the registry metadata declares no required binaries or config paths. A context-budgeting tool plausibly needs an OpenClaw control mechanism, but the skill should declare that dependency and a configurable workspace path instead of embedding a specific user's path.
Instruction Scope
SKILL.md mandates creating/updating memory/hot/HOT_MEMORY.md and running the script to 'finalize compaction' and instructs removing large raw data after summarization. Those actions directly modify local session state and can cause loss of raw outputs if run incorrectly. The instructions also reference a 'Heartbeat' check and '/status' without specifying how to access that status endpoint or what privileges are required.
Install Mechanism
There is no install spec (instruction-only) which limits on-disk risk, but the included scripts/gc_and_checkpoint.sh will run locally and call external binaries. The lack of an install spec is not itself dangerous, but the script assumes the presence of an 'openclaw' command and a specific filesystem layout without declaring or installing them.
Credentials
The skill requests no environment variables or credentials, which superficially looks benign, but the script accesses a hard-coded absolute path and will read/write HOT_MEMORY.md under that workspace. This is disproportionate because the skill did not declare the need to access that path or the openclaw CLI; it therefore may unexpectedly touch user files. No secrets are requested, however.
Persistence & Privilege
The skill is not always-enabled and does not request persistent privileges. It does invoke session compaction via the OpenClaw CLI which alters agent/session state — a legitimate action for this skill — but combined with the undeclared dependency and hard-coded path, it increases the risk of unintended state changes.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-budgeting-v2
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-budgeting-v2 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the context-budgeting skill for OpenClaw agents. - Introduces a structured framework for managing context window usage, including partitioning information into objectives, history, decision logs, and background knowledge. - Implements mandatory pre-compression checkpointing with updates to `HOT_MEMORY.md` and automation via `gc_and_checkpoint.sh`. - Integrates an automated heartbeat mechanism to monitor context usage and trigger cleanup when limits are exceeded. - Aims to minimize token costs, reduce latency, and prevent memory loss during long-running sessions.
元数据
Slug context-budgeting-v2
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Context Budgeting Pro 是什么?

Manage and optimize OpenClaw context window usage via partitioning, pre-compression checkpointing, and information lifecycle management. Use when the session... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 374 次。

如何安装 Context Budgeting Pro?

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

Context Budgeting Pro 是免费的吗?

是的,Context Budgeting Pro 完全免费(开源免费),可自由下载、安装和使用。

Context Budgeting Pro 支持哪些平台?

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

谁开发了 Context Budgeting Pro?

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

💬 留言讨论