Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

openclaw-cost-optimizationOpenClaw cost optimization 部署

Agent Skill

openclaw-cost-optimization 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

955

周安装

39

GitHub Stars

2

下载量

309
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:openclaw-cost-optimization(OpenClaw cost optimization 部署)
来源仓库:https://github.com/iammarcin/cc4life
仓库路径:skills/openclaw-cost-optimization
安装命令:
npx skills add https://github.com/iammarcin/cc4life --skill openclaw-cost-optimization
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/iammarcin/cc4life --skill openclaw-cost-optimization

简介

openclaw-cost-optimization 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词快速定位候选结果时使用。

  • 适用于成本优化、资源调度和部署效率提升的研究任务场景。
  • 通过关键词和来源仓库筛选,Agent 可返回相关文档或代码片段供进一步分析。
  • 安装前建议确认权限范围和维护状态,注意是否会触发联网或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

OpenClaw Cost Optimization

Your OpenClaw setup is probably burning money on three things: using expensive models for trivial tasks, re-processing the same static files on every message, and loading context the agent never touches.

The default config optimizes for capability. That's fine when you're exploring. But once you're running 24/7, it's the difference between $1,500/month and $150/month or even less.

This skill audits your current setup and applies six optimizations in order of impact. Most take under 5 minutes. Combined, they cut costs by roughly 97% without reducing quality where it matters.


What Claude Gets Wrong Without This

Left to its own defaults, an OpenClaw agent will:

  • Run Sonnet or Opus for "what's the weather?" — that's a Haiku job
  • Load 50KB of context at session start when 8KB would do
  • Send heartbeat checks to a paid API 96 times a day
  • Re-process your SOUL.md and USER.md at full price on every single message
  • Let a search loop burn $20 overnight with no guardrails

None of these are bugs. They're just defaults that weren't designed for 24/7 autonomous operation.


The Six Optimizations

Ordered by impact. Start at #1 and work down.

1. Route the Right Model to the Right Job

Impact: $40-300/month saved depending on usage

This is the single biggest lever. Your agent handles many different types of work — chat, heartbeats, coding, web crawling, image analysis — and each has a model that hits the sweet spot of quality vs cost. Using Opus for a heartbeat check is like hiring a surgeon to take your temperature.

The model routing map:

TaskBest (no budget)Budget alternativeSavings
Chat (brain)Opus 4.6Kimi K2.5Massive — near-Opus intelligence, slightly less personality
Heartbeat checksHaiku 4.5Haiku 4.5 (+ reduce frequency)~$50/month
Coding / overnight devCodex GPT-5.2Miniax 2.1~$250/month on long coding runs
Web browsing / crawlingOpus 4.6DeepSeek V3Hundreds/month if you crawl a lot
Image understandingOpus 4.6Gemini 2.5 FlashSignificant — Flash is very capable on vision
Routine tasksHaiku 4.5Haiku 4.510x cheaper than Sonnet

The key insight: You're not picking ONE cheap model. You're building a roster where each task gets the cheapest model that handles it well.

Default model — set your daily driver to Haiku or Kimi depending on how much personality matters:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-haiku-4-5"
      }
    }
  }
}

Model aliases — define aliases in agents.defaults.models so cron jobs and agents can reference models by short name:

{
  "agents": {
    "defaults": {
      "models": {
        "anthropic/claude-haiku-4-5": { "alias": "haiku" },
        "anthropic/claude-sonnet-4-5": { "alias": "sonnet" },
        "anthropic/claude-opus-4-6": { "alias": "opus" },
        "openai/codex-gpt-5.2": { "alias": "code" },
        "deepseek/deepseek-v3": { "alias": "crawl" },
        "google/gemini-2.5-flash": { "alias": "vision" }
      }
    }
  }
}

Heartbeat frequency matters too. Default is often every 10 minutes. If you're running Opus for heartbeats, that's ~$2/day / ~$54/month just on "anything need attention?" checks. Switch to Haiku AND reduce frequency to every hour:

{
  "heartbeat": {
    "every": "1h",
    "model": "anthropic/claude-haiku-4-5"
  }
}

That alone drops heartbeat costs to $0.01-0.10/day.

Add to your agent's SOUL.md or system prompt:

## Model Selection
Default: Haiku for routine tasks.
Escalate to Sonnet/Opus only for: architecture decisions, code review, security analysis, complex reasoning.
For coding sessions: prefer Codex or dedicated coding model.
For web crawling: use DeepSeek V3.
For image analysis: use Gemini Flash.
When uncertain, try the cheaper model first.

The model follows this as a behavioral constraint. No code changes needed.


2. Cache Stable Context

Impact: up to 90% discount on repeated tokens

Every message re-reads SOUL.md, USER.md, tool definitions, and reference docs. These files don't change between requests. Without caching, you're paying full price to re-process identical content dozens of times a day.

Anthropic's prompt caching charges 10% for cached tokens on reuse. For content you send repeatedly, that's a 90% cut on your most frequent cost.

What to cache (stable, rarely updated):

  • SOUL.md — personality, rules
  • USER.md — user profile, preferences
  • TOOLS.md — tool definitions
  • Reference docs, project specs

What NOT to cache (changes frequently):

  • Daily memory files
  • Conversation history
  • Tool outputs, search results

Config — set cacheRetention per model in agents.defaults.models:

{
  "agents": {
    "defaults": {
      "models": {
        "anthropic/claude-opus-4-6": {
          "alias": "opus",
          "params": { "cacheRetention": "short" }
        }
      }
    }
  }
}
ValueCache DurationNotes
"none"No cachingDisables prompt caching
"short"5 minutesDefault for API key auth
"long"1 hourRequires beta flag
Note: OpenClaw automatically applies "short" (5-min cache) when using Anthropic API key authentication. You only need to set this explicitly if you want "long" or "none".

Tips for maximizing cache hits:

  • Batch related requests within the cache window (5 min for short, 1h for long)
  • Align heartbeat frequency just under the cache TTL (e.g., every 4 min for short, every 55 min for long) to keep caches warm
  • Don't edit SOUL.md mid-conversation — each change invalidates the cache
  • Keep stable content at the top of your context hierarchy

3. Start Sessions Lean

Impact: ~$0.35 saved per session, $10-15/month with frequent use

Many setups eagerly load everything at startup: full memory archives, past conversations, every reference file. Most of it sits unused.

Load only what the agent needs to be itself and understand today:

Load at startupSkip at startup
SOUL.mdFull conversation history
USER.mdPast memory archives
IDENTITY.mdResearch docs from old projects
Today's memory fileOther agents' files

For everything else: pull on demand. When a topic comes up that needs historical context, use memory search:

"Search my memory for what we discussed about the marketing campaign"

Semantic search retrieves the relevant passages without loading the entire history. This is both cheaper and more effective — targeted retrieval beats brute-force loading.

Add to your agent's instructions:

## Session Startup
Load ONLY: SOUL.md, USER.md, IDENTITY.md, today's memory file.
For prior context: use memory_search() on demand. Don't pre-load history.

Result: Sessions start with ~8KB of context instead of 50KB+. The agent is faster, cheaper, and paradoxically better — less noise in the context means more focused responses.


4. Route Heartbeats to a Local Model

Impact: $5-15/month saved

Heartbeats are periodic checks — "anything need attention?" — that run every 15-60 minutes. They're simple tasks that don't need frontier reasoning. But by default, each one is a paid API call.

Route them to a free local model via Ollama instead.

Setup:

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Pull a lightweight model (2GB, handles heartbeat tasks easily)
ollama pull llama3.2:3b

Config:

{
  "heartbeat": {
    "model": "ollama/llama3.2:3b"
  }
}

Why it works: Heartbeat tasks are classification problems — "is there something that needs attention?" A 3B parameter model running locally answers this with zero issues. The quality difference from Sonnet is nonexistent for yes/no monitoring, and the cost drops to zero on your API bill.

Requirements: A machine running Ollama with ~2GB free RAM. If OpenClaw already runs on a home server or VPS, you have this.


5. Set Rate Limits and Budget Caps

Impact: prevents $50-200/month in runaway costs

AI agents can loop. A search spawns follow-up searches. A debugging session fires dozens of API calls in seconds. Without guardrails, a single runaway interaction can burn through a day's budget in minutes.

Add to SOUL.md or system prompt:

## API Discipline
- 5 seconds minimum between consecutive API calls
- 10 seconds minimum between web searches
- Max 5 searches per batch, then pause 2 minutes
- If a task needs more than 10 API calls, ask before continuing
- On rate limit error (429): stop, wait 5 minutes, retry once

Budget discipline via behavioral rules:

OpenClaw doesn't have a native budget config key. Instead, enforce limits through your agent's instructions and external monitoring:

  1. Set Anthropic API spend alerts — configure billing alerts directly in Anthropic Console or your provider dashboard
  2. Add behavioral limits to SOUL.md (see above) — the agent will self-regulate
  3. Monitor with the CLI:
openclaw cron list --all --json  # Check what's running and on which model
  1. Track via Anthropic usage dashboard — review daily/weekly spend patterns

Rate limits prevent waste during normal operation. Provider-level budget alerts catch edge cases. Together: predictable spending without limiting capability.


6. Trim Your Workspace Files

Impact: incremental but compounding — saves on every single request

SOUL.md, USER.md, and similar files load on every interaction. Every unnecessary line costs tokens not once, but on every message. A 200-line SOUL.md that could be 80 lines is silently 2-3x more expensive than it needs to be on your highest-frequency cost.

The audit question for each line: "Does the agent need this to do its job?"

What stays:

  • Core personality (2-3 sentences, not paragraphs)
  • Hard behavioral rules that change output
  • Communication preferences
  • Operational constraints

What goes:

  • Backstory or lore (move to a reference doc, load on demand)
  • Redundant restatements of the same rule
  • Verbose explanations of things Claude already knows
  • "Nice to have" context that doesn't affect responses

Before (bloated, 85 tokens):

## Communication Style
You should always communicate in a way that is clear, concise, and helpful.
When talking to the user, make sure your responses are well-structured and easy
to follow. Use bullet points when listing things. Don't write overly long
responses unless the topic genuinely requires depth. The user values efficiency.

After (lean, 22 tokens):

## Style
Direct and concise. Use structure for complex answers. Match depth to the question.

Same behavior. One-fourth the cost, multiplied by every message.


Combined Impact

OptimizationMonthly SavingsSetup Time
Default to Haiku$40-605 min
Prompt caching$15-302 min
Lean startup context$10-1530 min
Local heartbeats$5-1515 min
Rate limits + budgets$50-200 (prevention)10 min
Trim workspace files$5-101 hour

From $1,500+/month to $30-50/month.

Model routing and caching deliver the biggest absolute savings. Workspace trimming compounds over time because it reduces cost on every interaction.


How to Apply This

You don't need to hand-edit JSON files for most of these. Tell your OpenClaw agent:

"Switch your default model to Haiku. Only use Sonnet for complex reasoning tasks."
"Enable prompt caching — set cacheRetention to 'long' for my Anthropic models."
"Add API discipline rules to my SOUL.md — rate limits, search batching, and escalation thresholds."
"Audit my SOUL.md and USER.md — flag anything that doesn't directly affect your output quality."

OpenClaw can modify its own config in most cases. Just ask.


Verifying It Works

Verification Commands

Check actual model per cron job (the table view hides this — you MUST use JSON):

openclaw cron list --all --json

Look at each job's payload.model field. Don't assume from the agent assignment — cron jobs can override the agent's default model.

Check heartbeat status per agent (config is in ~/.openclaw/openclaw.json):

cat ~/.openclaw/openclaw.json | python3 -c "
import json,sys; c=json.load(sys.stdin)
d=c['agents']['defaults'].get('heartbeat',{}).get('every','')
print(f'Default: {d or \"(disabled)\"}')
for a in c['agents']['list']:
    e=a.get('heartbeat',{}).get('every',d)
    print(f'{a[\"id\"]}: {e or \"(disabled)\"}')
"

Agents without a heartbeat block inherit the default. An agent running on Opus with every: "15m" inherited = your biggest cost line.

Check bootstrap context size:

wc -c SOUL.md USER.md AGENTS.md MEMORY.md

What Good Looks Like

  • Context size: Should be 2-8KB at session start, not 50KB+
  • Default model: Should show Haiku, not Sonnet
  • Cron jobs: Each job's payload.model should match its complexity (Haiku for checkers, Sonnet for structured tasks, Opus only for creative/complex work)
  • Heartbeat: Should route to Ollama/local or Haiku at minimum
  • Daily costs: Should drop to $0.10-0.50 range within the first day

If costs haven't dropped, the most common issue is the system prompt not loading the model selection rules. Verify your SOUL.md changes are being picked up.

Common Audit Mistake

Don't infer cron job models from the agent assignment. openclaw cron list table shows Agent: sherlock but the job itself may override the model in its payload. Always check openclaw cron list --all --json for the actual payload.model field.


Anti-Patterns

"I'll just use Haiku for everything, including complex tasks." Don't. Haiku is fast and cheap but genuinely worse at multi-step reasoning, nuanced analysis, and creative work. The goal is right-sizing, not downgrading. Escalate when quality matters.

"I'll cache everything to save money." Caching volatile content (daily notes, tool outputs) wastes the cache slot and provides no benefit. Cache only what's stable.

"I'll set the budget to $1/day to be safe." Too aggressive. Your agent will hit the cap during legitimate work and stop mid-task. Start at $5/day, observe for a week, then adjust based on actual patterns.

"I trimmed SOUL.md to 10 lines and now the agent acts weird." You cut too deep. Some personality and behavioral rules genuinely affect output quality. Trim the fat, keep the muscle. If behavior degrades, add back the specific rule that was controlling it.


Quality Check

Before sharing this config with others:

  • Default model is Haiku (not Sonnet/Opus)
  • Caching enabled for stable files
  • Session startup loads only essentials
  • Heartbeat routes to local model (or cheapest available)
  • Budget caps set with warning threshold
  • Workspace files audited for unnecessary content
  • Agent behavior verified — no quality regression on important tasks

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.42%
按下载量换算109

Claude

30.32%
按下载量换算94

Cursor

16.57%
按下载量换算51

Gemini CLI

8.31%
按下载量换算26

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills