← 返回 Skills 市场
ragesaq

Clawsaver

作者 ragesaq · GitHub ↗ · v1.4.7
cross-platform ✓ 安全检测通过
581
总下载
0
收藏
1
当前安装
29
版本数
在 OpenClaw 中安装
/install clawsaver
功能描述
Reduce model API costs by 20–40% through intelligent message batching. Buffer related messages, send once.
使用说明 (SKILL.md)

ClawSaver

Reduce model API costs by 20–40% through intelligent message batching and buffering.

Most agent systems waste money on redundant API calls. When users send follow-up messages, you call the model separately for each one. ClawSaver fixes this by waiting ~800ms to collect related messages, then sending them together in a single optimized request. Same response quality. Lower cost. No user friction.

How It Works: Batching & Buffering

WITHOUT CLAWSAVER (Context Overhead Hidden):
User:  "What is ML?"
Model: → API Call #1 [Context: system prompt, chat history] (cost: $X)
       Returns: definition

User:  "Give an example"
Model: → API Call #2 [Context: system prompt, chat history, Q1, A1] (cost: $X)
       Returns: example

User:  "Apply to finance?"
Model: → API Call #3 [Context: system prompt, chat history, Q1–A2] (cost: $X)
       Returns: finance application

Total: 3 calls × full context = 3X cost, each call repeats context overhead

───────────────────────────────────────

WITH CLAWSAVER (Single Context Load):
User:  "What is ML?"          ← Buffer (800ms wait)
User:  "Give an example"      ← Buffer (800ms wait)
User:  "Apply to finance?"    ← Flush: Send all 3 together

Model: → API Call #1 [Context loaded ONCE: system prompt, chat history]
       Processes all 3 questions together
       Returns: comprehensive answer addressing all three

Total: 1 call × full context = 1X cost, context overhead paid once

Actual savings (with context): 67% reduction
Cost per token: 1/3 (fewer context re-loads + consolidation)

Why it matters: Context (system prompts, history, instructions) gets re-sent on every API call. With ClawSaver, you pay that context overhead once per batch instead of three times. This compounds the savings beyond just "fewer calls."

Example (4K token context, 200 output tokens):

  • Without ClawSaver: 3 calls × 4,200 tokens = 12,600 tokens
  • With ClawSaver: 1 call × 4,600 tokens = 4,600 tokens
  • Actual savings: 63% token reduction (even better than call reduction)

The Problem

User: "What is machine learning?"
(pause)
User: "Give an example"
(pause)
User: "How does that apply to healthcare?"

Without optimization: 3 API calls = 3x cost
With ClawSaver: 1 batched call = 1/3 the price

Across thousands of conversations, this compounds fast.

How It Works

  1. User sends message → ClawSaver buffers it
  2. Waits ~800ms for follow-ups from same user
  3. If more messages arrive → keep buffering
  4. Timer expires → send all messages together
  5. Model responds once → you get complete answer

Why users don't notice: They're already waiting for your model response. Buffering input doesn't feel slower because the response comes right after the batch sends.

Install

clawhub install clawsaver

Quick Start (10 lines)

import SessionDebouncer from 'clawsaver';

const debouncers = new Map();

function handleMessage(userId, text) {
  if (!debouncers.has(userId)) {
    debouncers.set(userId, new SessionDebouncer(
      userId,
      (msgs) => callModel(userId, msgs)
    ));
  }
  debouncers.get(userId).enqueue({ text });
}

Impact

Metric Value
Cost reduction 20–40% typical
Setup time 10 minutes
Code added ~10 lines
Dependencies 0
File size 4.2 KB
Latency added +800ms (user-imperceptible)
Maintenance None

Three Profiles

Choose based on your use case:

Balanced (Default)

  • 25–35% savings
  • 800ms buffer
  • Chat, Q&A, general conversation

Aggressive

  • 35–45% savings
  • 1.5s buffer
  • Batch workflows, high-volume ingestion

Real-Time

  • 5–10% savings
  • 200ms buffer
  • Interactive, voice-first systems

When to Use

✅ Chat applications
✅ Customer support bots
✅ Multi-turn Q&A
✅ Any conversation with follow-ups

❌ Single-request workflows
❌ Sub-100ms response requirements

API

new SessionDebouncer(userId, handler, {
  debounceMs: 800,      // wait time
  maxWaitMs: 3000,      // absolute max
  maxMessages: 5,       // batch size cap
  maxTokens: 2048       // reserved
})

// Methods
debouncer.enqueue(message)      // add to batch
debouncer.forceFlush(reason)    // send now
debouncer.getState()            // buffer + metrics
debouncer.getStatusString()     // human-readable

Docs

  • START_HERE.md — Navigation (pick your role/timeline)
  • AUTO-INTEGRATION.md — ⭐ Drop-in middleware wrapper (2 min setup)
  • QUICKSTART.md — 5-minute integration
  • INTEGRATION.md — Patterns, edge cases, full config
  • SUMMARY.md — Metrics and ROI (decision makers)
  • SKILL.md — Full API reference
  • example-integration.js — Copy-paste templates

Security

  • No telemetry — Doesn't phone home
  • No network calls — Runs locally
  • No dependencies — Pure JavaScript
  • You control output — You decide what goes to your model

Data never leaves your machine.

License

MIT


Start here: Pick your path in START_HERE.md, or jump to QUICKSTART.md for 5-minute setup.

安全使用建议
High-level: ClawSaver appears coherent for the stated purpose — a small, in-memory session debouncer — and it does not request credentials or system-level access. Before installing or running in production: 1) Inspect SessionDebouncer.js and example-integration.js for any network calls, file-system reads/writes, or eval/child_process usage. 2) Do not run publish.sh or demo scripts until you audit them (they may contact registries). 3) Confirm tests (npm test) run in an isolated environment. 4) Pay attention to the unicode-control-chars scan finding in SKILL.md — open the file in a plain text editor to ensure nothing is hidden or obfuscated. If you want extra assurance, run the package in a staging sandbox and verify no outbound network connections occur during normal operation.
功能分析
Type: OpenClaw Skill Name: clawsaver Version: 1.4.7 The OpenClaw AgentSkills skill bundle 'clawsaver' is a benign utility designed to reduce model API costs by batching user messages. The core JavaScript code (`SessionDebouncer.js`, `clawsaver-auto.js`) is self-contained, has zero external dependencies, and performs no direct network calls or file system operations. The documentation (`SKILL.md`, `README.md`, `AUTO-INTEGRATION.md`) consistently describes a benign purpose and contains no prompt injection attempts against the OpenClaw agent. The `publish.sh` script is for standard package publication and does not contain malicious commands. All claims of 'no telemetry' and 'no network calls' are verified for the skill's core logic.
能力评估
Purpose & Capability
The name/description (batching to reduce model calls) matches the provided code, examples, and docs. The skill requests no env vars or binaries and the included files (SessionDebouncer.js, example integration) are what you'd expect for this purpose.
Instruction Scope
SKILL.md and integration docs keep to batching/flush/metrics behavior and show how to call your own model; they do reference optional use of process.env.CLAWSAVER_PROFILE (an optional tuning hook) but that environment variable is not declared as required. The docs repeatedly assert "no telemetry / no network calls," which is consistent with the described in-memory debouncer, but you should still inspect the code (SessionDebouncer.js, example-integration.js) to confirm there are no hidden network calls or unexpected file reads.
Install Mechanism
There is no install spec (instruction-only at runtime), which is low-risk. However this bundle includes repository scripts (publish.sh, demo.js) that can perform network operations if executed — those are developer/publisher utilities, not required at runtime, but you should avoid running publish.sh or demo scripts until you audit them.
Credentials
The skill declares no required credentials or config paths. The only minor mismatch is optional documentation examples that read process.env.CLAWSAVER_PROFILE — an optional tuning variable, not a required secret. There are no unexplained requests for tokens/keys.
Persistence & Privilege
The skill does not request permanent presence (always is false) and does not attempt to modify other skills' configuration in the provided docs. Behavior is in-memory per-session debouncing; nothing indicates elevated privilege or forced inclusion.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install clawsaver
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /clawsaver 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.4.7
Add context overhead analysis: token savings 60-65% (better than call reduction alone)
v1.4.6
Add visual diagram: batching/buffering mechanics + cost reduction comparison
v1.4.5
Update SKILL.md: align with cost-optimization-first messaging
v1.4.4
Rewrite: lead with token/call optimization (the actual problem we solve), then explain batching.
v1.4.3
README refactored for ClawHub style: condensed, direct, practical. Matches ecosystem standards.
v1.4.2
ClawSaver 1.4.2 Changelog - Major documentation rewrite for greater clarity and ease of use. - Added START_HERE.md as a new starting point for onboarding. - Updated README.md, QUICKSTART.md, SKILL.md, and SUMMARY.md with improved integration guides, simplified explanations, and clearer setup/configuration steps. - Expanded FAQ and real-world examples for rapid evaluation. - No functional code/API changes; usage and interface remain the same.
v1.4.1
ClawSaver v1.4.1 - Major rewrite: Skill converted from pure behavior/instruction-based to a code module with a ready-to-integrate SessionDebouncer class. - Added 17 new files: public API, integration examples, scripts, and expanded documentation (README.md, QUICKSTART.md, etc.). - New features: Exposed batching configuration, session buffer state, metrics tracking, and direct API integration for easy adoption. - Updated documentation: Clear quick start, usage, and config examples, plus real-world batching/cost benchmarks. - Removed legacy batch-instruction listings and scriptless instructional docs. - Streamlined SKILL.md: Modern intro, API reference, and precise install/use steps.
v1.4.0
Removed analyze.py — pure behavior-change skill, zero credentials, zero scripts, clean security scan
v1.3.3
Declare OPENROUTER_MANAGEMENT_KEY as optional env in metadata; analyzer section marked optional with credentials callout; addresses security scanner findings
v1.3.2
Replace raw stats with analyze.py — users measure their own savings; cleaner general framing
v1.3.1
Honest scope language: behavior-change skill not active interceptor; real 233x ratio / 63k avg context stats added
v1.3.0
Dual registration pattern: skills.entries (global) + agents.list (per-agent); updated install docs with both paths
v1.2.0
Add openclaw.json registration instructions; skill is now dogfooded on this instance
v1.1.0
Add /batch commands, ASCII dashboard preview, visceral cost hook intro, checkmark safety format, clean version history
v1.0.14
Revert to 3-column tables — consistent with other ClawHub skills, ClawHub table spacing is just how it is
v1.0.13
Republish
v1.0.12
User manual spacing edits to table cells
v1.0.11
Drop to 2-column tables — renderer cannot handle 3+ columns without spacing collapse
v1.0.10
Units moved to headers (tok/req), bare numbers in cells — eliminates column bleed
v1.0.9
Shorten headers to Before/After/Saved, trim session names to prevent column bleed
元数据
Slug clawsaver
版本 1.4.7
许可证
累计安装 1
当前安装数 1
历史版本数 29
常见问题

Clawsaver 是什么?

Reduce model API costs by 20–40% through intelligent message batching. Buffer related messages, send once. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 581 次。

如何安装 Clawsaver?

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

Clawsaver 是免费的吗?

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

Clawsaver 支持哪些平台?

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

谁开发了 Clawsaver?

由 ragesaq(@ragesaq)开发并维护,当前版本 v1.4.7。

💬 留言讨论