← 返回 Skills 市场
sundevilatb

Context Slimmer

作者 SunDevilATB · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
1429
总下载
0
收藏
6
当前安装
1
版本数
在 OpenClaw 中安装
/install context-slimmer
功能描述
Audit and slim down always-loaded context files (AGENTS.md, TOOLS.md, USER.md, MEMORY.md, HEARTBEAT.md, SOUL.md, IDENTITY.md). Use when asked to reduce token usage, audit context files, optimize context window, or slim down workspace files. Measures current token cost and identifies what to move, remove, or compress.
使用说明 (SKILL.md)

Context Slimmer

Audit workspace files that load into every message and reduce their token footprint.

Quick Start

# Measure current context cost
bash scripts/measure.sh

# Full audit (outputs recommendations)
bash scripts/measure.sh --audit

Audit Process

For each always-loaded file, evaluate:

  1. Move to skill — Content only needed for specific tasks (betting config, group chat rules, detailed protocols). Move to a skill or reference file that loads on demand.
  2. Remove — Outdated info, dead features, completed one-time setup, duplicated content across files.
  3. Compress — Verbose explanations that could be 1 sentence. If the agent already knows it, cut it.

Rules of Thumb

  • If a cron job handles it, remove it from HEARTBEAT.md
  • If it's in SOUL.md, don't repeat it in MEMORY.md or AGENTS.md
  • If it's in USER.md, don't repeat it in MEMORY.md
  • If the agent does it daily, it doesn't need instructions — just a trigger word
  • Prefer 1 sentence over 5 bullets saying the same thing
  • Target: each file should justify every line's token cost

Expected File Sizes (lean targets)

File Target
AGENTS.md \x3C 500 tokens
TOOLS.md \x3C 500 tokens
USER.md \x3C 700 tokens
MEMORY.md \x3C 400 tokens
HEARTBEAT.md \x3C 400 tokens
SOUL.md \x3C 250 tokens
IDENTITY.md \x3C 50 tokens
Total \x3C 2,800 tokens

Output Format

Report: current size, projected size, savings per file. Include specific recommendations grouped by move/remove/compress.

安全使用建议
This skill is low-risk code-wise (no network calls, no credentials), but it is incomplete and slightly inconsistent with its own documentation. Before installing or running it: (1) review the script to confirm it only examines files you want checked; it reads the workspace path you supply (or the current directory) and will print counts/flags for those files; (2) don't run it pointed at sensitive directories unless you intend to scan them; (3) note the script does not produce the detailed move/remove/compress recommendations or projected savings promised by SKILL.md — you'll need to produce those recommendations yourself (or pair the output with manual review or an LLM prompt); (4) be aware the CLI usage in the README is slightly mismatched with the script's argument parsing (the script treats the second positional argument as workspace), so test it in a safe directory first. If you expect fully automated slimming recommendations, request an updated script that computes per-file projected sizes and explicit move/remove/compress suggestions and that documents correct argument usage.
功能分析
Type: OpenClaw Skill Name: context-slimmer Version: 1.0.0 The `scripts/measure.sh` file contains a shell injection vulnerability. The `WORKSPACE` variable, which can be supplied as the second argument to the script, is used directly in shell commands (e.g., `wc -c < "$filepath"`, `grep`). This allows for arbitrary command execution if an attacker can control the `WORKSPACE` argument, making it a critical Remote Code Execution (RCE) vulnerability. While the skill's stated purpose and other functionalities are benign, this lack of input sanitization makes the skill suspicious.
能力评估
Purpose & Capability
The skill claims to audit always-loaded context files and reduce token footprint; the provided scripts/measure.sh measures file sizes, approximates tokens, flags over-target files, and runs a light duplicate/verbosity checklist — which aligns with the stated purpose. However SKILL.md promises a full 'report' with projected sizes, savings per file, and concrete move/remove/compress recommendations. The script does not compute projected sizes, per-file savings, or generate concrete move/remove/compress suggestions, so the delivered capability is weaker than claimed.
Instruction Scope
SKILL.md instructs running scripts/measure.sh (with --audit and --workspace flags). The script reads the listed files from the workspace and prints checks — no network I/O — which is expected. Concerns: (1) the script's argument handling is inconsistent with the Quick Start: it inspects $1 for --audit and treats $2 as WORKSPACE, so the documented '--workspace /path' usage may not behave as expected; (2) the SKILL.md promises automated slimming recommendations but the script only emits counts/flags and limited duplicate-detection info, not move/remove/compress recommendations; (3) the script will read files from whatever directory is passed (or the current working directory), so running it against an unintended path could examine different files. None of these are inherently malicious, but they are functional mismatches and a small user-safety concern.
Install Mechanism
No install spec and the skill is instruction-only with a small local bash script. No downloads or external installers are used, which minimizes install risk.
Credentials
The skill requests no environment variables, no credentials, and no config paths. The script only reads files in the provided workspace path — this matches the stated purpose and is proportionate.
Persistence & Privilege
The skill is not always-loaded and uses default agent-invocable behavior. It does not request permanent presence or modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-slimmer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-slimmer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: audit and slim down always-loaded context files. Includes measure.sh script for token counting and duplicate detection.
元数据
Slug context-slimmer
版本 1.0.0
许可证
累计安装 7
当前安装数 6
历史版本数 1
常见问题

Context Slimmer 是什么?

Audit and slim down always-loaded context files (AGENTS.md, TOOLS.md, USER.md, MEMORY.md, HEARTBEAT.md, SOUL.md, IDENTITY.md). Use when asked to reduce token usage, audit context files, optimize context window, or slim down workspace files. Measures current token cost and identifies what to move, remove, or compress. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1429 次。

如何安装 Context Slimmer?

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

Context Slimmer 是免费的吗?

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

Context Slimmer 支持哪些平台?

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

谁开发了 Context Slimmer?

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

💬 留言讨论