搜索

PythonReactSEOPDF
OpenClaw

openclaw-token-optimizer

Optimize OpenClaw token usage and cost by auditing context injection, trimming workspace files (AGENTS.md/SOUL.md/MEMORY.md and daily memory), enabling prompt caching, heartbeat, context pruning, compaction, memory search or qmd, subagents, model tiering, and cron frequency. Use when a user asks to reduce OpenClaw token spend, speed up sessions, shrink context, or configure openclaw.json and memory search settings.

ccjingeth0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install ccjingeth/openclaw-token-save

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

OpenClaw Token Optimizer

Overview

Deliver a practical audit and configuration plan that cuts input tokens and unnecessary calls while keeping answer quality. Provide concrete config edits, workspace file trimming guidance, and a prioritized rollout plan.

Workflow

1) Scope and locate configuration
  • Identify the OpenClaw config file location (common paths include ~/.openclaw/openclaw.json, .openclaw/openclaw.json, or project root config).
  • List injected workspace files in scope (e.g., AGENTS.md, SOUL.md, TOOLS.md, IDENTITY.md, USER.md, HEARTBEAT.md, MEMORY.md, and memory/YYYY-MM-DD.md).
  • Confirm provider and model support for prompt caching and memory search to avoid proposing unsupported keys.
2) Baseline token sources
  • Break input cost into buckets: system prompt, tool schema, workspace files, memory files, and conversation history.
  • Use a rough sizing method if exact token counts are unavailable (e.g., characters/4 as a quick estimate) and call out that the estimate is approximate.
3) Input reduction (highest ROI)
  • Trim workspace files first. Target budgets:
    • AGENTS.md: keep only essential agent rules and policies.
    • SOUL.md: reduce to short persona bullets.
    • MEMORY.md: keep durable facts only; archive the rest.
    • memory/YYYY-MM-DD.md: prune or rotate daily logs.
  • Remove unused workspace injections in config (e.g., if TOOLS.md or IDENTITY.md is unused).
  • Prefer memory search over full-file injection for large memories. If using qmd, index only needed paths.
4) Cache and context control
  • Enable prompt caching for the primary model when supported. Set cacheRetention to a long window and keep a consistent system prompt to maximize cache hits.
  • Configure heartbeat to keep the cache warm (e.g., ~55 minutes), using a low-cost model and a minimal heartbeat prompt.
  • Enable context pruning with a TTL that matches the cache window to prevent unbounded history growth.
  • Add compaction with me...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/ccjingeth/openclaw-token-save
Version
—
Commit
c67855cf24f996bfb466600cb66b9560b2f17e25
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# OpenClaw Token Optimizer

## Overview
Deliver a practical audit and configuration plan that cuts input tokens and unnecessary calls while keeping answer quality. Provide concrete config edits, workspace file trimming guidance, and a prioritized rollout plan.

## Workflow

### 1) Scope and locate configuration
- Identify the OpenClaw config file location (common paths include `~/.openclaw/openclaw.json`, `.openclaw/openclaw.json`, or project root config).
- List injected workspace files in scope (e.g., `AGENTS.md`, `SOUL.md`, `TOOLS.md`, `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`, `MEMORY.md`, and `memory/YYYY-MM-DD.md`).
- Confirm provider and model support for prompt caching and memory search to avoid proposing unsupported keys.

### 2) Baseline token sources
- Break input cost into buckets: system prompt, tool schema, workspace files, memory files, and conversation history.
- Use a rough sizing method if exact token counts are unavailable (e.g., characters/4 as a quick estimate) and call out that the estimate is approximate.

### 3) Input reduction (highest ROI)
- Trim workspace files first. Target budgets:
  - `AGENTS.md`: keep only essential agent rules and policies.
  - `SOUL.md`: reduce to short persona bullets.
  - `MEMORY.md`: keep durable facts only; archive the rest.
  - `memory/YYYY-MM-DD.md`: prune or rotate daily logs.
- Remove unused workspace injections in config (e.g., if `TOOLS.md` or `IDENTITY.md` is unused).
- Prefer memory search over full-file injection for large memories. If using qmd, index only needed paths.

### 4) Cache and context control
- Enable prompt caching for the primary model when supported. Set `cacheRetention` to a long window and keep a consistent system prompt to maximize cache hits.
- Configure heartbeat to keep the cache warm (e.g., ~55 minutes), using a low-cost model and a minimal heartbeat prompt.
- Enable context pruning with a TTL that matches the cache window to prevent unbounded history growth.
- Add compaction with me...

相关技能

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.